Skip to content

Commit 3ffe45c

Browse files
authored
Merge pull request #2606 from LibreSign/backport/2605/stable28
[stable28] Remove died code
2 parents 8da7ece + 5d46b0f commit 3ffe45c

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

lib/Helper/ValidateHelper.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,15 @@ public function validateVisibleElementsRelation(array $list, SignRequest $signRe
295295
if (!array_key_exists('documentElementId', $elements)) {
296296
throw new LibresignException($this->l10n->t('Field %s not found', ['documentElementId']));
297297
}
298-
if (!array_key_exists('profileElementId', $elements)
299-
&& !array_key_exists('profileFileId', $elements)
300-
) {
301-
throw new LibresignException($this->l10n->t('Field %s not found', ['profileElementId, profileFileId']));
298+
if (!array_key_exists('profileFileId', $elements)) {
299+
throw new LibresignException($this->l10n->t('Field %s not found', ['profileFileId']));
302300
}
303301
$this->validateSignerIsOwnerOfPdfVisibleElement($elements['documentElementId'], $signRequest);
304302
if ($user instanceof IUser) {
305303
try {
306-
$this->userElementMapper->findOne(['id' => $elements['profileElementId'], 'user_id' => $user->getUID()]);
304+
$this->userElementMapper->findOne(['file_id' => $elements['profileFileId'], 'user_id' => $user->getUID()]);
307305
} catch (\Throwable $th) {
308-
throw new LibresignException($this->l10n->t('Field %s does not belong to user', $elements['profileElementId']));
306+
throw new LibresignException($this->l10n->t('Field %s does not belong to user', $elements['profileFileId']));
309307
}
310308
}
311309
}

lib/Service/SignFileService.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,7 @@ public function setVisibleElements(array $list): self {
232232
});
233233
if ($element) {
234234
$c = current($element);
235-
if (!empty($c['profileElementId'])) {
236-
$userElement = $this->userElementMapper->findOne(['id' => $c['profileElementId']]);
237-
$nodeId = $userElement->getFileId();
238-
} elseif (!empty($c['profileFileId'])) {
235+
if (!empty($c['profileFileId'])) {
239236
$nodeId = $c['profileFileId'];
240237
} else {
241238
throw new LibresignException($this->l10n->t('Invalid data to sign file'), 1);

0 commit comments

Comments
 (0)