X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fchange_history.html;h=11777b54ce04d96408a9f41435ffe78b8c46ec3b;hb=368ed08e24400e9d1faf401a1e4e23ea54d2c969;hp=53a79f47f46b887e46bacd7a51ee487429569aa0;hpb=63a268637b2d51a8766412617724b9436439deb6;p=freeside.git
diff --git a/httemplate/view/cust_main/change_history.html b/httemplate/view/cust_main/change_history.html
index 53a79f47f..11777b54c 100644
--- a/httemplate/view/cust_main/change_history.html
+++ b/httemplate/view/cust_main/change_history.html
@@ -13,108 +13,13 @@
% $cgi->param('change_history-years', $chy);
% }
-<% include("/elements/table-grid.html") %>
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor = '';
-
-
-
-% my $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 %>
- |
-
-% my $d = time2str('%b %o, %Y', $item->history_date );
-% $d =~ s/ / /g;
- <% $d %>
- |
-
-% my $t = time2str('%r', $item->history_date );
-% $t =~ s/ / /g;
- <% $t %>
- |
-
-% my $label = $h_tables{$item->table};
-% $label = &{ $h_table_labelsub{$item->table} }( $item, $label )
-% if $h_table_labelsub{$item->table};
- <% $label %>
- |
-
- <% $action{$item->history_action} %>
- |
-
- <% join(', ',
- map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ )
- ? 'N/A'
- : $item->get($_);
- $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
- )
- %>
- |
-
-
-% }
+<% include("/elements/change_history_common.html",
+ 'history' => \@history,
+ 'tables' => \%tables,
+ 'single_cust' => 1,
+ ) %>
-
-<%once>
-
-# length-switching
+<%init>
tie my %years, 'Tie::IxHash',
.5 => '6 months',
@@ -124,45 +29,10 @@ tie my %years, 'Tie::IxHash',
39 => 'all history',
;
-# labeling history rows
-
-my %action = (
- 'insert' => 'Insert', #'Create',
- 'replace_old' => 'Change from',
- 'replace_new' => 'Change to',
- 'delete' => 'Remove',
-);
-
-# finding the other replace row
-
-my %replace_other = (
- 'replace_new' => 'replace_old',
- 'replace_old' => 'replace_new',
-);
-my %replace_dir = (
- 'replace_new' => '<',
- 'replace_old' => '>',
-);
-my %replace_direq = (
- 'replace_new' => '<=',
- 'replace_old' => '>=',
-);
-my %replace_op = (
- 'replace_new' => '-',
- 'replace_old' => '+',
-);
-my %replace_ord = (
- 'replace_new' => 'DESC',
- 'replace_old' => 'ASC',
-);
-
-my $fuzz = 5; #seems like a lot
-
-# which tables to search and what to call them
-
tie my %tables, 'Tie::IxHash',
'cust_main' => 'Customer',
'cust_main_invoice' => 'Invoice destination',
+ 'cust_main_note' => 'Note',
'cust_pkg' => 'Package',
#? or just svc_* ? 'cust_svc' =>
'svc_acct' => 'Account',
@@ -173,50 +43,37 @@ tie my %tables, 'Tie::IxHash',
'svc_broadband' => 'Broadband',
'svc_external' => 'External service',
'svc_phone' => 'Phone',
+ 'svc_cable' => 'Cable',
'phone_device' => 'Phone device',
+ 'cust_pkg_discount' => 'Discount',
#? it gets provisioned anyway 'phone_avail' => 'Phone',
+ 'cust_tag' => 'Tag',
+ 'contact' => 'Contact',
+ 'cust_contact' => 'Contact',
;
-my $svc_join = 'JOIN cust_svc USING ( svcnum ) JOIN cust_pkg USING ( pkgnum )';
+my $pkg_join = "JOIN cust_pkg USING ( pkgnum )";
+my $svc_join = "JOIN cust_svc USING ( svcnum ) $pkg_join";
+
+my @svc_tables = qw(
+ svc_acct
+ svc_domain
+ svc_www
+ svc_forward
+ svc_broadband
+ svc_external
+ svc_phone
+ svc_cable
+);
my %table_join = (
- 'svc_acct' => $svc_join,
'radius_usergroup' => $svc_join,
- 'svc_domain' => $svc_join,
- 'svc_www' => $svc_join,
- 'svc_forward' => $svc_join,
- 'svc_broadband' => $svc_join,
- 'svc_external' => $svc_join,
- 'svc_phone' => $svc_join,
'phone_device' => $svc_join,
+ 'cust_pkg_discount'=> $pkg_join,
);
-my %h_tables = map { ( "h_$_" => $tables{$_} ) } keys %tables;
-
-my %pkgpart = ();
-my $pkg_labelsub = sub {
- my($item, $label) = @_;
- $pkgpart{$item->pkgpart} ||= $item->part_pkg->pkg;
- $label. ':