Line 0
Link Here
|
|
|
1 |
#!/usr/bin/perl |
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it |
6 |
# under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation; either version 3 of the License, or |
8 |
# (at your option) any later version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but |
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# GNU General Public License for more details. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
18 |
|
19 |
use Modern::Perl; |
20 |
use CGI qw ( -utf8 ); |
21 |
use C4::Context; |
22 |
use C4::Auth qw( get_template_and_user ); |
23 |
use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); |
24 |
use C4::Letters; |
25 |
use Koha::Patrons; |
26 |
use Koha::Preservation::Train::Items; |
27 |
|
28 |
my $input = CGI->new; |
29 |
my $train_item_id = $input->param('train_item_id'); |
30 |
|
31 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
32 |
{ |
33 |
template_name => "circ/printslip.tt", |
34 |
query => $input, |
35 |
type => "intranet", |
36 |
flagsrequired => { preservation => '*' }, |
37 |
} |
38 |
); |
39 |
|
40 |
my $logged_in_user = Koha::Patrons->find($loggedinuser); |
41 |
my $branch = C4::Context->userenv->{'branch'}; |
42 |
|
43 |
my $train_item = Koha::Preservation::Train::Items->find($train_item_id); |
44 |
|
45 |
unless ($train_item){ |
46 |
print $input->redirect("/cgi-bin/koha/errors/404.pl"); |
47 |
exit; |
48 |
} |
49 |
|
50 |
my $train = $train_item->train; |
51 |
|
52 |
my $letter = C4::Letters::GetPreparedLetter( |
53 |
module => 'preservation', |
54 |
letter_code => $train_item->processing->letter_code, |
55 |
branchcode => $branch, |
56 |
lang => $logged_in_user->lang, |
57 |
tables => { |
58 |
preservation_train_items => $train_item_id, |
59 |
}, |
60 |
message_transport_type => 'print' |
61 |
); |
62 |
|
63 |
my $slip = $letter->{content}; |
64 |
my $is_html = $letter->{is_html}; |
65 |
|
66 |
$template->param( |
67 |
slip => $slip, |
68 |
plain => !$is_html, |
69 |
caller => 'preservation', |
70 |
stylesheet => C4::Context->preference("SlipCSS"), |
71 |
); |
72 |
|
73 |
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS' ) ); |
74 |
|
75 |
output_html_with_http_headers $input, $cookie, $template->output; |