summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2001-12-28 15:14:01 +0000
committerivan <ivan>2001-12-28 15:14:01 +0000
commit368fe197549dab5edf86cd37b64b9fdddbd07a65 (patch)
tree2bf6a272dfc5ecde99bd407369859b6ac2c00424
parent5e25b996982d42eb2587ec54db0d5b39508aa730 (diff)
force printing in freeside-overdue
-rw-r--r--FS/FS/cust_main.pm20
-rwxr-xr-xFS/bin/freeside-overdue8
2 files changed, 18 insertions, 10 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 6c18f93a1..3e92417c4 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1067,6 +1067,9 @@ CyberCash is not installed.
report_badcard - Set this true if you want bad card transactions to
return an error. By default, they don't.
+force_print - force printing even if invoice has been printed more than once
+every 30 days, and don't increment the `printed' field.
+
=cut
sub collect {
@@ -1118,7 +1121,8 @@ sub collect {
my $since = $invoice_time - ( $cust_bill->_date || 0 );
#warn "$invoice_time ", $cust_bill->_date, " $since";
if ( $since >= 0 #don't print future invoices
- && ( $cust_bill->printed * 2592000 ) <= $since
+ && ( ( $cust_bill->printed * 2592000 ) <= $since
+ || $options{'force_print'} )
) {
#my @print_text = $cust_bill->print_text; #( date )
@@ -1148,11 +1152,13 @@ sub collect {
: "Exit status $? from $lpr";
}
- my %hash = $cust_bill->hash;
- $hash{'printed'}++;
- my $new_cust_bill = new FS::cust_bill(\%hash);
- my $error = $new_cust_bill->replace($cust_bill);
- warn "Error updating $cust_bill->printed: $error" if $error;
+ unless ( $options{'force_print'} ) {
+ my %hash = $cust_bill->hash;
+ $hash{'printed'}++;
+ my $new_cust_bill = new FS::cust_bill(\%hash);
+ my $error = $new_cust_bill->replace($cust_bill);
+ warn "Error updating $cust_bill->printed: $error" if $error;
+ }
}
@@ -1940,7 +1946,7 @@ sub append_fuzzyfiles {
=head1 VERSION
-$Id: cust_main.pm,v 1.52 2001-12-28 14:40:35 ivan Exp $
+$Id: cust_main.pm,v 1.53 2001-12-28 15:14:01 ivan Exp $
=head1 BUGS
diff --git a/FS/bin/freeside-overdue b/FS/bin/freeside-overdue
index 8f7f872c8..076330228 100755
--- a/FS/bin/freeside-overdue
+++ b/FS/bin/freeside-overdue
@@ -92,9 +92,11 @@ foreach $cust_main ( qsearch('cust_main',{} ) ) {
if ( $opt{o} ) {
print "\n\tCollecting" unless $opt{q};
- my $error = $cust_main->collect( 'invoice_time'=>$now,
- 'batch_card' => $opt{i} ? 'no' : 'yes',
- );
+ my $error = $cust_main->collect(
+ 'invoice_time' => $now,
+ 'batch_card' => $opt{i} ? 'no' : 'yes',
+ 'force_print' => 'yes',
+ );
warn "Error collecting from customer #" . $cust_main->custnum. ":$error"
if $error;
}