Merge pull request #4515 from emanuelschuetze/fixStatuteAmendment

Fixed statute amendment detection in motion form
This commit is contained in:
Sean 2019-03-20 12:56:12 +01:00 committed by GitHub
commit 460c99e683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1086,8 +1086,8 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
/** /**
* Sets the default workflow ID during form creation * Sets the default workflow ID during form creation
*/ */
public updateWorkflowIdForCreateForm(): void { public updateWorkflowIdForCreateForm(paragraph?: number): void {
const isStatuteAmendment = !!this.contentForm.get('statute_amendment').value; const isStatuteAmendment = !!this.contentForm.get('statute_amendment').value && !!paragraph;
const configKey = isStatuteAmendment ? 'motions_statute_amendments_workflow' : 'motions_workflow'; const configKey = isStatuteAmendment ? 'motions_statute_amendments_workflow' : 'motions_workflow';
const workflowId = this.configService.instant<string>(configKey); const workflowId = this.configService.instant<string>(configKey);
this.contentForm.patchValue({ workflow_id: +workflowId }); this.contentForm.patchValue({ workflow_id: +workflowId });
@ -1116,6 +1116,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
title: this.translate.instant('Statute amendment for') + ` ${selectedParagraph.title}`, title: this.translate.instant('Statute amendment for') + ` ${selectedParagraph.title}`,
text: selectedParagraph.text text: selectedParagraph.text
}); });
this.updateWorkflowIdForCreateForm(newValue);
} }
/** /**