Commit 26aba070 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #17108 TIME 5:10 include action name in process comment when interrupt visa workflow

parent 576cae4c
......@@ -710,7 +710,7 @@ class ActionMethodController
if (!empty($listInstances[0])) {
$listInstances = $listInstances[0];
$set = ['process_date' => 'CURRENT_TIMESTAMP', 'process_comment' => _HAS_INTERRUPTED_WORKFLOW];
$set = ['process_date' => 'CURRENT_TIMESTAMP', 'process_comment' => _HAS_INTERRUPTED_WORKFLOW . ' (' . _VIA_ACTION . ' ' . $args['action']['label_action'] . ')'];
if ($listInstances['item_id'] != $GLOBALS['id']) {
$set['delegate'] = $GLOBALS['id'];
}
......@@ -731,7 +731,7 @@ class ActionMethodController
ListInstanceModel::update([
'set' => [
'process_date' => 'CURRENT_TIMESTAMP',
'process_comment' => _INTERRUPTED_WORKFLOW
'process_comment' => _INTERRUPTED_WORKFLOW . ' (' . _VIA_ACTION . ' ' . $args['action']['label_action'] . ')'
],
'where' => ['res_id = ?', 'difflist_type = ?', 'process_date is null'],
'data' => [$args['resId'], 'VISA_CIRCUIT']
......
......@@ -437,7 +437,7 @@ class ResourceListController
return $response->withStatus(400)->withJson(['errors' => 'Action is not linked to this group basket']);
}
$action = ActionModel::getById(['id' => $aArgs['actionId'], 'select' => ['component', 'parameters']]);
$action = ActionModel::getById(['id' => $aArgs['actionId'], 'select' => ['component', 'parameters', 'label_action']]);
if (empty($action['component'])) {
return $response->withStatus(400)->withJson(['errors' => 'Action component does not exist']);
}
......
......@@ -479,3 +479,5 @@ define('_FULLTEXT', "Fulltext");
define('_CREATION_DATE', "Creation date");
define('_SUCCESS', "Success");
define('_ERROR', "Error");
define('_VIA_ACTION', "via action");
......@@ -486,3 +486,5 @@ define('_FULLTEXT', "Plein texte");
define('_CREATION_DATE', "Date de création");
define('_SUCCESS', "Réussi");
define('_ERROR', "Erreur");
define('_VIA_ACTION', "via l'action");
......@@ -53,8 +53,8 @@
<mat-list-item disableRipple *ngFor="let diffusion of visaWorkflow.items;let i=index" cdkDrag
class="columns workflow" [cdkDragDisabled]="!canManageUser(diffusion, i)"
[class.notDraggable]="!canManageUser(diffusion, i)" [class.notEditable]="!adminMode"
[class.processed]="diffusion.process_date != null && ['lang.visaWorkflowInterrupted' | translate, 'lang.hasInterruptedWorkflow' | translate].indexOf(diffusion.process_comment) === -1"
[class.interrupt]="diffusion.process_date != null && ['lang.visaWorkflowInterrupted' | translate, 'lang.hasInterruptedWorkflow' | translate].indexOf(diffusion.process_comment) > -1">
[class.processed]="diffusion.process_date != null && (!stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate) && !stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate))"
[class.interrupt]="diffusion.process_date != null && (stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate) || stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate))">
<mat-icon *ngIf="getCurrentVisaUserIndex() === i && (!adminMode || target === 'signatureBook' || target === 'action')"
class="fa fa-chevron-right fa-2x" mat-list-icon color="accent">
</mat-icon>
......@@ -73,11 +73,11 @@
<mat-icon mat-list-icon class="fa-2x fa"
[title]="diffusion.process_comment !== null ? diffusion.process_comment : ''"
[class.fa-hourglass]="diffusion.process_date == null"
[class.fa-thumbs-up]="diffusion.process_date != null && ['lang.visaWorkflowInterrupted' | translate, 'lang.hasInterruptedWorkflow' | translate].indexOf(diffusion.process_comment) === -1"
[class.fa-hand-paper]="diffusion.process_date != null && diffusion.process_comment === ('lang.hasInterruptedWorkflow' | translate)"
[class.fa-times]="diffusion.process_date != null && diffusion.process_comment === ('lang.visaWorkflowInterrupted' | translate)"
[class.valid]="diffusion.process_date != null && ['lang.visaWorkflowInterrupted' | translate, 'lang.hasInterruptedWorkflow' | translate].indexOf(diffusion.process_comment) === -1"
[class.invalid]="diffusion.process_date != null && ['lang.visaWorkflowInterrupted' | translate, 'lang.hasInterruptedWorkflow' | translate].indexOf(diffusion.process_comment) > -1"
[class.fa-thumbs-up]="diffusion.process_date != null && !stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate) && !stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate)"
[class.fa-hand-paper]="diffusion.process_date != null && stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate)"
[class.fa-times]="diffusion.process_date != null && stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate)"
[class.valid]="diffusion.process_date != null && !stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate) && !stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate)"
[class.invalid]="diffusion.process_date != null && (stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate) || stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate))"
style="opacity:0.5;"></mat-icon>
</ng-container>
<div mat-line class="workflowLine">
......@@ -102,11 +102,11 @@
[placeholder]="'lang.visaNote' | translate" [(ngModel)]="diffusion.process_comment">
</mat-form-field>
</div>
<div *ngIf="diffusion.requested_signature && diffusion.process_date != null && ['lang.visaWorkflowInterrupted' | translate, 'lang.hasInterruptedWorkflow' | translate].indexOf(diffusion.process_comment) === -1"
<div *ngIf="diffusion.process_date != null && !stringIncludes(diffusion.process_comment, 'lang.visaWorkflowInterrupted' | translate) && !stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate)"
class="workflowLineProcessDate" title='{{diffusion.process_date | fullDate}}' color="accent">
{{((functions.empty(diffusion.process_date) && diffusion.requested_signature) || diffusion.signatory) ? ('lang.signedUserDate' | translate) : ('lang.approvedUserDate' | translate)}} {{diffusion.process_date
| timeAgo : 'full'}}</div>
<div *ngIf="diffusion.process_date != null && ['A terminé le circuit'].indexOf(diffusion.process_comment) > -1"
<div *ngIf="diffusion.process_date != null && stringIncludes(diffusion.process_comment, 'lang.hasInterruptedWorkflow' | translate)"
class="workflowLineProcessDate" title='{{diffusion.process_date | fullDate}}' color="warn">
{{'lang.interrupted' | translate}} {{diffusion.process_date | timeAgo : 'full'}}</div>
</div>
......
......@@ -553,7 +553,7 @@ export class VisaWorkflowComponent implements OnInit {
if (this.functions.empty(item.process_date)) {
return item.requested_signature ? 'sign' : 'visa';
} else {
if (['A terminé le circuit'].indexOf(item.process_comment) > -1 || ['Circuit interrompu'].indexOf(item.process_comment) > -1) {
if (this.stringIncludes(item.process_comment, this.translate.instant('lang.hasInterruptedWorkflow')) || this.stringIncludes(item.process_comment, this.translate.instant('lang.visaWorkflowInterrupted'))) {
return item.requested_signature ? 'sign' : 'visa';
} else {
return item.signatory ? 'sign' : 'visa';
......@@ -561,6 +561,14 @@ export class VisaWorkflowComponent implements OnInit {
}
}
stringIncludes(source, search) {
if (source === undefined || source === null) {
return false;
}
return source.includes(search);
}
private _filter(value: string): string[] {
if (typeof value === 'string') {
const filterValue = this.latinisePipe.transform(value.toLowerCase());
......
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