LP#1406370 Set Search Preferences Ordered by Name
authorAdam Bowling <abowling@emeralddata.net>
Mon, 19 Jan 2015 21:04:04 +0000 (16:04 -0500)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 15:45:25 +0000 (11:45 -0400)
Set search preferences is currently ordered by shortname in
Admin > Workstation Administration > Set Search Preferences.
This patch adds functionality that orders each org unit and
its children in alphabetical order by name, rather than by
shortname.

Signed-off-by: Adam Bowling <abowling@emeralddata.net>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/xul/staff_client/chrome/content/main/search_prefs.xul

index c4bf6f9..e8f93ed 100644 (file)
             }
         }
         function add_aou(aou, depth) {
+            if (aou.children().length > 0) {
+                aou.children().sort(function(a, b) {
+                    if (a.name() < b.name()) return -1;
+                    if (a.name() > b.name()) return 1;
+                    return 0;
+                });
+            }
             search_lib_box.appendItem(depth + aou.name(), aou.id(), '');
             pref_lib_box.appendItem(depth + aou.name(), aou.id(), '');
             for(var i = 0; i < aou.children().length; i++)