% my @locations = $cust_main ? $cust_main->cust_location : ();
% push @locations, $cust_location
% if !$cust_main && $cust_location && $cust_location->locationnum>0;
-% foreach my $loc ( @locations ) {
+% foreach my $loc ( sort $location_sort @locations ) {
<OPTION VALUE="<% $loc->locationnum %>"
<% $locationnum == $loc->locationnum ? 'SELECTED' : '' %>
><% $loc->line |h %>
}
}
+my $location_sort = sub {
+ $a->country cmp $b->country
+ or $a->city cmp $b->city
+ or $a->address1 cmp $b->address1
+ or $a->address2 cmp $b->address2
+};
+
my $disabled = ( $locationnum == -1 || ($editable && $locationnum) )
? ''
: 'DISABLED';