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

(-)a/t/db_dependent/Circulation/issue.t (-2 / +39 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 46;
20
use Test::More tests => 50;
21
use DateTime::Duration;
21
use DateTime::Duration;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 79-84 my $itemtype = $builder->build( Link Here
79
        value  => { notforloan => undef, rentalcharge => 0 }
79
        value  => { notforloan => undef, rentalcharge => 0 }
80
    }
80
    }
81
)->{itemtype};
81
)->{itemtype};
82
my $itemtype2 = $builder->build(
83
    {   source => 'Itemtype',
84
        value  => { notforloan => undef, updatenotforloanstatusoncheckin => 0 }
85
    }
86
)->{itemtype};
87
82
my $branchcode_1 = $builder->build({ source => 'Branch' })->{branchcode};
88
my $branchcode_1 = $builder->build({ source => 'Branch' })->{branchcode};
83
my $branchcode_2 = $builder->build({ source => 'Branch' })->{branchcode};
89
my $branchcode_2 = $builder->build({ source => 'Branch' })->{branchcode};
84
my $branchcode_3 = $builder->build({ source => 'Branch' })->{branchcode};
90
my $branchcode_3 = $builder->build({ source => 'Branch' })->{branchcode};
Lines 125-134 my $daysago10 = output_pref( Link Here
125
131
126
# Add biblio and item
132
# Add biblio and item
127
my $record = MARC::Record->new();
133
my $record = MARC::Record->new();
134
my $record2 = MARC::Record->new();
128
$record->append_fields(
135
$record->append_fields(
136
    MARC::Field->new( '942', '0', '0', c => $itemtype ),
137
    MARC::Field->new( '952', '0', '0', a => $branchcode_1 ) );
138
139
$record2->append_fields(
140
    MARC::Field->new( '942', '0', '0', c => $itemtype2 ),
129
    MARC::Field->new( '952', '0', '0', a => $branchcode_1 ) );
141
    MARC::Field->new( '952', '0', '0', a => $branchcode_1 ) );
130
142
131
my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, '' );
143
my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, '' );
144
my ( $biblionumber2, $biblioitemnumber2 ) = C4::Biblio::AddBiblio( $record2, '' );
132
145
133
my $barcode_1 = 'barcode_1';
146
my $barcode_1 = 'barcode_1';
134
my $barcode_2 = 'barcode_2';
147
my $barcode_2 = 'barcode_2';
Lines 395-401 my $itemnumber = Koha::Item->new( Link Here
395
        homebranch     => $branchcode_1,
408
        homebranch     => $branchcode_1,
396
        holdingbranch  => $branchcode_1,
409
        holdingbranch  => $branchcode_1,
397
        notforloan     => 1,
410
        notforloan     => 1,
398
        itype          => $itemtype
411
        itype          => $itemtype,
412
        biblioitemnumber => $biblioitemnumber
399
    },
413
    },
400
)->store->itemnumber;
414
)->store->itemnumber;
401
415
Lines 413-418 AddReturn( 'barcode_3', $branchcode_1 ); Link Here
413
$item = Koha::Items->find( $itemnumber );
427
$item = Koha::Items->find( $itemnumber );
414
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
428
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
415
429
430
# Item type exclusions from UpdateNotForLoanStatusOnCheckin syspref
431
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', '9: 1');
432
AddReturn( 'barcode_3', $branchcode_1 );
433
$item = Koha::Items->find( $itemnumber );
434
ok( $item->notforloan eq 1, q{UpdateNotForLoanStatusOnCheckin updates notforloan value from 9 to 1 when the items type has itemtypes.updatenotforloanstatusoncheckin = 1} );
435
436
Koha::Items->find( $itemnumber )->itype($itemtype2)->store;
437
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', '1: 9');
438
AddReturn( 'barcode_3', $branchcode_1 );
439
$item = Koha::Items->find( $itemnumber );
440
ok( $item->notforloan eq 1, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value when itemtypes.updatenotforloanstatusoncheckin = 0} );
441
442
t::lib::Mocks::mock_preference( 'item-level_itypes', '0' );
443
AddReturn( 'barcode_3', $branchcode_1 );
444
$item = Koha::Items->find( $itemnumber );
445
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin updates notforloan value when item-level_itypes = 0, returned item biblio-level itemtype enables updatenotforloanstatusoncheckin & item level itype disables updatenotforloanstatusoncheckin} );
446
447
Koha::Items->find( $itemnumber )->biblioitemnumber($biblioitemnumber2)->store;
448
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', '9: 1');
449
AddReturn( 'barcode_3', $branchcode_1 );
450
$item = Koha::Items->find( $itemnumber );
451
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloanvalue when item-level_itypes=0, returned item biblio-level itemtype enables updatenotforloanstatusoncheckin & item level itype disables updatenotforloanstatusoncheck} );
452
416
my $itemnumber2 = Koha::Item->new(
453
my $itemnumber2 = Koha::Item->new(
417
    {
454
    {
418
        biblionumber   => $biblionumber,
455
        biblionumber   => $biblionumber,
(-)a/t/db_dependent/Koha/Object.t (-2 / +3 lines)
Lines 604-610 subtest "Test update method" => sub { Link Here
604
604
605
subtest 'store() tests' => sub {
605
subtest 'store() tests' => sub {
606
606
607
    plan tests => 16;
607
    plan tests => 17;
608
608
609
    # Using Koha::ApiKey to test Koha::Object>-store
609
    # Using Koha::ApiKey to test Koha::Object>-store
610
    # Simple object with foreign keys and unique key
610
    # Simple object with foreign keys and unique key
Lines 701-706 subtest 'store() tests' => sub { Link Here
701
                rentalcharge    => "",
701
                rentalcharge    => "",
702
                notforloan      => "",
702
                notforloan      => "",
703
                hideinopac      => "",
703
                hideinopac      => "",
704
                updatenotforloanstatusoncheckin => "",
704
            }
705
            }
705
        )->store;
706
        )->store;
706
    };
707
    };
Lines 708-713 subtest 'store() tests' => sub { Link Here
708
    is( $itemtype->rentalcharge, undef, 'decimal DEFAULT NULL should default to null');
709
    is( $itemtype->rentalcharge, undef, 'decimal DEFAULT NULL should default to null');
709
    is( $itemtype->notforloan, undef, 'int DEFAULT NULL should default to null');
710
    is( $itemtype->notforloan, undef, 'int DEFAULT NULL should default to null');
710
    is( $itemtype->hideinopac, 0, 'int NOT NULL DEFAULT 0 should default to 0');
711
    is( $itemtype->hideinopac, 0, 'int NOT NULL DEFAULT 0 should default to 0');
712
    is( $itemtype->updatenotforloanstatusoncheckin, 1, 'int NOT NULL DEFAULT 1 should default to 1');
711
713
712
    subtest 'Bad value tests' => sub {
714
    subtest 'Bad value tests' => sub {
713
715
714
- 

Return to bug 25560