Trying pcrud search and deferred.notify().
authorJason Stephenson <jason@sigio.com>
Sun, 21 Oct 2018 11:55:23 +0000 (07:55 -0400)
committerJason Stephenson <jason@sigio.com>
Fri, 26 Oct 2018 23:04:56 +0000 (19:04 -0400)
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index c9985e3..212e1a6 100644 (file)
@@ -1414,23 +1414,35 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,  egAddCopyAl
 
         function get_status(id) {
             var deferred = $q.defer()
-            egCore.pcrud.retrieve('ccs', id, {atomic: true})
+            egCore.pcrud.search('ccs', ids)
                 .then(function(resp) {
-                    deferred.resolve(resp)
+                    deferred.resolve(resp);
+                }, function(resp) {
+                    deferred.reject(resp);
+                }, function(resp) {
+                    deferred.notify(resp);
                 });
             return deferred.promise;
         }
 
-        var promise = get_status(markstatus);
-        return promise.then(function(newStatus) {
+        var newStatus, oldStatus;
+        var promise = get_status([markstatus,copy['status.id']]);
+        return promise.then(function(resp) {
             return egConfirmDialog.open(
-                'Status',
-                newStatus.name(),
+                'Mark Item ' + newStatus.name(),
+                'From ' + oldStatus.name(),
                 {
                     ok : function() {},
                     cancel : function() {}
                 }
             ).result;
+        }, function(resp) {
+            /* noop */
+        }, function(resp) {
+            if (resp.id() == markstatus)
+                newStatus = resp;
+            else
+                olStatus = resp;
         });
     }