[freeside-commits] branch master updated. c6af881c09662e932da6d965887f5be27fbcc158

Ivan Kohler ivan at freeside.biz
Tue Apr 10 18:11:01 PDT 2018


The branch, master has been updated
       via  c6af881c09662e932da6d965887f5be27fbcc158 (commit)
      from  50434de151ec3d79f6b397d0f0714b58885e80ec (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c6af881c09662e932da6d965887f5be27fbcc158
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Apr 10 18:11:00 2018 -0700

    optimize invoice rendering, RT#80177

diff --git a/FS/FS/TemplateItem_Mixin.pm b/FS/FS/TemplateItem_Mixin.pm
index 28fbd591d..28ef845c9 100644
--- a/FS/FS/TemplateItem_Mixin.pm
+++ b/FS/FS/TemplateItem_Mixin.pm
@@ -107,14 +107,13 @@ Returns a formatted time period for this line item.
 =cut
 
 sub time_period_pretty {
-  my( $self, $part_pkg, $agentnum ) = @_;
+  my( $self, $part_pkg, $agentnum, %opt ) = @_;
 
   #more efficient to look some of this conf stuff up outside the
   # invoice/template display loop we're called from
   # (Template_Mixin::_invoice_cust_bill_pkg) and pass them in as options
 
-  return '' if $conf->exists('disable_line_item_date_ranges')
-            || $part_pkg->option('disable_line_item_date_ranges',1)
+  return '' if $opt{'disable_line_item_date_ranges'}
             || ! $self->sdate
             || ! $self->edate;
 
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 2194a3fa5..551d53fc4 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -1204,6 +1204,8 @@ sub print_generic {
     $options{'skip_usage'} =
       scalar(@$extra_sections) && !grep{$section == $_} @$extra_sections;
     $options{'preref_callback'} = $params{'preref_callback'};
+    $options{'disable_line_item_date_ranges'} =
+      $conf->exists('disable_line_item_date_ranges');
 
     warn "$me   searching for line items\n"
       if $DEBUG > 1;
@@ -3434,8 +3436,15 @@ sub _items_cust_bill_pkg {
             || ($discount_show_always and $cust_bill_pkg->unitrecur > 0)
             || $cust_bill_pkg->recur_show_zero;
 
-          $description .= $cust_bill_pkg->time_period_pretty( $part_pkg,
-                                                              $agentnum )
+          my $disable_date_ranges =
+               $opt{disable_line_item_date_ranges}
+            || $part_pkg->option('disable_line_item_date_ranges', 1);
+
+          $description .= $cust_bill_pkg->time_period_pretty(
+                            $part_pkg,
+                            $agentnum,
+                            disable_date_ranges => $disable_date_ranges,
+                          )
             if $part_pkg->is_prepaid #for prepaid, "display the validity period
                                      # triggered by the recurring charge freq
                                      # (RT#26274)
@@ -3532,8 +3541,15 @@ sub _items_cust_bill_pkg {
             $description = $self->mt('Usage charges');
           }
 
-          $description .= $cust_bill_pkg->time_period_pretty( $part_pkg,
-                                                              $agentnum );
+          my $disable_date_ranges =
+               $opt{disable_line_item_date_ranges}
+            || $part_pkg->option('disable_line_item_date_ranges', 1);
+
+          $description .= $cust_bill_pkg->time_period_pretty(
+                                    $part_pkg,
+                                    $agentnum,
+                                    disable_date_ranges => $disable_date_ranges,
+                          );
 
           my @d = ();
           my @seconds = (); # for display of usage info

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/TemplateItem_Mixin.pm |  5 ++---
 FS/FS/Template_Mixin.pm     | 24 ++++++++++++++++++++----
 2 files changed, 22 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list