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