From e6804714140b920b1400d4a985724b6fe99f8132 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 21 Nov 2022 10:20:22 +0100 Subject: [PATCH] Bug 32272: Restore last and previous borrowers on moredetail GetItemsInfo added a card0, card1 and card2 info with the cardnumbers of the last 3 borrowers. But 31315 forgot to adjust the code when it has been moved to using Koha::Items Test plan: Check an item in and out to several patrons Go to the moredetail page (items) and confirm that the "last borrowers" info is displayed Signed-off-by: Lucas Gass Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- catalogue/moredetail.pl | 9 ++++++++ .../prog/en/modules/catalogue/moredetail.tt | 23 +++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 90f2de0b07..6eb3fe7fda 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -235,6 +235,15 @@ foreach my $item (@items){ $item_info->{'nomod'}=1; } } + + $item_info->{old_issues} = Koha::Old::Checkouts->search( + { itemnumber => $item->itemnumber }, + { + order_by => { '-desc' => 'returndate' }, + limit => 3 + } + ); + push @item_data, $item_info; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 765c87fef4..5ba3e48b08 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -406,22 +406,15 @@ [% ITEM_DAT.object.last_returned_by.cardnumber | html %] [% END %] - [% IF ( ITEM_DAT.card0 ) %] + [% FOR i IN ITEM_DAT.old_issues %] + [% SET b = i.patron %]
  • - Last borrower: - [% ITEM_DAT.card0 | html %]  -
  • - [% END %] - [% IF ( ITEM_DAT.card1 ) %] -
  • - Previous borrower: - [% ITEM_DAT.card1 | html %]  -
  • - [% END %] - [% IF ( ITEM_DAT.card2 ) %] -
  • - Previous borrower: - [% ITEM_DAT.card2 | html %]  + [% IF loop.first %] + Last borrower: + [% ELSE %] + Previous borrower: + [% END %] + [% b.cardnumber | html %] 
  • [% END %] [% IF ( ITEM_DAT.paidfor ) %] -- 2.39.5