[freeside-commits] branch FREESIDE_4_BRANCH updated. 5eb48cca81177ae5336fd014808eefe5cc75c8f4

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


The branch, FREESIDE_4_BRANCH has been updated
       via  5eb48cca81177ae5336fd014808eefe5cc75c8f4 (commit)
      from  1c0d446903667479a85385015cc5fa1dda60a280 (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 5eb48cca81177ae5336fd014808eefe5cc75c8f4
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Mar 8 21:24:23 2017 -0800

    End of Month invoice terms, RT#74050

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 482ce8c..0cafe9b 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 = (
@@ -5935,6 +5935,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 5d7fe32..3e027d3 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