LP#1402797 Add the ability (and action) to uncancel holds
authorMike Rylander <mrylander@gmail.com>
Thu, 30 Oct 2014 14:38:15 +0000 (10:38 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 12 Feb 2015 16:58:26 +0000 (11:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2
Open-ILS/src/templates/staff/circ/holds/t_pull_list.tt2
Open-ILS/src/templates/staff/circ/holds/t_shelf_list.tt2
Open-ILS/src/templates/staff/circ/patron/t_holds_list.tt2
Open-ILS/src/templates/staff/circ/share/t_uncancel_hold_dialog.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/services/holds.js

index b21146d..13d5bf9 100644 (file)
@@ -50,6 +50,8 @@
       label="[% l('Find Another Target') %]"></eg-grid-action>
     <eg-grid-action handler="grid_actions.cancel_hold"
       label="[% l('Cancel Hold') %]"></eg-grid-action>
+    <eg-grid-action handler="grid_actions.uncancel_hold"
+      label="[% l('Uncancel Hold') %]"></eg-grid-action>
 
     <eg-grid-field label="[% l('Hold ID') %]" path='hold.id'></eg-grid-field>
     <eg-grid-field label="[% l('Current Copy') %]" 
index 8cea1d1..33aee3e 100644 (file)
@@ -53,6 +53,8 @@
     label="[% l('Find Another Target') %]"></eg-grid-action>
   <eg-grid-action handler="grid_actions.cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
+  <eg-grid-action handler="grid_actions.uncancel_hold"
+    label="[% l('Uncancel Hold') %]"></eg-grid-action>
 
   <eg-grid-field label="[% l('Hold ID') %]" path='hold.id'></eg-grid-field>
   <eg-grid-field label="[% l('Current Copy') %]" 
index 3700df9..e47f713 100644 (file)
@@ -50,6 +50,8 @@
     label="[% l('Find Another Target') %]"></eg-grid-action>
   <eg-grid-action handler="grid_actions.cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
+  <eg-grid-action handler="grid_actions.uncancel_hold"
+    label="[% l('Uncancel Hold') %]"></eg-grid-action>
 
   <eg-grid-field label="[% l('Hold ID') %]" path='hold.id'></eg-grid-field>
   <eg-grid-field label="[% l('Current Copy') %]" 
index 721a417..c9bdf36 100644 (file)
@@ -39,6 +39,8 @@
     label="[% l('Find Another Target') %]"></eg-grid-action>
   <eg-grid-action handler="grid_actions.cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
+  <eg-grid-action handler="grid_actions.uncancel_hold"
+    label="[% l('Uncancel Hold') %]"></eg-grid-action>
 
   <eg-grid-field label="[% l('Hold ID') %]" path='hold.id'></eg-grid-field>
   <eg-grid-field label="[% l('Current Copy') %]" 
diff --git a/Open-ILS/src/templates/staff/circ/share/t_uncancel_hold_dialog.tt2 b/Open-ILS/src/templates/staff/circ/share/t_uncancel_hold_dialog.tt2
new file mode 100644 (file)
index 0000000..bceb1f7
--- /dev/null
@@ -0,0 +1,17 @@
+<form ng-submit="ok()" role="form" class="form-horizontal">
+  <div class="modal-content">
+    <div class="modal-header">
+      <button type="button" class="close" 
+        ng-click="cancel()" aria-hidden="true">&times;</button>
+      <h4 class="modal-title">
+        [% l('Uncancel [_1] Hold(s)', '{{args.num_holds}}') %]
+      </h4>
+    </div>
+    <div class="modal-body"></div>
+    <div class="modal-footer">
+      <input type="submit" class="btn btn-success" value="[% l('Uncancel Hold') %]"/>
+      <button class="btn btn-warning" ng-click="cancel($event)">[% l('Exit') %]</button>
+    </div>
+  </div>
+</div>
+
index a222018..77e4fb9 100644 (file)
@@ -107,6 +107,49 @@ function($modal , $q , egCore , egUser , egConfirmDialog , egAlertDialog) {
         }).result;
     }
 
+    service.uncancel_holds = function(hold_ids) {
+       
+        return $modal.open({
+            templateUrl : './circ/share/t_uncancel_hold_dialog',
+            controller : 
+                ['$scope', '$modalInstance',
+                function($scope, $modalInstance) {
+                    $scope.args = {
+                        num_holds : hold_ids.length
+                    };
+                    
+                    $scope.cancel = function($event) {
+                        $modalInstance.dismiss();
+                        $event.preventDefault();
+                    }
+
+                    $scope.ok = function() {
+
+                        function uncancel_one() {
+                            var hold_id = hold_ids.pop();
+                            if (!hold_id) {
+                                $modalInstance.close();
+                                return;
+                            }
+                            egCore.net.request(
+                                'open-ils.circ', 'open-ils.circ.hold.uncancel',
+                                egCore.auth.token(), hold_id
+                            ).then(function(resp) {
+                                if (evt = egCore.evt.parse(resp)) {
+                                    console.error('unable to uncancel hold: ' 
+                                        + evt.toString());
+                                }
+                                uncancel_one();
+                            });
+                        }
+
+                        uncancel_one();
+                    }
+                }
+            ]
+        }).result;
+    }
+
     service.get_cancel_reasons = function() {
         if (egCore.env.ahrcc) return $q.when(egCore.env.ahrcc.list);
         return egCore.pcrud.retrieveAll('ahrcc', {}, {atomic : true})