summaryrefslogtreecommitdiff
path: root/httemplate/misc/unsuspend_cust.html
blob: 4555a58b32b1b2a48ebb94903bdd500fe7efc81e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<& /elements/header-popup.html, mt('Unsuspend customer')  &>

<& /elements/error.html &>

<FORM NAME="cust_unsuspend_popup" ACTION="<% popurl(1) %>cust_main-unsuspend.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">

 <P ALIGN="center"><B><% mt('Unsuspend this customer?') |h %></B>

<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 />
  </TD>
  <TD ALIGN="left"><% mt('Unsuspend now') |h %></TD>
</TR>
<TR>
  <TD ALIGN="right">
    <INPUT TYPE="radio" NAME="now_or_later" VALUE="1" onclick="toggle(true)" />
  </TD>
  <TD ALIGN="left"><% mt('Unsuspend on date: ') |h %> 
  <& /elements/input-date-field.html, {
              'name'    => 'resume',
              'value'   => time,
    }  &>
  </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) {
  document.getElementById("resume_text").disabled = !val;
  document.getElementById("resume_button").style.visibility = 
    val ? 'visible' : 'hidden';
}
toggle(false);
</SCRIPT> 

<BR>
<P ALIGN="CENTER">
<INPUT TYPE="submit" NAME="submit" ID="confirm_unsuspend_cust_button" VALUE="<% mt('Unsuspend customer') |h %>"> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE="BUTTON" VALUE="<% mt("Don't unsuspend") |h %>" onClick="parent.cClick();"> 

</FORM>
</BODY>
</HTML>

<%init>

#false laziness w/cancel_cust.html

$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
my $custnum = $1;

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied" unless $curuser->access_right('Unsuspend customer');

my $cust_main = qsearchs( {
  'table'     => 'cust_main',
  'hashref'   => { 'custnum' => $custnum },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
} );
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>