From 5833673157d75ba6fbf2caedf7931283b4eabf7d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Oct 2016 09:33:10 +0200 Subject: [PATCH] Bug 17397: Simplify code passing the Koha::Object to the template Instead of creating a new array Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- circ/circulation.pl | 20 ++----------------- .../prog/en/modules/circ/circulation.tt | 2 +- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index e51ed2efc4..ded56c4a33 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -566,7 +566,7 @@ if ( $borrowernumber && $borrower->{'category_type'} eq 'C') { $template->param( 'catcode' => $patron_categories->next ) if $patron_categories->count == 1; } -my $all_messages = Koha::Patron::Messages->search( +my $messages = Koha::Patron::Messages->search( { 'me.borrowernumber' => $borrowernumber, }, @@ -577,22 +577,6 @@ my $all_messages = Koha::Patron::Messages->search( } ); -my @messages; -while ( my $content = $all_messages->next ) { - my $this_item; - - $this_item->{borrowernumber} = $content->borrowernumber; - $this_item->{message_id} = $content->message_id; - $this_item->{branchcode} = $content->branchcode; - $this_item->{message_type} = $content->message_type; - $this_item->{message_date} = $content->message_date; - $this_item->{message} = $content->message; - $this_item->{manager_id} = $content->manager_id; - $this_item->{name} = $content->_result->get_column('manager_firstname') . ' ' . $content->_result->get_column('manager_surname'); - - push @messages, $this_item; -} - my $fast_cataloging = 0; if ( Koha::BiblioFrameworks->find('FA') ) { $fast_cataloging = 1 @@ -642,7 +626,7 @@ if ($restoreduedatespec || $stickyduedate) { $template->param( patron => $patron, - messages => \@messages, + messages => $messages, borrower => $borrower, borrowernumber => $borrowernumber, categoryname => $borrower->{'description'}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index eab3ef2aa1..d8d2943763 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -859,7 +859,7 @@ No patron matched [% message | html %] [% END %]> [% message.message_date | $KohaDates %] [% Branches.GetName( message.branchcode ) %] - ( [% message.name %] ) + ( [% message.get_column('manager_firstname') %] [% message.get_column('manager_surname') %] ) "[% message.message %]" [% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %] -- 2.39.2