Bug 17386: Add opac notes for patron to self checkout screen
authorMarc Véron <veron@veron.ch>
Fri, 30 Sep 2016 19:30:00 +0000 (21:30 +0200)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Mon, 10 Oct 2016 14:08:20 +0000 (14:08 +0000)
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 <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc [new file with mode: 0644]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
opac/sco/sco-main.pl

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 (file)
index 0000000..e5dff6c
--- /dev/null
@@ -0,0 +1,13 @@
+<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>
index 4e27643..5a857f3 100644 (file)
@@ -41,19 +41,7 @@ Using this account is not recommended because some parts of Koha will not functi
                     [% END %]
 
                     [% IF ( bor_messages ) %]
-                        <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>
+                        [% INCLUDE 'opac-note.inc' %]
                     [% END %]
                     <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>
index 11147ae..e3b5413 100644 (file)
                         [% IF ( patronid ) %]
                             [% IF ( validuser ) %]
                                 <div class="alert alert-info">You are logged in as [% borrowername %].</div>
+                                [% IF ( bor_messages ) %]
+                                    [% INCLUDE 'opac-note.inc' %]
+                                [% END %]
                             [% END %]
 
                             [% IF ( nouser ) %]
index c97280b..8d2a1ae 100755 (executable)
@@ -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(