1 <% include("/elements/header.html",'Customer package - Edit dates') %>
4 %# "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum",
7 <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
8 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
9 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
12 <FORM NAME="formname" ACTION="process/REAL_cust_pkg.cgi" METHOD="POST">
13 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
15 % # raw error from below
17 <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error %></FONT>
19 % #or, regular error handler
20 <% include('/elements/error.html') %>
22 <% ntable("#cccccc",2) %>
25 <TD ALIGN="right">Package number</TD>
26 <TD BGCOLOR="#ffffff"><% $cust_pkg->pkgnum %></TD>
30 <TD ALIGN="right">Package</TD>
31 <TD BGCOLOR="#ffffff"><% $cust_pkg->pkg %></TD>
35 <TD ALIGN="right">Comment</TD>
36 <TD BGCOLOR="#ffffff"><% $cust_pkg->comment %></TD>
40 <TD ALIGN="right">Order taker</TD>
41 <TD BGCOLOR="#ffffff"><% $cust_pkg->otaker %></TD>
44 <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup', label=>'Setup' &>
45 <& .row_edit, cust_pkg=>$cust_pkg, column=>'last_bill', label=>$last_bill_or_renewed &>
46 <& .row_edit, cust_pkg=>$cust_pkg, column=>'bill', label=>$next_bill_or_prepaid_until &>
47 <& .row_edit, cust_pkg=>$cust_pkg, column=>'adjourn', label=>'Adjournment', note=>'(will <b>suspend</b> this package when the date is reached)' &>
48 <& .row_display, cust_pkg=>$cust_pkg, column=>'susp', label=>'Suspension' &>
50 <& .row_edit, cust_pkg=>$cust_pkg, column=>'expire', label=>'Expiration', note=>'(will <b>cancel</b> this package when the date is reached)' &>
51 <& .row_display, cust_pkg=>$cust_pkg, column=>'cancel', label=>'Cancellation' &>
60 % my $value = $cust_pkg->get($column);
61 % $value = $value ? time2str($format, $value) : "";
64 <TD ALIGN="right"><% $label %> date</TD>
67 NAME = "<% $column %>"
69 ID = "<% $column %>_text"
70 VALUE = "<% $value %>"
72 <IMG SRC = "../images/calendar.png"
73 ID = "<% $column %>_button"
74 STYLE = "cursor: pointer"
78 <BR><FONT SIZE=-1><% $note %></FONT>
83 <SCRIPT TYPE="text/javascript">
85 inputField: "<% $column %>_text",
87 button: "<% $column %>_button",
100 % if ( $cust_pkg->get($column) ) {
102 <TD ALIGN="right"><% $label %> date</TD>
103 <TD BGCOLOR="#ffffff"><% time2str($format,$cust_pkg->get($column)) %></TD>
111 <INPUT TYPE="submit" VALUE="Apply Changes">
114 <% include('/elements/footer.html') %>
118 #my $format = "%c %z (%Z)";
119 my $format = "%m/%d/%Y %T %z (%Z)";
121 #false laziness w/view/cust_main/packages.html
122 #my( $billed_or_prepaid,
128 unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates');
131 my( $pkgnum, $cust_pkg );
133 if ( $cgi->param('error') ) {
135 $pkgnum = $cgi->param('pkgnum');
136 if ( $cgi->param('error') eq '_bill_areyousure' ) {
137 if ( $cgi->param('bill') =~ /^([\s\d\/\:\-\(\w\)]*)$/ ) {
139 $cgi->param('error', '');
140 $error = "You are attempting to set the next bill date to $bill, which is
141 in the past. This will charge the customer for the interval
142 from $bill until now. Are you sure you want to do this? ".
143 '<INPUT TYPE="checkbox" NAME="bill_areyousure" VALUE="1">';
148 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
149 die "No package!" unless $cust_pkg;
151 foreach my $col (qw( setup last_bill bill adjourn expire )) {
152 my $value = $cgi->param($col);
153 $cust_pkg->set( $col, $value ? str2time($value) : '' );
158 my($query) = $cgi->keywords;
159 $query =~ /^(\d+)$/ or die "no pkgnum";
163 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
164 die "No package!" unless $cust_pkg;
168 my $part_pkg = qsearchs( 'part_pkg', { 'pkgpart' => $cust_pkg->pkgpart } );
170 my( $last_bill_or_renewed, $next_bill_or_prepaid_until );
171 unless ( $part_pkg->is_prepaid ) {
172 #$billed_or_prepaid = 'billed';
173 $last_bill_or_renewed = 'Last bill';
174 $next_bill_or_prepaid_until = 'Next bill';
176 #$billed_or_prepaid = 'prepaid';
177 $last_bill_or_renewed = 'Renewed';
178 $next_bill_or_prepaid_until = 'Prepaid until';