[freeside-commits] freeside/FS/FS Conf.pm, 1.493, 1.494 Schema.pm, 1.339, 1.340 cust_bill.pm, 1.366, 1.367 cust_bill_ApplicationCommon.pm, 1.21, 1.22

Mark Wells mark at wavetail.420.am
Thu Dec 8 13:13:18 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv3784/FS/FS

Modified Files:
	Conf.pm Schema.pm cust_bill.pm cust_bill_ApplicationCommon.pm 
Log Message:
promised payment date for invoices, #13554

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.339
retrieving revision 1.340
diff -u -w -d -r1.339 -r1.340
--- Schema.pm	29 Nov 2011 23:53:22 -0000	1.339
+++ Schema.pm	8 Dec 2011 21:13:16 -0000	1.340
@@ -532,6 +532,7 @@
         'closed',      'char', 'NULL',  1, '', '', #not yet used much
         'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements
         'agent_invid',  'int', 'NULL', '', '', '', #(varchar?) importing legacy
+        'promised_date', @date_type,       '', '',
       ],
       'primary_key' => 'invnum',
       'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum?  huh

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.493
retrieving revision 1.494
diff -u -w -d -r1.493 -r1.494
--- Conf.pm	7 Dec 2011 04:49:20 -0000	1.493
+++ Conf.pm	8 Dec 2011 21:13:16 -0000	1.494
@@ -4683,6 +4683,13 @@
   },
   
   {
+    'key'         => 'cust_bill-enable_promised_date',
+    'section'     => 'UI',
+    'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
+    'type'        => 'checkbox',
+  },
+  
+  {
     'key'         => 'available-locales',
     'section'     => '',
     'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',

Index: cust_bill_ApplicationCommon.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_ApplicationCommon.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -d -r1.21 -r1.22
--- cust_bill_ApplicationCommon.pm	19 Jun 2010 18:59:06 -0000	1.21
+++ cust_bill_ApplicationCommon.pm	8 Dec 2011 21:13:16 -0000	1.22
@@ -435,6 +435,17 @@
 
   }
 
+  # unset promised payment date if there is one
+  my $cust_bill = $self->cust_bill;
+  if ( $cust_bill->promised_date and $cust_bill->owed <= 0 ) {
+    $cust_bill->set('promised_date', '');
+    my $error = $cust_bill->replace;
+    if ( $error ) {
+      $dbh->rollback if $oldAutoCommit;
+      return $error;
+    }
+  }
+  
   #everything should always be applied to line items in full now... sanity check
   $applied = sprintf('%.2f', $applied);
   unless ( $applied == $self->amount ) {

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.366
retrieving revision 1.367
diff -u -w -d -r1.366 -r1.367
--- cust_bill.pm	7 Dec 2011 05:50:32 -0000	1.366
+++ cust_bill.pm	8 Dec 2011 21:13:16 -0000	1.367
@@ -144,6 +144,8 @@
 
 =item agent_invid - legacy invoice number
 
+=item promised_date - customer promised payment date, for collection
+
 =back
 
 =head1 METHODS
@@ -5622,6 +5624,15 @@
 
   }
 
+  #promised_date - also has an option to accept nulls
+  if ( $param->{promised_date} ) {
+    my($beginning, $ending, $null) = @{$param->{promised_date}};
+
+    push @search, "(( cust_bill.promised_date >= $beginning AND ".
+                    "cust_bill.promised_date <  $ending )" .
+                    ($null ? ' OR cust_bill.promised_date IS NULL ) ' : ')');
+  }
+
   #agent virtualization
   my $curuser = $FS::CurrentUser::CurrentUser;
   if ( $curuser->username eq 'fs_queue'



More information about the freeside-commits mailing list