From e9b3275376810e8524425b09d2272545262b93dd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 3 Jan 2023 11:19:32 +0100 Subject: [PATCH] Bug 32445: Fix availability display on opac-basket Also fix holding branch Will display an empty span if no location, big deal? Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .../bootstrap/en/modules/opac-basket.tt | 12 +++++---- opac/opac-basket.pl | 26 +------------------ 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index 4e6219c0bd..23d8c10f7c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -1,5 +1,7 @@ [% USE raw %] [% USE Koha %] +[% USE AuthorisedValues %] +[% USE Branches %] [% USE KohaDates %] [% USE Asset %] [% SET is_popup = 1 %] @@ -241,12 +243,12 @@
    [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
  • - [% ITEM_RESULT.branchname | html %] - [% IF ( ITEM_RESULT.location_opac ) %][% ITEM_RESULT.location_opac | html %][% END %] + [% Branches.GetName(ITEM_RESULT.holdingbranch) | html %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location, opac => 1 ) | html %] [% IF ( ITEM_RESULT.itemcallnumber ) %] ([% ITEM_RESULT.itemcallnumber | html %]) [% END %] - ([% INCLUDE 'item-status.inc' item = ITEM_RESULT %]) + ([% INCLUDE 'item-status.inc' item = ITEM_RESULT.item_object %])
  • [% END %]
@@ -303,8 +305,8 @@ [% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]
    [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
  • - [% ITEM_RESULT.branchname | html %] - [% IF ( ITEM_RESULT.location_opac ) %][% ITEM_RESULT.location_opac | html %][% END %] + [% Branches.GetName(ITEM_RESULT.holdingbranch) | html %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location, opac => 1 ) | html %] [% IF ( ITEM_RESULT.itemcallnumber ) %] ([% ITEM_RESULT.itemcallnumber | html %]) [% END %] diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index 411ae6444c..d6b11acf4c 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -93,22 +93,10 @@ foreach my $biblionumber ( @bibs ) { next if $biblio->hidden_in_opac({ rules => $rules }); - # grab all the items... - my $items = $biblio->items->filter_by_visible_in_opac({ patron => $logged_in_user })->unblessed; - foreach my $item (@$items) { - my $reserve_status = C4::Reserves::GetReserveStatus($item->{itemnumber}); - if( $reserve_status eq "Waiting"){ $item->{'waiting'} = 1; } - if( $reserve_status eq "Processing"){ $item->{'processing'} = 1; } - } - my $hasauthors = 0; if($dat->{'author'} || @$marcauthorsarray) { $hasauthors = 1; } - my $collections = - { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.ccode' } ) }; - my $shelflocations = - { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) }; # COinS format FIXME: for books Only my $fmt = substr $record->leader(), 6,2; @@ -120,21 +108,9 @@ foreach my $biblionumber ( @bibs ) { $dat->{'even'} = 1; } - for my $itm (@$items) { - if ($itm->{'location'}){ - $itm->{'location_opac'} = $shelflocations->{$itm->{'location'} }; - } - my $item_object = Koha::Items->find($itm->{itemnumber}); - my $transfer = $item_object->get_transfer; - if ( $transfer && $transfer->in_transit ) { - $itm->{transfertwhen} = $transfer->datesent; - $itm->{transfertfrom} = $transfer->frombranch; - $itm->{transfertto} = $transfer->tobranch; - } - } $num++; $dat->{biblionumber} = $biblionumber; - $dat->{ITEM_RESULTS} = $items; + $dat->{ITEM_RESULTS} = $biblio->items->filter_by_visible_in_opac({ patron => $logged_in_user }); $dat->{MARCNOTES} = $marcnotesarray; $dat->{MARCSUBJCTS} = $marcsubjctsarray; $dat->{MARCAUTHORS} = $marcauthorsarray; -- 2.39.5