[freeside-commits] branch FREESIDE_3_BRANCH updated. 769b080fc81e1858a71de16936a7d0796fdaac7a

Jonathan Prykop jonathan at 420.am
Wed Feb 11 12:17:10 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  769b080fc81e1858a71de16936a7d0796fdaac7a (commit)
       via  03113ec3660629e7e378d08c57aae6e0b67c297a (commit)
      from  4778dab8ae1c8cb6e6c784c9da1e475072479516 (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 769b080fc81e1858a71de16936a7d0796fdaac7a
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';

commit 03113ec3660629e7e378d08c57aae6e0b67c297a
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Feb 5 19:05:00 2015 -0600

    RT#28246: Add more details to Change History for Discounts

diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html
index 34ce70b..9e32bef 100644
--- a/httemplate/elements/change_history_common.html
+++ b/httemplate/elements/change_history_common.html
@@ -172,6 +172,18 @@ 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,
@@ -183,6 +195,7 @@ my %h_table_labelsub = (
   'h_svc_external'  => $svc_labelsub,
   'h_svc_phone'     => $svc_labelsub,
   #'h_phone_device'
+  'h_cust_pkg_discount' => $discount_labelsub,
 );
 
 my $cust_pkg_date_format = '%b %o, %Y';

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

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




More information about the freeside-commits mailing list