Skip to content

Commit

Permalink
UHF-11127: Make sure the form_uuid is always set, even if it's not in…
Browse files Browse the repository at this point in the history
… the og metadata.
  • Loading branch information
jiisuominen committed Dec 11, 2024
1 parent 7233bb4 commit c366961
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,22 @@ public function getCompanyApplications(
}

$submissionData = $submission->getData();
$webform = $submission->getWebform();

// There's old applications w/o form_uuid, let's add it here
// Since we've already loaded webform for submission object the old way,
// we should have it here anyways. Just make sure it's in the metadata
// as well.
if (!isset($submissionData["metadata"]["form_uuid"])) {
$submissionData["metadata"]["form_uuid"] = $webform->uuid();
}

$submissionData['messages'] = $this->grantsHandlerMessageService->parseMessages($submissionData);
$submission = [
'#theme' => $themeHook,
'#submission' => $submissionData,
'#document' => $document,
'#webform' => $submission->getWebform(),
'#webform' => $webform,
'#submission_id' => $submission->id(),
];

Expand Down Expand Up @@ -390,7 +399,7 @@ public function getWebformFromApplicationNumber(string $applicationNumber): Webf
throw new AtvDocumentNotFoundException('Document not found');
}

$uuid = $document->getMetadata()['form_uuid'];
$uuid = $document->getMetadata()['form_uuid'] ?? NULL;

if (!$uuid) {
// And return webform loaded the old way.
Expand Down

0 comments on commit c366961

Please sign in to comment.