LP#1708291: tweak to subscription selector collab/gmcharlt/lp1708291-webstaff-serials
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 29 Aug 2017 20:11:13 +0000 (16:11 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 29 Aug 2017 20:11:13 +0000 (16:11 -0400)
When entering the Manage Predictions or Manage Issues tab
and only one subscription is present in the current OU
scope, automatically select it rather than making the operator
have to select it manually.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/serials/directives/sub_selector.js

index 7556046..2918e78 100644 (file)
@@ -24,6 +24,9 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
     function reload() {
         egSerialsCoreSvc.fetch($scope.bibId, $scope.selected_owning_ou).then(function() {
             $scope.subscriptions = egCore.idl.toTypedHash(egSerialsCoreSvc.subTree);
+            if ($scope.subscriptions.length == 1 && !$scope.ssubId) {
+                $scope.ssubId = $scope.subscriptions[0].id;
+            }
         });
     }
 }]