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

(-)a/t/db_dependent/SIP/Message.t (-5 / +15 lines)
Lines 67-73 subtest 'Testing Patron Info Request V2' => sub { Link Here
67
subtest 'Checkin V2' => sub {
67
subtest 'Checkin V2' => sub {
68
    my $schema = Koha::Database->new->schema;
68
    my $schema = Koha::Database->new->schema;
69
    $schema->storage->txn_begin;
69
    $schema->storage->txn_begin;
70
    plan tests => 27;
70
    plan tests => 29;
71
    $C4::SIP::Sip::protocol_version = 2;
71
    $C4::SIP::Sip::protocol_version = 2;
72
    test_checkin_v2();
72
    test_checkin_v2();
73
    $schema->storage->txn_rollback;
73
    $schema->storage->txn_rollback;
Lines 292-298 sub test_request_patron_info_v2 { Link Here
292
292
293
sub test_checkin_v2 {
293
sub test_checkin_v2 {
294
    my $builder = t::lib::TestBuilder->new();
294
    my $builder = t::lib::TestBuilder->new();
295
    my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
295
    my $branchcode  = $builder->build({ source => 'Branch' })->{branchcode};
296
    my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode};
296
    my ( $response, $findpatron );
297
    my ( $response, $findpatron );
297
    my $mocks = create_mocks( \$response, \$findpatron, \$branchcode );
298
    my $mocks = create_mocks( \$response, \$findpatron, \$branchcode );
298
299
Lines 310-315 sub test_checkin_v2 { Link Here
310
        source => 'Item',
311
        source => 'Item',
311
        value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode },
312
        value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode },
312
    });
313
    });
314
    my $item_object = Koha::Items->find( $item->{itemnumber} );
313
315
314
    my $mockILS = $mocks->{ils};
316
    my $mockILS = $mocks->{ils};
315
    my $server = { ils => $mockILS, account => {} };
317
    my $server = { ils => $mockILS, account => {} };
Lines 360-368 sub test_checkin_v2 { Link Here
360
    is( substr($response,2,1), '1', 'OK flag is true now with checked_in_ok flag set when checking in an item that was not checked out' );
362
    is( substr($response,2,1), '1', 'OK flag is true now with checked_in_ok flag set when checking in an item that was not checked out' );
361
    is( substr($response,5,1), 'N', 'Alert flag no longer set' );
363
    is( substr($response,5,1), 'N', 'Alert flag no longer set' );
362
    check_field( $respcode, $response, FID_SCREEN_MSG, undef, 'No screen msg' );
364
    check_field( $respcode, $response, FID_SCREEN_MSG, undef, 'No screen msg' );
363
    $server->{account}->{checked_in_ok} = 0;
364
365
365
    $server->{account}->{checked_in_ok} = 1;
366
    # Move item to another holding branch to trigger CV of 04 with alert flag
367
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'holdingbranch' );
368
    $item_object->holdingbranch( $branchcode2 )->store();
369
    undef $response;
370
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
371
    $msg->handle_checkin( $server );
372
    is( substr($response,5,1), 'Y', 'Alert flag is set with check_in_ok, item is checked in but needs transfer' );
373
    check_field( $respcode, $response, FID_ALERT_TYPE, '04', 'Got FID_ALERT_TYPE (CV) field with value 04 ( needs transfer )' );
374
    $item_object->holdingbranch( $branchcode )->store();
375
    t::lib::Mocks::mock_preference( ' AllowReturnToBranch ', 'anywhere' );
376
366
    $server->{account}->{cv_send_00_on_success} = 0;
377
    $server->{account}->{cv_send_00_on_success} = 0;
367
    undef $response;
378
    undef $response;
368
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
379
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
369
- 

Return to bug 23057