From df41e077b4bf3d63604b7de171fbe53c04db1ea3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Jan 2012 05:10:25 +0000 Subject: [PATCH] add option for "Month of MMM" line item date style, RT#15858 --- FS/FS/Conf.pm | 10 ++++++++++ FS/FS/cust_bill.pm | 19 ++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index db4a40ca2..6a0b2e963 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -3532,6 +3532,16 @@ and customer address. Include units.', }, { + 'key' => 'cust_bill-line_item-date_style', + 'section' => 'billing', + 'description' => 'Display format for line item date ranges on invoice line items.', + 'type' => 'select', + 'select_hash' => [ '' => 'STARTDATE-ENDDATE', + 'month_of' => 'Month of MONTHNAME', + ], + }, + + { 'key' => 'support_packages', 'section' => '', 'description' => 'A list of packages eligible for RT ticket time transfer, one pkgpart per line.', #this should really be a select multiple, or specified in the packages themselves... diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 41ff6aaa9..7f6b3b9a9 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -4986,11 +4986,20 @@ sub _items_cust_bill_pkg { my $description = ($is_summary && $type && $type eq 'U') ? "Usage charges" : $desc; - $description .= " (" . time2str($date_format, $cust_bill_pkg->sdate). - " - ". time2str($date_format, $cust_bill_pkg->edate). - ")" - unless $conf->exists('disable_line_item_date_ranges') - || $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1); + unless ( + $conf->exists('disable_line_item_date_ranges') + || $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1) + ) { + my $time_period; + my $date_style = $conf->config('cust_bill-line_item-date_style'); + if ( $date_style eq 'month_of' ) { + $time_period = time2str('The month of %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)"; + } my @d = (); my @seconds = (); # for display of usage info -- 2.11.0