From 10ac7876d6327058fb86914dde044c6a8053b15b 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 Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- .../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 4cef22c9f6..75209edfda 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -623,26 +623,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' %] @@ -669,7 +669,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 %] @@ -703,7 +703,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 @@ -721,7 +721,7 @@ [% SET selected = 0 %] - [% FOREACH itemloo IN biblio.itemloop %] + [% FOREACH itemloo IN biblio_info.itemloop %] [% UNLESS ( itemloo.hide ) %] @@ -804,7 +804,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 %] @@ -903,7 +903,7 @@ [% IF hiddencount %]

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

[% END # /IF hiddencount %] @@ -1318,7 +1318,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 36e8eb2aad..6989485f0b 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.39.5