From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/misc/bill.cgi | 62 ++++++++++++++++++ httemplate/misc/cancel-unaudited.cgi | 97 +++++++++++++++++++++++++++++ httemplate/misc/cancel_pkg.cgi | 75 ++++++++++++++++++++++ httemplate/misc/delete-customer.cgi | 62 ++++++++++++++++++ httemplate/misc/expire_pkg.cgi | 65 +++++++++++++++++++ httemplate/misc/link.cgi | 89 ++++++++++++++++++++++++++ httemplate/misc/print-invoice.cgi | 55 ++++++++++++++++ httemplate/misc/process/delete-customer.cgi | 50 +++++++++++++++ httemplate/misc/process/link.cgi | 80 ++++++++++++++++++++++++ httemplate/misc/susp_pkg.cgi | 68 ++++++++++++++++++++ httemplate/misc/unsusp_pkg.cgi | 65 +++++++++++++++++++ 11 files changed, 768 insertions(+) create mode 100755 httemplate/misc/bill.cgi create mode 100755 httemplate/misc/cancel-unaudited.cgi create mode 100755 httemplate/misc/cancel_pkg.cgi create mode 100755 httemplate/misc/delete-customer.cgi create mode 100755 httemplate/misc/expire_pkg.cgi create mode 100755 httemplate/misc/link.cgi create mode 100755 httemplate/misc/print-invoice.cgi create mode 100755 httemplate/misc/process/delete-customer.cgi create mode 100755 httemplate/misc/process/link.cgi create mode 100755 httemplate/misc/susp_pkg.cgi create mode 100755 httemplate/misc/unsusp_pkg.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi new file mode 100755 index 000000000..d09fc45dc --- /dev/null +++ b/httemplate/misc/bill.cgi @@ -0,0 +1,62 @@ +<% +# +# $Id: bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# s/FS:Search/FS::Record/ and cgisuidsetup($cgi) ivan@sisd.com 98-mar-13 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: bill.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.5 1999/08/12 04:32:21 ivan +# hidecancelledcustomers +# +# Revision 1.4 1999/01/19 05:14:02 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:01:13 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:41 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $custnum $cust_main $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_main; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint custnum +($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +$custnum = $1; +$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +die "Can't find customer!\n" unless $cust_main; + +$error = $cust_main->bill( +# 'time'=>$time + ); +&eidiot($error) if $error; + +$error = $cust_main->collect( +# 'invoice-time'=>$time, +# 'batch_card'=> 'yes', + 'batch_card'=> 'no', + 'report_badcard'=> 'yes', + ); +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); + +%> diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi new file mode 100755 index 000000000..5bad5e737 --- /dev/null +++ b/httemplate/misc/cancel-unaudited.cgi @@ -0,0 +1,97 @@ +<% +# +# $Id: cancel-unaudited.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cancel-unaudited.cgi svcnum +# http://server.name/path/cancel-unaudited.cgi pkgnum +# +# ivan@voicenet.com 97-apr-23 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# Search->Record, cgisuidsetup($cgi) ivan@sids.com 98-mar-19 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cancel-unaudited.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 2001/04/09 23:05:16 ivan +# Transactions Part I!!! +# +# Revision 1.7 2000/06/15 12:30:37 ivan +# bugfix from Jeff Finucane, thanks! +# +# Revision 1.6 1999/02/28 00:03:48 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:34 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:14:03 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:02:05 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:42 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error $dbh ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_svc; +use FS::svc_acct; + +$cgi = new CGI; +$dbh = &cgisuidsetup($cgi); + +#untaint svcnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; + +$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $svc_acct; + +$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +&eidiot(qq!This account has already been audited. Cancel the + package instead.!) + if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; + +local $SIG{HUP} = 'IGNORE'; +local $SIG{INT} = 'IGNORE'; +local $SIG{QUIT} = 'IGNORE'; +local $SIG{TERM} = 'IGNORE'; +local $SIG{TSTP} = 'IGNORE'; + +local $FS::UID::AutoCommit = 0; + +$error = $svc_acct->cancel; +&myeidiot($error) if $error; +$error = $svc_acct->delete; +&myeidiot($error) if $error; + +$error = $cust_svc->delete; +&myeidiot($error) if $error; + +$dbh->commit or die $dbh->errstr; + +print $cgi->redirect(popurl(2)); + +sub myeidiot { + $dbh->rollback; + &eidiot(@_); +} + +%> diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi new file mode 100755 index 000000000..99a09bbe3 --- /dev/null +++ b/httemplate/misc/cancel_pkg.cgi @@ -0,0 +1,75 @@ +<% +# +# $Id: cancel_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cancel_pkg.cgi pkgnum +# http://server.name/path/cancel_pkg.cgi pkgnum +# +# IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!! +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-jan-2 +# +# still kludgy, but now runs /dbin/cancel $pkgnum +# ivan@voicenet.com 97-feb-27 +# +# doesn't run if pkgnum doesn't match regex +# ivan@voicenet.com 97-mar-6 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cancel_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/04/08 10:35:02 ivan +# import necessary subroutines from FS::CGI +# +# Revision 1.5 1999/02/28 00:03:49 ivan +# removed misleading comments +# +# Revision 1.4 1999/01/19 05:14:04 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:02:54 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:43 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $query $pkgnum $cust_pkg $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(eidiot popurl); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl eidiot); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint pkgnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +$error = $cust_pkg->cancel; +eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi new file mode 100755 index 000000000..cb5fc76b5 --- /dev/null +++ b/httemplate/misc/delete-customer.cgi @@ -0,0 +1,62 @@ +<% +# +# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# $Log: delete-customer.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.1 1999/04/15 16:44:36 ivan +# delete customers +# + +use strict; +use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs); +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); + +if ( $cgi->param('error') ) { + $custnum = $cgi->param('custnum'); + $new_custnum = $cgi->param('new_custnum'); +} else { + ($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die "Illegal query: $query"; + $custnum = $1; + $new_custnum = ''; +} +$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) + or die "Customer not found: $custnum"; + +print $cgi->header ( '-expires' => 'now' ), header('Delete customer'); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print + qq!
!, + qq!!; + +if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) { + print "Move uncancelled packages to customer number ", + qq!

!; +} + +print <completely remove all traces of this customer record. +
Are you absolutely sure you want to delete this customer? +
+ +END + +%> diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi new file mode 100755 index 000000000..7afa94267 --- /dev/null +++ b/httemplate/misc/expire_pkg.cgi @@ -0,0 +1,65 @@ +<% +# +# $Id: expire_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/expire_pkg.cgi +# +# based on susp_pkg +# ivan@voicenet.com 97-jul-29 +# +# ivan@sisd.com 98-mar-17 FS::Search->FS::Record +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: expire_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.4 1999/02/28 00:03:50 ivan +# removed misleading comments +# +# Revision 1.3 1999/01/19 05:14:05 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:12:44 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $date $pkgnum $cust_pkg %hash $new $error ); +use Date::Parse; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint date & pkgnum + +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"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +%hash = $cust_pkg->hash; +$hash{expire}=$date; +$new = new FS::cust_pkg ( \%hash ); +$error = $new->replace($cust_pkg); +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi new file mode 100755 index 000000000..fee02ddb7 --- /dev/null +++ b/httemplate/misc/link.cgi @@ -0,0 +1,89 @@ +<% +# +# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@voicenet.com 97-feb-5 +# +# rewrite ivan@sisd.com 98-mar-17 +# +# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 +# +# $Log: link.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/04/08 11:31:40 ivan +# *** empty log message *** +# +# Revision 1.6 1999/02/28 00:03:51 ivan +# removed misleading comments +# +# Revision 1.5 1999/01/19 05:14:06 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:36 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/23 03:03:39 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:45 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb + $link_field ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl header); +use FS::Record qw(qsearchs); + +%link_field = ( + 'svc_acct' => 'username', + 'svc_domain' => 'domain', + 'svc_acct_sm' => '', + 'svc_charge' => '', + 'svc_wo' => '', +); + +$cgi = new CGI; +cgisuidsetup($cgi); + +($query) = $cgi->keywords; +foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); +$svc = $part_svc->getfield('svc'); +$svcdb = $part_svc->getfield('svcdb'); +$link_field = $link_field{$svcdb}; + +print $cgi->header( '-expires' => 'now' ), header("Link to existing $svc"), + qq!
!; + +if ( $link_field ) { + print < + + $link_field of existing service: +END +} else { + print qq!Service # of existing service: !; +} + +print < + +

+ + + +END + +%> diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi new file mode 100755 index 000000000..1d35bc0f2 --- /dev/null +++ b/httemplate/misc/print-invoice.cgi @@ -0,0 +1,55 @@ +<% +# +# $Id: print-invoice.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# just a kludge for now, since this duplicates in a way it shouldn't stuff from +# Bill.pm (like $lpr) ivan@sisd.com 98-jun-16 +# +# $Log: print-invoice.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.4 1999/01/19 05:14:07 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:04:24 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:47 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs); +use FS::cust_bill; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$lpr = $conf->config('lpr'); + +#untaint invnum +($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +$invnum = $1; +$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Can't find invoice!\n" unless $cust_bill; + + open(LPR,"|$lpr") or die "Can't open $lpr: $!"; + print LPR $cust_bill->print_text; #( date ) + close LPR + or die $! ? "Error closing $lpr: $!" + : "Exit status $? from $lpr"; + +$custnum = $cust_bill->getfield('custnum'); + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); + +%> diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi new file mode 100755 index 000000000..b15ffef17 --- /dev/null +++ b/httemplate/misc/process/delete-customer.cgi @@ -0,0 +1,50 @@ +<% +# +# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# $Log: delete-customer.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.1 1999/04/15 16:44:36 ivan +# delete customers +# + +use strict; +use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl); +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); + +$cgi->param('custnum') =~ /^(\d+)$/; +$custnum = $1; +if ( $cgi->param('new_custnum') ) { + $cgi->param('new_custnum') =~ /^(\d+)$/ + or die "Illegal new customer number: ". $cgi->param('new_custnum'); + $new_custnum = $1; +} else { + $new_custnum = ''; +} +$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) + or die "Customer not found: $custnum"; + +$error = $cust_main->delete($new_custnum); + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string ); +} elsif ( $new_custnum ) { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum"); +} else { + print $cgi->redirect(popurl(3)); +} +%> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi new file mode 100755 index 000000000..94afa289a --- /dev/null +++ b/httemplate/misc/process/link.cgi @@ -0,0 +1,80 @@ +<% +# +# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@voicenet.com 97-feb-5 +# +# rewrite ivan@sisd.com 98-mar-18 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 +# +# $Log: link.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 2000/07/17 17:59:33 ivan +# oops +# +# Revision 1.5 1999/04/15 14:09:17 ivan +# get rid of top-level my() variables +# +# Revision 1.4 1999/02/07 09:59:35 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.3 1999/01/19 05:14:10 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:15:00 ivan +# s/CGI::Request/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::CGI qw(popurl idiot eidiot); +use FS::UID qw(cgisuidsetup); +use FS::cust_svc; +use FS::Record qw(qsearchs); + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('pkgnum') =~ /^(\d+)$/; +$pkgnum = $1; +$cgi->param('svcpart') =~ /^(\d+)$/; +$svcpart = $1; +$cgi->param('svcnum') =~ /^(\d*)$/; +$svcnum = $1; + +unless ( $svcnum ) { + my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); + my($svcdb) = $part_svc->getfield('svcdb'); + $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; + my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_acct; + $svcnum=$svc_acct->svcnum; +} + +$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "svcnum not found!" unless $old; +$new = new FS::cust_svc ({ + 'svcnum' => $svcnum, + 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, +}); + +$error = $new->replace($old); + +unless ($error) { + #no errors, so let's view this customer. + print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); +} else { + idiot($error); +} + +%> diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi new file mode 100755 index 000000000..52e3ce788 --- /dev/null +++ b/httemplate/misc/susp_pkg.cgi @@ -0,0 +1,68 @@ +<% +# +# $Id: susp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-feb-27 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: susp_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/04/08 10:35:02 ivan +# import necessary subroutines from FS::CGI +# +# Revision 1.5 1999/02/28 00:03:52 ivan +# removed misleading comments +# +# Revision 1.4 1999/01/19 05:14:08 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:04:56 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:48 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $pkgnum $cust_pkg $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl eidiot); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint pkgnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +$error = $cust_pkg->suspend; +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi new file mode 100755 index 000000000..d7d651b6d --- /dev/null +++ b/httemplate/misc/unsusp_pkg.cgi @@ -0,0 +1,65 @@ +<% +# +# $Id: unsusp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-feb-27 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: unsusp_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.5 1999/02/28 00:03:53 ivan +# removed misleading comments +# +# Revision 1.4 1999/01/19 05:14:09 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:05:25 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:49 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $pkgnum $cust_pkg $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint pkgnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +$error = $cust_pkg->unsuspend; +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> -- cgit v1.2.1 From 8748a199e18236d696115661a36e87f583481662 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 04:15:14 +0000 Subject: better docs --- httemplate/misc/delete-customer.cgi | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index cb5fc76b5..e1bcb8994 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,9 +1,12 @@ <% # -# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: delete-customer.cgi,v 1.2 2001-08-11 04:15:14 ivan Exp $ # # $Log: delete-customer.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-11 04:15:14 ivan +# better docs +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.1 1999/04/15 16:44:36 ivan @@ -53,7 +56,11 @@ if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) { } print <completely remove all traces of this customer record. +This will completely remove all traces of this customer record. This +is not what you want if this is a real customer who has simply +canceled service with you. For that, cancel all of the customer's packages. +(you can optionally hide cancelled customers with the hidecancelledcustomers configuration file) +

Are you absolutely sure you want to delete this customer?
-- cgit v1.2.1 From 8a8c9386cbd3383b0134aae8e32b5995f8886fb2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 19 Aug 2001 15:53:36 +0000 Subject: added user interface for svc_forward and vpopmail support --- httemplate/misc/catchall.cgi | 157 +++++++++++++++++++++++++++++++++++ httemplate/misc/process/catchall.cgi | 55 ++++++++++++ 2 files changed, 212 insertions(+) create mode 100755 httemplate/misc/catchall.cgi create mode 100755 httemplate/misc/process/catchall.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi new file mode 100755 index 000000000..79b72565b --- /dev/null +++ b/httemplate/misc/catchall.cgi @@ -0,0 +1,157 @@ +<% +# +# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ +# +# Usage: catchall.cgi {svcnum} +# http://server.name/path/catchall.cgi? {svcnum} +# +# $Log: catchall.cgi,v $ +# Revision 1.1 2001-08-19 15:53:35 jeff +# added user interface for svc_forward and vpopmail support +# +# + +use strict; +use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart + $part_svc $query %email $p1 $domain $catchall ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs fields); +use FS::svc_acct; +use FS::svc_domain; +use FS::svc_forward; +use FS::Conf; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; + +if ( $cgi->param('error') ) { + $svc_domain = new FS::svc_domain ( { + map { $_, scalar($cgi->param($_)) } fields('svc_domain') + } ); + $svcnum = $svc_domain->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $svcnum=$1; + $svc_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum}) + or die "Unknown (svc_domain) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + } else { + + die "Invalid (svc_domain) svcnum!"; + + } +} + +if ($pkgnum) { + + #find all possible user svcnums (and emails) + + #starting with that currently attached + if ($svc_domain->catchall) { + my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$svc_domain->catchall}); + $email{$svc_domain->catchall} = $svc_acct->email; + } + + #and including the rest for this customer + my($u_part_svc,@u_acct_svcparts); + foreach $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) { + push @u_acct_svcparts,$u_part_svc->getfield('svcpart'); + } + + my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + my($custnum)=$cust_pkg->getfield('custnum'); + my($i_cust_pkg); + foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { + my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); + my($acct_svcpart); + foreach $acct_svcpart (@u_acct_svcparts) { #now find the corresponding + #record(s) in cust_svc ( for this + #pkgnum ! ) + my($i_cust_svc); + foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { + my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); + $email{$svc_acct->getfield('svcnum')}=$svc_acct->email; + } + } + } + +} else { + + my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$svc_domain->catchall}); + $email{$svc_domain->catchall} = $svc_acct->email; +} + +# add an absence of a catchall +$email{0} = "(none)"; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Domain Catchall Edit", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
!; + +#display + + #formatting + print "
";
+
+#svcnum
+print qq!!;
+print qq!Service #!, $svcnum ? $svcnum : " (NEW)", "";
+
+#pkgnum
+print qq!!;
+ 
+#svcpart
+print qq!!;
+
+($domain,$catchall)=(
+  $svc_domain->domain,
+  $svc_domain->catchall,
+);
+
+print qq!!;
+
+#catchall
+print qq!\n\nMail to (anything)@$domain forwards to ";
+
+	#formatting
+	print "
\n"; + +print qq!
!; + +print < + + +END + +%> diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi new file mode 100755 index 000000000..0d84d7c4e --- /dev/null +++ b/httemplate/misc/process/catchall.cgi @@ -0,0 +1,55 @@ +<% +# +# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ +# +# Usage: post form to: +# http://server.name/path/catchall.cgi +# +# $Log: catchall.cgi,v $ +# Revision 1.1 2001-08-19 15:53:35 jeff +# added user interface for svc_forward and vpopmail support +# +# + +use strict; +use vars qw( $cgi $svcnum $old $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs fields); +use FS::svc_domain; +use FS::CGI qw(popurl); + +$FS::svc_domain::whois_hack=1; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +$svcnum =$1; + +$old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; + +$new = new FS::svc_domain ( { + map { + ($_, scalar($cgi->param($_))); + } ( fields('svc_domain'), qw( pkgnum svcpart ) ) +} ); + +$new->setfield('action' => 'M'); + +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->getfield('svcnum'); +} + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "catchall.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +} + +%> -- cgit v1.2.1 From 3d671921441ba8422650b54435a1959ad1d4c71d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Aug 2001 02:31:57 +0000 Subject: remove $Log$ messages. whew. --- httemplate/misc/bill.cgi | 26 +--------------- httemplate/misc/cancel-unaudited.cgi | 43 +------------------------- httemplate/misc/cancel_pkg.cgi | 48 +---------------------------- httemplate/misc/catchall.cgi | 12 +------- httemplate/misc/delete-customer.cgi | 14 +-------- httemplate/misc/expire_pkg.cgi | 29 +---------------- httemplate/misc/link.cgi | 34 +------------------- httemplate/misc/print-invoice.cgi | 21 +------------ httemplate/misc/process/catchall.cgi | 12 +------- httemplate/misc/process/delete-customer.cgi | 11 +------ httemplate/misc/process/link.cgi | 33 +------------------- httemplate/misc/susp_pkg.cgi | 42 +------------------------ httemplate/misc/unsusp_pkg.cgi | 39 +---------------------- 13 files changed, 13 insertions(+), 351 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index d09fc45dc..cc7938308 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,29 +1,5 @@ <% -# -# $Id: bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# s/FS:Search/FS::Record/ and cgisuidsetup($cgi) ivan@sisd.com 98-mar-13 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: bill.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.5 1999/08/12 04:32:21 ivan -# hidecancelledcustomers -# -# Revision 1.4 1999/01/19 05:14:02 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:01:13 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:41 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw( $cgi $query $custnum $cust_main $error ); diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 5bad5e737..9b90967d9 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -1,46 +1,5 @@ <% -# -# $Id: cancel-unaudited.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: cancel-unaudited.cgi svcnum -# http://server.name/path/cancel-unaudited.cgi pkgnum -# -# ivan@voicenet.com 97-apr-23 -# -# rewrote for new API -# ivan@voicenet.com 97-jul-21 -# -# Search->Record, cgisuidsetup($cgi) ivan@sids.com 98-mar-19 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: cancel-unaudited.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.8 2001/04/09 23:05:16 ivan -# Transactions Part I!!! -# -# Revision 1.7 2000/06/15 12:30:37 ivan -# bugfix from Jeff Finucane, thanks! -# -# Revision 1.6 1999/02/28 00:03:48 ivan -# removed misleading comments -# -# Revision 1.5 1999/02/07 09:59:34 ivan -# more mod_perl fixes, and bugfixes Peter Wemm sent via email -# -# Revision 1.4 1999/01/19 05:14:03 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:02:05 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:42 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error $dbh ); diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi index 99a09bbe3..8129463ae 100755 --- a/httemplate/misc/cancel_pkg.cgi +++ b/httemplate/misc/cancel_pkg.cgi @@ -1,51 +1,5 @@ <% -# -# $Id: cancel_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: cancel_pkg.cgi pkgnum -# http://server.name/path/cancel_pkg.cgi pkgnum -# -# IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!! -# -# probably should generalize this to do cancels, suspensions, unsuspensions, etc. -# -# ivan@voicenet.com 97-jan-2 -# -# still kludgy, but now runs /dbin/cancel $pkgnum -# ivan@voicenet.com 97-feb-27 -# -# doesn't run if pkgnum doesn't match regex -# ivan@voicenet.com 97-mar-6 -# -# now redirects to enter comments -# ivan@voicenet.com 97-may-8 -# -# rewrote for new API -# ivan@voicenet.com 97-jul-21 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: cancel_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.6 1999/04/08 10:35:02 ivan -# import necessary subroutines from FS::CGI -# -# Revision 1.5 1999/02/28 00:03:49 ivan -# removed misleading comments -# -# Revision 1.4 1999/01/19 05:14:04 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:02:54 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:43 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw ( $cgi $query $pkgnum $cust_pkg $error ); diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 79b72565b..9ebec6688 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,15 +1,5 @@ <% -# -# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ -# -# Usage: catchall.cgi {svcnum} -# http://server.name/path/catchall.cgi? {svcnum} -# -# $Log: catchall.cgi,v $ -# Revision 1.1 2001-08-19 15:53:35 jeff -# added user interface for svc_forward and vpopmail support -# -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index e1bcb8994..3a7330960 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,17 +1,5 @@ <% -# -# $Id: delete-customer.cgi,v 1.2 2001-08-11 04:15:14 ivan Exp $ -# -# $Log: delete-customer.cgi,v $ -# Revision 1.2 2001-08-11 04:15:14 ivan -# better docs -# -# Revision 1.1 2001/07/30 07:36:04 ivan -# templates!!! -# -# Revision 1.1 1999/04/15 16:44:36 ivan -# delete customers -# +# use strict; use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi index 7afa94267..21e220d18 100755 --- a/httemplate/misc/expire_pkg.cgi +++ b/httemplate/misc/expire_pkg.cgi @@ -1,32 +1,5 @@ <% -# -# $Id: expire_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: post form to: -# http://server.name/path/expire_pkg.cgi -# -# based on susp_pkg -# ivan@voicenet.com 97-jul-29 -# -# ivan@sisd.com 98-mar-17 FS::Search->FS::Record -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: expire_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.4 1999/02/28 00:03:50 ivan -# removed misleading comments -# -# Revision 1.3 1999/01/19 05:14:05 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.2 1998/12/17 09:12:44 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw ( $cgi $date $pkgnum $cust_pkg %hash $new $error ); diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index fee02ddb7..f4b70f76a 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,37 +1,5 @@ <% -# -# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# ivan@voicenet.com 97-feb-5 -# -# rewrite ivan@sisd.com 98-mar-17 -# -# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 -# -# $Log: link.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.7 1999/04/08 11:31:40 ivan -# *** empty log message *** -# -# Revision 1.6 1999/02/28 00:03:51 ivan -# removed misleading comments -# -# Revision 1.5 1999/01/19 05:14:06 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.4 1999/01/18 09:41:36 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.3 1998/12/23 03:03:39 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:45 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 1d35bc0f2..a6cb05230 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,24 +1,5 @@ <% -# -# $Id: print-invoice.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# just a kludge for now, since this duplicates in a way it shouldn't stuff from -# Bill.pm (like $lpr) ivan@sisd.com 98-jun-16 -# -# $Log: print-invoice.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.4 1999/01/19 05:14:07 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:04:24 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:47 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index 0d84d7c4e..6b1147633 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,15 +1,5 @@ <% -# -# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ -# -# Usage: post form to: -# http://server.name/path/catchall.cgi -# -# $Log: catchall.cgi,v $ -# Revision 1.1 2001-08-19 15:53:35 jeff -# added user interface for svc_forward and vpopmail support -# -# +# use strict; use vars qw( $cgi $svcnum $old $new $error ); diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index b15ffef17..4be52004b 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,14 +1,5 @@ <% -# -# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# $Log: delete-customer.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.1 1999/04/15 16:44:36 ivan -# delete customers -# +# use strict; use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 94afa289a..6b34e8a5d 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,36 +1,5 @@ <% -# -# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# ivan@voicenet.com 97-feb-5 -# -# rewrite ivan@sisd.com 98-mar-18 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 -# -# $Log: link.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.6 2000/07/17 17:59:33 ivan -# oops -# -# Revision 1.5 1999/04/15 14:09:17 ivan -# get rid of top-level my() variables -# -# Revision 1.4 1999/02/07 09:59:35 ivan -# more mod_perl fixes, and bugfixes Peter Wemm sent via email -# -# Revision 1.3 1999/01/19 05:14:10 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.2 1998/12/17 09:15:00 ivan -# s/CGI::Request/CGI.pm/; -# +# use strict; use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi index 52e3ce788..602314436 100755 --- a/httemplate/misc/susp_pkg.cgi +++ b/httemplate/misc/susp_pkg.cgi @@ -1,45 +1,5 @@ <% -# -# $Id: susp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: susp_pkg.cgi pkgnum -# http://server.name/path/susp_pkg.cgi pkgnum -# -# probably should generalize this to do cancels, suspensions, unsuspensions, etc. -# -# ivan@voicenet.com 97-feb-27 -# -# now redirects to enter comments -# ivan@voicenet.com 97-may-8 -# -# rewrote for new API -# ivan@voicenet.com 97-jul-21 -# -# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: susp_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.6 1999/04/08 10:35:02 ivan -# import necessary subroutines from FS::CGI -# -# Revision 1.5 1999/02/28 00:03:52 ivan -# removed misleading comments -# -# Revision 1.4 1999/01/19 05:14:08 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:04:56 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:48 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw( $cgi $query $pkgnum $cust_pkg $error ); diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi index d7d651b6d..8e1b5261b 100755 --- a/httemplate/misc/unsusp_pkg.cgi +++ b/httemplate/misc/unsusp_pkg.cgi @@ -1,42 +1,5 @@ <% -# -# $Id: unsusp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: susp_pkg.cgi pkgnum -# http://server.name/path/susp_pkg.cgi pkgnum -# -# probably should generalize this to do cancels, suspensions, unsuspensions, etc. -# -# ivan@voicenet.com 97-feb-27 -# -# now redirects to enter comments -# ivan@voicenet.com 97-may-8 -# -# rewrote for new API -# ivan@voicenet.com 97-jul-21 -# -# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: unsusp_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.5 1999/02/28 00:03:53 ivan -# removed misleading comments -# -# Revision 1.4 1999/01/19 05:14:09 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:05:25 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:49 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw( $cgi $query $pkgnum $cust_pkg $error ); -- cgit v1.2.1 From fbcb45dfe5a1bce7981fe4527176b9fdf2ec54b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Sep 2001 22:07:39 +0000 Subject: fix more bugs --- httemplate/misc/bill.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index cc7938308..43c7c576d 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $cust_main $error ); @@ -25,6 +25,9 @@ $error = $cust_main->bill( ); &eidiot($error) if $error; +$cust_main->apply_payments; +$cust_main->apply_credits; + $error = $cust_main->collect( # 'invoice-time'=>$time, # 'batch_card'=> 'yes', -- cgit v1.2.1 From a984fa561b6493ae41215c3d26013767f9ce79cb Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Oct 2001 12:16:42 +0000 Subject: print reasons with credits on invoices use straight eval, not Safe::reval in cust_main::bill for now, as i have no idea how to call methods on a share()'ed scalar. hmm. add cust_pkg::cust_main method s/eidiot/idiot/ in httemplate/misc/bill.cgi --- httemplate/misc/bill.cgi | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 43c7c576d..48da25562 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,12 +1,13 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $cust_main $error ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); +#use FS::CGI qw(popurl eidiot); +use FS::CGI qw(popurl idiot); use FS::Record qw(qsearchs); use FS::cust_main; @@ -23,19 +24,24 @@ die "Can't find customer!\n" unless $cust_main; $error = $cust_main->bill( # 'time'=>$time ); -&eidiot($error) if $error; - -$cust_main->apply_payments; -$cust_main->apply_credits; - -$error = $cust_main->collect( -# 'invoice-time'=>$time, -# 'batch_card'=> 'yes', - 'batch_card'=> 'no', - 'report_badcard'=> 'yes', - ); -&eidiot($error) if $error; - -print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); - +#&eidiot($error) if $error; + +unless ( $error ) { + $cust_main->apply_payments; + $cust_main->apply_credits; + + $error = $cust_main->collect( + # 'invoice-time'=>$time, + # 'batch_card'=> 'yes', + 'batch_card'=> 'no', + 'report_badcard'=> 'yes', + ); +} +#&eidiot($error) if $error; + +if ( $error ) { + &idiot($error); +} else { + print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); +} %> -- cgit v1.2.1 From 91387f8f489e561deaf1de052d80ef800a4970a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Oct 2001 10:24:56 +0000 Subject: cache foo *sigh* --- httemplate/misc/catchall.cgi | 4 ++-- httemplate/misc/delete-customer.cgi | 4 ++-- httemplate/misc/link.cgi | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 9ebec6688..7e90ac4e0 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart @@ -94,7 +94,7 @@ if ($pkgnum) { $email{0} = "(none)"; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Domain Catchall Edit", ''); +print $cgi->header( @FS::CGI::header ), header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 3a7330960..ec1f734f1 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); @@ -28,7 +28,7 @@ if ( $cgi->param('error') ) { $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -print $cgi->header ( '-expires' => 'now' ), header('Delete customer'); +print $cgi->header ( @FS::CGI::header ), header('Delete customer'); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index f4b70f76a..cd873cc8d 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb @@ -32,7 +32,7 @@ $svc = $part_svc->getfield('svc'); $svcdb = $part_svc->getfield('svcdb'); $link_field = $link_field{$svcdb}; -print $cgi->header( '-expires' => 'now' ), header("Link to existing $svc"), +print $cgi->header( @FS::CGI::header ), header("Link to existing $svc"), qq!!; if ( $link_field ) { -- cgit v1.2.1 From c14a267229fc0d6f2d2afdebab3bd34d825df2ef Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Oct 2001 14:54:07 +0000 Subject: get rid of header foo in individual templates --- httemplate/misc/catchall.cgi | 4 ++-- httemplate/misc/delete-customer.cgi | 4 ++-- httemplate/misc/link.cgi | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 7e90ac4e0..3aafd0d49 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart @@ -94,7 +94,7 @@ if ($pkgnum) { $email{0} = "(none)"; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Domain Catchall Edit", ''); +print header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index ec1f734f1..d3e7c798f 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); @@ -28,7 +28,7 @@ if ( $cgi->param('error') ) { $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -print $cgi->header ( @FS::CGI::header ), header('Delete customer'); +print header('Delete customer'); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index cd873cc8d..801b92006 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb @@ -32,7 +32,7 @@ $svc = $part_svc->getfield('svc'); $svcdb = $part_svc->getfield('svcdb'); $link_field = $link_field{$svcdb}; -print $cgi->header( @FS::CGI::header ), header("Link to existing $svc"), +print header("Link to existing $svc"), qq!!; if ( $link_field ) { -- cgit v1.2.1 From 1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 30 Jan 2002 14:18:09 +0000 Subject: remove use Module; and $cgi = new CGI; &cgisuidsetup(); from all templates. should work better under Mason. --- httemplate/misc/bill.cgi | 23 +++++------------------ httemplate/misc/cancel-unaudited.cgi | 28 ++++++++-------------------- httemplate/misc/cancel_pkg.cgi | 25 ++++++------------------- httemplate/misc/catchall.cgi | 28 +++++++--------------------- httemplate/misc/delete-customer.cgi | 21 +++++---------------- httemplate/misc/expire_pkg.cgi | 26 +++++++------------------- httemplate/misc/link.cgi | 27 ++++++++------------------- httemplate/misc/print-invoice.cgi | 26 +++++++------------------- httemplate/misc/process/catchall.cgi | 21 +++++---------------- httemplate/misc/process/delete-customer.cgi | 23 ++++++----------------- httemplate/misc/process/link.cgi | 26 +++++++------------------- httemplate/misc/susp_pkg.cgi | 22 +++++----------------- httemplate/misc/unsusp_pkg.cgi | 22 +++++----------------- 13 files changed, 81 insertions(+), 237 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 48da25562..731309585 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,27 +1,14 @@ + <% -# - -use strict; -use vars qw( $cgi $query $custnum $cust_main $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -#use FS::CGI qw(popurl eidiot); -use FS::CGI qw(popurl idiot); -use FS::Record qw(qsearchs); -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); #untaint custnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d*)$/; -$custnum = $1; -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Can't find customer!\n" unless $cust_main; -$error = $cust_main->bill( +my $error = $cust_main->bill( # 'time'=>$time ); #&eidiot($error) if $error; diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 9b90967d9..3e2bd07db 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -1,28 +1,16 @@ -<% -# - -use strict; -use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error $dbh ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_svc; -use FS::svc_acct; - -$cgi = new CGI; -$dbh = &cgisuidsetup($cgi); + + +my $dbh = dbh; #untaint svcnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; +my $svcnum = $1; -$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); die "Unknown svcnum!" unless $svc_acct; -$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); &eidiot(qq!This account has already been audited. Cancel the package instead.!) @@ -36,7 +24,7 @@ local $SIG{TSTP} = 'IGNORE'; local $FS::UID::AutoCommit = 0; -$error = $svc_acct->cancel; +my $error = $svc_acct->cancel; &myeidiot($error) if $error; $error = $svc_acct->delete; &myeidiot($error) if $error; diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi index 8129463ae..1513ef05e 100755 --- a/httemplate/misc/cancel_pkg.cgi +++ b/httemplate/misc/cancel_pkg.cgi @@ -1,29 +1,16 @@ + <% -# -use strict; -use vars qw ( $cgi $query $pkgnum $cust_pkg $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(eidiot popurl); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl eidiot); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); - #untaint pkgnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -$error = $cust_pkg->cancel; +my $error = $cust_pkg->cancel; eidiot($error) if $error; -print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); +print $cgi->redirect($p. "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); %> diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 3aafd0d49..a8d865780 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,24 +1,9 @@ + <% -# - -use strict; -use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart - $part_svc $query %email $p1 $domain $catchall ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch qsearchs fields); -use FS::svc_acct; -use FS::svc_domain; -use FS::svc_forward; -use FS::Conf; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; + +my($svc_domain, $svcnum, $pkgnum, $svcpart, $part_svc); if ( $cgi->param('error') ) { $svc_domain = new FS::svc_domain ( { map { $_, scalar($cgi->param($_)) } fields('svc_domain') @@ -51,6 +36,7 @@ if ( $cgi->param('error') ) { } } +my %email; if ($pkgnum) { #find all possible user svcnums (and emails) @@ -93,7 +79,7 @@ if ($pkgnum) { # add an absence of a catchall $email{0} = "(none)"; -$p1 = popurl(1); +my $p1 = popurl(1); print header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), @@ -117,7 +103,7 @@ print qq!!; #svcpart print qq!!; -($domain,$catchall)=( +my($domain,$catchall)=( $svc_domain->domain, $svc_domain->catchall, ); diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index d3e7c798f..18f6e8529 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,31 +1,20 @@ + <% -# -use strict; -use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch qsearchs); -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); +my($custnum, $new_custnum); if ( $cgi->param('error') ) { $custnum = $cgi->param('custnum'); $new_custnum = $cgi->param('new_custnum'); } else { - ($query) = $cgi->keywords; + my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "Illegal query: $query"; $custnum = $1; $new_custnum = ''; } -$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) +my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; print header('Delete customer'); diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi index 21e220d18..739fb517f 100755 --- a/httemplate/misc/expire_pkg.cgi +++ b/httemplate/misc/expire_pkg.cgi @@ -1,21 +1,9 @@ + <% -# - -use strict; -use vars qw ( $cgi $date $pkgnum $cust_pkg %hash $new $error ); -use Date::Parse; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); #untaint date & pkgnum +my $date; if ( $cgi->param('date') ) { str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; $date=$1; @@ -24,13 +12,13 @@ if ( $cgi->param('date') ) { } $cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%hash = $cust_pkg->hash; +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my %hash = $cust_pkg->hash; $hash{expire}=$date; -$new = new FS::cust_pkg ( \%hash ); -$error = $new->replace($cust_pkg); +my $new = new FS::cust_pkg ( \%hash ); +my $error = $new->replace($cust_pkg); &eidiot($error) if $error; print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 801b92006..3bcb5d978 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,16 +1,7 @@ + <% -# -use strict; -use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb - $link_field ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header); -use FS::Record qw(qsearchs); - -%link_field = ( +my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', 'svc_acct_sm' => '', @@ -18,19 +9,17 @@ use FS::Record qw(qsearchs); 'svc_wo' => '', ); -$cgi = new CGI; -cgisuidsetup($cgi); - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; +my($pkgnum, $svcpart) = ('', ''); foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } -$part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); -$svc = $part_svc->getfield('svc'); -$svcdb = $part_svc->getfield('svcdb'); -$link_field = $link_field{$svcdb}; +my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); +my $svc = $part_svc->getfield('svc'); +my $svcdb = $part_svc->getfield('svcdb'); +my $link_field = $link_field{$svcdb}; print header("Link to existing $svc"), qq!!; diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index a6cb05230..aec7cb39c 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,26 +1,14 @@ + <% -# -use strict; -use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs); -use FS::cust_bill; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$lpr = $conf->config('lpr'); +my $conf = new FS::Conf; +my $lpr = $conf->config('lpr'); #untaint invnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d*)$/; -$invnum = $1; -$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +my $invnum = $1; +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; @@ -29,7 +17,7 @@ die "Can't find invoice!\n" unless $cust_bill; or die $! ? "Error closing $lpr: $!" : "Exit status $? from $lpr"; -$custnum = $cust_bill->getfield('custnum'); +my $custnum = $cust_bill->getfield('custnum'); print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index 6b1147633..cf6f8d751 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,26 +1,14 @@ + <% -# - -use strict; -use vars qw( $cgi $svcnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::svc_domain; -use FS::CGI qw(popurl); $FS::svc_domain::whois_hack=1; -$cgi = new CGI; -cgisuidsetup($cgi); - $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum =$1; +my $svcnum =$1; -$old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; +my $old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; -$new = new FS::svc_domain ( { +my $new = new FS::svc_domain ( { map { ($_, scalar($cgi->param($_))); } ( fields('svc_domain'), qw( pkgnum svcpart ) ) @@ -28,6 +16,7 @@ $new = new FS::svc_domain ( { $new->setfield('action' => 'M'); +my $error; if ( $svcnum ) { $error = $new->replace($old); } else { diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index 4be52004b..6f26c8107 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,23 +1,12 @@ + <% -# -use strict; -use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl); -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); $cgi->param('custnum') =~ /^(\d+)$/; -$custnum = $1; +my $custnum = $1; +my $new_custnum; if ( $cgi->param('new_custnum') ) { $cgi->param('new_custnum') =~ /^(\d+)$/ or die "Illegal new customer number: ". $cgi->param('new_custnum'); @@ -25,10 +14,10 @@ if ( $cgi->param('new_custnum') ) { } else { $new_custnum = ''; } -$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) +my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -$error = $cust_main->delete($new_custnum); +my $error = $cust_main->delete($new_custnum); if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 6b34e8a5d..80a5de81f 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,24 +1,12 @@ + <% -# - -use strict; -use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::CGI qw(popurl idiot eidiot); -use FS::UID qw(cgisuidsetup); -use FS::cust_svc; -use FS::Record qw(qsearchs); - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('pkgnum') =~ /^(\d+)$/; -$pkgnum = $1; +my $pkgnum = $1; $cgi->param('svcpart') =~ /^(\d+)$/; -$svcpart = $1; +my $svcpart = $1; $cgi->param('svcnum') =~ /^(\d*)$/; -$svcnum = $1; +my $svcnum = $1; unless ( $svcnum ) { my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); @@ -29,15 +17,15 @@ unless ( $svcnum ) { $svcnum=$svc_acct->svcnum; } -$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; -$new = new FS::cust_svc ({ +my $new = new FS::cust_svc ({ 'svcnum' => $svcnum, 'pkgnum' => $pkgnum, 'svcpart' => $svcpart, }); -$error = $new->replace($old); +my $error = $new->replace($old); unless ($error) { #no errors, so let's view this customer. diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi index 602314436..efc2f9bba 100755 --- a/httemplate/misc/susp_pkg.cgi +++ b/httemplate/misc/susp_pkg.cgi @@ -1,26 +1,14 @@ + <% -# -use strict; -use vars qw( $cgi $query $pkgnum $cust_pkg $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl eidiot); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); - #untaint pkgnum -($query) = $cgi->keywords; +my ($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -$error = $cust_pkg->suspend; +my $error = $cust_pkg->suspend; &eidiot($error) if $error; print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi index 8e1b5261b..00f3a08b3 100755 --- a/httemplate/misc/unsusp_pkg.cgi +++ b/httemplate/misc/unsusp_pkg.cgi @@ -1,26 +1,14 @@ + <% -# -use strict; -use vars qw( $cgi $query $pkgnum $cust_pkg $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); - #untaint pkgnum -($query) = $cgi->keywords; +my ($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -$error = $cust_pkg->unsuspend; +my $error = $cust_pkg->unsuspend; &eidiot($error) if $error; print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -- cgit v1.2.1 From 69c6e80a7253f927af1780a3e0dd3fcf50110599 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 7 Feb 2002 22:29:35 +0000 Subject: delete payments --- httemplate/misc/delete-cust_pay.cgi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 httemplate/misc/delete-cust_pay.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-cust_pay.cgi b/httemplate/misc/delete-cust_pay.cgi new file mode 100755 index 000000000..3fb786d7d --- /dev/null +++ b/httemplate/misc/delete-cust_pay.cgi @@ -0,0 +1,17 @@ + +<% + +#untaint paynum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal paynum"; +my $paynum = $1; + +my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum}); +my $custnum = $cust_pay->custnum; + +my $error = $cust_pay->delete; +eidiot($error) if $error; + +print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); + +%> -- cgit v1.2.1 From 4c18a45810f000bb013d23d4738cfca012794c4b Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 Feb 2002 17:45:26 +0000 Subject: have FS::cust_svc::check look up & check pkg_svc.quantity like httemplate/view/cust_pkg.cgi (closes: Bug#43) --- httemplate/misc/process/link.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 80a5de81f..f8b7812e1 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,4 +1,4 @@ - + <% $cgi->param('pkgnum') =~ /^(\d+)$/; @@ -12,13 +12,14 @@ unless ( $svcnum ) { my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); my($svcdb) = $part_svc->getfield('svcdb'); $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; - my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); - eidiot("$link_field not found!") unless $svc_acct; - $svcnum=$svc_acct->svcnum; + my($svc_x)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_x; + $svcnum=$svc_x->svcnum; } my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; +#die "svcnum $svcnum already linked to package ". $old->pkgnum if $old->pkgnum; my $new = new FS::cust_svc ({ 'svcnum' => $svcnum, 'pkgnum' => $pkgnum, -- cgit v1.2.1 From 22a35047ecdffff80110e06cc08fc84f9ddba9b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 13:21:31 +0000 Subject: removed from all files to fix any redirects, whew Mason handler.pl overrides CGI::redirect fixed strict; problems in edit/part_pkg.cgi & edit/process/part_pkg.cgi --- httemplate/misc/bill.cgi | 1 - httemplate/misc/cancel-unaudited.cgi | 2 +- httemplate/misc/cancel_pkg.cgi | 1 - httemplate/misc/catchall.cgi | 1 - httemplate/misc/delete-cust_pay.cgi | 1 - httemplate/misc/delete-customer.cgi | 1 - httemplate/misc/expire_pkg.cgi | 1 - httemplate/misc/link.cgi | 1 - httemplate/misc/print-invoice.cgi | 1 - httemplate/misc/process/catchall.cgi | 1 - httemplate/misc/process/delete-customer.cgi | 1 - httemplate/misc/process/link.cgi | 1 - httemplate/misc/susp_pkg.cgi | 1 - httemplate/misc/unsusp_pkg.cgi | 1 - 14 files changed, 1 insertion(+), 14 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 731309585..8c21fe1bb 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,4 +1,3 @@ - <% #untaint custnum diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 3e2bd07db..a73b2ce97 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -1,4 +1,4 @@ - +<% my $dbh = dbh; diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi index 1513ef05e..0487677df 100755 --- a/httemplate/misc/cancel_pkg.cgi +++ b/httemplate/misc/cancel_pkg.cgi @@ -1,4 +1,3 @@ - <% #untaint pkgnum diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index a8d865780..cc4adb88a 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; diff --git a/httemplate/misc/delete-cust_pay.cgi b/httemplate/misc/delete-cust_pay.cgi index 3fb786d7d..3efd918ab 100755 --- a/httemplate/misc/delete-cust_pay.cgi +++ b/httemplate/misc/delete-cust_pay.cgi @@ -1,4 +1,3 @@ - <% #untaint paynum diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 18f6e8529..0ed3d0194 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi index 739fb517f..9e4ce8b62 100755 --- a/httemplate/misc/expire_pkg.cgi +++ b/httemplate/misc/expire_pkg.cgi @@ -1,4 +1,3 @@ - <% #untaint date & pkgnum diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 3bcb5d978..81e1bc448 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,4 +1,3 @@ - <% my %link_field = ( diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index aec7cb39c..a5500bff2 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index cf6f8d751..44a63f9f8 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,4 +1,3 @@ - <% $FS::svc_domain::whois_hack=1; diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index 6f26c8107..16bdbaea8 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index f8b7812e1..af96c0bcd 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,4 +1,3 @@ - <% $cgi->param('pkgnum') =~ /^(\d+)$/; diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi index efc2f9bba..4a19fa830 100755 --- a/httemplate/misc/susp_pkg.cgi +++ b/httemplate/misc/susp_pkg.cgi @@ -1,4 +1,3 @@ - <% #untaint pkgnum diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi index 00f3a08b3..500872983 100755 --- a/httemplate/misc/unsusp_pkg.cgi +++ b/httemplate/misc/unsusp_pkg.cgi @@ -1,4 +1,3 @@ - <% #untaint pkgnum -- cgit v1.2.1 From a4c96748eb6eab29a70f3a944c6520283a635c78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 16:05:22 +0000 Subject: *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. --- httemplate/misc/bill.cgi | 3 +++ httemplate/misc/cancel-unaudited.cgi | 15 +++++++++------ httemplate/misc/catchall.cgi | 1 + httemplate/misc/delete-customer.cgi | 1 + httemplate/misc/link.cgi | 1 + httemplate/misc/process/link.cgi | 3 +++ 6 files changed, 18 insertions(+), 6 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 8c21fe1bb..6f523a52c 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -26,6 +26,9 @@ unless ( $error ) { #&eidiot($error) if $error; if ( $error ) { +%> + +<% &idiot($error); } else { print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index a73b2ce97..5d3c87316 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -30,15 +30,18 @@ $error = $svc_acct->delete; &myeidiot($error) if $error; $error = $cust_svc->delete; -&myeidiot($error) if $error; - -$dbh->commit or die $dbh->errstr; - -print $cgi->redirect(popurl(2)); -sub myeidiot { +if ( $error ) { $dbh->rollback; + %> + +<% &eidiot(@_); +} else { + + $dbh->commit or die $dbh->errstr; + + print $cgi->redirect(popurl(2)); } %> diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index cc4adb88a..9aa84be18 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,3 +1,4 @@ + <% my $conf = new FS::Conf; diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 0ed3d0194..5088fef7b 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,3 +1,4 @@ + <% my $conf = new FS::Conf; diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 81e1bc448..efc762cc5 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,3 +1,4 @@ + <% my %link_field = ( diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index af96c0bcd..4b220a867 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -31,6 +31,9 @@ unless ($error) { #no errors, so let's view this customer. print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); } else { +%> + +<% idiot($error); } -- cgit v1.2.1 From 8f42b751aebda2e7dce2c363bed6f1e15b411b1d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2002 01:03:10 +0000 Subject: use Net::SSH::ssh_cmd for all job queueing rather than local duplicated ssh subs queue daemon updates: retry & remove links work, bubble up error message to webinterface, link to svcnum & have job listings on view/svc_* pages, closes: Bug#280 s/option/optionname/ schema change, dumb mysql, closes: Bug#334 --- httemplate/misc/queue.cgi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 httemplate/misc/queue.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi new file mode 100644 index 000000000..7e962d498 --- /dev/null +++ b/httemplate/misc/queue.cgi @@ -0,0 +1,25 @@ +<% + +$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; +my $jobnum = $1; +my $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; + +$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +my $action = $1; + +if ( $action eq 'new' ) { + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; +} elsif ( $action eq 'del' ) { + my $error = $job->delete; + die $error if $error; +} + +print $cgi->redirect(popurl(2). "browse/queue.cgi"); + +%> -- cgit v1.2.1 From 8068d7c9cca24c3517ea46f1addf412a9d362de9 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 28 Feb 2002 23:07:32 +0000 Subject: handle errors better --- httemplate/misc/cancel-unaudited.cgi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 5d3c87316..8f31db838 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -25,11 +25,8 @@ local $SIG{TSTP} = 'IGNORE'; local $FS::UID::AutoCommit = 0; my $error = $svc_acct->cancel; -&myeidiot($error) if $error; -$error = $svc_acct->delete; -&myeidiot($error) if $error; - -$error = $cust_svc->delete; +$error ||= $svc_acct->delete; +$error ||= $cust_svc->delete; if ( $error ) { $dbh->rollback; -- cgit v1.2.1 From 62a0a2a05de9f43e625357cc262312b86d178799 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 12 Mar 2002 18:45:36 +0000 Subject: print error message for failed cancels! --- httemplate/misc/cancel-unaudited.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 8f31db838..ecfaef29f 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -33,7 +33,7 @@ if ( $error ) { %> <% - &eidiot(@_); + &eidiot($error); } else { $dbh->commit or die $dbh->errstr; -- cgit v1.2.1 From b159f42fa3f48cc2ca3b43773e7661e17d2fb072 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Mar 2002 12:49:43 +0000 Subject: more new export... --- httemplate/misc/delete-part_export.cgi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 httemplate/misc/delete-part_export.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-part_export.cgi b/httemplate/misc/delete-part_export.cgi new file mode 100755 index 000000000..a5166d944 --- /dev/null +++ b/httemplate/misc/delete-part_export.cgi @@ -0,0 +1,15 @@ +<% + +#untaint paynum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal exportnum"; +my $exportnum = $1; + +my $part_export = qsearchs('part_export',{'exportnum'=>$exportnum}); + +my $error = $part_export->delete; +eidiot($error) if $error; + +print $cgi->redirect($p. "browse/part_svc.cgi"); + +%> -- cgit v1.2.1 From a7c1b602f88c177db34477ed4cdc1f72603f8995 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Apr 2002 22:05:31 +0000 Subject: (almost) everything for bug#375 - create export_svc table - part_svc to part_export is now properly many-to-many, not one-to-many still need to finish service editing (choosing exports) in httemplate/edit/part_svc.cgi and httemplate/edti/process/part_svc.cgi and do somethinga about that manual $svcdb = 'svc_acct' in httemplate/edit/part_export.cgi (do part_export records need a svcdb? probably not... should be able to just pass an svcdb on creation of new exports, move the big %exports hash into part_export.pm and allow httemplate/edit/part_svc.cgi to query it for exports that can apply to a given svcdb.... --- httemplate/misc/delete-part_export.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-part_export.cgi b/httemplate/misc/delete-part_export.cgi index a5166d944..34ef06b96 100755 --- a/httemplate/misc/delete-part_export.cgi +++ b/httemplate/misc/delete-part_export.cgi @@ -10,6 +10,6 @@ my $part_export = qsearchs('part_export',{'exportnum'=>$exportnum}); my $error = $part_export->delete; eidiot($error) if $error; -print $cgi->redirect($p. "browse/part_svc.cgi"); +print $cgi->redirect($p. "browse/part_export.cgi"); %> -- cgit v1.2.1 From e6ea57971831f25d682d97a0ba508c39b66ecd8b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 12 Apr 2002 13:22:03 +0000 Subject: - should finish off the part_svc -> part_export s/one-to-many/many-to-many/ transition (closes: Bug#375) - fixes a nasty export scoping bug with message catalogs, whew --- httemplate/misc/delete-customer.cgi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 5088fef7b..7016c9166 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -43,4 +43,18 @@ canceled service with you. For that, cancel all of the customer's packages. END +#Deleting a customer you have financial records on (i.e. credits) is +#typically considered fraudulant bookkeeping. Remember, deleting +#customers should ONLY be used for completely bogus records. You should +#NOT delete real customers who simply discontinue service. +# +#For real customers who simply discontinue service, cancel all of the +#customer's packages. Customers with all cancelled packages are not +#billed. There is no need to take further action to prevent billing on +#customers with all cancelled packages. +# +#Also see the "hidecancelledcustomers" and "hidecancelledpackages" +#configuration options, which will allow you to surpress the display of +#cancelled customers and packages, respectively. + %> -- cgit v1.2.1 From f70985da9714a8a2c5dd87f56d891ed0197ef590 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 13 Apr 2002 08:51:54 +0000 Subject: bulk queue operations (closes: Bug#389) --- httemplate/misc/queue.cgi | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index 7e962d498..8c1e5362d 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -1,13 +1,17 @@ <% -$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; -my $jobnum = $1; -my $job = qsearchs('queue', { 'jobnum' => $1 }) - or die "unknown jobnum $jobnum"; - -$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +$cgi->param('action') =~ /^(new|del|(retry|remove) selected)$/ + or die "Illegal action"; my $action = $1; +my $job; +if ( $action eq 'new' || $action eq 'del' ) { + $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; + my $jobnum = $1; + $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; +} + if ( $action eq 'new' ) { my %hash = $job->hash; $hash{'status'} = 'new'; @@ -18,6 +22,23 @@ if ( $action eq 'new' ) { } elsif ( $action eq 'del' ) { my $error = $job->delete; die $error if $error; +} elsif ( $action =~ /^(retry|remove) selected$/ ) { + foreach my $jobnum ( + map { /^jobnum(\d+)$/; $1; } grep /^jobnum\d+$/, $cgi->param + ) { + my $job = qsearchs('queue', { 'jobnum' => $jobnum }); + if ( $action eq 'retry selected' && $job ) { #new + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; + } elsif ( $action eq 'remove selected' && $job ) { #del + my $error = $job->delete; + die $error if $error; + } + } } print $cgi->redirect(popurl(2). "browse/queue.cgi"); -- cgit v1.2.1 From 23186f0338ec248d930c85db08cc997bca42525b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 22 May 2002 18:44:01 +0000 Subject: bind export, editing zones, deleting unaudited domains, mmm --- httemplate/misc/cancel-unaudited.cgi | 11 +++++++---- httemplate/misc/delete-domain_record.cgi | 15 +++++++++++++++ httemplate/misc/delete-part_export.cgi | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 httemplate/misc/delete-domain_record.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index ecfaef29f..f1fb15341 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -7,15 +7,18 @@ my($query) = $cgi->keywords; $query =~ /^(\d+)$/; my $svcnum = $1; -my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); -die "Unknown svcnum!" unless $svc_acct; +#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +#die "Unknown svcnum!" unless $svc_acct; my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $cust_svc; &eidiot(qq!This account has already been audited. Cancel the package instead.!) if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; +my $svc_x = $cust_svc->svc_x; + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -24,8 +27,8 @@ local $SIG{TSTP} = 'IGNORE'; local $FS::UID::AutoCommit = 0; -my $error = $svc_acct->cancel; -$error ||= $svc_acct->delete; +my $error = $svc_x->cancel; +$error ||= $svc_x->delete; $error ||= $cust_svc->delete; if ( $error ) { diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi new file mode 100755 index 000000000..dcc2d5022 --- /dev/null +++ b/httemplate/misc/delete-domain_record.cgi @@ -0,0 +1,15 @@ +<% + +#untaint recnum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal recnum"; +my $recnum = $1; + +my $domain_record = qsearchs('domain_record',{'recnum'=>$recnum}); + +my $error = $domain_record->delete; +eidiot($error) if $error; + +print $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum); + +%> diff --git a/httemplate/misc/delete-part_export.cgi b/httemplate/misc/delete-part_export.cgi index 34ef06b96..7c4ab8b9d 100755 --- a/httemplate/misc/delete-part_export.cgi +++ b/httemplate/misc/delete-part_export.cgi @@ -1,6 +1,6 @@ <% -#untaint paynum +#untaint exportnum my($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal exportnum"; my $exportnum = $1; -- cgit v1.2.1 From 68d29e0ca9fcfe6b68240d946c8bf71d7b31767a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 May 2002 21:51:48 +0000 Subject: point to correct place for hidecancelledcustomers config option --- httemplate/misc/delete-customer.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 7016c9166..430231737 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -36,7 +36,7 @@ print <completely remove all traces of this customer record. This is not what you want if this is a real customer who has simply canceled service with you. For that, cancel all of the customer's packages. -(you can optionally hide cancelled customers with the hidecancelledcustomers configuration file) +(you can optionally hide cancelled customers with the hidecancelledcustomers configuration option)

Are you absolutely sure you want to delete this customer?
-- cgit v1.2.1 From f21edcf70602d7f2ea314d65382bd8c40f51d530 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Jun 2002 22:48:03 +0000 Subject: also retry cards when user clicks "Bill now" (closes: Bug#417) --- httemplate/misc/bill.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 6f523a52c..f048e5559 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -18,9 +18,10 @@ unless ( $error ) { $error = $cust_main->collect( # 'invoice-time'=>$time, - # 'batch_card'=> 'yes', - 'batch_card'=> 'no', - 'report_badcard'=> 'yes', + #'batch_card'=> 'yes', + #'batch_card'=> 'no', + #'report_badcard'=> 'yes', + 'retry_card' => 'yes', ); } #&eidiot($error) if $error; -- cgit v1.2.1 From 967ff9a298e535bf3ad4611737a99932ed2f6e1a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Jun 2002 23:52:39 +0000 Subject: better error message --- httemplate/misc/queue.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index 8c1e5362d..ce9c8fbd3 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -9,7 +9,8 @@ if ( $action eq 'new' || $action eq 'del' ) { $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; my $jobnum = $1; $job = qsearchs('queue', { 'jobnum' => $1 }) - or die "unknown jobnum $jobnum"; + or die "unknown jobnum $jobnum - ". + "it probably completed normally or was removed by another user"; } if ( $action eq 'new' ) { -- cgit v1.2.1 From 21b3f9beaa73e13f7d5499c4852192594d20f5fb Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 27 Jul 2002 03:56:44 +0000 Subject: move transaction from web interface to lib code --- httemplate/misc/cancel-unaudited.cgi | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index f1fb15341..11cde968d 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -17,30 +17,14 @@ die "Unknown svcnum!" unless $cust_svc; qq!pkgnum"> package instead.!) if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; -my $svc_x = $cust_svc->svc_x; - -local $SIG{HUP} = 'IGNORE'; -local $SIG{INT} = 'IGNORE'; -local $SIG{QUIT} = 'IGNORE'; -local $SIG{TERM} = 'IGNORE'; -local $SIG{TSTP} = 'IGNORE'; - -local $FS::UID::AutoCommit = 0; - -my $error = $svc_x->cancel; -$error ||= $svc_x->delete; -$error ||= $cust_svc->delete; +my $error = $cust_svc->cancel; if ( $error ) { - $dbh->rollback; %> <% &eidiot($error); } else { - - $dbh->commit or die $dbh->errstr; - print $cgi->redirect(popurl(2)); } -- cgit v1.2.1 From 96fd4cf172f2b9fbdd00f7b7fe7a7797132b88c2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 24 Aug 2002 03:29:16 +0000 Subject: unprovision a single service --- httemplate/misc/unprovision.cgi | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 httemplate/misc/unprovision.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi new file mode 100755 index 000000000..8f2a7d13d --- /dev/null +++ b/httemplate/misc/unprovision.cgi @@ -0,0 +1,33 @@ +<% + +my $dbh = dbh; + +#untaint svcnum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $svcnum = $1; + +#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +#die "Unknown svcnum!" unless $svc_acct; + +my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $cust_svc; +#&eidiot(qq!This account has already been audited. Cancel the +# package instead.!) +# if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; + +my $custnum = $cust_svc->cust_pkg->custnum; + +my $error = $cust_svc->cancel; + +if ( $error ) { + %> + +<% + &eidiot($error); +} else { + print $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum"); +} + +%> -- cgit v1.2.1 From 04af7174c8f52ff484af7851f687e98f4d88670c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 Aug 2002 17:34:06 +0000 Subject: working CSV import for crcmn --- httemplate/misc/cust_main-import.cgi | 51 ++++++++++++++++++++++++++++ httemplate/misc/process/cust_main-import.cgi | 30 ++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 httemplate/misc/cust_main-import.cgi create mode 100644 httemplate/misc/process/cust_main-import.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi new file mode 100644 index 000000000..6b36f478d --- /dev/null +++ b/httemplate/misc/cust_main-import.cgi @@ -0,0 +1,51 @@ + +<%= header('Batch Customer Import') %> +
+Import a CSV file containing customer records.

+Default file format is CSV, with the following field order: cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments

+ +<% + #false laziness with edit/cust_main.cgi + my @agents = qsearch( 'agent', {} ); + die "No agents created!" unless @agents; + my $agentnum = $agents[0]->agentnum; #default to first + + if ( scalar(@agents) == 1 ) { +%> + +<% } else { %> +

Agent

+<% } %> + +<% + my @referrals = qsearch('part_referral',{}); + die "No advertising sources created!" unless @referrals; + my $refnum = $referrals[0]->refnum; #default to first + + if ( scalar(@referrals) == 1 ) { +%> + +<% } else { %> +

Advertising source

+<% } %> + + First package:

+ + CSV Filename:

+ +
+ + + diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi new file mode 100644 index 000000000..9e1adce54 --- /dev/null +++ b/httemplate/misc/process/cust_main-import.cgi @@ -0,0 +1,30 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_import( { + filehandle => $fh, + agentnum => scalar($cgi->param('agentnum')), + refnum => scalar($cgi->param('refnum')), + pkgpart => scalar($cgi->param('pkgpart')), + 'fields' => [qw( cust_pkg.setup dayphone first last address1 address2 + city state zip comments )], + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import.cgi + } else { + %> + + <%= header('Import sucessful') %> <% + } +%> -- cgit v1.2.1 From 10ffb6447a6e045b379f38bb78a7cb154076c2fd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 5 Sep 2002 13:28:00 +0000 Subject: batch charge/credit import --- httemplate/misc/cust_main-import_charges.cgi | 14 ++++++++++++ .../misc/process/cust_main-import_charges.cgi | 26 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 httemplate/misc/cust_main-import_charges.cgi create mode 100644 httemplate/misc/process/cust_main-import_charges.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import_charges.cgi b/httemplate/misc/cust_main-import_charges.cgi new file mode 100644 index 000000000..0822b9eb6 --- /dev/null +++ b/httemplate/misc/cust_main-import_charges.cgi @@ -0,0 +1,14 @@ + +<%= header('Batch Customer Charge') %> +
+Import a CSV file containing customer charges.

+Default file format is CSV, with the following field order: custnum, amount, description

+If amount is negative, a credit will be applied instead.

+

+ + CSV Filename:

+ +
+ + + diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi new file mode 100644 index 000000000..14df1bd8d --- /dev/null +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -0,0 +1,26 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_charge( { + filehandle => $fh, + 'fields' => [qw( custnum amount pkg )], + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import_charges.cgi + } else { + %> + + <%= header('Import sucessful') %> <% + } +%> -- cgit v1.2.1 From 3595c874f8e476e58b98b7ab6d86918d4dbb1d5c Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 17 Sep 2002 09:19:42 +0000 Subject: remove svc_acct_sm --- httemplate/misc/link.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index efc762cc5..79adce88c 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -4,7 +4,6 @@ my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', - 'svc_acct_sm' => '', 'svc_charge' => '', 'svc_wo' => '', ); -- cgit v1.2.1 From c4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Oct 2002 12:57:06 +0000 Subject: working on the road: - easier "change package" link for changing one package to another - sqlradius export now compatible with Pg - indices on phone numbers - install instructions specify Pg 7.1 (at least until ILIKE thing is changed) - searching on phone number fragments --- httemplate/misc/change_pkg.cgi | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 httemplate/misc/change_pkg.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi new file mode 100755 index 000000000..5346fd9d8 --- /dev/null +++ b/httemplate/misc/change_pkg.cgi @@ -0,0 +1,66 @@ + +<% + +my $pkgnum; +if ( $cgi->param('error') ) { + #$custnum = $cgi->param('custnum'); + #%remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); + $pkgnum = ($cgi->param('remove_pkg'))[0]; +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + #$custnum = $1; + $pkgnum = $1; + #%remove_pkg = (); +} + +my $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ) + or die "unknown pkgnum $pkgnum"; +my $custnum = $cust_pkg->custnum; + +my $conf = new FS::Conf; + +my $p1 = popurl(1); + +my $cust_main = $cust_pkg->cust_main + or die "can't get cust_main record for custnum ". $cust_pkg->custnum. + " ( pkgnum ". cust_pkg->pkgnum. ")"; +my $agent = $cust_main->agent; + +print header("Change Package", menubar( + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + 'Main Menu' => $p, +)); + +print qq!Error: !, $cgi->param('error'), + "

" + if $cgi->param('error'); + +my $part_pkg = $cust_pkg->part_pkg; + +print small_custview( $cust_main, $conf->config('countrydefault') ). + qq!
!. + qq!!. + qq!!. + '
Current package: '. $part_pkg->pkg. ' - '. $part_pkg->comment. + qq!
New package: +
+ + +END +%> -- cgit v1.2.1 From 9f96bd19b87cb0084dda17da070f3bb5dadd4823 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Oct 2002 15:49:44 +0000 Subject: add option to unapply payments --- httemplate/misc/unapply-cust_pay.cgi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 httemplate/misc/unapply-cust_pay.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/unapply-cust_pay.cgi b/httemplate/misc/unapply-cust_pay.cgi new file mode 100755 index 000000000..28643ef6e --- /dev/null +++ b/httemplate/misc/unapply-cust_pay.cgi @@ -0,0 +1,18 @@ +<% + +#untaint paynum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal paynum"; +my $paynum = $1; + +my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); +my $custnum = $cust_pay->custnum; + +foreach my $cust_bill_pay ( $cust_pay->cust_bill_pay ) { + my $error = $cust_bill_pay->delete; + eidiot($error) if $error; +} + +print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); + +%> -- cgit v1.2.1 From 69a956aecd4bc89c683e60f9ec3fe0c9e11ea0d7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 26 Nov 2002 11:58:14 +0000 Subject: link by username now only links to same svcpart --- httemplate/misc/process/link.cgi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 4b220a867..5d80adeb9 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -8,12 +8,15 @@ $cgi->param('svcnum') =~ /^(\d*)$/; my $svcnum = $1; unless ( $svcnum ) { - my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); - my($svcdb) = $part_svc->getfield('svcdb'); - $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; - my($svc_x)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); + my $svcdb = $part_svc->getfield('svcdb'); + $cgi->param('link_field') =~ /^(\w+)$/; + my $link_field = $1; + my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart } + qsearch( $svcdb, { $link_field => $cgi->param('link_value') }) + )[0]; eidiot("$link_field not found!") unless $svc_x; - $svcnum=$svc_x->svcnum; + $svcnum = $svc_x->svcnum; } my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -- cgit v1.2.1 From 6addb511875324241cb002b2fe96225c066d0ddc Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Dec 2002 00:12:22 +0000 Subject: beginning of web-based data importer --- httemplate/misc/meta-import.cgi | 52 ++++++++++++ httemplate/misc/process/meta-import.cgi | 145 ++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 httemplate/misc/meta-import.cgi create mode 100644 httemplate/misc/process/meta-import.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/meta-import.cgi b/httemplate/misc/meta-import.cgi new file mode 100644 index 000000000..ebd2a7e2f --- /dev/null +++ b/httemplate/misc/meta-import.cgi @@ -0,0 +1,52 @@ + +<%= header('Import') %> +
+Import a CSV file containing customer records (zip tar etc).

+ +##no##Default file format is CSV, with the following field order: cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments

+ +<% + #false laziness with edit/cust_main.cgi + my @agents = qsearch( 'agent', {} ); + die "No agents created!" unless @agents; + my $agentnum = $agents[0]->agentnum; #default to first + + if ( scalar(@agents) == 1 ) { +%> + +<% } else { %> +

Agent

+<% } %> + +<% + my @referrals = qsearch('part_referral',{}); + die "No advertising sources created!" unless @referrals; + my $refnum = $referrals[0]->refnum; #default to first + + if ( scalar(@referrals) == 1 ) { +%> + +<% } else { %> +

Advertising source

+<% } %> + + First package:

+ + CSV (zip, tar etc) Filename:

+ +
+ + + diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi new file mode 100644 index 000000000..d42d6d466 --- /dev/null +++ b/httemplate/misc/process/meta-import.cgi @@ -0,0 +1,145 @@ + +<%= header('Map tables') %> + +<% + #one + unless ( $cgi->param('magic') ) { + + #oops, silly + #my $fh = $cgi->upload('csvfile'); + ##warn $cgi; + ##warn $fh; + # + #use Archive::Tar; + #$tar = Archive::Tar->new(); + #$tar->create_archive($fh); #or die $tar->error; + + #haha for now + my @files = qw( +authserv credtype dunprev invoice pmtdet product taxplan +ccdet customer genlog ledger pops pubvars +cchist discplan glacct origco prodcat recur users +credcode dundet invline payment prodclas repforms webserv + ); + + %> +
+ + <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %> +
+
+ + + <% + + } elsif ( $cgi->param('magic') eq 'process' ) { + + %> +
+ + <% + + my $schema_string = $cgi->param('schema'); + my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ + or die "guru meditation #420: $_"; + ( $1 => $2 ); + } + split( /\n/, $schema_string ); + + #*** should be in global.asa/handler.pl like the rest + eval 'use Text::CSV_XS;'; + + foreach my $table ( keys %schema ) { + + my $csv = Text::CSV_XS->new({ 'binary'=>1 }); + open(FILE,"); + close FILE; + $csv->parse($header) or die; + my @from_columns = $csv->fields; + + my @fs_columns = dbdef->table($schema{$table})->columns; + + %> + <%= hashmaker($table, \@from_columns, \@fs_columns, $table, $schema{$table} ) %> +


+ <% + + } + + %> +
+
+ + + <% + + } elsif ( $cgi->param('magic') eq 'process' ) { + + %> + print results!! + <% + } + + #hashmaker widget + sub hashmaker { + my($name, $from, $to, $labelfrom, $labelto) = @_; + $fromsize = scalar(@$from); + $tosize = scalar(@$to); + "'. + '
$labelfrom$labelto
". + qq!\n". + ''. + qq!\n". + '
'. + qq!!. + '
'. + qq!!. + '
'. + "". + ''; + } + +%> -- cgit v1.2.1 From 64d21fc13eddf275f614f54ff9e17eca74dcd858 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 13 Dec 2002 00:31:32 +0000 Subject: taxclass fix (?) --- httemplate/misc/process/meta-import.cgi | 50 +++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index d42d6d466..4c3c7d665 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -19,6 +19,7 @@ function SafeOnsubmit() { gSafeOnsubmit[i](); } +
<% #one unless ( $cgi->param('magic') ) { @@ -41,23 +42,19 @@ credcode dundet invline payment prodclas repforms webserv ); %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %>
-
- - <% } elsif ( $cgi->param('magic') eq 'process' ) { %> -
<% my $schema_string = $cgi->param('schema'); + %><% my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ or die "guru meditation #420: $_"; ( $1 => $2 ); @@ -88,18 +85,47 @@ credcode dundet invline payment prodclas repforms webserv %>
-
- - <% - } elsif ( $cgi->param('magic') eq 'process' ) { + } elsif ( $cgi->param('magic') eq 'process2' ) { - %> - print results!! - <% + print "
\n";
+    #false laziness with above
+    my $schema_string = $cgi->param('schema');
+    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
+                         or die "guru meditation #420: $_";
+                       ( $1 => $2 );
+                     }
+                 split( /\n/, $schema_string );
+    foreach my $table ( keys %schema ) {
+      ( my $spaces = $table ) =~ s/./ /g;
+      print "'$table' => { 'table' => '$schema{$table}',\n".
+            #(length($table) x ' '). "         'map'   => {\n";
+            "$spaces        'map'   => {\n";
+      my %map = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
+                         or die "guru meditation #420: $_";
+                       ( $1 => $2 );
+                     }
+                 split( /\n/, $cgi->param($table) );
+      foreach ( keys %map ) {
+        print "$spaces                     '$_' => '$map{$_}',\n";
+      }
+      print "$spaces                   },\n";
+      print "$spaces      },\n";
+
+    }
+    print "\n
"; + + } else { + warn "unrecognized magic: ". $cgi->param('magic'); } + %> + + + + + <% #hashmaker widget sub hashmaker { my($name, $from, $to, $labelfrom, $labelto) = @_; -- cgit v1.2.1 From c174642d32c139d1233597e3fa6a467586207023 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Mar 2003 11:36:51 +0000 Subject: minor meta import webUI updates --- httemplate/misc/meta-import.cgi | 24 +++++++--- httemplate/misc/process/meta-import.cgi | 82 +++++++++++++-------------------- 2 files changed, 50 insertions(+), 56 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/meta-import.cgi b/httemplate/misc/meta-import.cgi index ebd2a7e2f..2f3b7380d 100644 --- a/httemplate/misc/meta-import.cgi +++ b/httemplate/misc/meta-import.cgi @@ -1,9 +1,7 @@ <%= header('Import') %>
-Import a CSV file containing customer records (zip tar etc).

- -##no##Default file format is CSV, with the following field order: cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments

+Import data from a DBI data source

<% #false laziness with edit/cust_main.cgi @@ -44,9 +42,23 @@ Import a CSV file containing customer records (zip tar etc).

<% } %>

- CSV (zip, tar etc) Filename:

- -
+ + + + + + + + + + + + + +
DBI data source:
DBI username:
DBI password:
+ + + diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 4c3c7d665..9e374b508 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -1,5 +1,6 @@ <%= header('Map tables') %> + +
+ <% - #one - unless ( $cgi->param('magic') ) { - - #oops, silly - #my $fh = $cgi->upload('csvfile'); - ##warn $cgi; - ##warn $fh; - # - #use Archive::Tar; - #$tar = Archive::Tar->new(); - #$tar->create_archive($fh); #or die $tar->error; - - #haha for now - my @files = qw( -authserv credtype dunprev invoice pmtdet product taxplan -ccdet customer genlog ledger pops pubvars -cchist discplan glacct origco prodcat recur users -credcode dundet invline payment prodclas repforms webserv - ); + #use DBIx::DBSchema; + my $schema = new_native DBIx::DBSchema + map { $cgi->param($_) } qw( data_source username password ); + foreach my $field (qw( data_source username password )) { %> + VALUE="<%= $cgi->param($field) %>"> + <% } + + my %schema = (); + if ( $cgi->param('schema') ) { + my $schema_string = $cgi->param('schema'); + %> <% + %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ + or die "guru meditation #420: $_"; + ( $1 => $2 ); + } + split( /\n/, $schema_string ); + } + + #first page + unless ( $cgi->param('magic') ) { %> - %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %> + <%= hashmaker('schema', [ $schema->tables ], + [ grep !/^h_/, dbdef->tables ], ) %>
<% - } elsif ( $cgi->param('magic') eq 'process' ) { + #second page + } elsif ( $cgi->param('magic') eq 'process' ) { %> - %> <% - my $schema_string = $cgi->param('schema'); - %><% - my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ - or die "guru meditation #420: $_"; - ( $1 => $2 ); - } - split( /\n/, $schema_string ); - - #*** should be in global.asa/handler.pl like the rest - eval 'use Text::CSV_XS;'; - foreach my $table ( keys %schema ) { - my $csv = Text::CSV_XS->new({ 'binary'=>1 }); - open(FILE,"); - close FILE; - $csv->parse($header) or die; - my @from_columns = $csv->fields; - + my @from_columns = $schema->table($table)->columns; my @fs_columns = dbdef->table($schema{$table})->columns; %> - <%= hashmaker($table, \@from_columns, \@fs_columns, $table, $schema{$table} ) %> + <%= hashmaker($table, \@from_columns => \@fs_columns, + $table => $schema{$table}, ) %>


<% @@ -87,16 +74,11 @@ credcode dundet invline payment prodclas repforms webserv
<% + #third (results) } elsif ( $cgi->param('magic') eq 'process2' ) { print "
\n";
-    #false laziness with above
-    my $schema_string = $cgi->param('schema');
-    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
-                         or die "guru meditation #420: $_";
-                       ( $1 => $2 );
-                     }
-                 split( /\n/, $schema_string );
+
     foreach my $table ( keys %schema ) {
       ( my $spaces = $table ) =~ s/./ /g;
       print "'$table' => { 'table' => '$schema{$table}',\n".
-- 
cgit v1.2.1


From 26deea8eb085dcb06295e6795f72f2844bcd3fe1 Mon Sep 17 00:00:00 2001
From: ivan 
Date: Tue, 1 Apr 2003 06:55:01 +0000
Subject: cancel button for customers (closes: Bug#25)

---
 httemplate/misc/cust_main-cancel.cgi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100755 httemplate/misc/cust_main-cancel.cgi

(limited to 'httemplate/misc')

diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi
new file mode 100755
index 000000000..526e128a4
--- /dev/null
+++ b/httemplate/misc/cust_main-cancel.cgi
@@ -0,0 +1,16 @@
+<%
+
+#untaint custnum
+my($query) = $cgi->keywords;
+$query =~ /^(\d+)$/ || die "Illegal custnum";
+my $custnum = $1;
+
+my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
+
+my $error = $cust_main->cancel;
+eidiot($error) if $error;
+
+#print $cgi->redirect($p. "view/cust_main.cgi?". $cust_main->custnum);
+print $cgi->redirect($p);
+
+%>
-- 
cgit v1.2.1


From 856a62ca215f921ef3e9ddf4080626565727532a Mon Sep 17 00:00:00 2001
From: ivan 
Date: Wed, 2 Apr 2003 09:46:50 +0000
Subject: updated meta-import web UI to allow duplicate import tables

---
 httemplate/misc/process/meta-import.cgi | 37 +++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

(limited to 'httemplate/misc')

diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi
index 9e374b508..2939c8fb2 100644
--- a/httemplate/misc/process/meta-import.cgi
+++ b/httemplate/misc/process/meta-import.cgi
@@ -31,7 +31,9 @@ function SafeOnsubmit() {
      VALUE="<%= $cgi->param($field) %>">
   <% }
 
-  my %schema = ();
+  my %schema;
+  use Tie::DxHash;
+  tie %schema, 'Tie::DxHash';
   if ( $cgi->param('schema') ) {
     my $schema_string = $cgi->param('schema');
     %>  <%
@@ -57,14 +59,16 @@ function SafeOnsubmit() {
     
     <%
 
+    my %unique;
     foreach my $table ( keys %schema ) {
 
       my @from_columns = $schema->table($table)->columns;
       my @fs_columns = dbdef->table($schema{$table})->columns;
 
       %>
-      <%= hashmaker($table, \@from_columns => \@fs_columns,
-                            $table         =>  $schema{$table}, ) %>
+      <%= hashmaker( $table.'__'.$unique{$table}++,
+                     \@from_columns => \@fs_columns,
+                     $table         =>  $schema{$table}, ) %>
       


<% @@ -79,6 +83,7 @@ function SafeOnsubmit() { print "
\n";
 
+    my %unique;
     foreach my $table ( keys %schema ) {
       ( my $spaces = $table ) =~ s/./ /g;
       print "'$table' => { 'table' => '$schema{$table}',\n".
@@ -88,7 +93,7 @@ function SafeOnsubmit() {
                          or die "guru meditation #420: $_";
                        ( $1 => $2 );
                      }
-                 split( /\n/, $cgi->param($table) );
+                 split( /\n/, $cgi->param($table.'__'.$unique{$table}++) );
       foreach ( keys %map ) {
         print "$spaces                     '$_' => '$map{$_}',\n";
       }
@@ -116,11 +121,13 @@ function SafeOnsubmit() {
     "'.
       '
-- 
cgit v1.2.1


From 83ce2076d59c3c27beb78dd5892b2da99fd60ec1 Mon Sep 17 00:00:00 2001
From: ivan 
Date: Fri, 25 Jun 2004 17:57:02 +0000
Subject: fix one-time card charging not pulling in exp date?

---
 httemplate/misc/payment.cgi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'httemplate/misc')

diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 699b31724..cea77fe1a 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -93,7 +93,7 @@ function achclose() {
           
@@ -101,7 +101,7 @@ function achclose() {
           
-- 
cgit v1.2.1


From 0b227319d33d012890891570891f9d9401ff89ff Mon Sep 17 00:00:00 2001
From: ivan 
Date: Wed, 30 Jun 2004 14:33:35 +0000
Subject: forgot october!  closes: Bug#880

---
 httemplate/misc/payment.cgi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'httemplate/misc')

diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index cea77fe1a..02c6c5428 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -92,7 +92,7 @@ function achclose() {
           
$labelfrom$labelto
". qq!\n". + "\n
". + qq!!. '
'. qq!\n". + "\n
". + qq!!. '
'. qq!!. @@ -146,6 +153,24 @@ function SafeOnsubmit() { object.options[index] = null; return value; } + function repack_${name}_from() { + var object = document.OneTrueForm.${name}_from; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$from ) ). " + } + function repack_${name}_to() { + var object = document.OneTrueForm.${name}_to; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$to ) ). " + } + function addOption_$name(object,value) { + var length = object.length; + object.options[length] = new Option(value, value, false, false); + } ". ''; } -- cgit v1.2.1 From aee635ea9986d031a996381f71e67d1446c10331 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 29 Apr 2003 19:49:37 +0000 Subject: 0 has a hash key looks like svcnum = 0. Suprisingly, '' works. --- httemplate/misc/catchall.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 9aa84be18..3402b61e6 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -77,7 +77,7 @@ if ($pkgnum) { } # add an absence of a catchall -$email{0} = "(none)"; +$email{''} = "(none)"; my $p1 = popurl(1); print header("Domain Catchall Edit", ''); -- cgit v1.2.1 From 3464d4c767130711e724fbd96e391e03fa3a1796 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 22 Jun 2003 14:21:57 +0000 Subject: fix the credit card retry on change or manual "retry_card" to ONCE per invoice --- httemplate/misc/bill.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index f048e5559..44d85b880 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -21,7 +21,8 @@ unless ( $error ) { #'batch_card'=> 'yes', #'batch_card'=> 'no', #'report_badcard'=> 'yes', - 'retry_card' => 'yes', + #'retry_card' => 'yes', + 'retry' => 'yes', ); } #&eidiot($error) if $error; -- cgit v1.2.1 From cd6707b49e29d62397c1e4107803965282ee0115 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 01:22:48 +0000 Subject: preliminary batch download --- httemplate/misc/download-batch.cgi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 httemplate/misc/download-batch.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi new file mode 100644 index 000000000..3803c8464 --- /dev/null +++ b/httemplate/misc/download-batch.cgi @@ -0,0 +1,16 @@ +<% + +http_header('Content-Type' => 'text/comma-separated-values'); + +for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } + qsearch('cust_pay_batch', {} ) +) { + +$cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; +my( $mon, $y ) = ( $2, $1 ); +$mon = "0$mon" if $mon < 10; +my $exp = "$mon$y"; + +%> +,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +<% } %> -- cgit v1.2.1 From 95b6fff06bd55cfc97647b056cb321b1b57c2d78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 06:52:30 +0000 Subject: eliminate extraneous newlines --- httemplate/misc/download-batch.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 3803c8464..5ee12f174 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -11,6 +11,5 @@ my( $mon, $y ) = ( $2, $1 ); $mon = "0$mon" if $mon < 10; my $exp = "$mon$y"; -%> -,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +%>,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> <% } %> -- cgit v1.2.1 From 8ba4df7e0fab1faa2032b8311a195d297502e4b2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 07:31:27 +0000 Subject: remove trancode from batching --- httemplate/misc/download-batch.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 5ee12f174..ecb80d256 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,6 +1,6 @@ <% -http_header('Content-Type' => 'text/comma-separated-values'); +http_header('Content-Type' => 'text/comma-separated-values' ); for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } qsearch('cust_pay_batch', {} ) -- cgit v1.2.1 From c8f80bd5aaeb0f3844a7cece4bfe250d4f89f745 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 28 Sep 2003 02:36:18 +0000 Subject: add upload of batch result from TD Canada Trust some global.asa / handler.pl enhancements --- httemplate/misc/upload-batch.cgi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 httemplate/misc/upload-batch.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi new file mode 100644 index 000000000..565a6da5c --- /dev/null +++ b/httemplate/misc/upload-batch.cgi @@ -0,0 +1,28 @@ +<% + + my $fh = $cgi->upload('batch_results'); + my $filename = $cgi->param('batch_results'); + my $paybatch = basename($filename); + + my $error = defined($fh) + ? FS::cust_pay_batch::import_results( { + 'filehandle' => $fh, + 'format' => $cgi->param('format'), + 'paybatch' => $paybatch, + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import.cgi + } else { + %> + + <%= header('Batch results upload sucessful') %> <% + } +%> + -- cgit v1.2.1 From d993eaef639b1abd95973b26e7c336fc5e588041 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Sep 2003 12:48:11 +0000 Subject: IE doesn't like downloading MIME type text/comma-separated-values --- httemplate/misc/download-batch.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index ecb80d256..306ef5d63 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,6 +1,7 @@ <% -http_header('Content-Type' => 'text/comma-separated-values' ); +#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes +http_header('Content-Type' => 'text/plain' ); for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } qsearch('cust_pay_batch', {} ) -- cgit v1.2.1 From 8950be198d09bf5e9e0959fe2b55726be63a2397 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 8 Oct 2003 04:09:05 +0000 Subject: can't use File::Basename::basename for windows filenames! use a regex instead --- httemplate/misc/upload-batch.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 565a6da5c..cc5346606 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,7 +2,8 @@ my $fh = $cgi->upload('batch_results'); my $filename = $cgi->param('batch_results'); - my $paybatch = basename($filename); + $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die; + my $paybatch = $1; my $error = defined($fh) ? FS::cust_pay_batch::import_results( { -- cgit v1.2.1 From 066c1665efce43307446207a33f876b0baefe1d6 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Nov 2003 13:54:21 +0000 Subject: hmm forgot to check this in? --- httemplate/misc/process/meta-import.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 2939c8fb2..59d236f64 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -116,8 +116,8 @@ function SafeOnsubmit() { #hashmaker widget sub hashmaker { my($name, $from, $to, $labelfrom, $labelto) = @_; - $fromsize = scalar(@$from); - $tosize = scalar(@$to); + my $fromsize = scalar(@$from); + my $tosize = scalar(@$to); " + + + +<% if ( $payby eq 'CARD' ) { + my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); + my $payname = $cust_main->first. ' '. $cust_main->getfield('last'); + my $address1 = $cust_main->address1; + my $address2 = $cust_main->address2; + my $city = $cust_main->city; + my $state = $cust_main->state; + my $zip = $cust_main->zip; + if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { + $payinfo = $cust_main->payinfo; + $paycvv = $cust_main->paycvv; + ( $month, $year ) = $cust_main->paydate_monthyear; + $payname = $cust_main->payname if $cust_main->payname; + } +%> + + + + + + + + + + + + + + + + + + + + + + +<% } elsif ( $payby eq 'CHEK' ) { + my( $payinfo1, $payinfo2, $payname, $ss ) = ( '', '', '', '' ); + if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { + $cust_main->payinfo =~ /^(\d+)\@(\d+)$/ + or die "unparsable payinfo ". $cust_main->payinfo; + ($payinfo1, $payinfo2) = ($1, $2); + $payname = $cust_main->payname; + $ss = $cust_main->ss; + } +%> + + + + + + + + + + + + + + + + + + + +<% } %> + + + + + + +
$labelfrom$labelto
". qq! + + + + + +
Cancel package on + +
m/d/y +
+ + + + + + + diff --git a/httemplate/misc/process/expire_pkg.cgi b/httemplate/misc/process/expire_pkg.cgi new file mode 100755 index 000000000..dc35592ce --- /dev/null +++ b/httemplate/misc/process/expire_pkg.cgi @@ -0,0 +1,25 @@ +<% + +#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')); + +%> -- cgit v1.2.1 From e3f327b2af9e6a591bae41d315fda731ec7f5128 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Mar 2004 11:05:58 +0000 Subject: remove everything that links to package view also, closes: Bug#569 --- httemplate/misc/cancel-unaudited.cgi | 11 +++++++---- httemplate/misc/process/link.cgi | 4 +++- httemplate/misc/unprovision.cgi | 4 ---- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 11cde968d..43e439b58 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -12,10 +12,13 @@ my $svcnum = $1; my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "Unknown svcnum!" unless $cust_svc; -&eidiot(qq!This account has already been audited. Cancel the - package instead.!) - if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; +my $cust_pkg = $cust_svc->cust_pkg; +if ( $cust_pkg ) { + &eidiot( 'This account has already been audited. Cancel the '. + qq!'. + 'package instead.'); +} my $error = $cust_svc->cancel; diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 5d80adeb9..8b71b893d 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -32,7 +32,9 @@ my $error = $new->replace($old); unless ($error) { #no errors, so let's view this customer. - print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); + my $custnum = $new->cust_pkg->custnum; + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" + "#cust_pkg$pkgnum" ); } else { %> diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi index 8f2a7d13d..3c92a4e2e 100755 --- a/httemplate/misc/unprovision.cgi +++ b/httemplate/misc/unprovision.cgi @@ -12,10 +12,6 @@ my $svcnum = $1; my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "Unknown svcnum!" unless $cust_svc; -#&eidiot(qq!This account has already been audited. Cancel the -# package instead.!) -# if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; my $custnum = $cust_svc->cust_pkg->custnum; -- cgit v1.2.1 From 73f34cbe08a9be968a2557cd6906dde5bb9a97a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Mar 2004 00:06:55 +0000 Subject: one-time credit card and ACH payments (like self-service) closes: Bug#648 --- httemplate/misc/payment.cgi | 209 ++++++++++++++++++++++++++++++++++++ httemplate/misc/process/payment.cgi | 148 +++++++++++++++++++++++++ 2 files changed, 357 insertions(+) create mode 100644 httemplate/misc/payment.cgi create mode 100644 httemplate/misc/process/payment.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi new file mode 100644 index 000000000..bf89a3da7 --- /dev/null +++ b/httemplate/misc/payment.cgi @@ -0,0 +1,209 @@ +<% + my %type = ( 'CARD' => 'credit card', + 'CHEK' => 'electronic check (ACH)', + ); + + $cgi->param('payby') =~ /^(CARD|CHEK)$/ + or die "unknown payby ". $cgi->param('payby'); + my $payby = $1; + + $cgi->param('custnum') =~ /^(\d+)$/ + or die "illegal custnum ". $cgi->param('custnum'); + my $custnum = $1; + + my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } ); + die "unknown custnum $custnum" unless $cust_main; + + my $balance = $cust_main->balance; + + my $payinfo = ''; + + #false laziness w/selfservice make_payment.html shortcut for one-country + my $conf = new FS::Conf; + my %states = map { $_->state => 1 } + qsearch('cust_main_county', { + 'country' => $conf->config('defaultcountry') || 'US' + } ); + my @states = sort { $a cmp $b } keys %states; + + my $paybatch = "webui-payment-". time. "-$$-". rand() * 2**32; + +%> +<%= include( '/elements/header.html', "Process $type{$payby} payment" ) %> +<%= include( '/elements/small_custview.html', $cust_main ) %> +
+ + + + +<% #include( '/elements/table.html', '#cccccc' ) %> +<%= ntable('#cccccc') %> +
Payment amount +
+ $"> +
+
Card number + + + + + + + + +
+ Exp. + + / + +
+
CVV2 + (help) +
Exact name on card
Card billing address + +
Address line 2 + +
City + + + + + + + + +
+ + State + + Zip + +
+
Account number
ABA/Routing number + + (help) +
Bank name
+ Account holder
+ Social security or tax ID # +
+ + Remember this information +
+ NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> + Charge future payments to this <%= $type{$payby} %> automatically +
+
+ + + + diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi new file mode 100644 index 000000000..fa0ede89c --- /dev/null +++ b/httemplate/misc/process/payment.cgi @@ -0,0 +1,148 @@ +<% + +#some false laziness w/MyAccount::process_payment + +$cgi->param('custnum') =~ /^(\d+)$/ + or die "illegal custnum ". $cgi->param('custnum'); +my $custnum = $1; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); +die "unknown custnum $custnum" unless $cust_main; + +$cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/ + or eidiot "illegal amount ". $cgi->param('amount'); +my $amount = $1; +eidiot "amount <= 0" unless $amount > 0; + +$cgi->param('year') =~ /^(\d+)$/ + or die "illegal year ". $cgi->param('year'); +my $year = $1; + +$cgi->param('month') =~ /^(\d+)$/ + or die "illegal month ". $cgi->param('month'); +my $month = $1; + +$cgi->param('payby') =~ /^(CARD|CHEK)$/ + or die "illegal payby ". $cgi->param('payby'); +my $payby = $1; +my %payby2bop = ( + 'CARD' => 'CC', + 'CHEK' => 'ECHECK', +); +my %payby2fields = ( + 'CARD' => [ qw( address1 address2 city state zip ) ], + 'CHEK' => [ qw( ss ) ], +); +my %type = ( 'CARD' => 'credit card', + 'CHEK' => 'electronic check (ACH)', + ); + +$cgi->param('payname') =~ /^([\w \,\.\-\']+)$/ + or eidiot gettext('illegal_name'). " payname: ". $cgi->param('payname'); +my $payname = $1; + +$cgi->param('paybatch') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/ + or eidiot gettext('illegal_text'). " paybatch: ". $cgi->param('paybatch'); +my $paybatch = $1; + +my $payinfo; +my $paycvv = ''; +if ( $payby eq 'CHEK' ) { + + $cgi->param('payinfo1') =~ /^(\d+)$/ + or eidiot "illegal account number ". $cgi->param('payinfo1'); + my $payinfo1 = $1; + $cgi->param('payinfo2') =~ /^(\d+)$/ + or eidiot "illegal ABA/routing number ". $cgi->param('payinfo2'); + my $payinfo2 = $1; + $payinfo = $payinfo1. '@'. $payinfo2; + +} elsif ( $payby eq 'CARD' ) { + + $payinfo = $cgi->param('payinfo'); + $payinfo =~ s/\D//g; + $payinfo =~ /^(\d{13,16})$/ + or eidiot gettext('invalid_card'); # . ": ". $self->payinfo; + $payinfo = $1; + validate($payinfo) + or eidiot gettext('invalid_card'); # . ": ". $self->payinfo; + eidiot gettext('unknown_card_type') + if cardtype($payinfo) eq "Unknown"; + + if ( defined $cust_main->dbdef_table->column('paycvv') ) { + if ( length($cgi->param('paycvv') ) ) { + if ( cardtype($payinfo) eq 'American Express card' ) { + $cgi->param('paycvv') =~ /^(\d{4})$/ + or eidiot "CVV2 (CID) for American Express cards is four digits."; + $paycvv = $1; + } else { + $cgi->param('paycvv') =~ /^(\d{3})$/ + or eidiot "CVV2 (CVC2/CID) is three digits."; + $paycvv = $1; + } + } + } + +} else { + die "unknown payby $payby"; +} + +my $error = $cust_main->realtime_bop( $payby2bop{$payby}, $amount, + 'quiet' => 1, + 'payinfo' => $payinfo, + 'paydate' => "$year-$month-01", + 'payname' => $payname, + 'paybatch' => $paybatch, + 'paycvv' => $paycvv, + map { $_ => $cgi->param($_) } @{$payby2fields{$payby}} +); +eidiot($error) if $error; + +$cust_main->apply_payments; + +if ( $cgi->param('save') ) { + my $new = new FS::cust_main { $cust_main->hash }; + if ( $payby eq 'CARD' ) { + $new->set( 'payby' => ( $cgi->param('auto') ? 'CARD' : 'DCRD' ) ); + } elsif ( $payby eq 'CHEK' ) { + $new->set( 'payby' => ( $cgi->param('auto') ? 'CHEK' : 'DCHK' ) ); + } else { + die "unknown payby $payby"; + } + $new->set( 'payinfo' => $payinfo ); + $new->set( 'paydate' => "$year-$month-01" ); + $new->set( 'payname' => $payname ); + + #false laziness w/FS:;cust_main::realtime_bop - check both to make sure + # working correctly + my $conf = new FS::Conf; + if ( $payby eq 'CARD' && + grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) { + $new->set( 'paycvv' => $paycvv ); + } else { + $new->set( 'paycvv' => ''); + } + + $new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}}; + + my $error = $new->replace($cust_main); + eidiot "payment processed sucessfully, but error saving info: $error" + if $error; + $cust_main = $new; +} + +#success! + +%> +<%= include( '/elements/header.html', ucfirst($type{$payby}). ' processing sucessful', + include('/elements/menubar.html', + 'Main menu' => popurl(3), + "View this customer (#$custnum)" => + popurl(3). "view/cust_main.cgi?$custnum", + ), + + ) +%> +<%= include( '/elements/small_custview.html', $cust_main ) %> + + -- cgit v1.2.1 From a5651d5945c790b0d3fee0cd5082269a21adc6ee Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Apr 2004 09:08:39 +0000 Subject: add whois functionality internally instead of linking to geektools --- httemplate/misc/whois.cgi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 httemplate/misc/whois.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/whois.cgi b/httemplate/misc/whois.cgi new file mode 100644 index 000000000..dd7851dc2 --- /dev/null +++ b/httemplate/misc/whois.cgi @@ -0,0 +1,25 @@ +<% + my $svcnum = $cgi->param('svcnum'); + my $custnum = $cgi->param('custnum'); + my $domain = $cgi->param('domain'); + +%> +<%= header("Whois $domain", menubar( + ( $custnum + ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : () + ), + "View this domain (#$svcnum)" => "${p}view/svc_domain.cgi?$svcnum", + "Main menu" => $p, +)) %> +<% my $whois = eval { whois($domain) }; + if ( $@ ) { + ( $whois = $@ ) =~ s/ at \/.*Net\/Whois\/Raw\.pm line \d+.*$//s; + } else { + $whois =~ s/^\n+//; + } +%> +
<%= $whois %>
+ + -- cgit v1.2.1 From 8ed2714fc50607081d7ac4edf0b17e23902dabba Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Apr 2004 14:06:04 +0000 Subject: add a domain pulldown to svc_acct linking, closes: Bug#277 / prevent "stealing" services with link unless you set legacy_link-steal config option, closes: Bug#321 --- httemplate/misc/link.cgi | 67 ++++++++++++++++++++++++++++------------ httemplate/misc/process/link.cgi | 27 ++++++++++------ 2 files changed, 66 insertions(+), 28 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 79adce88c..18cd378d3 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -4,8 +4,16 @@ my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', - 'svc_charge' => '', - 'svc_wo' => '', +); + +my %link_field2 = ( + 'svc_acct' => { label => 'Domain', + field => 'domsvc', + type => 'select', + select_table => 'svc_domain', + select_key => 'svcnum', + select_label => 'domain' + }, ); my($query) = $cgi->keywords; @@ -19,27 +27,48 @@ my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); my $svc = $part_svc->getfield('svc'); my $svcdb = $part_svc->getfield('svcdb'); my $link_field = $link_field{$svcdb}; +my $link_field2 = $link_field2{$svcdb}; + +%> -print header("Link to existing $svc"), - qq!
!; +<%= header("Link to existing $svc") %> + -if ( $link_field ) { - print < - - $link_field of existing service: -END -} else { - print qq!Service # of existing service: !; -} + + <%= $link_field %> of existing service: +
+ <% if ( $link_field2 ) { %> + + <%= $link_field2->{'label'} %> of existing service: + <% if ( $link_field2->{'type'} eq 'select' ) { %> + <% if ( $link_field2->{'select_table'} ) { %> + + <% } else { %> + Don't know how to process secondary link field for <%= $svcdb %> + (type=>select but no select_table) + <% } %> + <% } else { %> + Don't know how to process secondary link field for <%= $svcdb %> + (unknown type <%= $link_field2->{'type'} %>) + <% } %> +
+ <% } %> +<% } else { %> + Service # of existing service: +<% } %> -print < - -

+ + +
-END - -%> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 8b71b893d..32a5360d9 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -12,8 +12,12 @@ unless ( $svcnum ) { my $svcdb = $part_svc->getfield('svcdb'); $cgi->param('link_field') =~ /^(\w+)$/; my $link_field = $1; + my %search = ( $link_field => $cgi->param('link_value') ); + if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { + $search{$1} = $cgi->param('link_value2'); + } my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart } - qsearch( $svcdb, { $link_field => $cgi->param('link_value') }) + qsearch( $svcdb, \%search ) )[0]; eidiot("$link_field not found!") unless $svc_x; $svcnum = $svc_x->svcnum; @@ -21,19 +25,24 @@ unless ( $svcnum ) { my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; -#die "svcnum $svcnum already linked to package ". $old->pkgnum if $old->pkgnum; -my $new = new FS::cust_svc ({ - 'svcnum' => $svcnum, - 'pkgnum' => $pkgnum, - 'svcpart' => $svcpart, -}); +my $conf = new FS::Conf; +my($error, $new); +if ( $old->pkgnum && ! $conf->exists('legacy_link-steal') ) { + $error = "svcnum $svcnum already linked to package ". $old->pkgnum; +} else { + $new = new FS::cust_svc ({ + 'svcnum' => $svcnum, + 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, + }); -my $error = $new->replace($old); + $error = $new->replace($old); +} unless ($error) { #no errors, so let's view this customer. my $custnum = $new->cust_pkg->custnum; - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum". "#cust_pkg$pkgnum" ); } else { %> -- cgit v1.2.1 From 2e1a3719f1a9fb1f561d0eb4df349f3f03d66681 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 May 2004 11:21:46 +0000 Subject: better error reporting on unparsable filenames --- httemplate/misc/upload-batch.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index cc5346606..da5e41cbc 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,7 +2,7 @@ my $fh = $cgi->upload('batch_results'); my $filename = $cgi->param('batch_results'); - $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die; + $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die "unparsable filename: $filename\n"; my $paybatch = $1; my $error = defined($fh) -- cgit v1.2.1 From 038eaf525927a161e40577b2f2eec96c30523a6d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 May 2004 11:33:21 +0000 Subject: not entirely sure why we're checking the filename at all... to catch empty form submissions? --- httemplate/misc/upload-batch.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index da5e41cbc..5d0150177 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,8 +2,9 @@ my $fh = $cgi->upload('batch_results'); my $filename = $cgi->param('batch_results'); - $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die "unparsable filename: $filename\n"; - my $paybatch = $1; + $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ + or die "unparsable filename: $filename\n"; + my $paybatch = $2; my $error = defined($fh) ? FS::cust_pay_batch::import_results( { -- cgit v1.2.1 From 1cd72a6f1bd5ca39410f525779f5ca4ee9228a1c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 3 Jun 2004 10:09:08 +0000 Subject: also fix agent-specific From: address on "re-email" link --- httemplate/misc/email-invoice.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index 7ab1613ee..a560a1838 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -10,7 +10,7 @@ my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; my $error = send_email( - 'from' => $conf->config('invoice_from'), + 'from' => $cust_bill->_agent_invoice_from || $conf->config('invoice_from'), 'to' => [ grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ], 'subject' => 'Invoice', 'body' => [ $cust_bill->print_text ], -- cgit v1.2.1 From 3bdf0736baab914ce151849b1bc0139f5a554ca2 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Jun 2004 17:26:54 +0000 Subject: set defaults so as to not change the billing type when entering a one time payment --- httemplate/misc/payment.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index bf89a3da7..699b31724 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -197,7 +197,7 @@ function achclose() {
- NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> + payby ne 'DCRD' ) || ( $payby eq 'CHEK' && $cust_main->payby eq 'CHEK' ) ) ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> Charge future payments to this <%= $type{$payby} %> automatically
Exp. -- cgit v1.2.1 From cfe85e45bcba97089988b4dc22a895aec687f2c3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 6 Jul 2004 13:26:21 +0000 Subject: add cust_pay_void table and payment voiding web ui part one --- httemplate/misc/void-cust_pay.cgi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 httemplate/misc/void-cust_pay.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi new file mode 100755 index 000000000..4eec60892 --- /dev/null +++ b/httemplate/misc/void-cust_pay.cgi @@ -0,0 +1,16 @@ +<% + +#untaint paynum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal paynum"; +my $paynum = $1; + +my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum}); +my $custnum = $cust_pay->custnum; + +my $error = $cust_pay->void; +eidiot($error) if $error; + +print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); + +%> -- cgit v1.2.1 From 918bbc9ce36a3dc5943f521e26751ea94a5a5539 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 Jul 2004 04:54:41 +0000 Subject: svcpart changes now trigger all necessary export actions, manual svcpart changing on svc_acct view, linking changes svcpart if you ask it to, closes: Bug#671, Bug#644 --- httemplate/misc/process/link.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 32a5360d9..acdd1ad03 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -16,8 +16,11 @@ unless ( $svcnum ) { if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { $search{$1} = $cgi->param('link_value2'); } - my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart } - qsearch( $svcdb, \%search ) + my $svc_x = ( sort { ($b->cust_svc->pkgnum > 0) <=> ($a->cust_svc->pkgnum > 0) + or ($b->cust_svc->svcpart == $svcpart) + <=> ($a->cust_svc->svcpart == $svcpart) + } + qsearch( $svcdb, \%search ) )[0]; eidiot("$link_field not found!") unless $svc_x; $svcnum = $svc_x->svcnum; -- cgit v1.2.1