- my %location_hash = map { $_ => scalar($cgi->param($_)) }
- qw( custnum address1 address2 city county state zip country geocode );
- $location_hash{location_type} = $cgi->param('location_type')
- if $cgi->param('location_type');
- $location_hash{location_number} = $cgi->param('location_number')
- if $cgi->param('location_number');
- $location_hash{location_kind} = $cgi->param('location_kind')
- if $cgi->param('location_kind');
- $cust_location = new FS::cust_location ( { %location_hash } );
- $error = $cust_location->insert;
- die "Unable to insert cust_location: $error" if $error;
-}
-elsif ( $locationnum eq '' ) { # default service location
- $cust_location = new FS::cust_location ( {
- $cust_main->location_hash,
- custnum => $custnum,
- } );
-}
-elsif ( $locationnum != -2 ) { # -2 = address not required for qual
- $cust_location = qsearchs('cust_location', { 'locationnum' => $locationnum })
- or die 'Invalid locationnum';
-}