Skip to content
Snippets Groups Projects
Verified Commit 25e42234 authored by Damien's avatar Damien
Browse files

FEAT #15116 TIME 2:20 Save date positions

parent 4546fa40
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,8 @@ ALTER TABLE users ADD COLUMN x509_fingerprint text;
ALTER TABLE workflows DROP COLUMN IF EXISTS signature_positions;
ALTER TABLE workflows ADD COLUMN signature_positions jsonb DEFAULT '[]';
ALTER TABLE workflows DROP COLUMN IF EXISTS date_positions;
ALTER TABLE workflows ADD COLUMN date_positions jsonb DEFAULT '[]';
ALTER TABLE workflows DROP COLUMN IF EXISTS digital_signature_id;
ALTER TABLE workflows ADD COLUMN digital_signature_id text;
......@@ -71,4 +73,4 @@ DO $$ BEGIN
INSERT INTO docservers (type, label, is_readonly, size_limit_number, actual_size_number, path)
VALUES ('ESIGN', 'Document avec signatures électronique', 'N', 50000000000, 0, '/opt/maarchparapheur/docservers/esigned_documents/');
END IF;
END$$;
\ No newline at end of file
END$$;
......@@ -239,6 +239,7 @@ CREATE TABLE workflows
mode CHARACTER VARYING(16) NOT NULL,
signature_mode CHARACTER VARYING(64) NOT NULL,
signature_positions jsonb DEFAULT '[]',
date_positions jsonb DEFAULT '[]',
"order" INTEGER NOT NULL,
status CHARACTER VARYING(16) DEFAULT NULL,
note text DEFAULT NULL,
......
......@@ -171,7 +171,7 @@ class DocumentController
}
}
$workflow = WorkflowModel::getByDocumentId(['select' => ['user_id', 'mode', 'process_date', 'signature_mode', 'status', 'note', 'signature_positions'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]);
$workflow = WorkflowModel::getByDocumentId(['select' => ['user_id', 'mode', 'process_date', 'signature_mode', 'status', 'note', 'signature_positions', 'date_positions'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]);
$currentFound = false;
foreach ($workflow as $value) {
if (!empty($value['process_date'])) {
......@@ -188,6 +188,7 @@ class DocumentController
'current' => !$currentFound && empty($value['status']),
'signatureMode' => $value['signature_mode'],
'signaturePositions' => json_decode($value['signature_positions'], true),
'datePositions' => json_decode($value['date_positions'], true),
'userSignatureModes' => json_decode($userSignaturesModes['signature_modes'], true),
'note' => $value['note']
];
......@@ -323,6 +324,18 @@ class DocumentController
}
}
}
if (!empty($workflow['datePositions'])) {
if (!Validator::arrayType()->validate($workflow['datePositions'])) {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] datePositions is not an array"]);
}
foreach ($workflow['datePositions'] as $keyDP => $datePosition) {
if (empty($datePosition['positionX']) || empty($datePosition['positionY']) || empty($datePosition['page'])) {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}][datePositions][{$keyDP}] is wrong formatted"]);
} elseif (empty($datePosition['color']) || empty($datePosition['font']) || empty($datePosition['format']) || empty($datePosition['size'])) {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}][datePositions][{$keyDP}] is wrong formatted"]);
}
}
}
if ($workflow['signatureMode'] == 'eidas') {
$hasEidas = true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment