From ec13ad8872d7e090c93fb9b77dfe7762f6e49772 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 12 Jan 2024 15:22:52 +0100 Subject: [PATCH] Bug 35782: Fix scoping problem with "biblio" The "biblio" Koha::Biblio object we send from the controller needs to be accessible from the include files. To avoid a clash we rename it biblio_info --- .../prog/en/modules/reserve/request.tt | 22 +++++++++---------- reserve/request.pl | 3 ++- 2 files changed, 13 insertions(+), 12 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 8d512eede75..631b82d2a83 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -631,26 +631,26 @@ [% END %] - [% biblio = biblioloop.0 %] + [% biblio_info = biblioloop.0 %]
    [% UNLESS Koha.Preference('item-level_itypes') %]
  1. Item type: - [% biblio.itemtype.translated_description | html %] + [% biblio_info.itemtype.translated_description | html %]
  2. [% END %] - [% IF ( biblio.biblioitem.publicationyear ) %] + [% IF ( biblio_info.biblioitem.publicationyear ) %]
  3. Publication year: - [% biblio.biblioitem.publicationyear | html %] + [% biblio_info.biblioitem.publicationyear | html %]
  4. [% END %]
- [% IF Koha.Preference('EnableItemGroupHolds') && biblio.object.item_groups.count %] + [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]

Hold next available item from an item group [% IF force_hold_level == 'item_group' %] @@ -677,7 +677,7 @@ - [% FOREACH g IN biblio.object.item_groups.search({}, { order_by => ['display_order'] }) %] + [% FOREACH g IN biblio_info.object.item_groups.search({}, { order_by => ['display_order'] }) %] [% IF g.items %] @@ -711,7 +711,7 @@ Item type [% END %] Barcode - [% IF Koha.Preference('EnableItemGroupHolds') && biblio.object.item_groups.count %] + [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %] Item group [% END %] Home library @@ -729,7 +729,7 @@ [% SET selected = 0 %] - [% FOREACH itemloo IN biblio.itemloop %] + [% FOREACH itemloo IN biblio_info.itemloop %] [% UNLESS ( itemloo.hide ) %] @@ -812,7 +812,7 @@ [% itemloo.barcode | html %] - [% IF Koha.Preference('EnableItemGroupHolds') && biblio.object.item_groups.count %] + [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %] [% itemloo.object.item_group.description | html %] @@ -912,7 +912,7 @@ [% IF hiddencount %]

- Show all items ([% hiddencount | html %] hidden) + Show all items ([% hiddencount | html %] hidden)

[% END # /IF hiddencount %] @@ -1312,7 +1312,7 @@ var biblionumbers = [[% biblionumbers.join(', ') | $raw %]]; var borrowernumber = "[% patron.borrowernumber | $raw %]"; var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]"; - var override_items = {[% FOREACH biblio IN biblioloop %][% FOREACH itemloo IN biblio.itemloop %][% IF ( itemloo.override ) %] + var override_items = {[% FOREACH biblio_info IN biblioloop %][% FOREACH itemloo IN biblio_info.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 186b3faff5c..bb2eb56f2af 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -698,7 +698,8 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) $template->param( exceeded_holds_per_record => $exceeded_holds_per_record ); # FIXME: getting just the first bib's result doesn't seem right $template->param( subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumbers[0])); -} elsif ( ! $multi_hold ) { +} +unless ($multi_hold) { my $biblio = Koha::Biblios->find( $biblionumbers[0] ); $template->param( biblio => $biblio ); } -- 2.34.1