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

(-)a/t/db_dependent/Circulation/Returns.t (-45 / +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 68-117 my $rule = Koha::IssuingRule->new( Link Here
68
);
68
);
69
$rule->store();
69
$rule->store();
70
70
71
my $manager = $builder->build({source => 'Borrower'});
72
$manager_id = $manager->{borrowernumber};
73
74
subtest "InProcessingToShelvingCart tests" => sub {
75
76
    plan tests => 2;
77
78
    $branch = $builder->build({ source => 'Branch' })->{ branchcode };
79
    my $permanent_location = 'TEST';
80
    my $location           = 'PROC';
81
82
    # Create a biblio record with biblio-level itemtype
83
    my $record = MARC::Record->new();
84
    my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' );
85
    my $built_item = $builder->build({
86
        source => 'Item',
87
        value  => {
88
            biblionumber  => $biblionumber,
89
            homebranch    => $branch,
90
            holdingbranch => $branch,
91
            location      => $location,
92
            permanent_location => $permanent_location
93
        }
94
    });
95
    my $barcode = $built_item->{ barcode };
96
    my $itemnumber = $built_item->{ itemnumber };
97
    my $item;
98
99
    t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 1 );
100
    AddReturn( $barcode, $branch );
101
    $item = Koha::Items->find( $itemnumber );
102
    is( $item->location, 'CART',
103
        "InProcessingToShelvingCart functions as intended" );
104
105
    ModItem( {location => $location}, undef, $itemnumber );
106
107
    t::lib::Mocks::mock_preference( "InProcessingToShelvingCart", 0 );
108
    AddReturn( $barcode, $branch );
109
    $item = Koha::Items->find( $itemnumber );
110
    is( $item->location, $permanent_location,
111
        "InProcessingToShelvingCart functions as intended" );
112
};
113
114
115
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
71
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
116
72
117
    plan tests => 4;
73
    plan tests => 4;
Lines 382-384 subtest 'BlockReturnOfLostItems' => sub { Link Here
382
    ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
338
    ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
383
    is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
339
    is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
384
};
340
};
341
342
$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 => 33;
20
use Test::More tests => 45;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 373-378 AddReturn( 'barcode_3', $branchcode_1 ); Link Here
373
$item = Koha::Items->find( $itemnumber );
373
$item = Koha::Items->find( $itemnumber );
374
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
374
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
375
375
376
my $itemnumber2;
377
($biblionumber, $biblioitemnumber, $itemnumber2) = C4::Items::AddItem(
378
    {
379
        barcode        => 'barcode_4',
380
        itemcallnumber => 'callnumber4',
381
        homebranch     => $branchcode_1,
382
        holdingbranch  => $branchcode_1,
383
        location => 'FIC',
384
        itype          => $itemtype
385
    },
386
    $biblionumber
387
);
388
389
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} );
390
AddReturn( 'barcode_4', $branchcode_1 );
391
my $item2 = Koha::Items->find( $itemnumber2 );
392
ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
393
394
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
395
AddReturn( 'barcode_4', $branchcode_1 );
396
$item2 = Koha::Items->find( $itemnumber2 );
397
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
398
ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
399
AddReturn( 'barcode_4', $branchcode_1 );
400
$item2 = Koha::Items->find( $itemnumber2 );
401
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
402
403
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
404
AddReturn( 'barcode_4', $branchcode_1 );
405
$item2 = Koha::Items->find( $itemnumber2 );
406
ok( $item2->location eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} );
407
ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} );
408
AddIssue( $borrower_1, 'barcode_4', $daysago10,0, $today, '' );
409
$item2 = Koha::Items->find( $itemnumber2 );
410
ok( $item2->location eq 'GEN', q{Location updates from 'CART' to permanent location on issue} );
411
412
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
413
AddReturn( 'barcode_4', $branchcode_1 );
414
$item2 = Koha::Items->find( $itemnumber2 );
415
ok( $item2->location eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} );
416
AddReturn( 'barcode_4', $branchcode_1 );
417
$item2 = Koha::Items->find( $itemnumber2 );
418
ok( $item2->location eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
419
ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
420
AddReturn( 'barcode_4', $branchcode_1 );
421
$item2 = Koha::Items( $itemnumber2 );
422
ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
423
ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
424
425
426
427
376
# Bug 14640 - Cancel the hold on checking out if asked
428
# Bug 14640 - Cancel the hold on checking out if asked
377
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
429
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber,
378
    undef,  1, undef, undef, "a note", "a title", undef, '');
430
    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