projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git]
/
httemplate
/
elements
/
select-table.html
diff --git
a/httemplate/elements/select-table.html
b/httemplate/elements/select-table.html
index
9f26a35
..
6fb6b38
100644
(file)
--- a/
httemplate/elements/select-table.html
+++ b/
httemplate/elements/select-table.html
@@
-28,6
+28,7
@@
Example:
'agent_null_right' => '', #right to see un-agented entries
#or
'records' => \@records, #instead of search params
'agent_null_right' => '', #right to see un-agented entries
#or
'records' => \@records, #instead of search params
+ 'presorted' => 0, #set true to disable sorting the records on name_col
#instead of the primary key... only for special cases
'value_col' => 'columnname',
#instead of the primary key... only for special cases
'value_col' => 'columnname',
@@
-70,6
+71,7
@@
Example:
NAME = "<% $opt{'element_name'} || $opt{'field'} || $key %>"
ID = "<% $opt{'id'} || $key %>"
<% $onchange %>
NAME = "<% $opt{'element_name'} || $opt{'field'} || $key %>"
ID = "<% $opt{'id'} || $key %>"
<% $onchange %>
+ <% $size %>
<% $opt{'element_etc'} %>
>
<% $opt{'element_etc'} %>
>
@@
-88,10
+90,12
@@
Example:
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% }
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% }
-% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col()
-% || $a->$key() <=> $b->$key()
-% }
-% @records
+% foreach my $record (
+% # we have the order_by parameter for this
+% #sort { $a->$name_col() cmp $b->$name_col()
+% # || $a->$key() <=> $b->$key()
+% # }
+% @records
% )
% {
% my $recvalue = $record->$key();
% )
% {
% my $recvalue = $record->$key();
@@
-155,7
+159,7
@@
my $key = $opt{'value_col'} || $dbdef_table->primary_key;
my $name_col = $opt{'name_col'};
my $name_col = $opt{'name_col'};
-my $value =
$opt{'curr_value'} ||
$opt{'value'};
+my $value =
exists($opt{'curr_value'}) ? $opt{'curr_value'} :
$opt{'value'};
$value = [ split(/\s*,\s*/, $value) ] if $opt{'multiple'} && $value =~ /,/;
#my $addl_from = $opt{'addl_from'} || '';
$value = [ split(/\s*,\s*/, $value) ] if $opt{'multiple'} && $value =~ /,/;
#my $addl_from = $opt{'addl_from'} || '';
@@
-174,8
+178,11
@@
if ( $opt{'agent_virt'} ) {
my @records = ();
if ( $opt{'records'} ) {
@records = @{ $opt{'records'} };
my @records = ();
if ( $opt{'records'} ) {
@records = @{ $opt{'records'} };
+ @records = sort { $a->get($name_col) cmp $b->get($name_col) } @records
+ unless $opt{'presorted'};
} else {
@records = qsearch( {
} else {
@records = qsearch( {
+ 'select' => $opt{'select'} || '*',
'table' => $opt{'table'},
'addl_from' => $opt{'addl_from'},
'hashref' => $hashref,
'table' => $opt{'table'},
'addl_from' => $opt{'addl_from'},
'hashref' => $hashref,
@@
-212,4
+219,6
@@
unless ( !ref($value) && $value < 1 # !$value #ignore negatives too
my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
my @post_options = $opt{post_options} ? @{ $opt{post_options} } : ();
my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
my @post_options = $opt{post_options} ? @{ $opt{post_options} } : ();
+my $size = $opt{'size'} ? 'SIZE=' . $opt{'size'} : '';
+
</%init>
</%init>