Skip to content

Commit

Permalink
Remove died code
Browse files Browse the repository at this point in the history
The profileElementId was replaced by profileFileId and we havent more
references to profileElementId

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed Mar 27, 2024
1 parent 0745a7d commit ca86282
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 4 additions & 6 deletions lib/Helper/ValidateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions lib/Service/SignFileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca86282

Please sign in to comment.