summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-12-26 21:18:25 +0000
committerivan <ivan>2011-12-26 21:18:25 +0000
commite243f4541c78a033c4f969a03d29b9da84829d97 (patch)
treee32d67931068c934ab0a37145d32e77cf0b7bde5
parentd8535724aaeb4f5157d221a46a47bc25739d7495 (diff)
add -o flag to freeside-daily, to only bill for one month, RT#14904
-rw-r--r--FS/FS/Cron/bill.pm1
-rw-r--r--FS/FS/cust_main/Billing.pm10
-rwxr-xr-xFS/bin/freeside-daily4
3 files changed, 12 insertions, 3 deletions
diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm
index 88fe69b77..1569ef6a2 100644
--- a/FS/FS/Cron/bill.pm
+++ b/FS/FS/Cron/bill.pm
@@ -93,6 +93,7 @@ sub bill {
'check_freq' => $check_freq,
'resetup' => ( $opt{'s'} ? $opt{'s'} : 0 ),
'not_pkgpart' => $opt{'g'}, #$not_pkgpart,
+ 'one_recur' => $opt{'o'},
);
if ( $opt{'m'} ) {
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 464ee8a87..205180481 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -420,11 +420,17 @@ sub bill {
'real_pkgpart' => $real_pkgpart,
'options' => \%options,
);
- # Stop if anything goes wrong, or if we're not incrementing
- # the bill date.
+
+ # Stop if anything goes wrong
last if $error;
+
+ # or if we're not incrementing the bill date.
last if ($cust_pkg->getfield('bill') || 0) == $next_bill;
+
$next_bill = $cust_pkg->getfield('bill') || 0;
+
+ #stop if -o was passed to freeside-daily
+ last if $options{'one_recur'};
}
if ($error) {
$dbh->rollback if $oldAutoCommit && !$options{no_commit};
diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily
index 2beb096ab..ee63b9a29 100755
--- a/FS/bin/freeside-daily
+++ b/FS/bin/freeside-daily
@@ -97,7 +97,7 @@ freeside-daily - Run daily billing and invoice collection events.
=head1 SYNOPSIS
- freeside-daily [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum,agentnum,... ] [ -s ] [ -v ] [ -l level ] [ -m ] [ -r ] [ -k ] user [ custnum custnum ... ]
+ freeside-daily [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum,agentnum,... ] [ -s ] [ -o ] [ -v ] [ -l level ] [ -m ] [ -r ] [ -k ] user [ custnum custnum ... ]
=head1 DESCRIPTION
@@ -128,6 +128,8 @@ the bill and collect methods of a cust_main object. See L<FS::cust_main>.
-s: re-charge setup fees
+ -o: For packages which are more than one billing period behind, only charge for one billing period rather than catching up.
+
-v: enable debugging
-l: debugging level