summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-05-13 14:19:09 -0700
committerIvan Kohler <ivan@freeside.biz>2013-05-13 14:19:09 -0700
commit59d2b76f21d930235e7cde6822be8d338a26b777 (patch)
tree86c8be53e1d5fd707aab481148b80180cb4bbca2
parentb24f2ed54a7aad4772a6d7c04035887f59fb3fe2 (diff)
add anniversary-rollback option to roll the anniversary date back to the 28th instead of forward into the following month, RT#22723
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/part_pkg.pm3
2 files changed, 10 insertions, 0 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 36947ad82..10b2b810e 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -837,6 +837,13 @@ my @cdr_formats = (
},
{
+ '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 4054c2f36..5424db5c0 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -927,6 +927,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;