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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e9b3275376)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-01-03 11:19:32 +01:00 committed by Jacob O'Mara
parent a3a4a33158
commit d62ba07f28
2 changed files with 8 additions and 30 deletions

View file

@ -1,5 +1,7 @@
[% USE raw %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE KohaDates %]
[% USE Asset %]
[% SET is_popup = 1 %]
@ -241,12 +243,12 @@
<ul>
[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
<li>
<strong>[% ITEM_RESULT.branchname | html %]</strong>
[% IF ( ITEM_RESULT.location_opac ) %]<span class="shelvingloc">[% ITEM_RESULT.location_opac | html %]</span>[% END %]
<strong>[% Branches.GetName(ITEM_RESULT.holdingbranch) | html %]</strong>
<span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location, opac => 1 ) | html %]</span>
[% 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 %])
</li>
[% END %]
</ul>
@ -303,8 +305,8 @@
</td>
<td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]<ul>[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
<li>
[% ITEM_RESULT.branchname | html %]
[% IF ( ITEM_RESULT.location_opac ) %]<span class="shelvingloc">[% ITEM_RESULT.location_opac | html %]</span>[% END %]
[% Branches.GetName(ITEM_RESULT.holdingbranch) | html %]
<span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location, opac => 1 ) | html %]</span>
[% IF ( ITEM_RESULT.itemcallnumber ) %]
([% ITEM_RESULT.itemcallnumber | html %])
[% END %]

View file

@ -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;