diff --git a/src/Views/Form/Templates/Classic/Classic.php b/src/Views/Form/Templates/Classic/Classic.php index 95554d0d28..78860ce87c 100644 --- a/src/Views/Form/Templates/Classic/Classic.php +++ b/src/Views/Form/Templates/Classic/Classic.php @@ -2,11 +2,13 @@ namespace Give\Views\Form\Templates\Classic; +use Give\DonationForms\DonationQuery; use Give\Form\Template; use Give\Form\Template\Hookable; use Give\Form\Template\Scriptable; use Give\Helpers\Form\Template as FormTemplateUtils; use Give\Helpers\Form\Template\Utils\Frontend; +use Give\MultiFormGoals\ProgressBar\Model as ProgressBarModal; use Give\Receipt\DonationReceipt; use Give_Donate_Form; use InvalidArgumentException; @@ -103,7 +105,7 @@ public function loadHooks() ]; foreach ($sections as $section) { - list ($start, $end) = array_pad($section[ 'hooks' ], 2, null); + [$start, $end] = array_pad($section['hooks'], 2, null); add_action($start, function () use ($section) { printf('
', $section[ 'class' ]); @@ -289,10 +291,13 @@ public function getReceiptDetails($donationId) return $receipt; } + /** + * @unreleased Use sumIntendedAmount() and getDonationCount() methods to retrieve the proper values for the raised amount and donations count + */ public function getFormGoalStats(Give_Donate_Form $form) { $goalStats = give_goal_progress_stats($form->get_ID()); - $raisedRaw = $form->get_earnings(); + $raisedRaw = (new DonationQuery())->form($form->ID)->sumIntendedAmount(); // Setup default raised value $raised = give_currency_filter( @@ -306,7 +311,7 @@ public function getFormGoalStats(Give_Donate_Form $form) ); // Setup default count value - $count = $form->get_sales(); + $count = (new ProgressBarModal(['ids' => [$form->get_ID()]]))->getDonationCount(); // Setup default count label $countLabel = _n('donation', 'donations', $count, 'give'); diff --git a/src/Views/Form/Templates/Sequoia/sections/income-stats.php b/src/Views/Form/Templates/Sequoia/sections/income-stats.php index f4f09841f5..a6eb9bff74 100644 --- a/src/Views/Form/Templates/Sequoia/sections/income-stats.php +++ b/src/Views/Form/Templates/Sequoia/sections/income-stats.php @@ -3,6 +3,13 @@ /** * @var int $formId */ + +use Give\DonationForms\DonationQuery; +use Give\MultiFormGoals\ProgressBar\Model as ProgressBarModal; + +/** + * @unreleased Use sumIntendedAmount() and getDonationCount() methods to retrieve the proper values for the raised amount and donations count + */ if ($form->has_goal()) : ?> get_earnings(), + (new DonationQuery())->form($formId)->sumIntendedAmount(), [ 'sanitize' => false, 'decimal' => false, @@ -19,7 +26,7 @@ ); // Setup default count value - $count = $form->get_sales(); + $count = (new ProgressBarModal(['ids' => [$formId]]))->getDonationCount();; // Setup default count label $countLabel = _n('donation', 'donations', $count, 'give');