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

(-)a/t/db_dependent/Circulation/issue.t (-2 / +52 lines)
Lines 28-34 use C4::Context; Link Here
28
use C4::Reserves;
28
use C4::Reserves;
29
use Koha::Library;
29
use Koha::Library;
30
30
31
use Test::More tests => 32;
31
use Test::More tests => 44;
32
32
33
BEGIN {
33
BEGIN {
34
    use_ok('C4::Circulation');
34
    use_ok('C4::Circulation');
Lines 388-393 AddReturn( 'barcode_3', $samplebranch1->{branchcode} ); Link Here
388
$item = GetItem( $itemnumber );
388
$item = GetItem( $itemnumber );
389
ok( $item->{notforloan} eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
389
ok( $item->{notforloan} eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} );
390
390
391
my $itemnumber2;
392
($biblionumber, $biblioitemnumber, $itemnumber2) = C4::Items::AddItem(
393
    {
394
        barcode        => 'barcode_4',
395
        itemcallnumber => 'callnumber4',
396
        homebranch     => $samplebranch1->{branchcode},
397
        holdingbranch  => $samplebranch1->{branchcode},
398
        location => 'FIC',
399
    },
400
    $biblionumber
401
);
402
403
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', q{} );
404
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
405
my $item2 = GetItem( $itemnumber2 );
406
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
407
408
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
409
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
410
$item2 = GetItem( $itemnumber2 );
411
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
412
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
413
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
414
$item2 = GetItem( $itemnumber2 );
415
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
416
417
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' );
418
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
419
$item2 = GetItem( $itemnumber2 );
420
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} );
421
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} );
422
AddIssue( $borrower_1, 'barcode_4', $daysago10,0, $today, '' );
423
$item2 = GetItem( $itemnumber2 );
424
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} );
425
426
C4::Context->set_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" );
427
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
428
$item2 = GetItem( $itemnumber2 );
429
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} );
430
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
431
$item2 = GetItem( $itemnumber2 );
432
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
433
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} );
434
AddReturn( 'barcode_4', $samplebranch1->{branchcode} );
435
$item2 = GetItem( $itemnumber2 );
436
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } );
437
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } );
438
439
440
441
391
# Bug 14640 - Cancel the hold on checking out if asked
442
# Bug 14640 - Cancel the hold on checking out if asked
392
my $reserve_id = AddReserve('CPL', $borrower_id1, $biblionumber,
443
my $reserve_id = AddReserve('CPL', $borrower_id1, $biblionumber,
393
    undef,  1, undef, undef, "a note", "a title", undef, '');
444
    undef,  1, undef, undef, "a note", "a title", undef, '');
394
- 

Return to bug 14576