Since bug 22008 we have a foreign key constraint for manager_id against the borrowers table; However, we neglected to update the 'pay' routing in Koha::Account to reflect this non-required field and left it to default to '0' which may not be a borrower at all.
We should allow 'undef' to be passed into 'pay' unaltered when the interface is anything other than 'staff'.. as it may reflect a SIP or OPAC payment where no staff member is required to be present.
The data in question is coming from the userenv.. so in theory should always be set and not require a fallback at all.
I think this perhaps highlights an issue in some plugin code not setting userenv properly in my case.. but I still feel we should not be defaulting back to '0' and exploding..
Created attachment 109430 [details] [review]
Bug 26332: Remove hard coded '0' for manager_id
This patch removes the fallback to '0' for the manager_id in
Koha::Account::pay. This will only affect plugins that contain a
background callback that doesn't set the user environment.
*** This bug has been marked as a duplicate of bug 25606 ***
*** This bug has been marked as a duplicate of bug 26506 ***