Problem

Currently there is no way to change a submission owner as it is hardcoded to the user who actually submits it. There are times where as an administrator we need to upload a submission but want another user to be the owner so it shows on their profile or if they need to edit a submission.

Solution

Provide an option similar to node author where someone could add a different user name for submission author.

Comments

kclarkson created an issue. See original summary.

kclarkson’s picture

Multiple owners would also be good. I could see a scenario where its a group project and they want to add someone else.

  • jrockowitz committed 3d03bcc on 2865100-submission-owner
    Issue #2865100: Allow submission owner to be changed after submission
    
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new1.85 KB

Drupal core does not support multiple owners but exposing the single owner is very easy to do.

Status: Needs review » Needs work

The last submitted patch, 4: allow_submission_owner-2865100-4.patch, failed testing.

  • jrockowitz committed bf64473 on 2865100-submission-owner
    Issue #2865100: Allow submission owner to be changed after submission
    

  • jrockowitz committed c44318f on 2865100-submission-owner
    Issue #2865100: Allow submission owner to be changed after submission
    
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.52 KB
jrockowitz’s picture

The simplest solution is to add 'Submitted by' to the 'Notes' modal dialog. I don't expect a lot of administrators to be changing the submission's owner.

jrockowitz’s picture

StatusFileSize
new110.54 KB

Here is screenshot of the new field.

  • jrockowitz committed 8830335 on 8.x-5.x
    Issue #2865100 by jrockowitz: Allow submission owner to be changed after...
jrockowitz’s picture

jrockowitz’s picture

Status: Needs review » Fixed
kclarkson’s picture

when clicking on my add note icon nothing happens. No pop up or anything.

Also any reason it can't be a field on the submission edit tab like similar to a node?

I feel like people are comfortable with that and I could see wanting to provide permissions to allow different roles to change the author.

jrockowitz’s picture

When the notes icon stops working, there is most likely a 500 error suppressing the modal dialog.

Try right clicking the notes icon and opening a new tab.
or go to the notes form via /admin/structure/webform/manage/WEBFORM_ID/submission/SID/notes

You can also go the 'Recent log messages' and see what error is being captured.

The 'Submitted by' field looked out of place on the main form. Most admins are not going to need to change the submission user.

kclarkson’s picture

Jake,

When visiting the log link from within the webform I am receiving the following error:

The website encountered an unexpected error. Please try again later.

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "datetime.time". in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\webform\WebformSubmissionNotesForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\webform\WebformSubmissionNotesForm') (Line: 187)
Drupal\Core\Entity\EntityTypeManager->getFormObject('webform_submission', 'notes') (Line: 82)
Drupal\Core\Entity\EntityManager->getFormObject('webform_submission', 'notes') (Line: 69)
Drupal\Core\Entity\HtmlEntityFormController->getFormObject(Object, 'webform_submission.notes.default') (Line: 59)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

jrockowitz’s picture

Status: Fixed » Needs review
StatusFileSize
new1.68 KB

@kaleem I am willing to bet you are running 8.2.x.

The \Drupal\webform\WebformSubmissionNotesForm::__construct method definition is different between 8.2.x and 8.3.x and the 'datetime.time' service is only in 8.3.x.

I can't find any change records about these API tweaks.

The attached patch should fix this issue. It contains a @todo to update the code once only 8.3.x is supported by the Webform module.

  • jrockowitz committed 879d2d1 on 8.x-5.x
    Issue #2865100 by jrockowitz, kclarkson: Allow submission owner to be...
jrockowitz’s picture

I committed the patch. Please download and review the latest dev release.

jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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