[freeside-commits] branch FREESIDE_3_BRANCH updated. 02ccaf002b3c1f5274266061786dc7d03047fe30

Ivan Kohler ivan at freeside.biz
Wed Apr 11 13:26:15 PDT 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  02ccaf002b3c1f5274266061786dc7d03047fe30 (commit)
      from  121bbbde83b22ae0837d8010e743dc83396a30f4 (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 02ccaf002b3c1f5274266061786dc7d03047fe30
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Apr 11 13:26:14 2018 -0700

    optimize invoice display with sections, RT#80177

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index d011ff07f..3c063f9eb 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2665,7 +2665,13 @@ sub _items_sections {
       foreach my $display ($cust_bill_pkg->cust_bill_pkg_display) {
         next if ( $display->summary && $opt{summary} );
 
-        my $section = $display->section;
+        #my $section = $display->section;
+        #false laziness with the method, but for efficiency inside this loop
+        my $section = $display->get('section');
+        if ( !$section && !$cust_bill_pkg->hidden ) {
+          $section = $cust_bill_pkg->get('categoryname'); #cust_bill->cust_bill_pkg added it (XXX quotations / quotation_section)
+        }
+
         my $type    = $display->type;
         # Set $section = undef if we're sectioning by location and this
         # line item _has_ a location (i.e. isn't a fee).
@@ -3090,6 +3096,8 @@ sub _items_fee {
   my @cust_bill_pkg = grep { $_->feepart } $self->cust_bill_pkg;
   my $escape_function = $options{escape_function};
 
+  my $locale = $self->cust_main->locale;
+
   my @items;
   foreach my $cust_bill_pkg (@cust_bill_pkg) {
     # cache this, so we don't look it up again in every section
@@ -3131,7 +3139,7 @@ sub _items_fee {
           $self->mt('from invoice #[_1] on [_2]', $_, $base_invnums{$_})
         );
     }
-    my $desc = $part_fee->itemdesc_locale($self->cust_main->locale);
+    my $desc = $part_fee->itemdesc_locale($locale);
     # but not escape the base description line
 
     my @pkg_tax = $cust_bill_pkg->_pkg_tax_list
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 7727e07a5..b3e86584b 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -487,7 +487,13 @@ Returns the line items (see L<FS::cust_bill_pkg>) for this invoice.
 sub cust_bill_pkg {
   my $self = shift;
   qsearch(
-    { 'table'    => 'cust_bill_pkg',
+    { 
+      'select'    => 'cust_bill_pkg.*, pkg_category.categoryname',
+      'table'    => 'cust_bill_pkg',
+      'addl_from' => ' LEFT JOIN cust_pkg     USING ( pkgnum ) '.
+                     ' LEFT JOIN part_pkg     USING ( pkgpart ) '.
+                     ' LEFT JOIN pkg_class    USING ( classnum ) '.
+                     ' LEFT JOIN pkg_category USING ( categorynum ) ',
       'hashref'  => { 'invnum' => $self->invnum },
       'order_by' => 'ORDER BY billpkgnum',
     }

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

Summary of changes:
 FS/FS/Template_Mixin.pm | 12 ++++++++++--
 FS/FS/cust_bill.pm      |  8 +++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list