From 8eea84211b439453b6423c0415a7ea099ddbcdce Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 23 Feb 2018 16:54:51 -0500 Subject: [PATCH] LP#1676608: inject copy alert dialog in two more places The copy alert dialog (if an item has relevant copy alerts) is now injected into the dialog box series when handling checkouts of items that are in transit or where the patron record has overridable conditions that would block the checkout. Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- .../web/js/ui/default/staff/circ/services/circ.js | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 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 91ad8fb9b4..f349f6c2ac 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 @@ -365,7 +365,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl switch(evt[0].textcode) { case 'COPY_NOT_AVAILABLE': - return service.copy_not_avail_dialog(evt[0], params, options); + return service.copy_not_avail_dialog(evt, params, options); case 'COPY_ALERT_MESSAGE': return service.copy_alert_dialog(evt[0], params, options, 'checkout'); default: @@ -718,6 +718,13 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl if (!angular.isArray(evt)) evt = [evt]; egCore.audio.play('warning.circ.event_override'); + var copy_alert = evt.filter(function(e) { + return e.textcode == 'COPY_ALERT_MESSAGE'; + }); + evt = evt.filter(function(e) { + return e.textcode !== 'COPY_ALERT_MESSAGE'; + }); + return $uibModal.open({ templateUrl: './circ/share/t_event_override_dialog', backdrop: 'static', @@ -740,6 +747,10 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl function() { options.override = true; + if (copy_alert.length > 0) { + return service.copy_alert_dialog(copy_alert, params, options, action); + } + if (action == 'checkin') { return service.checkin(params, options); } @@ -756,7 +767,16 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl } service.copy_not_avail_dialog = function(evt, params, options) { - if (angular.isArray(evt)) evt = evt[0]; + if (!angular.isArray(evt)) evt = [evt]; + + var copy_alert = evt.filter(function(e) { + return e.textcode == 'COPY_ALERT_MESSAGE'; + }); + evt = evt.filter(function(e) { + return e.textcode !== 'COPY_ALERT_MESSAGE'; + }); + evt = evt[0]; + return $uibModal.open({ templateUrl: './circ/share/t_copy_not_avail_dialog', backdrop: 'static', @@ -776,6 +796,11 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl }).result.then( function() { options.override = true; + + if (copy_alert.length > 0) { + return service.copy_alert_dialog(copy_alert, params, options, 'checkout'); + } + return service.checkout(params, options); } ); -- 2.11.0