@@ -96,7 +96,7 @@ public function handleAjaxRequest(): void
9696 $ campaignId = intval ($ _POST ['campaign_id ' ]);
9797 $ formCount = intval ($ _POST ['form_count ' ]);
9898 $ formStatus = sanitize_text_field ($ _POST ['form_status ' ]);
99- $ enableGoals = !empty ($ _POST ['enable_goals ' ]);
99+ $ enableGoals = !empty ($ _POST ['enable_goals ' ]) ? filter_var ( $ _POST [ ' enable_goals ' ], FILTER_VALIDATE_BOOLEAN ) : false ;
100100 $ goalType = sanitize_text_field ($ _POST ['goal_type ' ]);
101101 $ goalAmountMin = intval ($ _POST ['goal_amount_min ' ]);
102102 $ goalAmountMax = intval ($ _POST ['goal_amount_max ' ]);
@@ -265,7 +265,7 @@ private function createTestDonationForm(
265265 // Create form settings
266266 $ formSettings = FormSettings::fromArray ([
267267 'showHeader ' => true ,
268- 'enableDonationGoal ' => $ goalSettings ['enabled ' ],
268+ 'enableDonationGoal ' => $ goalSettings ['enabled ' ] ?? false ,
269269 'goalAmount ' => $ goalSettings ['amount ' ],
270270 'goalType ' => $ goalSettings ['type ' ],
271271 'goalSource ' => $ goalSettings ['source ' ],
@@ -353,7 +353,7 @@ private function generateGoalSettings(bool $enableGoals, string $goalType, int $
353353 'enabled ' => false ,
354354 'amount ' => 0 ,
355355 'type ' => 'amount ' ,
356- 'source ' => GoalSource::FORM ()->getValue (),
356+ 'source ' => GoalSource::CAMPAIGN ()->getValue (),
357357 ];
358358 }
359359
0 commit comments