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

(-)a/t/db_dependent/Circulation/Returns.t (-42 / +3 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 5;
20
use Test::More tests => 4;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 60-106 my $rule = Koha::IssuingRule->new( Link Here
60
);
60
);
61
$rule->store();
61
$rule->store();
62
62
63
subtest "InProcessingToShelvingCart tests" => sub {
64
65
    plan tests => 2;
66
67
    $branch = $builder->build({ source => 'Branch' })->{ branchcode };
68
    my $permanent_location = 'TEST';
69
    my $location           = 'PROC';
70
71
    # Create a biblio record with biblio-level itemtype
72
    my $record = MARC::Record->new();
73
    my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' );
74
    my $built_item = $builder->build({
75
        source => 'Item',
76
        value  => {
77
            biblionumber  => $biblionumber,
78
            homebranch    => $branch,
79
            holdingbranch => $branch,
80
            location      => $location,
81
            permanent_location => $permanent_location
82
        }
83
    });
84
    my $barcode = $built_item->{ barcode };
85
    my $itemnumber = $built_item->{ itemnumber };
86
    my $item;
87
88
    t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 1 );
89
    AddReturn( $barcode, $branch );
90
    $item = Koha::Items->find( $itemnumber );
91
    is( $item->location, 'CART',
92
        "InProcessingToShelvingCart functions as intended" );
93
94
    ModItem( {location => $location}, undef, $itemnumber );
95
96
    t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 0 );
97
    AddReturn( $barcode, $branch );
98
    $item = Koha::Items->find( $itemnumber );
99
    is( $item->location, $permanent_location,
100
        "InProcessingToShelvingCart functions as intended" );
101
};
102
103
104
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
63
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
105
64
106
    plan tests => 4;
65
    plan tests => 4;
Lines 369-371 subtest 'BlockReturnOfLostItems' => sub { Link Here
369
    ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
328
    ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
370
    is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
329
    is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
371
};
330
};
331
332
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Circulation/issue.t (-1 / +53 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 32;
20
use Test::More tests => 44;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 362-367 AddReturn( 'barcode_3', $branchcode_1 ); Link Here
362
$item = Koha::Items->find( $itemnumber );
362
$item = Koha::Items->find( $itemnumber );
363
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
363
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
364
364
365
my $itemnumber2;
366
($biblionumber, $biblioitemnumber, $itemnumber2) = C4::Items::AddItem(
367
    {
368
        barcode        => 'barcode_4',
369
        itemcallnumber => 'callnumber4',
370
        homebranch     => $branchcode_1,
371
        holdingbranch  => $branchcode_1,
372
        location => 'FIC',
373
        itype          => $itemtype
374
    },
375
    $biblionumber
376
);
377
378
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} );
379
AddReturn( 'barcode_4', $branchcode_1 );
380
my $item2 = GetItem( $itemnumber2 );
381
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
382
383
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
384
AddReturn( 'barcode_4', $branchcode_1 );
385
$item2 = GetItem( $itemnumber2 );
386
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
387
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
388
AddReturn( 'barcode_4', $branchcode_1 );
389
$item2 = GetItem( $itemnumber2 );
390
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
391
392
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
393
AddReturn( 'barcode_4', $branchcode_1 );
394
$item2 = GetItem( $itemnumber2 );
395
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} );
396
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} );
397
AddIssue( $borrower_1, 'barcode_4', $daysago10,0, $today, '' );
398
$item2 = GetItem( $itemnumber2 );
399
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} );
400
401
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
402
AddReturn( 'barcode_4', $branchcode_1 );
403
$item2 = GetItem( $itemnumber2 );
404
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} );
405
AddReturn( 'barcode_4', $branchcode_1 );
406
$item2 = GetItem( $itemnumber2 );
407
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
408
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
409
AddReturn( 'barcode_4', $branchcode_1 );
410
$item2 = GetItem( $itemnumber2 );
411
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
412
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
413
414
415
416
365
# Bug 14640 - Cancel the hold on checking out if asked
417
# Bug 14640 - Cancel the hold on checking out if asked
366
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
418
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
367
    undef,  1, undef, undef, "a note", "a title", undef, '');
419
    undef,  1, undef, undef, "a note", "a title", undef, '');
(-)a/t/db_dependent/UsageStats.t (-3 lines)
Lines 397-403 sub mocking_systempreferences_to_a_set_value { Link Here
397
        CircControl
397
        CircControl
398
        HomeOrHoldingBranch
398
        HomeOrHoldingBranch
399
        HomeOrHoldingBranchReturn
399
        HomeOrHoldingBranchReturn
400
        InProcessingToShelvingCart
401
        IssueLostItem
400
        IssueLostItem
402
        IssuingInProcess
401
        IssuingInProcess
403
        ManInvInNoissuesCharge
402
        ManInvInNoissuesCharge
Lines 406-412 sub mocking_systempreferences_to_a_set_value { Link Here
406
        RenewalSendNotice
405
        RenewalSendNotice
407
        RentalsInNoissuesCharge
406
        RentalsInNoissuesCharge
408
        ReturnBeforeExpiry
407
        ReturnBeforeExpiry
409
        ReturnToShelvingCart
410
        TransfersMaxDaysWarning
408
        TransfersMaxDaysWarning
411
        UseBranchTransferLimits
409
        UseBranchTransferLimits
412
        useDaysMode
410
        useDaysMode
413
- 

Return to bug 14576