Commit e90dce27 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18721 TIME 0:20 indexing model changed : set values if field is empty

parent d2141d0e
......@@ -15,3 +15,4 @@ modules/content_management/dist/lib/httpclient-cache-4.5.2.jar
modules/content_management/dist/lib/httpclient-win-4.5.2.jar
modules/content_management/dist/lib/httpcore-4.4.4.jar
modules/content_management/dist/lib/plugin.jar
node_modules/
......@@ -259,6 +259,8 @@ export class IndexingFormComponent implements OnInit {
dialogRef: MatDialogRef<any>;
isPrivate: boolean = false;
constructor(
public translate: TranslateService,
public http: HttpClient,
......@@ -816,8 +818,13 @@ export class IndexingFormComponent implements OnInit {
await this.getCurrentInitiator(elem, fieldValue);
}
if (elem.type === 'date' && !this.functions.empty(fieldValue)) {
fieldValue = new Date(fieldValue);
if (elem.type === 'date') {
if (!this.isPrivate && this.functions.empty(fieldValue)) {
elem.default_value = null;
this.arrFormControl[elem.identifier].value = null;
} else if (!this.functions.empty(fieldValue)) {
fieldValue = new Date(fieldValue);
}
}
if (!this.functions.empty(fieldValue)) {
this.arrFormControl[elem.identifier].setValue(fieldValue);
......@@ -897,6 +904,7 @@ export class IndexingFormComponent implements OnInit {
this.http.get(`../rest/indexingModels/${indexModelId}`).pipe(
tap(async (data: any) => {
this.isPrivate = data.indexingModel.private || data.indexingModel.master !== null;
this.indexingFormId = data.indexingModel.master !== null ? data.indexingModel.master : data.indexingModel.id;
this.currentCategory = data.indexingModel.category;
this.mandatoryFile = data.indexingModel.mandatoryFile;
......
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