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

(-)a/C4/Circulation.pm (+8 lines)
Lines 322-327 sub transferbook { Link Here
322
    my $dotransfer      = 1;
322
    my $dotransfer      = 1;
323
    my $item = Koha::Items->find( { barcode => $barcode } );
323
    my $item = Koha::Items->find( { barcode => $barcode } );
324
324
325
    Koha::Exceptions::MissingParameter->throw(
326
        "Missing mandatory parameter: from_branch")
327
      unless $fbr;
328
329
    Koha::Exceptions::MissingParameter->throw(
330
        "Missing mandatory parameter: to_branch")
331
      unless $tbr;
332
325
    # bad barcode..
333
    # bad barcode..
326
    unless ( $item ) {
334
    unless ( $item ) {
327
        $messages->{'BadBarcode'} = $barcode;
335
        $messages->{'BadBarcode'} = $barcode;
(-)a/t/db_dependent/Circulation.t (-2 / +32 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 49;
21
use Test::More tests => 50;
22
use Test::Exception;
22
use Test::MockModule;
23
use Test::MockModule;
23
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
24
25
Lines 4449-4454 subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddIssue' => sub { Link Here
4449
    };
4450
    };
4450
};
4451
};
4451
4452
4453
subtest 'transferbook tests' => sub {
4454
    plan tests => 9;
4455
4456
    throws_ok
4457
    { C4::Circulation::transferbook({}); }
4458
    'Koha::Exceptions::MissingParameter',
4459
    'Koha::Patron->store raises an exception on missing params';
4460
4461
    throws_ok
4462
    { C4::Circulation::transferbook({to_branch=>'anything'}); }
4463
    'Koha::Exceptions::MissingParameter',
4464
    'Koha::Patron->store raises an exception on missing params';
4465
4466
    throws_ok
4467
    { C4::Circulation::transferbook({from_branch=>'anything'}); }
4468
    'Koha::Exceptions::MissingParameter',
4469
    'Koha::Patron->store raises an exception on missing params';
4470
4471
    my ($doreturn,$messages) = C4::Circulation::transferbook({to_branch=>'there',from_branch=>'here'});
4472
    is( $doreturn, 0, "No return without barcode");
4473
    ok( exists $messages->{BadBarcode}, "We get a BadBarcode message if no barcode passed");
4474
    is( $messages->{BadBarcode}, undef, "No barcode passed means undef BadBarcode" );
4475
4476
    ($doreturn,$messages) = C4::Circulation::transferbook({to_branch=>'there',from_branch=>'here',barcode=>'BadBarcode'});
4477
    is( $doreturn, 0, "No return without barcode");
4478
    ok( exists $messages->{BadBarcode}, "We get a BadBarcode message if no barcode passed");
4479
    is( $messages->{BadBarcode}, 'BadBarcode', "No barcode passed means undef BadBarcode" );
4480
4481
};
4482
4452
$schema->storage->txn_rollback;
4483
$schema->storage->txn_rollback;
4453
C4::Context->clear_syspref_cache();
4484
C4::Context->clear_syspref_cache();
4454
$branches = Koha::Libraries->search();
4485
$branches = Koha::Libraries->search();
4455
- 

Return to bug 23695