[Koha-patches] [PATCH] [Signed Off] Bug 3941 - Combine Notices & Messaging Tabs

Liz Rea lrea at nekls.org
Thu Sep 22 22:31:18 CEST 2011


From: Katrin Fischer <Katrin.Fischer.83 at web.de>

Changes to notices tab to make it a full replacement for messages tab.
Removes messages tab from patron account.

- repairs view of patron address in left column (category description, branch)
- shows some explanation, when there are no messages for a borrower
- makes the notice an expandable field, a click on the subject will
  expand the field to show the message content
- makes message status and message transport type translatable,
  by moving the possible values into the template
- removes the messaging tab from various menus
- removes the files that were associated with the messaging tab
- preserves the line breaks in message content to improve readability

Also fixes Bug 6593 - Some information missing from the "Notices" tab.

Signed-off-by: Liz Rea <lrea at nekls.org>
---
 .../intranet-tmpl/prog/en/includes/circ-menu.inc   |    1 -
 .../intranet-tmpl/prog/en/includes/circ-menu.tt    |    1 -
 .../prog/en/includes/members-menu.inc              |    1 -
 .../prog/en/modules/members/messaging.tt           |   68 -------------
 .../prog/en/modules/members/notices.tt             |   51 ++++++++--
 members/messaging.pl                               |  102 --------------------
 members/notices.pl                                 |    4 +-
 7 files changed, 43 insertions(+), 185 deletions(-)
 delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt
 delete mode 100755 members/messaging.pl

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
index 129bd66..cf5a675 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
@@ -63,7 +63,6 @@
 	[% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]">Circulation History</a></li>[% END %]
 	[% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;modules=circulation&amp;object=[% borrowernumber %]&amp;src=circ">Modification Log</a></li>[% END %]
     [% IF ( EnhancedMessagingPreferences ) %]
-    [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrowernumber %]">Messaging</a></li>
     [% END %]	
 	[% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber %]">Notices</a></li>
 </ul></div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
index 39be1be..8d5e3b8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
@@ -65,7 +65,6 @@ in the global namespace %]
 	[% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrower.borrowernumber %]">Circulation History</a></li>[% END %]
 	[% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;modules=circulation&amp;object=[% borrower.borrowernumber %]&amp;src=circ">Modification Log</a></li>[% END %]
     [% IF ( EnhancedMessagingPreferences ) %]
-    [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrower.borrowernumber %]">Messaging</a></li>
     [% END %]
     [% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrower.borrowernumber %]">Notices</a></li>
 </ul></div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
index a7b77e2..cadd1cb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
@@ -8,7 +8,6 @@
 	[% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]">Circulation History</a></li>[% END %]
 	[% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;action=MODIFY&amp;object=[% borrowernumber %]">Modification Log</a></li>[% END %]
     [% IF ( EnhancedMessagingPreferences ) %]
-    [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrowernumber %]">Messaging</a></li>
     [% END %]
 	[% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber %]">Notices</a></li>
 </ul></div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt
deleted file mode 100644
index 2980a53..0000000
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tt
+++ /dev/null
@@ -1,68 +0,0 @@
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Patron Details for [% firstname %] [% surname %] ([% cardnumber %])[% END %]</title>
-[% INCLUDE 'doc-head-close.inc' %]
-</head>
-<body>
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'patron-search.inc' %]
-
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Patron Details for [% firstname %] [% surname %] ([% cardnumber %])[% END %] </div>
-
-<div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-	<div id="yui-main">
-	<div class="yui-b">
-[% INCLUDE 'members-toolbar.inc' %]
-[% IF ( error ) %]
-<div class="dialog alert">
-[% IF ( AUTH_UPDATE_FAILED ) %]
-<h3>Userid / Password update failed</h3>
-<strong>Insufficient privileges.</strong>
-<p>Other fields updated.</p>
-[% END %]
-[% IF ( CANT_DELETE_STAFF ) %]
-<h3>Unable to delete staff user</h3>
-<p>Insufficient privileges.</p>
-[% END %]
-[% IF ( CANT_DELETE_OTHERLIBRARY ) %]
-<h3>Unable to delete patrons from other libraries with current settings</h3>
-<p>Insufficient privileges.</p>
-[% END %]
-[% IF ( CANT_DELETE ) %]
-<h3>Unable to delete patron:</h3>
-<p>Insufficient privileges.</p>
-[% END %]
-</div>
-[% END %]
-<div class="yui-g">
-[% IF ( unknowuser ) %]
-   <div class="dialog message">
-   	 This patron does not exist.
-   </div>
-[% ELSE %]
-
-<table>
-  <caption>Message Queue</caption>
-  <tr><th>Type</th><th>Subject</th><th>Status</th><th>Time Prepared</th></tr>
-[% IF ( message_queue ) %]
-  [% FOREACH message_queu IN message_queue %]
-    <tr><td>[% message_queu.message_transport_type %]</td><td>[% message_queu.subject %]</td><td>[% message_queu.status %]</td><td>[% message_queu.time_queued %]</td></tr>
-  [% END %]
-[% ELSE %]
-  <tr><td colspan="4">There is no record of any messages that have been sent to this patron.</td></tr>
-[% END %]
-</table>
-
-</div>
-
-[% END %] <!-- unknowuser -->
-
-
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'circ-menu.inc' %]
-</div>
-</div>
-[% INCLUDE 'intranet-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
index 2bce08a..8dcf7d7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
@@ -10,10 +10,20 @@
 		dateFormat: 'uk'
 	    [% END %]
 	});
+    
+    $("a.message-title").click(function(e){
+        $("p.message").hide();
+        $(this).next("p").show();
+        e.preventDefault();
+    });
+    
     });
 //]]>
 </script>
-
+<style type="text/css">
+    p.message { display: none; }
+    a.message-title { font-weight: bold; display: block; }
+</style>
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
@@ -22,34 +32,53 @@
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Sent notices for [% firstname %] [% surname %]</div>
 
 <div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-	<div id="yui-main">
-	<div class="yui-b">
+    <div id="bd">
+    <div id="yui-main">
+    <div class="yui-b">
 [% INCLUDE 'circ-toolbar.inc' %]
 <h1>Sent notices for [% firstname %] [% surname %]</h1>
 
+
     <table id="noticestable">
 	<thead>
 	    <tr>
-		<th>Subject</th>
-		<th>Content</th>
+		<th>Notice</th>
 		<th>Type</th>
 		<th>Status</th>
 		<th>Time</th>
 	    </tr>
 	</thead>
+[% IF ( QUEUED_MESSAGES ) %]
 	<tbody>
 	    [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
 	    <tr>
-		<td>[% QUEUED_MESSAGE.subject %]</td>
-		<td>[% QUEUED_MESSAGE.content %]</td>
-		<td>[% QUEUED_MESSAGE.message_transport_type %]</td>
-		<td>[% QUEUED_MESSAGE.status %]</td>
+		<td>
+            <a class="message-title" href="#">[% QUEUED_MESSAGE.subject %]</a>
+            <p class="message">
+                [% QUEUED_MESSAGE.content FILTER html_line_break %]
+            </p>
+        </td>
+		<td>
+            [% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]email
+            [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'print' ) %]print
+            [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'feed' ) %]feed
+            [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'sms' ) %]sms
+            [% ELSE %][% QUEUED_MESSAGE.message_transport_type %][% END %]
+        </td>
+		<td>
+            [% IF ( QUEUED_MESSAGE.status == 'sent' ) %]sent
+            [% ELSIF ( QUEUED_MESSAGE.status == 'pending' ) %]pending
+            [% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]failed
+            [% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
+            [% ELSE %][% QUEUED_MESSAGE.status %][% END %]
+        </td>
 		<td>[% QUEUED_MESSAGE.time_queued %]</td>
 	    </tr>
 	    [% END %]
 	</tbody>
+    [% ELSE %]
+    <tr><td colspan="4">There is no record of any messages that have been sent to this patron.</td></tr>
+    [% END %]
     </table>
 
 </div>
diff --git a/members/messaging.pl b/members/messaging.pl
deleted file mode 100755
index 8791dcf..0000000
--- a/members/messaging.pl
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright 2008 LibLime
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-use strict;
-use warnings;
-
-use CGI;
-use C4::Context;
-use C4::Auth;
-use C4::Output;
-use C4::Members;
-use C4::Members::Messaging;
-use C4::Dates;
-use C4::Reserves;
-use C4::Circulation;
-use C4::Koha;
-use C4::Letters;
-use C4::Biblio;
-use C4::Reserves;
-use C4::Branch; # GetBranchName
-
-use Data::Dumper;
-
-use vars qw($debug);
-
-BEGIN {
-	$debug = $ENV{DEBUG} || 0;
-}
-
-my $dbh = C4::Context->dbh;
-
-my $query = CGI->new();
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-    {
-        template_name   => 'members/messaging.tmpl',
-        query           => $query,
-        type            => "intranet",
-        authnotrequired => 0,
-        flagsrequired   => { borrowers => 1 },
-        debug           => 1,
-    }
-);
-my $borrowernumber = $query->param('borrowernumber');
-my $borrower       = GetMember( 'borrowernumber' => $borrowernumber );
-my $branch         = C4::Context->userenv->{'branch'};
-
-$template->param( $borrower );
-
-$borrower = GetMemberDetails( $borrowernumber );
-
-
-    if ( $borrower->{'category_type'} eq 'C') {
-        my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
-        my $cnt = scalar(@$catcodes);
-        $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
-        $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
-    }
-	
-my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
-$template->param( picture => 1 ) if $picture;
-
-# get some recent messages sent to this borrower for display:
-my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } );
-
-$template->param( messagingview               => 1,
-                  message_queue               => $message_queue,
-                  DHTMLcalendar_dateformat    => C4::Dates->DHTMLcalendar(), 
-                  borrowernumber              => $borrowernumber,
-                  branchname		      => GetBranchName($borrower->{'branchcode'}),
-                  dateformat                  => C4::Context->preference("dateformat"),
-                  categoryname                => $borrower->{'description'},
-                  $borrower->{'categorycode'} => 1,
-);
-
-#$messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'}
-#  ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'};
-
-$template->param( %{ $borrower } );
-$template->param(
-                  messagingview         => 1,
-				  is_child        => ($borrower->{'category_type'} eq 'C'),
-                );
-
-output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/members/notices.pl b/members/notices.pl
index 088d5a8..7955581 100755
--- a/members/notices.pl
+++ b/members/notices.pl
@@ -56,7 +56,9 @@ $template->param( %{$borrower} );
 $template->param(
 			QUEUED_MESSAGES 	=> $queued_messages,
 			borrowernumber 		=> $borrowernumber,
-			sentnotices 		=> 1
+			sentnotices 		=> 1,
+            branchname          => GetBranchName($borrower->{'branchcode'}),
+            categoryname        => $borrower->{'description'},
 		);
 output_html_with_http_headers $input, $cookie, $template->output;
 
-- 
1.7.2.5



More information about the Koha-patches mailing list