[freeside-commits] freeside/FS/FS cust_bill.pm,1.189,1.190
Ivan,,,
ivan at wavetail.420.am
Sat Mar 15 12:53:00 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv2264/FS/FS
Modified Files:
cust_bill.pm
Log Message:
check on invoice re-printing newest percust... can't reproduce any problem, prints newest per cust fine, closes: #3161
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- cust_bill.pm 4 Mar 2008 03:38:17 -0000 1.189
+++ cust_bill.pm 15 Mar 2008 19:52:58 -0000 1.190
@@ -2645,7 +2645,7 @@
use MIME::Base64;
sub process_re_X {
my( $method, $job ) = ( shift, shift );
- warn "process_re_X $method for job $job\n" if $DEBUG;
+ warn "$me process_re_X $method for job $job\n" if $DEBUG;
my $param = thaw(decode_base64(shift));
warn Dumper($param) if $DEBUG;
@@ -2671,16 +2671,20 @@
my $extra_sql = ' WHERE '. FS::cust_bill->search_sql(\%param);
- my $addl_from = 'left join cust_main using ( custnum )';
+ my $addl_from = 'LEFT JOIN cust_main USING ( custnum )';
- my @cust_bill = qsearch( 'cust_bill',
- {},
- #"$distinct cust_bill.*",
- "cust_bill.*",
- $extra_sql,
- '',
- $addl_from
- );
+ my @cust_bill = qsearch( {
+ #'select' => "cust_bill.*",
+ 'table' => 'cust_bill',
+ 'addl_from' => $addl_from,
+ 'hashref' => {},
+ 'extra_sql' => $extra_sql,
+ 'order_by' => $orderby,
+ 'debug' => 1,
+ } );
+
+ warn " $me re_X $method: ". scalar(@cust_bill). " invoices found\n"
+ if $DEBUG;
my( $num, $last, $min_sec ) = (0, time, 5); #progresbar foo
foreach my $cust_bill ( @cust_bill ) {
@@ -2790,6 +2794,11 @@
sub search_sql {
my($class, $param) = @_;
+ if ( $DEBUG ) {
+ warn "$me search_sql called with params: \n".
+ join("\n", map { " $_: ". $param->{$_} } keys %$param ). "\n";
+ }
+
my @search = ();
if ( $param->{'begin'} =~ /^(\d+)$/ ) {
@@ -2840,7 +2849,22 @@
}
- push @search, $FS::CurrentUser::CurrentUser->agentnums_sql;
+ my $curuser = $FS::CurrentUser::CurrentUser;
+ if ( $curuser->username eq 'fs_queue'
+ && $param->{'CurrentUser'} =~ /^(\w+)$/ ) {
+ my $username = $1;
+ my $newuser = qsearchs('access_user', {
+ 'username' => $username,
+ 'disabled' => '',
+ } );
+ if ( $newuser ) {
+ $curuser = $newuser;
+ } else {
+ warn "$me WARNING: (fs_queue) can't find CurrentUser $username\n";
+ }
+ }
+
+ push @search, $curuser->agentnums_sql;
join(' AND ', @search );
More information about the freeside-commits
mailing list