Bugzilla – Attachment 130354 Details for
Bug 29660
reserve/request.pl should not deal with biblioitem
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29660: Remove biblioitem loop from request.pl
Bug-29660-Remove-biblioitem-loop-from-requestpl.patch (text/plain), 66.57 KB, created by
Nick Clemens (kidclamp)
on 2022-02-09 12:43:56 UTC
(
hide
)
Description:
Bug 29660: Remove biblioitem loop from request.pl
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-02-09 12:43:56 UTC
Size:
66.57 KB
patch
obsolete
>From 5c7a6e60b5079cf479d8e8f5cdf0244fd504324e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 8 Dec 2021 15:34:28 +0100 >Subject: [PATCH] Bug 29660: Remove biblioitem loop from request.pl > >It seems that hiddencount didn't work prior to this patch (to confirm) > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/en/modules/reserve/request.tt | 406 +++++++++--------- > reserve/request.pl | 399 +++++++---------- > 2 files changed, 369 insertions(+), 436 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 1ed634dca3..cabfc8d279 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -284,7 +284,7 @@ > <tr> > <th> </th> > <th>Title</th> >- [% UNLESS ( item_level_itypes ) %] >+ [% UNLESS Koha.Preference('item-level_itypes') %] > <th>Item type</th> > [% END %] > <th>Priority</th> >@@ -316,9 +316,9 @@ > <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span> > [% END %] > </td> >- [% UNLESS ( item_level_itypes ) %] >+ [% UNLESS Koha.Preference('item-level_itypes') %] > <td> >- <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" /> >+ <img src="[% biblioloo.itemtype.image_location| html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" /> > </td> > [% END %] > <td>[% biblioloo.rank | html %]</td> >@@ -572,222 +572,222 @@ > [% END %] > </fieldset> > >- [% FOREACH bibitemloo IN bibitemloop %] >- <ol> >- [% UNLESS ( item_level_itypes ) %] >- <li> >- <span class="label">Item type:</span> >- [% bibitemloo.description | html %] >- </li> >- [% END %] >+ [% biblio = biblioloop.0 %] > >- [% IF ( bibitemloo.publicationyear ) %] >- <li> >- <span class="label">Publication year:</span> >- [% bibitemloo.publicationyear | html %] >- </li> >- [% END %] >- </ol> >+ <ol> >+ [% UNLESS Koha.Preference('item-level_itypes') %] >+ <li> >+ <span class="label">Item typeX:</span> >+ [% biblio.itemtype.translated_description | html %] >+ </li> >+ [% END %] > >- <h2 style="padding: 0 1em;"> >- Place a hold on a specific item >- [% IF bibitemloo.force_hold_level == 'item' %] >- <span class="error"><em>(Required)</em></span> >- [% END %] >- </h2> >+ [% IF ( biblio.biblioitem.publicationyear ) %] >+ <li> >+ <span class="label">Publication year:</span> >+ [% biblio.biblioitem.publicationyear | $KohaDates %] >+ </li> >+ [% END %] >+ </ol> > >- <table id="requestspecific"> >- <thead> >- <tr> >- <th>Hold</th> >- [% IF ( item_level_itypes ) %] >- <th>Item type</th> >- [% END %] >- <th>Barcode</th> >- <th>Home library</th> >- <th>Last location</th> >- [% IF itemdata_ccode %] >- <th>Collection</th> >- [% END %] >- <th>Call number</th> >- <th>Copy number</th> >- [% IF itemdata_enumchron %] >- <th>Vol no.</th> >- [% END %] >- <th>Information</th> >- <th>Allowed pickup locations</th> >- </tr> >- </thead> >- <tbody> >- [% SET selected = 0 %] >- [% FOREACH itemloo IN bibitemloo.itemloop %] >- [% UNLESS ( itemloo.hide ) %] >- <tr class="[% itemloo.backgroundcolor | html %]"> >- <td> >- [% IF itemloo.force_hold_level == 'record' # Patron has placed a record level hold previously for this record %] >- <span class="error"> >- <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i> >- Hold must be record level >- </span> >- [% ELSIF ( itemloo.available ) %] >- <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" /> >- [% ELSIF ( itemloo.override ) %] >- <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" /> >- <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i> >- [% ELSE %] >- <span class="error"> >- <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i> >- [% IF itemloo.not_holdable %] >- [% IF itemloo.not_holdable == 'damaged' %] >- Item damaged >- [% ELSIF itemloo.not_holdable == 'ageRestricted' %] >- Age restricted >- [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %] >- Exceeded max holds per record >- [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %] >- Daily hold limit reached for patron >- [% ELSIF itemloo.not_holdable == 'tooManyReserves' %] >- Too many holds >- [% ELSIF itemloo.not_holdable == 'notReservable' %] >- Not holdable >- [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %] >- Patron is from different library >- [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %] >- Cannot place hold from patron's library >- [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %] >- Patron already has hold for this item >- [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %] >- Cannot be transferred to pickup library >- [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %] >- Only pickup locations within the same hold group are allowed >- [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %] >- No reserves are allowed on this item >- [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %] >- Library is not a pickup location >- [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %] >- No valid pickup location >- [% ELSE %] >- [% itemloo.not_holdable | html %] >- [% END %] >+ <h2 style="padding: 0 1em;"> >+ Place a hold on a specific item >+ [% IF force_hold_level == 'item' %] >+ <span class="error"><em>(Required)</em></span> >+ [% END %] >+ </h2> >+ >+ <table id="requestspecific"> >+ <thead> >+ <tr> >+ <th>Hold</th> >+ [% IF Koha.Preference('item-level_itypes') %] >+ <th>Item type</th> >+ [% END %] >+ <th>Barcode</th> >+ <th>Home library</th> >+ <th>Last location</th> >+ [% IF itemdata_ccode %] >+ <th>Collection</th> >+ [% END %] >+ <th>Call number</th> >+ <th>Copy number</th> >+ [% IF itemdata_enumchron %] >+ <th>Vol no.</th> >+ [% END %] >+ <th>Information</th> >+ <th>Allowed pickup locations</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% SET selected = 0 %] >+ [% FOREACH itemloo IN biblio.itemloop %] >+ [% UNLESS ( itemloo.hide ) %] >+ <tr class="[% itemloo.backgroundcolor | html %]"> >+ <td> >+ [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %] >+ <span class="error"> >+ <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i> >+ Hold must be record level >+ </span> >+ [% ELSIF ( itemloo.available ) %] >+ <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" /> >+ [% ELSIF ( itemloo.override ) %] >+ <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" /> >+ <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i> >+ [% ELSE %] >+ <span class="error"> >+ <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i> >+ [% IF itemloo.not_holdable %] >+ [% IF itemloo.not_holdable == 'damaged' %] >+ Item damaged >+ [% ELSIF itemloo.not_holdable == 'ageRestricted' %] >+ Age restricted >+ [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %] >+ Exceeded max holds per record >+ [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %] >+ Daily hold limit reached for patron >+ [% ELSIF itemloo.not_holdable == 'tooManyReserves' %] >+ Too many holds >+ [% ELSIF itemloo.not_holdable == 'notReservable' %] >+ Not holdable >+ [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %] >+ Patron is from different library >+ [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %] >+ Cannot place hold from patron's library >+ [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %] >+ Patron already has hold for this item >+ [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %] >+ Cannot be transferred to pickup library >+ [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %] >+ Only pickup locations within the same hold group are allowed >+ [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %] >+ No reserves are allowed on this item >+ [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %] >+ Library is not a pickup location >+ [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %] >+ No valid pickup location >+ [% ELSE %] >+ [% itemloo.not_holdable | html %] > [% END %] >- </span> >- [% END # /IF itemloo.force_hold_level %] >- </td> >- [% IF ( item_level_itypes ) %] >- <td> >- [% UNLESS ( noItemTypeImages ) %] >- [% IF ( itemloo.imageurl ) %]<img src="[% itemloo.imageurl | html %]" alt="" /> <br /> [% END %] > [% END %] >- [% itemloo.itypename | html %] >- </td> >- [% END %] >- <td> >- [% itemloo.barcode | html %] >- </td> >+ </span> >+ [% END # /IF force_hold_level %] >+ </td> >+ [% IF Koha.Preference('item-level_itypes') %] > <td> >- [% Branches.GetName( itemloo.homebranch ) | html %] >+ [% UNLESS ( noItemTypeImages ) %] >+ [% IF ( itemloo.itemtype.image_location) %]<img src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br /> [% END %] >+ [% END %] >+ [% itemloo.itemtype.translated_description | html %] > </td> >+ [% END %] >+ <td> >+ [% itemloo.barcode | html %] >+ </td> >+ <td> >+ [% Branches.GetName( itemloo.homebranch ) | html %] >+ </td> >+ <td> >+ [% Branches.GetName( itemloo.holdingbranch ) | html %] >+ </td> >+ [% IF itemdata_ccode %] > <td> >- [% Branches.GetName( itemloo.holdingbranch ) | html %] >+ [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %] > </td> >- [% IF itemdata_ccode %] >- <td> >- [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %] >- </td> >- [% END %] >+ [% END %] >+ <td> >+ [% itemloo.itemcallnumber | html %] >+ </td> >+ <td> >+ [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %] [% END %] >+ </td> >+ [% IF itemdata_enumchron %] > <td> >- [% itemloo.itemcallnumber | html %] >+ [% itemloo.enumchron | html %] > </td> >+ [% END %] >+ [% IF ( itemloo.onloan ) %] >+ <td data-order="[% itemloo.date_due | html %]"> >+ <span class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 %]</span> >+ [% ELSE %] > <td> >- [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %] [% END %] >- </td> >- [% IF itemdata_enumchron %] >- <td> >- [% itemloo.enumchron | html %] >- </td> >- [% END %] >- [% IF ( itemloo.onloan ) %] >- <td data-order="[% itemloo.date_due | html %]"> >- <span class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 %]</span> >- [% ELSE %] >- <td> >- [% IF ( itemloo.transfertwhen ) %] >- In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %], >- to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %] >- [% END %] >- [% END %] >+ [% IF ( itemloo.transfertwhen ) %] >+ In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %], >+ to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %] >+ [% END %] >+ [% END %] > >- [% IF ( itemloo.reservedate ) %] >- [% IF ( itemloo.nocancel ) %] >- Can't be cancelled when item is in transit >+ [% IF ( itemloo.reservedate ) %] >+ [% IF ( itemloo.nocancel ) %] >+ Can't be cancelled when item is in transit >+ [% ELSE %] >+ [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] >+ [% IF ( itemloo.canreservefromotherbranches ) %] >+ for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a> >+ [% END %] >+ [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] >+ [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since >+ [% IF ( itemloo.waitingdate ) %] >+ [% itemloo.waitingdate | $KohaDates %] > [% ELSE %] >- [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] >- [% IF ( itemloo.canreservefromotherbranches ) %] >- for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a> >+ [% IF ( itemloo.reservedate ) %] >+ [% itemloo.reservedate | html %] > [% END %] >- [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] >- [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since >- [% IF ( itemloo.waitingdate ) %] >- [% itemloo.waitingdate | $KohaDates %] >- [% ELSE %] >- [% IF ( itemloo.reservedate ) %] >- [% itemloo.reservedate | html %] >- [% END %] >- [% END %]. >- <a class="info cancel-hold" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&CancelItemnumber=[% itemloo.itemnumber | html %]">Cancel hold</a> >- [% END # /IF itemloo.nocancel %] >- [% ELSE %] >- Not on hold >- [% END # /IF itemloo.reservedate %] >+ [% END %]. >+ <a class="info cancel-hold" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&CancelItemnumber=[% itemloo.itemnumber | html %]">Cancel hold</a> >+ [% END # /IF itemloo.nocancel %] >+ [% ELSE %] >+ Not on hold >+ [% END # /IF itemloo.reservedate %] > >- [% IF itemloo.item_level_holds == "N" %] >- <br/>Item level hold not allowed from OPAC >- [% ELSIF itemloo.item_level_holds == "F" %] >- <br/>Item level hold forced from OPAC >- [% END %] >+ [% IF itemloo.item_level_holds == "N" %] >+ <br/>Item level hold not allowed from OPAC >+ [% ELSIF itemloo.item_level_holds == "F" %] >+ <br/>Item level hold forced from OPAC >+ [% END %] > >- [% IF ( itemloo.itemlost ) %] >- <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span> >- [% END %] >+ [% IF ( itemloo.itemlost ) %] >+ <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span> >+ [% END %] > >- [% IF ( itemloo.damaged ) %] >- <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span> >- [% END %] >+ [% IF ( itemloo.damaged ) %] >+ <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span> >+ [% END %] > >- [% IF ( itemloo.withdrawn ) %] >- <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span> >- [% END %] >+ [% IF ( itemloo.withdrawn ) %] >+ <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span> >+ [% END %] > >- [% IF ( itemloo.notforloan ) %] >- <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span> >- [% END %] >- </td> >- <td> >- [% 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 %]" >- data-pickup-location-source="item"> >- [% IF (itemloo.default_pickup_location) %] >- <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option> >- [% END %] >- </select> >+ [% IF ( itemloo.notforloan ) %] >+ <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span> > [% END %] >- </td> >- </tr> >- [% END # / UNLESS itemloo.hide %] >- [% END # /FOREACH itemloo %] >- </tbody> >- </table> <!-- /#requestspecific --> >- >- [% IF ( bibitemloo.hiddencount ) %] >- <form> >- <p class="hiddencount"> >- <a href="request.pl?biblionumber=[% bibitemloo.biblionumber | uri %]&borrowernumber=[% bibitemloo.borrowernumber | uri %]&showallitems=1">Show all items ([% bibitemloo.hiddencount | html %] hidden)</a> >- </p> >- </form> >- [% END # /IF bibitemloo.hiddencount %] >- [% END # /FOREACH bibitemloo %] >+ </td> >+ <td> >+ [% 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 %]" >+ data-pickup-location-source="item"> >+ [% IF (itemloo.default_pickup_location) %] >+ <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option> >+ [% END %] >+ </select> >+ [% END %] >+ </td> >+ </tr> >+ [% END # / UNLESS itemloo.hide %] >+ [% END # /FOREACH itemloo %] >+ </tbody> >+ </table> <!-- /#requestspecific --> >+ >+ [% IF hiddencount %] >+ <form> >+ <p class="hiddencount"> >+ <a href="request.pl?biblionumber=[% biblio.biblionumber | uri %]&borrowernumber=[% borrowernumber | uri %]&showallitems=1">Show all items ([% biblio.hiddencount | html %] hidden)</a> >+ </p> >+ </form> >+ [% END # /IF hiddencount %] > > [% ELSE # /UNLESS multi_hold %] > >@@ -795,7 +795,7 @@ > <tr> > <th> </th> > <th>Title</th> >- [% UNLESS ( item_level_itypes ) %] >+ [% UNLESS Koha.Preference('item-level_itypes') %] > <th>Item type</th> > [% END %] > <th>Priority</th> >@@ -828,9 +828,9 @@ > <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span> > [% END %] > </td> >- [% UNLESS ( item_level_itypes ) %] >+ [% UNLESS Koha.Preference('item-level_itypes') %] > <td> >- <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" /> >+ <img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" /> > </td> > [% END %] > <td>[% biblioloo.rank | html %]</td> >@@ -1144,18 +1144,18 @@ > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'columns_settings.inc' %] > [% Asset.js("lib/hc-sticky.js") | $raw %] > [% Asset.js("js/circ-patron-search-results.js") | $raw %] > [% INCLUDE 'select2.inc' %] > [% Asset.js("js/holds.js") | $raw%] >- [% INCLUDE 'calendar.inc' %] > <script> > var Sticky; > var biblionumber = "[% biblionumber | $raw %]"; > var borrowernumber = "[% patron.borrowernumber | $raw %]"; > var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]"; >- var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %] >+ var override_items = {[% FOREACH biblio IN biblioloop %][% FOREACH itemloo IN biblio.itemloop %][% IF ( itemloo.override ) %] > [% itemloo.itemnumber | html %]: { > homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]", > holdallowed: "[% itemloo.holdallowed | html %]" >diff --git a/reserve/request.pl b/reserve/request.pl >index 22ef54cc58..d06d5f5987 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -68,7 +68,12 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( > my $showallitems = $input->param('showallitems'); > my $pickup = $input->param('pickup'); > >-my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; >+my $itemtypes = { >+ map { >+ $_->itemtype => >+ { %{ $_->unblessed }, image_location => $_->image_location } >+ } Koha::ItemTypes->search_with_localization->as_list >+}; > > # Select borrowers infos > my $findborrower = $input->param('findborrower'); >@@ -165,13 +170,10 @@ if($findclub) { > if( $club ) { > $club_hold = $club->id; > } else { >- my @clubs = Koha::Clubs->search( >- [ >- { name => { like => '%' . $findclub . '%' } }, >- { description => { like => '%' . $findclub . '%' } } >- ] >- )->filter_out_empty->as_list; >- >+ my @clubs = Koha::Clubs->search( [ >+ { name => { like => '%'.$findclub.'%' } }, >+ { description => { like => '%'.$findclub.'%' } } >+ ] ); > if( scalar @clubs == 1 ) { > $club_hold = $clubs[0]->id; > } elsif ( @clubs ) { >@@ -306,7 +308,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > if ( $patron && $multi_hold ) { > my @multi_pickup_locations = > Koha::Biblios->search( { biblionumber => \@biblionumbers } ) >- ->pickup_locations( { patron => $patron } )->as_list; >+ ->pickup_locations( { patron => $patron } ); > $template->param( multi_pickup_locations => \@multi_pickup_locations ); > } > >@@ -332,7 +334,6 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > last; > } > >- my $force_hold_level; > if ( $patron ) { > { # CanBookBeReserved > my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); >@@ -376,9 +377,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > found => undef, > } > ); >- $force_hold_level = $holds->forced_hold_level(); >- $biblioloopiter{force_hold_level} = $force_hold_level; >- $template->param( force_hold_level => $force_hold_level ); >+ $template->param( force_hold_level => $holds->forced_hold_level() ); > > # For a librarian to be able to place multiple record holds for a patron for a record, > # we must find out what the maximum number of holds they can place for the patron is >@@ -389,203 +388,161 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $template->param( remaining_holds_for_record => $remaining_holds_for_record ); > } > >- >- my $count = Koha::Holds->search( { biblionumber => $biblionumber } )->count(); >- my $totalcount = $count; >- > # adding a fixed value for priority options >- my $fixedRank = $count+1; >+ my $fixedRank = $biblio->holds->count + 1; > >- my %itemnumbers_of_biblioitem; >+ my @items = $biblio->items->as_list; > >- my @hostitems = get_hostitemnumbers_of($biblionumber); >- my @itemnumbers; >- if (@hostitems){ >- push(@itemnumbers, @hostitems); >+ my @host_items = $biblio->host_items->as_list; >+ if (@host_items) { >+ push @items, @host_items; > } > >- my $items = Koha::Items->search({ -or => { biblionumber => $biblionumber, itemnumber => { in => \@itemnumbers } } }); >- >- unless ( $items->count ) { >+ unless ( @items ) { > # FIXME Then why do we continue? > $template->param('noitems' => 1) unless ( $multi_hold ); > $biblioloopiter{noitems} = 1; > } > >- ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers >- ## this is important when we have analytic items which may be on another record >- my ( $iteminfos_of ); >- while ( my $item = $items->next ) { >- $item = $item->unblessed; >- my $biblioitemnumber = $item->{biblioitemnumber}; >- my $itemnumber = $item->{itemnumber}; >- push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber ); >- $iteminfos_of->{$itemnumber} = $item; >- } >- >- my @biblioitemnumbers = keys %itemnumbers_of_biblioitem; >- >- my $biblioiteminfos_of = { >- map { >- my $biblioitem = $_; >- ( $biblioitem->{biblioitemnumber} => $biblioitem ) >- } @{ Koha::Biblioitems->search( >- { biblioitemnumber => { -in => \@biblioitemnumbers } }, >- { select => ['biblionumber', 'biblioitemnumber', 'publicationyear', 'itemtype']} >- )->unblessed >- } >- }; >- > if ( $club_hold or $borrowernumber_hold ) { >- my @bibitemloop; >- > my @available_itemtypes; >- foreach my $biblioitemnumber (@biblioitemnumbers) { >- my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber}; >- my $num_available = 0; >- my $num_override = 0; >- my $hiddencount = 0; >- my $num_alreadyheld = 0; >- >- $biblioitem->{force_hold_level} = $force_hold_level; >- >- $biblioloopiter{description} = $biblioitem->{description}; >- $biblioloopiter{itypename} = $biblioitem->{description}; >- if ( $biblioitem->{itemtype} ) { >- >- $biblioitem->{description} = >- $itemtypes->{ $biblioitem->{itemtype} }{description}; >- >- $biblioloopiter{imageurl} = >- getitemtypeimagelocation( 'intranet', >- $itemtypes->{ $biblioitem->{itemtype} }{imageurl} ); >- } >- >- # iterating through all items first to check if any of them available >- # to pass this value further inside down to IsAvailableForItemLevelRequest to >- # it's complicated logic to analyse. >- # (before this loop was inside that sub loop so it was O(n^2) ) >- my $items_any_available; >- $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitem->{biblionumber}, patron => $patron }) >- if $patron; >- >- foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { >- my $item = $iteminfos_of->{$itemnumber}; >- my $do_check; >- if ( $patron ) { >- $do_check = $patron->do_check_for_previous_checkout($item) if $wants_check; >- if ( $do_check && $wants_check ) { >- $item->{checked_previously} = $do_check; >- if ( $multi_hold ) { >- $biblioloopiter{checked_previously} = $do_check; >- } else { >- $template->param( checked_previously => $do_check ); >- } >+ my $num_available = 0; >+ my $num_override = 0; >+ my $hiddencount = 0; >+ my $num_alreadyheld = 0; >+ >+ # iterating through all items first to check if any of them available >+ # to pass this value further inside down to IsAvailableForItemLevelRequest to >+ # it's complicated logic to analyse. >+ # (before this loop was inside that sub loop so it was O(n^2) ) >+ my $items_any_available; >+ $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblio->biblionumber, patron => $patron }) >+ if $patron; >+ >+ for my $item_object ( @items ) { >+ my $do_check; >+ my $item = $item_object->unblessed; >+ if ( $patron ) { >+ $do_check = $patron->do_check_for_previous_checkout($item) if $wants_check; >+ if ( $do_check && $wants_check ) { >+ $item->{checked_previously} = $do_check; >+ if ( $multi_hold ) { >+ $biblioloopiter{checked_previously} = $do_check; >+ } else { >+ $template->param( checked_previously => $do_check ); > } > } >- $item->{force_hold_level} = $force_hold_level; >- >- unless (C4::Context->preference('item-level_itypes')) { >- $item->{itype} = $biblioitem->{itemtype}; >- } >+ } > >- $item->{itypename} = $itemtypes->{ $item->{itype} }{description}; >- $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} ); >- $item->{homebranch} = $item->{homebranch}; >+ $item->{itemtype} = $itemtypes->{ $item_object->effective_itemtype }; > >- # if the holdingbranch is different than the homebranch, we show the >- # holdingbranch of the document too >- if ( $item->{homebranch} ne $item->{holdingbranch} ) { >- $item->{holdingbranch} = $item->{holdingbranch}; >- } >+ if($item->{biblionumber} ne $biblio->biblionumber){ >+ $item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title; >+ } > >- if($item->{biblionumber} ne $biblionumber){ >- $item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title; >- } >+ # if the item is currently on loan, we display its return date and >+ # change the background color >+ my $issue = $item_object->checkout; >+ if ( $issue ) { # FIXME must be moved to the template >+ $item->{date_due} = $issue->date_due; >+ $item->{backgroundcolor} = 'onloan'; >+ } > >- # if the item is currently on loan, we display its return date and >- # change the background color >- my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ); >- if ( $issue ) { >- $item->{date_due} = $issue->date_due; >- $item->{backgroundcolor} = 'onloan'; >- } >+ # checking reserve >+ my $holds = $item_object->current_holds; >+ if ( my $first_hold = $holds->next ) { >+ my $p = Koha::Patrons->find( $first_hold->borrowernumber ); > >- # checking reserve >- my $item_object = Koha::Items->find( $itemnumber ); >- my $holds = $item_object->current_holds; >- if ( my $first_hold = $holds->next ) { >- my $p = Koha::Patrons->find( $first_hold->borrowernumber ); >- >- $item->{backgroundcolor} = 'reserved'; >- $item->{reservedate} = output_pref({ dt => dt_from_string( $first_hold->reservedate ), dateonly => 1 }); # FIXME Should be formatted in the template >- $item->{ReservedFor} = $p; >- $item->{ExpectedAtLibrary} = $first_hold->branchcode; >- $item->{waitingdate} = $first_hold->waitingdate; >- } >+ $item->{backgroundcolor} = 'reserved'; >+ $item->{reservedate} = output_pref({ dt => dt_from_string( $first_hold->reservedate ), dateonly => 1 }); # FIXME Should be formatted in the template >+ $item->{ReservedFor} = $p; >+ $item->{ExpectedAtLibrary} = $first_hold->branchcode; >+ $item->{waitingdate} = $first_hold->waitingdate; >+ } > >- # Management of the notforloan document >- if ( $item->{notforloan} ) { >- $item->{backgroundcolor} = 'other'; >- } >+ # Management of the notforloan document >+ if ( $item->{notforloan} ) { >+ $item->{backgroundcolor} = 'other'; >+ } > >- # Management of lost or long overdue items >- if ( $item->{itemlost} ) { >- $item->{backgroundcolor} = 'other'; >- if ($logged_in_patron->category->hidelostitems && !$showallitems) { >- $item->{hide} = 1; >- $hiddencount++; >- } >+ # Management of lost or long overdue items >+ if ( $item->{itemlost} ) { >+ $item->{backgroundcolor} = 'other'; >+ if ($logged_in_patron->category->hidelostitems && !$showallitems) { >+ $item->{hide} = 1; >+ $hiddencount++; > } >+ } > >- # Check the transit status >- my ( $transfertwhen, $transfertfrom, $transfertto ) = >- GetTransfers($itemnumber); >+ # Check the transit status >+ my ( $transfertwhen, $transfertfrom, $transfertto ) = >+ GetTransfers($item_object->itemnumber); # FIXME replace with get_transfer > >- if ( defined $transfertwhen && $transfertwhen ne '' ) { >- $item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 }); >- $item->{transfertfrom} = $transfertfrom; >- $item->{transfertto} = $transfertto; >- $item->{nocancel} = 1; >- } >+ if ( defined $transfertwhen && $transfertwhen ne '' ) { >+ $item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 }); >+ $item->{transfertfrom} = $transfertfrom; >+ $item->{transfertto} = $transfertto; >+ $item->{nocancel} = 1; >+ } > >- # If there is no loan, return and transfer, we show a checkbox. >- $item->{notforloan} ||= 0; >- >- # if independent branches is on we need to check if the person can reserve >- # for branches they arent logged in to >- if ( C4::Context->preference("IndependentBranches") ) { >- if (! C4::Context->preference("canreservefromotherbranches")){ >- # can't reserve items so need to check if item homebranch and userenv branch match if not we can't reserve >- my $userenv = C4::Context->userenv; >- unless ( C4::Context->IsSuperLibrarian ) { >- $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} ); >- } >+ # If there is no loan, return and transfer, we show a checkbox. >+ $item->{notforloan} ||= 0; >+ >+ # if independent branches is on we need to check if the person can reserve >+ # for branches they arent logged in to >+ if ( C4::Context->preference("IndependentBranches") ) { >+ if (! C4::Context->preference("canreservefromotherbranches")){ >+ # can't reserve items so need to check if item homebranch and userenv branch match if not we can't reserve >+ my $userenv = C4::Context->userenv; >+ unless ( C4::Context->IsSuperLibrarian ) { >+ $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} ); > } > } >+ } > >- if ( $patron ) { >- my $patron_unblessed = $patron->unblessed; >- my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed); >- >- my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); >- >- $item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; >- >- my $can_item_be_reserved = CanItemBeReserved( $patron, $item_object )->{status}; >- $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); >- >- $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); >+ if ( $patron ) { >+ my $patron_unblessed = $patron->unblessed; >+ my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed); >+ >+ my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} ); >+ >+ $item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; >+ >+ my $can_item_be_reserved = CanItemBeReserved( $patron, $item_object )->{status}; >+ $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); >+ >+ $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); >+ >+ 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, $items_any_available) >+ ) >+ { >+ # 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 }); >+ $item->{pickup_locations_count} = $pickup_locations->count; >+ if ( $item->{pickup_locations_count} > 0 ) { >+ $num_available++; >+ $item->{available} = 1; >+ # pass the holding branch for use as default >+ my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; >+ $item->{default_pickup_location} = $default_pickup_location; >+ } >+ else { >+ $item->{available} = 0; >+ $item->{not_holdable} = "no_valid_pickup_location"; >+ } > >- 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, $items_any_available) >- ) >- { >+ 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; >@@ -607,67 +564,42 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $item->{available} = 0; > $item->{not_holdable} = "no_valid_pickup_location"; > } >+ } else { $num_alreadyheld++ } > >- 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 }); >- $item->{pickup_locations_count} = $pickup_locations->count; >- if ( $item->{pickup_locations_count} > 0 ) { >- $item->{override} = 1; >- $num_override++; >- # pass the holding branch for use as default >- my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next; >- $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} ); >- } >+ push( @available_itemtypes, $item->{itype} ); >+ } > >- # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked >+ # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked > >- # Show serial enumeration when needed >- if ($item->{enumchron}) { >- $itemdata_enumchron = 1; >- } >- # Show collection when needed >- if ($item->{ccode}) { >- $itemdata_ccode = 1; >- } >+ # Show serial enumeration when needed >+ if ($item->{enumchron}) { >+ $itemdata_enumchron = 1; >+ } >+ # Show collection when needed >+ if ($item->{ccode}) { >+ $itemdata_ccode = 1; > } >- >- push @{ $biblioitem->{itemloop} }, $item; > } > >- # While we can't override an alreay held item, we should be able to override the others >- # Unless all items are already held >- if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) { >- # That is, if all items require an override >- $template->param( override_required => 1 ); >- } elsif ( $num_available == 0 ) { >- $template->param( none_available => 1 ); >- $biblioloopiter{warn} = 1; >- $biblioloopiter{none_avail} = 1; >- } >- $template->param( hiddencount => $hiddencount); >+ push @{ $biblioloopiter{itemloop} }, $item; >+ } > >- push @bibitemloop, $biblioitem; >+ $biblioloopiter{biblioitem} = $biblio->biblioitem; >+ >+ # While we can't override an alreay held item, we should be able to override the others >+ # Unless all items are already held >+ if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioloopiter{itemloop} } ) ) { >+ # That is, if all items require an override >+ $template->param( override_required => 1 ); >+ } elsif ( $num_available == 0 ) { >+ $template->param( none_available => 1 ); >+ $biblioloopiter{warn} = 1; >+ $biblioloopiter{none_avail} = 1; > } >+ $template->param( hiddencount => $hiddencount); > > @available_itemtypes = uniq( @available_itemtypes ); >- $template->param( >- bibitemloop => \@bibitemloop, >- available_itemtypes => \@available_itemtypes >- ); >+ $template->param( available_itemtypes => \@available_itemtypes ); > } > > # existingreserves building >@@ -761,7 +693,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > if ( $patron ) { > # Add the valid pickup locations >- my @pickup_locations = $biblio->pickup_locations({ patron => $patron })->as_list; >+ my @pickup_locations = $biblio->pickup_locations({ patron => $patron }); > $biblioloopiter{pickup_locations} = \@pickup_locations; > $biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ]; > } >@@ -795,6 +727,7 @@ if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) { > $template->param( > SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), > AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), >+ borrowernumber => $borrowernumber_hold, > ); > > # printout the page >-- >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 29660
:
128366
|
128367
|
128368
|
129934
|
129935
|
129936
|
130352
|
130353
|
130354
|
130447
|
130731
|
130732
|
130733
|
130734