summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-02-10 18:45:12 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-02-10 18:45:12 -0600
commit73d97ad71884ce66b435f0e8d85e5bf99cda3712 (patch)
treedab6f86d0ae9d0d2802d97290ff9f7645b2c1462
parent4d0db1129018d2f598091edbbffeb09b23c64d99 (diff)
RT#28246: Add more details to Change History for Discounts [better solution]
-rw-r--r--httemplate/elements/change_history_common.html34
1 files changed, 21 insertions, 13 deletions
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';