View | Details | Raw Unified | Return to bug 12122
Collapse All | Expand All

(-)a/C4/Circulation.pm (-3 / +3 lines)
Lines 3737-3752 sub ProcessOfflinePayment { Link Here
3737
3737
3738
=head2 TransferSlip
3738
=head2 TransferSlip
3739
3739
3740
  TransferSlip($user_branch, $itemnumber, $to_branch)
3740
  TransferSlip($user_branch, $itemnumber, $barcode, $to_branch)
3741
3741
3742
  Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef
3742
  Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef
3743
3743
3744
=cut
3744
=cut
3745
3745
3746
sub TransferSlip {
3746
sub TransferSlip {
3747
    my ($branch, $itemnumber, $to_branch) = @_;
3747
    my ($branch, $itemnumber, $barcode, $to_branch) = @_;
3748
3748
3749
    my $item =  GetItem( $itemnumber )
3749
    my $item =  GetItem( $itemnumber, $barcode )
3750
      or return;
3750
      or return;
3751
3751
3752
    my $pulldate = C4::Dates->new();
3752
    my $pulldate = C4::Dates->new();
(-)a/circ/transfer-slip.pl (-1 / +2 lines)
Lines 38-43 my $sessionID = $input->cookie("CGISESSID"); Link Here
38
my $session = get_session($sessionID);
38
my $session = get_session($sessionID);
39
39
40
my $itemnumber = $input->param('transferitem');
40
my $itemnumber = $input->param('transferitem');
41
my $barcode    = $input->param('barcode');
41
my $branchcode = $input->param('branchcode');
42
my $branchcode = $input->param('branchcode');
42
43
43
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
44
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 54-60 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
54
55
55
my $userenv = C4::Context->userenv;
56
my $userenv = C4::Context->userenv;
56
my ($slip, $is_html);
57
my ($slip, $is_html);
57
if ( my $letter = TransferSlip ($session->param('branch') || $userenv->{branch}, $itemnumber, $branchcode) ) {
58
if ( my $letter = TransferSlip ($session->param('branch') || $userenv->{branch}, $itemnumber, $barcode, $branchcode) ) {
58
    $slip = $letter->{content};
59
    $slip = $letter->{content};
59
    $is_html = $letter->{is_html};
60
    $is_html = $letter->{is_html};
60
}
61
}
(-)a/t/db_dependent/Circulation_transfers.t (-2 / +12 lines)
Lines 9-15 use C4::Circulation; Link Here
9
use Koha::DateUtils;
9
use Koha::DateUtils;
10
use DateTime::Duration;
10
use DateTime::Duration;
11
11
12
use Test::More tests => 19;
12
use Test::More tests => 22;
13
use Test::Deep;
13
use Test::Deep;
14
14
15
BEGIN {
15
BEGIN {
Lines 198-202 is( C4::Circulation::DeleteTransfer($item_id1), Link Here
198
is(C4::Circulation::DeleteTransfer(),undef,"Without itemid DeleteTransfer returns undef");
198
is(C4::Circulation::DeleteTransfer(),undef,"Without itemid DeleteTransfer returns undef");
199
is(C4::Circulation::DeleteTransfer(-1),'0E0',"with a wrong itemid DeleteTranfer returns 0E0");
199
is(C4::Circulation::DeleteTransfer(-1),'0E0',"with a wrong itemid DeleteTranfer returns 0E0");
200
200
201
#Test TransferSlip
202
is( C4::Circulation::TransferSlip($samplebranch1->{branchcode}, undef, 5, $samplebranch2->{branchcode}),
203
    undef, "No tranferslip if invalid or undef itemnumber or barcode" );
204
is( C4::Circulation::TransferSlip($samplebranch1->{branchcode}, $item_id1, 1, $samplebranch2->{branchcode})->{'code'},
205
    'TRANSFERSLIP', "Get a transferslip on valid itemnumber and/or barcode" );
206
cmp_deeply(
207
    C4::Circulation::TransferSlip($samplebranch1->{branchcode}, $item_id1, undef, $samplebranch2->{branchcode}),
208
    C4::Circulation::TransferSlip($samplebranch1->{branchcode}, undef, 1, $samplebranch2->{branchcode}),
209
    "Barcode and itemnumber for same item both generate same TransferSlip"
210
    );
211
201
#End transaction
212
#End transaction
202
$dbh->rollback;
213
$dbh->rollback;
203
- 

Return to bug 12122