|
Line 0
Link Here
|
|
|
1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
|
| 4 |
# Copyright 2018 Catalyst IT |
| 5 |
# |
| 6 |
# This file is part of Koha. |
| 7 |
# |
| 8 |
# Koha is free software; you can redistribute it and/or modify it |
| 9 |
# under the terms of the GNU General Public License as published by |
| 10 |
# the Free Software Foundation; either version 3 of the License, or |
| 11 |
# (at your option) any later version. |
| 12 |
# |
| 13 |
# Koha is distributed in the hope that it will be useful, but |
| 14 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
# GNU General Public License for more details. |
| 17 |
# |
| 18 |
# You should have received a copy of the GNU General Public License |
| 19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 20 |
|
| 21 |
use Modern::Perl; |
| 22 |
use C4::Context; |
| 23 |
use C4::Output; |
| 24 |
use CGI qw ( -utf8 ); |
| 25 |
use C4::Auth qw/:DEFAULT get_session/; |
| 26 |
use Koha::Recall; |
| 27 |
use Koha::Recalls; |
| 28 |
use C4::Letters; |
| 29 |
use C4::Message; |
| 30 |
use Data::Dumper; |
| 31 |
use Koha::Patrons; |
| 32 |
use Koha::Items; |
| 33 |
use Koha::Biblios; |
| 34 |
use Koha::Libraries; |
| 35 |
use vars qw($debug); |
| 36 |
|
| 37 |
BEGIN { |
| 38 |
$debug = $ENV{DEBUG} || 0; |
| 39 |
} |
| 40 |
|
| 41 |
my $input = new CGI; |
| 42 |
my $sessionID = $input->cookie("CGISESSID"); |
| 43 |
my $session = get_session($sessionID); |
| 44 |
|
| 45 |
my $borrowernumber = $input->param('borrowernumber'); |
| 46 |
my $biblionumber = $input->param('biblionumber'); |
| 47 |
my $itemnumber = $input->param('itemnumber'); |
| 48 |
my $recallid = $input->param('recall_id'); |
| 49 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
| 50 |
{ |
| 51 |
template_name => "circ/recall-pickup-slip.tt", |
| 52 |
query => $input, |
| 53 |
type => "intranet", |
| 54 |
authnotrequired => 0, |
| 55 |
flagsrequired => { circulate => "circulate_remaining_permissions" }, |
| 56 |
debug => $debug, |
| 57 |
} |
| 58 |
); |
| 59 |
|
| 60 |
my $recall = Koha::Recalls->find($recallid); |
| 61 |
my $patron = Koha::Patrons->find($borrowernumber); |
| 62 |
my $item = Koha::Items->find($recall->itemnumber); |
| 63 |
my $biblio = Koha::Biblios->find($item->biblionumber); |
| 64 |
my $library = Koha::Libraries->find($recall->branchcode); |
| 65 |
|
| 66 |
#Print slip to inform library staff of details of recall requester, so the item can be put aside for requester |
| 67 |
my ($slip, $is_html); |
| 68 |
my $letter = C4::Letters::GetPreparedLetter ( |
| 69 |
module => 'circulation', |
| 70 |
letter_code => 'RECALL_REQUESTER_DET', |
| 71 |
tables => { |
| 72 |
'branches' => $library->branchcode, |
| 73 |
'borrowers' => $patron->borrowernumber, |
| 74 |
'biblio' => $biblio->biblionumber, |
| 75 |
'items' => $item->itemnumber, |
| 76 |
'recalls' => $recall->recall_id |
| 77 |
} |
| 78 |
); |
| 79 |
|
| 80 |
if ($letter) { |
| 81 |
$slip = $letter->{content}; |
| 82 |
$is_html = $letter->{is_html}; |
| 83 |
} |
| 84 |
|
| 85 |
$template->param( slip => $slip ) if ($slip); |
| 86 |
$template->param( plain => !$is_html ); |
| 87 |
|
| 88 |
output_html_with_http_headers $input, $cookie, $template->output; |