From 4449cbe2a3cc0cbd9e72795a8e16ba3c13f59236 Mon Sep 17 00:00:00 2001 From: jeremy breuillard Date: Mon, 9 May 2022 11:42:55 +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 | 12 +++++++++++ .../bootstrap/en/modules/sco/sco-main.tt | 10 ++++++++++ opac/sco/sco-main.pl | 5 +++++ 5 files changed, 49 insertions(+) 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 0000000000..fca18ecbb9 --- /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 9a5cb2e0a8..b516b5330f 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -615,6 +615,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RoutingListNote','To change this note edit RoutingListNote system preference.','70|10','Define a note to be shown on all routing lists','Textarea'), ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','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'), ('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'), ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded