summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-09-16 21:38:07 -0700
committerMark Wells <mark@freeside.biz>2014-09-16 21:38:15 -0700
commit7a486dea647f735a9a1d0381443218ad6affe6e1 (patch)
tree33fffd4cfdf1288767ba61da6ee58c358daaa76a /httemplate
parent43da86c4a7fab275a941650abb11173f4f2930aa (diff)
improve unsuspend behavior for packages on hold, #28508
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/misc/cust_main-unsuspend.cgi10
-rw-r--r--httemplate/misc/unsuspend_cust.html26
-rw-r--r--httemplate/view/cust_main/packages/status.html3
3 files changed, 35 insertions, 4 deletions
diff --git a/httemplate/misc/cust_main-unsuspend.cgi b/httemplate/misc/cust_main-unsuspend.cgi
index eb4a2c8..e8ac8d3 100755
--- a/httemplate/misc/cust_main-unsuspend.cgi
+++ b/httemplate/misc/cust_main-unsuspend.cgi
@@ -34,6 +34,10 @@ if($cgi->param('now_or_later')) {
if($resume) {
#warn "setting resume dates on custnum#$custnum\n";
my @pkgs = $cust_main->suspended_pkgs;
+ if (!$cgi->param('release_hold')) {
+ # then avoid packages that are on hold
+ @pkgs = grep { $_->get('setup') } @pkgs;
+ }
@errors = grep {$_} map { $_->unsuspend(
'date' => $resume,
) } @pkgs;
@@ -42,9 +46,13 @@ if($cgi->param('now_or_later')) {
@errors = ("error parsing adjourn date: ".$cgi->param('adjourn'));
}
}
-else {
+else { # unsuspending now
warn "unsuspending $cust_main";
@errors = $cust_main->unsuspend;
+
+ if ( $cgi->param('release_hold') ) {
+ push @errors, $cust_main->release_hold;
+ }
}
my $error = join(' / ', @errors) if scalar(@errors);
diff --git a/httemplate/misc/unsuspend_cust.html b/httemplate/misc/unsuspend_cust.html
index 600eb26..4555a58 100644
--- a/httemplate/misc/unsuspend_cust.html
+++ b/httemplate/misc/unsuspend_cust.html
@@ -7,8 +7,7 @@
<P ALIGN="center"><B><% mt('Unsuspend this customer?') |h %></B>
-<TABLE BORDER="0" CELLSPACING="2"
-STYLE="margin-left:auto; margin-right:auto">
+<TABLE BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto">
<TR>
<TD ALIGN="right">
<INPUT TYPE="radio" NAME="now_or_later" VALUE="0" onclick="toggle(false)" CHECKED />
@@ -26,6 +25,21 @@ STYLE="margin-left:auto; margin-right:auto">
} &>
</TD>
</TR>
+% if ( $on_hold_pkgs > 0 ) {
+<TR>
+ <TD ALIGN="right">
+ <INPUT TYPE="checkbox" NAME="release_hold" VALUE="1" CHECKED \
+ <% $susp_pkgs == 0 ? 'DISABLED' : '' %> />
+
+ </TD>
+ <TD ALIGN="left">
+ <% emt('Activate [quant,_1,on-hold package,on-hold packages]', $on_hold_pkgs) %>
+ </TD>
+</TR>
+% }
+% if ( $susp_pkgs == 0 ) { # then always release holds, or this will do nothing
+ <INPUT TYPE="hidden" NAME="release_hold" VALUE="1">
+% }
</TABLE>
<SCRIPT type="text/javascript">
function toggle(val) {
@@ -64,5 +78,13 @@ my $cust_main = qsearchs( {
} );
die "No customer # $custnum" unless $cust_main;
+my $susp_pkgs = FS::cust_pkg->count(
+ FS::cust_pkg->susp_sql . " AND custnum = ?", $custnum
+);
+
+my $on_hold_pkgs = FS::cust_pkg->count(
+ FS::cust_pkg->on_hold_sql . " AND custnum = ?", $custnum
+);
+
</%init>
diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index dbf3698..accdb45 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -48,7 +48,8 @@
%
% if ( $cust_pkg->get('susp') ) { #suspended or on hold
%
-% if ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { #status: on hold
+% #if ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { # inconsistent with FS::cust_pkg::status
+% if ( ! $cust_pkg->setup ) { #status: on hold
<% pkg_status_row( $cust_pkg, emt('On Hold'), '', 'color'=>'7E0079', %opt ) %>