use localized service labels in invoices, #71347
[freeside.git] / httemplate / elements / select-terms.html
1 <SELECT NAME = "invoice_terms"
2         ID   = "invoice_terms"
3         <% $opt{'disabled'} ? 'DISABLED' : ''%>
4 >
5 # #false laziness w/select-table.html
6 % while ( @pre_options ) { 
7 %   my $pre_opt   = shift(@pre_options);
8 %   my $pre_label = shift(@pre_options);
9 %   my $selected = #   ( ref($value) && $value->{$pre_opt} ) ||
10 %                   ( $curr_value eq $pre_opt );
11     <OPTION VALUE="<% $pre_opt %>"
12             <% $selected ? 'SELECTED' : '' %>
13     ><% $pre_label %>
14 % } 
15
16   <OPTION VALUE="<% $empty_value %>"><% $empty_label %>
17 % foreach my $term ( @terms ) {
18     <OPTION VALUE="<% $term %>" <% $curr_value eq $term ? ' SELECTED' : '' %>><% $term %>
19 % }
20 </SELECT>
21 <%init>
22
23 my %opt = @_;
24 my $curr_value = $opt{'curr_value'};
25 my $conf = new FS::Conf;
26
27 my $empty_label =
28   $opt{'empty_label'}
29     || emt('Default').' ('.
30          ( $conf->config('invoice_default_terms', $opt{'agentnum'})
31              || emt('Payable upon receipt')
32          ).
33        ')';
34
35 my $empty_value = $opt{'empty_value'} || '';
36
37 my @terms = ( emt('Payable upon receipt'),
38               ( map "Net $_",
39                 0, 3, 5, 7, 9, 10, 14, 15, 18, 20, 21, 25, 30, 45, 60, 90 ),
40             );
41
42 my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
43
44 </%init>