[freeside-commits] freeside/FS/FS Conf.pm, 1.468.2.25, 1.468.2.26 Schema.pm, 1.317.2.19, 1.317.2.20 cust_bill.pm, 1.350.2.16, 1.350.2.17 cust_bill_ApplicationCommon.pm, 1.21, 1.21.6.1

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


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

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	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.317.2.19
retrieving revision 1.317.2.20
diff -u -w -d -r1.317.2.19 -r1.317.2.20
--- Schema.pm	29 Nov 2011 23:53:33 -0000	1.317.2.19
+++ Schema.pm	8 Dec 2011 21:13:57 -0000	1.317.2.20
@@ -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.468.2.25
retrieving revision 1.468.2.26
diff -u -w -d -r1.468.2.25 -r1.468.2.26
--- Conf.pm	7 Dec 2011 04:49:25 -0000	1.468.2.25
+++ Conf.pm	8 Dec 2011 21:13:56 -0000	1.468.2.26
@@ -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.21.6.1
diff -u -w -d -r1.21 -r1.21.6.1
--- cust_bill_ApplicationCommon.pm	19 Jun 2010 18:59:06 -0000	1.21
+++ cust_bill_ApplicationCommon.pm	8 Dec 2011 21:13:57 -0000	1.21.6.1
@@ -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.350.2.16
retrieving revision 1.350.2.17
diff -u -w -d -r1.350.2.16 -r1.350.2.17
--- cust_bill.pm	7 Dec 2011 05:50:46 -0000	1.350.2.16
+++ cust_bill.pm	8 Dec 2011 21:13:57 -0000	1.350.2.17
@@ -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