Bug 13417: (qa follow-up) Rename the permission to delete_public_lists
[koha.git] / members / notices.pl
blob113e20cbb9499f28717adec8a410e1adf0b20f7f
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 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.
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.
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.
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);
32 use C4::Dates qw/format_date/;
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 ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
51 $template->param( picture => 1 ) if $picture;
53 # Getting the messages
54 my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
55 $template->param( %{$borrower} );
57 if (C4::Context->preference('ExtendedPatronAttributes')) {
58 my $attributes = GetBorrowerAttributes($borrowernumber);
59 $template->param(
60 ExtendedPatronAttributes => 1,
61 extendedattributes => $attributes
65 # Computes full borrower address
66 my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{'streettype'} );
67 my $address = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'};
69 $template->param(
70 QUEUED_MESSAGES => $queued_messages,
71 borrowernumber => $borrowernumber,
72 sentnotices => 1,
73 branchname => GetBranchName($borrower->{'branchcode'}),
74 categoryname => $borrower->{'description'},
75 address => $address,
76 activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
77 RoutingSerials => C4::Context->preference('RoutingSerials'),
79 output_html_with_http_headers $input, $cookie, $template->output;