From 87a59b1bdf236765177c27ab18390ef1317cc34c Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 9 Jan 2014 15:29:50 -0800 Subject: [PATCH] time/data/etc. unit pricing add-ons, RT#24392 --- FS/FS/cust_pkg.pm | 157 +++++------------------- FS/FS/cust_pkg_usageprice.pm | 73 ++++++++++- FS/FS/part_pkg.pm | 8 +- FS/FS/part_pkg/agent.pm | 19 ++- FS/FS/part_pkg/bulk_Common.pm | 6 +- FS/FS/part_pkg/cdr_termination.pm | 8 +- FS/FS/part_pkg/currency_fixed.pm | 4 +- FS/FS/part_pkg/flat.pm | 24 +++- FS/FS/part_pkg/prorate.pm | 11 +- FS/FS/part_pkg/sql_external.pm | 2 +- FS/FS/part_pkg/sql_generic.pm | 2 +- FS/FS/part_pkg/sqlradacct_daily.pm | 2 +- FS/FS/part_pkg/sqlradacct_hour.pm | 2 +- FS/FS/part_pkg/torrus_Common.pm | 2 +- FS/FS/part_pkg/voip_cdr.pm | 2 +- FS/FS/part_pkg/voip_inbound.pm | 2 +- FS/FS/part_pkg/voip_sqlradacct.pm | 2 +- httemplate/misc/cancel_pkg.html | 2 +- httemplate/misc/delay_susp_pkg.html | 4 +- httemplate/search/cust_main.cgi | 2 +- httemplate/view/cust_main/packages/package.html | 2 +- httemplate/view/cust_main/packages/status.html | 18 +-- 22 files changed, 178 insertions(+), 176 deletions(-) diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index f53094714..fa09640c5 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 5380081b5..394ba0ba9 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 +L, L, L =cut diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 3c4c127a4..8e65c50b9 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 6ab21d64f..4a8772828 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 4e8850ee5..3477c444c 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 54bce2c1d..9011846b7 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 c64fb7872..bbd95e872 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 6118fd2ed..7bc44e176 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 a5f9ef6b6..a81bfda9d 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 813e8085c..be36c11ee 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 e323d8b5b..0a875b045 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 1a0bafe15..ab1afd75c 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 c9fdb36f4..e929735d3 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 d0dc9d14d..b32deab04 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 1a99bd7e1..db0b9e7f6 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 ec95c9040..1566c18fe 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 b856b5cda..f58194ffe 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; } diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index f9a46a898..20032072d 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -7,7 +7,7 @@

-<% emt(ucfirst($method)." [_1]", $part_pkg->pkg_comment) %> +<% emt(ucfirst($method)." [_1]", $part_pkg->pkg_comment(cust_pkg=>$cust_pkg) %> <% ntable("#cccccc", 2) %> % my $date_init = 0; diff --git a/httemplate/misc/delay_susp_pkg.html b/httemplate/misc/delay_susp_pkg.html index e5f1d8cb3..02f8824b4 100755 --- a/httemplate/misc/delay_susp_pkg.html +++ b/httemplate/misc/delay_susp_pkg.html @@ -12,7 +12,9 @@

-<% "Delay automatic suspension of " .$part_pkg->pkg_comment %> +<% "Delay automatic suspension of ". + $part_pkg->pkg_comment( cust_pkg=>$cust_pkg ) +%> <% ntable("#cccccc", 2) %> diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 69f04f5e1..ee1dd8597 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -233,7 +233,7 @@ % my $pkgnum = $_->pkgnum; % my $part_pkg = $_->part_pkg; % -% my $pkg_comment = $part_pkg->pkg_comment(nopkgpart => 1); +% my $pkg_comment = $part_pkg->pkg_comment( cust_pkg=>$_, nopkgpart=>1 ); % my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ % ? '' % : ';show=packages'; diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index 7a1e9a55e..06eb50d34 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -11,7 +11,7 @@ <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><% $part_pkg->pkg |h %> -% my $custom_comment = $part_pkg->custom_comment(); +% my $custom_comment = $part_pkg->custom_comment('cust_pkg'=>$cust_pkg); <% $custom_comment ? ' - ' : '' %> <% $custom_comment |h %> diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index 70b623c0f..3ebdf22dc 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -416,14 +416,16 @@ sub pkg_status_row_changed { my $old = $cust_pkg->old_cust_pkg; if ( $old ) { my $part_pkg = $old->part_pkg; - $html .= pkg_status_row_colspan( $cust_pkg, - emt("Changed from [_1]: [_2]", - $cust_pkg->change_pkgnum, - $part_pkg->pkg_comment(nopartpkg => 1) ), - '', - 'size' => '-1', - 'align' => 'right', - ); + $html .= pkg_status_row_colspan( + $cust_pkg, + emt("Changed from [_1]: [_2]", + $cust_pkg->change_pkgnum, + $part_pkg->pkg_comment(cust_pkg=>$old, nopartpkg=>1) + ), + '', + 'size' => '-1', + 'align' => 'right', + ); } $html; -- 2.11.0