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

(-)a/t/db_dependent/SIP/Transaction.t (-2 / +40 lines)
Lines 5-11 Link Here
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
use Test::NoWarnings;
7
use Test::NoWarnings;
8
use Test::More tests => 22;
8
use Test::More tests => 23;
9
use Test::Warn;
9
use Test::Warn;
10
10
11
use DateTime;
11
use DateTime;
Lines 1643-1646 subtest 'Checkin message' => sub { Link Here
1643
    is( $circ->{screen_msg}, '', "Checked out item was checked out to the next patron" );
1643
    is( $circ->{screen_msg}, '', "Checked out item was checked out to the next patron" );
1644
};
1644
};
1645
1645
1646
subtest 'TransferArrived should not trigger SIP alert' => sub {
1647
    plan tests => 4;
1648
1649
    my $library1 = $builder->build_object( { class => 'Koha::Libraries' } );
1650
    my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
1651
1652
    my $item     = $builder->build_sample_item( { library => $library1->branchcode } );
1653
    my $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
1654
1655
    # Create a transfer from library1 to library2
1656
    my $transfer = Koha::Item::Transfer->new(
1657
        {
1658
            itemnumber => $item->itemnumber,
1659
            frombranch => $library1->branchcode,
1660
            tobranch   => $library2->branchcode,
1661
            datesent   => dt_from_string(),
1662
            reason     => 'Manual'
1663
        }
1664
    )->store;
1665
1666
    t::lib::Mocks::mock_userenv( { branchcode => $library2->branchcode, flags => 1 } );
1667
    t::lib::Mocks::mock_preference( 'SIP2SortBinMapping', '' );
1668
1669
    # Test: Checkin at correct destination with checked_in_ok=1 (should work perfectly)
1670
    my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new();
1671
    $ci_transaction->item($sip_item);
1672
1673
    my $account_with_checked_in_ok = { checked_in_ok => 1, sort_bin_mapping => [] };
1674
    my $result = $ci_transaction->do_checkin( $library2->branchcode, undef, $account_with_checked_in_ok );
1675
1676
    # Key test: TransferArrived message should be filtered out
1677
    ok( !$result->{messages}->{TransferArrived}, 'TransferArrived message filtered out by fix' );
1678
1679
    # Verify no alert is triggered for successful transfer completion
1680
    is( $ci_transaction->alert_type, undef, 'No alert_type set for successful transfer completion' );
1681
    ok( !$ci_transaction->alert, 'Alert flag is false for successful transfer completion' );
1682
    is( $ci_transaction->ok, 1, 'Transaction marked as successful' );
1683
};
1684
1646
$schema->storage->txn_rollback;
1685
$schema->storage->txn_rollback;
1647
- 

Return to bug 40800