freeside/httemplate/misc/process link.cgi,1.10,1.11

Ivan Kohler ivan at pouncequick.420.am
Thu Jun 16 21:42:08 PDT 2005


Update of /home/cvs/cvsroot/freeside/httemplate/misc/process
In directory pouncequick:/tmp/cvs-serv13551

Modified Files:
	link.cgi 
Log Message:
add debugging for accounts picked to pick

Index: link.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/process/link.cgi,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- link.cgi	30 Jul 2004 04:54:41 -0000	1.10
+++ link.cgi	17 Jun 2005 04:42:06 -0000	1.11
@@ -1,5 +1,7 @@
 <%
 
+my $DEBUG = 0;
+
 $cgi->param('pkgnum') =~ /^(\d+)$/;
 my $pkgnum = $1;
 $cgi->param('svcpart') =~ /^(\d+)$/;
@@ -16,14 +18,30 @@
   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});




More information about the freeside-commits mailing list