Add release notes to 16.05.14 release
[koha.git] / members / notices.pl
blob2c694f7207fded4d347498340fd0961696721555
1 #!/usr/bin/perl
3 # Displays sent notices for a given borrower
5 # Copyright (c) 2009 BibLibre
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
22 use strict;
23 #use warnings; FIXME - Bug 2505
24 use C4::Auth;
25 use C4::Output;
26 use CGI qw ( -utf8 );
27 use C4::Members;
28 use C4::Branch;
29 use C4::Letters;
30 use C4::Members::Attributes qw(GetBorrowerAttributes);
31 use Koha::Patron::Images;
33 my $input=new CGI;
36 my $borrowernumber = $input->param('borrowernumber');
37 #get borrower details
38 my $borrower = GetMember(borrowernumber => $borrowernumber);
40 my ($template, $loggedinuser, $cookie)
41 = get_template_and_user({template_name => "members/notices.tt",
42 query => $input,
43 type => "intranet",
44 authnotrequired => 0,
45 flagsrequired => {borrowers => 1},
46 debug => 1,
47 });
49 $template->param( $borrower );
50 my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
51 $template->param( picture => 1 ) if $patron_image;
53 # Allow resending of messages in Notices tab
54 my $op = $input->param('op') || q{};
55 if ( $op eq 'resend_notice' ) {
56 my $message_id = $input->param('message_id');
57 my $message = C4::Letters::GetMessage( $message_id );
58 if ( $message->{borrowernumber} = $borrowernumber ) {
59 C4::Letters::ResendMessage( $message_id );
60 # redirect to self to avoid form submission on refresh
61 print $input->redirect("/cgi-bin/koha/members/notices.pl?borrowernumber=$borrowernumber");
65 # Getting the messages
66 my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
68 if (C4::Context->preference('ExtendedPatronAttributes')) {
69 my $attributes = GetBorrowerAttributes($borrowernumber);
70 $template->param(
71 ExtendedPatronAttributes => 1,
72 extendedattributes => $attributes
76 $template->param(%$borrower);
77 $template->param( adultborrower => 1 ) if ( $borrower->{category_type} eq 'A' || $borrower->{category_type} eq 'I' );
78 $template->param(
79 QUEUED_MESSAGES => $queued_messages,
80 borrowernumber => $borrowernumber,
81 sentnotices => 1,
82 branchname => GetBranchName($borrower->{'branchcode'}),
83 categoryname => $borrower->{'description'},
84 RoutingSerials => C4::Context->preference('RoutingSerials'),
86 output_html_with_http_headers $input, $cookie, $template->output;