Revert "MT2232 : members/notices.pl and members/messaging.pl are doing the same thing"
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 28 Jan 2010 08:22:42 +0000 (09:22 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 28 Jan 2010 14:11:57 +0000 (15:11 +0100)
This reverts commit 653de3c295b5b21ddfe11f0597b4ba7092f1effc.
Should remove members/notices.pl instead

koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl [new file with mode: 0644]
members/messaging.pl [new file with mode: 0755]

index 8db64af..443e12b 100644 (file)
@@ -66,6 +66,9 @@
        <!-- /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="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 -->
index aebb2bf..513d415 100644 (file)
@@ -7,6 +7,9 @@
        <!-- /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" -->">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 -->
 </ul>
 </div>
 <!-- /TMPL_IF -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl
new file mode 100644 (file)
index 0000000..75bec95
--- /dev/null
@@ -0,0 +1,68 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Koha &rsaquo; Patrons &rsaquo; <!-- TMPL_IF NAME="unknowuser" -->Patron does not exist<!-- TMPL_ELSE -->Patron Details for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_IF --></title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+</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; <!-- TMPL_IF NAME="unknowuser" -->Patron does not exist<!-- TMPL_ELSE -->Patron Details for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_IF --> </div>
+
+<div id="doc3" class="yui-t2">
+   
+   <div id="bd">
+       <div id="yui-main">
+       <div class="yui-b">
+<!-- TMPL_INCLUDE NAME="members-toolbar.inc" -->
+<!-- TMPL_IF NAME="error" -->
+<div class="dialog alert">
+<!-- TMPL_IF NAME="AUTH_UPDATE_FAILED" -->
+<h3>Userid / Password update failed</h3>
+<strong>Insufficient privileges.</strong>
+<p>Other fields updated.</p>
+<!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="CANT_DELETE_STAFF" -->
+<h3>Unable to delete staff user</h3>
+<p>Insufficient privileges.</p>
+<!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="CANT_DELETE_OTHERLIBRARY" -->
+<h3>Unable to delete patrons from other libraries with current settings</h3>
+<p>Insufficient privileges.</p>
+<!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="CANT_DELETE" -->
+<h3>Unable to delete patron:</h3>
+<p>Insufficient privileges.</p>
+<!-- /TMPL_IF -->
+</div>
+<!-- /TMPL_IF -->
+<div class="yui-g">
+<!-- TMPL_IF NAME="unknowuser" -->
+   <div class="dialog message">
+        This patron does not exist.
+   </div>
+<!-- TMPL_ELSE -->
+
+<table>
+  <caption>Message Queue</caption>
+  <tr><th>Type</th><th>Subject</th><th>Status</th><th>Time Prepared</th></tr>
+<!-- TMPL_IF NAME="message_queue" -->
+  <!-- TMPL_LOOP name="message_queue" -->
+    <tr><td><!-- TMPL_VAR NAME="message_transport_type" --></td><td><!-- TMPL_VAR NAME="subject" --></td><td><!-- TMPL_VAR NAME="status" --></td><td><!-- TMPL_VAR NAME="time_queued" --></td></tr>
+  <!-- /TMPL_LOOP -->
+<!-- TMPL_ELSE -->
+  <tr><td colspan="4">There is no record of any messages that have been sent to this patron.</td></tr>
+<!-- /TMPL_IF -->
+</table>
+
+</div>
+
+<!-- /TMPL_IF --> <!-- unknowuser -->
+
+
+</div>
+</div>
+<div class="yui-b">
+<!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
+</div>
+</div>
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/members/messaging.pl b/members/messaging.pl
new file mode 100755 (executable)
index 0000000..6390dad
--- /dev/null
@@ -0,0 +1,102 @@
+#!/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., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 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,
+                  branchcode                  => $borrower->{'branchcode'},
+                  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_INFO         => [ $borrower ],
+                  messagingview         => 1,
+                                 is_child        => ($borrower->{'category_type'} eq 'C'),
+                );
+
+output_html_with_http_headers $query, $cookie, $template->output;