Last active
March 8, 2021 17:52
-
-
Save sylus/eecf002008d06227f65cec43a7c826f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d7270f425c878e07b890505cc671052d6d014d51 Mon Sep 17 00:00:00 2001 | |
From: William Hearn <[email protected]> | |
Date: Mon, 8 Mar 2021 12:50:14 -0500 | |
Subject: [PATCH] feat(webform_service): Enable decryption capability | |
--- | |
resources/submission_resource.inc | 7 +++++-- | |
webform_service.module | 6 ++---- | |
2 files changed, 7 insertions(+), 6 deletions(-) | |
diff --git a/resources/submission_resource.inc b/resources/submission_resource.inc | |
index 31ed4a2..a25c883 100644 | |
--- a/resources/submission_resource.inc | |
+++ b/resources/submission_resource.inc | |
@@ -109,11 +109,14 @@ function _submission_resource_definition() { | |
function webform_service_submission_create($uuid, $submission) { | |
// Get the webform entity. | |
$webform = webform_service_resource_load($uuid); | |
- | |
// If the entity exists. | |
if ($webform && $submission) { | |
module_load_include('inc', 'webform', 'includes/webform.submissions'); | |
- $sid = webform_submission_insert($webform, webform_service_parse_submission($webform, $submission)); | |
+ module_load_include('inc', 'webform', 'webform.module'); | |
+ $serial = _webform_submission_serial_next_value($webform->nid); | |
+ $parsed_submission = webform_service_parse_submission($webform, $submission); | |
+ $parsed_submission->serial = $serial; | |
+ $sid = webform_submission_insert($webform, $parsed_submission); | |
$saved_submission = webform_get_submission($webform->nid, $sid); | |
webform_submission_send_mail($webform, $saved_submission); | |
return webform_service_get_submission($webform, webform_get_submission($webform->nid, $sid, TRUE)); | |
diff --git a/webform_service.module b/webform_service.module | |
index 902aa14..63fc793 100644 | |
--- a/webform_service.module | |
+++ b/webform_service.module | |
@@ -35,15 +35,12 @@ function webform_service_services_resources() { | |
* Determine whether the current user has access to a submission. | |
*/ | |
function webform_service_submission_access($op = 'view', $args = array()) { | |
- | |
// Check to make sure they always have a UUID. | |
if (empty($args[0])) { | |
return services_error(t('Must provide a uuid.'), 404); | |
} | |
- | |
// The create submission access check. | |
if ($op == 'create') { | |
- | |
// Get the webform provided the UUID. | |
if (is_array($args[0]) || is_object($args[0])) { | |
$webform = (object)$args[0]; | |
@@ -54,6 +51,7 @@ function webform_service_submission_access($op = 'view', $args = array()) { | |
// If they can access the node view, then they can create a submission. | |
$webform = webform_node_view($webform, 'node'); | |
+ | |
return empty($webform['#enabled']); | |
} | |
else { | |
@@ -280,7 +278,7 @@ function webform_service_get_submission($webform, $submission) { | |
'form_key' => $component['form_key'], | |
'cid' => $component['cid'], | |
'type' => $component['type'], | |
- 'values' => $submission->data[$component['cid']] | |
+ 'values' => isset($submission->data[$component['cid']]) ? $submission->data[$component['cid']] : NULL, | |
); | |
} | |
-- | |
2.21.0 (Apple Git-122) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment