diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index b1f8de68a..4d316fbbc 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -1544,9 +1544,6 @@ private function storeAnswersForQuestion(Form $form, $submissionId, array $quest $answerEntity->setText($answerText); $this->answerMapper->insert($answerEntity); - if ($uploadedFile) { - $this->uploadedFileMapper->delete($uploadedFile); - } } else { $answerText = $answer; // Not a multiple-question, answerText is given answer @@ -1565,6 +1562,10 @@ private function storeAnswersForQuestion(Form $form, $submissionId, array $quest $this->answerMapper->insert($answerEntity); } } + + if ($uploadedFile) { + $this->uploadedFileMapper->delete($uploadedFile); + } } if (in_array($question['type'], Constants::ANSWER_TYPES_PREDEFINED)) { diff --git a/lib/Db/Form.php b/lib/Db/Form.php index 0fd95b5e7..31daad7c8 100644 --- a/lib/Db/Form.php +++ b/lib/Db/Form.php @@ -72,7 +72,7 @@ public function __construct() { $this->addType('expires', 'integer'); $this->addType('isAnonymous', 'boolean'); $this->addType('submitMultiple', 'boolean'); - $this->addType('allowEdit', 'bool'); + $this->addType('allowEdit', 'boolean'); $this->addType('showExpiration', 'boolean'); $this->addType('lastUpdated', 'integer'); $this->addType('state', 'integer'); diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index 8449de96d..55382fc1d 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -228,9 +228,7 @@ public function getForm(Form $form): array { $result['submissionId'] = $submissionEntity->getId(); } } catch (DoesNotExistException $e) { - // do nothing - } catch (MultipleObjectsReturnedException $e) { - // do nothing + //handle silently } }