X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fchange_history_common.html;h=9fc85aa53fac074f16a0c3c4bc7c375a09b15052;hb=769b080fc81e1858a71de16936a7d0796fdaac7a;hp=232664e39876fdf1b485d1f32c10906c9572ece2;hpb=781f0ffcf560d3df0aec7ae349b57463d1c2518a;p=freeside.git diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html index 232664e39..9fc85aa53 100644 --- a/httemplate/elements/change_history_common.html +++ b/httemplate/elements/change_history_common.html @@ -15,13 +15,7 @@ Description -% 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/ ) { @@ -112,6 +106,9 @@ $item->fields ) %> +% if ( $single_cust && $h_table_descripsub{$item->table} ) { + <% &{ $h_table_descripsub{$item->table} }( $item ) %> +% } @@ -191,9 +188,34 @@ my %h_table_labelsub = ( #'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}; + '(' . 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'; $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; +} +