From 769b080fc81e1858a71de16936a7d0796fdaac7a Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 10 Feb 2015 18:45:12 -0600 Subject: [PATCH] RT#28246: Add more details to Change History for Discounts [better solution] --- httemplate/elements/change_history_common.html | 34 ++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html index 9e32bef33..9fc85aa53 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 ) %> +% } @@ -172,18 +175,6 @@ my $svc_labelsub = sub { $label. ': '. encode_entities($item->label($item->history_date)). ''; }; -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 . ': ' . encode_entities($d->description_short) . ''; -}; - 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}; + '(' . encode_entities($d->description_short) . '' + . ' on ' . encode_entities($pkgpart{$item->pkgpart}) . ')'; +}; + +my %h_table_descripsub = ( + 'h_cust_pkg_discount' => $discount_descripsub, ); my $cust_pkg_date_format = '%b %o, %Y'; -- 2.11.0