add option for "Month of MMM" line item date style, RT#15858
authorivan <ivan>
Tue, 3 Jan 2012 05:10:25 +0000 (05:10 +0000)
committerivan <ivan>
Tue, 3 Jan 2012 05:10:25 +0000 (05:10 +0000)
FS/FS/Conf.pm
FS/FS/cust_bill.pm

index db4a40c..6a0b2e9 100644 (file)
@@ -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...
     '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...
index 41ff6aa..7f6b3b9 100644 (file)
@@ -4986,11 +4986,20 @@ sub _items_cust_bill_pkg {
           my $description = ($is_summary && $type && $type eq 'U')
                             ? "Usage charges" : $desc;
 
           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
 
           my @d = ();
           my @seconds = (); # for display of usage info