LP1787636: Sort Libraries without Holdings In Holdings View
authorDaniel Pearl <dpearl@cwmars.org>
Wed, 13 Mar 2019 14:07:17 +0000 (10:07 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Fri, 1 May 2020 17:55:51 +0000 (13:55 -0400)
Empty libraries in holdings view are listed at the end of the library
list instead of integrated within the list.  This patch sorts them
within the list.

Signed-off-by: Daniel Pearl <dpearl@cwmars.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2
Open-ILS/web/js/ui/default/staff/cat/services/holdings.js

index 4223d43..4e7106e 100644 (file)
@@ -1,7 +1,7 @@
 
 <div>
   <div class="row">
-    <div class="col-md-3">
+    <div class="col-md-4">
       <div class="input-group">
         <span class="input-group-addon">[% l('Show holdings at or below') %]</span>
         <eg-org-selector selected="holdings_ou" onchange="holdings_ou_changed" sticky-setting="cat.holdings_view_ou"></eg-org-selector>
index 73c91a3..aeae4b9 100644 (file)
@@ -88,6 +88,43 @@ function(egCore , $q) {
                     }
                 });
 
+                if (empty_org) {
+
+                    var empty_org_list = [];
+                    angular.forEach(svc.org_use_map,function(v,k){
+                        if (v == 0) empty_org_list.push(k);
+                    });
+
+                    angular.forEach(empty_org_list, function (oid) {
+                        var owner = egCore.org.get(oid);
+                        if (owner.ou_type().can_have_vols() != 't') return;
+
+                        var owner_list = [];
+                        while (owner.parent_ou()) { // we're going to skip the top of the tree...
+                            owner_list.unshift(owner.shortname());
+                            owner = egCore.org.get(owner.parent_ou());
+                        }
+
+                        var owner_label = owner_list.join(' ... ');
+
+                        svc.copies.push({
+                            index      : index++,
+                            id_list    : [],
+                            call_number: { label : '' },
+                            barcode    : '',
+                            owner_id   : oid,
+                            owner_list : owner_list,
+                            owner_label: owner_label,
+                            copy_count : 0,
+                            cn_count   : 0,
+                            copy_alert_count : 0
+                        });
+                    });
+                }
+
+                svc.ongoing = false;
+
+
                 svc.copies = svc.copies.sort(
                     function (a, b) {
                         function compare_array (x, y, i) {
@@ -277,40 +314,6 @@ function(egCore , $q) {
                     }
                 }
 
-                if (empty_org) {
-
-                    var empty_org_list = [];
-                    angular.forEach(svc.org_use_map,function(v,k){
-                        if (v == 0) empty_org_list.push(k);
-                    });
-
-                    angular.forEach(empty_org_list, function (oid) {
-                        var owner = egCore.org.get(oid);
-                        if (owner.ou_type().can_have_vols() != 't') return;
-
-                        var owner_list = [];
-                        while (owner.parent_ou()) { // we're going to skip the top of the tree...
-                            owner_list.unshift(owner.shortname());
-                            owner = egCore.org.get(owner.parent_ou());
-                        }
-
-                        var owner_label = owner_list.join(' ... ');
-
-                        new_list.push({
-                            index      : index++,
-                            id_list    : [],
-                            call_number: { label : '' },
-                            barcode    : '',
-                            owner_id   : oid,
-                            owner_list : owner_list,
-                            owner_label: owner_label,
-                            copy_count : 0,
-                            cn_count   : 0,
-                            copy_alert_count : 0
-                        });
-                    });
-                }
-
                 svc.copies = new_list;
                 svc.ongoing = false;
             },