From 057783b0810df535f2085ffb92c7de88e64aff34 Mon Sep 17 00:00:00 2001
From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Tue, 2 Mar 2010 18:39:36 +0000
Subject: [PATCH] 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
---
 Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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;
 }
 
 
-- 
2.11.0