Bug 40800 - TransferArrived needlessly triggers alerts in SIP
Summary: TransferArrived needlessly triggers alerts in SIP
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-12 14:04 UTC by Martin Renvoize (ashimema)
Modified: 2025-09-12 14:23 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 40800: SIP checkin incorrectly triggering alerts on successful transfer completion (2.12 KB, patch)
2025-09-12 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 40800: Add unit test for SIP TransferArrived alert fix (3.27 KB, patch)
2025-09-12 14:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2025-09-12 14:04:28 UTC
A SIP check-in incorrectly triggers alerts when receiving items in transit at the destination library due to the NotIssued status combined with the TransferArrived message.

When an item in transit is checked in at its destination library via SIP clients (sorters, self-service kiosks), the system generates an alert because it finds both:

* NotIssued status (item not checked out to a user), therefore a checkin failure
* Transfer receipt message

Whilst this combination appropriately provides informational messages in the staff client, it's inappropriate for SIP contexts where automated systems don't require transfer receipt notifications and the alert disrupts workflow.

The item status transition works correctly (transit → available), but the SIP response incorrectly signals an alert condition, preventing automated systems like sorters from processing transferred items seamlessly.

Expected Behaviour
SIP check-in of transit items at destination libraries should complete without alerts, allowing automated systems to process transferred items without manual intervention.
Comment 1 Martin Renvoize (ashimema) 2025-09-12 14:21:47 UTC
Created attachment 186385 [details] [review]
Bug 40800: SIP checkin incorrectly triggering alerts on successful transfer completion

When an item is checked in via SIP2 at the correct target branch after a
transfer, the system was incorrectly triggering an alert flag. This occurred
because the TransferArrived message was not being filtered out for accounts
with checked_in_ok="1", causing the alert logic to treat successful transfer
completion as a failure condition.

The TransferArrived message indicates successful transfer completion and is
purely informational - it should not trigger SIP alerts. This fix ensures
that TransferArrived messages are filtered out before alert evaluation,
preventing false positive alerts on successful operations.

Test Plan:
1. Set up a SIP2 account with checked_in_ok="1" in SIPconfig.xml
2. Via staff client, check out an item to a patron
3. Return the item to a different branch to trigger a transfer
4. Use misc/sip_cli_emulator.pl to check in the item at the target branch
5. Verify SIP response shows alert flag 'N' (no alert) instead of 'Y'
6. Test wrong branch checkin still shows alert flag 'Y' with CV04 type

Before: Transfer completion at correct branch incorrectly shows alert='Y'
After: Transfer completion at correct branch correctly shows alert='N'
Comment 2 Martin Renvoize (ashimema) 2025-09-12 14:21:49 UTC
Created attachment 186386 [details] [review]
Bug 40800: Add unit test for SIP TransferArrived alert fix

This test verifies that the TransferArrived message is properly filtered
out during SIP checkin operations to prevent false positive alerts when
an item is successfully checked in at the correct transfer destination.

The test creates a transfer scenario and confirms that:
1. TransferArrived messages are filtered out of the response
2. No alert_type is set for successful transfer completion
3. Alert flag remains false for accounts with checked_in_ok=1
4. Transaction is marked as successful

This validates the fix for the bug where SIP was incorrectly triggering
alerts on successful transfer completion.