Bug 41369

Summary: SIP payments have no branchcode
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: SIP2Assignee: Kyle M Hall (khall) <kyle>
Status: Pushed to main --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: david, lisette, m.de.rooy
Version: 25.05   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes SIP2 based payments, so that a branchcode (institution id) is now recorded for the payment.
Version(s) released in:
26.05.00
Circulation function:
Attachments: Bug 41369 - SIP payments have no branchcode
Bug 41369 - SIP payments have no branchcode
Bug 41369: SIP payments have no branchcode
Bug 41369: SIP payments have no branchcode

Description Kyle M Hall (khall) 2025-12-03 18:13:29 UTC
For SIP based payments, no branchcode is recorded for the corresponding credit. Koha should be recording the institution id ( i.e. branchcode ) for SIP payments.
Comment 1 Kyle M Hall (khall) 2025-12-03 18:15:19 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall (khall) 2025-12-03 18:53:43 UTC Comment hidden (obsolete)
Comment 3 David Nind 2025-12-03 21:34:06 UTC
Created attachment 190133 [details] [review]
Bug 41369: SIP payments have no branchcode

For SIP based payments, no branchcode is recorded for the corresponding
credit. Koha should be recording the institution id (i.e. branchcode)
for SIP payments.

Test plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Transaction.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Marcel de Rooy 2025-12-05 10:17:03 UTC
        * Proving /usr/share/koha/t/db_dependent/SIP/Transaction.t FAIL
    # Looks like you planned 14 tests but ran 9.

#   Failed test 'do_checkin'
#   at /usr/share/koha/t/db_dependent/SIP/Transaction.t line 714.
 Can't call method "branchtransfer_id" on an undefined value at /usr/share/koha/t/db_dependent/SIP/Transaction.t line 501.

Do we need to mock some circ preferences to get this always working ?
Comment 5 Kyle M Hall (khall) 2025-12-05 12:04:21 UTC
(In reply to Marcel de Rooy from comment #4)
>         * Proving /usr/share/koha/t/db_dependent/SIP/Transaction.t FAIL
>     # Looks like you planned 14 tests but ran 9.
> 
> #   Failed test 'do_checkin'
> #   at /usr/share/koha/t/db_dependent/SIP/Transaction.t line 714.
>  Can't call method "branchtransfer_id" on an undefined value at
> /usr/share/koha/t/db_dependent/SIP/Transaction.t line 501.
> 
> Do we need to mock some circ preferences to get this always working ?

Possibly, but this would be unrelated to this patch. The failed unit test is not even in the subtest I modified!
Comment 6 Marcel de Rooy 2025-12-08 10:27:13 UTC
(In reply to Kyle M Hall (khall) from comment #5)
> (In reply to Marcel de Rooy from comment #4)
> >         * Proving /usr/share/koha/t/db_dependent/SIP/Transaction.t FAIL
> >     # Looks like you planned 14 tests but ran 9.
> > 
> > #   Failed test 'do_checkin'
> > #   at /usr/share/koha/t/db_dependent/SIP/Transaction.t line 714.
> >  Can't call method "branchtransfer_id" on an undefined value at
> > /usr/share/koha/t/db_dependent/SIP/Transaction.t line 501.
> > 
> > Do we need to mock some circ preferences to get this always working ?
> 
> Possibly, but this would be unrelated to this patch. The failed unit test is
> not even in the subtest I modified!

Ah. Thats true.
Comment 7 Marcel de Rooy 2025-12-08 10:43:59 UTC
Seems that AutomaticItemReturn was the cause; enabling it makes the test pass. Seems logical given the error message..
Comment 8 Marcel de Rooy 2025-12-08 10:44:47 UTC
Created attachment 190280 [details] [review]
Bug 41369: SIP payments have no branchcode

For SIP based payments, no branchcode is recorded for the corresponding
credit. Koha should be recording the institution id (i.e. branchcode)
for SIP payments.

Test plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Transaction.t

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Lucas Gass (lukeg) 2025-12-17 20:27:16 UTC
Nice work everyone!

Pushed to main for 26.05