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

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

Return to bug 14576