From 5b53140aec3a9f3fe4828c4bbd0f35949c752da1 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 3 Dec 2024 22:52:47 +0000 Subject: [PATCH] Bug 38615: Add ability to set hold cancellation request via SIP To test: 1. APPLY PATCH, updatedatabase, restart_all 2. Search for the new system preference HoldCancellationRequestSIP, it should be set to 'Don't'. Leave it as is. 3. Make some holds, either in the staff client of via SIP. -/kohadevbox/koha/misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m hold --patron 23529000035676 --item 39999000001310 --hold-mode + 4. Mark the hold as waiting. 5. Cancel it via SIP: -/kohadevbox/koha/misc/sip_cli_emulator.pl -a localhost -p 6001 -l CPL -su term1 -sp term1 -m hold --patron 23529000035676 --item 39999000001310 --hold-mode - 6. The hold is cancelled like normal, the screen msg should be "Hold Cancelled." 7. Change HoldCancellationRequestSIP to 'Do'. 8. Do steps 3-5 again. 9. Now the screen message is 'Hold Cancellation Requested.' 10. Now check Holds awaiting pickup. In the "Holds with cancellation requests" tab you should now see the hold from step 8. Signed-off-by: Brendan Lawlor Signed-off-by: Martin Renvoize --- C4/SIP/ILS.pm | 7 +++++-- C4/SIP/ILS/Transaction/Hold.pm | 7 ++++++- installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 751cd5906e5..8fdfc473408 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -471,8 +471,11 @@ sub cancel_hold { last; # ?? should we keep going, in case there are multiples } } - - $trans->screen_msg("Hold Cancelled."); + if ( C4::Context->preference('HoldCancellationRequestSIP') ) { + $trans->screen_msg("Hold Cancellation Requested."); + } else { + $trans->screen_msg("Hold Cancelled."); + } return $trans; } diff --git a/C4/SIP/ILS/Transaction/Hold.pm b/C4/SIP/ILS/Transaction/Hold.pm index 20a4d0f77a9..f2aeaff8dbd 100644 --- a/C4/SIP/ILS/Transaction/Hold.pm +++ b/C4/SIP/ILS/Transaction/Hold.pm @@ -94,8 +94,13 @@ sub drop_hold { my $holds = $item->holds->search( { borrowernumber => $patron->borrowernumber } ); return $self unless $holds->count; + my $hold = $holds->next; - $holds->next->cancel; + if ( C4::Context->preference('HoldCancellationRequestSIP') ) { + $hold->add_cancellation_request; + } else { + $hold->cancel; + } $self->ok(1); return $self; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index c4bb3ca9a7d..f9e2c643a1f 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -300,6 +300,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('HidePatronName','0','','If this is switched on, patron\'s cardnumber will be shown instead of their name on the holds and catalog screens','YesNo'), ('HidePersonalPatronDetailOnCirculation', 0, '', 'Hide patrons phone number, email address, street address and city in the circulation page','YesNo'), ('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'), +('HoldCancellationRequestSIP','0','','Option to set holds cancelled via SIP as cancelation requests','YesNo'), ('HoldFeeMode','not_always','any_time_is_placed|not_always|any_time_is_collected','Set the hold fee mode','Choice'), ('HoldRatioDefault','3','','Default value for the hold ratio report','Integer'), ('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index e380c2fa0e8..291c6ccec6b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1100,6 +1100,12 @@ Circulation: 1: "Do" 0: "Don't" - place a hold when ordering from a suggestion. + - + - pref: HoldCancellationRequestSIP + choices: + 1: "Do" + 0: "Don't" + - set holds cancelled via SIP as cancellation requests. Patron restrictions: - - pref: PatronRestrictionTypes -- 2.48.1