projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f8e7f53
)
fix "Column reference "payby" is ambiguous" error when selecting by payment type...
author
ivan
<ivan>
Fri, 4 Mar 2005 22:24:27 +0000
(22:24 +0000)
committer
ivan
<ivan>
Fri, 4 Mar 2005 22:24:27 +0000
(22:24 +0000)
httemplate/search/cust_credit.html
patch
|
blob
|
history
httemplate/search/cust_pay.cgi
patch
|
blob
|
history
diff --git
a/httemplate/search/cust_credit.html
b/httemplate/search/cust_credit.html
index
85128bc
..
8f6258e
100755
(executable)
--- a/
httemplate/search/cust_credit.html
+++ b/
httemplate/search/cust_credit.html
@@
-9,7
+9,7
@@
}
if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
}
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";
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',
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 )',
'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
64fe1f9
..
d4aaaa8
100755
(executable)
--- 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( $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+)$/ ) {
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');
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
if ( $3 ) {
if ( $3 eq 'VisaMC' ) {
#avoid posix regexes for portability
@@
-60,22
+59,19
@@
push @search, " _date < $1 ";
}
push @search, " _date < $1 ";
}
- my $search;
+ my $search
= ''
;
if ( @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 )".
$count_query = "SELECT COUNT(*), SUM(paid) ".
"FROM cust_pay LEFT JOIN cust_main USING ( custnum )".
- ( $hsearch ? " WHERE $hsearch " : '' ).
$search;
$search;
- warn join('-', keys %search);
$sql_query = {
'table' => 'cust_pay',
$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 )',
};
'extra_sql' => "$search ORDER BY _date",
'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
};