agent-virt batches and batchconfig-eftcanada config (argh!), RT#14859
[freeside.git] / FS / FS / cust_main.pm
index dd0fd74..0788e15 100644 (file)
@@ -211,6 +211,10 @@ phone (optional)
 
 phone (optional)
 
+=item mobile
+
+phone (optional)
+
 =item ship_first
 
 Shipping first name
@@ -257,6 +261,10 @@ phone (optional)
 
 phone (optional)
 
+=item ship_mobile
+
+phone (optional)
+
 =item payby
 
 Payment Type (See L<FS::payinfo_Mixin> for valid payby values)
@@ -329,6 +337,10 @@ Discourage individual CDR printing, empty or `Y'
 
 Allow self-service editing of ticket subjects, empty or 'Y'
 
+=item calling_list_exempt
+
+Do not call, empty or 'Y'
+
 =back
 
 =head1 METHODS
@@ -1693,6 +1705,7 @@ sub check {
     || $self->ut_floatn('credit_limit')
     || $self->ut_numbern('billday')
     || $self->ut_enum('edit_subject', [ '', 'Y' ] )
+    || $self->ut_enum('calling_list_exempt', [ '', 'Y' ] )
     || $self->ut_enum('locale', [ '', FS::Locales->locales ])
   ;
 
@@ -1747,9 +1760,10 @@ sub check {
   }
 
   $error =
-    $self->ut_phonen('daytime', $self->country)
-    || $self->ut_phonen('night', $self->country)
-    || $self->ut_phonen('fax', $self->country)
+       $self->ut_phonen('daytime', $self->country)
+    || $self->ut_phonen('night',   $self->country)
+    || $self->ut_phonen('fax',     $self->country)
+    || $self->ut_phonen('mobile',  $self->country)
   ;
   return $error if $error;
 
@@ -1759,7 +1773,7 @@ sub check {
   }
 
   if ( $conf->exists('cust_main-require_phone')
-       && ! length($self->daytime) && ! length($self->night)
+       && ! length($self->daytime) && ! length($self->night) && ! length($self->mobile)
      ) {
 
     my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
@@ -1768,8 +1782,12 @@ sub check {
     my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
                         ? 'Night Phone'
                         : FS::Msgcat::_gettext('night');
-  
-    return "$daytime_label or $night_label is required"
+
+    my $mobile_label = FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
+                        ? 'Mobile Phone'
+                        : FS::Msgcat::_gettext('mobile');
+
+    return "$daytime_label, $night_label or $mobile_label is required"
   
   }
 
@@ -1807,9 +1825,10 @@ sub check {
     #eofalse
 
     $error =
-      $self->ut_phonen('ship_daytime', $self->ship_country)
-      || $self->ut_phonen('ship_night', $self->ship_country)
-      || $self->ut_phonen('ship_fax', $self->ship_country)
+         $self->ut_phonen('ship_daytime', $self->ship_country)
+      || $self->ut_phonen('ship_night',   $self->ship_country)
+      || $self->ut_phonen('ship_fax',     $self->ship_country)
+      || $self->ut_phonen('ship_mobile',  $self->ship_country)
     ;
     return $error if $error;
 
@@ -1935,9 +1954,6 @@ sub check {
     if ( $conf->exists('cust_main-require-bank-branch') ) {
       $payinfo =~ /^(\d+)\@(\d+)\.(\d+)$/ or return 'invalid echeck account@branch.bank';
       $payinfo = "$1\@$2.$3";
-    } elsif ( $conf->exists('echeck-no_routing') ) {
-      $payinfo =~ /^(\d+)\@(\d*)$/ or return 'invalid echeck account';
-      $payinfo = "$1\@$2";
     } elsif ( $conf->exists('echeck-nonus') ) {
       $payinfo =~ /^(\d+)\@(\d+)$/ or return 'invalid echeck account@aba';
       $payinfo = "$1\@$2";
@@ -2062,7 +2078,7 @@ Returns a list of fields which have ship_ duplicates.
 sub addr_fields {
   qw( last first company
       address1 address2 city county state zip country
-      daytime night fax
+      daytime night fax mobile
     );
 }
 
@@ -2465,6 +2481,7 @@ sub batch_card {
     'status' => 'O',
     'payby'  => FS::payby->payby2payment($payby),
   );
+  $pay_batch{agentnum} = $self->agentnum if $conf->exists('batch-spoolagent');
 
   my $pay_batch = qsearchs( 'pay_batch', \%pay_batch );