Skip to content

Commit

Permalink
Merge pull request #2606 from LibreSign/backport/2605/stable28
Browse files Browse the repository at this point in the history
[stable28] Remove died code
  • Loading branch information
vitormattos authored Mar 27, 2024
2 parents 8da7ece + 5d46b0f commit 3ffe45c
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 3ffe45c

Please sign in to comment.