[freeside-commits] freeside/FS/FS Conf.pm, 1.180.2.13, 1.180.2.14 cust_main.pm, 1.271.2.21, 1.271.2.22

Ivan,,, ivan at wavetail.420.am
Mon Sep 10 18:34:02 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv23498

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	Conf.pm cust_main.pm 
Log Message:
add cust_main-require_phone and cust_main-require_invoicing_list_email options

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.180.2.13
retrieving revision 1.180.2.14
diff -u -d -r1.180.2.13 -r1.180.2.14
--- Conf.pm	23 Aug 2007 08:23:33 -0000	1.180.2.13
+++ Conf.pm	11 Sep 2007 01:34:00 -0000	1.180.2.14
@@ -2135,6 +2135,20 @@
 
   
 
+  {
+    'key'         => 'cust_main-require_phone',
+    'section'     => '',
+    'description' => 'Require daytime or night for all customer records.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'cust_main-require_invoicing_list_email',
+    'section'     => '',
+    'description' => 'Require at least one invoicing email address for all customer records.',
+    'type'        => 'checkbox',
+  },
+
 );
 
 1;

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.271.2.21
retrieving revision 1.271.2.22
diff -u -d -r1.271.2.21 -r1.271.2.22
--- cust_main.pm	16 Aug 2007 00:00:05 -0000	1.271.2.21
+++ cust_main.pm	11 Sep 2007 01:34:00 -0000	1.271.2.22
@@ -350,7 +350,8 @@
     $error = $self->check_invoicing_list( $invoicing_list );
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
-      return "checking invoicing_list (transaction rolled back): $error";
+      #return "checking invoicing_list (transaction rolled back): $error";
+      return $error;
     }
     $self->invoicing_list( $invoicing_list );
   }
@@ -1273,6 +1274,21 @@
   ;
   return $error if $error;
 
+  if ( $conf->exists('cust_main-require_phone')
+       && ! length($self->daytime) && ! length($self->night)
+     ) {
+
+    my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
+                          ? 'Day Phone'
+                          : FS::Msgcat::_gettext('daytime');
+    my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
+                        ? 'Night Phone'
+                        : FS::Msgcat::_gettext('night');
+  
+    return "$daytime_label or $night_label is required"
+  
+  }
+
   my @addfields = qw(
     last first company address1 address2 city county state zip
     country daytime night fax
@@ -3749,7 +3765,8 @@
 
 sub check_invoicing_list {
   my( $self, $arrayref ) = @_;
-  foreach my $address ( @{$arrayref} ) {
+
+  foreach my $address ( @$arrayref ) {
 
     if ($address eq 'FAX' and $self->getfield('fax') eq '') {
       return 'Can\'t add FAX invoice destination with a blank FAX number.';
@@ -3764,7 +3781,13 @@
                 : $cust_main_invoice->checkdest
     ;
     return $error if $error;
+
   }
+
+  return "Email address required"
+    if $conf->exists('cust_main-require_invoicing_list_email')
+    && ! grep { $_ !~ /^([A-Z]+)$/ } @$arrayref;
+
   '';
 }
 



More information about the freeside-commits mailing list