Merge branch 'new/bug_5307' into kcmaster
[wip/koha-chris_n.git] / members / notices.pl
1 #!/usr/bin/perl
2
3 # Displays sent notices for a given borrower
4
5 # Copyright (c) 2009 BibLibre
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along
19 # with Koha; if not, write to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22 use strict;
23 #use warnings; FIXME - Bug 2505
24 use C4::Auth;
25 use C4::Output;
26 use CGI;
27 use C4::Members;
28 use C4::Branch;
29 use C4::Letters;
30
31 use C4::Dates qw/format_date/;
32 my $input=new CGI;
33
34
35 my $borrowernumber = $input->param('borrowernumber');
36 #get borrower details
37 my $borrower = GetMember(borrowernumber => $borrowernumber);
38
39 my ($template, $loggedinuser, $cookie)
40 = get_template_and_user({template_name => "members/notices.tmpl",
41                                 query => $input,
42                                 type => "intranet",
43                                 authnotrequired => 0,
44                                 flagsrequired => {borrowers => 1},
45                                 debug => 1,
46                                 });
47
48 $template->param( $borrower );
49 my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
50 $template->param( picture => 1 ) if $picture;
51
52 # Getting the messages
53 my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
54
55 $template->param(
56                         QUEUED_MESSAGES         => $queued_messages,
57                         BORROWER_INFO           => [ $borrower ],
58                         firstname               => $borrower->{'firstname'},
59                         surname                 => $borrower->{'surname'},
60                         borrowernumber          => $borrowernumber,
61                         sentnotices             => 1
62                 );
63 output_html_with_http_headers $input, $cookie, $template->output;
64
65
66