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

(-)a/t/db_dependent/SIP/Message.t (-7 / +10 lines)
Lines 326-336 sub test_checkin_v2 { Link Here
326
    my $card1 = $patron1->{cardnumber};
326
    my $card1 = $patron1->{cardnumber};
327
    my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 );
327
    my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 );
328
    $findpatron = $sip_patron1;
328
    $findpatron = $sip_patron1;
329
    my $item = $builder->build({
329
    my $item_object = $builder->build_sample_item({
330
        source => 'Item',
330
        damaged => 0,
331
        value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode },
331
        withdrawn => 0,
332
        itemlost => 0,
333
        restricted => 0,
334
        homebranch => $branchcode,
335
        holdingbranch => $branchcode,
332
    });
336
    });
333
    my $item_object = Koha::Items->find( $item->{itemnumber} );
334
337
335
    my $mockILS = $mocks->{ils};
338
    my $mockILS = $mocks->{ils};
336
    my $server = { ils => $mockILS, account => {} };
339
    my $server = { ils => $mockILS, account => {} };
Lines 364-370 sub test_checkin_v2 { Link Here
364
    $siprequest = CHECKIN . 'N' . 'YYYYMMDDZZZZHHMMSS' .
367
    $siprequest = CHECKIN . 'N' . 'YYYYMMDDZZZZHHMMSS' .
365
        siprequestdate( $today->clone->add( days => 1) ) .
368
        siprequestdate( $today->clone->add( days => 1) ) .
366
        FID_INST_ID . $branchcode . '|'.
369
        FID_INST_ID . $branchcode . '|'.
367
        FID_ITEM_ID . $item->{barcode} . '|' .
370
        FID_ITEM_ID . $item_object->barcode . '|' .
368
        FID_TERMINAL_PWD . 'ignored' . '|';
371
        FID_TERMINAL_PWD . 'ignored' . '|';
369
    undef $response;
372
    undef $response;
370
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
373
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
Lines 443-449 sub test_checkin_v2 { Link Here
443
    $server->{account}->{ct_always_send} = 0;
446
    $server->{account}->{ct_always_send} = 0;
444
447
445
    # Checkin at wrong branch: issue item and switch branch, and checkin
448
    # Checkin at wrong branch: issue item and switch branch, and checkin
446
    my $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item->{itemnumber} })->store;
449
    my $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object->itemnumber })->store;
447
    $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
450
    $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
448
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'homebranch' );
451
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'homebranch' );
449
    undef $response;
452
    undef $response;
Lines 452-458 sub test_checkin_v2 { Link Here
452
    is( substr($response,2,1), '0', 'OK flag is false when we check in at the wrong branch and we do not allow it' );
455
    is( substr($response,2,1), '0', 'OK flag is false when we check in at the wrong branch and we do not allow it' );
453
    is( substr($response,5,1), 'Y', 'Alert flag is set' );
456
    is( substr($response,5,1), 'Y', 'Alert flag is set' );
454
    check_field( $respcode, $response, FID_SCREEN_MSG, 'Checkin failed', 'Check screen msg' );
457
    check_field( $respcode, $response, FID_SCREEN_MSG, 'Checkin failed', 'Check screen msg' );
455
    $branchcode = $item->{homebranch};  # switch back
458
    $branchcode = $item_object->homebranch;  # switch back
456
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
459
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
457
460
458
    # Data corrupted: add same issue_id to old_issues
461
    # Data corrupted: add same issue_id to old_issues
(-)a/t/db_dependent/SIP/Transaction.t (-14 / +8 lines)
Lines 49-73 subtest fill_holds_at_checkout => sub { Link Here
49
    t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 });
49
    t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 });
50
50
51
    my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} });
51
    my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} });
52
    my $biblio = $builder->build({ source => 'Biblio' });
52
    my $item1 = $builder->build_sample_item({
53
    my $biblioitem = $builder->build({ source => 'Biblioitem', value=>{biblionumber=>$biblio->{biblionumber}} });
54
    my $item1 = $builder->build({ source => 'Item', value => {
55
        barcode       => 'barcode4test',
53
        barcode       => 'barcode4test',
56
        homebranch    => $branch->{branchcode},
54
        homebranch    => $branch->{branchcode},
57
        holdingbranch => $branch->{branchcode},
55
        holdingbranch => $branch->{branchcode},
58
        biblionumber  => $biblio->{biblionumber},
59
        itype         => $itype->{itemtype},
56
        itype         => $itype->{itemtype},
60
        notforloan       => 0,
57
        notforloan       => 0,
61
        }
58
    })->unblessed;
62
    });
59
    my $item2 = $builder->build_sample_item({
63
    my $item2 = $builder->build({ source => 'Item', value => {
64
        homebranch    => $branch->{branchcode},
60
        homebranch    => $branch->{branchcode},
65
        holdingbranch => $branch->{branchcode},
61
        holdingbranch => $branch->{branchcode},
66
        biblionumber  => $biblio->{biblionumber},
62
        biblionumber  => $item1->{biblionumber},
67
        itype         => $itype->{itemtype},
63
        itype         => $itype->{itemtype},
68
        notforloan       => 0,
64
        notforloan       => 0,
69
        }
65
    })->unblessed;
70
    });
71
66
72
    Koha::CirculationRules->set_rules(
67
    Koha::CirculationRules->set_rules(
73
        {
68
        {
Lines 88-105 subtest fill_holds_at_checkout => sub { Link Here
88
        {
83
        {
89
            branchcode     => $branch->{branchcode},
84
            branchcode     => $branch->{branchcode},
90
            borrowernumber => $borrower->{borrowernumber},
85
            borrowernumber => $borrower->{borrowernumber},
91
            biblionumber   => $biblio->{biblionumber}
86
            biblionumber   => $item1->{biblionumber}
92
        }
87
        }
93
    );
88
    );
94
    my $reserve2 = AddReserve(
89
    my $reserve2 = AddReserve(
95
        {
90
        {
96
            branchcode     => $branch->{branchcode},
91
            branchcode     => $branch->{branchcode},
97
            borrowernumber => $borrower->{borrowernumber},
92
            borrowernumber => $borrower->{borrowernumber},
98
            biblionumber   => $biblio->{biblionumber}
93
            biblionumber   => $item1->{biblionumber}
99
        }
94
        }
100
    );
95
    );
101
96
102
    my $bib = Koha::Biblios->find( $biblio->{biblionumber} );
97
    my $bib = Koha::Biblios->find( $item1->{biblionumber} );
103
    is( $bib->holds->count(), 2, "Bib has 2 holds");
98
    is( $bib->holds->count(), 2, "Bib has 2 holds");
104
99
105
    my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} );
100
    my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} );
106
- 

Return to bug 20816