1 <SELECT NAME="<% $prefix %>_month" SIZE="1" <% $disabled%>>
3 <% $empty ? '<OPTION VALUE="">' : '' %>
4 % foreach ( 1 .. 12 ) {
6 <OPTION<% $_ == $mon ? ' SELECTED' : '' %> VALUE="<% sprintf('%02d', $_) %>"><% $mon[$_-1] %></OPTION>
9 </SELECT>/<SELECT NAME="<% $prefix %>_year" SIZE="1" <% $disabled%>>
11 <% $empty ? '<OPTION VALUE="">' : '' %>
12 % for ( $start_year .. $end_year ) {
14 <OPTION<% $_ == $year ? ' SELECTED' : '' %> VALUE="<% $_ %>"><% $_ %></OPTION>
22 my $prefix = $opt{'prefix'} || '';
23 my $disabled = $opt{'disabled'} || '';
24 my $empty = $opt{'empty_option'} || '';
25 my $start_year = $opt{'start_year'};
26 my $end_year = $opt{'end_year'} || '2037';
29 if ( $opt{'show_month_abbr'} ) {
30 @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
33 @mon = ( ( map "0$_", 1 .. 9 ), 10 .. 12 ),
36 my $date = $opt{'selected_date'} || '';
37 $date = '' if $date eq '-';
39 my $mon = $opt{'selected_mon'} || 0;
40 my $year = $opt{'selected_year'} || 0;
42 #false laziness w/cust_payby->paydate_mon_year
44 if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
45 ( $mon, $year ) = ( $2, $1 );
46 } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
47 ( $mon, $year ) = ( $1, $3 );
49 die "unrecognized expiration date format: $date";
53 unless ( $start_year ) {
55 $start_year = $t[5] + 1900;
57 $start_year = $year if $start_year > $year && $year > 0;