Bug 20948: Simplify existing code
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 18 Nov 2019 09:10:56 +0000 (10:10 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 9 Dec 2019 14:34:44 +0000 (14:34 +0000)
No changes expected here.

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

catalogue/detail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

index 511855e..249a741 100755 (executable)
@@ -314,13 +314,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 ) {
index c24edd0..bb8cc89 100644 (file)
                             [% 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 %]