X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Felements%2Fchange_history_common.html;h=2d2c4c0be8080edd7e63dde2db8f53984af6c97e;hb=834b24e3a5aeb9188635e710be7002af04f187c8;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..2d2c4c0be 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,37 @@ my %h_table_labelsub = ( #'h_phone_device' ); +my $discounts = {}; +my $discount_descripsub = sub { + my($item) = @_; + $pkgpart{$item->pkgpart} ||= qsearchs({ + 'table' => 'part_pkg', + 'hashref' => {'pkgpart' => $item->pkgpart} + })->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; +} +