mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-18 05:20:45 +01:00
fix: respect status 0 (DRAFT) when adding new signers
When adding a new signer with status 0, the backend was ignoring it because empty() treated 0 as falsy. Changed to isset() to properly handle status 0. Also updated determineInitialStatus() to allow new signers to be added in DRAFT mode even when the file is not in DRAFT status, allowing gradual signer addition before requesting signatures. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
parent
23f6bd730b
commit
6bd828e9ed
1 changed files with 3 additions and 1 deletions
|
|
@ -53,7 +53,7 @@ class RequestSignatureService {
|
|||
public function save(array $data): FileEntity {
|
||||
$file = $this->saveFile($data);
|
||||
$this->saveVisibleElements($data, $file);
|
||||
if (empty($data['status'])) {
|
||||
if (!isset($data['status'])) {
|
||||
$data['status'] = $file->getStatus();
|
||||
}
|
||||
$this->associateToSigners($data, $file->getId());
|
||||
|
|
@ -289,6 +289,8 @@ class RequestSignatureService {
|
|||
}
|
||||
|
||||
private function determineInitialStatus(int $signingOrder, ?int $fileStatus = null): \OCA\Libresign\Enum\SignRequestStatus {
|
||||
// If fileStatus is explicitly DRAFT (0), keep signer as DRAFT
|
||||
// This allows adding new signers in DRAFT mode even when file is not in DRAFT status
|
||||
if ($fileStatus === FileEntity::STATUS_DRAFT) {
|
||||
return \OCA\Libresign\Enum\SignRequestStatus::DRAFT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue