From: Dan Briem Date: Fri, 17 Feb 2023 17:36:15 +0000 (-0500) Subject: LP#2007073 Staff Should Only Select Manual Hold Cancel Causes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=27ea19796be6475d61f630d41cf6f016000ba238;p=evergreen%2Fpines.git LP#2007073 Staff Should Only Select Manual Hold Cancel Causes Adds a field to action.hold_request_cancel_cause to indicate if they are manual cancel causes. Filters on this field in cancel hold dialogs to only display manual cancel causes. Adds two new cancel causes, Patron via email and Patron via SMS. Signed-off-by: Dan Briem Signed-off-by: Susan Morrison Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 916958b2df..63353a3704 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -8895,6 +8895,7 @@ SELECT usr, + diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/cancel-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/cancel-dialog.component.ts index 7927bceb80..1591bd66f9 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/cancel-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/cancel-dialog.component.ts @@ -53,8 +53,10 @@ export class HoldCancelDialogComponent if (this.cancelReasons.length === 0) { this.pcrud.retrieveAll('ahrcc', {}, {atomic: true}).toPromise() .then(reasons => { - this.cancelReasons = - reasons.map(r => ({id: r.id(), label: r.label()})); + this.cancelReasons = reasons + // only display reasons for manually canceling holds + .filter(r => 't' === r.manual()) + .map(r => ({id: r.id(), label: r.label()})); }); } diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 90518414d2..5a86cd3353 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -449,7 +449,8 @@ CREATE TRIGGER action_circulation_stop_fines_tgr CREATE TABLE action.hold_request_cancel_cause ( id SERIAL PRIMARY KEY, - label TEXT UNIQUE + label TEXT UNIQUE, + manual BOOL NOT NULL DEFAULT FALSE ); CREATE TABLE action.hold_request ( diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 9cd8aba5a5..346c273411 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2926,13 +2926,15 @@ INSERT INTO asset.call_number VALUES (-1,1,NOW(),1,NOW(),-1,1,'UNCATALOGED'); --090.schema.action.sql INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (1, oils_i18n_gettext(1, 'Untargeted expiration', 'ahrcc', 'label')); -INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (2, oils_i18n_gettext(2, 'Hold Shelf expiration', 'ahrcc', 'label')); -INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (3, oils_i18n_gettext(3, 'Patron via phone', 'ahrcc', 'label')); -INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (4, oils_i18n_gettext(4, 'Patron in person', 'ahrcc', 'label')); -INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (5, oils_i18n_gettext(5, 'Staff forced', 'ahrcc', 'label')); +INSERT INTO action.hold_request_cancel_cause (id,label,manual) VALUES (2, oils_i18n_gettext(2, 'Hold Shelf expiration', 'ahrcc', 'label'), TRUE); +INSERT INTO action.hold_request_cancel_cause (id,label,manual) VALUES (3, oils_i18n_gettext(3, 'Patron via phone', 'ahrcc', 'label'), TRUE); +INSERT INTO action.hold_request_cancel_cause (id,label,manual) VALUES (4, oils_i18n_gettext(4, 'Patron in person', 'ahrcc', 'label'), TRUE); +INSERT INTO action.hold_request_cancel_cause (id,label,manual) VALUES (5, oils_i18n_gettext(5, 'Staff forced', 'ahrcc', 'label'), TRUE); INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (6, oils_i18n_gettext(6, 'Patron via OPAC', 'ahrcc', 'label')); INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (7, oils_i18n_gettext(7, 'Patron via SIP', 'ahrcc', 'label')); INSERT INTO action.hold_request_cancel_cause (id,label) VALUES (8, oils_i18n_gettext(8, 'Hold Group Event rollback', 'ahrcc', 'label')); +INSERT INTO action.hold_request_cancel_cause (id,label,manual) VALUES (9, oils_i18n_gettext(9, 'Patron via email', 'ahrcc', 'label'), TRUE); +INSERT INTO action.hold_request_cancel_cause (id,label,manual) VALUES (10, oils_i18n_gettext(10, 'Patron via SMS', 'ahrcc', 'label'), TRUE); SELECT SETVAL('action.hold_request_cancel_cause_id_seq', 100); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action.hold_request_cancel_cause.manual.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action.hold_request_cancel_cause.manual.sql new file mode 100644 index 0000000000..a80576c055 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.action.hold_request_cancel_cause.manual.sql @@ -0,0 +1,20 @@ +BEGIN; + +ALTER TABLE action.hold_request_cancel_cause + ADD COLUMN manual BOOL NOT NULL DEFAULT FALSE; + +UPDATE action.hold_request_cancel_cause SET manual = TRUE + WHERE id IN ( + 2, -- Hold Shelf expiration + 3, -- Patron via phone + 4, -- Patron in person + 5 -- Staff forced + ); + +INSERT INTO action.hold_request_cancel_cause (id, label, manual) + VALUES (9, oils_i18n_gettext(9, 'Patron via email', 'ahrcc', 'label'), TRUE); + +INSERT INTO action.hold_request_cancel_cause (id, label, manual) + VALUES (10, oils_i18n_gettext(10, 'Patron via SMS', 'ahrcc', 'label'), TRUE); + +COMMIT; diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js index 251ceb216e..fbad441f14 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js @@ -116,7 +116,12 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) { ], resolve : { cancel_reasons : function() { - return service.get_cancel_reasons(); + return service.get_cancel_reasons().then(function(reasons) { + // only display reasons for manually canceling holds + return reasons.filter(function(r) { + return 't' === r.manual(); + }); + }); } } }).result;