Bug 26332 - Koha::Account::pay incorrectly defaults to '0' for manager_id
Summary: Koha::Account::pay incorrectly defaults to '0' for manager_id
Status: RESOLVED DUPLICATE of bug 26506
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on: 22008
Blocks: 14825
  Show dependency treegraph
 
Reported: 2020-09-01 08:17 UTC by Martin Renvoize
Modified: 2020-09-28 19:47 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 26332: Remove hard coded '0' for manager_id (1.04 KB, patch)
2020-09-01 13:25 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2020-09-01 08:17:35 UTC
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.
Comment 1 Martin Renvoize 2020-09-01 08:29:06 UTC
Hmm.. 

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..
Comment 2 Martin Renvoize 2020-09-01 13:25:26 UTC
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.
Comment 3 Martin Renvoize 2020-09-27 06:40:41 UTC

*** This bug has been marked as a duplicate of bug 25606 ***
Comment 4 Martin Renvoize 2020-09-28 19:47:29 UTC

*** This bug has been marked as a duplicate of bug 26506 ***