From 3a07482336fb7be395ce83b414c90731b9454cb4 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 --- 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 c5492eb..dd630d7 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -564,7 +564,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, }, @@ -575,22 +575,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 (defined getframeworkinfo('FA')) { $fast_cataloging = 1 @@ -639,7 +623,7 @@ if ($restoreduedatespec || $stickyduedate) { } $template->param( - 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 7c65ad0..78c52a0 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.1.4