From d63f02a8c46439d76507bb1b07c40e6a86f4130a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Fri, 30 Sep 2016 21:30:00 +0200 Subject: [PATCH] Bug 17386: Add opac notes for patron to self checkout screen Display patron messages from OPAC summary page on SCO screen as well. To test: - Make sure you have patrons with and without OPAC note and OPAC messages - Log in to OPAC and go to patrons 'your summary' page to display note and messages - Apply patch - Refresh patrons detail page. Verify that it looks the same as before - Go to SCO - Log in as such patron - Verify that note and messages appear the same as on OPAC summary page Signed-off-by: Hector Castro Works as advertised Signed-off-by: Jonathan Druart Signed-off-by: Brendan Gallagher --- .../bootstrap/en/includes/opac-note.inc | 13 ++++++++++++ .../bootstrap/en/modules/opac-user.tt | 14 +------------ .../bootstrap/en/modules/sco/sco-main.tt | 3 +++ opac/sco/sco-main.pl | 21 +++++++++++++++++++ 4 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc new file mode 100644 index 0000000000..e5dff6c3c7 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc @@ -0,0 +1,13 @@ +
+

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 %] +
+
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 4e276435ab..5a857f3199 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -41,19 +41,7 @@ Using this account is not recommended because some parts of Koha will not functi [% END %] [% IF ( bor_messages ) %] -
-

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 %] -
-
+ [% INCLUDE 'opac-note.inc' %] [% END %]

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 11147ae3e6..e3b5413e31 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,6 +166,9 @@ [% IF ( patronid ) %] [% IF ( validuser ) %]
You are logged in as [% borrowername %].
+ [% IF ( bor_messages ) %] + [% INCLUDE 'opac-note.inc' %] + [% END %] [% END %] [% IF ( nouser ) %] diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index c97280b41c..8d2a1aefc4 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -47,6 +47,7 @@ use C4::Biblio; use C4::Items; use Koha::Acquisition::Currencies; use Koha::Patron::Images; +use Koha::Patron::Messages; my $query = new CGI; @@ -249,6 +250,26 @@ if ($borrower->{cardnumber}) { noitemlinks => 1 , borrowernumber => $borrower->{'borrowernumber'}, ); + + my $patron_messages = Koha::Patron::Messages->search( + { + borrowernumber => $borrower->{'borrowernumber'}, + 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'}, + ); + } + my $inputfocus = ($return_only == 1) ? 'returnbook' : ($confirm_required == 1) ? 'confirm' : 'barcode' ; $template->param( -- 2.39.5