[freeside-commits] branch FREESIDE_3_BRANCH updated. 0fb4ab2c74868ace9e7ac46a5ddb67c7c99597c5

Mark Wells mark at 420.am
Mon Jun 9 14:24:05 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  0fb4ab2c74868ace9e7ac46a5ddb67c7c99597c5 (commit)
      from  a8fac25bb0a138fd8fa7d87c6e4cee1de6fd4748 (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 0fb4ab2c74868ace9e7ac46a5ddb67c7c99597c5
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Jun 9 14:23:03 2014 -0700

    correctly associate bundled line item amounts with base items, #29518

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index bfa03bc..afa17fc 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2295,7 +2295,26 @@ separate quantities, for some reason).
 
 sub _items_nontax {
   my $self = shift;
-  grep { $_->pkgnum } $self->cust_bill_pkg;
+  # The order of these is important.  Bundled line items will be merged into
+  # the most recent non-hidden item, so it needs to be the one with:
+  # - the same pkgnum
+  # - the same start date
+  # - no pkgpart_override
+  #
+  # So: sort by pkgnum,
+  # then by sdate
+  # then sort the base line item before any overrides
+  # then sort hidden before non-hidden add-ons
+  # then sort by override pkgpart (for consistency)
+  sort { $a->pkgnum <=> $b->pkgnum        or
+         $a->sdate  <=> $b->sdate         or
+         ($a->pkgpart_override ? 0 : -1)  or
+         ($b->pkgpart_override ? 0 : 1)   or
+         $b->hidden cmp $a->hidden        or
+         $a->pkgpart_override <=> $b->pkgpart_override
+       }
+  # and of course exclude taxes and fees
+  grep { $_->pkgnum > 0 } $self->cust_bill_pkg;
 }
 
 sub _items_fee {

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

Summary of changes:
 FS/FS/Template_Mixin.pm |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list