[freeside-commits] branch master updated. 31e2411af8f9b34986942a6264e8229d9f60b923

Ivan ivan at 420.am
Wed Mar 8 21:24:22 PST 2017


The branch, master has been updated
       via  31e2411af8f9b34986942a6264e8229d9f60b923 (commit)
      from  dacdaebc0eeacb4705dd5d5f09563d711e81dfd3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 31e2411af8f9b34986942a6264e8229d9f60b923
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Mar 8 21:24:22 2017 -0800

    End of Month invoice terms, RT#74050

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4bc7404..34e465d 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -621,8 +621,8 @@ logo.eps
   '',
   'Payable upon receipt',
   'Net 0', 'Net 3', 'Net 5', 'Net 7', 'Net 9', 'Net 10', 'Net 14', 
-  'Net 15', 'Net 18', 'Net 20', 'Net 21', 'Net 25', 'Net 30', 'Net 45', 
-  'Net 60', 'Net 90'
+  'Net 15', 'Net 18', 'Net 20', 'Net 21', 'Net 25', 'End of Month', 'Net 30',
+  'Net 45', 'Net 60', 'Net 90'
 );
 
 my %msg_template_options = (
@@ -5885,6 +5885,14 @@ and customer address. Include units.',
     'type'        => 'text',
   },
 
+  {
+    'key'         => 'selfservice-db_profile',
+    'section'     => 'development',
+    'description' => 'Enable collection and logging of database profiling information for self-service servers.  This has significant overhead, do not leave enabled in production beyond that necessary to collect profiling data.',
+    'type'        => 'checkbox',
+  },
+
+
   # for internal use only; test databases should declare this option and
   # everyone else should pretend it doesn't exist
   #{
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 62d15a3..7eae34a 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -10,6 +10,7 @@ use vars qw( $invoice_lines @buf ); #yuck
 use List::Util qw(sum); #can't import first, it conflicts with cust_main.first
 use Date::Format;
 use Date::Language;
+use Time::Local qw( timelocal );
 use Text::Template 1.20;
 use File::Temp 0.14;
 use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
@@ -1924,6 +1925,12 @@ sub due_date {
   my $duedate = '';
   if ( $self->terms =~ /^\s*Net\s*(\d+)\s*$/ ) {
     $duedate = $self->_date() + ( $1 * 86400 );
+  } elsif ( $self->terms =~ /^End of Month$/ ) {
+    my ($mon,$year) = (localtime($self->_date) )[4,5];
+    $mon++;
+    until ( $mon < 12 ) { $mon -= 12; $year++; }
+    my $nextmonth_first = timelocal(0,0,0,1,$mon,$year);
+    $duedate = $nextmonth_first - 86400;
   }
   $duedate;
 }

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm           |   12 ++++++++++--
 FS/FS/Template_Mixin.pm |    7 +++++++
 2 files changed, 17 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list