summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-cust_main-status.html
blob: bdbaac7f44ca6c9a3ff8dcdb7a79d25acc158f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<SELECT NAME="<% $opt{'field'} || 'status' %>"
        <% $opt{'multiple'} ? 'MULTIPLE' : '' %>
        <% $onchange %>
>

  <OPTION VALUE="">all

% foreach my $option ( @{ $opt{'statuses'} } ) { 

    <OPTION VALUE="<% $option %>"
            <% ref($value) && $value->{$option} || $option eq $value
               ? 'SELECTED' : ''
            %>
    ><% $option %>

% } 

</SELECT>

<%init>

my %opt = @_;

$opt{'statuses'} ||= [ FS::cust_main->statuses() ]; # { disabled=>'' } )

my $onchange = $opt{'onchange'}
                 ? 'onChange="'. $opt{'onchange'}. '(this)"'
                 : '';

my $value = $opt{'curr_value'} || $opt{'value'};
$value = [ split(/\s*,\s*/, $value) ] if $opt{'multiple'} && $value =~ /,/;

</%init>