[freeside-commits] freeside/httemplate/misc cancel_cust.html, NONE, 1.1 cancel_pkg.html, 1.3, 1.4 cust_main-cancel.cgi, 1.4, 1.5 cust_main-import.cgi, 1.5, 1.6 email_events.cgi, NONE, 1.1 fax_events.cgi, NONE, 1.1 order_pkg.html, NONE, 1.1 print_events.cgi, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Wed Aug 1 15:26:45 PDT 2007
Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory wavetail:/tmp/cvs-serv23435/httemplate/misc
Modified Files:
cancel_pkg.html cust_main-cancel.cgi cust_main-import.cgi
Added Files:
cancel_cust.html email_events.cgi fax_events.cgi
order_pkg.html print_events.cgi
Log Message:
event refactor, landing on HEAD!
--- NEW FILE: print_events.cgi ---
%
%my $server = new FS::UI::Web::JSRPC 'FS::cust_event::process_reprint', $cgi;
<% $server->process %>
--- NEW FILE: order_pkg.html ---
<% 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>
--- NEW FILE: cancel_cust.html ---
<% 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>
Index: cust_main-import.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/cust_main-import.cgi,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cust_main-import.cgi 14 Nov 2006 12:22:27 -0000 1.5
+++ cust_main-import.cgi 1 Aug 2007 22:26:43 -0000 1.6
@@ -24,7 +24,8 @@
<% &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',
)
Index: cancel_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/cancel_pkg.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cancel_pkg.html 26 Jun 2007 15:37:18 -0000 1.3
+++ cancel_pkg.html 1 Aug 2007 22:26:42 -0000 1.4
@@ -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>
--- NEW FILE: email_events.cgi ---
%
%my $server = new FS::UI::Web::JSRPC 'FS::cust_event::process_reemail', $cgi;
%
<% $server->process %>
--- NEW FILE: fax_events.cgi ---
%
%my $server = new FS::UI::Web::JSRPC 'FS::cust_event::process_refax', $cgi;
%
<% $server->process %>
Index: cust_main-cancel.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/cust_main-cancel.cgi,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cust_main-cancel.cgi 23 Aug 2006 22:25:38 -0000 1.4
+++ cust_main-cancel.cgi 1 Aug 2007 22:26:43 -0000 1.5
@@ -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>
More information about the freeside-commits
mailing list