summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-discount_term.html
blob: 26d877a86ceacce38e8a40190acd184c54676e04 (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
% if ( scalar(@discount_term) ) {
    <SELECT NAME="discount_term">
      <OPTION VALUE="">1 month
%   foreach my $discount_term (@discount_term) {
%     my $sel = ( $cgi->param('discount_term') == $discount_term ) ? 'SELECTED' : '';
      <OPTION <% $sel %> VALUE="<% $discount_term %>"><% $discount_term. " months" %>
%   }
    </SELECT>
% }
<%init>

my %opt = @_;

my $cgi = $opt{'cgi'};

my @discount_term;
if ( $opt{discount_term} ) {

  @discount_term = @{ $opt{discount_term} };

} else {

  my $custnum = $opt{'custnum'};

  my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
    or die "unknown custnum $custnum\n";

  @discount_term = $cust_main->discount_terms;

}

</%init>