From 57de16c0074dca2ee2cdd6ae991ea0b6f717e63c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 4 Oct 2016 13:58:13 +0100 Subject: [PATCH] Bug 17386: Simplify code Signed-off-by: Jonathan Druart --- .../opac-tmpl/bootstrap/en/includes/opac-note.inc | 26 ++++++++++++---------- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 5 ++--- .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 4 +--- opac/opac-user.pl | 11 +-------- opac/sco/sco-main.pl | 16 ++++--------- 5 files changed, 22 insertions(+), 40 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc index e5dff6c..e2b3d67 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc @@ -1,13 +1,15 @@ -
-

Messages for you

-
    - [% FOREACH message IN patron_messages %] -
  • - [% message.message %]
    -    Written on [% message.message_date | $KohaDates %] by [% Branches.GetName(message.branchcode) %] -
  • - [% END %] +[% IF patron_messages.count OR opacnote %] +
    +

    Messages for you

    +
      + [% FOREACH message IN patron_messages %] +
    • + [% message.message %]
      +    Written on [% message.message_date | $KohaDates %] by [% Branches.GetName(message.branchcode) %] +
    • + [% END %] - [% IF ( opacnote ) %]
    • [% opacnote %]
    • [% END %] -
    -
    + [% IF ( opacnote ) %]
  • [% opacnote %]
  • [% END %] +
+
+[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 5a857f3..b7ac6f9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -40,9 +40,8 @@ Using this account is not recommended because some parts of Koha will not functi [% END %] - [% IF ( bor_messages ) %] - [% INCLUDE 'opac-note.inc' %] - [% END %] + [% INCLUDE 'opac-note.inc' %] +

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 %]

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index e3b5413..3e5d7f4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -166,9 +166,7 @@ [% IF ( patronid ) %] [% IF ( validuser ) %]
You are logged in as [% borrowername %].
- [% IF ( bor_messages ) %] - [% INCLUDE 'opac-note.inc' %] - [% END %] + [% INCLUDE 'opac-note.inc' %] [% END %] [% IF ( nouser ) %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 7eb8749..0ac78de 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -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, diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 8d2a1ae..0a59d3b 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -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' ; -- 2.8.1