|
Lines 380-386
subtest "Test build_custom_field_string" => sub {
Link Here
|
| 380 |
}; |
380 |
}; |
| 381 |
|
381 |
|
| 382 |
subtest "Test cr_item_field" => sub { |
382 |
subtest "Test cr_item_field" => sub { |
| 383 |
plan tests => 3; |
383 |
plan tests => 8; |
| 384 |
|
384 |
|
| 385 |
my $builder = t::lib::TestBuilder->new(); |
385 |
my $builder = t::lib::TestBuilder->new(); |
| 386 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
386 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
|
Lines 405-410
subtest "Test cr_item_field" => sub {
Link Here
|
| 405 |
restricted => 0, |
405 |
restricted => 0, |
| 406 |
homebranch => $branchcode, |
406 |
homebranch => $branchcode, |
| 407 |
holdingbranch => $branchcode, |
407 |
holdingbranch => $branchcode, |
|
|
408 |
datelastseen => '1900-01-01', |
| 408 |
}); |
409 |
}); |
| 409 |
|
410 |
|
| 410 |
my $mockILS = $mocks->{ils}; |
411 |
my $mockILS = $mocks->{ils}; |
|
Lines 448-454
subtest "Test cr_item_field" => sub {
Link Here
|
| 448 |
|
449 |
|
| 449 |
$server->{account}->{cr_item_field} = 'itype'; |
450 |
$server->{account}->{cr_item_field} = 'itype'; |
| 450 |
|
451 |
|
|
|
452 |
$server->{account}->{seen_on_item_information} = ''; |
| 453 |
$msg->handle_item_information( $server ); |
| 454 |
$item_object->get_from_storage; |
| 455 |
is( $item_object->datelastseen, "1900-01-01", "datelastseen remains unchanged" ); |
| 456 |
|
| 457 |
$item_object->update({ itemlost => 1, datelastseen => '1900-01-01' }); |
| 458 |
$server->{account}->{seen_on_item_information} = 'keep_lost'; |
| 459 |
$msg->handle_item_information( $server ); |
| 460 |
$item_object = Koha::Items->find( $item_object->id ); |
| 461 |
isnt( $item_object->datelastseen, "1900-01-01", "datelastseen updated" ); |
| 462 |
is( $item_object->itemlost, 1, "item remains lost" ); |
| 463 |
|
| 464 |
$item_object->update({ itemlost => 1, datelastseen => '1900-01-01' }); |
| 465 |
$server->{account}->{seen_on_item_information} = 'mark_found'; |
| 451 |
$msg->handle_item_information( $server ); |
466 |
$msg->handle_item_information( $server ); |
|
|
467 |
$item_object = Koha::Items->find( $item_object->id ); |
| 468 |
isnt( $item_object->datelastseen, "1900-01-01", "datelastseen updated" ); |
| 469 |
is( $item_object->itemlost, 0, "item is no longer lost" ); |
| 452 |
|
470 |
|
| 453 |
my $itype = $item_object->itype; |
471 |
my $itype = $item_object->itype; |
| 454 |
ok( $response =~ m/CR$itype/, "Found correct CR field in response"); |
472 |
ok( $response =~ m/CR$itype/, "Found correct CR field in response"); |
| 455 |
- |
|
|