summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-07-17 15:08:57 -0700
committerMark Wells <mark@freeside.biz>2015-07-17 15:08:57 -0700
commit45b1d2bf265890e1872420580a907ada70fb6c4b (patch)
tree18f1cc353ad6f082b656ef1924a3d1dfab4b43d1 /FS
parent85f0e2caa759102f68fe28278faf5f65c7b33b3c (diff)
fix invoice reprinting + cust_bill::Search changes, #37320, from #25943
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_bill.pm28
1 files changed, 12 insertions, 16 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 69fdc91ee..7e068abe8 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -3016,6 +3016,9 @@ sub process_re_X {
}
+# this is called from search/cust_bill.html and given all its search
+# parameters, so it needs to perform the same search.
+
sub re_X {
# spool_invoice ftp_invoice fax_invoice print_invoice
my($method, $job, %param ) = @_;
@@ -3025,22 +3028,15 @@ sub re_X {
}
#some false laziness w/search/cust_bill.html
- my $distinct = '';
- my $orderby = 'ORDER BY cust_bill._date';
-
- my $extra_sql = ' WHERE '. FS::cust_bill->search_sql_where(\%param);
-
- my $addl_from = 'LEFT JOIN cust_main USING ( custnum )';
-
- my @cust_bill = qsearch( {
- #'select' => "cust_bill.*",
- 'table' => 'cust_bill',
- 'addl_from' => $addl_from,
- 'hashref' => {},
- 'extra_sql' => $extra_sql,
- 'order_by' => $orderby,
- 'debug' => 1,
- } );
+ $param{'order_by'} = 'cust_bill._date';
+
+ my $query = FS::cust_bill->search(\%param);
+ delete $query->{'count_query'};
+ delete $query->{'count_addl'};
+
+ $query->{debug} = 1; # was in here before, is obviously useful
+
+ my @cust_bill = qsearch( $query );
$method .= '_invoice' unless $method eq 'email' || $method eq 'print';