projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
05bb22c
)
check on invoice re-printing newest percust... can't reproduce any problem, prints...
author
ivan
<ivan>
Sat, 15 Mar 2008 19:53:00 +0000
(19:53 +0000)
committer
ivan
<ivan>
Sat, 15 Mar 2008 19:53:00 +0000
(19:53 +0000)
FS/FS/cust_bill.pm
patch
|
blob
|
history
httemplate/search/cust_bill.html
patch
|
blob
|
history
diff --git
a/FS/FS/cust_bill.pm
b/FS/FS/cust_bill.pm
index
1d76f80
..
3c69632
100644
(file)
--- a/
FS/FS/cust_bill.pm
+++ b/
FS/FS/cust_bill.pm
@@
-2570,7
+2570,7
@@
use Data::Dumper;
use MIME::Base64;
sub process_re_X {
my( $method, $job ) = ( shift, shift );
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;
my $param = thaw(decode_base64(shift));
warn Dumper($param) if $DEBUG;
@@
-2596,16
+2596,20
@@
sub re_X {
my $extra_sql = ' WHERE '. FS::cust_bill->search_sql(\%param);
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 ) {
my( $num, $last, $min_sec ) = (0, time, 5); #progresbar foo
foreach my $cust_bill ( @cust_bill ) {
@@
-2715,6
+2719,11
@@
Note: validates all passed-in data; i.e. safe to use with unchecked CGI params.
sub search_sql {
my($class, $param) = @_;
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+)$/ ) {
my @search = ();
if ( $param->{'begin'} =~ /^(\d+)$/ ) {
@@
-2765,7
+2774,22
@@
sub search_sql {
}
}
- 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 );
join(' AND ', @search );
diff --git
a/httemplate/search/cust_bill.html
b/httemplate/search/cust_bill.html
index
4f0585d
..
25a7ea0
100755
(executable)
--- a/
httemplate/search/cust_bill.html
+++ b/
httemplate/search/cust_bill.html
@@
-159,7
+159,8
@@
if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
FS::cust_bill->owed_sql. ' AS owed',
FS::cust_bill->net_sql. ' AS net',
),
FS::cust_bill->owed_sql. ' AS owed',
FS::cust_bill->net_sql. ' AS net',
),
- 'extra_sql' => "$extra_sql $orderby"
+ 'extra_sql' => $extra_sql,
+ 'order_by' => $orderby,
};
}
};
}
@@
-187,17
+188,40
@@
my $html_init = join("\n", map {
qq!<FORM NAME="${_}form">!,
( map qq!<INPUT TYPE="hidden" NAME="$_" VALUE="$search{$_}">!, keys %search ),
qq!</FORM>!
qq!<FORM NAME="${_}form">!,
( map qq!<INPUT TYPE="hidden" NAME="$_" VALUE="$search{$_}">!, keys %search ),
qq!</FORM>!
-} qw( print_ email_ fax_ ) );
+} qw( print_ email_ fax_ ) ).
+
+'<SCRIPT TYPE="text/javascript">
+
+function confirm_print_process() {
+ if ( ! confirm("Are you sure you want to reprint these invoices?") ) {
+ return;
+ }
+ print_process();
+}
+function confirm_email_process() {
+ if ( ! confirm("Are you sure you want to re-email these invoices?") ) {
+ return;
+ }
+ email_process();
+}
+function confirm_fax_process() {
+ if ( ! confirm("Are you sure you want to re-fax these invoices?") ) {
+ return;
+ }
+ fax_process();
+}
+
+</SCRIPT>';
my $menubar = [
'Print these invoices' =>
my $menubar = [
'Print these invoices' =>
- "javascript:print_process()",
+ "javascript:
confirm_
print_process()",
'Email these invoices' =>
'Email these invoices' =>
- "javascript:email_process()",
+ "javascript:
confirm_
email_process()",
];
push @$menubar, 'Fax these invoices' =>
];
push @$menubar, 'Fax these invoices' =>
- "javascript:fax_process()"
+ "javascript:
confirm_
fax_process()"
if $conf->exists('hylafax');
</%init>
if $conf->exists('hylafax');
</%init>