From 07b898fc607709e40ec210e52768c1640ddfa3e7 Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Fri, 6 Jan 2023 14:26:03 -0700 Subject: [PATCH] Bug 32272: Restore last and previous borrowers on moredetail Content-Type: text/plain; charset="utf-8" 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 --- 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.34.1