[freeside-commits] branch master updated. 73d97ad71884ce66b435f0e8d85e5bf99cda3712

Jonathan Prykop jonathan at 420.am
Tue Feb 10 16:45:43 PST 2015


The branch, master has been updated
       via  73d97ad71884ce66b435f0e8d85e5bf99cda3712 (commit)
      from  4d0db1129018d2f598091edbbffeb09b23c64d99 (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 73d97ad71884ce66b435f0e8d85e5bf99cda3712
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Feb 10 18:45:12 2015 -0600

    RT#28246: Add more details to Change History for Discounts [better solution]

diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html
index 9e32bef..9fc85aa 100644
--- a/httemplate/elements/change_history_common.html
+++ b/httemplate/elements/change_history_common.html
@@ -106,6 +106,9 @@
                 $item->fields
          )
       %>
+% if ( $single_cust && $h_table_descripsub{$item->table} ) {
+      <% &{ $h_table_descripsub{$item->table} }( $item ) %>
+% }
     </TD>
   </TR>
 
@@ -172,18 +175,6 @@ my $svc_labelsub = sub {
   $label. ': <b>'. encode_entities($item->label($item->history_date)). '</b>';
 };
 
-my $discounts = {};
-my $discount_labelsub = sub {
-  my($item, $label) = @_;
-  my $dnum = $item->discountnum;
-  $discounts->{$dnum} ||= qsearchs({
-    'table'=>'discount',
-    'hashref'=>{'discountnum'=>$dnum}
-  });
-  my $d = $discounts->{$dnum};
-  $label . ': <b>' . encode_entities($d->description_short) . '<b>';
-};
-
 my %h_table_labelsub = (
   'h_cust_pkg'      => $pkg_labelsub,
   'h_svc_acct'      => $svc_labelsub,
@@ -195,7 +186,24 @@ my %h_table_labelsub = (
   'h_svc_external'  => $svc_labelsub,
   'h_svc_phone'     => $svc_labelsub,
   #'h_phone_device'
-  'h_cust_pkg_discount' => $discount_labelsub,
+);
+
+my $discounts = {};
+my $discount_descripsub = sub {
+  my($item) = @_;
+  $pkgpart{$item->pkgpart} ||= $item->part_pkg->pkg;
+  my $dnum = $item->discountnum;
+  $discounts->{$dnum} ||= qsearchs({
+    'table'=>'discount',
+    'hashref'=>{'discountnum'=>$dnum}
+  });
+  my $d = $discounts->{$dnum};
+  '(<b>' . encode_entities($d->description_short) . '</b>'
+  . ' on <b>' . encode_entities($pkgpart{$item->pkgpart}) . '</b>)';
+};
+
+my %h_table_descripsub = (
+  'h_cust_pkg_discount' => $discount_descripsub,
 );
 
 my $cust_pkg_date_format = '%b %o, %Y';

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

Summary of changes:
 httemplate/elements/change_history_common.html |   34 +++++++++++++++---------
 1 file changed, 21 insertions(+), 13 deletions(-)




More information about the freeside-commits mailing list