1 <& /elements/header-popup.html, mt($title) &>
3 <& /elements/error.html &>
5 <FORM NAME="sc_popup" ACTION="<% popurl(1) %>process/cancel_pkg.html" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
7 <INPUT TYPE="hidden" NAME="method" VALUE="<% $method %>">
10 <% emt(ucfirst($method)." [_1]", $part_pkg->pkg_comment(cust_pkg=>$cust_pkg) ) %>
11 <table style="background-color: #cccccc; border-spacing: 2; width: 100%">
14 % if ($method eq 'expire' || $method eq 'adjourn' || $method eq 'resume') {
15 % $submit =~ /^(\w*)\s/;
16 <& /elements/tr-input-date-field.html, {
19 'label' => mt("$1 package on"),
20 'format' => $date_format,
25 % if ($method eq 'uncancel' ) {
27 % #XXX customer also requested setup
28 % # setup: what usefulness is changing or blanking this? re-charge setup fee?
29 % # an option that says that would be better if that's what we want to do
31 % # last_bill: isn't this informational? what good would editing it do?
32 % # something about invoice display?
33 <& /elements/tr-input-date-field.html, {
34 'name' => 'last_bill',
35 'value' => ( $cgi->param('last_bill') || $cust_pkg->get('last_bill') ),
36 'label' => mt("Last bill date"),
37 'format' => $date_format,
40 <& /elements/tr-input-date-field.html, {
42 'value' => ( $cgi->param('bill') || $cust_pkg->get('bill') ),
43 'label' => mt("Next bill date"),
44 'format' => $date_format,
47 <& /elements/tr-checkbox.html,
48 'label' => mt("Uncancel even if service reprovisioning fails"),
49 'field' => 'svc_not_fatal',
54 % my @uncancel_svcs = sort { $b->{'reprovisionable'} <=> $a->{'reprovisionable'} }
55 % sort { $a->{'svcpart'} <=> $b->{'svcpart'} }
56 % $cust_pkg->uncancel_svc_summary();
57 % if (@uncancel_svcs) {
58 <TR><TD COLSPAN="2"> </TD></TR>
59 <TR><TH ALIGN="right"><% emt("Re-provision the following services") %></TH><TD></TD>
60 % foreach my $uncancel_svc (@uncancel_svcs) {
61 % my $uncancel_curr_value = $uncancel_svc->{'uncancel_svcnum'};
62 % my $uncancel_disabled = '';
63 % if ($cgi->param('error')) {
64 % $uncancel_curr_value = '' unless grep { $_ == $uncancel_svc->{'_uncancel_svcnum'} } $cgi->param('only_svcnum');
66 % unless ($uncancel_svc->{'reprovisionable'}) {
67 % $uncancel_curr_value = '';
68 % $uncancel_disabled = 1;
70 <& /elements/tr-checkbox.html,
71 'label' => $uncancel_svc->{'svc'} . ': ' . $uncancel_svc->{'label'},
72 'field' => 'only_svcnum',
73 'value' => $uncancel_svc->{'uncancel_svcnum'},
74 'curr_value' => $uncancel_curr_value,
75 'disabled' => $uncancel_disabled,
76 'cell_style' => 'font-weight: normal;'
82 % unless ( $method eq 'resume' || $method eq 'uncancel' ) {
83 <& /elements/tr-select-reason.html,
85 reason_class => $class,
86 curr_value => $reasonnum,
87 control_button => "confirm_cancel_pkg_button",
91 % if (( $method eq 'adjourn' || $method eq 'suspend' ) && $curuser->access_right('Customize billing during suspension')) {
93 % if ( $part_pkg->option('suspend_bill', 1) ) {
94 <& /elements/checkbox.html, name=>'no_suspend_bill', value=>'Y' &>
95 Disable recurring billing while suspended
97 <& /elements/checkbox.html, name=>'suspend_bill', value=>'Y' &>
98 Continue recurring billing while suspended
103 % if ( ( $method eq 'adjourn' || $method eq 'suspend' ) and
104 % $curuser->access_right('Unsuspend customer package') ) { #later?
105 % my $resume_date = $cgi->param('error')
106 % ? str2time($cgi->param('resume_date'))
107 % : $cust_pkg->get('resume');
109 <& /elements/tr-input-date-field.html, {
110 'name' => 'resume_date',
111 'value' => $resume_date,
112 'label' => mt('Unsuspend on'),
113 'format' => $date_format,
114 'noinit' => $date_init,
120 <INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_pkg_button"
121 VALUE="<% mt($submit) |h %>"
122 <% $method !~ /^(resume|uncancel)$/ ? 'DISABLED' : '' %>>
129 use Date::Parse qw(str2time);
131 my $conf = new FS::Conf;
132 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
136 my($pkgnum, $reasonnum);
137 if ( $cgi->param('error') ) {
138 $pkgnum = $cgi->param('pkgnum');
139 $reasonnum = $cgi->param('reasonnum');
140 $date = str2time($cgi->param('date'));
141 } elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
145 die "illegal query ". $cgi->keywords;
148 $cgi->param('method') =~ /^(\w+)$/ or die 'illegal method';
151 my($class, $submit, $right);
152 if ($method eq 'cancel') {
154 $submit = 'Cancel Now';
155 $right = 'Cancel customer package immediately';
156 } elsif ($method eq 'expire') {
158 $submit = 'Cancel Later';
159 $right = 'Cancel customer package later';
160 } elsif ($method eq 'suspend') {
162 $submit = 'Suspend Now';
163 $right = 'Suspend customer package';
164 } elsif ($method eq 'adjourn') {
166 $submit = "Suspend Later";
167 $right = 'Suspend customer package later';
168 } elsif ( $method eq 'resume') {
170 $submit = 'Unsuspend Later';
171 $right = 'Unsuspend customer package'; #later?
172 } elsif ( $method eq 'uncancel') {
174 $submit = 'Un-Cancel';
175 $right = 'Un-cancel customer package'; #later?
177 die 'illegal query (unknown method param)';
180 my $curuser = $FS::CurrentUser::CurrentUser;
181 die "access denied" unless $curuser->access_right($right);
183 my $title = ucfirst($method) . ' Package';
184 $title =~ s/Uncancel/Un-cancel/;
186 my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum})
187 or die "Unknown pkgnum: $pkgnum";
189 my $part_pkg = $cust_pkg->part_pkg;
191 $date ||= $cust_pkg->get($method);