From b74e1de57ca6566ae26a2a11397c041a877fa88b Mon Sep 17 00:00:00 2001 From: Jean-Laurent <jean-laurent.duzant@xelians.fr> Date: Tue, 16 Aug 2022 16:25:59 +0200 Subject: [PATCH] FEAT #21724 TIME 0:10 accept delay -1, can disable DLT in admin --- src/app/resource/controllers/IndexingController.php | 5 ++++- .../doctype/doctypes-administration.component.html | 13 ++++++++++--- .../doctype/doctypes-administration.component.ts | 13 ++++++++++++- .../indexing-form/indexing-form.component.ts | 7 ++++--- src/lang/lang-en.json | 5 ++++- src/lang/lang-fr.json | 5 ++++- 6 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/app/resource/controllers/IndexingController.php b/src/app/resource/controllers/IndexingController.php index 3efca6752cb..808ff1eff46 100755 --- a/src/app/resource/controllers/IndexingController.php +++ b/src/app/resource/controllers/IndexingController.php @@ -245,7 +245,7 @@ class IndexingController $queryParams = $request->getQueryParams(); // if delay is 0, then the process limit date is today - $delay = 0; + $delay = -1; if (!empty($queryParams['doctype'])) { $doctype = DoctypeModel::getById(['id' => $queryParams['doctype'], 'select' => ['process_delay']]); if (empty($doctype)) { @@ -269,6 +269,9 @@ class IndexingController $delay = 0; } } + if ($delay == -1) { + return $response->withJson(['processLimitDate' => null]); + } if (!Validator::intVal()->validate($delay)) { return $response->withStatus(400)->withJson(['errors' => 'Delay is not a numeric value']); } diff --git a/src/frontend/app/administration/doctype/doctypes-administration.component.html b/src/frontend/app/administration/doctype/doctypes-administration.component.html index cde5ed8df2d..6d70da1ef99 100755 --- a/src/frontend/app/administration/doctype/doctypes-administration.component.html +++ b/src/frontend/app/administration/doctype/doctypes-administration.component.html @@ -196,13 +196,20 @@ </div> </div> <div class="form-group"> - <div class="col-sm-12"> + <div class="col-sm-10"> <mat-form-field> - <input matInput [(ngModel)]="currentType.process_delay" required + <input matInput [(ngModel)]="currentType.process_delay" [disabled]="currentType.process_delay === -1" required name="process_delay" id="process_delay" title="{{'lang.processDelayDay' | translate}}" - type="number" placeholder="{{'lang.processDelayDay' | translate}}" pattern="^[0-9]*$"> + type="number" placeholder="{{'lang.processDelayDay' | translate}}" min="0" pattern="^[0-9]*$" (change)="currentType.process_delay === -1 ? hideProcessDelay = false : hideProcessDelay = true"> + <mat-hint align="start" *ngIf="currentType.process_delay === -1" style="color: red;">{{'lang.disableProcessDelayDesc' | translate}}</mat-hint> </mat-form-field> </div> + <diV class="col-sm-2"> + <mat-slide-toggle [(ngModel)]="hideProcessDelay" [ngModelOptions]="{standalone: true}" color="primary" + [title]="(currentType.process_delay !== -1 ? 'lang.processDelayEnabled' : 'lang.processDelayDisabled') | translate" (toggleChange)="toggleProcessDelay(hideProcessDelay)" + style="margin-top: 12px; margin-bottom: 12px;"> + </mat-slide-toggle> + </diV> </div> <div class="form-group"> <div class="col-sm-12"> diff --git a/src/frontend/app/administration/doctype/doctypes-administration.component.ts b/src/frontend/app/administration/doctype/doctypes-administration.component.ts index b8fc072e2e5..664da971567 100755 --- a/src/frontend/app/administration/doctype/doctypes-administration.component.ts +++ b/src/frontend/app/administration/doctype/doctypes-administration.component.ts @@ -28,7 +28,7 @@ export class DoctypesAdministrationComponent implements OnInit { config: any = {}; doctypes: any[] = []; - currentType: any = false; + currentType: any = null; currentSecondLevel: any = false; currentFirstLevel: any = false; firstLevels: any = false; @@ -50,6 +50,9 @@ export class DoctypesAdministrationComponent implements OnInit { displayedColumns = ['label', 'use', 'mandatory', 'column']; + hideProcessDelay: boolean = true; + currentTypeClone: any = null; + constructor( public translate: TranslateService, public http: HttpClient, @@ -188,6 +191,8 @@ export class DoctypesAdministrationComponent implements OnInit { this.currentType = dataValue['doctype']; this.secondLevels = dataValue['secondLevel']; this.processModes = ['NORMAL', 'SVA', 'SVR']; + this.currentTypeClone = JSON.parse(JSON.stringify(dataValue['doctype'])); + this.hideProcessDelay = this.currentType.process_delay === -1 ? false : true; this.getRules(); if (move) { @@ -461,6 +466,12 @@ export class DoctypesAdministrationComponent implements OnInit { $('#jstree').jstree(true).search(''); this.emptyField = true; } + + toggleProcessDelay(value: boolean) { + this.hideProcessDelay = !value; + const processDelay: number = this.currentTypeClone.process_delay !== -1 ? this.currentTypeClone.process_delay : 0; + this.currentType.process_delay = !this.hideProcessDelay ? -1 : processDelay; + } } @Component({ templateUrl: 'doctypes-administration-redirect-modal.component.html' diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts index 919d0a04cea..49db744e007 100755 --- a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts +++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts @@ -1281,9 +1281,8 @@ export class IndexingFormComponent implements OnInit { } launchEvent(value: any, field: any) { - if (field.event !== undefined && field.identifier === 'priority' && value === null && this.adminMode) { + if (field.event !== undefined && field.identifier === 'priority' && value === null) { this[field.event](field, value); - return; } else if (field.event !== undefined && value !== null && !this.adminMode) { this[field.event](field, value); } @@ -1330,8 +1329,10 @@ export class IndexingFormComponent implements OnInit { priority: value, doctype: this.arrFormControl['doctype']?.value }; - if (this.functions.empty(this.arrFormControl['doctype']?.value)) { + if (!this.functions.empty(objToSend.priority) && this.functions.empty(this.arrFormControl['doctype']?.value)) { delete objToSend.doctype; + } else if (this.functions.empty(objToSend.priority) && !this.functions.empty(this.arrFormControl['doctype']?.value)) { + delete objToSend.priority; } if (!this.adminMode && this.arrFormControl['processLimitDate'] !== undefined) { this.http.get('../rest/indexing/processLimitDate', { params: objToSend }).pipe( diff --git a/src/lang/lang-en.json b/src/lang/lang-en.json index 004932775e7..f539e825655 100644 --- a/src/lang/lang-en.json +++ b/src/lang/lang-en.json @@ -2649,5 +2649,8 @@ "allDoctypesDesc": "This option enabled automatically adds new types to the list below", "notifTargetDesc": "The <i>[res_letterbox.linktodetail], [res_letterbox.linktodoc]</i> and <i>[res_letterbox.linktoprocess]</i> merge variables require the <br> application URL to be filled in : <b>Administration -> Settings -> Personalization -> Application URL</b>", "separatorsEmail": "To separate email addresses, use \",\" or \";\"", - "cannotAccessPage": "Cannot access the page" + "cannotAccessPage": "Cannot access page", + "processDelayEnabled": "Process delay enabled", + "processDelayDisabled": "Process delay disabled", + "disableProcessDelayDesc": "This type of document is no longer taken into account for the calculation of the process limit date" } diff --git a/src/lang/lang-fr.json b/src/lang/lang-fr.json index 635d7179e91..3c0a98fd7ea 100644 --- a/src/lang/lang-fr.json +++ b/src/lang/lang-fr.json @@ -2648,5 +2648,8 @@ "allDoctypesDesc": "Cette option activée permet d'ajouter automatiquement les nouveaux types à la liste ci-dessous", "notifTargetDesc": "Les champs de fusion <i>[res_letterbox.linktodetail], [res_letterbox.linktodoc]</i> et <i>[res_letterbox.linktoprocess]</i> requièrent que l’URL de l’application <br> soit renseignée dans : <b>Administration -> Paramètres -> Personnalisation -> URL de l'application</b>", "separatorsEmail": "Pour séparer les adresses courriels, utiliser les \",\" ou \";\"", - "cannotAccessPage": "Impossible d'accéder à la page" + "cannotAccessPage": "Impossible d'accéder à la page", + "processDelayEnabled": "Délai de traitement activé", + "processDelayDisabled": "Délai de traitement désactivé", + "disableProcessDelayDesc": "Ce type de document n'est plus pris en compte pour le calcul de la date limite de traitement" } -- GitLab