Bug 9543 - Show patrons messaging subscription on holds notification
authorMarc Véron <veron@veron.ch>
Thu, 24 Mar 2016 15:06:30 +0000 (16:06 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Fri, 3 Jun 2016 08:47:41 +0000 (08:47 +0000)
Display an information about a patron's messaging preferences if an item
is checked in where the patron has put a hold.

To test:

- Apply patch
- Make sure that SMS driver and TalkingTech sysprefs are defined to
  enable SMS and Phone preferences for users (SMS driver can be a dummy
  value)
- Place a hold for a patron
- Set patron's messaging preferences to different choices (including none)
- Check in the item that is on hold (it has not to be checked out for the
  test
- Verify that below the message "Hold found (item is already waiting") an
  information appears about the patron's messaging preferences.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Chris Kirby <christopherlawrencekirby@gmail.com>

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

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

index 49899f0..3804543 100755 (executable)
@@ -44,6 +44,7 @@ use C4::Reserves;
 use C4::Biblio;
 use C4::Items;
 use C4::Members;
+use C4::Members::Messaging;
 use C4::Branch; # GetBranches GetBranchName
 use C4::Koha;   # FIXME : is it still useful ?
 use C4::RotatingCollections;
@@ -429,7 +430,7 @@ if ( $messages->{'ResFound'}) {
     my $reserve    = $messages->{'ResFound'};
     my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
     my $borr = C4::Members::GetMember( borrowernumber => $reserve->{'borrowernumber'} );
-
+    my $holdmsgpreferences =  C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $reserve->{'borrowernumber'}, message_name   => 'Hold_Filled' } );
     if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) {
         if ( $reserve->{'ResFound'} eq "Waiting" ) {
             $template->param(
@@ -468,6 +469,7 @@ if ( $messages->{'ResFound'}) {
             borrowernumber => $reserve->{'borrowernumber'},
             itemnumber     => $reserve->{'itemnumber'},
             reservenotes   => $reserve->{'reservenotes'},
+            bormessagepref => $holdmsgpreferences->{'transports'},
         );
     } # else { ; }  # error?
 }
index 6a9f868..17a20d4 100644 (file)
@@ -238,6 +238,17 @@ $(document).ready(function () {
             [% borcity %] [% borzip %]</li>
            [% IF ( borphone ) %]<li> [% borphone %]</li>[% END %]
                   [% IF ( boremail ) %]<li><a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a></li>[% END %]
+           [% IF ( bormessagepref ) %]
+               <li>Patron is notified:
+               [% FOREACH key IN bormessagepref.keys %]
+                   [% IF ( key == 'email' ) %] Email. [% END %]
+                   [% IF ( key == 'phone' ) %] Phone. [% END %]
+                   [% IF ( key == 'sms' ) %] SMS. [% END %]
+               [% END %]
+               </li>
+           [% ELSE %]
+               <li>Patron is not notified</li>
+           [% END %]
 [% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
 [% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]</ul>
                [% IF ( transfertodo ) %]