Commit 3ec7f61d authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #17191 TIME 1 Display delegate user in notes list

parent 97f4c26f
......@@ -260,6 +260,7 @@ CREATE TABLE workflows
note text DEFAULT NULL,
process_date timestamp without time zone DEFAULT NULL,
digital_signature_id text,
delegate INTEGER,
CONSTRAINT workflow_pkey PRIMARY KEY (id)
)
WITH (OIDS=FALSE);
......
......@@ -176,7 +176,7 @@ class DocumentController
}
}
$workflow = WorkflowModel::getByDocumentId(['select' => ['id', 'user_id', 'mode', 'process_date', 'signature_mode', 'status', 'note', 'signature_positions', 'date_positions'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]);
$workflow = WorkflowModel::getByDocumentId(['select' => ['id', 'user_id', 'mode', 'process_date', 'signature_mode', 'status', 'note', 'signature_positions', 'date_positions', 'delegate'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]);
$currentFound = false;
$currentId = null;
foreach ($workflow as $value) {
......@@ -197,6 +197,12 @@ class DocumentController
unset($workflowExternalInformations['informations']['yousignFileId'], $workflowExternalInformations['informations']['yousignProcedureId']);
}
$noteCreator = null;
if (!empty($value['note'])) {
$noteCreatorId = !empty($value['delegate']) ? $value['delegate'] : $value['user_id'];
$noteCreator = UserModel::getLabelledUserById(['id' => $noteCreatorId]);
}
$formattedDocument['workflow'][] = [
'userId' => $value['user_id'],
'userDisplay' => $userLabel,
......@@ -208,6 +214,7 @@ class DocumentController
'datePositions' => json_decode($value['date_positions'], true),
'userSignatureModes' => !empty($userSignaturesModes['signature_modes']) ? json_decode($userSignaturesModes['signature_modes'], true) : [],
'note' => $value['note'],
'noteCreator' => $noteCreator,
'status' => $value['status'],
'externalInformations' => $workflowExternalInformations
];
......@@ -1069,6 +1076,10 @@ class DocumentController
$set = ['process_date' => 'CURRENT_TIMESTAMP', 'status' => $args['status']];
if (!empty($args['note'])) {
$set['note'] = $args['note'];
$currentWorkflow = WorkflowModel::getCurrentStep(['select' => ['user_id'], 'documentId' => $args['id']]);
if ($currentWorkflow['user_id'] != $GLOBALS['id']) {
$set['delegate'] = $GLOBALS['id'];
}
}
WorkflowModel::update([
'set' => $set,
......
......@@ -74,7 +74,7 @@
<ng-container *ngFor="let step of mainDocument.workflow">
<div *ngIf="step.note">
<div class="note-creator">
{{step.userDisplay}} ({{step.processDate}}) :
{{step.noteCreator}} ({{step.processDate}}) :
</div>
<div class="note-content">
{{step.note}}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment