[freeside-commits] freeside/httemplate/elements tr-select-cust_location.html, 1.8, 1.9

Ivan,,, ivan at wavetail.420.am
Fri Dec 3 19:29:08 PST 2010


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv13840

Modified Files:
	tr-select-cust_location.html 
Log Message:
sort locations in dropdown, RT#10766

Index: tr-select-cust_location.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-cust_location.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -d -r1.8 -r1.9
--- tr-select-cust_location.html	12 Mar 2010 21:29:04 -0000	1.8
+++ tr-select-cust_location.html	4 Dec 2010 03:29:06 -0000	1.9
@@ -150,7 +150,7 @@
 %     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 %>
@@ -223,6 +223,13 @@
   }
 }
 
+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';



More information about the freeside-commits mailing list