From caf97029df8266f9c0ccba090cd75285fafd1224 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 18 Nov 2019 10:10:56 +0100 Subject: [PATCH] Bug 20948: Simplify existing code No changes expected here. Signed-off-by: Lisette Scheer Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit bdffc685f2c715b683d3b31e7c218ba71800bf43) Signed-off-by: Lucas Gass (cherry picked from commit 62021926df99639a4432ce798f4483bbf8edaaba) Signed-off-by: Hayley Mapley --- catalogue/detail.pl | 8 +------- .../prog/en/modules/catalogue/detail.tt | 13 +++++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 42d93dd034..b7b20c17a3 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -281,13 +281,7 @@ foreach my $item (@items) { my $item_object = Koha::Items->find( $item->{itemnumber} ); my $holds = $item_object->current_holds; if ( my $first_hold = $holds->next ) { - my $patron = Koha::Patrons->find( $first_hold->borrowernumber ); - $item->{backgroundcolor} = 'reserved'; - $item->{reservedate} = $first_hold->reservedate; - $item->{ReservedFor} = $patron, - $item->{ExpectedAtLibrary} = $first_hold->branchcode; - # Check waiting status - $item->{waitingdate} = $first_hold->waitingdate; + $item->{first_hold} = $first_hold; } if ( my $checkout = $item_object->checkout ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index ee4bd2f232..96684226ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -484,18 +484,19 @@ [% END %] [% END %] - [% IF ( item.reservedate ) %] - [% IF ( item.waitingdate ) %] - Waiting at [% Branches.GetName( item.ExpectedAtLibrary ) | html %] since [% item.waitingdate | $KohaDates %]. + [% SET hold = item.first_hold %] + [% IF hold %] + [% IF hold.waitingdate %] + Waiting at [% Branches.GetName( hold.branchcode ) | html %] since [% hold.waitingdate | $KohaDates %]. [% ELSE %] - Item-level hold (placed [% item.reservedate | $KohaDates %]) for delivery at [% Branches.GetName( item.ExpectedAtLibrary ) | html %]. + Item-level hold (placed [% hold.reservedate | $KohaDates %]) for delivery at [% Branches.GetName( hold.branchcode ) | html %]. [% END %] [% IF ( canreservefromotherbranches ) %] Hold for: - [% INCLUDE 'patron-title.inc' patron=item.ReservedFor hide_patron_infos_if_needed=1 %] + [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %] [% END %] [% END %] - [% UNLESS ( item.itemnotforloan || item.notforloan_per_itemtype || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfertwhen || item.reservedate ) %] + [% UNLESS ( item.itemnotforloan || item.notforloan_per_itemtype || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfertwhen || hold ) %] Available [% END %] -- 2.39.5