Bug 17397: Simplify code passing the Koha::Object to the template

Instead of creating a new array

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-10-27 09:33:10 +02:00 committed by Kyle M Hall
parent 3d63c64915
commit 5833673157
2 changed files with 3 additions and 19 deletions

View File

@ -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'},

View File

@ -859,7 +859,7 @@ No patron matched <span class="ex">[% message | html %]</span>
[% END %]>
[% message.message_date | $KohaDates %]
[% Branches.GetName( message.branchcode ) %]
( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% message.manager_id %]">[% message.name %]</a> )
( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% message.manager_id %]">[% message.get_column('manager_firstname') %] [% message.get_column('manager_surname') %]</a> )
<i>"[% message.message %]"</i>
</span>
[% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %]