[freeside-commits] branch FREESIDE_3_BRANCH updated. e41904a3e2d5d8c9f0d178126420eeb9dd33c39c

Ivan ivan at 420.am
Tue Jan 13 20:10:13 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  e41904a3e2d5d8c9f0d178126420eeb9dd33c39c (commit)
      from  e3e4763e500169faa7ce8bd3dba787da82edff2e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e41904a3e2d5d8c9f0d178126420eeb9dd33c39c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jan 13 20:10:12 2015 -0800

    fix customer-specific pending payment search, RT#32962

diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index 8aece0c..b5172fb 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -239,14 +239,14 @@ if ( $cgi->param('magic') ) {
   if ( $cgi->param('magic') eq '_date' ) {
 
     if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
-      push @search, "agentnum = $1"; # $search{'agentnum'} = $1;
+      push @search, "cust_main.agentnum = $1"; # $search{'agentnum'} = $1;
       my $agent = qsearchs('agent', { 'agentnum' => $1 } );
       die "unknown agentnum $1" unless $agent;
       $title = $agent->agent. " $title";
     }
 
     if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
-      push @search, "refnum = $1";
+      push @search, "cust_main.refnum = $1";
       my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
       die "unknown refnum $1" unless $part_referral;
       $title = $part_referral->referral. " $title";
@@ -262,7 +262,7 @@ if ( $cgi->param('magic') ) {
     }
 
     if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
-      push @search, "custnum = $1";
+      push @search, "$table.custnum = $1";
     }
 
     if ( $cgi->param('payby') ) {
@@ -421,22 +421,22 @@ if ( $cgi->param('magic') ) {
 
     #for cust_pay_pending...  statusNOT=done
     if ( $cgi->param('statusNOT') =~ /^(\w+)$/ ) {
-      push @search, "status != '$1'";
+      push @search, "$table.status != '$1'";
     }
 
     my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 
-    push @search, "_date >= $beginning ",
-                  "_date <= $ending";
+    push @search, "$table._date >= $beginning ",
+                  "$table._date <= $ending";
 
     if ( $table eq 'cust_pay_void' ) {
       my($v_beginning, $v_ending) =
         FS::UI::Web::parse_beginning_ending($cgi, 'void');
-      push @search, "void_date >= $v_beginning ",
-                    "void_date <= $v_ending";
+      push @search, "$table.void_date >= $v_beginning ",
+                    "$table.void_date <= $v_ending";
     }
 
-    push @search, FS::UI::Web::parse_lt_gt($cgi, $amount_field );
+    push @search, FS::UI::Web::parse_lt_gt($cgi, "$table.$amount_field" );
 
     $orderby = '_date';
 
@@ -517,7 +517,7 @@ if ( $cgi->param('magic') ) {
 
   my $search = ' WHERE '. join(' AND ', @search);
 
-  $count_query = "SELECT COUNT(*), SUM($amount_field) ";
+  $count_query = "SELECT COUNT(*), SUM($table.$amount_field) ";
   $count_query .= ', SUM(' . "FS::$table"->unapplied_sql . ') ' 
     if $unapplied;
   $count_query .= "FROM $table $addl_from".
@@ -545,7 +545,7 @@ if ( $cgi->param('magic') ) {
   $cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby";
   my $payby = $1;
 
-  $count_query = "SELECT COUNT(*), SUM($amount_field) FROM $table".
+  $count_query = "SELECT COUNT(*), SUM($table.$amount_field) FROM $table".
                  "  WHERE payinfo = '$payinfo' AND payby = '$payby'".
                  "  AND ". $curuser->agentnums_sql;
   @count_addl = ( '$%.2f total '.$opt{name_verb} );

-----------------------------------------------------------------------

Summary of changes:
 httemplate/search/elements/cust_pay_or_refund.html |   22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)




More information about the freeside-commits mailing list