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 371-376
AddReturn( 'barcode_3', $branchcode_1 );
Link Here
|
371 |
$item = GetItem( $itemnumber ); |
371 |
$item = GetItem( $itemnumber ); |
372 |
ok( $item->{notforloan} eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} ); |
372 |
ok( $item->{notforloan} eq 9, q{UpdateNotForLoanStatusOnCheckin does not update notforloan value from 9 with setting "1: 9"} ); |
373 |
|
373 |
|
|
|
374 |
my $itemnumber2; |
375 |
($biblionumber, $biblioitemnumber, $itemnumber2) = C4::Items::AddItem( |
376 |
{ |
377 |
barcode => 'barcode_4', |
378 |
itemcallnumber => 'callnumber4', |
379 |
homebranch => $branchcode_1, |
380 |
holdingbranch => $branchcode_1, |
381 |
location => 'FIC', |
382 |
itype => $itemtype |
383 |
}, |
384 |
$biblionumber |
385 |
); |
386 |
|
387 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); |
388 |
AddReturn( 'barcode_4', $branchcode_1 ); |
389 |
my $item2 = GetItem( $itemnumber2 ); |
390 |
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); |
391 |
|
392 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); |
393 |
AddReturn( 'barcode_4', $branchcode_1 ); |
394 |
$item2 = GetItem( $itemnumber2 ); |
395 |
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
396 |
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
397 |
AddReturn( 'barcode_4', $branchcode_1 ); |
398 |
$item2 = GetItem( $itemnumber2 ); |
399 |
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); |
400 |
|
401 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' ); |
402 |
AddReturn( 'barcode_4', $branchcode_1 ); |
403 |
$item2 = GetItem( $itemnumber2 ); |
404 |
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} ); |
405 |
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); |
406 |
AddIssue( $borrower_1, 'barcode_4', $daysago10,0, $today, '' ); |
407 |
$item2 = GetItem( $itemnumber2 ); |
408 |
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} ); |
409 |
|
410 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); |
411 |
AddReturn( 'barcode_4', $branchcode_1 ); |
412 |
$item2 = GetItem( $itemnumber2 ); |
413 |
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); |
414 |
AddReturn( 'barcode_4', $branchcode_1 ); |
415 |
$item2 = GetItem( $itemnumber2 ); |
416 |
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
417 |
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
418 |
AddReturn( 'barcode_4', $branchcode_1 ); |
419 |
$item2 = GetItem( $itemnumber2 ); |
420 |
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); |
421 |
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); |
422 |
|
423 |
|
424 |
|
425 |
|
374 |
# Bug 14640 - Cancel the hold on checking out if asked |
426 |
# Bug 14640 - Cancel the hold on checking out if asked |
375 |
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber, |
427 |
my $reserve_id = AddReserve($branchcode_1, $borrower_id1, $biblionumber, |
376 |
undef, 1, undef, undef, "a note", "a title", undef, ''); |
428 |
undef, 1, undef, undef, "a note", "a title", undef, ''); |