projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9b61510
)
fix discounts vs. quantities for prorate packages, RT#23530
author
Ivan Kohler
<ivan@freeside.biz>
Wed, 3 Jul 2013 03:02:45 +0000
(20:02 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Wed, 3 Jul 2013 03:02:45 +0000
(20:02 -0700)
FS/FS/part_pkg/cdr_termination.pm
patch
|
blob
|
history
FS/FS/part_pkg/prorate.pm
patch
|
blob
|
history
FS/FS/part_pkg/prorate_Mixin.pm
patch
|
blob
|
history
FS/FS/part_pkg/sql_external.pm
patch
|
blob
|
history
FS/FS/part_pkg/subscription.pm
patch
|
blob
|
history
FS/FS/part_pkg/voip_cdr.pm
patch
|
blob
|
history
FS/FS/part_pkg/voip_inbound.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_pkg/cdr_termination.pm
b/FS/FS/part_pkg/cdr_termination.pm
index
37fa47e
..
54bce2c
100644
(file)
--- 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
# eotermiation calculation
- $charges += $self->calc_recur_Common(@_);
+ $charges +=
($cust_pkg->quantity || 1) *
$self->calc_recur_Common(@_);
$charges;
}
$charges;
}
diff --git
a/FS/FS/part_pkg/prorate.pm
b/FS/FS/part_pkg/prorate.pm
index
ac86f39
..
a5f9ef6
100644
(file)
--- 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];
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 {
}
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
(file)
--- 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 );
#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);
}
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
(file)
--- 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;
}
$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; }
}
sub can_discount { 1; }
diff --git
a/FS/FS/part_pkg/subscription.pm
b/FS/FS/part_pkg/subscription.pm
index
bf88f51
..
0dfe049
100644
(file)
--- 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);
my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param);
- sprintf('%.2f',
$br - $discount
);
+ sprintf('%.2f',
($cust_pkg->quantity || 1) * ($br - $discount)
);
}
1;
}
1;
diff --git
a/FS/FS/part_pkg/voip_cdr.pm
b/FS/FS/part_pkg/voip_cdr.pm
index
21c6a8a
..
1a97186
100644
(file)
--- 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.',
;
'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 '.
#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,
},
'options' => \%rating_method,
},
+ 'rounding' => { 'name' => 'Rounding for destination prefix rating',
+ 'type' => 'select',
+ 'select_options' => \%rounding,
+ },
+
'ratenum' => { 'name' => 'Rate plan',
'type' => 'select',
'select_table' => 'rate',
'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
FS::part_pkg::prorate_Mixin::fieldorder,
qw(
cdr_svc_method
- rating_method ratenum intrastate_ratenum
+ rating_method r
ounding r
atenum intrastate_ratenum
calls_included
min_charge min_included sec_granularity
ignore_unrateable
calls_included
min_charge min_included sec_granularity
ignore_unrateable
@@
-352,7
+362,7
@@
sub calc_recur {
my $charges = 0;
$charges += $self->calc_usage(@_);
my $charges = 0;
$charges += $self->calc_usage(@_);
- $charges += $self->calc_recur_Common(@_);
+ $charges +=
($cust_pkg->quantity || 1) *
$self->calc_recur_Common(@_);
$charges;
$charges;
@@
-423,6
+433,11
@@
sub calc_usage {
$svc_x = $cust_svc->svc_x;
}
$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'),
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
(file)
--- 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(@_);
my $charges = 0;
$charges += $self->calc_usage(@_);
- $charges += $self->calc_recur_Common(@_);
+ $charges +=
($cust_pkg->quantity || 1) *
$self->calc_recur_Common(@_);
$charges;
$charges;