From 5d46b0fcf84a9f44bc45c9ec68a880dda0b91510 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 27 Mar 2024 14:14:41 -0300 Subject: [PATCH] Remove died code The profileElementId was replaced by profileFileId and we havent more references to profileElementId Signed-off-by: Vitor Mattos --- lib/Helper/ValidateHelper.php | 10 ++++------ lib/Service/SignFileService.php | 5 +---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/Helper/ValidateHelper.php b/lib/Helper/ValidateHelper.php index 1d12a8a98a..1befe6d3e0 100644 --- a/lib/Helper/ValidateHelper.php +++ b/lib/Helper/ValidateHelper.php @@ -295,17 +295,15 @@ public function validateVisibleElementsRelation(array $list, SignRequest $signRe if (!array_key_exists('documentElementId', $elements)) { throw new LibresignException($this->l10n->t('Field %s not found', ['documentElementId'])); } - if (!array_key_exists('profileElementId', $elements) - && !array_key_exists('profileFileId', $elements) - ) { - throw new LibresignException($this->l10n->t('Field %s not found', ['profileElementId, profileFileId'])); + if (!array_key_exists('profileFileId', $elements)) { + throw new LibresignException($this->l10n->t('Field %s not found', ['profileFileId'])); } $this->validateSignerIsOwnerOfPdfVisibleElement($elements['documentElementId'], $signRequest); if ($user instanceof IUser) { try { - $this->userElementMapper->findOne(['id' => $elements['profileElementId'], 'user_id' => $user->getUID()]); + $this->userElementMapper->findOne(['file_id' => $elements['profileFileId'], 'user_id' => $user->getUID()]); } catch (\Throwable $th) { - throw new LibresignException($this->l10n->t('Field %s does not belong to user', $elements['profileElementId'])); + throw new LibresignException($this->l10n->t('Field %s does not belong to user', $elements['profileFileId'])); } } } diff --git a/lib/Service/SignFileService.php b/lib/Service/SignFileService.php index 534a3c06c9..41789ec21a 100644 --- a/lib/Service/SignFileService.php +++ b/lib/Service/SignFileService.php @@ -232,10 +232,7 @@ public function setVisibleElements(array $list): self { }); if ($element) { $c = current($element); - if (!empty($c['profileElementId'])) { - $userElement = $this->userElementMapper->findOne(['id' => $c['profileElementId']]); - $nodeId = $userElement->getFileId(); - } elseif (!empty($c['profileFileId'])) { + if (!empty($c['profileFileId'])) { $nodeId = $c['profileFileId']; } else { throw new LibresignException($this->l10n->t('Invalid data to sign file'), 1);