Bug 12904: Force browser to load new javascript files after upgrade
[koha.git] / members / notices.pl
blobaf66679e31b388bb0d74641905d27a471abd2d58
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 Modern::Perl;
23 use C4::Auth;
24 use C4::Output;
25 use CGI qw ( -utf8 );
26 use C4::Members;
27 use C4::Letters;
28 use C4::Members::Attributes qw(GetBorrowerAttributes);
29 use Koha::Patrons;
31 my $input=new CGI;
34 my $borrowernumber = $input->param('borrowernumber');
35 my $patron = Koha::Patrons->find( $borrowernumber );
36 unless ( $patron ) {
37 print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
38 exit;
40 my $borrower = $patron->unblessed;
42 my ($template, $loggedinuser, $cookie)
43 = get_template_and_user({template_name => "members/notices.tt",
44 query => $input,
45 type => "intranet",
46 authnotrequired => 0,
47 flagsrequired => {borrowers => 1},
48 debug => 1,
49 });
51 $template->param( $borrower );
52 $template->param( picture => 1 ) if $patron->image;
54 # Allow resending of messages in Notices tab
55 my $op = $input->param('op') || q{};
56 if ( $op eq 'resend_notice' ) {
57 my $message_id = $input->param('message_id');
58 my $message = C4::Letters::GetMessage( $message_id );
59 if ( $message->{borrowernumber} = $borrowernumber ) {
60 C4::Letters::ResendMessage( $message_id );
61 # redirect to self to avoid form submission on refresh
62 print $input->redirect("/cgi-bin/koha/members/notices.pl?borrowernumber=$borrowernumber");
66 # Getting the messages
67 my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
69 if (C4::Context->preference('ExtendedPatronAttributes')) {
70 my $attributes = GetBorrowerAttributes($borrowernumber);
71 $template->param(
72 ExtendedPatronAttributes => 1,
73 extendedattributes => $attributes
77 $template->param(%$borrower);
78 $template->param( adultborrower => 1 ) if ( $borrower->{category_type} eq 'A' || $borrower->{category_type} eq 'I' );
79 $template->param(
80 QUEUED_MESSAGES => $queued_messages,
81 borrowernumber => $borrowernumber,
82 sentnotices => 1,
83 categoryname => $patron->category->description,
85 output_html_with_http_headers $input, $cookie, $template->output;