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

Return to bug 40800