summaryrefslogtreecommitdiff
path: root/FS/FS/Template_Mixin.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-12-26 23:35:38 -0800
committerIvan Kohler <ivan@freeside.biz>2013-12-26 23:35:38 -0800
commit484f64be9482f5ab1a7a76778b1c406a68b8929e (patch)
treefbdd66c32b14f85738770a138e192be8107648f0 /FS/FS/Template_Mixin.pm
parent5e96efd1f204142b750b62fa4a977ca50fb5b0fe (diff)
for prepaid, display the time period triggered by a 0 recurring with freq in the setup line item, RT#26274
Diffstat (limited to 'FS/FS/Template_Mixin.pm')
-rw-r--r--FS/FS/Template_Mixin.pm45
1 files changed, 13 insertions, 32 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 2314c02c1..2d9be618f 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -15,6 +15,7 @@ use Locale::Country;
use Cwd;
use FS::UID;
use FS::Record qw( qsearch qsearchs );
+use FS::Conf;
use FS::Misc qw( generate_ps generate_pdf );
use FS::pkg_category;
use FS::pkg_class;
@@ -2485,6 +2486,7 @@ sub _items_cust_bill_pkg {
if $DEBUG > 1;
my $cust_pkg = $cust_bill_pkg->cust_pkg;
+ my $part_pkg = $cust_pkg->part_pkg;
# which pkgpart to show for display purposes?
my $pkgpart = $cust_bill_pkg->pkgpart_override || $cust_pkg->pkgpart;
@@ -2493,7 +2495,7 @@ sub _items_cust_bill_pkg {
# things with them
my %item_dates = ();
%item_dates = map { $_ => $cust_bill_pkg->$_ } ('sdate', 'edate')
- unless $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1);
+ unless $part_pkg->option('disable_line_item_date_ranges',1);
if ( (!$type || $type eq 'S')
&& ( $cust_bill_pkg->setup != 0
@@ -2511,6 +2513,14 @@ sub _items_cust_bill_pkg {
|| $discount_show_always
|| $cust_bill_pkg->recur_show_zero;
+ $description .= $cust_bill_pkg->time_period_pretty( $part_pkg,
+ $self->agentnum )
+ if $part_pkg->is_prepaid #for prepaid, "display the validity period
+ # triggered by the recurring charge freq
+ # (RT#26274)
+ && $cust_bill_pkg->recur == 0
+ && ! $cust_bill_pkg->recur_show_zero;
+
my @d = ();
my $svc_label;
unless ( $cust_pkg->part_pkg->hide_svc_detail
@@ -2581,37 +2591,8 @@ sub _items_cust_bill_pkg {
my $part_pkg = $cust_pkg->part_pkg;
- #pry be a bit more efficient to look some of this conf stuff up
- # outside the loop
- unless (
- $conf->exists('disable_line_item_date_ranges')
- || $part_pkg->option('disable_line_item_date_ranges',1)
- || ! $cust_bill_pkg->sdate
- || ! $cust_bill_pkg->edate
- ) {
- my $time_period;
- my $date_style = '';
- $date_style = $conf->config( 'cust_bill-line_item-date_style-non_monhtly',
- $self->agentnum
- )
- if $part_pkg && $part_pkg->freq !~ /^1m?$/;
- $date_style ||= $conf->config( 'cust_bill-line_item-date_style',
- $self->agentnum
- );
- if ( defined($date_style) && $date_style eq 'month_of' ) {
- $time_period = time2str('The month of %B', $cust_bill_pkg->sdate);
- } elsif ( defined($date_style) && $date_style eq 'X_month' ) {
- my $desc = $conf->config( 'cust_bill-line_item-date_description',
- $self->agentnum
- );
- $desc .= ' ' unless $desc =~ /\s$/;
- $time_period = $desc. time2str('%B', $cust_bill_pkg->sdate);
- } else {
- $time_period = time2str($date_format, $cust_bill_pkg->sdate).
- " - ". time2str($date_format, $cust_bill_pkg->edate);
- }
- $description .= " ($time_period)";
- }
+ $description .= $cust_bill_pkg->time_period_pretty( $part_pkg,
+ $self->agentnum );
my @d = ();
my @seconds = (); # for display of usage info