summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2005-03-04 22:24:27 +0000
committerivan <ivan>2005-03-04 22:24:27 +0000
commitf34557b8890dcc63db6c5588233dc7bfa9d39f22 (patch)
tree10ed936bb1a3f5e179729a3cf2f585e22b638122 /httemplate
parentf8e7f53109f36e3c649dc509b61c75c3c44fb519 (diff)
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
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/search/cust_credit.html3
-rwxr-xr-xhttemplate/search/cust_pay.cgi14
2 files changed, 7 insertions, 10 deletions
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index 85128bca2..8f6258e4e 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -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 )',
diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi
index 64fe1f93a..d4aaaa89c 100755
--- a/httemplate/search/cust_pay.cgi
+++ b/httemplate/search/cust_pay.cgi
@@ -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 )',
};