LP#1406370 Set Search Preferences Ordered by Name user/abowling/lp1406370_set_search_preferences_by_name
authorAdam Bowling <abowling@emeralddata.net>
Mon, 19 Jan 2015 21:04:04 +0000 (16:04 -0500)
committerAdam Bowling <abowling@emeralddata.net>
Mon, 19 Jan 2015 21:04:04 +0000 (16:04 -0500)
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>
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++)