diff options
Diffstat (limited to 'httemplate/misc')
-rwxr-xr-x | httemplate/misc/cancel_pkg.cgi | 16 | ||||
-rwxr-xr-x | httemplate/misc/cancel_pkg.html | 95 | ||||
-rwxr-xr-x | httemplate/misc/expire_pkg.cgi | 56 | ||||
-rwxr-xr-x | httemplate/misc/process/cancel_pkg.html | 94 | ||||
-rwxr-xr-x | httemplate/misc/process/expire_pkg.cgi | 26 | ||||
-rwxr-xr-x | httemplate/misc/susp_pkg.cgi | 16 |
6 files changed, 189 insertions, 114 deletions
diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi deleted file mode 100755 index 00b421f10..000000000 --- a/httemplate/misc/cancel_pkg.cgi +++ /dev/null @@ -1,16 +0,0 @@ -% -% -%#untaint pkgnum -%my($query) = $cgi->keywords; -%$query =~ /^(\d+)$/ || die "Illegal pkgnum"; -%my $pkgnum = $1; -% -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -% -%my $error = $cust_pkg->cancel; -%eidiot($error) if $error; -% -%print $cgi->redirect($p. "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -% -% - diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html new file mode 100755 index 000000000..bfb0893e9 --- /dev/null +++ b/httemplate/misc/cancel_pkg.html @@ -0,0 +1,95 @@ +%# if ( $link eq 'popup' ) { + <% include('/elements/header-popup.html', $title ) %> +%# } else { +%# <% include("/elements/header.html", $title, '') %> +%# } + +<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> + +% if ( $cgi->param('error') ) { + <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT> + <BR><BR> +% } + +<FORM NAME="sc_popup" ACTION="<% popurl(1) %>process/cancel_pkg.html" METHOD=POST> +<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> +<INPUT TYPE="hidden" NAME="method" VALUE="<% $method %>"> + + +<BR><BR> +<% ucfirst($method) . " $pkgnum: " .$part_pkg->pkg. ' - ' .$part_pkg->comment %> +<% ntable("#cccccc", 2) %> + +% if ($method eq 'expire') { +<TR> + <TD>Cancel package on </TD> + <TD><INPUT TYPE="text" NAME="date" ID="expire_date" VALUE="<% $date %>"> + <IMG SRC="<% $p %>images/calendar.png" ID="expire_button" STYLE="cursor:pointer" TITLE="Select date"> + <BR><I>m/d/y</I> + </TD> +</TR> +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "expire_date", + ifFormat: "%m/%d/%Y", + button: "expire_button", + align: "BR" + }); +</SCRIPT> +%} +% + +<% include('/elements/tr-select-reason.html', 'reasonnum', $class) %> + +</TABLE> + +<BR> +<INPUT TYPE="submit" VALUE="<% $submit %>"> + +</FORM> +</BODY> +</HTML> + +<%init> +my($method, $pkgnum, $reasonnum, $submit, $cust_pkg, $part_pkg, + $date, $curuser, $class); +$date = time2str("%m/%d/%Y", time); +if ( $cgi->param('error') ) { + $method = $cgi->param('method'); + $pkgnum = $cgi->param('pkgnum'); + $reasonnum = $cgi->param('reasonnum'); + $date = $cgi->param('date'); +} elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + $pkgnum = $1; +} else { + die "illegal query ". $cgi->keywords; +} + +$method = $cgi->param('method'); +if ($method eq 'cancel') { + $class = 'C'; + $submit = "Cancel Now"; +}elsif ($method eq 'expire') { + $class = 'C'; + $submit = "Cancel Later"; +}elsif ($method eq 'suspend') { + $class = 'S'; + $submit = "Suspend"; +}else{ + die "illegal query ". $cgi->keywords; +} + +my $title = ucfirst($method) . ' Package'; + +$cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); +die "No such package: $pkgnum" unless $cust_pkg; + +$part_pkg = $cust_pkg->part_pkg; + +$curuser = $FS::CurrentUser::CurrentUser; + +</%init> + diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi deleted file mode 100755 index 55364c652..000000000 --- a/httemplate/misc/expire_pkg.cgi +++ /dev/null @@ -1,56 +0,0 @@ -<!-- mason kludge --> -% -% -%my($query) = $cgi->keywords; -%$query =~ /^(\d+)$/; -%my $pkgnum = $1; -% -%#get package record -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%die "Unknown pkgnum $pkgnum" unless $cust_pkg; -%my $part_pkg = $cust_pkg->part_pkg; -% -%my $custnum = $cust_pkg->getfield('custnum'); -% -%my $date = $cust_pkg->expire ? time2str('%D', $cust_pkg->expire) : ''; -% -% - - -<% include("/elements/header.html",'Expire package', menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - 'Main Menu' => popurl(2) -)) %> - -<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> -<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> -<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> -<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> - -<% $pkgnum %>: <% $part_pkg->pkg. ' - '. $part_pkg->comment %> - -<FORM NAME="formname" ACTION="process/expire_pkg.cgi" METHOD="post"> -<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> -<TABLE> - <TR> - <TD>Cancel package on </TD> - <TD><INPUT TYPE="text" NAME="date" ID="expire_date" VALUE="<% $date %>"> - <IMG SRC="<% $p %>images/calendar.png" ID="expire_button" STYLE="cursor:pointer" TITLE="Select date"> - <BR><I>m/d/y</I> - </TD> - </TR> -</TABLE> - -<SCRIPT TYPE="text/javascript"> - Calendar.setup({ - inputField: "expire_date", - ifFormat: "%m/%d/%Y", - button: "expire_button", - align: "BR" - }); -</SCRIPT> - -<INPUT TYPE="submit" VALUE="Cancel later"> -</FORM> -</BODY> -</HTML> diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html new file mode 100755 index 000000000..b53809854 --- /dev/null +++ b/httemplate/misc/process/cancel_pkg.html @@ -0,0 +1,94 @@ +% +% +%#untaint method +%my $method = $cgi->param('method'); +%$method =~ /^(cancel|expire|suspend)$/ || die "Illegal method"; +%$method = $1; + +%#untaint pkgnum +%my $pkgnum = $cgi->param('pkgnum'); +%$pkgnum =~ /^(\d+)$/ || die "Illegal pkgnum"; +%$pkgnum = $1; +% +%#untaint reasonnum +%my $reasonnum = $cgi->param('reasonnum'); +%$reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum"; +%$reasonnum = $1; +% +%my $date = time; +%if ($method eq 'expire'){ +% #untaint date +% $date = $cgi->param('date'); +% str2time($cgi->param('date')) =~ /^(\d+)$/ || die "Illegal date"; +% $date = $1; +%} +% +%my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); +% +% +%my $oldAutoCommit = $FS::UID::AutoCommit; +%local $FS::UID::AutoCommit = 0; +%my $dbh = dbh; +% +%my $otaker = $FS::CurrentUser::CurrentUser->name; +%$otaker = $FS::CurrentUser::CurrentUser->username +% if ($otaker eq "User, Legacy"); +% +%my $error; +%if ($reasonnum == -1) { +% #untaint new reason +% my $nr = $cgi->param('newreasonnum'); +% $nr =~ /^([\w\s]+)$/ || die "Illegal new reason"; +% $nr = $1; +% +% #untaint new reason type +% my $nrtype = $cgi->param('newreasonnumT'); +% $nrtype =~ /^(\d+)$/ || die "Illegal new reason type"; +% $nrtype = $1; +% +% my $reason = new FS::reason({ 'reason_type' => $nrtype, +% 'reason' => $nr, +% }); +% $error = $reason->insert; +% $reasonnum = $reason->reasonnum +% unless $error; +%} +% +%unless ($error) { +% my $cust_pkg_reason = new FS::cust_pkg_reason({ 'pkgnum' => $pkgnum, +% 'reasonnum' => $reasonnum, +% 'otaker' => $otaker, +% 'date' => $date, +% }); +% $error = $cust_pkg_reason->insert; +%} +% +%unless ($error) { +% if ($method eq 'expire'){ +% my %hash = $cust_pkg->hash; +% $hash{'expire'}=$date; +% my $new = new FS::cust_pkg (\%hash); +% $error = $new->replace($cust_pkg); +% }else{ +% $error = $cust_pkg->$method +% } +%} +% +%if ($error) { +% $cgi->param('error', $error); +% $dbh->rollback if $oldAutoCommit; +% print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); +%} +% +%$dbh->commit or die $dbh->errstr if $oldAutoCommit; +% +% my %past = ( 'cancel' => 'cancelled', +% 'expire' => 'expired', +% 'suspend' => 'suspended', +% ); +<% header("Package $past{$method}") %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY></HTML> + diff --git a/httemplate/misc/process/expire_pkg.cgi b/httemplate/misc/process/expire_pkg.cgi deleted file mode 100755 index d1963e2f5..000000000 --- a/httemplate/misc/process/expire_pkg.cgi +++ /dev/null @@ -1,26 +0,0 @@ -% -% -%#untaint date & pkgnum -% -%my $date; -%if ( $cgi->param('date') ) { -% str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; -% $date=$1; -%} else { -% $date=''; -%} -% -%$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; -%my $pkgnum = $1; -% -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%my %hash = $cust_pkg->hash; -%$hash{expire}=$date; -%my $new = new FS::cust_pkg ( \%hash ); -%my $error = $new->replace($cust_pkg); -%&eidiot($error) if $error; -% -%print $cgi->redirect(popurl(3). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -% -% - diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi deleted file mode 100755 index ea9edc7bb..000000000 --- a/httemplate/misc/susp_pkg.cgi +++ /dev/null @@ -1,16 +0,0 @@ -% -% -%#untaint pkgnum -%my ($query) = $cgi->keywords; -%$query =~ /^(\d+)$/ || die "Illegal pkgnum"; -%my $pkgnum = $1; -% -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -% -%my $error = $cust_pkg->suspend; -%&eidiot($error) if $error; -% -%print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -% -% - |