Koha/circ/hold-transfer-slip.pl
Benjamin Rokseth 2c1f7d2281 Bug 17561: ReserveSlip needs itemnumber for item level holds on same biblio
This patch fixes a regression after bug 14695.
This patch adds itemnumber and barcode as optional params in ReserveSlip used
by hold-transfer-slip.pl to generate HOLD_SLIP. This is for ReserveSlip to be
able to generate correct slips when items in multi-item holds are checked in.

Test plan:

1) activate a circulation rule with multi-item holds
2) Place two holds on same biblio for patron
3) for debugging, either use browser console to observe POST request and responses
   or use info from reserves, e.g. reserve_id in the HOLD_SLIP
4) checkin two items from same biblio on pickup branch
5) note that both holds are effectuated, but reserve_id is the same on both slips
6) also note that there is no itemnumber or barcode in the requests from returns.pl
7) Apply this patch
8) repeat 2-4
9) note that reserve_id is now different on the two slips

and/or:
Run tests:
  t/db_dependent/Reserves/ReserveSlip.t

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Maksim Sen <maksim.sen@inlibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-06-04 13:40:36 -04:00

71 lines
2.1 KiB
Perl
Executable file

#!/usr/bin/perl
# Copyright 2008 LibLime
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use C4::Context;
use C4::Output;
use CGI qw ( -utf8 );
use C4::Auth qw/:DEFAULT get_session/;
use C4::Reserves;
use vars qw($debug);
BEGIN {
$debug = $ENV{DEBUG} || 0;
}
my $input = new CGI;
my $sessionID = $input->cookie("CGISESSID");
my $session = get_session($sessionID);
my $biblionumber = $input->param('biblionumber');
my $borrowernumber = $input->param('borrowernumber');
my $itemnumber = $input->param('itemnumber');
my $barcode = $input->param('barcode');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "circ/printslip.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { circulate => "circulate_remaining_permissions" },
debug => $debug,
}
);
my $userenv = C4::Context->userenv;
my ($slip, $is_html);
if ( my $letter = ReserveSlip ({
branchcode => $session->param('branch') || $userenv->{branch},
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
itemnumber => $itemnumber,
barcode => $barcode,
}) ) {
$slip = $letter->{content};
$is_html = $letter->{is_html};
}
$template->param( slip => $slip ) if ($slip);
$template->param( caller => 'hold-transfer' );
$template->param( plain => !$is_html );
output_html_with_http_headers $input, $cookie, $template->output;