X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Flink.cgi;h=acdd1ad031cf32ba8010edc3008d3cbe63228bb7;hb=0247c39288b477060509240ef23a5e7b6bfcd8f8;hp=32a5360d98999e4c992633b12c0cf16c1842eae3;hpb=8ed2714fc50607081d7ac4edf0b17e23902dabba;p=freeside.git diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 32a5360d9..acdd1ad03 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -16,8 +16,11 @@ unless ( $svcnum ) { if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { $search{$1} = $cgi->param('link_value2'); } - my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart } - qsearch( $svcdb, \%search ) + my $svc_x = ( sort { ($b->cust_svc->pkgnum > 0) <=> ($a->cust_svc->pkgnum > 0) + or ($b->cust_svc->svcpart == $svcpart) + <=> ($a->cust_svc->svcpart == $svcpart) + } + qsearch( $svcdb, \%search ) )[0]; eidiot("$link_field not found!") unless $svc_x; $svcnum = $svc_x->svcnum;