-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: form value bug fixes #1022
Changes from 2 commits
dfa6a6c
4359975
575bd5d
716d720
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -258,6 +258,9 @@ export class IntacctImportSettingsComponent implements OnInit { | |
} | ||
|
||
closeModel() { | ||
this.customFieldControl.patchValue({ | ||
source_field: null | ||
}); | ||
this.customFieldForm.reset(); | ||
this.showDialog = false; | ||
} | ||
|
@@ -337,13 +340,17 @@ export class IntacctImportSettingsComponent implements OnInit { | |
|
||
this.importSettingsForm.controls.isDependentImportEnabled.valueChanges.subscribe((isDependentImportEnabled) => { | ||
if (isDependentImportEnabled) { | ||
this.importSettingsForm.controls.costCodes.patchValue(null); | ||
this.importSettingsForm.controls.costTypes.patchValue(null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is common for if and else, move it out |
||
this.importSettingsForm.controls.costCodes.enable(); | ||
this.importSettingsForm.controls.costTypes.enable(); | ||
this.importSettingsForm.controls.costCodes.setValidators(Validators.required); | ||
this.importSettingsForm.controls.costTypes.setValidators(Validators.required); | ||
} else { | ||
this.importSettingsForm.controls.costCodes.patchValue(null); | ||
this.importSettingsForm.controls.costTypes.patchValue(null); | ||
this.importSettingsForm.controls.costCodes.disable(); | ||
this.importSettingsForm.controls.costTypes.disable(); | ||
this.importSettingsForm.controls.costTypes.disable(); | ||
this.importSettingsForm.controls.costCodes.clearValidators(); | ||
this.importSettingsForm.controls.costTypes.clearValidators(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,9 @@ export class Sage300ImportSettingsComponent implements OnInit { | |
} | ||
|
||
closeModel() { | ||
this.customFieldControl.patchValue({ | ||
source_field: null | ||
}); | ||
Comment on lines
+128
to
+130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure In the Apply this diff to add a null check: closeModel() {
+ if (this.customFieldControl) {
this.customFieldControl.patchValue({
source_field: null
});
+ }
this.customFieldForm.reset();
this.showCustomFieldDialog = false;
}
|
||
this.customFieldForm.reset(); | ||
this.showCustomFieldDialog = false; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ export class ConfigurationSkipExportComponent implements OnInit { | |
|
||
@Output() deleteSkipExportForm = new EventEmitter<number>(); | ||
|
||
@Output() invalidSkipExportForm = new EventEmitter<boolean>(); | ||
|
||
isLoading: boolean = true; | ||
|
||
showExpenseFilters: boolean; | ||
|
@@ -209,11 +211,12 @@ export class ConfigurationSkipExportComponent implements OnInit { | |
if (this.showAdditionalCondition) { | ||
if (condition1.valid && condition2.valid) { | ||
if (condition1.value?.field_name === condition2.value?.field_name) { | ||
this.skipExportForm.controls.operator2.setValue(null); | ||
this.invalidSkipExportForm.emit(true); | ||
return true; | ||
} | ||
} | ||
} | ||
this.invalidSkipExportForm.emit(false); | ||
return false; | ||
Comment on lines
+214
to
220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review the logic in The current implementation of
This logic appears counterintuitive. Typically, we would expect the form to be considered invalid when conditions are not met, rather than when they are. Please review and clarify if this is the intended behavior. Consider revising the logic to align with expected form validation behavior. For example: checkValidationCondition() {
const condition1 = this.skipExportForm.controls.condition1;
const condition2 = this.skipExportForm.controls.condition2;
if (this.showAdditionalCondition) {
if (condition1.valid && condition2.valid) {
if (condition1.value?.field_name === condition2.value?.field_name) {
this.invalidSkipExportForm.emit(false);
return false; // Form is valid when conditions are different
}
}
}
this.invalidSkipExportForm.emit(true);
return true; // Form is invalid in other cases
} Please review and adjust according to the intended validation logic. |
||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null check for 'customFieldControl' before calling 'patchValue'
In the
closeModel()
method, ensure thatthis.customFieldControl
is not null or undefined before callingpatchValue
to prevent potential runtime errors.Consider updating the code as follows:
📝 Committable suggestion