diff options
author | ivan <ivan> | 2007-08-01 22:26:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-01 22:26:52 +0000 |
commit | eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd (patch) | |
tree | bb38241e8c865c3bca861da7749071feeadd2b5b /httemplate/misc | |
parent | 32b5d3a31f112a381f0a15ac5e3a2204242f3405 (diff) |
event refactor, landing on HEAD!
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/cancel_cust.html | 75 | ||||
-rwxr-xr-x | httemplate/misc/cancel_pkg.html | 9 | ||||
-rwxr-xr-x | httemplate/misc/cust_main-cancel.cgi | 75 | ||||
-rw-r--r-- | httemplate/misc/cust_main-import.cgi | 3 | ||||
-rw-r--r-- | httemplate/misc/email_events.cgi | 4 | ||||
-rw-r--r-- | httemplate/misc/fax_events.cgi | 4 | ||||
-rw-r--r-- | httemplate/misc/order_pkg.html | 67 | ||||
-rw-r--r-- | httemplate/misc/print_events.cgi | 4 | ||||
-rwxr-xr-x | httemplate/misc/process/cancel_pkg.html | 66 |
9 files changed, 245 insertions, 62 deletions
diff --git a/httemplate/misc/cancel_cust.html b/httemplate/misc/cancel_cust.html new file mode 100644 index 000000000..a757aa6e3 --- /dev/null +++ b/httemplate/misc/cancel_cust.html @@ -0,0 +1,75 @@ +<% include('/elements/header-popup.html', 'Cancel customer' ) %> + +% if ( $cgi->param('error') ) { + <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT> + <BR><BR> +% } + +<FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST> +<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> + + + <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B> + + <% $ban %> + +<BR><BR> + +<% ntable("#cccccc", 2) %> + +<% include('/elements/tr-select-reason.html', + 'field' => 'reasonnum', + 'reason_class' => 'C', + #XXX these need to be sticky on errors too... + #'curr_value' => '', + 'control_button' => 'document.cust_cancel_popup.submit', + ) +%> + +</TABLE> + +<BR> +<P ALIGN="CENTER"> +<INPUT TYPE="submit" NAME="submit" VALUE="Cancel customer" disabled='true'> <INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();"> + +</FORM> +</BODY> +</HTML> + +<%init> + +my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); +if ( $cgi->param('error') ) { + $custnum = $cgi->param('custnum'); + $reasonnum = $cgi->param('reasonnum'); +} else { + my( $query ) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { + $custnum = $1; + } else { + die "illegal query ". $cgi->keywords; + } +} + +$curuser = $FS::CurrentUser::CurrentUser; + +$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 $ban = ''; +if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) { + $ban = '<BR><P ALIGN="center">'. + '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s '; + if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { + $ban .= 'credit card'; + } elsif ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { + $ban .= 'ACH account'; + } +} + +</%init> + diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index b085d2281..642f0c83e 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -42,7 +42,14 @@ %} % -<% include('/elements/tr-select-reason.html', 'reasonnum', $class, '', '', '', 'document.sc_popup.submit' ) %> +<% include('/elements/tr-select-reason.html', + 'field' => 'reasonnum', + 'reason_class' => $class, + #XXX these need to be sticky on errors too... + #'curr_value' => '', + 'control_button' => 'document.sc_popup.submit', + ) +%> </TABLE> diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi index d29e4f5fc..2f9c38004 100755 --- a/httemplate/misc/cust_main-cancel.cgi +++ b/httemplate/misc/cust_main-cancel.cgi @@ -1,23 +1,54 @@ -% -% -%my $custnum; -%my $ban = ''; -%if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { -% $custnum = $1; -% $ban = $cgi->param('ban'); -%} else { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/ || die "Illegal custnum"; -% $custnum = $1; -%} -% -%my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); -% -%my @errors = $cust_main->cancel( 'ban' => $ban ); -%eidiot(join(' / ', @errors)) if scalar(@errors); -% -%#print $cgi->redirect($p. "view/cust_main.cgi?". $cust_main->custnum); -%print $cgi->redirect($p); -% -% +<% header("Customer cancelled") %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY> +</HTML> +<%init> +my $custnum; +my $ban = ''; +if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + $custnum = $1; + $ban = $cgi->param('ban'); +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/ || die "Illegal custnum"; + $custnum = $1; +} + +#false laziness w/process/cancel_pkg.html + +#untaint reasonnum +my $reasonnum = $cgi->param('reasonnum'); +$reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum"; +$reasonnum = $1; + +if ($reasonnum == -1) { + $reasonnum = { + 'typenum' => scalar( $cgi->param('newreasonnumT') ), + 'reason' => scalar( $cgi->param('newreasonnum' ) ), + }; +} + +#eslaf + +my $cust_main = qsearchs( { + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +} ); + +warn "cancelling $cust_main"; +my @errors = $cust_main->cancel( + 'ban' => $ban, + 'reason' => $reasonnum, +); +my $error = join(' / ', @errors) if scalar(@errors); + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); +} + +</%init> diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 73efd3705..b273a80aa 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -24,7 +24,8 @@ target table. <% &ntable("#cccccc") %> -<% include('/elements/tr-select-agent.html', '', #$agentnum, +<% include('/elements/tr-select-agent.html', + #'curr_value' => '', #$agentnum, 'label' => "<B>Agent</B>", 'empty_label' => 'Select agent', ) diff --git a/httemplate/misc/email_events.cgi b/httemplate/misc/email_events.cgi new file mode 100644 index 000000000..c6efa7dc9 --- /dev/null +++ b/httemplate/misc/email_events.cgi @@ -0,0 +1,4 @@ +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_event::process_reemail', $cgi; +% +<% $server->process %> diff --git a/httemplate/misc/fax_events.cgi b/httemplate/misc/fax_events.cgi new file mode 100644 index 000000000..bf5ddd138 --- /dev/null +++ b/httemplate/misc/fax_events.cgi @@ -0,0 +1,4 @@ +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_event::process_refax', $cgi; +% +<% $server->process %> diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html new file mode 100644 index 000000000..c81f5b06f --- /dev/null +++ b/httemplate/misc/order_pkg.html @@ -0,0 +1,67 @@ +<% include('/elements/header-popup.html', 'Order new package' ) %> + +<SCRIPT TYPE="text/javascript"> +function enable_order_pkg () { + if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { + document.OrderPkgForm.submit.disabled = false; + } else { + document.OrderPkgForm.submit.disabled = true; + } +} +</SCRIPT> + +<FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST"> + +<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>"> + +<% ntable("#cccccc", 2) %> +<TR> + <TH ALIGN="right">Package</TH> + <TD> + <SELECT NAME="pkgpart" onChange="enable_order_pkg()"><OPTION>Select package + +%foreach my $part_pkg ( +% qsearch( 'part_pkg', { 'disabled' => '' }, '', +% ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '. +% ' WHERE typenum = '. $cust_main->agent->typenum. +% ' AND type_pkgs.pkgpart = part_pkg.pkgpart )' +% ) +%) { + + <OPTION VALUE="<% $part_pkg->pkgpart %>"><% $part_pkg->pkg %> - <% $part_pkg->comment %> + +% } + + </SELECT> + </TD> +</TR> + +% if ( $conf->exists('pkg_referral') ) { + <% include('/elements/tr-select-part_referral.html', + 'curr_value' => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum, + 'disable_empty' => 1, + 'multiple' => $conf->exists('pkg_referral-multiple'), + ) + %> +% } + +</TABLE> + +<BR> +<INPUT NAME="submit" TYPE="submit" VALUE="Order Package" disabled> + +</FORM> +<%init> + +my $conf = new FS::Conf; + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $custnum = $1; +my $cust_main = qsearchs({ + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); + +</%init> diff --git a/httemplate/misc/print_events.cgi b/httemplate/misc/print_events.cgi new file mode 100644 index 000000000..db7f9843e --- /dev/null +++ b/httemplate/misc/print_events.cgi @@ -0,0 +1,4 @@ +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_event::process_reprint', $cgi; + +<% $server->process %> diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html index aa542187a..805d1a711 100755 --- a/httemplate/misc/process/cancel_pkg.html +++ b/httemplate/misc/process/cancel_pkg.html @@ -1,4 +1,20 @@ +<% header("Package $past{$method}") %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY> +</HTML> +<%once> + +my %past = ( 'cancel' => 'cancelled', + 'expire' => 'expired', + 'suspend' => 'suspended', + 'adjourn' => 'adjourned', + ); + +</%once> <%init> + #untaint method my $method = $cgi->param('method'); $method =~ /^(cancel|expire|suspend|adjourn)$/ || die "Illegal method"; @@ -24,56 +40,30 @@ if ($method eq 'expire' || $method eq 'adjourn'){ 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) { - - $error = 'Enter a new reason (or select an existing one)' - unless $cgi->param('newreasonnum') !~ /^\s*$/; - - my $reason = new FS::reason({ 'reason_type' => $cgi->param('newreasonnumT'), - 'reason' => $cgi->param('newreasonnum'), - }); - $error ||= $reason->insert; - $reasonnum = $reason->reasonnum - unless $error; + $reasonnum = { + 'typenum' => scalar( $cgi->param('newreasonnumT') ), + 'reason' => scalar( $cgi->param('newreasonnum' ) ), + }; } -unless ($error) { - if ($method eq 'expire' || $method eq 'adjourn'){ - my %hash = $cust_pkg->hash; - $hash{$method}=$date; - my $new = new FS::cust_pkg (\%hash); - $error = $new->replace($cust_pkg, 'reason' => $reasonnum); - }else{ - $error = $cust_pkg->$method( 'reason' => $reasonnum ); - } +my $error; +if ($method eq 'expire' || $method eq 'adjourn'){ + my %hash = $cust_pkg->hash; + $hash{$method} = $date; + my $new = new FS::cust_pkg \%hash; + $error = $new->replace($cust_pkg, 'reason' => $reasonnum); +} else { + $error = $cust_pkg->$method( 'reason' => $reasonnum ); } 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', - 'adjourn' => 'adjourned', - ); </%init> -<% header("Package $past{$method}") %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY></HTML> - |