1 <SELECT NAME = "locationnum"
3 % if ( $opt{onchange} ) {
4 onchange = "<% $opt{onchange} %>"
8 % #false laziness w/select-table.html
9 % my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
10 % while ( @pre_options ) {
11 % my $pre_opt = shift(@pre_options);
12 % my $pre_label = shift(@pre_options);
13 % my $selected = #$opt{'all_selected'}
14 % # || ( ref($locationnum) && $locationnum->{$pre_opt} )
16 % ( $locationnum eq $pre_opt );
17 <OPTION VALUE="<% $pre_opt %>"
18 <% $selected ? 'SELECTED' : '' %>
23 % my $selected = ( $locationnum == $cust_main->ship_locationnum );
24 <OPTION VALUE="<% $cust_main->ship_locationnum %>"
25 <% $selected ? 'SELECTED' : '' %>
26 ><% $opt{'empty_label'} || '(default service address)' |h %>
29 % if ( $opt{'is_optional'} ) {
30 <OPTION VALUE="-2" <% $locationnum == -2 ? 'SELECTED' : ''%>><% $opt{'optional_label'} || '(not required)' |h %>
33 % foreach my $loc ( @{ $opt{cust_location} } ) {
34 % # don't show the ship_location redundantly
35 % next if $cust_main && $cust_main->ship_locationnum == $loc->locationnum;
36 <OPTION VALUE="<% $loc->locationnum %>"
37 <% $locationnum == $loc->locationnum ? 'SELECTED' : '' %>
38 ><% $loc->line( cust_main => $cust_main,
39 countrydefault => $countrydefault,
46 <% $locationnum == -1 ? 'SELECTED' : '' %>
53 my $conf = new FS::Conf;
54 my $countrydefault = $conf->config('countrydefault') || 'US';
57 my $cust_main = $opt{'cust_main'};
58 my $locationnum = $opt{'curr_value'};
60 $opt{'cust_location'} ||= [ $cust_main ? $cust_main->cust_location : () ];
62 my $addnew = exists($opt{addnew}) ? $opt{addnew}
63 : $cust_main ? 1 : ( $locationnum>0 ? 0 : 1 );