From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Tue, 2 Mar 2010 18:39:36 +0000 (+0000)
Subject: Sort Z39.50 sources as returned by fetch_service_defs() for a better UX
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=057783b0810df535f2085ffb92c7de88e64aff34;p=evergreen%2Ftadl.git

Sort Z39.50 sources as returned by fetch_service_defs() for a better UX


git-svn-id: svn://svn.open-ils.org/ILS/trunk@15655 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
index 27362a9c02..aeab20ec30 100755
--- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
@@ -149,7 +149,15 @@ sub fetch_service_defs {
     };
 
     %services = %$hash; # cache these internally so we can actually use the db-configured sources
-    return $hash;
+
+    # Return a sorted list for easier handling in the client
+    my @sorted_sources;
+    foreach my $zsource (sort keys %$hash) {
+        if ($hash->{$zsource}->{name}) {
+            push @sorted_sources, $hash->{$zsource};
+        }
+    }
+    return \@sorted_sources;
 }