X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fchange_history_common.html;h=9fc85aa53fac074f16a0c3c4bc7c375a09b15052;hb=769b080fc81e1858a71de16936a7d0796fdaac7a;hp=9e19539d096258f82b3b5ec5e2c61dfc668caa68;hpb=d6ff3967df6ee08263023a4d35865b66bdb8a672;p=freeside.git diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html index 9e19539d0..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 ) %> +% } @@ -138,7 +135,7 @@ my %action = ( 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 @@ -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; +} +