Bug 12122: TransferSlip should accept both itemnumber and barcode
Added small patch to allow barcode as input in TransferSlip routine, mostly to allow generating transfer slips where only barcode is present (aka. javascript). Test plan: 1) find book with <barcode> and <itemnumber> 2) generate transferslips with both: transfer-slip.pl?transferitem=<itemnumber>3967925&branchcode=MPL&op=slip transfer-slip.pl?barcode=<barcode>&branchcode=MPL&op=slip and verify that the generated slips match. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Edit: - Added tests in t/db_dependent/Circulation_transfers.t Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Passes tests and QA script. Works with both itemnumber or barcode as described. Tested printing transfer slips with the URL examples given and in the UI. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
45e5afb77b
commit
7ba06aad68
|
|
@ -3755,16 +3755,16 @@ sub ProcessOfflinePayment {
|
|||
|
||||
=head2 TransferSlip
|
||||
|
||||
TransferSlip($user_branch, $itemnumber, $to_branch)
|
||||
TransferSlip($user_branch, $itemnumber, $barcode, $to_branch)
|
||||
|
||||
Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef
|
||||
|
||||
=cut
|
||||
|
||||
sub TransferSlip {
|
||||
my ($branch, $itemnumber, $to_branch) = @_;
|
||||
my ($branch, $itemnumber, $barcode, $to_branch) = @_;
|
||||
|
||||
my $item = GetItem( $itemnumber )
|
||||
my $item = GetItem( $itemnumber, $barcode )
|
||||
or return;
|
||||
|
||||
my $pulldate = C4::Dates->new();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ my $sessionID = $input->cookie("CGISESSID");
|
|||
my $session = get_session($sessionID);
|
||||
|
||||
my $itemnumber = $input->param('transferitem');
|
||||
my $barcode = $input->param('barcode');
|
||||
my $branchcode = $input->param('branchcode');
|
||||
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
|
|
@ -54,7 +55,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
|
||||
my $userenv = C4::Context->userenv;
|
||||
my ($slip, $is_html);
|
||||
if ( my $letter = TransferSlip ($session->param('branch') || $userenv->{branch}, $itemnumber, $branchcode) ) {
|
||||
if ( my $letter = TransferSlip ($session->param('branch') || $userenv->{branch}, $itemnumber, $barcode, $branchcode) ) {
|
||||
$slip = $letter->{content};
|
||||
$is_html = $letter->{is_html};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use C4::Circulation;
|
|||
use Koha::DateUtils;
|
||||
use DateTime::Duration;
|
||||
|
||||
use Test::More tests => 19;
|
||||
use Test::More tests => 22;
|
||||
use Test::Deep;
|
||||
|
||||
BEGIN {
|
||||
|
|
@ -198,5 +198,16 @@ is( C4::Circulation::DeleteTransfer($item_id1),
|
|||
is(C4::Circulation::DeleteTransfer(),undef,"Without itemid DeleteTransfer returns undef");
|
||||
is(C4::Circulation::DeleteTransfer(-1),'0E0',"with a wrong itemid DeleteTranfer returns 0E0");
|
||||
|
||||
#Test TransferSlip
|
||||
is( C4::Circulation::TransferSlip($samplebranch1->{branchcode}, undef, 5, $samplebranch2->{branchcode}),
|
||||
undef, "No tranferslip if invalid or undef itemnumber or barcode" );
|
||||
is( C4::Circulation::TransferSlip($samplebranch1->{branchcode}, $item_id1, 1, $samplebranch2->{branchcode})->{'code'},
|
||||
'TRANSFERSLIP', "Get a transferslip on valid itemnumber and/or barcode" );
|
||||
cmp_deeply(
|
||||
C4::Circulation::TransferSlip($samplebranch1->{branchcode}, $item_id1, undef, $samplebranch2->{branchcode}),
|
||||
C4::Circulation::TransferSlip($samplebranch1->{branchcode}, undef, 1, $samplebranch2->{branchcode}),
|
||||
"Barcode and itemnumber for same item both generate same TransferSlip"
|
||||
);
|
||||
|
||||
#End transaction
|
||||
$dbh->rollback;
|
||||
|
|
|
|||
Loading…
Reference in New Issue