add global_unique-pbx_title to disable duplicate checking on svc_pbx.title
authorivan <ivan>
Tue, 29 Jun 2010 01:40:25 +0000 (01:40 +0000)
committerivan <ivan>
Tue, 29 Jun 2010 01:40:25 +0000 (01:40 +0000)
FS/FS/Conf.pm
FS/FS/svc_pbx.pm

index 11658a8..cd2792b 100644 (file)
@@ -2194,6 +2194,14 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'global_unique-pbx_title',
+    'section'     => '',
+    'description' => 'Global phone number uniqueness control: enabled (usual setting - title must e unique), or disabled turns off duplicate checking for this field.',
+    'type'        => 'select',
+    'select_enum' => [ 'enabled', 'disabled' ],
+  },
+
+  {
     'key'         => 'svc_external-skip_manual',
     'section'     => 'UI',
     'description' => 'When provisioning svc_external services, skip manual entry of id and title fields in the UI.  Usually used in conjunction with an export that populates these fields (i.e. artera_turbo).',
index 7c4385c..d2760a5 100644 (file)
@@ -3,6 +3,7 @@ package FS::svc_pbx;
 use strict;
 use base qw( FS::svc_External_Common );
 use FS::Record qw( qsearch qsearchs dbh );
+use FS::Conf;
 use FS::cust_svc;
 use FS::svc_phone;
 use FS::svc_acct;
@@ -258,6 +259,9 @@ sub check {
 sub _check_duplicate {
   my $self = shift;
 
+  my $conf = new FS::Conf;
+  return '' if $conf->config('global_unique-pbx_title') eq 'disabled';
+
   $self->lock_table;
 
   if ( qsearchs( 'svc_pbx', { 'title' => $self->title } ) ) {