% my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
% if ( ! @pre_options
% && ! $cust_main
% && ! $opt{is_optional}
% && ! @{ $opt{cust_location} }
% && $addnew
% ) {
% } else {
% }
<%init>
my $conf = new FS::Conf;
my $countrydefault = $conf->config('countrydefault') || 'US';
my %opt = @_;
my $cust_main = $opt{'cust_main'};
my $locationnum = $opt{'curr_value'};
$opt{'cust_location'} ||= [ $cust_main ? $cust_main->cust_location : () ];
my $addnew = exists($opt{addnew}) ? $opt{addnew}
: $cust_main ? 1 : ( $locationnum>0 ? 0 : 1 );
%init>