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 45-69 subtest fill_holds_at_checkout => sub { Link Here
45
    t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 });
45
    t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 });
46
46
47
    my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} });
47
    my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} });
48
    my $biblio = $builder->build({ source => 'Biblio' });
48
    my $item1 = $builder->build_sample_item({
49
    my $biblioitem = $builder->build({ source => 'Biblioitem', value=>{biblionumber=>$biblio->{biblionumber}} });
50
    my $item1 = $builder->build({ source => 'Item', value => {
51
        barcode       => 'barcode4test',
49
        barcode       => 'barcode4test',
52
        homebranch    => $branch->{branchcode},
50
        homebranch    => $branch->{branchcode},
53
        holdingbranch => $branch->{branchcode},
51
        holdingbranch => $branch->{branchcode},
54
        biblionumber  => $biblio->{biblionumber},
55
        itype         => $itype->{itemtype},
52
        itype         => $itype->{itemtype},
56
        notforloan       => 0,
53
        notforloan       => 0,
57
        }
54
    })->unblessed;
58
    });
55
    my $item2 = $builder->build_sample_item({
59
    my $item2 = $builder->build({ source => 'Item', value => {
60
        homebranch    => $branch->{branchcode},
56
        homebranch    => $branch->{branchcode},
61
        holdingbranch => $branch->{branchcode},
57
        holdingbranch => $branch->{branchcode},
62
        biblionumber  => $biblio->{biblionumber},
58
        biblionumber  => $item1->{biblionumber},
63
        itype         => $itype->{itemtype},
59
        itype         => $itype->{itemtype},
64
        notforloan       => 0,
60
        notforloan       => 0,
65
        }
61
    })->unblessed;
66
    });
67
62
68
    Koha::IssuingRule->new({
63
    Koha::IssuingRule->new({
69
        categorycode     => $borrower->{categorycode},
64
        categorycode     => $borrower->{categorycode},
Lines 76-84 subtest fill_holds_at_checkout => sub { Link Here
76
        lengthunit       => 'days',
71
        lengthunit       => 'days',
77
    })->store;
72
    })->store;
78
73
79
    my $reserve1 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->{biblionumber});
74
    my $reserve1 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$item1->{biblionumber});
80
    my $reserve2 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->{biblionumber});
75
    my $reserve2 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$item1->{biblionumber});
81
    my $bib = Koha::Biblios->find( $biblio->{biblionumber} );
76
    my $bib = Koha::Biblios->find( $item1->{biblionumber} );
82
    is( $bib->holds->count(), 2, "Bib has 2 holds");
77
    is( $bib->holds->count(), 2, "Bib has 2 holds");
83
78
84
    my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} );
79
    my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} );
85
- 

Return to bug 20816