Commit e8cb0e90 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request maarch/MaarchParapheur!71
parents 2e3ff333 19c04673
......@@ -521,7 +521,7 @@
"messageSaved": "Message enregistré",
"manage_customizationAdmin": "Personnaliser la page de connexion",
"internalUserOtpMsg": "Les autres modes de signatures ne seront plus disponibles pour <b>{{user}}</b> après validation.",
"externalUser": "Role externe",
"externalUser": "Mode externe",
"external": "Externe",
"otpSignaturePositionMandatory": "La position de signature pour les utilisateurs externes est obligatoire."
}
......
......@@ -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
];
......@@ -365,7 +372,7 @@ class DocumentController
if ($hasElectronicSignature && $workflow['signatureMode'] == 'stamp' && $workflow['mode'] == 'sign') {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signatureMode cannot be stamp after an electronic signature", 'lang' => 'stampInTheMiddleImpossible']);
}
if ($workflow['externalInformations']['role'] == 'sign_yousign' && empty($workflow['signaturePositions'])) {
if ($workflow['externalInformations']['role'] == 'otp_sign_yousign' && empty($workflow['signaturePositions'])) {
return $response->withStatus(400)->withJson(['errors' => "Body workflow[{$key}] signaturePositions must be set for sign_yousign role"]);
}
if (!empty($workflow['signaturePositions'])) {
......@@ -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,
......
......@@ -39,15 +39,16 @@ class ExternalSignatoryBookController
public function getById(Request $request, Response $response, array $args)
{
if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_otp_connectors'])) {
return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']);
}
if (!Validator::intVal()->notEmpty()->validate($args['id'])) {
return $response->withStatus(400)->withJson(['errors' => 'Route id must be an integer']);
}
$connector = ExternalSignatoryBookModel::getById(['id' => $args['id']]);
$select = [];
if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_otp_connectors'])) {
$select = ['otp_code'];
}
$connector = ExternalSignatoryBookModel::getById(['select' => $select, 'id' => $args['id']]);
if (empty($connector)) {
return $response->withStatus(400)->withJson(['errors' => 'Connector not found']);
}
......@@ -55,13 +56,15 @@ class ExternalSignatoryBookController
$connector['securityModes'] = json_decode($connector['otp_code'], true);
unset($connector['otp_code']);
$connector['message'] = json_decode($connector['message_content'], true);
unset($connector['message_content']);
$connectionData = json_decode($connector['connection_data'], true);
$connector['apiUri'] = $connectionData['apiUri'];
$connector['apiKey'] = $connectionData['apiKey'];
unset($connector['connection_data']);
if (PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_otp_connectors'])) {
$connector['message'] = json_decode($connector['message_content'], true);
unset($connector['message_content']);
$connectionData = json_decode($connector['connection_data'], true);
$connector['apiUri'] = $connectionData['apiUri'];
$connector['apiKey'] = $connectionData['apiKey'];
unset($connector['connection_data']);
}
return $response->withJson(['otp' => $connector]);
}
......
......@@ -34,7 +34,7 @@
</ion-segment-button>
</ion-segment>
<ion-buttons slot="end" *ngIf="!detailMode">
<ion-button color="primary" (click)="openAction($event)">
<ion-button color="primary" (click)="openAction($event)" [disabled]="!canShowActions()">
<ion-icon slot="icon-only" name="settings-sharp"></ion-icon>
</ion-button>
</ion-buttons>
......@@ -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}}
......@@ -87,7 +87,7 @@
<drag-scroll style="overflow:auto;height: 100%;width: 100%;margin: auto;"
[drag-scroll-disabled]="(signaturesService.dragging || signaturesService.resizing) && signaturesService.mobileMode"
[drag-disabled]="(signaturesService.dragging || signaturesService.resizing) && !signaturesService.mobileMode"
[style.maxWidth.px]="signaturesService.workingAreaWidth" #nav (click)="currentDoc == 0 && !detailMode ? openAction($event) : false">
[style.maxWidth.px]="signaturesService.workingAreaWidth" #nav (click)="canShowActions() ? openAction($event) : false">
<div style="position:relative;cursor: grab;" [style.width.px]="signaturesService.workingAreaWidth"
[style.height.px]="signaturesService.workingAreaHeight" id="myBounds" #myBounds>
<app-document-note-list *ngIf="currentDoc == 0 && !loadingImage">
......
......@@ -200,14 +200,14 @@ export class DocumentComponent implements OnInit {
this.openSignatures();
}
});
buttons.push({
text: this.translate.instant('lang.annotateDocument'),
icon: 'receipt-outline',
handler: () => {
this.openNoteEditor();
}
});
}
buttons.push({
text: this.translate.instant('lang.annotateDocument'),
icon: 'receipt-outline',
handler: () => {
this.openNoteEditor();
}
});
/* if (this.originalSize) {
buttons.push({
text: 'Zoom taille écran',
......@@ -804,4 +804,8 @@ export class DocumentComponent implements OnInit {
}
return res.buffer;
}
canShowActions() {
return this.currentDoc == 0 && !this.detailMode && !this.signaturesService.stampLock;
}
}
......@@ -92,7 +92,7 @@
</p>
<p *ngIf="diffusion.processDate !== null" [title]="diffusion.processDate">
<ion-note *ngIf="diffusion.status === 'VAL'" class="valProcess">
{{'lang.'+diffusion.mode+'ProcessInfo' | translate}}
{{'lang.' + getProcessInfo(diffusion.mode) + 'ProcessInfo' | translate}}
{{diffusion.processDate}}
</ion-note>
<ion-note *ngIf="diffusion.status === 'REF'" class="refProcess">
......
......@@ -373,4 +373,16 @@ export class VisaWorkflowComponent implements OnInit {
this.openOtpModal(item, position, item.userId);
}
}
getProcessInfo(mode: string) {
const isOtpSign = /otp_sign_/g;
const isOtpvisa = /otp_visa_/g;
if (mode.match(isOtpSign) !== null) {
return 'sign';
} else if (mode.match(isOtpvisa) !== null) {
return 'visa';
} else {
return mode;
}
}
}
......@@ -118,12 +118,12 @@ export class SignaturePositionComponent implements OnInit {
sequence: this.currentUser,
page: this.currentPage,
position: {
positionX: 0,
positionY: 0
positionX: 80,
positionY: 100
}
}
);
document.getElementsByClassName('drag-scroll-content')[0].scrollTop = 0;
document.getElementsByClassName('drag-scroll-content')[0].scrollTop = this.workingAreaHeight;
}
getUserSignPosPage(workflowIndex: number) {
......
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