+ # 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";
+ }
+ }
+