Bugzilla – Attachment 156519 Details for
Bug 16260
Have AllowHoldsOnPatronsPossessions check for multiple holds allowed on a record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16260: Adjust logic of AllowHoldsOnPatronsPossessions
Bug-16260-Adjust-logic-of-AllowHoldsOnPatronsPosse.patch (text/plain), 6.65 KB, created by
Jonathan Druart
on 2023-10-04 08:48:29 UTC
(
hide
)
Description:
Bug 16260: Adjust logic of AllowHoldsOnPatronsPossessions
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-04 08:48:29 UTC
Size:
6.65 KB
patch
obsolete
>From b97da4ff97a2b0fca5825be5ddc55853b29ea600 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 Oct 2023 10:46:07 +0200 >Subject: [PATCH] Bug 16260: Adjust logic of AllowHoldsOnPatronsPossessions > >--- > C4/Reserves.pm | 21 +++++++------------ > .../prog/en/modules/reserve/request.tt | 6 +++--- > reserve/request.pl | 4 ---- > 3 files changed, 11 insertions(+), 20 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 36257378852..9bfd23ede81 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -25,7 +25,7 @@ use Modern::Perl; > > use C4::Accounts; > use C4::Biblio qw( GetMarcFromKohaField ); >-use C4::Circulation qw( CheckIfIssuedToPatron GetAgeRestriction GetBranchItemRule ); >+use C4::Circulation qw( GetAgeRestriction GetBranchItemRule ); > use C4::Context; > use C4::Items qw( CartToShelf get_hostitemnumbers_of ); > use C4::Letters; >@@ -335,12 +335,6 @@ See CanItemBeReserved() for possible return values. > sub CanBookBeReserved{ > my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_; > >- # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) >- if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') >- && C4::Circulation::CheckIfIssuedToPatron( $borrowernumber, $biblionumber ) ) { >- return { status =>'alreadypossession' }; >- } >- > if ( $params->{itemtype} ) { > > # biblio-level, item type-contrained >@@ -472,12 +466,6 @@ sub CanItemBeReserved { > return _cache { status =>'itemAlreadyOnHold' } > if ( !$params->{ignore_hold_counts} && Koha::Holds->search( { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber } )->count() ); > >- # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) >- if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') >- && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) { >- return _cache { status =>'alreadypossession' }; >- } >- > # check if a recall exists on this item from this borrower > return _cache { status => 'recall' } > if $patron->recalls->filter_by_current->search({ item_id => $item->itemnumber })->count; >@@ -532,6 +520,13 @@ sub CanItemBeReserved { > }; > my $holds = Koha::Holds->search($search_params); > return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } if $holds->count() >= $holds_per_record; >+ >+ # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) >+ if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') >+ && $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) >+ { >+ return _cache { status => 'alreadypossession' }; >+ } > } > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 59f90bb2d8b..ae91b947549 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -421,7 +421,7 @@ > </div> > [% END %] > >- [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recall ) %] >+ [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || ageRestricted || recall ) %] > <div class="dialog alert"> > > [% UNLESS ( multi_hold ) %] >@@ -433,8 +433,6 @@ > <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total holds.</li> > [% ELSIF ( exceeded_holds_per_record ) %] > <li><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li> >- [% ELSIF ( alreadypossession ) %] >- <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 hide_patron_infos_if_needed => 1 %] <strong>is already in possession</strong> of one item.</li> > [% ELSIF ( alreadyreserved ) %] > <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li> > [% ELSIF ( ageRestricted ) %] >@@ -782,6 +780,8 @@ > <span>No valid pickup location</span> > [% ELSIF itemloo.not_holdable == 'notforloan' %] > <span>Not for loan</span> >+ [% ELSIF itemloo.not_holdable == 'alreadypossession' %] >+ <span>Patron is already in posession of this item</span> > [% ELSE %] > <span>[% itemloo.not_holdable | html %]</span> > [% END %] >diff --git a/reserve/request.pl b/reserve/request.pl >index 36af34399c9..8e26d0a9bea 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -330,10 +330,6 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $template->param( $canReserve->{status} => 1 ); > $biblioloopiter{ $canReserve->{status} } = 1; > } >- elsif ( $canReserve->{status} eq 'alreadypossession' ) { >- $template->param( $canReserve->{status} => 1); >- $biblioloopiter{ $canReserve->{status} } = 1; >- } > elsif ( $canReserve->{status} eq 'recall' ) { > $template->param( $canReserve->{status} => 1 ); > $biblioloopiter{ $canReserve->{status} } = 1; >-- >2.34.1
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 16260
:
156518
| 156519