From eab3205d2032e66392bb73aa8d1077caf1f65675 Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Fri, 29 Nov 2019 14:51:06 -0500 Subject: [PATCH] LP#1775276: Check In - "Route To" Field Sometimes Incorrect When open-ils.circ.checkin closes a transit and creates a new one, the payload only returns the closed transit. The route dialogs perform a pcrud search to get the most recent transit, but the grid's Route To field still depends on the transit returned by the API, so received transits display the old destination in the Route To field instead of the shelving location or new destination. This branch returns the most recent route info collected by the route dialog and, if the most recent transit destination doesn't match the old one, the new one is assigned to the route_to prop on the final_resp. It also checks that the transit is open before displaying the destination in the Route To field so the shelving location displays if the most recent transit is closed. To test: 1. Sign in as Library A and check in an item owned by Library B 2. Place a copy hold on the item with a pickup location of Library C 3. Sign in as Library B and check in the item - note the dialog is correct but the grid's Route To field displays Library B instead of Library C 4. Apply patch 5. Repeat steps 1-3, note the Route To field displays Library C Signed-off-by: Dan Briem Signed-off-by: John Amundson Signed-off-by: Jason Stephenson --- .../web/js/ui/default/staff/circ/services/circ.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index 8488021684..e6779e4292 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -359,7 +359,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl data.mbts = payload.parent_circ.billable_transaction().summary(); if (!data.route_to) { - if (data.transit) { + if (data.transit && !data.transit.dest_recv_time() && !data.transit.cancel_time()) { data.route_to = data.transit.dest().shortname(); } else if (data.acp) { data.route_to = data.acp.location().name(); @@ -1595,7 +1595,11 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl return service.route_dialog( './circ/share/t_transit_dialog', evt[0], params, options - ).then(function() { return final_resp }); + ).then(function(data) { + if (transit && data.transit && transit.dest().id() != data.transit.dest().id()) + final_resp.evt[0].route_to = data.transit.dest().shortname(); + return final_resp; + }); case 'ASSET_COPY_NOT_FOUND': egCore.audio.play('error.checkin.not_found'); @@ -1678,7 +1682,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl // do not show the dialog or print if the // disabled automatic print attempt type list includes // the specified template - return; + return data; } // All actions flow from the print data @@ -1727,7 +1731,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl context : 'default', template : template, scope : print_context - }); + }).then(function() { return data }); } // when auto-print is on, skip the dialog and go straight @@ -1757,7 +1761,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl } }] - }).result; + }).result.then(function() { return data }); }); } -- 2.43.2