From edf5efafd04444de2ffae7f9a288b160c4948dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Wed, 17 Feb 2021 16:20:28 +0200 Subject: [PATCH] Bug 25690: Make CanBookBeIssued return In Processing state as needing confirmation This prevents checking out to a patron an item with hold to someone else in the In Processing state via staff interface. The checkout error message via SIP is now a more clearer one: "Item is on hold for another patron." Before it was "Item cannot be issued: $confirmation". The branch transfer and batch checkout pages are adapted to this new confirmation message as well. To test: 1) Create bib level hold to an item for patron A 2) Check-in that item via SIP2, now the hold state should be "In Processing" 3) Apply patch 4) Try to checkout the item to patron B via staff interface and notice we get now confirmation prompt do we really want to do it. --- C4/Circulation.pm | 11 +++++++++++ C4/SIP/ILS/Transaction/Checkout.pm | 4 +++- circ/branchtransfers.pl | 11 +++++------ circ/circulation.pl | 2 +- .../intranet-tmpl/prog/en/modules/circ/branchtransfers.tt | 2 +- .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 15 ++++++++++++++- .../prog/en/modules/circ/circulation_batch_checkouts.tt | 5 ++++- 7 files changed, 39 insertions(+), 11 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index ffbb4f1bea..8db1b99b6b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1146,6 +1146,17 @@ sub CanBookBeIssued { $needsconfirmation{'resreservedate'} = $res->{reservedate}; $needsconfirmation{'reserve_id'} = $res->{reserve_id}; } + elsif ( $restype eq "Processing" ) { + # The item is determined hold being processed for someone else. + $needsconfirmation{PROCESSED} = 1; + $needsconfirmation{'resfirstname'} = $patron->firstname; + $needsconfirmation{'ressurname'} = $patron->surname; + $needsconfirmation{'rescardnumber'} = $patron->cardnumber; + $needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; + $needsconfirmation{'resbranchcode'} = $patron->branchcode; + $needsconfirmation{'resreservedate'} = $res->{reservedate}; + $needsconfirmation{'reserve_id'} = $res->{reserve_id}; + } } } } diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index dcbb83a39c..0b0ba81239 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -70,7 +70,9 @@ sub do_checkout { } elsif ($confirmation eq 'RESERVED' and !C4::Context->preference("AllowItemsOnHoldCheckoutSIP")) { $self->screen_msg("Item is reserved for another patron upon return."); $noerror = 0; - } elsif ($confirmation eq 'RESERVE_WAITING' or $confirmation eq 'TRANSFERRED') { + } elsif ($confirmation eq 'RESERVE_WAITING' + or $confirmation eq 'TRANSFERRED' + or $confirmation eq 'PROCESSED') { $debug and warn "Item is on hold for another patron."; $self->screen_msg("Item is on hold for another patron."); $noerror = 0; diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index a63d7453cf..ccd4cff011 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -176,13 +176,11 @@ if ($found) { if ( $res->{'ResFound'} eq "Waiting" ) { $waiting = 1; - } - - if ( $res->{'ResFound'} eq "Transferred" ) { + } elsif ( $res->{'ResFound'} eq "Transferred" ) { $hold_transferred = 1; - } - - elsif ( $res->{'ResFound'} eq "Reserved" ) { + } elsif ( $res->{'ResFound'} eq "Processing" ) { + $hold_processed = 1; + } elsif ( $res->{'ResFound'} eq "Reserved" ) { $reserved = 1; $biblionumber = $res->{'biblionumber'}; } @@ -225,6 +223,7 @@ $template->param( reserved => $reserved, waiting => $waiting, transferred => $hold_transferred, + processed => $hold_processed, borrowernumber => $borrowernumber, itemnumber => $itemnumber, barcode => $barcode, diff --git a/circ/circulation.pl b/circ/circulation.pl index 9923f42f74..eef2d2f1a1 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -422,7 +422,7 @@ if (@$barcodes) { } } - if ($question->{RESERVE_WAITING} or $question->{RESERVED} or $question->{TRANSFERRED}){ + if ($question->{RESERVE_WAITING} or $question->{RESERVED} or $question->{TRANSFERRED} or $question->{PROCESSING}){ $template->param( reserveborrowernumber => $question->{'resborrowernumber'}, reserve_id => $question->{reserve_id}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 9b563c86b8..89a7f6d496 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -50,7 +50,7 @@ - [% IF ( waiting or transferred ) %] + [% IF ( waiting or transferred or processed ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index f91ef45cf1..a71fb2873c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -126,6 +126,10 @@
  • Item [% getTitleMessageIteminfo | html %] ([% getBarcodeMessageIteminfo | html %]) is on hold for [% resfirstname | html %] [% ressurname | html %] ([% rescardnumber | html %]) and being transferred to [% Branches.GetName( resbranchcode ) | html %]
  • [% END %] + [% IF ( PROCESSED ) %] +
  • Item [% getTitleMessageIteminfo | html %] ([% getBarcodeMessageIteminfo | html %]) is being processed for [% resfirstname | html %] [% ressurname | html %] ([% rescardnumber | html %]) at [% Branches.GetName( resbranchcode ) | html %]
  • + [% END %] + [% IF ( RESERVED ) %]
  • Item [% getTitleMessageIteminfo | html %] ([% getBarcodeMessageIteminfo | html %]) has been on hold for [% resfirstname | html %] [% ressurname | html %] ([% rescardnumber | html %]) at [% Branches.GetName( resbranchcode ) | html %] since [% resreservedate | $KohaDates %]
  • [% END %] @@ -250,6 +254,15 @@

    [% END %] + [% IF ( PROCESSED ) %] +

    + +
    + + +

    + [% END %] + @@ -280,7 +293,7 @@ [% END # /IF CAN_user_circulate_force_checkout or HIGHHOLDS %] - [% IF ( RESERVED or RESERVE_WAITING or TRANSFERRED ) %] + [% IF ( RESERVED or RESERVE_WAITING or TRANSFERRED or PROCESSING ) %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index c21b2e79ae..6afb301479 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -150,6 +150,9 @@ [% IF checkout_info.TRANSFERRED %]
  • This item is on hold and being transferred to another patron.
  • [% END %] + [% IF checkout_info.PROCESSED %] +
  • This item is on hold and being processed for another patron.
  • + [% END %] [% IF checkout_info.ISSUED_TO_ANOTHER %]
  • This item is checked out to another patron. [% IF CAN_user_circulate_force_checkout %] @@ -190,7 +193,7 @@ [% END %] - [% IF NOT checkout_info.IMPOSSIBLE && ( CAN_user_circulate_force_checkout || checkout_info.HIGHHOLDS ) && ( checkout_info.RESERVED || checkout_info.RESERVE_WAITING || checkout_info.TRANSFERRED ) %] + [% IF NOT checkout_info.IMPOSSIBLE && ( CAN_user_circulate_force_checkout || checkout_info.HIGHHOLDS ) && ( checkout_info.RESERVED || checkout_info.RESERVE_WAITING || checkout_info.TRANSFERRED || checkout_info.PROCESSED ) %]
  • This item is on hold for another patron. The hold will be overridden, but not cancelled.
  • [% ELSIF checkout_info.RESERVED %]
  • This item is on hold for another patron.
  • -- 2.11.0