[Koha-patches] [PATCH] Adding notices.pl which enables staff to see what notices have been sent to user

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Mon Aug 24 23:47:18 CEST 2009


---
 .../intranet-tmpl/prog/en/includes/circ-menu.inc   |    7 +-
 .../prog/en/modules/members/notices.tmpl           |   62 ++++++++++++++++++
 members/notices.pl                                 |   66 ++++++++++++++++++++
 3 files changed, 132 insertions(+), 3 deletions(-)
 create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tmpl
 create mode 100755 members/notices.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 67e7b39..56dd2f2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
@@ -63,9 +63,10 @@
 	<!-- /TMPL_IF -->
 	<!-- TMPL_IF NAME="intranetreadinghistory" --><!-- TMPL_IF NAME="readingrecordview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Circulation History</a></li><!-- /TMPL_IF -->
 	<!-- TMPL_IF NAME="CAN_user_parameters"--><!-- TMPL_IF NAME="logview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;action=MODIFY&amp;object=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;src=circ">Modification Log</a></li><!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
-          <!-- TMPL_IF NAME="messagingview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Messaging</a></li>
-        <!-- /TMPL_IF -->
+    <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
+    <!-- TMPL_IF NAME="messagingview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Messaging</a></li>
+    <!-- /TMPL_IF -->	
+	<!-- TMPL_IF NAME="sentnotices" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/notices.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Notices</a></li>
 </ul></div>
 <!-- /TMPL_IF -->
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tmpl
new file mode 100644
index 0000000..35acf9a
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tmpl
@@ -0,0 +1,62 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Sent notices for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<script type="text/javascript" language="javascript">
+//<![CDATA[
+    $(document).ready(function() {
+	$("#noticestable").tablesorter({
+	    <!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk'
+	    <!-- /TMPL_IF -->
+	});
+    });
+//]]>
+</script>
+
+</head>
+<body>
+<!-- TMPL_INCLUDE NAME="header.inc" -->
+<!-- TMPL_INCLUDE NAME="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; Sent notices for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></div>
+
+<div id="doc3" class="yui-t2">
+   
+   <div id="bd">
+	<div id="yui-main">
+	<div class="yui-b">
+<!-- TMPL_INCLUDE NAME="circ-toolbar.inc" -->
+<h1>Sent notices for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></h1>
+
+    <table id="noticestable">
+	<thead>
+	    <tr>
+		<th>Subject</th>
+		<th>Content</th>
+		<th>Type</th>
+		<th>Status</th>
+		<th>Time</th>
+	    </tr>
+	</thead>
+	<tbody>
+	    <!-- TMPL_LOOP NAME="QUEUED_MESSAGES" -->
+	    <tr>
+		<td><!-- TMPL_VAR NAME="subject" --></td>
+		<td><!-- TMPL_VAR NAME="content" --></td>
+		<td><!-- TMPL_VAR NAME="message_transport_type" --></td>
+		<td><!-- TMPL_VAR NAME="status" --></td>
+		<td><!-- TMPL_VAR NAME="time_queued" --></td>
+	    </tr>
+	    <!-- /TMPL_LOOP -->
+	</tbody>
+    </table>
+
+</div>
+</div>
+
+<div class="yui-b">
+<!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
+</div>
+</div>
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/members/notices.pl b/members/notices.pl
new file mode 100755
index 0000000..da615d4
--- /dev/null
+++ b/members/notices.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+# Displays sent notices for a given borrower
+
+# Copyright (c) 2009 BibLibre
+#
+# 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., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+use strict;
+use C4::Auth;
+use C4::Output;
+use CGI;
+use C4::Members;
+use C4::Branch;
+use C4::Letters;
+
+use C4::Dates qw/format_date/;
+my $input=new CGI;
+
+
+my $borrowernumber = $input->param('borrowernumber');
+#get borrower details
+my $borrower = GetMember(borrowernumber=>$borrowernumber);
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "members/notices.tmpl",
+				query => $input,
+				type => "intranet",
+				authnotrequired => 0,
+				flagsrequired => {borrowers => 1},
+				debug => 1,
+				});
+
+$template->param( $borrower );
+my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
+$template->param( picture => 1 ) if $picture;
+
+# Getting the messages
+my $queued_messages = C4::Letters::GetQueuedMessages({$borrowernumber});
+
+warn Data::Dumper::Dumper( $queued_messages );
+$template->param(
+			QUEUED_MESSAGES 	=> $queued_messages,
+ 			BORROWER_INFO         	=> [ $borrower ],
+                        firstname 		=> $borrower->{'firstname'},
+			surname 		=> $borrower->{'surname'},
+			borrowernumber 		=> $borrowernumber,
+			sentnotices 		=> 1
+		);
+output_html_with_http_headers $input, $cookie, $template->output;
+
+
+
-- 
1.6.0.4




More information about the Koha-patches mailing list