Sort Z39.50 sources as returned by fetch_service_defs() for a better UX
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Mar 2010 18:39:36 +0000 (18:39 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Mar 2010 18:39:36 +0000 (18:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15655 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm

index 27362a9..aeab20e 100755 (executable)
@@ -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;
 }