Download & Extend

Allow edit of submissions after submission limit

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.

AttachmentSize
webform-submission-limit.patch917 bytes

Comments

#1

I think it's better check access in _validate()

AttachmentSize
webform-submission-limit.patch 2 KB

#2

Forget about global $user also $details should be filled with $submission->uid to not override when editing

AttachmentSize
webform-submission-limit.patch 2.02 KB

#3

Same patch for 6-2 branch

AttachmentSize
webform-submission-limit-2.patch 1.09 KB

#4

Title:Allow edit submission depending on user_access()» Allow edit of submissions after submission limit

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.

AttachmentSize
webform_submission_limit_fix.patch 1.47 KB

#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

Also there's a problem with owner of submission in 3rd branch. Owner is changing to editor

Sure enough. We can roll that in with this patch, as you corrected it in #3.

#7

Status:needs review» fixed

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.

AttachmentSize
webform2_submission_limit_fix5.patch 1.24 KB
webform2_submission_limit_fix6.patch 1.2 KB
webform3_submission_limit_fix6.patch 1.65 KB
webform3_submission_limit_fix7.patch 1.73 KB

#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

WF3 still have no integration with Form Builder

Webform 3 won't have Form Builder support for a long time. See #738994: Remove Form Builder Integration.

#10

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here