X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fchange_history_common.html;fp=httemplate%2Felements%2Fchange_history_common.html;h=9e19539d096258f82b3b5ec5e2c61dfc668caa68;hb=d6ff3967df6ee08263023a4d35865b66bdb8a672;hp=0000000000000000000000000000000000000000;hpb=4665d5af02f915679207a369222472a25e137c9d;p=freeside.git
diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html
new file mode 100644
index 000000000..9e19539d0
--- /dev/null
+++ b/httemplate/elements/change_history_common.html
@@ -0,0 +1,199 @@
+<% 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 %>
+ |
+
+% unless ( $single_cust ) {
+
+% my $cust_main = qsearchs('cust_main', { custnum => $item->custnum });
+ <% $cust_main ? "".$cust_main->name.'' : '' %>
+ |
+% }
+
+
+% 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};
+% }
+ <% $label %>
+ |
+
+ <% $action{$item->history_action} %>
+ |
+
+ <% 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
+ )
+ %>
+ |
+
+
+% }
+
+<%init>
+
+my %opt = @_;
+my @history = @{$opt{'history'}};
+my %tables = %{$opt{'tables'}};
+my $single_cust = $opt{'single_cust'};
+my $conf = new FS::Conf;
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access deined"
+ unless $curuser->access_right('View customer history');
+
+my %action = (
+ 'insert' => 'Insert', #'Create',
+ 'replace_old' => 'Change from',
+ 'replace_new' => 'Change to',
+ 'delete' => 'Remove',
+);
+
+my %cust_pkg_date_fields = map { $_=>1 } qw(
+ start_date setup bill last_bill susp adjourn cancel expire contract_end
+ change_date
+);
+
+# 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
+
+my %pkgpart = ();
+my $pkg_labelsub = sub {
+ my($item, $label) = @_;
+ $pkgpart{$item->pkgpart} ||= $item->part_pkg->pkg;
+ $label. ':