[freeside-commits] branch master updated. 4c4f4f3e38bb48e491ff7141b2a2e337f69386ae

Ivan ivan at 420.am
Tue Jun 11 23:09:38 PDT 2013


The branch, master has been updated
       via  4c4f4f3e38bb48e491ff7141b2a2e337f69386ae (commit)
      from  597b7036c67ddf08fe367f9212ff06dd94cf76f5 (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 4c4f4f3e38bb48e491ff7141b2a2e337f69386ae
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jun 11 23:07:05 2013 -0700

    fix discounts w/quantities, RT#23530

diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index 9737a94..6118fd2 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -120,9 +120,7 @@ sub calc_setup {
     push @$details, $self->option( 'additional_info' . $i++ );
   }
 
-  my $quantity = $cust_pkg->quantity || 1;
-
-  my $charge = $quantity * $self->base_setup($cust_pkg, $sdate, $details);
+  my $charge = $self->base_setup($cust_pkg, $sdate, $details);
 
   my $discount = 0;
   if ( $charge > 0 ) {
@@ -131,7 +129,7 @@ sub calc_setup {
       delete $param->{'setup_charge'};
   }
 
-  sprintf('%.2f', $charge - $discount);
+  sprintf( '%.2f', ($cust_pkg->quantity || 1) * ($charge - $discount) );
 }
 
 sub base_setup {
@@ -162,11 +160,9 @@ sub calc_recur {
     $charge *= $param->{freq_override} if $param->{freq_override};
   }
 
-  my $quantity = $cust_pkg->quantity || 1;
-  $charge *= $quantity;
-
   my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param);
-  return sprintf('%.2f', $charge - $discount);
+
+  sprintf( '%.2f', ($cust_pkg->quantity || 1) * ($charge - $discount) );
 }
 
 sub cutoff_day {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/flat.pm |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list