Bugzilla – Attachment 162304 Details for
Bug 35573
Koha is not correctly warning of overridden items when placing a hold if AllowHoldPolicyOverride
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35573: Revert "Bug 30687: Allow pickup location to be forced when override is allowed"
Bug-35573-Revert-Bug-30687-Allow-pickup-location-t.patch (text/plain), 6.51 KB, created by
David Nind
on 2024-02-20 17:06:20 UTC
(
hide
)
Description:
Bug 35573: Revert "Bug 30687: Allow pickup location to be forced when override is allowed"
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-02-20 17:06:20 UTC
Size:
6.51 KB
patch
obsolete
>From 8082a5f4a84ffc169bac350a010b1874f141c6f6 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Mon, 5 Feb 2024 12:59:06 +0100 >Subject: [PATCH] Bug 35573: Revert "Bug 30687: Allow pickup location to be > forced when override is allowed" > >This reverts commit ab93008da7eb61b697e4586c679b88c2eebaacd0. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/reserve/request.tt | 4 +- > reserve/request.pl | 52 ++++++++++++------- > 2 files changed, 35 insertions(+), 21 deletions(-) > >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 025d5b0ca1..ce314d4481 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -791,7 +791,7 @@ > [% END # /IF force_hold_level %] > </td> > <td> >- [% IF (itemloo.pickup_locations_count > 0) || itemloo.override %] >+ [% IF (itemloo.pickup_locations_count > 0) %] > <select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" style="width:100%;" > data-item-id="[% itemloo.itemnumber | html %]" > data-patron-id="[% patron.borrowernumber | html %]" >@@ -1517,7 +1517,7 @@ > msg = (_("- Please select an item to place a hold") + "\n"); > } > } else { >- if( $("#pickup").length < 1 || $("#pickup").val() == "" || $('#pickup').val() === null ){ >+ if( $("#pickup").length < 1 || $("#pickup").val() == "" ){ > msg = _("- Please select a pickup location for this hold" + "\n"); > } > } >diff --git a/reserve/request.pl b/reserve/request.pl >index 186b3faff5..f3ea029b9f 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -499,19 +499,13 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $default_pickup_branch = C4::Context->userenv->{branch}; > } > >- if ( $can_item_be_reserved eq 'itemAlreadyOnHold' ) { >- # itemAlreadyOnHold cannot be overridden >- $num_alreadyheld++ >- } >- elsif ( >- ( >- !$item->{cantreserve} >- && !$exceeded_maxreserves >- && $can_item_be_reserved eq 'OK' >- && IsAvailableForItemLevelRequest($item_object, $patron, undef) >- ) || C4::Context->preference('AllowHoldPolicyOverride') >- # If AllowHoldPolicyOverride is set, it overrides EVERY restriction >- # not just branch item rules >+ if ( >+ !$item->{cantreserve} >+ && !$exceeded_maxreserves >+ && $can_item_be_reserved eq 'OK' >+ # items_any_available defined outside of the current loop, >+ # so we avoiding loop inside IsAvailableForItemLevelRequest: >+ && IsAvailableForItemLevelRequest($item_object, $patron, undef) > ) > { > # Send the pickup locations count to the UI, the pickup locations will be pulled using the API >@@ -524,17 +518,37 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next; > $item->{default_pickup_location} = $default_pickup_location; > } >- elsif ( C4::Context->preference('AllowHoldPolicyOverride') ){ >- $num_items_available++; >- $item->{override} = 1; >- my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next; >- $item->{default_pickup_location} = $default_pickup_location; >- } > else { > $item->{available} = 0; > $item->{not_holdable} = "no_valid_pickup_location"; > } > >+ push( @available_itemtypes, $item->{itype} ); >+ } >+ elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) { >+ # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules >+ # with the exception of itemAlreadyOnHold because, you know, the item is already on hold >+ if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) { >+ # Send the pickup locations count to the UI, the pickup locations will be pulled using the API >+ my @pickup_locations = $item_object->pickup_locations({ patron => $patron })->as_list; >+ $item->{pickup_locations_count} = scalar @pickup_locations; >+ >+ if ( @pickup_locations ) { >+ $num_items_available++; >+ $item->{override} = 1; >+ >+ my $default_pickup_location; >+ >+ ($default_pickup_location) = grep { $_->branchcode eq $default_pickup_branch } @pickup_locations; >+ >+ $item->{default_pickup_location} = $default_pickup_location; >+ } >+ else { >+ $item->{available} = 0; >+ $item->{not_holdable} = "no_valid_pickup_location"; >+ } >+ } else { $num_alreadyheld++ } >+ > push( @available_itemtypes, $item->{itype} ); > } else { > # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked >-- >2.30.2
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 35573
:
161758
|
161759
|
162304
|
162305
|
164251
|
164252