From 85e05fcdefcdf64b6351f815e7efe36f78c177fe 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 --- 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 751cd5906e..8fdfc47340 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 20a4d0f77a..f2aeaff8db 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 682b9fb950..b39aa4da16 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -299,6 +299,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('hidelostitems','0','','If ON, disables display of\"lost\" items in OPAC.','YesNo'), ('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'), +('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 7192181ea4..06d6c34384 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.39.5