time/data/etc. unit pricing add-ons, RT#24392
authorIvan Kohler <ivan@freeside.biz>
Thu, 9 Jan 2014 23:29:50 +0000 (15:29 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 9 Jan 2014 23:29:50 +0000 (15:29 -0800)
22 files changed:
FS/FS/cust_pkg.pm
FS/FS/cust_pkg_usageprice.pm
FS/FS/part_pkg.pm
FS/FS/part_pkg/agent.pm
FS/FS/part_pkg/bulk_Common.pm
FS/FS/part_pkg/cdr_termination.pm
FS/FS/part_pkg/currency_fixed.pm
FS/FS/part_pkg/flat.pm
FS/FS/part_pkg/prorate.pm
FS/FS/part_pkg/sql_external.pm
FS/FS/part_pkg/sql_generic.pm
FS/FS/part_pkg/sqlradacct_daily.pm
FS/FS/part_pkg/sqlradacct_hour.pm
FS/FS/part_pkg/torrus_Common.pm
FS/FS/part_pkg/voip_cdr.pm
FS/FS/part_pkg/voip_inbound.pm
FS/FS/part_pkg/voip_sqlradacct.pm
httemplate/misc/cancel_pkg.html
httemplate/misc/delay_susp_pkg.html
httemplate/search/cust_main.cgi
httemplate/view/cust_main/packages/package.html
httemplate/view/cust_main/packages/status.html

index f530947..fa09640 100644 (file)
@@ -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;
index 5380081..394ba0b 100644 (file)
@@ -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
 
index 3c4c127..8e65c50 100644 (file)
@@ -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 {
index 6ab21d6..4a87728 100644 (file)
@@ -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;
 
index 4e8850e..3477c44 100644 (file)
@@ -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;
 
index 54bce2c..9011846 100644 (file)
@@ -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;
index c64fb78..bbd95e8 100644 (file)
@@ -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;
index 6118fd2..7bc44e1 100644 (file)
@@ -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);
index a5f9ef6..a81bfda 100644 (file)
@@ -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) );
index 813e808..be36c11 100644 (file)
@@ -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;
 }
index e323d8b..0a875b0 100644 (file)
@@ -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;
 }
index 1a0bafe..ab1afd7 100644 (file)
@@ -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;
 }
index c9fdb36..e929735 100644 (file)
@@ -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;
 }
index d0dc9d1..b32deab 100644 (file)
@@ -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;
 }
index 1a99bd7..db0b9e7 100644 (file)
@@ -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;
 }
index ec95c90..1566c18 100644 (file)
@@ -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;
 }
index b856b5c..f58194f 100644 (file)
@@ -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;
 }
index f9a46a8..2003207 100755 (executable)
@@ -7,7 +7,7 @@
 <INPUT TYPE="hidden" NAME="method" VALUE="<% $method %>">
 
 <BR><BR>
-<% 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;
index e5f1d8c..02f8824 100755 (executable)
@@ -12,7 +12,9 @@
 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
 
 <BR><BR>
-<% "Delay automatic suspension of " .$part_pkg->pkg_comment %>
+<% "Delay automatic suspension of ".
+     $part_pkg->pkg_comment( cust_pkg=>$cust_pkg )
+%>
 <% ntable("#cccccc", 2) %>
 
 <TR>
index 69f04f5..ee1dd85 100755 (executable)
 %      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';
index 7a1e9a5..06eb50d 100644 (file)
@@ -11,7 +11,7 @@
         <A NAME="cust_pkg<% $cust_pkg->pkgnum %>"
            ID  ="cust_pkg<% $cust_pkg->pkgnum %>"
         ><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B></A>
-%       my $custom_comment = $part_pkg->custom_comment();
+%       my $custom_comment = $part_pkg->custom_comment('cust_pkg'=>$cust_pkg);
         <% $custom_comment ? ' - ' : '' %>
         <% $custom_comment |h %>
       </TD>
index 70b623c..3ebdf22 100644 (file)
@@ -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;