X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fchange_history_common.html;h=5aaf6e691fd0ed09df8b1211ea072c2adfb3a4c4;hp=34ce70b6cba2330f5b2c67c84c8119ad462b7d12;hb=f822e27a1e00594332ffa487a1c284234c5580a6;hpb=f3e0ac2b009c4edd5692cb587ff709dac2223ebe diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html index 34ce70b6c..5aaf6e691 100644 --- a/httemplate/elements/change_history_common.html +++ b/httemplate/elements/change_history_common.html @@ -3,6 +3,7 @@ % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; + User Date @@ -14,11 +15,12 @@ Action Description + % foreach my $item ( @history ) { % my $history_other = ''; % my $act = $item->history_action; -% if ( $act =~ /^replace/ ) { +% if ( $act =~ /^replace/ && $item->table ne 'legacy_cust_history' ) { % my $pkey = $item->primary_key; % my $date = $item->history_date; % $history_other = qsearchs({ @@ -44,18 +46,29 @@ % } + -% my $otaker = $item->history_user; +% my $otaker = ''; +% if ( $item->history_usernum ) { +% $access_user{ $item->history_usernum } ||= +% FS::access_user->by_key( $item->history_usernum ); +% $otaker = $access_user{ $item->history_usernum }->username +% if $access_user{ $item->history_usernum }; +% } +% $otaker ||= $item->history_user; % $otaker = 'auto billing' if $otaker eq 'fs_daily'; % $otaker = 'customer self-service' if $otaker eq 'fs_selfservice'; % $otaker = 'job queue' if $otaker eq 'fs_queue'; +% $otaker = 'system bootstrap user' if $otaker eq 'fs_bootstrap'; <% $otaker %> + % my $d = time2str('%b %o, %Y', $item->history_date ); % $d =~ s/ / /g; <% $d %> + % my $t = time2str('%r', $item->history_date ); % $t =~ s/ / /g; @@ -72,41 +85,53 @@ % my $label = ''; -% $label = $item->table; -% $label =~ s/^h_//; -% $label = $tables{$label}; -% if ( $single_cust ) { -% $label = &{ $h_table_labelsub{$item->table} }( $item, $label ) -% if $h_table_labelsub{$item->table}; -% } +% if ( $item->table eq 'legacy_cust_history' ) { +% $label = $item->item; +% } else { +% $label = $item->table; +% $label =~ s/^h_//; +% $label = $tables{$label}; +% $label = &{ $h_table_labelsub{$item->table} }( $item, $label ) +% if $single_cust && $h_table_labelsub{$item->table}; +% } <% $label %> + - <% $action{$item->history_action} %> + <% $action{$item->history_action} || ucfirst($item->history_action) |h %> + - <% join(', ', - map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ ) - ? 'N/A' - : $item->get($_); - $value = time2str($cust_pkg_date_format, $value) - if $item->table eq 'h_cust_pkg' - && $cust_pkg_date_fields{$_} - && $value; - - $value = substr($value, 0, 77).'...' if length($value) > 80; - $value = encode_entities($value); - "$_:$value"; - } - grep { $history_other - ? ( $item->get($_) ne $history_other->get($_) ) - : ( $item->get($_) =~ /\S/ ) - } - grep { ! /^(history|custnum$)/i } - $item->fields - ) - %> +% if ( $item->table eq 'legacy_cust_history' ) { + <% $item->description |h %> +% } else { + <% join(', ', + map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ ) + ? 'N/A' + : $item->get($_); + $value = time2str($cust_pkg_date_format, $value) + if $item->table eq 'h_cust_pkg' + && $cust_pkg_date_fields{$_} + && $value; + + $value = substr($value, 0, 77).'...' if length($value) > 80; + $value = encode_entities($value); + "$_:$value"; + } + grep { $history_other + ? ( $item->get($_) ne $history_other->get($_) ) + : ( $item->get($_) =~ /\S/ ) + } + grep { ! /^(history|custnum$)/i } + $item->fields + ) + %> +% if ( $single_cust && $h_table_descripsub{$item->table} ) { + <% &{ $h_table_descripsub{$item->table} }( $item ) %> +% } +% } + % } @@ -125,8 +150,8 @@ die "access deined" my %action = ( 'insert' => 'Insert', #'Create', - 'replace_old' => 'Change from', - 'replace_new' => 'Change to', + 'replace_old' => "Change\xA0from", + 'replace_new' => "Change\xA0to", 'delete' => 'Remove', ); @@ -172,6 +197,12 @@ my $svc_labelsub = sub { $label. ': '. encode_entities($item->label($item->history_date)). ''; }; +my $tag_labelsub = sub { + my($item, $label) = @_; + my $part_tag = qsearchs('part_tag',{ tagnum => $item->tagnum }); + $label. ': '. encode_entities($part_tag->tagname). ''; +}; + my %h_table_labelsub = ( 'h_cust_pkg' => $pkg_labelsub, 'h_svc_acct' => $svc_labelsub, @@ -183,6 +214,28 @@ my %h_table_labelsub = ( 'h_svc_external' => $svc_labelsub, 'h_svc_phone' => $svc_labelsub, #'h_phone_device' + 'h_cust_tag' => $tag_labelsub, +); + +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'; @@ -197,4 +250,6 @@ if ( $curuser->option('history_order') eq 'newest' ) { @history = reverse @history; } +my %access_user = (); #cache +