Skip to content

Commit 5a75f42

Browse files
author
Jon Waldstein
committed
fix: form goal
1 parent 0c815cb commit 5a75f42

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/DataGenerator/DonationFormGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)