diff options
author | ivan <ivan> | 2005-06-17 04:42:06 +0000 |
---|---|---|
committer | ivan <ivan> | 2005-06-17 04:42:06 +0000 |
commit | 21e9127d3a16335907d1102793b294446e07120b (patch) | |
tree | 5a3889e294b989ba583f5f5462773ef9de0865c9 /httemplate/misc/process/link.cgi | |
parent | beb9cc8ec5bc9ec114763d5ecb48cf674ff4de72 (diff) |
add debugging for accounts picked to pick
Diffstat (limited to 'httemplate/misc/process/link.cgi')
-rwxr-xr-x | httemplate/misc/process/link.cgi | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index acdd1ad03..7768b3bd4 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,5 +1,7 @@ <% +my $DEBUG = 0; + $cgi->param('pkgnum') =~ /^(\d+)$/; my $pkgnum = $1; $cgi->param('svcpart') =~ /^(\d+)$/; @@ -16,14 +18,30 @@ unless ( $svcnum ) { if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { $search{$1} = $cgi->param('link_value2'); } - my $svc_x = ( sort { ($b->cust_svc->pkgnum > 0) <=> ($a->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 ) - )[0]; + ); + + if ( $DEBUG ) { + warn scalar(@svc_x). " candidate accounts found for linking ". + "(svcpart $svcpart):\n"; + foreach my $svc_x ( @svc_x ) { + warn " ". $svc_x->email. + " (pkgnum ". $_->cust_svc->pkgnum. + ", svcpart ". $_->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}); |