Bug 17386: Simplify code

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-10-04 13:58:13 +01:00 committed by Brendan Gallagher
parent d63f02a8c4
commit 649956b216
5 changed files with 22 additions and 40 deletions

View file

@ -1,13 +1,15 @@
<div class="alert alert-info">
<h3>Messages for you</h3>
<ul>
[% FOREACH message IN patron_messages %]
<li>
<strong>[% message.message %]</strong><br>
&nbsp;&nbsp;&nbsp;<i>Written on [% message.message_date | $KohaDates %] by [% Branches.GetName(message.branchcode) %]</i>
</li>
[% END %]
[% IF patron_messages.count OR opacnote %]
<div class="alert alert-info">
<h3>Messages for you</h3>
<ul>
[% FOREACH message IN patron_messages %]
<li>
<strong>[% message.message %]</strong><br>
&nbsp;&nbsp;&nbsp;<i>Written on [% message.message_date | $KohaDates %] by [% Branches.GetName(message.branchcode) %]</i>
</li>
[% END %]
[% IF ( opacnote ) %]<li>[% opacnote %]</li>[% END %]
</ul>
</div>
[% IF ( opacnote ) %]<li>[% opacnote %]</li>[% END %]
</ul>
</div>
[% END %]

View file

@ -40,9 +40,8 @@ Using this account is not recommended because some parts of Koha will not functi
</div>
[% END %]
[% IF ( bor_messages ) %]
[% INCLUDE 'opac-note.inc' %]
[% END %]
[% INCLUDE 'opac-note.inc' %]
<h2>Hello, [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]
</h2>

View file

@ -166,9 +166,7 @@
[% IF ( patronid ) %]
[% IF ( validuser ) %]
<div class="alert alert-info">You are logged in as [% borrowername %].</div>
[% IF ( bor_messages ) %]
[% INCLUDE 'opac-note.inc' %]
[% END %]
[% INCLUDE 'opac-note.inc' %]
[% END %]
[% IF ( nouser ) %]

View file

@ -308,16 +308,6 @@ my $patron_messages = Koha::Patron::Messages->search(
message_type => 'B',
}
);
if ( $patron_messages->count ) {
$template->param( bor_messages => 1 );
}
if ( $borr->{'opacnote'} ) {
$template->param(
bor_messages => 1,
opacnote => $borr->{'opacnote'},
);
}
if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor')
|| C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') )
@ -336,6 +326,7 @@ if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor'
$template->param(
borrower => $borr,
patron_messages => $patron_messages,
opacnote => $borr->{opacnote},
patronupdate => $patronupdate,
OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
userview => 1,

View file

@ -257,18 +257,10 @@ if ($borrower->{cardnumber}) {
message_type => 'B',
}
);
if ( $patron_messages->count ) {
$template->param( bor_messages => 1,
patron_messages => $patron_messages,
);
}
if ( $borrower->{'opacnote'} ) {
$template->param(
bor_messages => 1,
opacnote => $borrower->{'opacnote'},
);
}
$template->param(
patron_messages => $patron_messages,
opacnote => $borrower->{opacnote},
);
my $inputfocus = ($return_only == 1) ? 'returnbook' :
($confirm_required == 1) ? 'confirm' : 'barcode' ;