<TH CLASS="grid" BGCOLOR="#cccccc">Description</TH>
</TR>
-% foreach my $item ( sort { $a->history_date <=> $b->history_date
-% #|| table order
-% || $a->historynum <=> $b->historynum
-% }
-% @history
-% )
-% {
+% foreach my $item ( @history ) {
% my $history_other = '';
% my $act = $item->history_action;
% if ( $act =~ /^replace/ ) {
$item->fields
)
%>
+% if ( $single_cust && $h_table_descripsub{$item->table} ) {
+ <% &{ $h_table_descripsub{$item->table} }( $item ) %>
+% }
</TD>
</TR>
my %cust_pkg_date_fields = map { $_=>1 } qw(
start_date setup bill last_bill susp adjourn cancel expire contract_end
- change_date
+ resume change_date
);
# finding the other replace row
#'h_phone_device'
);
+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';
$cust_pkg_date_format .= ' %l:%M:%S%P'
if $conf->exists('cust_pkg-display_times')
|| $curuser->option('cust_pkg-display_times');
+@history = sort { $a->history_date <=> $b->history_date
+ || $a->historynum <=> $b->historynum } @history;
+
+if ( $curuser->option('history_order') eq 'newest' ) {
+ @history = reverse @history;
+}
+
</%init>