diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-05-13 14:19:08 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-05-13 14:19:08 -0700 |
commit | c1f7dc4627e48b52e059c79fcae24873bec733da (patch) | |
tree | 3ed473fa675b9ff89ad31ec606f49b63c2460a18 /FS/FS | |
parent | 1ab861a30013585eadb02bdef9e2fa073a67ee61 (diff) |
add anniversary-rollback option to roll the anniversary date back to the 28th instead of forward into the following month, RT#22723
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/part_pkg.pm | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index d955f34ae..323bd22f7 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 e788269f7..605c84f95 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; |