[freeside-commits] branch master updated. d3c4fed49558ea5a99d379bf7e1cbefc8049d2d0

Ivan ivan at 420.am
Mon May 13 14:19:08 PDT 2013


The branch, master has been updated
       via  d3c4fed49558ea5a99d379bf7e1cbefc8049d2d0 (commit)
      from  178a4a3b111cb1cae3b44b2de4a86c8491096bfa (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 d3c4fed49558ea5a99d379bf7e1cbefc8049d2d0
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon May 13 14:19:07 2013 -0700

    add anniversary-rollback option to roll the anniversary date back to the 28th instead of forward into the following month, RT#22723

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 3c44520..0a9b781 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -866,6 +866,13 @@ sub reason_type_options {
   },
 
   {
+    'key'         => 'anniversary-rollback',
+    'section'     => 'billing',
+    'description' => 'When billing an anniversary package ordered after the 28th, roll the anniversary date back to the 28th instead of forward into the following month.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'encryption',
     'section'     => 'billing',
     'description' => 'Enable encryption of credit cards and echeck numbers',
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index e788269..605c84f 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -1081,6 +1081,9 @@ sub add_freq {
   if ( $freq =~ /^\d+$/ ) {
     $mon += $freq;
     until ( $mon < 12 ) { $mon -= 12; $year++; }
+
+    $mday = 28 if $mday > 28 && FS::Conf->new->exists('anniversary-rollback');
+
   } elsif ( $freq =~ /^(\d+)w$/ ) {
     my $weeks = $1;
     $mday += $weeks * 7;

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

Summary of changes:
 FS/FS/Conf.pm     |    7 +++++++
 FS/FS/part_pkg.pm |    3 +++
 2 files changed, 10 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list