From 2a54fd15d357ce97c8becef00d19ed1f711c1c6a Mon Sep 17 00:00:00 2001 From: levinse Date: Sat, 12 Feb 2011 04:56:28 +0000 Subject: [PATCH] show package pricing details on customer view, RT11372 --- FS/FS/part_pkg.pm | 2 +- FS/FS/part_pkg/base_rate.pm | 14 ++++++++++++++ FS/FS/part_pkg/bulk.pm | 17 +++++++++++++++++ FS/FS/part_pkg/flat.pm | 13 +++++++++++++ FS/FS/part_pkg/flat_comission.pm | 8 ++++++++ FS/FS/part_pkg/rt_time.pm | 8 ++++++++ FS/FS/part_pkg/sesmon_hour.pm | 7 +++++++ FS/FS/part_pkg/sesmon_minute.pm | 6 ++++++ FS/FS/part_pkg/sql_external.pm | 7 +++++++ FS/FS/part_pkg/sql_generic.pm | 7 +++++++ FS/FS/part_pkg/sqlradacct_hour.pm | 7 +++++++ FS/FS/part_pkg/voip_cdr.pm | 7 +++++++ FS/FS/part_pkg/voip_inbound.pm | 7 +++++++ FS/FS/part_pkg/voip_sqlradacct.pm | 7 +++++++ 14 files changed, 116 insertions(+), 1 deletion(-) diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 7cccab0b3..140bd9b14 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -539,7 +539,7 @@ sub pkg_comment { sub custom_comment { my $self = shift; - ( $self->custom ? '(CUSTOM) ' : '' ). $self->comment; + ( $self->custom ? '(CUSTOM) ' : '' ). $self->comment . ' ' . $self->price_info; } =item pkg_class diff --git a/FS/FS/part_pkg/base_rate.pm b/FS/FS/part_pkg/base_rate.pm index 678197799..43a050610 100644 --- a/FS/FS/part_pkg/base_rate.pm +++ b/FS/FS/part_pkg/base_rate.pm @@ -22,6 +22,20 @@ use FS::part_pkg; 'weight' => 52, ); +sub price_info { + my $self = shift; + 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 $str = ''; + $str = $money_char . $setup . ' one-time' if $setup; + $str .= ', ' if ($setup && $recur); + $str .= $money_char . $recur . ' recurring per unit ' if $recur; + $str; +} + + sub calc_setup { my($self, $cust_pkg, $sdate, $details ) = @_; diff --git a/FS/FS/part_pkg/bulk.pm b/FS/FS/part_pkg/bulk.pm index beee06913..4ac73892c 100644 --- a/FS/FS/part_pkg/bulk.pm +++ b/FS/FS/part_pkg/bulk.pm @@ -4,6 +4,7 @@ use strict; use vars qw(@ISA $DEBUG $me %info); use Date::Format; use FS::part_pkg::flat; +use FS::Conf; @ISA = qw(FS::part_pkg::flat); @@ -34,6 +35,22 @@ $me = '[FS::part_pkg::bulk]'; 'weight' => 50, ); +sub price_info { + my $self = shift; + 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 .= ": $money_char" . $svc_setup_fee . " one-time per service" + if $svc_setup_fee; + $str .= ", " if ($svc_setup_fee && $svc_recur_fee); + $str .= $money_char . $svc_recur_fee . " recurring per service" + if $svc_recur_fee; + $str; +} + #some false laziness-ish w/agent.pm... not a lot sub calc_recur { my($self, $cust_pkg, $sdate, $details ) = @_; diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index ffeb8ae5a..0c54b3562 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -77,6 +77,19 @@ tie my %contract_years, 'Tie::IxHash', ( 'weight' => 10, ); +sub price_info { + my $self = shift; + 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 $str = ''; + $str = $money_char . $setup . ' one-time' if $setup; + $str .= ', ' if ($setup && $recur); + $str .= $money_char . $recur . ' recurring ' if $recur; + $str; +} + sub calc_setup { my($self, $cust_pkg, $sdate, $details ) = @_; diff --git a/FS/FS/part_pkg/flat_comission.pm b/FS/FS/part_pkg/flat_comission.pm index ec8c8ebbc..0bc1e7cb4 100644 --- a/FS/FS/part_pkg/flat_comission.pm +++ b/FS/FS/part_pkg/flat_comission.pm @@ -32,6 +32,14 @@ use FS::part_pkg::flat; 'weight' => 62, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + my $com = $self->option('comission_amount'); + $str .= ", $com commission" if $com; + $str; +} + sub calc_recur { my($self, $cust_pkg ) = @_; diff --git a/FS/FS/part_pkg/rt_time.pm b/FS/FS/part_pkg/rt_time.pm index 03ed1cde7..37891e245 100644 --- a/FS/FS/part_pkg/rt_time.pm +++ b/FS/FS/part_pkg/rt_time.pm @@ -24,6 +24,14 @@ our %info = ( 'fieldorder' => [ 'base_rate' ], ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + my $rate = $self->option('base_rate'); + $str .= " plus $rate/min" if $rate; + $str; +} + sub calc_setup { my($self, $cust_pkg ) = @_; $self->option('setup_fee'); diff --git a/FS/FS/part_pkg/sesmon_hour.pm b/FS/FS/part_pkg/sesmon_hour.pm index a57b1591a..8d019c306 100644 --- a/FS/FS/part_pkg/sesmon_hour.pm +++ b/FS/FS/part_pkg/sesmon_hour.pm @@ -26,6 +26,13 @@ use FS::part_pkg::flat; 'weight' => 80, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} + sub calc_recur { my($self, $cust_pkg ) = @_; diff --git a/FS/FS/part_pkg/sesmon_minute.pm b/FS/FS/part_pkg/sesmon_minute.pm index 8c9ef03cf..b86cffd76 100644 --- a/FS/FS/part_pkg/sesmon_minute.pm +++ b/FS/FS/part_pkg/sesmon_minute.pm @@ -26,6 +26,12 @@ use FS::part_pkg::flat; 'weight' => 80, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} sub calc_recur { my( $self, $cust_pkg ) = @); diff --git a/FS/FS/part_pkg/sql_external.pm b/FS/FS/part_pkg/sql_external.pm index 718548771..c0c57251b 100644 --- a/FS/FS/part_pkg/sql_external.pm +++ b/FS/FS/part_pkg/sql_external.pm @@ -45,6 +45,13 @@ use DBI; 'weight' => '58', ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus per-service charges" if $str; + $str; +} + sub calc_recur { my $self = shift; my($cust_pkg, $sdate, $details, $param ) = @_; diff --git a/FS/FS/part_pkg/sql_generic.pm b/FS/FS/part_pkg/sql_generic.pm index cf38257fa..e323d8b5b 100644 --- a/FS/FS/part_pkg/sql_generic.pm +++ b/FS/FS/part_pkg/sql_generic.pm @@ -40,6 +40,13 @@ use FS::part_pkg::flat; 'weight' => '56', ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus per-service charges" if $str; + $str; +} + sub calc_recur { my($self, $cust_pkg ) = @_; diff --git a/FS/FS/part_pkg/sqlradacct_hour.pm b/FS/FS/part_pkg/sqlradacct_hour.pm index 3cc46acc4..1c198a1c2 100644 --- a/FS/FS/part_pkg/sqlradacct_hour.pm +++ b/FS/FS/part_pkg/sqlradacct_hour.pm @@ -73,6 +73,13 @@ use FS::part_pkg::flat; 'weight' => 40, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} + sub calc_recur { my($self, $cust_pkg, $sdate, $details ) = @_; diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index f4741ab47..658df5446 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -278,6 +278,13 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); 'weight' => 40, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} + sub calc_setup { my($self, $cust_pkg ) = @_; $self->option('setup_fee'); diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm index 1b91575d4..36efad1ae 100644 --- a/FS/FS/part_pkg/voip_inbound.pm +++ b/FS/FS/part_pkg/voip_inbound.pm @@ -160,6 +160,13 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); 'weight' => 40, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} + sub calc_setup { my($self, $cust_pkg ) = @_; $self->option('setup_fee'); diff --git a/FS/FS/part_pkg/voip_sqlradacct.pm b/FS/FS/part_pkg/voip_sqlradacct.pm index 538876712..b856b5cda 100644 --- a/FS/FS/part_pkg/voip_sqlradacct.pm +++ b/FS/FS/part_pkg/voip_sqlradacct.pm @@ -29,6 +29,13 @@ $DEBUG = 1; 'weight' => 40, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info; + $str .= " plus usage" if $str; + $str; +} + sub calc_setup { my($self, $cust_pkg ) = @_; $self->option('setup_fee'); -- 2.11.0