From c1bb4ddb71147d0571bd301a6d8c452fdf0e1bc9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 31 Jan 2006 04:26:54 +0000 Subject: move header() to include(/elements/header.html) so it can be changed in one place, thanks to Scott Edwards --- httemplate/misc/batch-cust_pay.html | 2 +- httemplate/misc/cust_main-import.cgi | 2 +- httemplate/misc/cust_main-import_charges.cgi | 2 +- httemplate/misc/expire_pkg.cgi | 2 +- httemplate/misc/link.cgi | 2 +- httemplate/misc/meta-import.cgi | 2 +- httemplate/misc/process/cust_main-import.cgi | 2 +- httemplate/misc/process/cust_main-import_charges.cgi | 2 +- httemplate/misc/process/meta-import.cgi | 2 +- httemplate/misc/upload-batch.cgi | 2 +- httemplate/misc/whois.cgi | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index 20cc89045..b40869476 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -1,4 +1,4 @@ -<%= header( 'Quick payment entry', +<%= include("/elements/header.html", 'Quick payment entry', menubar( 'Main Menu' => $p, #popurl(1), 'Old-style quick payment entry' => diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 6b36f478d..484855005 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -1,5 +1,5 @@ -<%= header('Batch Customer Import') %> +<%= include("/elements/header.html",'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

diff --git a/httemplate/misc/cust_main-import_charges.cgi b/httemplate/misc/cust_main-import_charges.cgi index 0822b9eb6..8402386d5 100644 --- a/httemplate/misc/cust_main-import_charges.cgi +++ b/httemplate/misc/cust_main-import_charges.cgi @@ -1,5 +1,5 @@ -<%= header('Batch Customer Charge') %> +<%= include("/elements/header.html",'Batch Customer Charge') %> Import a CSV file containing customer charges.

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

diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi index b59674a69..f8f69dafd 100755 --- a/httemplate/misc/expire_pkg.cgi +++ b/httemplate/misc/expire_pkg.cgi @@ -16,7 +16,7 @@ my $date = $cust_pkg->expire ? time2str('%D', $cust_pkg->expire) : ''; %> -<%= header('Expire package', menubar( +<%= include("/elements/header.html",'Expire package', menubar( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", 'Main Menu' => popurl(2) )) %> diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 18cd378d3..e2bdda7d5 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -31,7 +31,7 @@ my $link_field2 = $link_field2{$svcdb}; %> -<%= header("Link to existing $svc") %> +<%= include("/elements/header.html","Link to existing $svc") %> <% if ( $link_field ) { %> diff --git a/httemplate/misc/meta-import.cgi b/httemplate/misc/meta-import.cgi index 2f3b7380d..b2fcfe450 100644 --- a/httemplate/misc/meta-import.cgi +++ b/httemplate/misc/meta-import.cgi @@ -1,5 +1,5 @@ -<%= header('Import') %> +<%= include("/elements/header.html",'Import') %> Import data from a DBI data source

diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi index 9e1adce54..2348ef680 100644 --- a/httemplate/misc/process/cust_main-import.cgi +++ b/httemplate/misc/process/cust_main-import.cgi @@ -25,6 +25,6 @@ } else { %> - <%= header('Import sucessful') %> <% + <%= include("/elements/header.html",'Import sucessful') %> <% } %> diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi index 14df1bd8d..c14228cf4 100644 --- a/httemplate/misc/process/cust_main-import_charges.cgi +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -21,6 +21,6 @@ } else { %> - <%= header('Import sucessful') %> <% + <%= include("/elements/header.html",'Import sucessful') %> <% } %> diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 59d236f64..4cdecafc4 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -1,5 +1,5 @@ -<%= header('Map tables') %> +<%= include("/elements/header.html",'Map tables') %> + + + + <% #include( '/elements/table.html', '#cccccc' ) %> <%= ntable('#cccccc') %> @@ -112,7 +102,7 @@ function achclose() { CVV2 - (help) + (help) @@ -173,7 +163,7 @@ function achclose() { ABA/Routing number - (help) + (help) @@ -205,5 +195,5 @@ function achclose() {
- - + +<%= include('/elements/footer.html') %> -- cgit v1.2.1 From 50f25b285b2caf77d267ed66f03e56924ad7229f Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 20 May 2006 20:06:30 +0000 Subject: first stab at BoM download --- httemplate/misc/download-batch.cgi | 69 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 306ef5d63..5a98f1d51 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,16 +1,79 @@ <% +my $conf=new FS::Conf; + #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes http_header('Content-Type' => 'text/plain' ); +#need default +my $formatconfig = "batchconfig".$cgi->param('format'); + +die "No batch configuration exists.\n$formatconfig\n" unless $conf->exists($formatconfig); +my $format = $conf->config($formatconfig); + +my $oldAutoCommit = $FS::UID::AutoCommit; +local $FS::UID::AutoCommit = 0; +my $dbh = dbh; + +my $pay_batch = qsearchs('pay_batch', {'status'=>''} ); +die "No pending batch. \n" unless $pay_batch; + +my %batchhash = $pay_batch->hash; +$batchhash{'status'} = 'I'; +my $new = new FS::pay_batch \%batchhash; +my $error = $new->replace($pay_batch); +die "error updating batch status: $error\n" if $error; + +my $batchtotal=0; +my $batchcount=0; + +my (@date)=localtime(); +my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]); + +if ($format eq "BoM") { + my($reformat,$origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = $conf->config('batchconfig'); + printf "A%10s%04u%06u%05u%54s\n",$origid,$pay_batch->batchnum,$jdate,$datacenter,""; + printf "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct; +}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ + 1; +}else{ + die "Unknown format for batch in batchconfig. \n"; +} + + for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } - qsearch('cust_pay_batch', {} ) + qsearch('cust_pay_batch', + {'batchnum'=>$pay_batch->batchnum} ) ) { $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"; +$batchcount++; +$batchtotal += $cust_pay_batch->amount; + +if ($format eq "BoM") { + my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); + printf "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum; +}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ +%>,,,,<%= $cust_pay_batch->payinfo %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +<% }else{ + die "I'm already dead, but you did not know that.\n"; +} + +} + +if ($format eq "BoM") { + printf "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,""; + printf "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0",""; +}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ + 1; +} else{ + die "I'm already dead (again), but you did not know that.\n"; +} + +$dbh->commit or die $dbh->errstr if $oldAutoCommit; + +%> -%>,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> -<% } %> -- cgit v1.2.1 From 44c866ddd722374379813d774f609ef43f39dfbc Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 16 Jun 2006 00:27:43 +0000 Subject: s/printf/sprintf/ and make the config a little less strange --- httemplate/misc/download-batch.cgi | 66 ++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 28 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 5a98f1d51..37b31c196 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -5,11 +5,12 @@ my $conf=new FS::Conf; #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes http_header('Content-Type' => 'text/plain' ); -#need default -my $formatconfig = "batchconfig".$cgi->param('format'); - -die "No batch configuration exists.\n$formatconfig\n" unless $conf->exists($formatconfig); -my $format = $conf->config($formatconfig); +my $format; +if ( $cgi->param('format') =~ /^([\w ]+)$/ ) { + $format = $1; +} else { + $format = $conf->config('batch_default_format'); +} my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; @@ -31,11 +32,14 @@ my (@date)=localtime(); my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]); if ($format eq "BoM") { - my($reformat,$origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = $conf->config('batchconfig'); - printf "A%10s%04u%06u%05u%54s\n",$origid,$pay_batch->batchnum,$jdate,$datacenter,""; - printf "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct; + + my($reformat,$origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = $conf->config("batchconfig-$format"); + %><%= sprintf( "A%10s%04u%06u%05u%54s\n",$origid,$pay_batch->batchnum,$jdate,$datacenter,""). + sprintf( "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct ) + %><% + }elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ - 1; +# 1; }else{ die "Unknown format for batch in batchconfig. \n"; } @@ -46,30 +50,36 @@ for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } {'batchnum'=>$pay_batch->batchnum} ) ) { -$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"; -$batchcount++; -$batchtotal += $cust_pay_batch->amount; + $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"; + $batchcount++; + $batchtotal += $cust_pay_batch->amount; + + if ($format eq "BoM") { -if ($format eq "BoM") { - my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); - printf "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum; -}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ -%>,,,,<%= $cust_pay_batch->payinfo %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> -<% }else{ - die "I'm already dead, but you did not know that.\n"; -} + my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); + %><%= sprintf( "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum %><% + + } elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch") { + + %>,,,,<%= $cust_pay_batch->payinfo %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %><% + + } else { + die "I'm already dead, but you did not know that.\n"; + } } if ($format eq "BoM") { - printf "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,""; - printf "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0",""; -}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ - 1; -} else{ + + %><%= sprintf( "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,"" ). + sprintf( "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0","" ) %><% + +} elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ + #1; +} else { die "I'm already dead (again), but you did not know that.\n"; } -- cgit v1.2.1 From 2aee6063dd65e588b884181542815f98319419bf Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 16 Jun 2006 00:33:31 +0000 Subject: oops i'm gonna do that too, now that the batch format file is not the same as the batch params files --- 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 37b31c196..88b10eecf 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -33,7 +33,8 @@ my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]); if ($format eq "BoM") { - my($reformat,$origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = $conf->config("batchconfig-$format"); + my($origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = + $conf->config("batchconfig-$format"); %><%= sprintf( "A%10s%04u%06u%05u%54s\n",$origid,$pay_batch->batchnum,$jdate,$datacenter,""). sprintf( "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct ) %><% -- cgit v1.2.1 From 1904b218cacfe4e96f3fd3b57f7242617099c485 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 16 Jun 2006 00:47:39 +0000 Subject: and fix the name for TD Canada Trust. and that's it for now. really. --- httemplate/misc/download-batch.cgi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 88b10eecf..2d6f8a286 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -6,10 +6,10 @@ my $conf=new FS::Conf; http_header('Content-Type' => 'text/plain' ); my $format; -if ( $cgi->param('format') =~ /^([\w ]+)$/ ) { +if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { $format = $1; } else { - $format = $conf->config('batch_default_format'); + $format = $conf->config('batch-default_format'); } my $oldAutoCommit = $FS::UID::AutoCommit; @@ -39,7 +39,7 @@ if ($format eq "BoM") { sprintf( "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct ) %><% -}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ +}elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ # 1; }else{ die "Unknown format for batch in batchconfig. \n"; @@ -63,7 +63,7 @@ for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); %><%= sprintf( "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum %><% - } elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch") { + } elsif ($format eq "csv-td_canada_trust-merchant_pc_batch") { %>,,,,<%= $cust_pay_batch->payinfo %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %><% @@ -78,7 +78,7 @@ if ($format eq "BoM") { %><%= sprintf( "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,"" ). sprintf( "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0","" ) %><% -} elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){ +} elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ #1; } else { die "I'm already dead (again), but you did not know that.\n"; -- cgit v1.2.1 From aaad08cae3a0d46d012de5b78360101cda836c30 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 16 Jun 2006 01:23:41 +0000 Subject: value issues and many bits remain --- 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 2d6f8a286..6172b1335 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -16,7 +16,7 @@ my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; -my $pay_batch = qsearchs('pay_batch', {'status'=>''} ); +my $pay_batch = qsearchs('pay_batch', {'status'=>'O'} ); die "No pending batch. \n" unless $pay_batch; my %batchhash = $pay_batch->hash; -- cgit v1.2.1 From 1053db7f76169cbbc87840539959a4c362aff242 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 12 Jul 2006 00:20:23 +0000 Subject: svc_phone service and CDR billing from imported CDRs --- httemplate/misc/cdr-import.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cdr-import.html b/httemplate/misc/cdr-import.html index dc1733249..93de6e43f 100644 --- a/httemplate/misc/cdr-import.html +++ b/httemplate/misc/cdr-import.html @@ -2,8 +2,9 @@
Import a CSV file containing Call Detail Records (CDRs).

CDR Format:

Filename:

-- cgit v1.2.1 From 6c375156081be5d2023001ed8eaac9b6db568e95 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 9 Aug 2006 06:43:02 +0000 Subject: batch refactor --- httemplate/misc/download-batch.cgi | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 6172b1335..2c6481493 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -5,6 +5,13 @@ my $conf=new FS::Conf; #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes http_header('Content-Type' => 'text/plain' ); +my $batchnum; +if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) { + $batchnum = $1; +} else { + die "No batch number (bad URL) \n"; +} + my $format; if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { $format = $1; @@ -16,11 +23,12 @@ my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; -my $pay_batch = qsearchs('pay_batch', {'status'=>'O'} ); +my $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'O'} ); die "No pending batch. \n" unless $pay_batch; my %batchhash = $pay_batch->hash; $batchhash{'status'} = 'I'; +$batchhash{'download'} = time unless $batchhash{'download'}; my $new = new FS::pay_batch \%batchhash; my $error = $new->replace($pay_batch); die "error updating batch status: $error\n" if $error; @@ -28,8 +36,10 @@ die "error updating batch status: $error\n" if $error; my $batchtotal=0; my $batchcount=0; -my (@date)=localtime(); -my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]); +my (@date)=localtime($new->download); +my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7] + 1); +my $cdate = sprintf("%02d", $date[3]).sprintf("%02d", $date[4] + 1). + sprintf("%02d", $date[5] % 100); if ($format eq "BoM") { @@ -39,6 +49,14 @@ if ($format eq "BoM") { sprintf( "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct ) %><% +}elsif ($format eq "PAP"){ + + my($origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = + $conf->config("batchconfig-$format"); + %><%= sprintf( "H%10sD%3s%06u%-15s%09u%-12s%04u%19s\n",$origid,$typecode,$cdate,$shortname,$mybank,$myacct,$pay_batch->batchnum,"") + + %><% + }elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ # 1; }else{ @@ -61,7 +79,12 @@ for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } if ($format eq "BoM") { my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); - %><%= sprintf( "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum %><% + %><%= sprintf( "D%010.0f%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->paybatchnum) %><% + + } elsif ($format eq "PAP"){ + + my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); + %><%= sprintf( "D%-23s%06u%-19s%09u%-12s%010.0f\n",$cust_pay_batch->payname,$cdate,$cust_pay_batch->paybatchnum,$aba,$account,$cust_pay_batch->amount*100) %><% } elsif ($format eq "csv-td_canada_trust-merchant_pc_batch") { @@ -75,9 +98,13 @@ for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } if ($format eq "BoM") { - %><%= sprintf( "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,"" ). + %><%= sprintf( "YD%08u%014.0f%56s\n",$batchcount,$batchtotal*100,"" ). sprintf( "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0","" ) %><% +} elsif ($format eq "PAP"){ + + %><%= sprintf( "T%08u%014.0f%57s\n",$batchcount,$batchtotal*100,"" ) %><% + } elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ #1; } else { -- cgit v1.2.1 From 04cbf1d986eabf7fdcc22ff95b95da17e5f4bf63 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 15 Aug 2006 14:20:51 +0000 Subject: add a new, extended CSV import format --- httemplate/misc/cust_main-import.cgi | 102 +++++++++++++++------------ httemplate/misc/process/cust_main-import.cgi | 5 +- 2 files changed, 61 insertions(+), 46 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 484855005..2ad4d95b4 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -1,51 +1,65 @@ - <%= include("/elements/header.html",'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 +Import a CSV file containing customer records. +

+ + + +Extended file format is CSV, with the following field order: agent_custid, refnum[1], last, first, address1, address2, city, state, zip, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password +

- if ( scalar(@agents) == 1 ) { +[1] This field has special treatment upon import: If a string is passed instead +of an integer, the string is searched for and if necessary auto-created in the +target table. +

+ +<%= &ntable("#cccccc") %> + +<%= include('/elements/tr-select-agent.html', '', #$agentnum, + 'label' => "Agent", + 'empty_label' => 'Select agent', + ) %> - -<% } 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 ) { + + + Format + + + + + + + CSV filename + + + +<% #include('/elements/tr-select-part_referral.html') %> - -<% } else { %> -

Advertising source

-<% } %> - - First package:

- - CSV Filename:

- - - - + + + + +

+ + + + +<%= include('/elements/footer.html') %> diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi index 371929a5e..aff6b39ef 100644 --- a/httemplate/misc/process/cust_main-import.cgi +++ b/httemplate/misc/process/cust_main-import.cgi @@ -10,8 +10,9 @@ 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 )], + #'fields' => [qw( cust_pkg.setup dayphone first last address1 address2 + # city state zip comments )], + 'format' => scalar($cgi->param('format')), } ) : 'No file'; -- cgit v1.2.1 From 15e561850b61b10a92a46d8f3e316d53d4970087 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Aug 2006 21:53:40 +0000 Subject: remove extraneous " --- httemplate/misc/batch-cust_pay.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index 41537ee7e..ed093ac08 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -264,7 +264,7 @@ customer_input<%= $row %>.onclick = clearhint_customer; customer_input<%= $row %>.onchange = search_customer; - - " rownum="<%= $row %>"> + " rownum="<% $row %>"> - - $" > + $" > - " > + " > - <% if ( $param->{"error$row"} ) { %> - Error: <%= $param->{"error$row"} %> - <% } %> +% if ( $param->{"error$row"} ) { + + Error: <% $param->{"error$row"} %> +% } + +% } +% } - <% } %> - -<% } %> @@ -303,7 +304,7 @@ -<%= include('/elements/xmlhttp.html', +<% include('/elements/xmlhttp.html', 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi', 'subs' => [qw( custnum_search smart_search )], ) @@ -311,7 +312,7 @@ -<%= $pkgnum %>: <%= $part_pkg->pkg. ' - '. $part_pkg->comment %> +<% $pkgnum %>: <% $part_pkg->pkg. ' - '. $part_pkg->comment %>
- + - diff --git a/httemplate/misc/fax-invoice.cgi b/httemplate/misc/fax-invoice.cgi index 94fee2cf2..1ddc23ece 100755 --- a/httemplate/misc/fax-invoice.cgi +++ b/httemplate/misc/fax-invoice.cgi @@ -1,17 +1,18 @@ -<% +% +% +%#untaint invnum +%my($query) = $cgi->keywords; +%$query =~ /^((.+)-)?(\d+)$/; +%my $template = $2; +%my $invnum = $3; +%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +%die "Can't find invoice!\n" unless $cust_bill; +% +%$cust_bill->fax($template); +% +%my $custnum = $cust_bill->getfield('custnum'); +% +%print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); +% +% -#untaint invnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $template = $2; -my $invnum = $3; -my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -die "Can't find invoice!\n" unless $cust_bill; - -$cust_bill->fax($template); - -my $custnum = $cust_bill->getfield('custnum'); - -print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); - -%> diff --git a/httemplate/misc/fax_invoice_events.cgi b/httemplate/misc/fax_invoice_events.cgi index 778c4291e..deb78d456 100644 --- a/httemplate/misc/fax_invoice_events.cgi +++ b/httemplate/misc/fax_invoice_events.cgi @@ -1,3 +1,4 @@ -<% -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_refax', $cgi; -%><%= $server->process %> +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_refax', $cgi; +% +<% $server->process %> diff --git a/httemplate/misc/fax_invoices.cgi b/httemplate/misc/fax_invoices.cgi index b3238885f..4bdac970c 100644 --- a/httemplate/misc/fax_invoices.cgi +++ b/httemplate/misc/fax_invoices.cgi @@ -1,3 +1,4 @@ -<% -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_refax', $cgi; -%><%= $server->process %> +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_refax', $cgi; +% +<% $server->process %> diff --git a/httemplate/misc/inventory_item-import.html b/httemplate/misc/inventory_item-import.html index a702fbc49..87c6af34c 100644 --- a/httemplate/misc/inventory_item-import.html +++ b/httemplate/misc/inventory_item-import.html @@ -1,20 +1,21 @@ -<% - -my $classnum = $cgi->param('classnum'); -$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum"; -$classnum = $1; -my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } ); - -%><%= include("/elements/header.html", $inventory_class->classname. 's') %> +% +% +%my $classnum = $cgi->param('classnum'); +%$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum"; +%$classnum = $1; +%my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } ); +% +% +<% include("/elements/header.html", $inventory_class->classname. 's') %> - -Import a file containing <%= $inventory_class->classname %>s, one per line.

+ +Import a file containing <% $inventory_class->classname %>s, one per line.

Filename:

-<%= include('/elements/footer.html') %> +<% include('/elements/footer.html') %> diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index e2bdda7d5..1d1f5e133 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,73 +1,83 @@ -<% +% +% +%my %link_field = ( +% 'svc_acct' => 'username', +% 'svc_domain' => 'domain', +%); +% +%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; +%my($pkgnum, $svcpart) = ('', ''); +%foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart +% $pkgnum=$1 if /^pkgnum(\d+)$/; +% $svcpart=$1 if /^svcpart(\d+)$/; +%} +% +%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}; +% +% -my %link_field = ( - 'svc_acct' => 'username', - 'svc_domain' => 'domain', -); -my %link_field2 = ( - 'svc_acct' => { label => 'Domain', - field => 'domsvc', - type => 'select', - select_table => 'svc_domain', - select_key => 'svcnum', - select_label => 'domain' - }, -); +<% include("/elements/header.html","Link to existing $svc") %> + +% if ( $link_field ) { -my($query) = $cgi->keywords; -my($pkgnum, $svcpart) = ('', ''); -foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart - $pkgnum=$1 if /^pkgnum(\d+)$/; - $svcpart=$1 if /^svcpart(\d+)$/; -} - -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}; - -%> - -<%= include("/elements/header.html","Link to existing $svc") %> - - -<% if ( $link_field ) { %> - - <%= $link_field %> 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'} ) { %> +% 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 %> +% } 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 { + + Don't know how to process secondary link field for <% $svcdb %> + (unknown type <% $link_field2->{'type'} %>) +% } +
- <% } %> -<% } else { %> +% } +% } else { + Service # of existing service: -<% } %> +% } + - - + +
diff --git a/httemplate/misc/meta-import.cgi b/httemplate/misc/meta-import.cgi index b2fcfe450..fc249a2ab 100644 --- a/httemplate/misc/meta-import.cgi +++ b/httemplate/misc/meta-import.cgi @@ -1,45 +1,54 @@ -<%= include("/elements/header.html",'Import') %> +<% include("/elements/header.html",'Import') %> Import data from a DBI data source

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

Advertising source

-<% } %> +% } + First package:

Cancel package on - + +
m/d/y
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index ec50c03f1..4c6ae3349 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -1,40 +1,41 @@ -<% - my %type = ( 'CARD' => 'credit card', - 'CHEK' => 'electronic check (ACH)', - ); +% +% 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('countrydefault') || 'US' +% } ); +% my @states = sort { $a cmp $b } keys %states; +% +% my $paybatch = "webui-payment-". time. "-$$-". rand() * 2**32; +% +% - $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('countrydefault') || '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/header.html', "Process $type{$payby} payment" ) %> +<% include( '/elements/small_custview.html', $cust_main ) %> - - - + + + @@ -46,53 +47,58 @@ function OLiframeContent(src, width, height, name) { +'
[iframe not supported]
'); } +% #include( '/elements/table.html', '#cccccc' ) -<% #include( '/elements/table.html', '#cccccc' ) %> -<%= ntable('#cccccc') %> +<% ntable('#cccccc') %> -<% 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; - } -%> +% 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; +% } +% -<% } 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; - } -%> - + - + - + +% } -<% } %>
Payment amount
- $"> + $">
Card number + @@ -101,22 +107,22 @@ function OLiframeContent(src, width, height, name) { - - + @@ -124,61 +130,63 @@ function OLiframeContent(src, width, height, name) {
- 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 #
@@ -187,8 +195,8 @@ function OLiframeContent(src, width, height, name) {
- 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 + 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
@@ -196,4 +204,4 @@ function OLiframeContent(src, width, height, name) { -<%= include('/elements/footer.html') %> +<% include('/elements/footer.html') %> diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 6a4c2d7f1..511bdce19 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,17 +1,18 @@ -<% +% +% +%#untaint invnum +%my($query) = $cgi->keywords; +%$query =~ /^((.+)-)?(\d+)$/; +%my $template = $2; +%my $invnum = $3; +%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +%die "Can't find invoice!\n" unless $cust_bill; +% +%$cust_bill->print($template); +% +%my $custnum = $cust_bill->getfield('custnum'); +% +%print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); +% +% -#untaint invnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $template = $2; -my $invnum = $3; -my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -die "Can't find invoice!\n" unless $cust_bill; - -$cust_bill->print($template); - -my $custnum = $cust_bill->getfield('custnum'); - -print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); - -%> diff --git a/httemplate/misc/print_invoice_events.cgi b/httemplate/misc/print_invoice_events.cgi index 897c39ede..913e2683f 100644 --- a/httemplate/misc/print_invoice_events.cgi +++ b/httemplate/misc/print_invoice_events.cgi @@ -1,3 +1,4 @@ -<% -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_reprint', $cgi; %> -<%= $server->process %> +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_reprint', $cgi; + +<% $server->process %> diff --git a/httemplate/misc/print_invoices.cgi b/httemplate/misc/print_invoices.cgi index 218262077..826a081fd 100644 --- a/httemplate/misc/print_invoices.cgi +++ b/httemplate/misc/print_invoices.cgi @@ -1,3 +1,4 @@ -<% -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_reprint', $cgi; -%><%= $server->process %> +% +%my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_reprint', $cgi; +% +<% $server->process %> diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi index 12d72e8a0..e4d1bbff5 100644 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ b/httemplate/misc/process/batch-cust_pay.cgi @@ -1,42 +1,45 @@ -<% - my $param = $cgi->Vars; +% +% my $param = $cgi->Vars; +% +% #my $paybatch = $param->{'paybatch'}; +% my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); +% +% my @cust_pay = (); +% #my $row = 0; +% #while ( exists($param->{"custnum$row"}) ) { +% for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { +% push @cust_pay, new FS::cust_pay { +% 'custnum' => $param->{"custnum$row"}, +% 'paid' => $param->{"paid$row"}, +% 'payby' => 'BILL', +% 'payinfo' => $param->{"payinfo$row"}, +% 'paybatch' => $paybatch, +% } +% if $param->{"custnum$row"} +% || $param->{"paid$row"} +% || $param->{"payinfo$row"}; +% #$row++; +% } +% +% my @errors = FS::cust_pay->batch_insert(@cust_pay); +% my $num_errors = scalar(grep $_, @errors); +% +% if ( $num_errors ) { +% +% $cgi->param('error', "$num_errors error". ($num_errors>1 ? 's' : ''). +% ' - Batch not processed, correct and resubmit' +% ); +% +% my $erow=0; +% $cgi->param('error'. $erow++, shift @errors) while @errors; +% +% +<% $cgi->redirect($p.'batch-cust_pay.html?'. $cgi->query_string) + + %> +% } else { +% +% +<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %> +% } - #my $paybatch = $param->{'paybatch'}; - my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); - - my @cust_pay = (); - #my $row = 0; - #while ( exists($param->{"custnum$row"}) ) { - for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { - push @cust_pay, new FS::cust_pay { - 'custnum' => $param->{"custnum$row"}, - 'paid' => $param->{"paid$row"}, - 'payby' => 'BILL', - 'payinfo' => $param->{"payinfo$row"}, - 'paybatch' => $paybatch, - } - if $param->{"custnum$row"} - || $param->{"paid$row"} - || $param->{"payinfo$row"}; - #$row++; - } - - my @errors = FS::cust_pay->batch_insert(@cust_pay); - my $num_errors = scalar(grep $_, @errors); - - if ( $num_errors ) { - - $cgi->param('error', "$num_errors error". ($num_errors>1 ? 's' : ''). - ' - Batch not processed, correct and resubmit' - ); - - my $erow=0; - $cgi->param('error'. $erow++, shift @errors) while @errors; - - %><%= $cgi->redirect($p.'batch-cust_pay.html?'. $cgi->query_string) - - %><% } else { - - %><%= $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %> - - <% } %> diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index 44a63f9f8..f2899c720 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,33 +1,34 @@ -<% +% +% +%$FS::svc_domain::whois_hack=1; +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum =$1; +% +%my $old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; +% +%my $new = new FS::svc_domain ( { +% map { +% ($_, scalar($cgi->param($_))); +% } ( fields('svc_domain'), qw( pkgnum svcpart ) ) +%} ); +% +%$new->setfield('action' => 'M'); +% +%my $error; +%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"); +%} +% +% -$FS::svc_domain::whois_hack=1; - -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum =$1; - -my $old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; - -my $new = new FS::svc_domain ( { - map { - ($_, scalar($cgi->param($_))); - } ( fields('svc_domain'), qw( pkgnum svcpart ) ) -} ); - -$new->setfield('action' => 'M'); - -my $error; -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"); -} - -%> diff --git a/httemplate/misc/process/cdr-import.html b/httemplate/misc/process/cdr-import.html index 653dd479e..68edaa21c 100644 --- a/httemplate/misc/process/cdr-import.html +++ b/httemplate/misc/process/cdr-import.html @@ -1,26 +1,30 @@ -<% +% +% +% my $fh = $cgi->upload('csvfile'); +% +% my $error = defined($fh) +% ? FS::cdr::batch_import( { +% 'filehandle' => $fh, +% 'format' => $cgi->param('format'), +% } ) +% : 'No file'; +% +% if ( $error ) { +% - my $fh = $cgi->upload('csvfile'); - - my $error = defined($fh) - ? FS::cdr::batch_import( { - 'filehandle' => $fh, - 'format' => $cgi->param('format'), - } ) - : 'No file'; - - if ( $error ) { - %> - <% - eidiot($error); -# $cgi->param('error', $error); -# print $cgi->redirect( "${p}cust_main-import.cgi - } else { - %> +% +% eidiot($error); +%# $cgi->param('error', $error); +%# print $cgi->redirect( "${p}cust_main-import.cgi +% } else { +% + - <%= include("/elements/header.html",'Import successful') %> + <% include("/elements/header.html",'Import successful') %> - <%= include("/elements/footer.html",'Import successful') %> <% - } -%> + <% include("/elements/footer.html",'Import successful') %> +% +% } +% + diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi index aff6b39ef..a5ede99a1 100644 --- a/httemplate/misc/process/cust_main-import.cgi +++ b/httemplate/misc/process/cust_main-import.cgi @@ -1,31 +1,35 @@ -<% +% +% +% 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 )], +% 'format' => scalar($cgi->param('format')), +% } ) +% : 'No file'; +% +% if ( $error ) { +% - 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 )], - 'format' => scalar($cgi->param('format')), - } ) - : 'No file'; - - if ( $error ) { - %> - <% - eidiot($error); -# $cgi->param('error', $error); -# print $cgi->redirect( "${p}cust_main-import.cgi - } else { - %> +% +% eidiot($error); +%# $cgi->param('error', $error); +%# print $cgi->redirect( "${p}cust_main-import.cgi +% } else { +% + - <%= include("/elements/header.html",'Import successful') %> <% - } -%> + <% include("/elements/header.html",'Import successful') %> +% +% } +% + diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi index 404dfde2e..e0ede576b 100644 --- a/httemplate/misc/process/cust_main-import_charges.cgi +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -1,26 +1,30 @@ -<% +% +% +% 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 ) { +% - 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 { - %> +% +% eidiot($error); +%# $cgi->param('error', $error); +%# print $cgi->redirect( "${p}cust_main-import_charges.cgi +% } else { +% + - <%= include("/elements/header.html",'Import successful') %> <% - } -%> + <% include("/elements/header.html",'Import successful') %> +% +% } +% + diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index 16bdbaea8..d0d237ee8 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,29 +1,30 @@ -<% +% +% +%my $conf = new FS::Conf; +%die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); +% +%$cgi->param('custnum') =~ /^(\d+)$/; +%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'); +% $new_custnum = $1; +%} else { +% $new_custnum = ''; +%} +%my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) +% or die "Customer not found: $custnum"; +% +%my $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)); +%} +% -my $conf = new FS::Conf; -die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); - -$cgi->param('custnum') =~ /^(\d+)$/; -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'); - $new_custnum = $1; -} else { - $new_custnum = ''; -} -my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) - or die "Customer not found: $custnum"; - -my $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/expire_pkg.cgi b/httemplate/misc/process/expire_pkg.cgi index dc35592ce..d1963e2f5 100755 --- a/httemplate/misc/process/expire_pkg.cgi +++ b/httemplate/misc/process/expire_pkg.cgi @@ -1,25 +1,26 @@ -<% +% +% +%#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')); +% +% -#untaint date & pkgnum - -my $date; -if ( $cgi->param('date') ) { - str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; - $date=$1; -} else { - $date=''; -} - -$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; -my $pkgnum = $1; - -my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -my %hash = $cust_pkg->hash; -$hash{expire}=$date; -my $new = new FS::cust_pkg ( \%hash ); -my $error = $new->replace($cust_pkg); -&eidiot($error) if $error; - -print $cgi->redirect(popurl(3). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); - -%> diff --git a/httemplate/misc/process/inventory_item-import.html b/httemplate/misc/process/inventory_item-import.html index e98a6ed2a..f6159dc99 100644 --- a/httemplate/misc/process/inventory_item-import.html +++ b/httemplate/misc/process/inventory_item-import.html @@ -1,27 +1,31 @@ -<% +% +% +% my $fh = $cgi->upload('filename'); +% +% my $error = defined($fh) +% ? FS::inventory_item::batch_import( { +% 'filehandle' => $fh, +% 'classnum' => $cgi->param('classnum'), +% } ) +% : 'No file'; +% +% if ( $error ) { +% - my $fh = $cgi->upload('filename'); - - my $error = defined($fh) - ? FS::inventory_item::batch_import( { - 'filehandle' => $fh, - 'classnum' => $cgi->param('classnum'), - } ) - : 'No file'; - - if ( $error ) { - %> - <% - eidiot($error); -# $cgi->param('error', $error); -# print $cgi->redirect( "${p}cust_main-import.cgi - } else { - %> +% +% eidiot($error); +%# $cgi->param('error', $error); +%# print $cgi->redirect( "${p}cust_main-import.cgi +% } else { +% + - <%= include("/elements/header.html",'Import successful') %> + <% include("/elements/header.html",'Import successful') %> - <%= include("/elements/footer.html",'Import successful') %> <% - } -%> + <% include("/elements/footer.html",'Import successful') %> +% +% } +% + diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index c3d79e22c..fd3d8bb13 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,76 +1,78 @@ -<% +% +% +%my $DEBUG = 0; +% +%$cgi->param('pkgnum') =~ /^(\d+)$/; +%my $pkgnum = $1; +%$cgi->param('svcpart') =~ /^(\d+)$/; +%my $svcpart = $1; +%$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 %search = ( $link_field => $cgi->param('link_value') ); +% if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { +% $search{$1} = $cgi->param('link_value2'); +% } +% +% my @svc_x = ( sort { ($a->cust_svc->pkgnum > 0) <=> ($b->cust_svc->pkgnum > 0) +% or ($b->cust_svc->svcpart == $svcpart) +% <=> ($a->cust_svc->svcpart == $svcpart) +% } +% qsearch( $svcdb, \%search ) +% ); +% +% if ( $DEBUG ) { +% warn scalar(@svc_x). " candidate accounts found for linking ". +% "(svcpart $svcpart):\n"; +% foreach my $svc_x ( @svc_x ) { +% warn " ". $svc_x->email. +% " (svcnum ". $svc_x->svcnum. ",". +% " pkgnum ". $svc_x->cust_svc->pkgnum. ",". +% " svcpart ". $svc_x->cust_svc->svcpart. ")\n"; +% } +% } +% +% my $svc_x = $svc_x[0]; +% +% 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; +%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, +% }); +% +% $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". +% "#cust_pkg$pkgnum" ); +%} else { +% -my $DEBUG = 0; - -$cgi->param('pkgnum') =~ /^(\d+)$/; -my $pkgnum = $1; -$cgi->param('svcpart') =~ /^(\d+)$/; -my $svcpart = $1; -$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 %search = ( $link_field => $cgi->param('link_value') ); - if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { - $search{$1} = $cgi->param('link_value2'); - } - - my @svc_x = ( sort { ($a->cust_svc->pkgnum > 0) <=> ($b->cust_svc->pkgnum > 0) - or ($b->cust_svc->svcpart == $svcpart) - <=> ($a->cust_svc->svcpart == $svcpart) - } - qsearch( $svcdb, \%search ) - ); - - if ( $DEBUG ) { - warn scalar(@svc_x). " candidate accounts found for linking ". - "(svcpart $svcpart):\n"; - foreach my $svc_x ( @svc_x ) { - warn " ". $svc_x->email. - " (svcnum ". $svc_x->svcnum. ",". - " pkgnum ". $svc_x->cust_svc->pkgnum. ",". - " svcpart ". $svc_x->cust_svc->svcpart. ")\n"; - } - } - - my $svc_x = $svc_x[0]; - - 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; -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, - }); - - $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". - "#cust_pkg$pkgnum" ); -} else { -%> -<% - idiot($error); -} +% +% idiot($error); +%} +% +% -%> diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 4cdecafc4..5a97d1160 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -1,5 +1,5 @@ -<%= include("/elements/header.html",'Map tables') %> +<% include("/elements/header.html",'Map tables') %>
+% +% #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; +% use Tie::DxHash; +% tie %schema, 'Tie::DxHash'; +% 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') ) { -<% - #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; - use Tie::DxHash; - tie %schema, 'Tie::DxHash'; - 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', [ $schema->tables ], + <% hashmaker('schema', [ $schema->tables ], [ grep !/^h_/, dbdef->tables ], ) %>
- <% +% +% +% #second page +% } elsif ( $cgi->param('magic') eq 'process' ) { - #second page - } elsif ( $cgi->param('magic') eq 'process' ) { %> - <% - - my %unique; - foreach my $table ( keys %schema ) { - - my @from_columns = $schema->table($table)->columns; - my @fs_columns = dbdef->table($schema{$table})->columns; - - %> - <%= hashmaker( $table.'__'.$unique{$table}++, +% +% +% my %unique; +% foreach my $table ( keys %schema ) { +% +% my @from_columns = $schema->table($table)->columns; +% my @fs_columns = dbdef->table($schema{$table})->columns; +% +% + + <% hashmaker( $table.'__'.$unique{$table}++, \@from_columns => \@fs_columns, $table => $schema{$table}, ) %>


- <% - - } +% +% +% } +% +% - %>
- <% +% +% +% #third (results) +% } elsif ( $cgi->param('magic') eq 'process2' ) { +% +% print "
\n";
+%
+%    my %unique;
+%    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.'__'.$unique{$table}++) );
+%      foreach ( keys %map ) {
+%        print "$spaces                     '$_' => '$map{$_}',\n";
+%      }
+%      print "$spaces                   },\n";
+%      print "$spaces      },\n";
+%
+%    }
+%    print "\n
"; +% +% } else { +% warn "unrecognized magic: ". $cgi->param('magic'); +% } +% +% - #third (results) - } elsif ( $cgi->param('magic') eq 'process2' ) { - - print "
\n";
-
-    my %unique;
-    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.'__'.$unique{$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) = @_; +% my $fromsize = scalar(@$from); +% my $tosize = scalar(@$to); +% "'. +% '
$labelfrom$labelto
". +% qq!\n
". +% qq!!. +% '
'. +% qq!\n
". +% qq!!. +% '
'. +% qq!!. +% '
'. +% qq!!. +% '
'. +% "". +% ''; +% } +% +% - <% - #hashmaker widget - sub hashmaker { - my($name, $from, $to, $labelfrom, $labelto) = @_; - my $fromsize = scalar(@$from); - my $tosize = scalar(@$to); - "'. - '
$labelfrom$labelto
". - qq!\n
". - qq!!. - '
'. - qq!\n
". - qq!!. - '
'. - qq!!. - '
'. - qq!!. - '
'. - "". - ''; - } - -%> diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index d21c57c40..188d1dd04 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -1,140 +1,141 @@ -<% - -#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 successfully, but error saving info: $error" - if $error; - $cust_main = $new; -} - -#success! - -%> -<%= include( '/elements/header.html', ucfirst($type{$payby}). ' processing successful', +% +% +%#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 successfully, but error saving info: $error" +% if $error; +% $cust_main = $new; +%} +% +%#success! +% +% + +<% include( '/elements/header.html', ucfirst($type{$payby}). ' processing successful', include('/elements/menubar.html', 'Main menu' => popurl(3), "View this customer (#$custnum)" => @@ -143,6 +144,6 @@ if ( $cgi->param('save') ) { ) %> -<%= include( '/elements/small_custview.html', $cust_main ) %> +<% include( '/elements/small_custview.html', $cust_main ) %> diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index d8e910fb7..7370aabe1 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -1,47 +1,48 @@ -<% +% +% +%$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 - ". +% "it probably completed normally or was removed by another user"; +%} +% +%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; +%} 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). "search/queue.html"); +% +% -$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 - ". - "it probably completed normally or was removed by another user"; -} - -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; -} 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). "search/queue.html"); - -%> diff --git a/httemplate/misc/states.cgi b/httemplate/misc/states.cgi index 63c494d15..cf2b46ee2 100644 --- a/httemplate/misc/states.cgi +++ b/httemplate/misc/states.cgi @@ -1,6 +1,7 @@ -<% - - my $country = $cgi->param('arg'); - my @output = states_hash($country); - -%>[ <%= join(', ', map { qq("$_") } @output) %> ] +% +% +% my $country = $cgi->param('arg'); +% my @output = states_hash($country); +% +% +[ <% join(', ', map { qq("$_") } @output) %> ] diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi index 4a19fa830..ea9edc7bb 100755 --- a/httemplate/misc/susp_pkg.cgi +++ b/httemplate/misc/susp_pkg.cgi @@ -1,15 +1,16 @@ -<% +% +% +%#untaint pkgnum +%my ($query) = $cgi->keywords; +%$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +%my $pkgnum = $1; +% +%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +% +%my $error = $cust_pkg->suspend; +%&eidiot($error) if $error; +% +%print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); +% +% -#untaint pkgnum -my ($query) = $cgi->keywords; -$query =~ /^(\d+)$/ || die "Illegal pkgnum"; -my $pkgnum = $1; - -my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - -my $error = $cust_pkg->suspend; -&eidiot($error) if $error; - -print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); - -%> diff --git a/httemplate/misc/unapply-cust_credit.cgi b/httemplate/misc/unapply-cust_credit.cgi index c658d2acc..56a3ff854 100755 --- a/httemplate/misc/unapply-cust_credit.cgi +++ b/httemplate/misc/unapply-cust_credit.cgi @@ -1,18 +1,19 @@ -<% +% +% +%#untaint crednum +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/ || die "Illegal crednum"; +%my $crednum = $1; +% +%my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); +%my $custnum = $cust_credit->custnum; +% +%foreach my $cust_credit_bill ( $cust_credit->cust_credit_bill ) { +% my $error = $cust_credit_bill->delete; +% eidiot($error) if $error; +%} +% +%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); +% +% -#untaint crednum -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/ || die "Illegal crednum"; -my $crednum = $1; - -my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); -my $custnum = $cust_credit->custnum; - -foreach my $cust_credit_bill ( $cust_credit->cust_credit_bill ) { - my $error = $cust_credit_bill->delete; - eidiot($error) if $error; -} - -print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); - -%> diff --git a/httemplate/misc/unapply-cust_pay.cgi b/httemplate/misc/unapply-cust_pay.cgi index 28643ef6e..b28f61b0f 100755 --- a/httemplate/misc/unapply-cust_pay.cgi +++ b/httemplate/misc/unapply-cust_pay.cgi @@ -1,18 +1,19 @@ -<% +% +% +%#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); +% +% -#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); - -%> diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi index 3c92a4e2e..e42feda8a 100755 --- a/httemplate/misc/unprovision.cgi +++ b/httemplate/misc/unprovision.cgi @@ -1,29 +1,31 @@ -<% +% +% +%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; +% +%my $custnum = $cust_svc->cust_pkg->custnum; +% +%my $error = $cust_svc->cancel; +% +%if ( $error ) { +% -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; - -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"); -} +% +% &eidiot($error); +%} else { +% print $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum"); +%} +% +% -%> diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi index 500872983..79c07a72a 100755 --- a/httemplate/misc/unsusp_pkg.cgi +++ b/httemplate/misc/unsusp_pkg.cgi @@ -1,15 +1,16 @@ -<% +% +% +%#untaint pkgnum +%my ($query) = $cgi->keywords; +%$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +%my $pkgnum = $1; +% +%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +% +%my $error = $cust_pkg->unsuspend; +%&eidiot($error) if $error; +% +%print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); +% +% -#untaint pkgnum -my ($query) = $cgi->keywords; -$query =~ /^(\d+)$/ || die "Illegal pkgnum"; -my $pkgnum = $1; - -my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - -my $error = $cust_pkg->unsuspend; -&eidiot($error) if $error; - -print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); - -%> diff --git a/httemplate/misc/unvoid-cust_pay_void.cgi b/httemplate/misc/unvoid-cust_pay_void.cgi index 539cd4a23..75c3edc06 100755 --- a/httemplate/misc/unvoid-cust_pay_void.cgi +++ b/httemplate/misc/unvoid-cust_pay_void.cgi @@ -1,16 +1,17 @@ -<% +% +% +%#untaint paynum +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/ || die "Illegal paynum"; +%my $paynum = $1; +% +%my $cust_pay_void = qsearchs('cust_pay_void', { 'paynum' => $paynum } ); +%my $custnum = $cust_pay_void->custnum; +% +%my $error = $cust_pay_void->unvoid; +%eidiot($error) if $error; +% +%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); +% +% -#untaint paynum -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/ || die "Illegal paynum"; -my $paynum = $1; - -my $cust_pay_void = qsearchs('cust_pay_void', { 'paynum' => $paynum } ); -my $custnum = $cust_pay_void->custnum; - -my $error = $cust_pay_void->unvoid; -eidiot($error) if $error; - -print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); - -%> diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 746b81b17..742bbc0c6 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,30 +1,34 @@ -<% +% +% +% my $fh = $cgi->upload('batch_results'); +% my $filename = $cgi->param('batch_results'); +% $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ +% or die "unparsable filename: $filename\n"; +% my $paybatch = $2; +% +% my $error = defined($fh) +% ? FS::cust_pay_batch::import_results( { +% 'filehandle' => $fh, +% 'format' => $cgi->param('format'), +% 'paybatch' => $paybatch, +% } ) +% : 'No file'; +% +% if ( $error ) { +% - my $fh = $cgi->upload('batch_results'); - my $filename = $cgi->param('batch_results'); - $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ - or die "unparsable filename: $filename\n"; - my $paybatch = $2; - - 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 { - %> +% +% eidiot($error); +%# $cgi->param('error', $error); +%# print $cgi->redirect( "${p}cust_main-import.cgi +% } else { +% + - <%= include("/elements/header.html",'Batch results upload successful') %> <% - } -%> + <% include("/elements/header.html",'Batch results upload successful') %> +% +% } +% + diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi index 4eec60892..b55d22c41 100755 --- a/httemplate/misc/void-cust_pay.cgi +++ b/httemplate/misc/void-cust_pay.cgi @@ -1,16 +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->void; +%eidiot($error) if $error; +% +%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); +% +% -#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); - -%> diff --git a/httemplate/misc/whois.cgi b/httemplate/misc/whois.cgi index 919add42a..d3d9649fd 100644 --- a/httemplate/misc/whois.cgi +++ b/httemplate/misc/whois.cgi @@ -1,10 +1,11 @@ -<% - my $svcnum = $cgi->param('svcnum'); - my $custnum = $cgi->param('custnum'); - my $domain = $cgi->param('domain'); +% +% my $svcnum = $cgi->param('svcnum'); +% my $custnum = $cgi->param('custnum'); +% my $domain = $cgi->param('domain'); +% +% -%> -<%= include("/elements/header.html","Whois $domain", menubar( +<% include("/elements/header.html","Whois $domain", menubar( ( $custnum ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) @@ -13,13 +14,14 @@ "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 %>
+% my $whois = eval { whois($domain) }; +% if ( $@ ) { +% ( $whois = $@ ) =~ s/ at \/.*Net\/Whois\/Raw\.pm line \d+.*$//s; +% } else { +% $whois =~ s/^\n+//; +% } +% + +
<% $whois %>
diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 8dbd5a4f2..67512fad9 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -1,21 +1,22 @@ -<% - my $sub = $cgi->param('sub'); - - if ( $sub eq 'custnum_search' ) { - - my $custnum = $cgi->param('arg'); - my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); +% +% my $sub = $cgi->param('sub'); +% +% if ( $sub eq 'custnum_search' ) { +% +% my $custnum = $cgi->param('arg'); +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); +% +% +"<% $cust_main ? $cust_main->name : '' %>" +% } elsif ( $sub eq 'smart_search' ) { +% +% my $string = $cgi->param('arg'); +% my @cust_main = smart_search( 'search' => $string ); +% my $return = [ map [ $_->custnum, $_->name ], @cust_main ]; +% +% +<% objToJson($return) %> +% } - %>"<%= $cust_main ? $cust_main->name : '' %>" - -<% } elsif ( $sub eq 'smart_search' ) { - - my $string = $cgi->param('arg'); - my @cust_main = smart_search( 'search' => $string ); - my $return = [ map [ $_->custnum, $_->name ], @cust_main ]; - - %><%= objToJson($return) %> - -<% } %> diff --git a/httemplate/misc/xmlrpc.cgi b/httemplate/misc/xmlrpc.cgi index 53ef8fb80..1d0383f2a 100644 --- a/httemplate/misc/xmlrpc.cgi +++ b/httemplate/misc/xmlrpc.cgi @@ -1,17 +1,18 @@ -<% +% +% +% my $request_xml = $cgi->param('POSTDATA'); +% +% #$r->log_error($request_xml); +% +% my $fsxmlrpc = new FS::XMLRPC; +% my ($error, $response_xml) = $fsxmlrpc->serve($request_xml); +% +% #$r->log_error($error) if $error; +% +% http_header('Content-Type' => 'text/xml', +% 'Content-Length' => length($response_xml)); +% +% print $response_xml; +% +% - my $request_xml = $cgi->param('POSTDATA'); - - #$r->log_error($request_xml); - - my $fsxmlrpc = new FS::XMLRPC; - my ($error, $response_xml) = $fsxmlrpc->serve($request_xml); - - #$r->log_error($error) if $error; - - http_header('Content-Type' => 'text/xml', - 'Content-Length' => length($response_xml)); - - print $response_xml; - -%> -- cgit v1.2.1 From 6af1b1bfa25e5ececef5e0dcd38b55917121cee2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 26 Aug 2006 23:15:14 +0000 Subject: batch refactor continued --- httemplate/misc/bill.cgi | 4 +++- httemplate/misc/download-batch.cgi | 44 +++++-------------------------------- httemplate/misc/process/payment.cgi | 7 +----- 3 files changed, 9 insertions(+), 46 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 1532a44eb..6e4cc265d 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,5 +1,4 @@ % -% %#untaint custnum %my($query) = $cgi->keywords; %$query =~ /^(\d*)$/; @@ -7,6 +6,8 @@ %my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); %die "Can't find customer!\n" unless $cust_main; % +%my $conf = new FS::Conf; +% %my $error = $cust_main->bill( %# 'time'=>$time % ); @@ -23,6 +24,7 @@ % #'report_badcard'=> 'yes', % #'retry_card' => 'yes', % 'retry' => 'yes', +% 'realtime' => $conf->exists('realtime-backend'), % ); %} %#&eidiot($error) if $error; diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 038aa2049..ad88092d3 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,17 +1,9 @@ % -% %my $conf=new FS::Conf; % %#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes %http_header('Content-Type' => 'text/plain' ); % -%my $batchnum; -%if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) { -% $batchnum = $1; -%} else { -% die "No batch number (bad URL) \n"; -%} -% %my $format; %if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { % $format = $1; @@ -23,12 +15,11 @@ %local $FS::UID::AutoCommit = 0; %my $dbh = dbh; % -%my $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'O'} ); +%my $pay_batch = qsearchs('pay_batch', {'status'=>''} ); %die "No pending batch. \n" unless $pay_batch; % %my %batchhash = $pay_batch->hash; %$batchhash{'status'} = 'I'; -%$batchhash{'download'} = time unless $batchhash{'download'}; %my $new = new FS::pay_batch \%batchhash; %my $error = $new->replace($pay_batch); %die "error updating batch status: $error\n" if $error; @@ -36,10 +27,8 @@ %my $batchtotal=0; %my $batchcount=0; % -%my (@date)=localtime($new->download); -%my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7] + 1); -%my $cdate = sprintf("%02d", $date[3]).sprintf("%02d", $date[4] + 1). -% sprintf("%02d", $date[5] % 100); +%my (@date)=localtime(); +%my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]); % %if ($format eq "BoM") { % @@ -51,16 +40,6 @@ %> % % -%}elsif ($format eq "PAP"){ -% -% my($origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = -% $conf->config("batchconfig-$format"); -% -<% sprintf( "H%10sD%3s%06u%-15s%09u%-12s%04u%19s\n",$origid,$typecode,$cdate,$shortname,$mybank,$myacct,$pay_batch->batchnum,"") - - %> -% -% %}elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ %# 1; %}else{ @@ -84,14 +63,7 @@ % % my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); % -<% sprintf( "D%010.0f%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->paybatchnum) %> -% -% -% } elsif ($format eq "PAP"){ -% -% my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); -% -<% sprintf( "D%-23s%06u%-19s%09u%-12s%010.0f\n",$cust_pay_batch->payname,$cdate,$cust_pay_batch->paybatchnum,$aba,$account,$cust_pay_batch->amount*100) %> +<% sprintf( "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum %> % % % } elsif ($format eq "csv-td_canada_trust-merchant_pc_batch") { @@ -109,16 +81,10 @@ %if ($format eq "BoM") { % % -<% sprintf( "YD%08u%014.0f%56s\n",$batchcount,$batchtotal*100,"" ). +<% sprintf( "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,"" ). sprintf( "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0","" ) %> % % -%} elsif ($format eq "PAP"){ -% -% -<% sprintf( "T%08u%014.0f%57s\n",$batchcount,$batchtotal*100,"" ) %> -% -% %} elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ % #1; %} else { diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 188d1dd04..e1fade4e2 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -1,5 +1,4 @@ % -% %#some false laziness w/MyAccount::process_payment % %$cgi->param('custnum') =~ /^(\d+)$/ @@ -25,10 +24,6 @@ %$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 ) ], @@ -87,7 +82,7 @@ % die "unknown payby $payby"; %} % -%my $error = $cust_main->realtime_bop( $payby2bop{$payby}, $amount, +%my $error = $cust_main->realtime_bop( $FS::payby::payby2bop->{$payby}, $amount, % 'quiet' => 1, % 'payinfo' => $payinfo, % 'paydate' => "$year-$month-01", -- cgit v1.2.1 From 4142ac8edaafd2791cd89116e2a6883f0be99366 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 27 Aug 2006 19:30:38 +0000 Subject: correct bad conflict resolution --- httemplate/misc/download-batch.cgi | 44 +++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index ad88092d3..038aa2049 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,9 +1,17 @@ % +% %my $conf=new FS::Conf; % %#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes %http_header('Content-Type' => 'text/plain' ); % +%my $batchnum; +%if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) { +% $batchnum = $1; +%} else { +% die "No batch number (bad URL) \n"; +%} +% %my $format; %if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { % $format = $1; @@ -15,11 +23,12 @@ %local $FS::UID::AutoCommit = 0; %my $dbh = dbh; % -%my $pay_batch = qsearchs('pay_batch', {'status'=>''} ); +%my $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'O'} ); %die "No pending batch. \n" unless $pay_batch; % %my %batchhash = $pay_batch->hash; %$batchhash{'status'} = 'I'; +%$batchhash{'download'} = time unless $batchhash{'download'}; %my $new = new FS::pay_batch \%batchhash; %my $error = $new->replace($pay_batch); %die "error updating batch status: $error\n" if $error; @@ -27,8 +36,10 @@ %my $batchtotal=0; %my $batchcount=0; % -%my (@date)=localtime(); -%my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]); +%my (@date)=localtime($new->download); +%my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7] + 1); +%my $cdate = sprintf("%02d", $date[3]).sprintf("%02d", $date[4] + 1). +% sprintf("%02d", $date[5] % 100); % %if ($format eq "BoM") { % @@ -40,6 +51,16 @@ %> % % +%}elsif ($format eq "PAP"){ +% +% my($origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) = +% $conf->config("batchconfig-$format"); +% +<% sprintf( "H%10sD%3s%06u%-15s%09u%-12s%04u%19s\n",$origid,$typecode,$cdate,$shortname,$mybank,$myacct,$pay_batch->batchnum,"") + + %> +% +% %}elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ %# 1; %}else{ @@ -63,7 +84,14 @@ % % my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); % -<% sprintf( "D%010u%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->invnum %> +<% sprintf( "D%010.0f%09u%-12s%-29s%-19s\n",$cust_pay_batch->amount*100,$aba,$account,$cust_pay_batch->payname,$cust_pay_batch->paybatchnum) %> +% +% +% } elsif ($format eq "PAP"){ +% +% my( $account, $aba ) = split( '@', $cust_pay_batch->payinfo ); +% +<% sprintf( "D%-23s%06u%-19s%09u%-12s%010.0f\n",$cust_pay_batch->payname,$cdate,$cust_pay_batch->paybatchnum,$aba,$account,$cust_pay_batch->amount*100) %> % % % } elsif ($format eq "csv-td_canada_trust-merchant_pc_batch") { @@ -81,10 +109,16 @@ %if ($format eq "BoM") { % % -<% sprintf( "YD%08u%014u%56s\n",$batchcount,$batchtotal*100,"" ). +<% sprintf( "YD%08u%014.0f%56s\n",$batchcount,$batchtotal*100,"" ). sprintf( "Z%014u%05u%014u%05u%41s\n",$batchtotal*100,$batchcount,"0","0","" ) %> % % +%} elsif ($format eq "PAP"){ +% +% +<% sprintf( "T%08u%014.0f%57s\n",$batchcount,$batchtotal*100,"" ) %> +% +% %} elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ % #1; %} else { -- cgit v1.2.1 From e1be514d16011ba193157c27ed626c4e31e7ecc6 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 27 Aug 2006 21:50:18 +0000 Subject: fix payby2bop brokenness --- httemplate/misc/process/payment.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index e1fade4e2..027cd502a 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -82,7 +82,7 @@ % die "unknown payby $payby"; %} % -%my $error = $cust_main->realtime_bop( $FS::payby::payby2bop->{$payby}, $amount, +%my $error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount, % 'quiet' => 1, % 'payinfo' => $payinfo, % 'paydate' => "$year-$month-01", -- cgit v1.2.1 From ce98306f315a53f2ac4b8c010341c4f84bf728a8 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 19 Oct 2006 14:29:27 +0000 Subject: suspension and cancellation reasons --- httemplate/misc/cancel_pkg.cgi | 16 ------ httemplate/misc/cancel_pkg.html | 95 +++++++++++++++++++++++++++++++++ httemplate/misc/expire_pkg.cgi | 56 ------------------- httemplate/misc/process/cancel_pkg.html | 94 ++++++++++++++++++++++++++++++++ httemplate/misc/process/expire_pkg.cgi | 26 --------- httemplate/misc/susp_pkg.cgi | 16 ------ 6 files changed, 189 insertions(+), 114 deletions(-) delete mode 100755 httemplate/misc/cancel_pkg.cgi create mode 100755 httemplate/misc/cancel_pkg.html delete mode 100755 httemplate/misc/expire_pkg.cgi create mode 100755 httemplate/misc/process/cancel_pkg.html delete mode 100755 httemplate/misc/process/expire_pkg.cgi delete mode 100755 httemplate/misc/susp_pkg.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi deleted file mode 100755 index 00b421f10..000000000 --- a/httemplate/misc/cancel_pkg.cgi +++ /dev/null @@ -1,16 +0,0 @@ -% -% -%#untaint pkgnum -%my($query) = $cgi->keywords; -%$query =~ /^(\d+)$/ || die "Illegal pkgnum"; -%my $pkgnum = $1; -% -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -% -%my $error = $cust_pkg->cancel; -%eidiot($error) if $error; -% -%print $cgi->redirect($p. "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -% -% - diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html new file mode 100755 index 000000000..bfb0893e9 --- /dev/null +++ b/httemplate/misc/cancel_pkg.html @@ -0,0 +1,95 @@ +%# if ( $link eq 'popup' ) { + <% include('/elements/header-popup.html', $title ) %> +%# } else { +%# <% include("/elements/header.html", $title, '') %> +%# } + + + + + + +% if ( $cgi->param('error') ) { + Error: <% $cgi->param('error') %> +

+% } + +
+ + + + +

+<% ucfirst($method) . " $pkgnum: " .$part_pkg->pkg. ' - ' .$part_pkg->comment %> +<% ntable("#cccccc", 2) %> + +% if ($method eq 'expire') { + + Cancel package on + + +
m/d/y + + + +%} +% + +<% include('/elements/tr-select-reason.html', 'reasonnum', $class) %> + + + +
+ + +
+ + + +<%init> +my($method, $pkgnum, $reasonnum, $submit, $cust_pkg, $part_pkg, + $date, $curuser, $class); +$date = time2str("%m/%d/%Y", time); +if ( $cgi->param('error') ) { + $method = $cgi->param('method'); + $pkgnum = $cgi->param('pkgnum'); + $reasonnum = $cgi->param('reasonnum'); + $date = $cgi->param('date'); +} elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + $pkgnum = $1; +} else { + die "illegal query ". $cgi->keywords; +} + +$method = $cgi->param('method'); +if ($method eq 'cancel') { + $class = 'C'; + $submit = "Cancel Now"; +}elsif ($method eq 'expire') { + $class = 'C'; + $submit = "Cancel Later"; +}elsif ($method eq 'suspend') { + $class = 'S'; + $submit = "Suspend"; +}else{ + die "illegal query ". $cgi->keywords; +} + +my $title = ucfirst($method) . ' Package'; + +$cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); +die "No such package: $pkgnum" unless $cust_pkg; + +$part_pkg = $cust_pkg->part_pkg; + +$curuser = $FS::CurrentUser::CurrentUser; + + + diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi deleted file mode 100755 index 55364c652..000000000 --- a/httemplate/misc/expire_pkg.cgi +++ /dev/null @@ -1,56 +0,0 @@ - -% -% -%my($query) = $cgi->keywords; -%$query =~ /^(\d+)$/; -%my $pkgnum = $1; -% -%#get package record -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%die "Unknown pkgnum $pkgnum" unless $cust_pkg; -%my $part_pkg = $cust_pkg->part_pkg; -% -%my $custnum = $cust_pkg->getfield('custnum'); -% -%my $date = $cust_pkg->expire ? time2str('%D', $cust_pkg->expire) : ''; -% -% - - -<% include("/elements/header.html",'Expire package', menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - 'Main Menu' => popurl(2) -)) %> - - - - - - -<% $pkgnum %>: <% $part_pkg->pkg. ' - '. $part_pkg->comment %> - -
- - - - - - -
Cancel package on - -
m/d/y -
- - - - -
- - diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html new file mode 100755 index 000000000..b53809854 --- /dev/null +++ b/httemplate/misc/process/cancel_pkg.html @@ -0,0 +1,94 @@ +% +% +%#untaint method +%my $method = $cgi->param('method'); +%$method =~ /^(cancel|expire|suspend)$/ || die "Illegal method"; +%$method = $1; + +%#untaint pkgnum +%my $pkgnum = $cgi->param('pkgnum'); +%$pkgnum =~ /^(\d+)$/ || die "Illegal pkgnum"; +%$pkgnum = $1; +% +%#untaint reasonnum +%my $reasonnum = $cgi->param('reasonnum'); +%$reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum"; +%$reasonnum = $1; +% +%my $date = time; +%if ($method eq 'expire'){ +% #untaint date +% $date = $cgi->param('date'); +% str2time($cgi->param('date')) =~ /^(\d+)$/ || die "Illegal date"; +% $date = $1; +%} +% +%my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); +% +% +%my $oldAutoCommit = $FS::UID::AutoCommit; +%local $FS::UID::AutoCommit = 0; +%my $dbh = dbh; +% +%my $otaker = $FS::CurrentUser::CurrentUser->name; +%$otaker = $FS::CurrentUser::CurrentUser->username +% if ($otaker eq "User, Legacy"); +% +%my $error; +%if ($reasonnum == -1) { +% #untaint new reason +% my $nr = $cgi->param('newreasonnum'); +% $nr =~ /^([\w\s]+)$/ || die "Illegal new reason"; +% $nr = $1; +% +% #untaint new reason type +% my $nrtype = $cgi->param('newreasonnumT'); +% $nrtype =~ /^(\d+)$/ || die "Illegal new reason type"; +% $nrtype = $1; +% +% my $reason = new FS::reason({ 'reason_type' => $nrtype, +% 'reason' => $nr, +% }); +% $error = $reason->insert; +% $reasonnum = $reason->reasonnum +% unless $error; +%} +% +%unless ($error) { +% my $cust_pkg_reason = new FS::cust_pkg_reason({ 'pkgnum' => $pkgnum, +% 'reasonnum' => $reasonnum, +% 'otaker' => $otaker, +% 'date' => $date, +% }); +% $error = $cust_pkg_reason->insert; +%} +% +%unless ($error) { +% if ($method eq 'expire'){ +% my %hash = $cust_pkg->hash; +% $hash{'expire'}=$date; +% my $new = new FS::cust_pkg (\%hash); +% $error = $new->replace($cust_pkg); +% }else{ +% $error = $cust_pkg->$method +% } +%} +% +%if ($error) { +% $cgi->param('error', $error); +% $dbh->rollback if $oldAutoCommit; +% print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); +%} +% +%$dbh->commit or die $dbh->errstr if $oldAutoCommit; +% +% my %past = ( 'cancel' => 'cancelled', +% 'expire' => 'expired', +% 'suspend' => 'suspended', +% ); +<% header("Package $past{$method}") %> + + + diff --git a/httemplate/misc/process/expire_pkg.cgi b/httemplate/misc/process/expire_pkg.cgi deleted file mode 100755 index d1963e2f5..000000000 --- a/httemplate/misc/process/expire_pkg.cgi +++ /dev/null @@ -1,26 +0,0 @@ -% -% -%#untaint date & pkgnum -% -%my $date; -%if ( $cgi->param('date') ) { -% str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; -% $date=$1; -%} else { -% $date=''; -%} -% -%$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; -%my $pkgnum = $1; -% -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%my %hash = $cust_pkg->hash; -%$hash{expire}=$date; -%my $new = new FS::cust_pkg ( \%hash ); -%my $error = $new->replace($cust_pkg); -%&eidiot($error) if $error; -% -%print $cgi->redirect(popurl(3). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -% -% - diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi deleted file mode 100755 index ea9edc7bb..000000000 --- a/httemplate/misc/susp_pkg.cgi +++ /dev/null @@ -1,16 +0,0 @@ -% -% -%#untaint pkgnum -%my ($query) = $cgi->keywords; -%$query =~ /^(\d+)$/ || die "Illegal pkgnum"; -%my $pkgnum = $1; -% -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -% -%my $error = $cust_pkg->suspend; -%&eidiot($error) if $error; -% -%print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); -% -% - -- cgit v1.2.1 From 9811b8ce65909a293810ddbcd8c9b5ca963fba01 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 23 Oct 2006 04:21:04 +0000 Subject: events should attach reasons --- httemplate/misc/cancel_pkg.html | 4 ++-- httemplate/misc/process/cancel_pkg.html | 13 ++----------- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index bfb0893e9..e61000618 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -42,12 +42,12 @@ %} % -<% include('/elements/tr-select-reason.html', 'reasonnum', $class) %> +<% include('/elements/tr-select-reason.html', 'reasonnum', $class, '', '', '', 'document.sc_popup.submit' ) %>
- + diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html index b53809854..01433a3dc 100755 --- a/httemplate/misc/process/cancel_pkg.html +++ b/httemplate/misc/process/cancel_pkg.html @@ -55,22 +55,13 @@ %} % %unless ($error) { -% my $cust_pkg_reason = new FS::cust_pkg_reason({ 'pkgnum' => $pkgnum, -% 'reasonnum' => $reasonnum, -% 'otaker' => $otaker, -% 'date' => $date, -% }); -% $error = $cust_pkg_reason->insert; -%} -% -%unless ($error) { % if ($method eq 'expire'){ % my %hash = $cust_pkg->hash; % $hash{'expire'}=$date; % my $new = new FS::cust_pkg (\%hash); -% $error = $new->replace($cust_pkg); +% $error = $new->replace($cust_pkg, 'reason' => $reasonnum); % }else{ -% $error = $cust_pkg->$method +% $error = $cust_pkg->$method( 'reason' => $reasonnum ); % } %} % -- cgit v1.2.1 From d5aaf28009ff269858f6b0532541da55b4968e6e Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 23 Oct 2006 08:47:07 +0000 Subject: better error message if you don't enter a reason. FS::reason::check can untaint its data, and will allow punctuation in reasons --- httemplate/misc/process/cancel_pkg.html | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html index 01433a3dc..dfe1317f4 100755 --- a/httemplate/misc/process/cancel_pkg.html +++ b/httemplate/misc/process/cancel_pkg.html @@ -34,22 +34,16 @@ %$otaker = $FS::CurrentUser::CurrentUser->username % if ($otaker eq "User, Legacy"); % -%my $error; +%my $error = ''; %if ($reasonnum == -1) { -% #untaint new reason -% my $nr = $cgi->param('newreasonnum'); -% $nr =~ /^([\w\s]+)$/ || die "Illegal new reason"; -% $nr = $1; % -% #untaint new reason type -% my $nrtype = $cgi->param('newreasonnumT'); -% $nrtype =~ /^(\d+)$/ || die "Illegal new reason type"; -% $nrtype = $1; +% $error = 'Enter a new reason (or select an existing oen)' +% unless $cgi->param('newreasonnum') !~ /^\s*$/; % -% my $reason = new FS::reason({ 'reason_type' => $nrtype, -% 'reason' => $nr, +% my $reason = new FS::reason({ 'reason_type' => $cgi->param('newreasonnumT'), +% 'reason' => $cgi->param('newreasonnum'), % }); -% $error = $reason->insert; +% $error ||= $reason->insert; % $reasonnum = $reason->reasonnum % unless $error; %} -- cgit v1.2.1 From 2f015c66aeb24d3c7a9ea2e10bb5a22e94d5a8f4 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 14 Nov 2006 04:04:33 +0000 Subject: working agent gateway override delete link --- httemplate/misc/delete-agent_payment_gateway.cgi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 httemplate/misc/delete-agent_payment_gateway.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-agent_payment_gateway.cgi b/httemplate/misc/delete-agent_payment_gateway.cgi new file mode 100644 index 000000000..fb0f1e4b8 --- /dev/null +++ b/httemplate/misc/delete-agent_payment_gateway.cgi @@ -0,0 +1,15 @@ +% die "you don't have the 'Configuration' access right" +% unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +% +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ || die "Illegal agentgatewaynum"; +% my $agentgatewaynum = $1; +% +% my $agent_payment_gateway = qsearchs('agent_payment_gateway', { +% 'agentgatewaynum' => $agentgatewaynum, +% }); +% +% my $error = $agent_payment_gateway->delete; +% eidiot($error) if $error; +% +% print $cgi->redirect($p. "browse/agent.cgi"); -- cgit v1.2.1 From 4fc89f725b1ef07a6f1687af0ddeb83988d493c1 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 14 Nov 2006 12:22:27 +0000 Subject: add some docs on required fields to page --- httemplate/misc/cust_main-import.cgi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index f7a8d8b52..73efd3705 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -8,7 +8,10 @@ Import a CSV file containing customer records. -Extended file format is CSV, with the following field order: agent_custid, refnum[1], last, first, address1, address2, city, state, zip, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password +Extended file format is CSV, with the following field order: agent_custid, refnum[1]<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo<%$req%>, paycvv, paydate<%$req%>, invoicing_list, pkgpart, username[2], _password[2] +

+ +<%$req%> Required fields

[1] This field has special treatment upon import: If a string is passed instead @@ -16,6 +19,9 @@ of an integer, the string is searched for and if necessary auto-created in the target table.

+[2] username and _password are required if pkgpart is specified. +

+ <% &ntable("#cccccc") %> <% include('/elements/tr-select-agent.html', '', #$agentnum, @@ -65,3 +71,6 @@ target table. <% include('/elements/footer.html') %> +<%once> +my $req = qq!*!; + -- cgit v1.2.1 From dbb388836b7951a3db49deda05a1ff9ba5125c17 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 30 Nov 2006 02:27:57 +0000 Subject: prepaid download/upload tracking --- httemplate/misc/process/recharge_svc.html | 46 +++++++++++++++++++++++++++++ httemplate/misc/recharge_svc.html | 48 +++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 httemplate/misc/process/recharge_svc.html create mode 100755 httemplate/misc/recharge_svc.html (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html new file mode 100755 index 000000000..ae526689e --- /dev/null +++ b/httemplate/misc/process/recharge_svc.html @@ -0,0 +1,46 @@ +% +% +%#untaint svcnum +%my $svcnum = $cgi->param('svcnum'); +%$svcnum =~ /^(\d+)$/ || die "Illegal svcnum"; +%$svcnum = $1; +% +%#untaint prepaid +%my $prepaid = $cgi->param('prepaid'); +%$prepaid =~ /^(\w*)$/; +%$prepaid = $1; +% +%my $error = ''; +%my $svc_acct = qsearchs( 'svc_acct', {'svcnum'=>$svcnum} ); +%$error = "Can't recharge service $svcnum. " unless $svc_acct; +% +%my $cust_main = $svc_acct->cust_svc->cust_pkg->cust_main; +% +%my $oldAutoCommit = $FS::UID::AutoCommit; +%local $FS::UID::AutoCommit = 0; +%my $dbh = dbh; +% +% +%unless ($error) { +% +%my ($amount, $seconds, $up, $down) = (0, 0, 0, 0); +%$error = $cust_main->get_prepay($prepaid, \$amount, \$seconds, \$up, \$down) +% || $svc_acct->increment_seconds($seconds) +% || $svc_acct->increment_upbytes($up) +% || $svc_acct->increment_downbytes($down) +% || $svc_acct->increment_totalbytes($up + $down) +% || $cust_main->insert_cust_pay_prepay( $amount, $prepaid ); +%} +% +%if ($error) { +% $cgi->param('error', $error); +% $dbh->rollback if $oldAutoCommit; +% print $cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ); +%} +% +<% header("Package recharged") %> + + + diff --git a/httemplate/misc/recharge_svc.html b/httemplate/misc/recharge_svc.html new file mode 100755 index 000000000..61f738455 --- /dev/null +++ b/httemplate/misc/recharge_svc.html @@ -0,0 +1,48 @@ +<% include('/elements/header-popup.html', 'Recharge Service' ) %> + +% if ( $cgi->param('error') ) { + Error: <% $cgi->param('error') %> +

+% } + +
+ + +

+<% "Recharge $svcnum: $label - $value" %> +<% ntable("#cccccc", 2) %> + + + Enter prepaid card: + + + + + +
+ + +
+ + + +<%init> +my($svcnum, $cust_svc, $label, $value, $prepaid); +if ( $cgi->param('error') ) { + $svcnum = $cgi->param('svcnum'); + $prepaid = $cgi->param('prepaid'); +} elsif ( $cgi->param('svcnum') =~ /^(\d+)$/ ) { + $svcnum = $1; +} else { + die "illegal query ". $cgi->keywords; +} + +my $title = 'Recharge Service'; + +$cust_svc = qsearchs('cust_svc', {'svcnum' => $svcnum}); +die "No such service: $svcnum" unless $cust_svc; + +($label, $value) = $cust_svc->label; + + + -- cgit v1.2.1 From 2c8748ac26281934a1b75671c6a5d0125145660a Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 1 Dec 2006 06:31:55 +0000 Subject: chase canada E-xactBatch --- httemplate/misc/download-batch.cgi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 038aa2049..a1e7b5c44 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -40,6 +40,8 @@ %my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7] + 1); %my $cdate = sprintf("%02d", $date[3]).sprintf("%02d", $date[4] + 1). % sprintf("%02d", $date[5] % 100); +%my $sdate = sprintf("%02d", $date[5] % 100).'/'.sprintf("%02d", $date[4] + 1). +% '/'.sprintf("%02d", $date[3]); % %if ($format eq "BoM") { % @@ -63,6 +65,12 @@ % %}elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ %# 1; +%}elsif ($format eq "csv-chase_canada-E-xactBatch"){ +% +% my($origid) = $conf->config("batchconfig-$format"); +<% sprintf( '$$E-xactBatchFileV1.0$$%s:%03u$$%s',$sdate,$pay_batch->batchnum, $origid) + %> +% %}else{ % die "Unknown format for batch in batchconfig. \n"; %} @@ -100,6 +108,12 @@ ,,,,<% $cust_pay_batch->payinfo %>,<% $exp %>,<% $cust_pay_batch->amount %>,<% $cust_pay_batch->paybatchnum %> % % +% } elsif ($format eq "csv-chase_canada-E-xactBatch"){ +% +% +<% $cust_pay_batch->paybatchnum %>,<% $cust_pay_batch->custnum %>,<% $cust_pay_batch->invnum %>,"<% $cust_pay_batch->payname %>",01,<% $cust_pay_batch->payinfo %>,<% $cust_pay_batch->amount %>,<% $exp %>,, +% +% % } else { % die "I'm already dead, but you did not know that.\n"; % } @@ -121,6 +135,8 @@ % %} elsif ($format eq "csv-td_canada_trust-merchant_pc_batch"){ % #1; +%} elsif ($format eq "csv-chase_canada-E-xactBatch"){ +% #1; %} else { % die "I'm already dead (again), but you did not know that.\n"; %} -- cgit v1.2.1 From 6194551336a925ae5455cede68a7f73660b06bb6 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 7 Dec 2006 02:40:32 +0000 Subject: retouch bandwidth countdown --- httemplate/misc/process/recharge_svc.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html index ae526689e..d9fa2070e 100755 --- a/httemplate/misc/process/recharge_svc.html +++ b/httemplate/misc/process/recharge_svc.html @@ -23,12 +23,12 @@ % %unless ($error) { % -%my ($amount, $seconds, $up, $down) = (0, 0, 0, 0); -%$error = $cust_main->get_prepay($prepaid, \$amount, \$seconds, \$up, \$down) +%my ($amount, $seconds, $up, $down, $total) = (0, 0, 0, 0, 0); +%$error = $cust_main->get_prepay($prepaid, \$amount, \$seconds, \$up, \$down, \$total) % || $svc_acct->increment_seconds($seconds) % || $svc_acct->increment_upbytes($up) % || $svc_acct->increment_downbytes($down) -% || $svc_acct->increment_totalbytes($up + $down) +% || $svc_acct->increment_totalbytes($total) % || $cust_main->insert_cust_pay_prepay( $amount, $prepaid ); %} % -- cgit v1.2.1 From dcdf657e77ec7b46dc69e19a849a9c133123db7c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 14 Dec 2006 06:00:46 +0000 Subject: encryption fixes from huntsberg & jayce --- httemplate/misc/payment.cgi | 4 ++-- httemplate/misc/process/payment.cgi | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 4c6ae3349..081964e93 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -67,7 +67,7 @@ function OLiframeContent(src, width, height, name) { % my $state = $cust_main->state; % my $zip = $cust_main->zip; % if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { -% $payinfo = $cust_main->payinfo; +% $payinfo = $cust_main->paymask; % $paycvv = $cust_main->paycvv; % ( $month, $year ) = $cust_main->paydate_monthyear; % $payname = $cust_main->payname if $cust_main->payname; @@ -153,7 +153,7 @@ function OLiframeContent(src, width, height, name) { % } elsif ( $payby eq 'CHEK' ) { % my( $payinfo1, $payinfo2, $payname, $ss ) = ( '', '', '', '' ); % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { -% $cust_main->payinfo =~ /^(\d+)\@(\d+)$/ +% $cust_main->paymask =~ /^(\d+)\@(\d+)$/ % or die "unparsable payinfo ". $cust_main->payinfo; % ($payinfo1, $payinfo2) = ($1, $2); % $payname = $cust_main->payname; diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 027cd502a..d591db1e8 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -44,17 +44,24 @@ %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; +% if ($cgi->param('payinfo1') =~ /xx/ || $cgi->param('payinfo2') =~ /xx/ ) { +% $payinfo = $cust_main->payinfo; +% } else { +% $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'); +% if ($payinfo eq $cust_main->paymask) { +% $payinfo = $cust_main->payinfo; +% } % $payinfo =~ s/\D//g; % $payinfo =~ /^(\d{13,16})$/ % or eidiot gettext('invalid_card'); # . ": ". $self->payinfo; -- cgit v1.2.1 From 709fb1259715b7bd353a6a6e37274f253fcb0c11 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 21 Dec 2006 03:05:26 +0000 Subject: fix on-demand payment form when making payments from masked data --- 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 081964e93..d7a2c2daf 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -153,7 +153,7 @@ function OLiframeContent(src, width, height, name) { % } elsif ( $payby eq 'CHEK' ) { % my( $payinfo1, $payinfo2, $payname, $ss ) = ( '', '', '', '' ); % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { -% $cust_main->paymask =~ /^(\d+)\@(\d+)$/ +% $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/ % or die "unparsable payinfo ". $cust_main->payinfo; % ($payinfo1, $payinfo2) = ($1, $2); % $payname = $cust_main->payname; -- cgit v1.2.1 From 8e95986bf97e83e00b0375dd1517c4bd0afb23e5 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 27 Dec 2006 01:07:28 +0000 Subject: fix county selector --- httemplate/misc/counties.cgi | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/counties.cgi b/httemplate/misc/counties.cgi index c9eb98500..940cba7dc 100644 --- a/httemplate/misc/counties.cgi +++ b/httemplate/misc/counties.cgi @@ -1,18 +1,27 @@ -% -% -% my( $state, $country ) = $cgi->param('arg'); -% -% my @counties = -% sort -% map { s/[\n\r]//g; $_; } -% map { $_->county; } -% qsearch( 'cust_main_county', -% { 'state' => $state, -% 'country' => $country, -% }, -% ) -% ; -% -% -% [ <% join(', ', map { qq("$_") } @counties) %> ] +<%init> + +my $DEBUG = 0; + +my( $state, $country ) = $cgi->param('arg'); + +warn "fetching counties for $state / $country \n" + if $DEBUG; + +my @counties = + sort + map { s/[\n\r]//g; $_; } + map { $_->county; } + qsearch( { + 'select' => 'DISTINCT county', + 'table' => 'cust_main_county', + 'hashref' => { 'state' => $state, + 'country' => $country, + }, + } ) +; + +warn "counties: ". join(', ', map { qq("$_") } @counties). "\n" + if $DEBUG; + + -- cgit v1.2.1 From 3c8870ee619416f126a65c93d5ef7a2f2e24bc96 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 27 Dec 2006 02:37:17 +0000 Subject: Add a (magically appearing and disappearing) label on the county selector. confusing when labeled "state" --- httemplate/misc/counties.cgi | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/counties.cgi b/httemplate/misc/counties.cgi index 940cba7dc..c022a27d9 100644 --- a/httemplate/misc/counties.cgi +++ b/httemplate/misc/counties.cgi @@ -1,27 +1,7 @@ [ <% join(', ', map { qq("$_") } @counties) %> ] <%init> -my $DEBUG = 0; - my( $state, $country ) = $cgi->param('arg'); - -warn "fetching counties for $state / $country \n" - if $DEBUG; - -my @counties = - sort - map { s/[\n\r]//g; $_; } - map { $_->county; } - qsearch( { - 'select' => 'DISTINCT county', - 'table' => 'cust_main_county', - 'hashref' => { 'state' => $state, - 'country' => $country, - }, - } ) -; - -warn "counties: ". join(', ', map { qq("$_") } @counties). "\n" - if $DEBUG; +my @counties = counties($state, $country); -- cgit v1.2.1 From b5a848358ad73e0d74eb2753123eecc6afabf730 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:35:51 +0000 Subject: just in case it gets capitalized --- httemplate/misc/payment.cgi | 2 +- httemplate/misc/process/payment.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index d7a2c2daf..73a9c6297 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -153,7 +153,7 @@ function OLiframeContent(src, width, height, name) { % } elsif ( $payby eq 'CHEK' ) { % my( $payinfo1, $payinfo2, $payname, $ss ) = ( '', '', '', '' ); % if ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { -% $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/ +% $cust_main->paymask =~ /^([\dx]+)\@([\dx]+)$/i % or die "unparsable payinfo ". $cust_main->payinfo; % ($payinfo1, $payinfo2) = ($1, $2); % $payname = $cust_main->payname; diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index d591db1e8..c5638c585 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -44,7 +44,7 @@ %my $paycvv = ''; %if ( $payby eq 'CHEK' ) { % -% if ($cgi->param('payinfo1') =~ /xx/ || $cgi->param('payinfo2') =~ /xx/ ) { +% if ($cgi->param('payinfo1') =~ /xx/i || $cgi->param('payinfo2') =~ /xx/i ) { % $payinfo = $cust_main->payinfo; % } else { % $cgi->param('payinfo1') =~ /^(\d+)$/ -- cgit v1.2.1 From 633c48448d9468690b7ad77eb6ff7c660a286658 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:51:34 +0000 Subject: service refactor! --- httemplate/misc/link.cgi | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 1d1f5e133..ef72b4a5c 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,6 +1,3 @@ - -% -% %my %link_field = ( % 'svc_acct' => 'username', % 'svc_domain' => 'domain', @@ -16,12 +13,10 @@ % }, %); % -%my($query) = $cgi->keywords; -%my($pkgnum, $svcpart) = ('', ''); -%foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart -% $pkgnum=$1 if /^pkgnum(\d+)$/; -% $svcpart=$1 if /^svcpart(\d+)$/; -%} +%$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +%my $pkgnum = $1; +%$cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +%my $svcpart = $1; % %my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); %my $svc = $part_svc->getfield('svc'); @@ -29,8 +24,6 @@ %my $link_field = $link_field{$svcdb}; %my $link_field2 = $link_field2{$svcdb}; % -% - <% include("/elements/header.html","Link to existing $svc") %>
-- cgit v1.2.1 From b89c7f126690704c8d1558dba06d5fabd7470528 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 8 Jan 2007 17:36:53 +0000 Subject: refund deletion --- httemplate/misc/delete-cust_refund.cgi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 httemplate/misc/delete-cust_refund.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-cust_refund.cgi b/httemplate/misc/delete-cust_refund.cgi new file mode 100755 index 000000000..3e44560d0 --- /dev/null +++ b/httemplate/misc/delete-cust_refund.cgi @@ -0,0 +1,17 @@ +% +% +%#untaint refundnum +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/ || die "Illegal refundnum"; +%my $refundnum = $1; +% +%my $cust_refund = qsearchs('cust_refund',{'refundnum'=>$refundnum}); +%my $custnum = $cust_refund->custnum; +% +%my $error = $cust_refund->delete; +%eidiot($error) if $error; +% +%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); +% +% + -- cgit v1.2.1 From a3e2c44624aa50e408046e77e6b1cd5d9c20b4c2 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 10 Jan 2007 00:41:36 +0000 Subject: permit batch redownloads --- httemplate/misc/download-batch.cgi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index a1e7b5c44..7e6750c58 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -24,6 +24,10 @@ %my $dbh = dbh; % %my $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'O'} ); +%unless ($pay_batch) { +% $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'I'} ) +% if $FS::CurrentUser::CurrentUser->access_right('Reprocess batches'); +%} %die "No pending batch. \n" unless $pay_batch; % %my %batchhash = $pay_batch->hash; -- cgit v1.2.1 From e8e43b0e59cf50e7a3c0789f589046459bc658c1 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 10 Jan 2007 00:42:23 +0000 Subject: ignore filenames and rely on selected batch number --- httemplate/misc/upload-batch.cgi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 742bbc0c6..5b4961be3 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,10 +1,8 @@ % % % my $fh = $cgi->upload('batch_results'); -% my $filename = $cgi->param('batch_results'); -% $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ -% or die "unparsable filename: $filename\n"; -% my $paybatch = $2; +% $cgi->param('batchnum') =~ /^(\d+)$/; +% my $paybatch = $1; % % my $error = defined($fh) % ? FS::cust_pay_batch::import_results( { -- cgit v1.2.1 From db690b75431c6bcff432930db1646f316d2e7154 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Jan 2007 07:53:54 +0000 Subject: add batch expiration date incrementer for 295 --- httemplate/misc/download-batch.cgi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 7e6750c58..74805b2a8 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -87,7 +87,13 @@ % % $cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; % my( $mon, $y ) = ( $2, $1 ); -% $mon = "0$mon" if $mon < 10; +% if ( $conf->exists('batch-increment_expiration') ) { +% my( $curmon, $curyear ) = (localtime(time))[4,5]; +% $curmon++; $curyear-=100; +% $y++ while $y < $curyear || ( $y == $curyear && $mon < $curmon ); +% } +% $mon = "0$mon" if $mon =~ /^\d$/; +% $y = "0$y" if $y =~ /^\d$/; % my $exp = "$mon$y"; % $batchcount++; % $batchtotal += $cust_pay_batch->amount; -- cgit v1.2.1 From be10e7a1421c13eec4b1bb3676eaf5c84344e601 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 17 Jan 2007 23:27:18 +0000 Subject: link to customer from manual payment screen (ticket 1414) --- httemplate/misc/change_pkg.cgi | 8 +++----- httemplate/misc/payment.cgi | 2 +- httemplate/misc/process/payment.cgi | 8 ++------ 3 files changed, 6 insertions(+), 12 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index 17dc8b859..7276f3256 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -27,10 +27,7 @@ % " ( 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 header("Change Package"); % %print qq!Error: !, $cgi->param('error'), % "

" @@ -38,7 +35,8 @@ % %my $part_pkg = $cust_pkg->part_pkg; % -%print small_custview( $cust_main, $conf->config('countrydefault') ). +%print small_custview( $cust_main, $conf->config('countrydefault') || '' , '', +% "${p}view/cust_main.cgi"). % qq!!. % qq!!. % qq!!. diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 73a9c6297..728eba7b9 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -31,7 +31,7 @@ % <% include( '/elements/header.html', "Process $type{$payby} payment" ) %> -<% include( '/elements/small_custview.html', $cust_main ) %> +<% include( '/elements/small_custview.html', $cust_main, '', '', popurl(2) . "view/cust_main.cgi" ) %> diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index c5638c585..6089d27c0 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -138,14 +138,10 @@ % <% include( '/elements/header.html', ucfirst($type{$payby}). ' processing successful', - include('/elements/menubar.html', - 'Main menu' => popurl(3), - "View this customer (#$custnum)" => - popurl(3). "view/cust_main.cgi?$custnum", - ), + include('/elements/menubar.html'), ) %> -<% include( '/elements/small_custview.html', $cust_main ) %> +<% include( '/elements/small_custview.html', $cust_main, '', '', popurl(3). "view/cust_main.cgi" ) %> -- cgit v1.2.1 From 216136a9a2aed14a099b9cc931c5b21a29c04894 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 19 Jan 2007 23:00:36 +0000 Subject: work around CSV brokenness --- httemplate/misc/download-batch.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 74805b2a8..371f17d19 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -120,8 +120,8 @@ % % } elsif ($format eq "csv-chase_canada-E-xactBatch"){ % -% -<% $cust_pay_batch->paybatchnum %>,<% $cust_pay_batch->custnum %>,<% $cust_pay_batch->invnum %>,"<% $cust_pay_batch->payname %>",01,<% $cust_pay_batch->payinfo %>,<% $cust_pay_batch->amount %>,<% $exp %>,, +% my $payname=$cust_pay_batch->payname; $payname =~ tr/",/ /; #payinfo too? :P +<% $cust_pay_batch->paybatchnum %>,<% $cust_pay_batch->custnum %>,<% $cust_pay_batch->invnum %>,"<% $payname %>",01,<% $cust_pay_batch->payinfo %>,<% $cust_pay_batch->amount %>,<% $exp %>,, % % % } else { -- cgit v1.2.1 From 05686487551e26418c9b2d6b92ea0d89bb100082 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Jan 2007 21:45:29 +0000 Subject: Have lineitem-specific applications happen in all cases; add weightsto control --- httemplate/misc/bill.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 6e4cc265d..8d4b4ac65 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -14,8 +14,7 @@ %#&eidiot($error) if $error; % %unless ( $error ) { -% $cust_main->apply_payments; -% $cust_main->apply_credits; +% $cust_main->apply_payments_and_credits; % % $error = $cust_main->collect( % # 'invoice-time'=>$time, -- cgit v1.2.1 From ddf21d3a3e70b4839e6b5db7a154ccc118026209 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Jan 2007 23:41:46 +0000 Subject: 00 = sale, 01 = pre-auth. we need the former --- 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 371f17d19..b6af849b9 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -121,7 +121,7 @@ % } elsif ($format eq "csv-chase_canada-E-xactBatch"){ % % my $payname=$cust_pay_batch->payname; $payname =~ tr/",/ /; #payinfo too? :P -<% $cust_pay_batch->paybatchnum %>,<% $cust_pay_batch->custnum %>,<% $cust_pay_batch->invnum %>,"<% $payname %>",01,<% $cust_pay_batch->payinfo %>,<% $cust_pay_batch->amount %>,<% $exp %>,, +<% $cust_pay_batch->paybatchnum %>,<% $cust_pay_batch->custnum %>,<% $cust_pay_batch->invnum %>,"<% $payname %>",00,<% $cust_pay_batch->payinfo %>,<% $cust_pay_batch->amount %>,<% $exp %>,, % % % } else { -- cgit v1.2.1 From 96192f1c88de6f54c856cac650bd2e1338e64fbc Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 29 Jan 2007 21:11:49 +0000 Subject: correct a typo, and <%init> helps alot --- httemplate/misc/process/cancel_pkg.html | 143 ++++++++++++++++---------------- 1 file changed, 71 insertions(+), 72 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html index dfe1317f4..cd533be10 100755 --- a/httemplate/misc/process/cancel_pkg.html +++ b/httemplate/misc/process/cancel_pkg.html @@ -1,76 +1,75 @@ -% -% -%#untaint method -%my $method = $cgi->param('method'); -%$method =~ /^(cancel|expire|suspend)$/ || die "Illegal method"; -%$method = $1; +<%init> +#untaint method +my $method = $cgi->param('method'); +$method =~ /^(cancel|expire|suspend)$/ || die "Illegal method"; +$method = $1; -%#untaint pkgnum -%my $pkgnum = $cgi->param('pkgnum'); -%$pkgnum =~ /^(\d+)$/ || die "Illegal pkgnum"; -%$pkgnum = $1; -% -%#untaint reasonnum -%my $reasonnum = $cgi->param('reasonnum'); -%$reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum"; -%$reasonnum = $1; -% -%my $date = time; -%if ($method eq 'expire'){ -% #untaint date -% $date = $cgi->param('date'); -% str2time($cgi->param('date')) =~ /^(\d+)$/ || die "Illegal date"; -% $date = $1; -%} -% -%my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); -% -% -%my $oldAutoCommit = $FS::UID::AutoCommit; -%local $FS::UID::AutoCommit = 0; -%my $dbh = dbh; -% -%my $otaker = $FS::CurrentUser::CurrentUser->name; -%$otaker = $FS::CurrentUser::CurrentUser->username -% if ($otaker eq "User, Legacy"); -% -%my $error = ''; -%if ($reasonnum == -1) { -% -% $error = 'Enter a new reason (or select an existing oen)' -% unless $cgi->param('newreasonnum') !~ /^\s*$/; -% -% my $reason = new FS::reason({ 'reason_type' => $cgi->param('newreasonnumT'), -% 'reason' => $cgi->param('newreasonnum'), -% }); -% $error ||= $reason->insert; -% $reasonnum = $reason->reasonnum -% unless $error; -%} -% -%unless ($error) { -% if ($method eq 'expire'){ -% my %hash = $cust_pkg->hash; -% $hash{'expire'}=$date; -% my $new = new FS::cust_pkg (\%hash); -% $error = $new->replace($cust_pkg, 'reason' => $reasonnum); -% }else{ -% $error = $cust_pkg->$method( 'reason' => $reasonnum ); -% } -%} -% -%if ($error) { -% $cgi->param('error', $error); -% $dbh->rollback if $oldAutoCommit; -% print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); -%} -% -%$dbh->commit or die $dbh->errstr if $oldAutoCommit; -% -% my %past = ( 'cancel' => 'cancelled', -% 'expire' => 'expired', -% 'suspend' => 'suspended', -% ); +#untaint pkgnum +my $pkgnum = $cgi->param('pkgnum'); +$pkgnum =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +#untaint reasonnum +my $reasonnum = $cgi->param('reasonnum'); +$reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum"; +$reasonnum = $1; + +my $date = time; +if ($method eq 'expire'){ + #untaint date + $date = $cgi->param('date'); + str2time($cgi->param('date')) =~ /^(\d+)$/ || die "Illegal date"; + $date = $1; +} + +my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); + +my $oldAutoCommit = $FS::UID::AutoCommit; +local $FS::UID::AutoCommit = 0; +my $dbh = dbh; + +my $otaker = $FS::CurrentUser::CurrentUser->name; +$otaker = $FS::CurrentUser::CurrentUser->username + if ($otaker eq "User, Legacy"); + +my $error = ''; +if ($reasonnum == -1) { + + $error = 'Enter a new reason (or select an existing one)' + unless $cgi->param('newreasonnum') !~ /^\s*$/; + + my $reason = new FS::reason({ 'reason_type' => $cgi->param('newreasonnumT'), + 'reason' => $cgi->param('newreasonnum'), + }); + $error ||= $reason->insert; + $reasonnum = $reason->reasonnum + unless $error; +} + +unless ($error) { + if ($method eq 'expire'){ + my %hash = $cust_pkg->hash; + $hash{'expire'}=$date; + my $new = new FS::cust_pkg (\%hash); + $error = $new->replace($cust_pkg, 'reason' => $reasonnum); + }else{ + $error = $cust_pkg->$method( 'reason' => $reasonnum ); + } +} + +if ($error) { + $cgi->param('error', $error); + $dbh->rollback if $oldAutoCommit; + print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string ); +} + +$dbh->commit or die $dbh->errstr if $oldAutoCommit; + + my %past = ( 'cancel' => 'cancelled', + 'expire' => 'expired', + 'suspend' => 'suspended', + ); + <% header("Package $past{$method}") %>