diff options
Diffstat (limited to 'httemplate/misc/process')
-rw-r--r-- | httemplate/misc/process/batch-cust_pay.cgi | 42 | ||||
-rwxr-xr-x | httemplate/misc/process/link.cgi | 23 |
2 files changed, 2 insertions, 63 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi deleted file mode 100644 index 12d72e8a0..000000000 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ /dev/null @@ -1,42 +0,0 @@ -<% - 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") %> - - <% } %> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index c3d79e22c..acdd1ad03 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,7 +1,5 @@ <% -my $DEBUG = 0; - $cgi->param('pkgnum') =~ /^(\d+)$/; my $pkgnum = $1; $cgi->param('svcpart') =~ /^(\d+)$/; @@ -18,31 +16,14 @@ unless ( $svcnum ) { 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) + my $svc_x = ( sort { ($b->cust_svc->pkgnum > 0) <=> ($a->cust_svc->pkgnum > 0) or ($b->cust_svc->svcpart == $svcpart) <=> ($a->cust_svc->svcpart == $svcpart) } qsearch( $svcdb, \%search ) - ); - - 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]; - + )[0]; eidiot("$link_field not found!") unless $svc_x; - $svcnum = $svc_x->svcnum; - } my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); |