[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 7c9d0e84f7cdf6cd6af3dea9399f2ad30015875f
Ivan
ivan at 420.am
Sun Jul 8 22:43:27 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via 7c9d0e84f7cdf6cd6af3dea9399f2ad30015875f (commit)
from b3d471fc5a646dc0197dd177873899e5b240ea33 (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 7c9d0e84f7cdf6cd6af3dea9399f2ad30015875f
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun Jul 8 22:43:19 2012 -0700
per-package flags to override package def level suspend_bill flag, RT#18376
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index e9cac8d..ef51fdb 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -953,7 +953,10 @@ sub _make_lines {
my @recur_discounts = ();
my $sdate;
if ( ! $cust_pkg->start_date
- and ( ! $cust_pkg->susp || $part_pkg->option('suspend_bill', 1) )
+ and ( ! $cust_pkg->susp || $cust_pkg->option('suspend_bill',1)
+ || ( $part_pkg->option('suspend_bill', 1) )
+ && ! $cust_pkg->option('no_suspend_bill',1)
+ )
and
( $part_pkg->freq ne '0' && ( $cust_pkg->bill || 0 ) <= day_end($time) )
|| ( $part_pkg->plan eq 'voip_cdr'
diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm
index 5145753..2aec35c 100644
--- a/FS/FS/cust_main/Packages.pm
+++ b/FS/FS/cust_main/Packages.pm
@@ -408,7 +408,11 @@ sub billing_pkgs {
my $self = shift;
grep { my $part_pkg = $_->part_pkg;
$part_pkg->freq ne '' && $part_pkg->freq ne '0'
- && ( ! $_->susp || $part_pkg->option('suspend_bill', 1) );
+ && ( ! $_->susp || $_->option('suspend_bill',1)
+ || ( $part_pkg->option('suspend_bill', 1)
+ && ! $_->option('no_suspend_bill',1)
+ )
+ );
}
$self->ncancelled_pkgs;
}
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index d16881a..1c79ed7 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -1176,8 +1176,13 @@ sub suspend {
$hash{'resume'} = $resume_date;
}
+ $options{options} ||= {};
+
my $new = new FS::cust_pkg ( \%hash );
- $error = $new->replace( $self, options => { $self->options } );
+ $error = $new->replace( $self, options => { $self->options,
+ %{ $options{options} },
+ }
+ );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html
index 348f0a6..f9a46a8 100755
--- a/httemplate/misc/cancel_pkg.html
+++ b/httemplate/misc/cancel_pkg.html
@@ -62,7 +62,19 @@
&>
% }
-% if ( ( $method eq 'adjourn' or $method eq 'suspend' ) and
+% if ( $method eq 'adjourn' || $method eq 'suspend' ) {
+ <TR><TD COLSPAN=2>
+% if ( $part_pkg->option('suspend_bill', 1) ) {
+ <& /elements/checkbox.html, name=>'no_suspend_bill', value=>'Y' &>
+ Disable recurring billing while suspended
+% } else {
+ <& /elements/checkbox.html, name=>'suspend_bill', value=>'Y' &>
+ Continue recurring billing while suspended
+% }
+ </TD></TR>
+% }
+
+% if ( ( $method eq 'adjourn' || $method eq 'suspend' ) and
% $curuser->access_right('Unsuspend customer package') ) { #later?
% my $resume_date = $cgi->param('error')
% ? str2time($cgi->param('resume_date'))
diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html
index b2d7bfa..79e489c 100755
--- a/httemplate/misc/process/cancel_pkg.html
+++ b/httemplate/misc/process/cancel_pkg.html
@@ -52,10 +52,15 @@ if ($method eq 'expire' || $method eq 'adjourn' || $method eq 'resume') {
$method = 'unsuspend' if $method eq 'resume';
}
-my $resume_date;
+my $resume_date = '';
+my $options = '';
if ( $method eq 'suspend' ) { #or 'adjourn'
$resume_date = parse_datetime($cgi->param('resume_date'))
if $cgi->param('resume_date');
+
+ $options = { map scalar($cgi->param($_)),
+ suspend_bill no_suspend_bill
+ };
}
my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} );
@@ -88,6 +93,7 @@ my $error = $cust_pkg->$method( 'reason' => $reasonnum,
'last_bill' => $last_bill,
'bill' => $bill,
'svc_fatal' => $svc_fatal,
+ 'options' => $options,
);
if ($error) {
diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index 4aec90e..e901774 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -73,7 +73,12 @@
<% pkg_status_row_changed( $cust_pkg, %opt, 'colspan'=>$colspan ) %>
<% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %>
-% if ( $part_pkg->option('suspend_bill', 1) ) {
+% if ( $cust_pkg->option('suspend_bill', 1)
+% || ( $part_pkg->option('suspend_bill', 1)
+% && ! $cust_pkg->option('no_suspend_bill',1)
+% )
+% )
+% {
<% pkg_status_row_if( $cust_pkg, emt('Next bill'), 'bill', %opt, curuser=>$curuser ) %>
% }
<% pkg_status_row_if( $cust_pkg, emt('Will resume'), 'resume', %opt, curuser=>$curuser ) %>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Billing.pm | 5 ++++-
FS/FS/cust_main/Packages.pm | 6 +++++-
FS/FS/cust_pkg.pm | 7 ++++++-
httemplate/misc/cancel_pkg.html | 14 +++++++++++++-
httemplate/misc/process/cancel_pkg.html | 8 +++++++-
httemplate/view/cust_main/packages/status.html | 7 ++++++-
6 files changed, 41 insertions(+), 6 deletions(-)
More information about the freeside-commits
mailing list