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 under the |
6 |
# terms of the GNU General Public License as published by the Free Software |
7 |
# Foundation; either version 2 of the License, or (at your option) any later |
8 |
# version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
11 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
12 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
13 |
# |
14 |
# You should have received a copy of the GNU General Public License along |
15 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
16 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17 |
|
18 |
|
19 |
use strict; |
20 |
use warnings; |
21 |
use CGI; |
22 |
use C4::Context; |
23 |
use C4::Auth qw/:DEFAULT get_session/; |
24 |
use C4::Output; |
25 |
use C4::Members; |
26 |
use C4::Koha; |
27 |
|
28 |
#use Smart::Comments; |
29 |
#use Data::Dumper; |
30 |
|
31 |
use vars qw($debug); |
32 |
|
33 |
BEGIN { |
34 |
$debug = $ENV{DEBUG} || 0; |
35 |
} |
36 |
|
37 |
my $input = new CGI; |
38 |
my $sessionID = $input->cookie("CGISESSID"); |
39 |
my $session = get_session($sessionID); |
40 |
|
41 |
$debug or $debug = $input->param('debug') || 0; |
42 |
my $print = $input->param('print'); |
43 |
my $error = $input->param('error'); |
44 |
|
45 |
# circ staff who process checkouts but can't edit |
46 |
# patrons still need to be able to print receipts |
47 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
48 |
{ |
49 |
template_name => "/sco/printslip.tmpl", |
50 |
query => $input, |
51 |
type => "opac", |
52 |
debug => 1, |
53 |
} |
54 |
); |
55 |
|
56 |
my $borrowernumber = $input->param('borrowernumber'); |
57 |
my $branch=C4::Context->userenv->{'branch'}; |
58 |
my ($slip, $is_html); |
59 |
if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) { |
60 |
$slip = $letter->{content}; |
61 |
$is_html = $letter->{is_html}; |
62 |
} |
63 |
|
64 |
$template->{VARS}->{slip} = $slip; |
65 |
$template->{VARS}->{plain} = !$is_html; |
66 |
$template->{VARS}->{title} = "Print Receipt for $borrowernumber"; |
67 |
$template->{VARS}->{stylesheet} = C4::Context->preference("SlipCSS"); |
68 |
$template->{VARS}->{error} = $error; |
69 |
|
70 |
output_html_with_http_headers $input, $cookie, $template->output; |