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

(-)a/t/db_dependent/SIP/Message.t (-7 / +10 lines)
Lines 317-327 sub test_checkin_v2 { Link Here
317
    my $card1 = $patron1->{cardnumber};
317
    my $card1 = $patron1->{cardnumber};
318
    my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 );
318
    my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 );
319
    $findpatron = $sip_patron1;
319
    $findpatron = $sip_patron1;
320
    my $item = $builder->build({
320
    my $item_object = $builder->build_sample_item({
321
        source => 'Item',
321
        damaged => 0,
322
        value => { damaged => 0, withdrawn => 0, itemlost => 0, restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode },
322
        withdrawn => 0,
323
        itemlost => 0,
324
        restricted => 0,
325
        homebranch => $branchcode,
326
        holdingbranch => $branchcode,
323
    });
327
    });
324
    my $item_object = Koha::Items->find( $item->{itemnumber} );
325
328
326
    my $mockILS = $mocks->{ils};
329
    my $mockILS = $mocks->{ils};
327
    my $server = { ils => $mockILS, account => {} };
330
    my $server = { ils => $mockILS, account => {} };
Lines 355-361 sub test_checkin_v2 { Link Here
355
    $siprequest = CHECKIN . 'N' . 'YYYYMMDDZZZZHHMMSS' .
358
    $siprequest = CHECKIN . 'N' . 'YYYYMMDDZZZZHHMMSS' .
356
        siprequestdate( $today->clone->add( days => 1) ) .
359
        siprequestdate( $today->clone->add( days => 1) ) .
357
        FID_INST_ID . $branchcode . '|'.
360
        FID_INST_ID . $branchcode . '|'.
358
        FID_ITEM_ID . $item->{barcode} . '|' .
361
        FID_ITEM_ID . $item_object->barcode . '|' .
359
        FID_TERMINAL_PWD . 'ignored' . '|';
362
        FID_TERMINAL_PWD . 'ignored' . '|';
360
    undef $response;
363
    undef $response;
361
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
364
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
Lines 434-440 sub test_checkin_v2 { Link Here
434
    $server->{account}->{ct_always_send} = 0;
437
    $server->{account}->{ct_always_send} = 0;
435
438
436
    # Checkin at wrong branch: issue item and switch branch, and checkin
439
    # Checkin at wrong branch: issue item and switch branch, and checkin
437
    my $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item->{itemnumber} })->store;
440
    my $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object->itemnumber })->store;
438
    $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
441
    $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
439
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'homebranch' );
442
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'homebranch' );
440
    undef $response;
443
    undef $response;
Lines 443-449 sub test_checkin_v2 { Link Here
443
    is( substr($response,2,1), '0', 'OK flag is false when we check in at the wrong branch and we do not allow it' );
446
    is( substr($response,2,1), '0', 'OK flag is false when we check in at the wrong branch and we do not allow it' );
444
    is( substr($response,5,1), 'Y', 'Alert flag is set' );
447
    is( substr($response,5,1), 'Y', 'Alert flag is set' );
445
    check_field( $respcode, $response, FID_SCREEN_MSG, 'Checkin failed', 'Check screen msg' );
448
    check_field( $respcode, $response, FID_SCREEN_MSG, 'Checkin failed', 'Check screen msg' );
446
    $branchcode = $item->{homebranch};  # switch back
449
    $branchcode = $item_object->homebranch;  # switch back
447
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
450
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
448
451
449
    # Data corrupted: add same issue_id to old_issues
452
    # Data corrupted: add same issue_id to old_issues
(-)a/t/db_dependent/SIP/Transaction.t (-14 / +8 lines)
Lines 46-70 subtest fill_holds_at_checkout => sub { Link Here
46
    t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 });
46
    t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 });
47
47
48
    my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} });
48
    my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} });
49
    my $biblio = $builder->build({ source => 'Biblio' });
49
    my $item1 = $builder->build_sample_item({
50
    my $biblioitem = $builder->build({ source => 'Biblioitem', value=>{biblionumber=>$biblio->{biblionumber}} });
51
    my $item1 = $builder->build({ source => 'Item', value => {
52
        barcode       => 'barcode4test',
50
        barcode       => 'barcode4test',
53
        homebranch    => $branch->{branchcode},
51
        homebranch    => $branch->{branchcode},
54
        holdingbranch => $branch->{branchcode},
52
        holdingbranch => $branch->{branchcode},
55
        biblionumber  => $biblio->{biblionumber},
56
        itype         => $itype->{itemtype},
53
        itype         => $itype->{itemtype},
57
        notforloan       => 0,
54
        notforloan       => 0,
58
        }
55
    })->unblessed;
59
    });
56
    my $item2 = $builder->build_sample_item({
60
    my $item2 = $builder->build({ source => 'Item', value => {
61
        homebranch    => $branch->{branchcode},
57
        homebranch    => $branch->{branchcode},
62
        holdingbranch => $branch->{branchcode},
58
        holdingbranch => $branch->{branchcode},
63
        biblionumber  => $biblio->{biblionumber},
59
        biblionumber  => $item1->{biblionumber},
64
        itype         => $itype->{itemtype},
60
        itype         => $itype->{itemtype},
65
        notforloan       => 0,
61
        notforloan       => 0,
66
        }
62
    })->unblessed;
67
    });
68
63
69
    Koha::CirculationRules->set_rules(
64
    Koha::CirculationRules->set_rules(
70
        {
65
        {
Lines 85-102 subtest fill_holds_at_checkout => sub { Link Here
85
        {
80
        {
86
            branchcode     => $branch->{branchcode},
81
            branchcode     => $branch->{branchcode},
87
            borrowernumber => $borrower->{borrowernumber},
82
            borrowernumber => $borrower->{borrowernumber},
88
            biblionumber   => $biblio->{biblionumber}
83
            biblionumber   => $item1->{biblionumber}
89
        }
84
        }
90
    );
85
    );
91
    my $reserve2 = AddReserve(
86
    my $reserve2 = AddReserve(
92
        {
87
        {
93
            branchcode     => $branch->{branchcode},
88
            branchcode     => $branch->{branchcode},
94
            borrowernumber => $borrower->{borrowernumber},
89
            borrowernumber => $borrower->{borrowernumber},
95
            biblionumber   => $biblio->{biblionumber}
90
            biblionumber   => $item1->{biblionumber}
96
        }
91
        }
97
    );
92
    );
98
93
99
    my $bib = Koha::Biblios->find( $biblio->{biblionumber} );
94
    my $bib = Koha::Biblios->find( $item1->{biblionumber} );
100
    is( $bib->holds->count(), 2, "Bib has 2 holds");
95
    is( $bib->holds->count(), 2, "Bib has 2 holds");
101
96
102
    my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} );
97
    my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} );
103
- 

Return to bug 20816