X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fchange_history_common.html;h=d734053431f280f44c5781993f6cf8c69500f9fc;hp=d941427820b2fa595261f025f2a31bbe1b171ced;hb=HEAD;hpb=aaa1a91c209ec3547b2c62dc59af935649a62b58 diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html index d94142782..d73405343 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,6 +15,7 @@ Action Description + % foreach my $item ( @history ) { % my $history_other = ''; @@ -42,14 +44,50 @@ % } else { % $bgcolor = $bgcolor1; % } +% +% ## Create Description and check to see it is not empty, no need to display a record with no description, so skip it. +% my $description = ''; +% if ( $item->table eq 'legacy_cust_history' ) { +% $description = $item->description; +% } elsif ( $item->table eq 'h_cust_tag' ) { +% $description = &{ $h_table_descripsub{$item->table} }( $item, $tables{'cust_tag'} ) +% if $single_cust && $h_table_descripsub{$item->table}; +% } else { +% my @fields = $item->fields; +% push @fields, 'message_dest' if $item->table eq 'h_contact'; +% $description = 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 } +% @fields +% ); +% if ( $single_cust && $h_table_descripsub{$item->table} ) { +% $description = &{ $h_table_descripsub{$item->table} }( $item ); +% } +% } #else +% if (!$description) { next; } -% my $otaker; +% my $otaker = ''; % if ( $item->history_usernum ) { % $access_user{ $item->history_usernum } ||= -% qsearchs('access_user', { 'usernum' => $item->history_usernum }); +% FS::access_user->by_key( $item->history_usernum ); % $otaker = $access_user{ $item->history_usernum }->username % if $access_user{ $item->history_usernum }; % } @@ -83,7 +121,7 @@ % my $label = ''; -% if ( $item->table eq 'legacy_cust_bill' ) { +% if ( $item->table eq 'legacy_cust_history' ) { % $label = $item->item; % } else { % $label = $item->table; @@ -100,34 +138,7 @@ -% if ( $item->table eq 'legacy_cust_bill' ) { - <% $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 ) %> -% } -% } + <% $description %> @@ -148,8 +159,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', ); @@ -195,6 +206,18 @@ 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 $contact_labelsub = sub { + my($item, $label) = @_; + my $contact = qsearchs('h_contact',{ contactnum => $item->contactnum }); + $label. ': '. encode_entities($contact->first). ' ' . encode_entities($contact->last) . ''; +}; + my %h_table_labelsub = ( 'h_cust_pkg' => $pkg_labelsub, 'h_svc_acct' => $svc_labelsub, @@ -206,8 +229,37 @@ my %h_table_labelsub = ( 'h_svc_external' => $svc_labelsub, 'h_svc_phone' => $svc_labelsub, #'h_phone_device' + #'h_cust_tag' => $tag_labelsub, + 'h_contact' => $contact_labelsub, + 'h_cust_contact' => $contact_labelsub, + 'h_contact_phone' => $contact_labelsub, + 'h_contact_email' => $contact_labelsub, ); +my $tag_descripsub = sub { + my($item, $label) = @_; + my $part_tag = qsearchs('part_tag',{ tagnum => $item->tagnum }); + ''. encode_entities($part_tag->tagname). ''; +}; + +my $contact_descripsub = sub { + my($item, $label) = @_; + my $phone_type = qsearchs('phone_type',{ phonetypenum => $item->phonetypenum }); + my @fields = $item->fields; + join(', ', + map { + my $value = ( $_ eq "phonetypenum" ) + ? $item->get($_).' ('.$phone_type->typename.')' + : $item->get($_); + $value = substr($value, 0, 77).'...' if length($value) > 80; + $value = encode_entities($value); + "$_:$value"; + } + grep { ! /^(history|custnum$)/i } + @fields + ); +}; + my $discounts = {}; my $discount_descripsub = sub { my($item) = @_; @@ -227,6 +279,8 @@ my $discount_descripsub = sub { my %h_table_descripsub = ( 'h_cust_pkg_discount' => $discount_descripsub, + 'h_cust_tag' => $tag_descripsub, + 'h_contact_phone' => $contact_descripsub, ); my $cust_pkg_date_format = '%b %o, %Y';