Lines 1-102
Link Here
|
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# Copyright 2008 LibLime |
4 |
# |
5 |
# This file is part of Koha. |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it under the |
8 |
# terms of the GNU General Public License as published by the Free Software |
9 |
# Foundation; either version 2 of the License, or (at your option) any later |
10 |
# version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
13 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
14 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
15 |
# |
16 |
# You should have received a copy of the GNU General Public License along |
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
|
20 |
|
21 |
use strict; |
22 |
use warnings; |
23 |
|
24 |
use CGI; |
25 |
use C4::Context; |
26 |
use C4::Auth; |
27 |
use C4::Output; |
28 |
use C4::Members; |
29 |
use C4::Members::Messaging; |
30 |
use C4::Dates; |
31 |
use C4::Reserves; |
32 |
use C4::Circulation; |
33 |
use C4::Koha; |
34 |
use C4::Letters; |
35 |
use C4::Biblio; |
36 |
use C4::Reserves; |
37 |
use C4::Branch; # GetBranchName |
38 |
|
39 |
use Data::Dumper; |
40 |
|
41 |
use vars qw($debug); |
42 |
|
43 |
BEGIN { |
44 |
$debug = $ENV{DEBUG} || 0; |
45 |
} |
46 |
|
47 |
my $dbh = C4::Context->dbh; |
48 |
|
49 |
my $query = CGI->new(); |
50 |
|
51 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
52 |
{ |
53 |
template_name => 'members/messaging.tmpl', |
54 |
query => $query, |
55 |
type => "intranet", |
56 |
authnotrequired => 0, |
57 |
flagsrequired => { borrowers => 1 }, |
58 |
debug => 1, |
59 |
} |
60 |
); |
61 |
my $borrowernumber = $query->param('borrowernumber'); |
62 |
my $borrower = GetMember( 'borrowernumber' => $borrowernumber ); |
63 |
my $branch = C4::Context->userenv->{'branch'}; |
64 |
|
65 |
$template->param( $borrower ); |
66 |
|
67 |
$borrower = GetMemberDetails( $borrowernumber ); |
68 |
|
69 |
|
70 |
if ( $borrower->{'category_type'} eq 'C') { |
71 |
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); |
72 |
my $cnt = scalar(@$catcodes); |
73 |
$template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; |
74 |
$template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; |
75 |
} |
76 |
|
77 |
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); |
78 |
$template->param( picture => 1 ) if $picture; |
79 |
|
80 |
# get some recent messages sent to this borrower for display: |
81 |
my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } ); |
82 |
|
83 |
$template->param( messagingview => 1, |
84 |
message_queue => $message_queue, |
85 |
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), |
86 |
borrowernumber => $borrowernumber, |
87 |
branchname => GetBranchName($borrower->{'branchcode'}), |
88 |
dateformat => C4::Context->preference("dateformat"), |
89 |
categoryname => $borrower->{'description'}, |
90 |
$borrower->{'categorycode'} => 1, |
91 |
); |
92 |
|
93 |
#$messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'} |
94 |
# ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'}; |
95 |
|
96 |
$template->param( %{ $borrower } ); |
97 |
$template->param( |
98 |
messagingview => 1, |
99 |
is_child => ($borrower->{'category_type'} eq 'C'), |
100 |
); |
101 |
|
102 |
output_html_with_http_headers $query, $cookie, $template->output; |