Posted by andypost on March 31, 2010 at 12:54pm
3 followers
| Project: | Webform |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
If a set "Submission limit" and already post submission - I can't edit submission because getting error message on every submit 'You have already submitted this form.'
This caused by webform_client_form_validate() calling _webform_submission_limit_check() which does not check for access rights properly.
_webform_submission_limit_check() should first check is submission edited and user has rights.
This patch just adds this check.
| Attachment | Size |
|---|---|
| webform-submission-limit.patch | 917 bytes |
Comments
#1
I think it's better check access in _validate()
#2
Forget about global $user also $details should be filled with $submission->uid to not override when editing
#3
Same patch for 6-2 branch
#4
Thanks, I've confirmed this problem in 3.x.
I don't think checking permissions is necessary, since we already checked permissions when the user was granted access to the form. Instead we can check variables from $form_state:
<?php
// In 3.x, the 'finished' value means this submission has been saved to the database and is not a draft.
// In other words, it's an existing submission being edited.
$form_state['values']['details']['finished'];
// In 2.x, we can just check the 'sid' value since it will only be set when editing.
$form_state['values']['details']['sid'];
</code>
?>
Though I found a problem with our "finished" variable, it's not populated correctly because we were checking a non-existent property when populating it.
#5
Yes, no need to check permission. But I a bit confused by finished and draft states (never used them)
Also there's a problem with owner of submission in 3rd branch. Owner is changing to editor
#6
Sure enough. We can roll that in with this patch, as you corrected it in #3.
#7
Phew, okay fixed in all branches. Patches attached that I committed to each branch. This is why 2.x support is coming to an abrupt end once 3.x reaches final. ;-)
Thanks for reporting this issue, it would've been a terrible nasty for anyone upgrading to 2.10 of Webform, which I'm hoping will be the last release in the 2.x cycle.
#8
Thanx a lot for quick reply, I already found code-base very different for 2.9 and 6-2 branch which seems more like 3.0
I'm testing 3.0 branch but scare it's too early for production. WF3 still have no integration with Form Builder
#9
Webform 3 won't have Form Builder support for a long time. See #738994: Remove Form Builder Integration.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.