Skip to content
Snippets Groups Projects
Commit 6c7bce23 authored by Jean-Laurent DUZANT's avatar Jean-Laurent DUZANT
Browse files

FIX #21555 TIME 0 fix conflicts : Merge branch '21.03' into 'feat/21555/21.03'

# Conflicts:
#   src/frontend/app/indexation/indexing-form/indexing-form.component.ts
parents 18c5bb98 57652f9b
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,10 @@
-- --
-- *************************************************************************--
UPDATE indexing_models_fields SET default_value = NULL WHERE identifier = 'processLimitDate' AND enabled = true;
DROP TABLE IF EXISTS blacklist;
CREATE TABLE blacklist
(
......
......@@ -43,7 +43,7 @@
<span *ngIf="field.mandatory">{{'lang.optionalField' | translate}}</span>
</button>
<mat-divider *ngIf="!field.system"></mat-divider>
<button mat-menu-item *ngIf="!field.enabled" (click)="enableField(field, true)">
<button mat-menu-item *ngIf="!field.enabled && field.identifier != 'processLimitDate'" (click)="enableField(field, true)">
<span>{{'lang.enableField' | translate}}</span>
</button>
<button mat-menu-item *ngIf="field.enabled" (click)="enableField(field, false)">
......@@ -113,7 +113,7 @@
<mat-icon color="primary" class="fas fa-database">
</mat-icon>
</button>
<button mat-button color="primary" *ngIf="adminMode && !field.SQLMode" matPrefix
<button mat-button color="primary" *ngIf="adminMode && !field.SQLMode && !arrFormControl[field.identifier].disabled" matPrefix
mat-icon-button (click)="$event.stopPropagation();toggleTodayDate(field);"
[matTooltip]="'lang.todayDate' | translate"
style="position: absolute;left: -40px;">
......
......@@ -130,7 +130,7 @@ export class IndexingFormComponent implements OnInit {
type: 'date',
default_value: null,
values: [],
enabled: true,
enabled: false,
},
{
identifier: 'tags',
......@@ -388,7 +388,9 @@ export class IndexingFormComponent implements OnInit {
filter((data: string) => data === 'ok'),
tap(() => {
item.mandatory = false;
item.enabled = true;
if (item.identifier !== 'processLimitDate') {
item.enabled = true;
}
if (item.identifier.indexOf('indexingCustomField') > -1) {
this.availableCustomFields.push(item);
this[arrTarget].splice(index, 1);
......@@ -1037,7 +1039,15 @@ export class IndexingFormComponent implements OnInit {
this.indexingModelClone = JSON.parse(JSON.stringify(data.indexingModel));
}
await this.initElemForm(saveResourceState);
await this.initElemForm(saveResourceState).then(() => {
if (!this.adminMode && !this.functions.empty(this.arrFormControl['processLimitDate'])) {
this.arrFormControl['processLimitDate'].enable();
this.indexingModelClone.fields.find((field: any) => field.identifier === 'processLimitDate').enabled = true;
} else if (this.adminMode && !this.functions.empty(this.arrFormControl['processLimitDate'])) {
this.arrFormControl['processLimitDate'].disable();
this.indexingModelClone.fields.find((field: any) => field.identifier === 'processLimitDate').enabled = false;
}
});
this.createForm();
}),
......@@ -1075,7 +1085,7 @@ export class IndexingFormComponent implements OnInit {
const valArr: ValidatorFn[] = [];
const disabledState = !field.enabled || this.isAlwaysDisabledField(field);
if (!disabledState) {
if (!disabledState && field.identifier !== 'processLimitDate') {
field.enabled = true;
}
......@@ -1234,7 +1244,7 @@ export class IndexingFormComponent implements OnInit {
if (this.functions.empty(this.arrFormControl['priority']?.value)) {
delete objToSend.priority;
}
if (this.arrFormControl['processLimitDate'] !== undefined) {
if (!this.adminMode && this.arrFormControl['processLimitDate'] !== undefined) {
this.http.get('../rest/indexing/processLimitDate', { params: objToSend }).pipe(
tap((data: any) => {
limitDate = data.processLimitDate !== null ? new Date(data.processLimitDate) : '';
......@@ -1243,7 +1253,9 @@ export class IndexingFormComponent implements OnInit {
filter((data) => this.arrFormControl['priority'] !== undefined && data.processLimitDate !== null),
exhaustMap(() => this.http.get('../rest/indexing/priority', { params: { 'processLimitDate': limitDate.toDateString() } })),
tap((data: any) => {
this.arrFormControl['priority'].setValue(data.priority);
if (!this.functions.empty(this.arrFormControl['priority'])) {
this.arrFormControl['priority'].setValue(data.priority);
}
this.setPriorityColor(null, data.priority);
}),
catchError((err: any) => {
......@@ -1255,6 +1267,10 @@ export class IndexingFormComponent implements OnInit {
}
calcLimitDateByPriority(field: any, value: any) {
if (this.functions.empty(value) && this.functions.empty(this.arrFormControl['processLimitDate'])) {
this.arrFormControl['processLimitDate'].setValue(null);
return;
}
let limitDate: any = null;
const objToSend: any = {
priority: value,
......@@ -1265,7 +1281,7 @@ export class IndexingFormComponent implements OnInit {
} else if (this.functions.empty(objToSend.priority) && !this.functions.empty(this.arrFormControl['doctype']?.value)) {
delete objToSend.priority;
}
if (this.arrFormControl['processLimitDate'] !== undefined) {
if (!this.adminMode && this.arrFormControl['processLimitDate'] !== undefined) {
this.http.get('../rest/indexing/processLimitDate', { params: objToSend }).pipe(
tap((data: any) => {
limitDate = data.processLimitDate !== null ? new Date(data.processLimitDate) : '';
......
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