From 354b5aa9176036142a029bfd7780b0769fe59e20 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 --- 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 41b44bc7f8..e149c5be75 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -432,8 +432,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 b3dae13860..d61cfa25ed 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 f49557be9c..13d62f17f8 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 d8497227a8..b64de9c35d 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 @@ -1095,6 +1095,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.2