freeside/httemplate/search cust_pay.cgi,1.14,1.15 cust_credit.html,1.4,1.5

ivan ivan at pouncequick.420.am
Fri Mar 4 14:24:33 PST 2005


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory pouncequick:/tmp/cvs-serv6789

Modified Files:
	cust_pay.cgi cust_credit.html 
Log Message:
fix "Column reference "payby" is ambiguous" error when selecting by payment type, fix missing check #s caused by cust_main.payinfo masking cust_pay.payinfo, closes (really this time): Bug#1105

Index: cust_pay.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_pay.cgi,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cust_pay.cgi	4 Mar 2005 12:57:53 -0000	1.14
+++ cust_pay.cgi	4 Mar 2005 22:24:27 -0000	1.15
@@ -3,7 +3,6 @@
    my( $count_query, $sql_query );
    if ( $cgi->param('magic') && $cgi->param('magic') eq '_date' ) {
    
-     my %search = ();
      my @search = ();
 
      if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
@@ -16,7 +15,7 @@
      if ( $cgi->param('payby') ) {
        $cgi->param('payby') =~ /^(CARD|CHEK|BILL)(-(VisaMC|Amex|Discover))?$/
          or die "illegal payby ". $cgi->param('payby');
-       $search{'payby'} = $1;
+       push @search, "cust_pay.payby = '$1'";
        if ( $3 ) {
          if ( $3 eq 'VisaMC' ) {
            #avoid posix regexes for portability
@@ -60,22 +59,19 @@
        push @search, " _date < $1 ";
      }
    
-     my $search;
+     my $search = '';
      if ( @search ) {
-       $search = ( scalar(keys %search) ? ' AND ' : ' WHERE ' ).
-                 join(' AND ', @search);
+       $search = ' WHERE '. join(' AND ', @search);
      }
 
-     my $hsearch = join(' AND ', map { "$_ = '$search{$_}'" } keys %search );
      $count_query = "SELECT COUNT(*), SUM(paid) ".
                     "FROM cust_pay LEFT JOIN cust_main USING ( custnum )".
-                    ( $hsearch ? " WHERE $hsearch " : '' ).
                     $search;
    
-     warn join('-', keys %search);
      $sql_query = {
        'table'     => 'cust_pay',
-       'hashref'   => \%search,
+       'select'    => 'cust_pay.*, cust_main.last, cust_main.first, cust_main.company',
+       'hashref'   => {},
        'extra_sql' => "$search ORDER BY _date",
        'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
      };

Index: cust_credit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_credit.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cust_credit.html	4 Mar 2005 12:57:53 -0000	1.4
+++ cust_credit.html	4 Mar 2005 22:24:27 -0000	1.5
@@ -9,7 +9,7 @@
    }
 
    if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
-     push @search, "agentnum = $1"; # $search{'agentnum'} = $1;
+     push @search, "agentnum = $1";
      my $agent = qsearchs('agent', { 'agentnum' => $1 } );
      die "unknown agentnum $1" unless $agent;
      $title = $agent->agent. " $title";
@@ -46,6 +46,7 @@
 
    my $sql_query   = {
      'table'     => 'cust_credit',
+     'select'    => 'cust_credit.*, cust_main.last, cust_main.first, cust_main.company',
      'hashref'   => {},
      'extra_sql' => $where,
      'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',




More information about the freeside-commits mailing list