diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index f9b5992c883245f288413402aec75855cd064bdb..4bb476d01aa01d547fa2f2a65078ab380ad56e71 100755 --- a/core/xml/actions_pages.xml +++ b/core/xml/actions_pages.xml @@ -309,7 +309,7 @@ An action page is described in a ACTIONPAGE tag : <LABEL>_VALIDATE_RECOMMENDATION</LABEL> <NAME>validate_recommendation</NAME> <DESC>_VALIDATE_RECOMMENDATION_DESC</DESC> - <component>validateRecommendationAction</component> + <component>validateParallelOpinionDiffusionAction</component> <ORIGIN>module</ORIGIN> <MODULE>avis</MODULE> <FLAG_CREATE>false</FLAG_CREATE> diff --git a/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.ts b/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.ts index 978f9514b752f89eb77a9b634b728bde5e777670..e5163d39524eb02915c59983fce5aa8fdd7ffe21 100644 --- a/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.ts +++ b/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.ts @@ -87,7 +87,7 @@ export class SendAvisParallelComponent implements AfterViewInit { executeAction(realResSelected: number[]) { const noteContent: string = `[${this.lang.avisUserAsk.toUpperCase()}] ${this.noteEditor.getNoteContent()}`; - this.http.put(this.data.processActionRoute, { resources: realResSelected, note: noteContent, data: { opinionLimitDate: this.functions.formatDateObjectToFrenchDateString(this.opinionLimitDate, true), opinionCircuit : this.appAvisWorkflow.getWorkflow() } }).pipe( + this.http.put(this.data.processActionRoute, { resources: realResSelected, note: noteContent, data: { opinionLimitDate: this.functions.formatDateObjectToDateString(this.opinionLimitDate, true, 'yyyy-mm-dd'), opinionCircuit : this.appAvisWorkflow.getWorkflow() } }).pipe( tap((data: any) => { if (!data) { this.dialogRef.close('success'); @@ -105,7 +105,7 @@ export class SendAvisParallelComponent implements AfterViewInit { } isValidAction() { - if (!this.noResourceToProcess && this.appAvisWorkflow !== undefined && !this.appAvisWorkflow.emptyWorkflow() && !this.appAvisWorkflow.workflowEnd() && !this.functions.empty(this.noteEditor.getNoteContent()) && !this.functions.empty(this.functions.formatDateObjectToFrenchDateString(this.opinionLimitDate))) { + if (!this.noResourceToProcess && this.appAvisWorkflow !== undefined && !this.appAvisWorkflow.emptyWorkflow() && !this.appAvisWorkflow.workflowEnd() && !this.functions.empty(this.noteEditor.getNoteContent()) && !this.functions.empty(this.functions.formatDateObjectToDateString(this.opinionLimitDate))) { return true; } else { return false; diff --git a/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.ts b/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.ts index 08fa0fa1661bce3c07557ecdd669e613caeb7d5e..ec018d4dec001b95b5a6309be7ee17de7e52cc40 100644 --- a/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.ts +++ b/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.ts @@ -94,7 +94,7 @@ export class ValidateAvisParallelComponent implements AfterViewInit { executeAction(realResSelected: number[]) { const noteContent: string = `[${this.lang.avisUserAsk.toUpperCase()}] ${this.noteEditor.getNoteContent()} ↠${this.lang.validateBy} ${this.headerService.user.firstname} ${this.headerService.user.lastname}`; - this.http.put(this.data.processActionRoute, { resources: realResSelected, data: { note: noteContent, opinionLimitDate: this.functions.formatDateObjectToFrenchDateString(this.opinionLimitDate, true), opinionCircuit: this.appAvisWorkflow.getWorkflow() } }).pipe( + this.http.put(this.data.processActionRoute, { resources: realResSelected, data: { note: noteContent, opinionLimitDate: this.functions.formatDateObjectToDateString(this.opinionLimitDate, true), opinionCircuit: this.appAvisWorkflow.getWorkflow() } }).pipe( tap((data: any) => { if (!data) { this.dialogRef.close('success'); @@ -113,7 +113,7 @@ export class ValidateAvisParallelComponent implements AfterViewInit { isValidAction() { if (this.data.resIds.length === 1) { - if (!this.noResourceToProcess && this.noteEditor !== undefined && this.appAvisWorkflow !== undefined && !this.appAvisWorkflow.emptyWorkflow() && !this.appAvisWorkflow.workflowEnd() && !this.functions.empty(this.noteEditor.getNoteContent()) && !this.functions.empty(this.functions.formatDateObjectToFrenchDateString(this.opinionLimitDate))) { + if (!this.noResourceToProcess && this.noteEditor !== undefined && this.appAvisWorkflow !== undefined && !this.appAvisWorkflow.emptyWorkflow() && !this.appAvisWorkflow.workflowEnd() && !this.functions.empty(this.noteEditor.getNoteContent()) && !this.functions.empty(this.functions.formatDateObjectToDateString(this.opinionLimitDate))) { return true; } else { return false; diff --git a/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.ts b/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.ts index 695a9af27ecb450d7dab6ffb887077fb5afe4df7..895d494314b161d40baa5ae6ca3de838a03b6c09 100644 --- a/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.ts +++ b/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.ts @@ -85,7 +85,7 @@ export class SendAvisWorkflowComponent implements AfterViewInit { executeAction(realResSelected: number[]) { const noteContent: string = `[${this.lang.avisUserAsk.toUpperCase()}] ${this.noteEditor.getNoteContent()}`; - this.http.put(this.data.processActionRoute, { resources: realResSelected, note: noteContent, data: { opinionLimitDate: this.functions.formatDateObjectToFrenchDateString(this.opinionLimitDate, true) } }).pipe( + this.http.put(this.data.processActionRoute, { resources: realResSelected, note: noteContent, data: { opinionLimitDate: this.functions.formatDateObjectToDateString(this.opinionLimitDate, true) } }).pipe( tap((data: any) => { if (!data) { this.dialogRef.close('success'); @@ -103,7 +103,7 @@ export class SendAvisWorkflowComponent implements AfterViewInit { } isValidAction() { - if (!this.noResourceToProcess && this.appAvisWorkflow !== undefined && !this.appAvisWorkflow.emptyWorkflow() && !this.appAvisWorkflow.workflowEnd() && !this.functions.empty(this.noteEditor.getNoteContent()) && !this.functions.empty(this.functions.formatDateObjectToFrenchDateString(this.opinionLimitDate))) { + if (!this.noResourceToProcess && this.appAvisWorkflow !== undefined && !this.appAvisWorkflow.emptyWorkflow() && !this.appAvisWorkflow.workflowEnd() && !this.functions.empty(this.noteEditor.getNoteContent()) && !this.functions.empty(this.functions.formatDateObjectToDateString(this.opinionLimitDate))) { return true; } else { return false; diff --git a/src/frontend/app/administration/contact/page/form/contacts-form.component.ts b/src/frontend/app/administration/contact/page/form/contacts-form.component.ts index 58ad9cae548b5bee545c2da81e81a8c4468df28a..e685c4f3cc67fa90e0e47ef0411ff5abacc988e8 100644 --- a/src/frontend/app/administration/contact/page/form/contacts-form.component.ts +++ b/src/frontend/app/administration/contact/page/form/contacts-form.component.ts @@ -590,7 +590,7 @@ export class ContactsFormComponent implements OnInit { this.contactForm.filter(field => field.display).forEach(element => { if (element.type === 'date' && !this.functions.empty(element.control.value)) { const date = new Date(element.control.value); - element.control.value = this.functions.formatDateObjectToFrenchDateString(date); + element.control.value = this.functions.formatDateObjectToDateString(date); } if (element.id.match(regex) !== null) { contact['customFields'][element.id.split('_')[1]] = element.control.value; 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 d3d80fd176b2a166001fbd23f60bbe1be9431f10..fb437b789827dabf44f5c62b1d77ff833ba6e61e 100644 --- a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts +++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts @@ -296,15 +296,15 @@ export class IndexingFormComponent implements OnInit { if (element.today === true) { if (!this.adminMode) { const now = new Date(); - element.default_value = this.functions.formatDateObjectToFrenchDateString(now, false); + element.default_value = this.functions.formatDateObjectToDateString(now, false); } else { element.default_value = '_TODAY'; } } else { if (element.identifier === 'processLimitDate') { - element.default_value = this.functions.formatDateObjectToFrenchDateString(this.arrFormControl[element.identifier].value, true); + element.default_value = this.functions.formatDateObjectToDateString(this.arrFormControl[element.identifier].value, true); } else { - element.default_value = this.functions.formatDateObjectToFrenchDateString(this.arrFormControl[element.identifier].value, false); + element.default_value = this.functions.formatDateObjectToDateString(this.arrFormControl[element.identifier].value, false); } } } else { diff --git a/src/frontend/service/functions.service.ts b/src/frontend/service/functions.service.ts index c1e9b1bbf5b4c7c7803a976d6d4689bfc881c6ee..13b94132655ba902f193da8278930fd8b560906e 100644 --- a/src/frontend/service/functions.service.ts +++ b/src/frontend/service/functions.service.ts @@ -43,16 +43,29 @@ export class FunctionsService { } } - formatDateObjectToFrenchDateString(date: Date, limitMode: boolean = false) { + formatDateObjectToDateString(date: Date, limitMode: boolean = false, format:string = 'dd-mm-yyyy') { if (date !== null) { - let day = date.getDate(); - let month = date.getMonth() + 1; - let year = date.getFullYear(); + let formatDate: any[] = []; + format.split('-').forEach((element: any) => { + if (element === 'dd') { + let day: any = date.getDate(); + day = ('00' + day).slice(-2); + formatDate.push(day); + } else if (element === 'mm') { + let month: any = date.getMonth() + 1; + month = ('00' + month).slice(-2); + formatDate.push(month); + } else if (element === 'yyyy') { + let year: any = date.getFullYear(); + formatDate.push(year); + } + }); + let limit = ''; if (limitMode) { limit = ' 23:59:59'; } - return `${('00' + day).slice(-2)}-${('00' + month).slice(-2)}-${year}${limit}`; + return `${formatDate.join('-')}${limit}`; } else { return date; }