From: Ivan Kohler Date: Mon, 13 May 2013 21:19:09 +0000 (-0700) Subject: add anniversary-rollback option to roll the anniversary date back to the 28th instead... X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=59d2b76f21d930235e7cde6822be8d338a26b777;p=freeside.git 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 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;