summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-09 15:29:50 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-09 15:29:50 -0800
commit87a59b1bdf236765177c27ab18390ef1317cc34c (patch)
tree00ea14723ad672b5aedeb2a9f11a1f840ef3f619 /FS/FS
parent8a7eec7b683294a15aab0b2bf1710e10fa80b4c5 (diff)
time/data/etc. unit pricing add-ons, RT#24392
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/cust_pkg.pm157
-rw-r--r--FS/FS/cust_pkg_usageprice.pm73
-rw-r--r--FS/FS/part_pkg.pm8
-rw-r--r--FS/FS/part_pkg/agent.pm19
-rw-r--r--FS/FS/part_pkg/bulk_Common.pm6
-rw-r--r--FS/FS/part_pkg/cdr_termination.pm8
-rw-r--r--FS/FS/part_pkg/currency_fixed.pm4
-rw-r--r--FS/FS/part_pkg/flat.pm24
-rw-r--r--FS/FS/part_pkg/prorate.pm11
-rw-r--r--FS/FS/part_pkg/sql_external.pm2
-rw-r--r--FS/FS/part_pkg/sql_generic.pm2
-rw-r--r--FS/FS/part_pkg/sqlradacct_daily.pm2
-rw-r--r--FS/FS/part_pkg/sqlradacct_hour.pm2
-rw-r--r--FS/FS/part_pkg/torrus_Common.pm2
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm2
-rw-r--r--FS/FS/part_pkg/voip_inbound.pm2
-rw-r--r--FS/FS/part_pkg/voip_sqlradacct.pm2
17 files changed, 162 insertions, 164 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index f530947..fa09640 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -336,13 +336,6 @@ sub insert {
# set order date unless it was specified as part of an import
$self->order_date(time) unless $import && $self->order_date;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -444,13 +437,6 @@ hide cancelled packages.
sub delete {
my $self = shift;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -561,13 +547,6 @@ sub replace {
local($disable_agentcheck) = 1 if $old->pkgpart == $new->pkgpart;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -801,13 +780,6 @@ sub cancel {
join(', ', map { "$_: $options{$_}" } keys %options ). "\n"
if $DEBUG;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -1004,13 +976,6 @@ sub uncancel {
# Transaction-alize
##
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -1165,13 +1130,6 @@ sub unexpire {
my( $self, %options ) = @_;
my $error;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -1248,13 +1206,6 @@ sub suspend {
return $self->main_pkg->suspend(%options);
}
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -1491,13 +1442,6 @@ sub unsuspend {
return $self->main_pkg->unsuspend(%opt);
}
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -1674,13 +1618,6 @@ sub unadjourn {
my( $self, %options ) = @_;
my $error;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -1798,13 +1735,6 @@ sub change {
my $conf = new FS::Conf;
# Transactionize this whole mess
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -2431,13 +2361,6 @@ sub process_bulk_cust_pkg {
#my $keep_dates = $param->{'keep_dates'} || 0;
my $keep_dates = 1; # there is no good reason to turn this off
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -2674,13 +2597,6 @@ If there is an error, returns the error, otherwise returns false.
sub set_cust_pkg_detail {
my( $self, $detailtype, @details ) = @_;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -3168,7 +3084,7 @@ Returns a label for this package. (Currently "pkgnum: pkg - comment" or
sub pkg_label {
my $self = shift;
- my $label = $self->part_pkg->pkg_comment( 'nopkgpart' => 1 );
+ my $label = $self->part_pkg->pkg_comment( cust_pkg=>$self, nopkgpart=>1 );
$label = $self->pkgnum. ": $label"
if $FS::CurrentUser::CurrentUser->option('show_pkgnum');
$label;
@@ -3634,13 +3550,6 @@ sub grab_svcnums {
my $self = shift;
my @svcnum = @_;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -3675,13 +3584,6 @@ order_pkgs methods in FS::cust_main for a better way to defer provisioning.
sub reexport {
my $self = shift;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -3712,13 +3614,6 @@ Calls the "pkg_change" export action for all services attached to this package.
sub export_pkg_change {
my( $self, $old ) = ( shift, shift );
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -3890,6 +3785,34 @@ sub recharge {
}
}
+=item apply_usageprice
+
+=cut
+
+sub apply_usageprice {
+ my $self = shift;
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
+ my $error = '';
+
+ foreach my $cust_pkg_usageprice ( $self->cust_pkg_usageprice ) {
+ $error ||= $cust_pkg_usageprice->apply;
+ }
+
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ die "error applying part_pkg_usageprice add-ons, pkgnum ". $self->pkgnum.
+ ": $error\n";
+ } else {
+ $dbh->commit if $oldAutoCommit;
+ }
+
+
+}
+
=item cust_pkg_discount
=item cust_pkg_discount_active
@@ -3930,16 +3853,10 @@ sub apply_usage {
my $pkgnum = $self->pkgnum;
my $custnum = $self->custnum;
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
+
my $order = FS::Conf->new->config('cdr-minutes_priority');
my $is_classnum;
@@ -4921,13 +4838,6 @@ sub order {
my $conf = new FS::Conf;
# Transactionize this whole mess
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
@@ -5067,13 +4977,6 @@ sub bulk_change {
my ($pkgparts, $remove_pkgnum, $return_cust_pkg) = @_;
# Transactionize this whole mess
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
diff --git a/FS/FS/cust_pkg_usageprice.pm b/FS/FS/cust_pkg_usageprice.pm
index 5380081..394ba0b 100644
--- a/FS/FS/cust_pkg_usageprice.pm
+++ b/FS/FS/cust_pkg_usageprice.pm
@@ -103,13 +103,84 @@ sub check {
$self->SUPER::check;
}
+=item price
+
+Returns the price for this customer usage pricing add-on (quantity of this
+record multiplied by price of the associated FS::part_pkg_usageprice record)
+
+=cut
+
+sub price {
+ my $self = shift;
+ sprintf('%.2f', $self->quantity * $self->part_pkg_usageprice->price);
+}
+
+=item apply
+
+Applies this customer usage pricing add-on. (Mulitplies quantity of this record
+by part_pkg_usageprice.amount, and applies to to any services of this package
+matching part_pkg_usageprice.target)
+
+If there is an error, returns the error, otherwise returns false.
+
+=cut
+
+sub apply {
+ my $self = shift;
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
+ my $error = '';
+
+ my $part_pkg_usageprice = $self->part_pkg_usageprice;
+
+ my $amount = $self->quantity * $part_pkg_usageprice->amount;
+
+ my $target = $part_pkg_usageprice->target;
+
+ #these are ongoing counters that count down, so increment them
+ if ( $target =~ /^svc_acct.(\w+)$/ ) {
+
+ my $method = "increment_$1";
+
+ foreach my $cust_svc ( $self->cust_pkg->cust_svc(svcdb=>'svc_acct') ) {
+ $error ||= $cust_svc->svc_x->$method( $amount );
+ }
+
+ #this is a maximum number, not a counter, so we want to take our number
+ # and add it to the default for the service
+ } elsif ( $target eq 'svc_conferencing.participants' ) {
+
+ foreach my $cust_svc ($self->cust_pkg->cust_svc(svcdb=>'svc_conferencing')){
+ my $svc_conferencing = $cust_svc->svc_x;
+ my $base_amount = $cust_svc->part_svc->part_svc_column('participants')->columnvalue || 0; #assuming.. D? F would get overridden :/
+ $svc_acct->participants( $base_amount + $amount );
+ $error ||= $svc_acct->replace;
+ }
+
+ #this has no multiplication involved, its just a set only
+ #} elsif ( $target eq 'svc_conferencing.confqualitynum' ) {
+
+ }
+
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ } else {
+ $dbh->commit if $oldAutoCommit;
+ }
+ return $error;
+
+}
+
=back
=head1 BUGS
=head1 SEE ALSO
-L<FS::Record>
+L<FS::part_pkg_usageprice>, L<FS::cust_pkg>, L<FS::Record>
=cut
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 3c4c127..8e65c50 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -837,8 +837,8 @@ sub custom_comment {
my $price_info = $self->price_info(@_);
( $self->custom ? '(CUSTOM) ' : '' ).
$self->comment.
- ( ( ($self->custom || $self->comment) && $price_info ) ? ' - ' : '' ).
- $price_info;
+ ( ($self->custom || $self->comment) ? ' - ' : '' ).
+ ($price_info || 'No charge');
}
=item pkg_class
@@ -1068,6 +1068,10 @@ sub can_discount { 0; }
# whether the plan allows changing the start date
sub can_start_date { 1; }
+
+# whether the plan supports part_pkg_usageprice add-ons (a specific kind of
+# pre-selectable usage pricing, there's others this doesn't refer to)
+sub can_usageprice { 0; }
# the delay start date if present
sub delay_start_date {
diff --git a/FS/FS/part_pkg/agent.pm b/FS/FS/part_pkg/agent.pm
index 6ab21d6..4a87728 100644
--- a/FS/FS/part_pkg/agent.pm
+++ b/FS/FS/part_pkg/agent.pm
@@ -1,17 +1,14 @@
package FS::part_pkg::agent;
+#use base qw(FS::part_pkg::recur_Common);
+use base qw(FS::part_pkg::prorate);
use strict;
-use vars qw(@ISA $DEBUG $me %info);
+use vars qw($DEBUG $me %info);
use Date::Format;
use FS::Record qw( qsearch );
use FS::agent;
use FS::cust_main;
-#use FS::part_pkg::recur_Common;;
-#@ISA = qw(FS::part_pkg::recur_Common);
-use FS::part_pkg::prorate;
-@ISA = qw(FS::part_pkg::prorate);
-
$DEBUG = 0;
$me = '[FS::part_pkg::agent]';
@@ -160,13 +157,11 @@ sub calc_recur {
sub can_discount { 0; }
-sub hide_svc_detail {
- 1;
-}
+sub hide_svc_detail { 1; }
-sub is_free {
- 0;
-}
+sub is_free { 0; }
+
+sub can_usageprice { 0; }
1;
diff --git a/FS/FS/part_pkg/bulk_Common.pm b/FS/FS/part_pkg/bulk_Common.pm
index 4e8850e..3477c44 100644
--- a/FS/FS/part_pkg/bulk_Common.pm
+++ b/FS/FS/part_pkg/bulk_Common.pm
@@ -31,12 +31,12 @@ $me = '[FS::part_pkg::bulk_Common]';
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
my $svc_setup_fee = $self->option('svc_setup_fee');
my $svc_recur_fee = $self->option('svc_recur_fee');
my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
- $str .= " , bulk" if $str;
+ $str .= ", bulk " if $str;
$str .= ": $money_char" . $svc_setup_fee . " one-time per service"
if $svc_setup_fee;
$str .= ", " if ($svc_setup_fee && $svc_recur_fee);
@@ -120,5 +120,7 @@ sub is_free_options {
qw( setup_fee recur_fee svc_setup_fee svc_recur_fee );
}
+sub can_usageprice { 0; }
+
1;
diff --git a/FS/FS/part_pkg/cdr_termination.pm b/FS/FS/part_pkg/cdr_termination.pm
index 54bce2c..9011846 100644
--- a/FS/FS/part_pkg/cdr_termination.pm
+++ b/FS/FS/part_pkg/cdr_termination.pm
@@ -1,7 +1,7 @@
package FS::part_pkg::cdr_termination;
+use base qw( FS::part_pkg::recur_Common );
use strict;
-use base qw( FS::part_pkg::recur_Common );
use vars qw( $DEBUG %info );
use Tie::IxHash;
use FS::Record qw( qsearch ); #qsearchs );
@@ -187,8 +187,8 @@ sub calc_recur {
$charges;
}
-sub is_free {
- 0;
-}
+sub is_free { 0; }
+
+sub can_usageprice { 0; }
1;
diff --git a/FS/FS/part_pkg/currency_fixed.pm b/FS/FS/part_pkg/currency_fixed.pm
index c64fb78..bbd95e8 100644
--- a/FS/FS/part_pkg/currency_fixed.pm
+++ b/FS/FS/part_pkg/currency_fixed.pm
@@ -33,7 +33,7 @@ use FS::currency_exchange;
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " (or local currency pricing)" if $str;
$str;
}
@@ -93,4 +93,6 @@ sub is_free { 0; }
sub can_currency_exchange { 1; }
+sub can_usageprice { 0; }
+
1;
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index 6118fd2..7bc44e1 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -98,12 +98,16 @@ tie my %contract_years, 'Tie::IxHash', (
sub price_info {
my $self = shift;
+ my %opt = @_;
my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
- my $setup = $self->option('setup_fee') || 0;
- my $recur = $self->option('recur_fee', 1) || 0;
+ my $setup = $opt{cust_pkg} ? $self->base_setup( $opt{cust_pkg} )
+ : ($self->option('setup_fee') || 0);
+ my $recur = $opt{cust_pkg} ? $self->base_recur( $opt{cust_pkg} )
+ : ($self->option('recur_fee', 1) || 0);
+ $recur += $self->usageprice_recur( $opt{cust_pkg} ) if $opt{cust_pkg};
my $str = '';
- $str = $money_char . $setup . ($recur ? ' setup ' : ' one-time') if $setup;
+ $str = $money_char . $setup . ($recur ? ' setup' : ' one-time') if $setup;
$str .= ', ' if ($setup && $recur);
$str .= $money_char. $recur. '/'. $self->freq_pretty if $recur;
$str;
@@ -160,6 +164,9 @@ sub calc_recur {
$charge *= $param->{freq_override} if $param->{freq_override};
}
+ $charge += $self->usageprice_recur($cust_pkg, $sdate);
+ $cust_pkg->apply_usageprice(); #$sdate for prorating?
+
my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param);
sprintf( '%.2f', ($cust_pkg->quantity || 1) * ($charge - $discount) );
@@ -190,6 +197,15 @@ sub base_recur_permonth {
sprintf('%.2f', $self->base_recur($cust_pkg) / $self->freq );
}
+sub usageprice_recur {
+ my($self, $cust_pkg, $sdate) = @_;
+
+ my $recur = 0;
+ $recur += $_->price foreach $cust_pkg->cust_pkg_usageprice;
+
+ sprintf('%.2f', $recur);
+}
+
sub calc_cancel {
my $self = shift;
my $conf = new FS::Conf;
@@ -257,6 +273,8 @@ sub can_start_date { ! shift->option('start_1st', 1) }
sub can_discount { 1; }
+sub can_usageprice { 1; }
+
sub recur_temporality {
my $self = shift;
$self->option('recur_temporality', 1);
diff --git a/FS/FS/part_pkg/prorate.pm b/FS/FS/part_pkg/prorate.pm
index a5f9ef6..a81bfda 100644
--- a/FS/FS/part_pkg/prorate.pm
+++ b/FS/FS/part_pkg/prorate.pm
@@ -1,12 +1,10 @@
package FS::part_pkg::prorate;
+use base qw( FS::part_pkg::flat );
use strict;
-use vars qw(@ISA %info);
+use vars qw(%info);
use Time::Local qw(timelocal);
#use FS::Record qw(qsearch qsearchs);
-use FS::part_pkg::flat;
-
-@ISA = qw(FS::part_pkg::flat);
%info = (
'name' => 'First partial month pro-rated, then flat-rate (selectable billing day)',
@@ -44,9 +42,14 @@ use FS::part_pkg::flat;
sub calc_recur {
my $self = shift;
+ #my($cust_pkg, $sdate, $details, $param ) = @_;
my $cust_pkg = $_[0];
my $charge = $self->calc_prorate(@_, $self->cutoff_day($cust_pkg));
+
+ $charge += $self->usageprice_recur(@_);
+ $cust_pkg->apply_usageprice(); #$sdate for prorating?
+
my $discount = $self->calc_discount(@_);
sprintf( '%.2f', ($cust_pkg->quantity || 1) * ($charge - $discount) );
diff --git a/FS/FS/part_pkg/sql_external.pm b/FS/FS/part_pkg/sql_external.pm
index 813e808..be36c11 100644
--- a/FS/FS/part_pkg/sql_external.pm
+++ b/FS/FS/part_pkg/sql_external.pm
@@ -44,7 +44,7 @@ use DBI;
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus per-service charges" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/sql_generic.pm b/FS/FS/part_pkg/sql_generic.pm
index e323d8b..0a875b0 100644
--- a/FS/FS/part_pkg/sql_generic.pm
+++ b/FS/FS/part_pkg/sql_generic.pm
@@ -42,7 +42,7 @@ use FS::part_pkg::flat;
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus per-service charges" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/sqlradacct_daily.pm b/FS/FS/part_pkg/sqlradacct_daily.pm
index 1a0bafe..ab1afd7 100644
--- a/FS/FS/part_pkg/sqlradacct_daily.pm
+++ b/FS/FS/part_pkg/sqlradacct_daily.pm
@@ -78,7 +78,7 @@ use Date::Format;
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus usage" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/sqlradacct_hour.pm b/FS/FS/part_pkg/sqlradacct_hour.pm
index c9fdb36..e929735 100644
--- a/FS/FS/part_pkg/sqlradacct_hour.pm
+++ b/FS/FS/part_pkg/sqlradacct_hour.pm
@@ -73,7 +73,7 @@ use FS::part_pkg::flat;
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus usage" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/torrus_Common.pm b/FS/FS/part_pkg/torrus_Common.pm
index d0dc9d1..b32deab 100644
--- a/FS/FS/part_pkg/torrus_Common.pm
+++ b/FS/FS/part_pkg/torrus_Common.pm
@@ -11,7 +11,7 @@ sub recur_temporality { 'preceding'; }
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus usage" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 1a99bd7..db0b9e7 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -361,7 +361,7 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus usage" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm
index ec95c90..1566c18 100644
--- a/FS/FS/part_pkg/voip_inbound.pm
+++ b/FS/FS/part_pkg/voip_inbound.pm
@@ -167,7 +167,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus usage" if $str;
$str;
}
diff --git a/FS/FS/part_pkg/voip_sqlradacct.pm b/FS/FS/part_pkg/voip_sqlradacct.pm
index b856b5c..f58194f 100644
--- a/FS/FS/part_pkg/voip_sqlradacct.pm
+++ b/FS/FS/part_pkg/voip_sqlradacct.pm
@@ -31,7 +31,7 @@ $DEBUG = 1;
sub price_info {
my $self = shift;
- my $str = $self->SUPER::price_info;
+ my $str = $self->SUPER::price_info(@_);
$str .= " plus usage" if $str;
$str;
}