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 302-308 sub test_request_patron_info_v2 { Link Here
302
302
303
sub test_checkin_v2 {
303
sub test_checkin_v2 {
304
    my $builder = t::lib::TestBuilder->new();
304
    my $builder = t::lib::TestBuilder->new();
305
    my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
305
    my $branchcode  = $builder->build({ source => 'Branch' })->{branchcode};
306
    my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode};
306
    my ( $response, $findpatron );
307
    my ( $response, $findpatron );
307
    my $mocks = create_mocks( \$response, \$findpatron, \$branchcode );
308
    my $mocks = create_mocks( \$response, \$findpatron, \$branchcode );
308
309
Lines 320-325 sub test_checkin_v2 { Link Here
320
        source => 'Item',
321
        source => 'Item',
321
        value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode },
322
        value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode },
322
    });
323
    });
324
    my $item_object = Koha::Items->find( $item->{itemnumber} );
323
325
324
    my $mockILS = $mocks->{ils};
326
    my $mockILS = $mocks->{ils};
325
    my $server = { ils => $mockILS, account => {} };
327
    my $server = { ils => $mockILS, account => {} };
Lines 370-378 sub test_checkin_v2 { Link Here
370
    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' );
372
    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' );
371
    is( substr($response,5,1), 'N', 'Alert flag no longer set' );
373
    is( substr($response,5,1), 'N', 'Alert flag no longer set' );
372
    check_field( $respcode, $response, FID_SCREEN_MSG, undef, 'No screen msg' );
374
    check_field( $respcode, $response, FID_SCREEN_MSG, undef, 'No screen msg' );
373
    $server->{account}->{checked_in_ok} = 0;
374
375
375
    $server->{account}->{checked_in_ok} = 1;
376
    # Move item to another holding branch to trigger CV of 04 with alert flag
377
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'holdingbranch' );
378
    $item_object->holdingbranch( $branchcode2 )->store();
379
    undef $response;
380
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
381
    $msg->handle_checkin( $server );
382
    is( substr($response,5,1), 'Y', 'Alert flag is set with check_in_ok, item is checked in but needs transfer' );
383
    check_field( $respcode, $response, FID_ALERT_TYPE, '04', 'Got FID_ALERT_TYPE (CV) field with value 04 ( needs transfer )' );
384
    $item_object->holdingbranch( $branchcode )->store();
385
    t::lib::Mocks::mock_preference( ' AllowReturnToBranch ', 'anywhere' );
386
376
    $server->{account}->{cv_send_00_on_success} = 0;
387
    $server->{account}->{cv_send_00_on_success} = 0;
377
    undef $response;
388
    undef $response;
378
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
389
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
379
- 

Return to bug 23057