[freeside-commits] branch master updated. d62206a94d9d49ef96640e0a8ec492679f8345e9

Ivan ivan at 420.am
Tue Jul 2 20:02:46 PDT 2013


The branch, master has been updated
       via  d62206a94d9d49ef96640e0a8ec492679f8345e9 (commit)
       via  9b61510dcd5a7e30c0c1664df619bcff0aa50f08 (commit)
       via  050f1d1afbb08680769f1e643118e729dd90c4a8 (commit)
       via  a1183aad7a409d1212c7e3cdb4a9f02e93578d31 (commit)
       via  856db1a116ffe0e2d79d572c14abcac488e128bd (commit)
      from  601137d2d3d57841f50f4ab5393c2e521ada263a (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 d62206a94d9d49ef96640e0a8ec492679f8345e9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 2 20:02:45 2013 -0700

    fix discounts vs. quantities for prorate packages, RT#23530

diff --git a/FS/FS/part_pkg/cdr_termination.pm b/FS/FS/part_pkg/cdr_termination.pm
index 37fa47e..54bce2c 100644
--- a/FS/FS/part_pkg/cdr_termination.pm
+++ b/FS/FS/part_pkg/cdr_termination.pm
@@ -182,7 +182,7 @@ sub calc_recur {
     
   # eotermiation calculation
 
-  $charges += $self->calc_recur_Common(@_);
+  $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
 
   $charges;
 }
diff --git a/FS/FS/part_pkg/prorate.pm b/FS/FS/part_pkg/prorate.pm
index ac86f39..a5f9ef6 100644
--- a/FS/FS/part_pkg/prorate.pm
+++ b/FS/FS/part_pkg/prorate.pm
@@ -45,8 +45,12 @@ use FS::part_pkg::flat;
 sub calc_recur {
   my $self = shift;
   my $cust_pkg = $_[0];
-  $self->calc_prorate(@_, $self->cutoff_day($cust_pkg))
-    - $self->calc_discount(@_);
+
+  my $charge = $self->calc_prorate(@_, $self->cutoff_day($cust_pkg));
+  my $discount = $self->calc_discount(@_);
+
+  sprintf( '%.2f', ($cust_pkg->quantity || 1) * ($charge - $discount) );
+
 }
 
 sub cutoff_day {
diff --git a/FS/FS/part_pkg/prorate_Mixin.pm b/FS/FS/part_pkg/prorate_Mixin.pm
index 9efc7e8..e8d42b9 100644
--- a/FS/FS/part_pkg/prorate_Mixin.pm
+++ b/FS/FS/part_pkg/prorate_Mixin.pm
@@ -169,9 +169,6 @@ sub calc_prorate {
                                                   #so 1.005 rounds to 1.01
   $charge = sprintf('%.2f', $permonth * $months + 0.00000001 );
 
-  my $quantity = $cust_pkg->quantity || 1;
-  $charge *= $quantity;
-
   return sprintf('%.2f', $charge);
 }
 
diff --git a/FS/FS/part_pkg/sql_external.pm b/FS/FS/part_pkg/sql_external.pm
index 4bf9ecb..813e808 100644
--- a/FS/FS/part_pkg/sql_external.pm
+++ b/FS/FS/part_pkg/sql_external.pm
@@ -71,7 +71,7 @@ sub calc_recur {
   }
 
   $param->{'override_charges'} = $price;
-  $self->calc_recur_Common($cust_pkg,$sdate,$details,$param);
+  ($cust_pkg->quantity || 1) * $self->calc_recur_Common($cust_pkg,$sdate,$details,$param);
 }
 
 sub can_discount { 1; }
diff --git a/FS/FS/part_pkg/subscription.pm b/FS/FS/part_pkg/subscription.pm
index bf88f51..0dfe049 100644
--- a/FS/FS/part_pkg/subscription.pm
+++ b/FS/FS/part_pkg/subscription.pm
@@ -102,7 +102,7 @@ sub calc_recur {
 
   my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param);
 
-  sprintf('%.2f', $br - $discount);
+  sprintf('%.2f', ($cust_pkg->quantity || 1) * ($br - $discount) );
 }
 
 1;
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 21c6a8a..1a97186 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -31,6 +31,11 @@ tie my %rating_method, 'Tie::IxHash',
   'single_price' => 'A single price per minute for all calls.',
 ;
 
+tie my %rounding, 'Tie::IxHash',
+  '2' => 'Two decimal places (cent)',
+  '4' => 'Four decimal places (100th of a cent)',
+;
+
 #tie my %cdr_location, 'Tie::IxHash',
 #  'internal' => 'Internal: CDR records imported into the internal CDR table',
 #  'external' => 'External: CDR records queried directly from an external '.
@@ -92,6 +97,11 @@ tie my %detail_formats, 'Tie::IxHash',
                          'options' => \%rating_method,
                        },
 
+    'rounding' => { 'name' => 'Rounding for destination prefix rating',
+                    'type' => 'select',
+                    'select_options' => \%rounding,
+                  },
+
     'ratenum'   => { 'name' => 'Rate plan',
                      'type' => 'select',
                      'select_table' => 'rate',
@@ -304,7 +314,7 @@ tie my %detail_formats, 'Tie::IxHash',
                        FS::part_pkg::prorate_Mixin::fieldorder,
                     qw(
                        cdr_svc_method
-                       rating_method ratenum intrastate_ratenum 
+                       rating_method rounding ratenum intrastate_ratenum 
                        calls_included
                        min_charge min_included sec_granularity
                        ignore_unrateable
@@ -352,7 +362,7 @@ sub calc_recur {
   my $charges = 0;
 
   $charges += $self->calc_usage(@_);
-  $charges += $self->calc_recur_Common(@_);
+  $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
 
   $charges;
 
@@ -423,6 +433,11 @@ sub calc_usage {
       $svc_x = $cust_svc->svc_x;
     }
 
+    unless ( $svc_x ) {
+      my $h = $self->option('bill_inactive_svcs',1) ? 'h_' : '';
+      warn "WARNING: no $h$svc_table for svcnum ". $cust_svc->svcnum. "\n";
+    }
+
     my %options = (
         'disable_src'    => $self->option('disable_src'),
         'default_prefix' => $self->option('default_prefix'),
diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm
index 525db80..811329d 100644
--- a/FS/FS/part_pkg/voip_inbound.pm
+++ b/FS/FS/part_pkg/voip_inbound.pm
@@ -179,7 +179,7 @@ sub calc_recur {
   my $charges = 0;
 
   $charges += $self->calc_usage(@_);
-  $charges += $self->calc_recur_Common(@_);
+  $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
 
   $charges;
 

commit 9b61510dcd5a7e30c0c1664df619bcff0aa50f08
Merge: 050f1d1 601137d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 2 20:02:42 2013 -0700

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 050f1d1afbb08680769f1e643118e729dd90c4a8
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 2 20:02:32 2013 -0700

    fix discounts vs. quantities for prorate packages, RT#23530

diff --git a/FS/FS/part_pkg/currency_fixed.pm b/FS/FS/part_pkg/currency_fixed.pm
index ce71452..c64fb78 100644
--- a/FS/FS/part_pkg/currency_fixed.pm
+++ b/FS/FS/part_pkg/currency_fixed.pm
@@ -81,9 +81,12 @@ sub base_recur {
 sub can_discount { 0; } #can't discount yet (percentage would work, but amount?)
 sub calc_recur {
   my $self = shift;
+
   #my($cust_pkg, $sdate, $details, $param ) = @_;
-  #$self->calc_recur_Common($cust_pkg,$sdate,$details,$param);
-  $self->calc_recur_Common(@_);
+  my $cust_pkg = $_[0];
+
+  ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_); #($cust_pkg,$sdate,$details,$param);
+
 }
 
 sub is_free { 0; }

commit a1183aad7a409d1212c7e3cdb4a9f02e93578d31
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 2 19:52:06 2013 -0700

    rt time price plan doesn't pick up all RT time; better to not have it available at all than underbill

diff --git a/FS/FS/part_pkg/rt_time.pm b/FS/FS/part_pkg/incomplete/rt_time.pm
similarity index 96%
rename from FS/FS/part_pkg/rt_time.pm
rename to FS/FS/part_pkg/incomplete/rt_time.pm
index 11b7ee8..f96eba6 100644
--- a/FS/FS/part_pkg/rt_time.pm
+++ b/FS/FS/part_pkg/incomplete/rt_time.pm
@@ -44,7 +44,7 @@ sub calc_recur {
   my $charges = 0;
 
   $charges += $self->calc_usage(@_);
-  $charges += $self->calc_recur_Common(@_);
+  $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
 
   $charges;
 

commit 856db1a116ffe0e2d79d572c14abcac488e128bd
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 2 14:49:16 2013 -0700

    selfservice, TNG, RT#22193

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 42fe9ec..f76c72f 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2275,6 +2275,7 @@ and customer address. Include units.',
     'key'         => 'selfservice-timeout',
     'section'     => 'self-service',
     'description' => 'Timeout for the self-service login cookie, in seconds.  Defaults to 1 hour.',
+    'type'        => 'text',
   },
 
   {

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

Summary of changes:
 FS/FS/Conf.pm                              |    1 +
 FS/FS/part_pkg/cdr_termination.pm          |    2 +-
 FS/FS/part_pkg/currency_fixed.pm           |    7 +++++--
 FS/FS/part_pkg/{ => incomplete}/rt_time.pm |    2 +-
 FS/FS/part_pkg/prorate.pm                  |    8 ++++++--
 FS/FS/part_pkg/prorate_Mixin.pm            |    3 ---
 FS/FS/part_pkg/sql_external.pm             |    2 +-
 FS/FS/part_pkg/subscription.pm             |    2 +-
 FS/FS/part_pkg/voip_cdr.pm                 |   19 +++++++++++++++++--
 FS/FS/part_pkg/voip_inbound.pm             |    2 +-
 10 files changed, 34 insertions(+), 14 deletions(-)
 rename FS/FS/part_pkg/{ => incomplete}/rt_time.pm (96%)




More information about the freeside-commits mailing list