webstaff: have Quick Receive make operator select subscription rather than OU
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 30 Jun 2017 20:39:21 +0000 (16:39 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 30 Jun 2017 20:39:21 +0000 (16:39 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/cat/catalog/index.tt2
Open-ILS/src/templates/staff/share/t_subscription_select_dialog.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index f517879..50a1f8f 100644 (file)
@@ -11,7 +11,9 @@
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/tagtable.js"></script>
 [% INCLUDE 'staff/serials/share/serials_strings.tt2' %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/serials/app.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/serials/services/core.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/serials/directives/sub_selector.js"></script>
 [% INCLUDE 'staff/cat/share/marcedit_strings.tt2' %]
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/marcedit.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/circ/services/circ.js"></script>
@@ -51,8 +53,8 @@
     s.MARK_OVERLAY_TARGET =                                                                                                            
       "[% l('Record Overlay Target set') %]";                
 
-    s.SERIALS_NO_SUBS = "[% l('No subscriptions at the selected library') %]";
-    s.SERIALS_NO_ITEMS = "[% l('No items at the selected library') %]";
+    s.SERIALS_NO_SUBS = "[% l('No subscription selected') %]";
+    s.SERIALS_NO_ITEMS = "[% l('No items expected for the selected subscription') %]";
 
     s.SERIALS_ISSUANCE_FAIL_SAVE = "[% l('Failed to save issuance') %]";
     s.SERIALS_ISSUANCE_SUCCESS_SAVE = "[% l('Issuance saved') %]";
diff --git a/Open-ILS/src/templates/staff/share/t_subscription_select_dialog.tt2 b/Open-ILS/src/templates/staff/share/t_subscription_select_dialog.tt2
new file mode 100644 (file)
index 0000000..eeea5d8
--- /dev/null
@@ -0,0 +1,22 @@
+<!--
+  Org selection interstitial
+-->
+<div>
+  <div class="modal-header">
+    <button type="button" class="close" 
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title alert alert-info">{{ title || '[% l('Select subscription') %]'}}</h4> 
+  </div>
+  <div class="modal-body">
+    <div class="row">
+      <div class="col-md-12">
+       <eg-sub-selector bib-id="record_id" ssub-id="ssubId"></eg-sub-selector>
+      </div>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <input type="submit" class="btn btn-primary" 
+      ng-click="ok()" value="[% l('OK/Continue') %]"/>
+    <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+  </div>
+</div>
index 1fa43f0..f6b813b 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 
-angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast', 'egSerialsMod'])
+angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast', 'egSerialsMod', 'egSerialsAppDep'])
 
 .config(['ngToastProvider', function(ngToastProvider) {
   ngToastProvider.configure({
@@ -369,58 +369,53 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
         var list = [];
         var next_per_stream = {};
 
+        var recId = $scope.record_id;
         return $uibModal.open({
-            templateUrl: './share/t_org_select_dialog',
+            templateUrl: './share/t_subscription_select_dialog',
             controller: ['$scope', '$uibModalInstance',
                 function($scope, $uibModalInstance) {
 
                     $scope.focus = true;
                     $scope.rememberMe = 'eg.serials.quickreceive.last_org';
+                    $scope.record_id = recId;
+                    $scope.ssubId = null;
 
-                    $scope.ok = function() { $uibModalInstance.close($scope.ws_ou.id()) }
+                    $scope.ok = function() { $uibModalInstance.close($scope.ssubId) }
                     $scope.cancel = function() { $uibModalInstance.dismiss(); }
                 }
             ]
-        }).result.then(function(org) {
-            if (org) {
-                return egSerialsCoreSvc.fetch($scope.record_id, egCore.org.descendants(org, true)).then(function(sub_list){
-                    if (!sub_list.length) {
-                        ngToast.warning(egCore.strings.SERIALS_NO_SUBS);
-                        return $q.reject();
-                    }
-
-                    var promises = [];
-                    angular.forEach(sub_list, function (sub) {
-                        promises.push(egSerialsCoreSvc.fetchItemsForSub(sub.id(),{status:'Expected'}).then(function(){
-                            angular.forEach(egSerialsCoreSvc.itemTree, function (item) {
-                                if (next_per_stream[item.stream().id()]) return;
-                                if (item.status() == 'Expected') {
-                                    next_per_stream[item.stream().id()] = item;
-                                    list.push(egCore.idl.Clone(item));
-                                }
-                            });
-                        }));
+        }).result.then(function(ssubId) {
+            if (ssubId) {
+                var promises = [];
+                promises.push(egSerialsCoreSvc.fetchItemsForSub(ssubId,{status:'Expected'}).then(function(){
+                    angular.forEach(egSerialsCoreSvc.itemTree, function (item) {
+                        if (next_per_stream[item.stream().id()]) return;
+                        if (item.status() == 'Expected') {
+                            next_per_stream[item.stream().id()] = item;
+                            list.push(egCore.idl.Clone(item));
+                        }
                     });
+                }));
 
-                    return $q.all(promises).then(function() {
+                return $q.all(promises).then(function() {
 
-                        if (!list.length) {
-                            ngToast.warning(egCore.strings.SERIALS_NO_ITEMS);
-                            return $q.reject();
-                        }
+                    if (!list.length) {
+                        ngToast.warning(egCore.strings.SERIALS_NO_ITEMS);
+                        return $q.reject();
+                    }
 
-                        return egSerialsCoreSvc.process_items(
-                            'receive',
-                            $scope.record_id,
-                            list,
-                            true, // barcode
-                            false,// bind
-                            false, // print by default
-                            function() { $scope.holdings_record_id_changed($scope.record_id) }
-                        );
-                    });
+                    return egSerialsCoreSvc.process_items(
+                        'receive',
+                        $scope.record_id,
+                        list,
+                        true, // barcode
+                        false,// bind
+                        false, // print by default
+                        function() { $scope.holdings_record_id_changed($scope.record_id) }
+                    );
                 });
             } else {
+                ngToast.warning(egCore.strings.SERIALS_NO_SUBS);
                 return $q.reject();
             }
         });