Bugzilla – Attachment 180751 Details for
Bug 34326
Add forbidden notforloan status
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34326: (follow-up) Add forbidden notforloan status option
Bug-34326-follow-up-Add-forbidden-notforloan-statu.patch (text/plain), 5.72 KB, created by
Marion Durand
on 2025-04-10 07:33:27 UTC
(
hide
)
Description:
Bug 34326: (follow-up) Add forbidden notforloan status option
Filename:
MIME Type:
Creator:
Marion Durand
Created:
2025-04-10 07:33:27 UTC
Size:
5.72 KB
patch
obsolete
>From 978399ee0d3bcab9fb9ba7f630327e3239365916 Mon Sep 17 00:00:00 2001 >From: Marion Durand <marion.durand@biblibre.com> >Date: Wed, 9 Apr 2025 13:09:14 +0000 >Subject: [PATCH] Bug 34326: (follow-up) Add forbidden notforloan status option > >Add a SIP option to prevent the checkin of items if they have a special status. > >The follow-up fixes a bug where SIP reported a failed checkin even if the >checkin was correctly done by Koha. > >Test plan (assuming ktd) >0- Apply the patch, restart services (restart_all with KTD) (no need to update database) > >1- checkout 4 items to a single patron >In the following example I used barcode 3999900000017, 3999900000018, >3999900000019 and 3999900000020 and the patron cardnumber 23529000035676 > >2- Update these items notforloan value ($7 in marc21, $o in unimarc) with 3 >different not for loan status and an empty not for loan status > >In the following example I used >3999900000017 notforloan = 1 "Not for loan" >3999900000018 notforloan = 2 "Staff collection" >3999900000019 notforloan = 3 "Added to bundle" >3999900000020 notforloan is empty > >3- Edit file /etc/koha/sites/kohadev/SIPconfig.xml >Add to one of the login the parameter "forbidden_notforloan_status"" with two >different notforloan status previously used > >In the following example I used ><login id="term1" password="term1" delimiter="|" error-detect="enabled" >institution="CPL" encoding="ascii" checked_in_ok="1" >forbidden_notforloan_status="1,2" /> > >4- restart sip (in KTD "sudo koha-sip --stop kohadev" then "sudo koha-sip >--start kohadev") > >5- checkin the first two items with sip_cli_emulator (the ones with the >forbidden notforloan status). The checkin should fail (response starts with >100), a screen message (AF field) is added to explain and these items should >still be checked out to the patron in the interface > >/kohadevbox/koha/misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su=term1 >-sp=term1 -l=CPL -m=checkin --patron=23529000035676 --item=3999900000017 > >/kohadevbox/koha/misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su=term1 >-sp=term1 -l=CPL -m=checkin --patron=23529000035676 --item=3999900000018 > >6- checkin the last two items with sip_cli_emulator (the one with the allowed >notforloan status and the one without any notforloan status). The checkin >should succeed (response starts with 101) and these items should not appear in >the checked out items to the patron in the interface. > >/kohadevbox/koha/misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su=term1 >-sp=term1 -l=CPL -m=checkin --patron=23529000035676 --item=3999900000019 > >/kohadevbox/koha/misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su=term1 >-sp=term1 -l=CPL -m=checkin --patron=23529000035676 --item=3999900000020 >--- > C4/SIP/ILS/Transaction/Checkin.pm | 39 ++++++++++++++++--------------- > 1 file changed, 20 insertions(+), 19 deletions(-) > >diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm >index 05e730e2f2..2de2b9f4bc 100644 >--- a/C4/SIP/ILS/Transaction/Checkin.pm >+++ b/C4/SIP/ILS/Transaction/Checkin.pm >@@ -51,11 +51,11 @@ sub do_checkin { > my $return_date = shift; > my $account = shift; > >- my $checked_in_ok = $account->{checked_in_ok}; >- my $cv_triggers_alert = $account->{cv_triggers_alert}; >- my $holds_block_checkin = $account->{holds_block_checkin}; >- my $holds_get_captured = $account->{holds_get_captured} // 1; >- my @forbidden_notforloan_status = split(",",$account->{forbidden_notforloan_status}); >+ my $checked_in_ok = $account->{checked_in_ok}; >+ my $cv_triggers_alert = $account->{cv_triggers_alert}; >+ my $holds_block_checkin = $account->{holds_block_checkin}; >+ my $holds_get_captured = $account->{holds_get_captured} // 1; >+ my @forbidden_notforloan_status = split( ",", $account->{forbidden_notforloan_status} ); > > if ( !$branch ) { > $branch = 'SIP2'; >@@ -95,32 +95,33 @@ sub do_checkin { > > my $checkin_blocked_by_holds = $holds_block_checkin && $reserved; > >- ( $return, $messages, $issue, $borrower ) = AddReturn( $barcode, $branch, undef, $return_date ) >- unless $human_required || $checkin_blocked_by_holds; >- >- if ($checked_in_ok) { >- delete $messages->{ItemLocationUpdated}; >- delete $messages->{NotIssued}; >- delete $messages->{LocalUse}; >- $return = 1 unless keys %$messages; >- } >- >- if (@forbidden_notforloan_status) { >+ my $checkin_blocked_by_notforloan_status = 0; >+ if (@forbidden_notforloan_status) { > my @results = grep { $_ == $item->notforloan } @forbidden_notforloan_status; > if (@results) { >- my $notforloan_desc = >- Koha::AuthorisedValues->get_description_by_koha_field( >+ $checkin_blocked_by_notforloan_status = 1; >+ my $notforloan_desc = Koha::AuthorisedValues->get_description_by_koha_field( > { > kohafield => 'items.notforloan', > authorised_value => $item->notforloan > } >- ); >+ ); > my $f_status = $item->notforloan; > $f_status .= "-$notforloan_desc->{lib}" if $notforloan_desc->{lib}; > $messages->{ForbiddenNotForLoanStatus} = $f_status; > } > } > >+ ( $return, $messages, $issue, $borrower ) = AddReturn( $barcode, $branch, undef, $return_date ) >+ unless $human_required || $checkin_blocked_by_holds || $checkin_blocked_by_notforloan_status; >+ >+ if ($checked_in_ok) { >+ delete $messages->{ItemLocationUpdated}; >+ delete $messages->{NotIssued}; >+ delete $messages->{LocalUse}; >+ $return = 1 unless keys %$messages; >+ } >+ > # biblionumber, biblioitemnumber, itemnumber > # borrowernumber, reservedate, branchcode > # cancellationdate, found, reservenotes, priority, timestamp >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34326
:
153756
|
180741
|
180750
|
180751
|
180819
|
180820
|
181003
|
181004