'id' => $id,
'table' => 'reason',
'records' => \@reasons,
- 'label_callback' => sub { my $reason = shift;
- $reason->type . ' : ' . $reason->reason },
+ 'name_col' => 'label',
'disable_empty' => 1,
'pre_options' => [ 0 => 'Select reason...' ],
'post_options' => \@post_options,
die "illegal class: $class";
}
+my $select = join(',',
+ 'reason.*',
+ FS::Record::concat_sql([ 'type', "' : '", 'reason' ]) . ' AS label',
+);
+
my @reasons = qsearch({
'table' => 'reason',
+ 'select' => $select,
'addl_from' => ' LEFT JOIN reason_type'.
' ON (reason.reason_type = reason_type.typenum)',
'hashref' => { disabled => '' },
'extra_sql' => " AND reason_type.class = '$class'",
- 'order_by' => ' ORDER BY type, reason',
});
my %all_hints;