Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / elements / select-discount_term.html
1 % if ( scalar(@discount_term) ) {
2     <SELECT NAME="discount_term">
3       <OPTION VALUE="">1 month
4 %   foreach my $discount_term (@discount_term) {
5 %     my $sel = ( $cgi->param('discount_term') == $discount_term ) ? 'SELECTED' : '';
6       <OPTION <% $sel %> VALUE="<% $discount_term %>"><% $discount_term. " months" %>
7 %   }
8     </SELECT>
9 % }
10 <%init>
11
12 my %opt = @_;
13
14 my $cgi = $opt{'cgi'};
15
16 my @discount_term;
17 if ( $opt{discount_term} ) {
18
19   @discount_term = @{ $opt{discount_term} };
20
21 } else {
22
23   my $custnum = $opt{'custnum'};
24
25   my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
26     or die "unknown custnum $custnum\n";
27
28   @discount_term = $cust_main->discount_terms;
29
30 }
31
32 </%init>