##
'table' => 'table_name',
'name_col' => 'name_column', #or method if you pass an order_by
+ # order_by is currently broken, though
#strongly recommended (you want your forms to be "sticky" on errors, right?)
'curr_value' => 'current_value',
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% }
-%# foreach my $record ( sort { $a->$name_col() cmp $b->$name_col()
-%# || $a->$key() <=> $b->$key()
-%# }
-%# @records
-%# )
-%# {
-% # show records in query order, or preserve the order they were given
-% foreach my $record (@records) {
+% # XXX fix this eventually, when we have time to test it
+% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col()
+% || $a->$key() <=> $b->$key()
+% }
+% @records
+% )
+% {
% my $recvalue = $record->$key();
% my $selected;
% if ( $opt{'all_selected'} ) {
'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,
my @reasons = qsearch({
'table' => 'reason',
+ 'select' => "reason.*, (type || ' : ' || reason) AS label",
'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;