1 <% include("/elements/header.html", "Employee Audit Report") %>
2 <% include("/elements/change_history_common.html",
3 'history' => \@history,
6 <% include('/elements/footer.html') %>
10 unless $FS::CurrentUser::CurrentUser->access_right('Employees: Audit Report');
13 cust_pay => 'Payments',
14 cust_refund => 'Refunds',
15 cust_credit => 'Credits',
16 cust_bill => 'Invoices',
17 cust_main => 'Customers',
18 cust_pkg => 'Packages',
19 cust_main_invoice => 'Customer invoice destinations',
20 cust_pkg_discount => 'Discount applications',
23 my $history_user = ($cgi->param('usernum') && $cgi->param('usernum') =~ /^(\d+)$/)
24 ? qsearchs('access_user', { 'usernum' => $1 } )
26 $history_user = $history_user->username if $history_user;
28 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
30 my @checked_tables = grep { defined($cgi->param($_)) } keys(%tables);
33 foreach my $table ( @checked_tables ) {
35 push @extra_sql, "history_user = '$history_user'" if $history_user;
36 push @extra_sql, "history_date >= $beginning" if $beginning;
37 push @extra_sql, "history_date <= $ending" if $ending;
39 'table' => "h_$table",
40 'extra_sql' => scalar(@extra_sql) ? "WHERE ".join(' AND ',@extra_sql) : '',
42 push @history, @items;