Commit 0a7f2231 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

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

parent 3fb6d7fa
......@@ -262,6 +262,8 @@ export class IndexingFormComponent implements OnInit {
mustFixErrors: boolean = false;
isPrivate: boolean = false;
constructor(
public translate: TranslateService,
public http: HttpClient,
......@@ -813,12 +815,11 @@ export class IndexingFormComponent implements OnInit {
}
if (elem.type === 'date') {
if (!this.functions.empty(fieldValue) || elem.default_value !== null) {
fieldValue = elem.default_value !== null ? elem.default_value : fieldValue;
fieldValue = new Date(fieldValue);
} else {
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)) {
......@@ -899,6 +900,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