Fix permission check on Contribution form, clarify underlying functions
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 6 Aug 2023 23:29:47 +0000 (11:29 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 12 Aug 2023 21:28:03 +0000 (09:28 +1200)
commit1841b6391c6648f6f66692c9f400712ed06590fa
tree1220bdb08f7928f700208239c1fa9854eeba15bc
parent96b3fa35880ce5783eda408e7a7d7dd69846a5be
Fix permission check on Contribution form, clarify underlying functions

This is a reviewer response to https://github.com/civicrm/civicrm-core/pull/22951

In that PR it seeks to set UserID to something derived from a function that is doing
a lot of work. I dug into that function which someone (ahem) wrote many years ago
and teased out some of the underlying chunks & cleaned up the variable names for clarity
along with a doc block cleanup.

I decided that rather than set _userID in contributionBase we should remove it
(it is only referred to in 4 places) and call the more specific function at each usage.

Otherwise we change the meaning of userID that is used somewhat differently later.

Also I rather prefer functions that will perform the same whenever called over relying
on a variable having been set correctly the first time
CRM/Contribute/Form/ContributionBase.php
CRM/Core/Form.php