LP#1740537 Transit dialog showing wrong branch
authorBill Erickson <berickxx@gmail.com>
Mon, 30 Apr 2018 18:27:41 +0000 (14:27 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 14 May 2018 12:04:41 +0000 (08:04 -0400)
Always retrieve the latest copy transit from the server when displaying
the copy transit dialog.  This resolves an issue where a just-closed
transit is used instead.

Add a filter to avoid canceled transits.

Make the transit lookup call authoritative, since the transit may have
just been created.

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

index 9fed9ed..d56e3a6 100644 (file)
@@ -863,11 +863,12 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
     service.find_copy_transit = function(evt, params, options) {
         if (angular.isArray(evt)) evt = evt[0];
 
-        if (evt && evt.payload && evt.payload.transit)
-            return $q.when(evt.payload.transit);
+        // NOTE: evt.payload.transit may exist, but it's not necessarily
+        // the transit we want, since a transit close + open in the API
+        // returns the closed transit.
 
          return egCore.pcrud.search('atc',
-            {   dest_recv_time : null},
+            {   dest_recv_time : null, cancel_time : null},
             {   flesh : 1, 
                 flesh_fields : {atc : ['target_copy']},
                 join : {
@@ -880,7 +881,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
                 },
                 limit : 1,
                 order_by : {atc : 'source_send_time desc'}, 
-            }
+            }, {authoritative : true}
         ).then(function(transit) {
             transit.source(egCore.org.get(transit.source()));
             transit.dest(egCore.org.get(transit.dest()));