|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 33; |
|
|
| 21 |
use DateTime::Duration; |
20 |
use DateTime::Duration; |
| 22 |
|
21 |
|
| 23 |
use t::lib::Mocks; |
22 |
use t::lib::Mocks; |
|
Lines 33-39
use Koha::Database;
Link Here
|
| 33 |
use Koha::DateUtils; |
32 |
use Koha::DateUtils; |
| 34 |
use Koha::Library; |
33 |
use Koha::Library; |
| 35 |
|
34 |
|
| 36 |
use Test::More tests => 44; |
35 |
use Test::More tests => 45; |
| 37 |
|
36 |
|
| 38 |
BEGIN { |
37 |
BEGIN { |
| 39 |
require_ok('C4::Circulation'); |
38 |
require_ok('C4::Circulation'); |
|
Lines 370-398
my $itemnumber2;
Link Here
|
| 370 |
{ |
369 |
{ |
| 371 |
barcode => 'barcode_4', |
370 |
barcode => 'barcode_4', |
| 372 |
itemcallnumber => 'callnumber4', |
371 |
itemcallnumber => 'callnumber4', |
| 373 |
homebranch => $samplebranch1->{branchcode}, |
372 |
homebranch => $branchcode_1, |
| 374 |
holdingbranch => $samplebranch1->{branchcode}, |
373 |
holdingbranch => $branchcode_1, |
| 375 |
location => 'FIC', |
374 |
location => 'FIC', |
| 376 |
}, |
375 |
}, |
| 377 |
$biblionumber |
376 |
$biblionumber |
| 378 |
); |
377 |
); |
| 379 |
|
378 |
|
| 380 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); |
379 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); |
| 381 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
380 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 382 |
my $item2 = GetItem( $itemnumber2 ); |
381 |
my $item2 = GetItem( $itemnumber2 ); |
| 383 |
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); |
382 |
ok( $item2->{location} eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); |
| 384 |
|
383 |
|
| 385 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); |
384 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); |
| 386 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
385 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 387 |
$item2 = GetItem( $itemnumber2 ); |
386 |
$item2 = GetItem( $itemnumber2 ); |
| 388 |
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
387 |
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
| 389 |
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
388 |
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
| 390 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
389 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 391 |
$item2 = GetItem( $itemnumber2 ); |
390 |
$item2 = GetItem( $itemnumber2 ); |
| 392 |
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); |
391 |
ok( $item2->{location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); |
| 393 |
|
392 |
|
| 394 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' ); |
393 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' ); |
| 395 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
394 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 396 |
$item2 = GetItem( $itemnumber2 ); |
395 |
$item2 = GetItem( $itemnumber2 ); |
| 397 |
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} ); |
396 |
ok( $item2->{location} eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} ); |
| 398 |
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); |
397 |
ok( $item2->{permanent_location} eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); |
|
Lines 401-414
$item2 = GetItem( $itemnumber2 );
Link Here
|
| 401 |
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} ); |
400 |
ok( $item2->{location} eq 'GEN', q{Location updates from 'CART' to permanent location on issue} ); |
| 402 |
|
401 |
|
| 403 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); |
402 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); |
| 404 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
403 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 405 |
$item2 = GetItem( $itemnumber2 ); |
404 |
$item2 = GetItem( $itemnumber2 ); |
| 406 |
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); |
405 |
ok( $item2->{location} eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); |
| 407 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
406 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 408 |
$item2 = GetItem( $itemnumber2 ); |
407 |
$item2 = GetItem( $itemnumber2 ); |
| 409 |
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
408 |
ok( $item2->{location} eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
| 410 |
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
409 |
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); |
| 411 |
AddReturn( 'barcode_4', $samplebranch1->{branchcode} ); |
410 |
AddReturn( 'barcode_4', $branchcode_1 ); |
| 412 |
$item2 = GetItem( $itemnumber2 ); |
411 |
$item2 = GetItem( $itemnumber2 ); |
| 413 |
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); |
412 |
ok( $item2->{location} eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); |
| 414 |
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); |
413 |
ok( $item2->{permanent_location} eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); |
| 415 |
- |
|
|