if $conf->exists('enable_taxproducts');
$config_billing{'Tax classes'} = [ $fsurl. 'browse/part_pkg_taxclass.html', 'Tax classes' ];
+ $config_billing{'separator5'} = ''; #its a separator!
$config_billing{'Credit reasons'} = [ $fsurl.'browse/reason.html?class=R', 'Credit reasons explain why a credit was issued.' ];
$config_billing{'Credit reason types'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons.' ];
$config_billing{'Credit void reasons'} = [ $fsurl.'browse/reason.html?class=X', 'Credit void reasons explain why a credit was voided.' ];
$config_billing{'Credit void reason types'} = [ $fsurl.'browse/reason_type.html?class=X', 'Credit void reason types define groups of reasons.' ];
- $config_billing{'separator5'} = ''; #its a separator!
$config_billing{'Refund reasons'} = [ $fsurl.'browse/reason.html?class=F', 'Refund reasons explain why a refund was issued.' ];
$config_billing{'Refund reason types'} = [ $fsurl.'browse/reason_type.html?class=F', 'Refund reason types define groups of reasons.' ];
}
'html_init' => '',
'addl_header' => [],
'addl_fields' => [],
+ 'addl_sort_fields' => [],
'redirect_empty' => $redirect_empty,
)
my $table = $opt{'table'} || 'cust_'.$opt{'thing'};
+my $has_reason = dbdef->table($table)->column('reasonnum') ? 1 : 0;
+
my $amount_field = $opt{'amount_field'};
my $name_singular = $opt{'name_singular'};
$o = 'customer self-service' if $o eq 'fs_selfservice';
$o;
};
+ push @sort_fields, '';
}
if ( $tax_names ) {
split('\|', shift->tax_names)
);
};
+ push @sort_fields, '', '';
}
push @header, FS::UI::Web::cust_header();
my @color = ( ( map '', @fields ), FS::UI::Web::cust_colors() );
my @style = ( ( map '', @fields ), FS::UI::Web::cust_styles() );
push @fields, \&FS::UI::Web::cust_fields;
+push @sort_fields, FS::UI::Web::cust_sort_fields;
push @header, @{ $opt{'addl_header'} }
if $opt{'addl_header'};
push @fields, @{ $opt{'addl_fields'} }
if $opt{'addl_fields'};
+push @sort_fields, @{ $opt{'addl_sort_fields'} }
+ if $opt{'addl_sort_fields'};
my( $count_query, $sql_query, @count_addl );
if ( $cgi->param('magic') ) {
push @search, "($table.auth LIKE '$1%') OR ($table.order_number LIKE '$1%')";
push @fields, 'auth', 'order_number';
push @header, 'Auth #', 'Transaction #';
+ push @sort_fields, '', '';
$align .= 'rr';
}
my $addl_from = FS::UI::Web::join_cust_main($table);
my $group_by = '';
+ # reasons, for refunds and voided payments
+ if ( $has_reason ) {
+ push @select, "reason.reason";
+ $addl_from .= " LEFT JOIN reason USING (reasonnum)\n";
+ push @fields, 'reason';
+ push @sort_fields, 'reason.reason';
+ push @header, emt('Reason');
+ if ( $cgi->param('reasonnum') =~ /^(\d+)$/ ) {
+ push @search, "COALESCE(reasonnum, 0) = $1";
+ }
+ }
+
if ( $cgi->param('tax_names') ) {
if ( dbh->{Driver}->{Name} =~ /^Pg/i ) {
<TR>
<TH CLASS="background" COLSPAN=2 ALIGN="left">
- <FONT SIZE="+1"><% mt('Payment search options') |h %></FONT>
+ <FONT SIZE="+1"><% mt('[_1] search options', ucfirst($name_singular)) |h %></FONT>
</TH>
</TR>
<& /elements/tr-select-user.html &>
+% if ( $has_reason ) {
+% # limit to reasons that are in use for the table being reported on
+% # (maybe order by count(*) desc?)
+ <& /elements/tr-select-table.html,
+ label => emt('Reason'),
+ field => 'reasonnum',
+ id => 'reasonnum',
+ table => 'reason',
+ name_col => 'reason',
+ extra_sql => " WHERE EXISTS(SELECT 1 FROM $table WHERE $table.reasonnum = reason.reasonnum) ",
+ empty_label => emt('any'),
+ &>
+% }
+
<TR>
<TD ALIGN="right" VALIGN="center"><% mt(ucfirst($name_singular). ' date') |h %></TD>
<TD>
"\u$name_singular report" ;
$table .= '_void' if $void;
+my $has_reason = dbdef->table($table)->column('reasonnum');
+
tie (my %payby, 'Tie::IxHash',
'CARD-VisaMC' => 'credit card (Visa/MasterCard)',
'CARD-Amex' => 'credit card (American Express)',