[freeside-commits] branch FREESIDE_3_BRANCH updated. e4278a4de86f87a4a25c6cbdd93fd9f650bbccf0
Ivan
ivan at 420.am
Fri Dec 12 16:49:52 PST 2014
The branch, FREESIDE_3_BRANCH has been updated
via e4278a4de86f87a4a25c6cbdd93fd9f650bbccf0 (commit)
from c50ac2e99690064ac74868f076cc5590448d95aa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e4278a4de86f87a4a25c6cbdd93fd9f650bbccf0
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Dec 12 16:49:51 2014 -0800
fix agent bulk billing with quantities, RT#31610
diff --git a/FS/FS/part_pkg/agent.pm b/FS/FS/part_pkg/agent.pm
index e24ebe1..99b7749 100644
--- a/FS/FS/part_pkg/agent.pm
+++ b/FS/FS/part_pkg/agent.pm
@@ -119,6 +119,8 @@ sub calc_recur {
my $pkg_charge = 0;
+ my $quantity = $cust_pkg->quantity || 1;
+
#option to not fallback? via options above
my $pkg_setup_fee =
$part_pkg->setup_cost || $part_pkg->option('setup_fee');
@@ -129,14 +131,18 @@ sub calc_recur {
if ( $pkg_start < $last_bill ) {
$pkg_start = $last_bill;
} elsif ( $pkg_setup_fee ) {
- $pkg_charge += $pkg_setup_fee;
- $pkg_details .= $money_char. sprintf('%.2f setup, ', $pkg_setup_fee );
+ $pkg_charge += $quantity * $pkg_setup_fee;
+ $pkg_details .= $money_char.
+ sprintf('%.2f setup', $quantity * $pkg_setup_fee );
+ $pkg_details .= sprintf(" ($quantity \@ $money_char". '%.2f)',
+ $pkg_setup_fee )
+ if $quantity > 1;
+ $pkg_details .= ', ';
}
my $pkg_end = $cust_pkg->get('cancel');
$pkg_end = ( !$pkg_end || $pkg_end > $$sdate ) ? $$sdate : $pkg_end;
-
my $pkg_recur_charge = $prorate_ratio * $pkg_base_recur;
$pkg_recur_charge *= ( $pkg_end - $pkg_start )
/ ( $$sdate - $last_bill )
@@ -144,12 +150,17 @@ sub calc_recur {
my $recur_charge += $pkg_recur_charge;
- $pkg_details .= $money_char. sprintf('%.2f', $recur_charge ).
- ' ('. time2str($date_format, $pkg_start).
- ' - '. time2str($date_format, $pkg_end ). ')'
- if $recur_charge;
+ if ( $recur_charge ) {
+ $pkg_details .= $money_char.
+ sprintf('%.2f', $quantity * $recur_charge );
+ $pkg_details .= sprintf(" ($quantity \@ $money_char". '%.2f)',
+ $recur_charge )
+ if $quantity > 1;
+ $pkg_details .= ' ('. time2str($date_format, $pkg_start).
+ ' - '. time2str($date_format, $pkg_end ). ')';
+ }
- $pkg_charge += $recur_charge;
+ $pkg_charge += $quantity * $recur_charge;
push @$details, $pkg_details
if $pkg_charge;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_pkg/agent.pm | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
More information about the freeside-commits
mailing list