-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/financial#50 - Fix contributions and participants getting overwritten #14244
dev/financial#50 - Fix contributions and participants getting overwritten #14244
Conversation
(Standard links)
|
53a88ab
to
de49856
Compare
@pradpnayak Thanks, nice catch! Digging a bit deeper, it seems that unlike the AJAX form, this one does not pass the contribution ID as a GET/POST parameter, thus triggering the fallback to session. Naturally, that also means the standalone edit form suffers from the same problem - if you open more than one, values from the form submission will be applied to the one you opened last. I'll check if I can make the standalone form behave like the AJAX form. |
Jenkins test this please |
8b92924 seems to have addressed the issue @pradpnayak found. The approach used here (passing the record ID explicitly):
With that in mind, there's some remaining uncertainty on whether this would break in unexpected places, and test coverage is not great for forms, to say the least. I wasn't able to uncover further issues during |
@mattwire @colemanw @seamuslee001 @xurizaemon this looks promising & addresses an ongoing annoyance - can anyone see any reason for caution here? |
I've not tested but the principal here is good. I've come up against issues when writing custom stuff and the ID of what you're trying to work with can sometimes be nearly impossible to retrieve! If the ID changes the form would be reloaded so I can't see any issues with this. |
Jenkins test this please |
test this please |
@pfigel just sitting with @colemanw now & discussing this & this seems to make sense but there could be security implications - ie could someone alter id in firebug & access a contribution that they would otherwise be blocked from by the financial acl check - ie
|
This fixes an issue where contributions may be overwritten when users open an existing contribution after opening the "Record Contribution" form (but before actually submitting it).
@eileenmcnaughton @colemanw so I tried to reproduce this and I think the check in
On the bright side, this got me to do some testing with deleting contributions, and that seems to have regressed with this change. I'll continue tomorrow. |
This fixes an issue where the hidden "id" element wasn't added because the CRM_Core_Action::DELETE handler has an early return.
8b92924
to
5774b54
Compare
@eileenmcnaughton @colemanw issue with deletes was resolved. If someone could double-check my findings for financial ACLs (haven't really used them before), I think this would be ready. |
@monishdeb please review. |
I also had a go at circumventing the acl by going into the edit screen of a contribution I had access to & setting cj('#id').val(15) in firefox and that seemed to be ignored in post processing @xurizaemon opening the hacking floor to you :-) , also @monishdeb will you have a chance to try? @pradpnayak Note the test config is a bit weird - you need to enable financial acls on the contribution settings screen and then the limited user needs to have edit contributions + edit contributions of a particular financial type in the drupal screen |
In absence of further input (I've tried a few places) I'm going to merge this in time for the rc |
@pfigel ok I've found a regression from this - it's pretty kooky https://lab.civicrm.org/dev/report/issues/16 - question is should we revert this out of 5.16 rc & bring back into master to give us more time given the crazy ugliness of it |
& a PR for the regression - #14732 (but I'm running scared now) |
Hiah, I'm just trying to follow along the trail with this - it looks like the participant element of this has NOT been fixed yet then? Is there an open issue/PR for this bit of it? |
@JKingsnorth you are right - we found a regression on the participant side & backed it out - I'd say it's a fixable but probably requires a bit of retrofitting sanity onto the code to get past the are which regressed |
Created a follow up issue on gitlab for the event registration part then: https://lab.civicrm.org/dev/core/issues/1164 |
Overview
This fixes an issue where contributions or participants may be overwritten when users open an existing contribution or participant after opening the creation form (but before actually submitting it).
Before
An existing contribution or participant is overwritten if it's been opened after the creation form was loaded.
After
A new contribution or participant is recorded.
Technical Details
The form passes a reference to itself when calling
CRM_Utils_Request::retrieve
, which eventually leads to the ID being loaded from$_SESSION
(viaCRM_Core_Controller::get()
).Some forms bypass this behaviour by not loading the ID for
CRM_Core_Action::ADD
(or only forCRM_Core_Action::UPDATE
), but I could not find any issues with this approach (i.e. not passing$this
).https://lab.civicrm.org/dev/financial/issues/50