From 11d4dd742c6e1ab33097ee37e035357702b2e637 Mon Sep 17 00:00:00 2001 From: Jeremy Breuillard Date: Mon, 29 Jul 2024 11:58:16 +0200 Subject: [PATCH] Bug 31521: Configure behaviour when checking in a reserved item at SCO This patch adds a system preference (SCOCheckinIfReservedBehaviour) which allow to control the behaviour of SCO checkin when the returned item is reserved: - allow checkin (current behaviour) - allow checkin and show a message - forbid checkin and show a message The message is configurable is another system preference (SCOCheckinIfReservedMessage) Test plan: 1. Apply patch, run updatedatabase.pl and restart koha 2. Enable WebBasedSelfCheck and SCOAllowCheckin 3. (Staff) Set SCOCheckinIfReservedBehaviour to "Forbid checkin & show message" 4. (Staff) Write some text in SCOCheckinIfReservedMessage 5. (Staff) Checkout an item I to patron A 6. (Staff) Place a hold on item I for patron B 7. (SCO) Log in to SCO with patron A 8. (SCO) Try to return item I The configured message should be displayed and item I should still be checked out 9. (Staff) Set SCOCheckinIfReservedBehaviour to "Allow checkin & show message" 10. (SCO) Try to return item I The configured message should be displayed and item I should have been checked in 11. (Staff) Checkout item I to patron A again 12. (Staff) Set SCOCheckinIfReservedBehaviour to "Allow checkin" 13. (SCO) Try to return item I The configured message should NOT be displayed and item I should have been checked in --- .../data/mysql/atomicupdate/bug-31521.pl | 20 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 ++ .../admin/preferences/circulation.pref | 15 +++++++++++++- .../bootstrap/en/modules/sco/sco-main.tt | 12 +++++++++++ opac/sco/sco-main.pl | 6 ++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug-31521.pl diff --git a/installer/data/mysql/atomicupdate/bug-31521.pl b/installer/data/mysql/atomicupdate/bug-31521.pl new file mode 100644 index 0000000..fca18ec --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-31521.pl @@ -0,0 +1,20 @@ +use Modern::Perl; + +return { + bug_number => "31521", + description => "Add sysprefs SCOCheckinIfReservedBehaviour and SCOCheckinIfReservedMessage", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) + VALUES ('SCOCheckinIfReservedMessage','', NULL,'Message to display if SCOCheckinIfReservedBehaviour is "Alert" or "Forbid"','Free') + }); + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`, `value`,`options`,`explanation`, `type`) + VALUES ('SCOCheckinIfReservedBehaviour', 'Allow', 'Allow|Alert|Forbid', 'Behaviour of SCO checkin when the returned item is reserved', 'Choice') + }); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 94acbe3..e96a8f0 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -684,6 +684,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'), ('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'), ('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'), +('SCOCheckinIfReservedMessage','', NULL,'Message to display if SCOCheckinIfReservedBehaviour is "Alert" or "Forbid"','Free'), +('SCOCheckinIfReservedBehaviour', 'Allow', 'Allow|Alert|Forbid', 'Behaviour of SCO checkin when the returned item is reserved', 'Choice'), ('SCOBatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch while logged into Self Checkout','Free'), ('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'), ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded