LP#1522635 Webstaff lost (etc.) checkout completes user/berick/lp1522635-webstaff-lost-co-err
authorBill Erickson <berickxx@gmail.com>
Thu, 4 Aug 2016 21:56:32 +0000 (17:56 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 4 Aug 2016 21:56:35 +0000 (17:56 -0400)
Resolves an issue in the browser client where checkout of LOST
(and other non status='checked out' copies) failed to show the
open-circ-exists dialog.  In short, when searching for an existing
open circulation, look for any open circulation linked to the copy,
regardless of the status of the copy.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index e74cc78..dd1974d 100644 (file)
@@ -822,18 +822,12 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog) {
         if (angular.isArray(evt)) evt = evt[0];
 
         if (!evt.payload.old_circ) {
-            return egCore.net.request(
-                'open-ils.search',
-                'open-ils.search.asset.copy.fleshed2.find_by_barcode',
-                params.copy_barcode
-            ).then(function(resp){
-                console.log(resp);
-                if (egCore.evt.parse(resp)) {
-                    console.error(egCore.evt.parse(resp));
-                } else {
-                   evt.payload.old_circ = resp.circulations()[0];
-                   return service.circ_exists_dialog_impl( evt, params, options );
-                }
+            return egCore.pcrud.search('circ',
+                {target_copy : evt.payload.copy.id(), checkin_time : null},
+                {limit : 1} // should only ever be 1
+            ).then(function(old_circ) {
+                evt.payload.old_circ = old_circ;
+               return service.circ_exists_dialog_impl(evt, params, options);
             });
         } else {
             return service.circ_exists_dialog_impl( evt, params, options );