File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/app/integrations/intacct/intacct-shared/intacct-import-settings Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,10 @@ export class IntacctImportSettingsComponent implements OnInit {
170170 sourceField = IntacctCategoryDestination . ACCOUNT ;
171171 }
172172
173- if ( event . checked && this . acceptedImportCodeField . includes ( sourceField ) && this . intacctImportCodeConfig [ sourceField ] ) {
173+ // Find the index of the FormGroup
174+ const index = importCodeFieldsArray . controls . findIndex ( control => control ?. get ( 'source_field' ) ?. value === sourceField ) ;
175+
176+ if ( event . checked && this . acceptedImportCodeField . includes ( sourceField ) && this . intacctImportCodeConfig [ sourceField ] && index === - 1 ) {
174177 // Create a new FormGroup
175178 const value = this . formBuilder . group ( {
176179 source_field : [ sourceField ] ,
@@ -180,8 +183,6 @@ export class IntacctImportSettingsComponent implements OnInit {
180183 // Push the new FormGroup into the FormArray
181184 importCodeFieldsArray . push ( value ) ;
182185 } else {
183- // Find the index of the FormGroup to be removed
184- const index = importCodeFieldsArray . controls . findIndex ( control => control ?. get ( 'source_field' ) ?. value === sourceField ) ;
185186
186187 // If found, remove the FormGroup from the FormArray
187188 if ( index !== - 1 ) {
You can’t perform that action at this time.
0 commit comments