PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.15
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.15
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
← All changes | app/Services/Report/ReportService.php +11 -8 6.2.2 → 6.2.15 View file →
@@ -180,11 +180,12 @@
180 180
181 181 $startDate = $data['start_date'];
182 182 $endDate = $data['end_date'];
183 183 $formId = $data['form_id'];
184 + $breakdown = ReportHelper::getPaymentBreakdown($startDate, $endDate, $formId);
184 185 $data['payment_types'] = [
185 - 'subscription' => ReportHelper::getPaymentsByType($startDate, $endDate, 'subscription', $formId),
186 - 'onetime' => ReportHelper::getPaymentsByType($startDate, $endDate, 'onetime', $formId),
186 + 'subscription' => $breakdown['subscription'] ?? [],
187 + 'onetime' => $breakdown['onetime'] ?? [],
187 188 ];
188 189 return $data;
189 190 }
190 191
@@ -205,16 +206,18 @@
205 206 $startDate = Arr::get($data, 'start_date');
206 207 $endDate = Arr::get($data, 'end_date');
207 208 $formId = Acl::normalizeFormId(Arr::get($data, 'form_id'));
208 209
209 - // Set default date range if not provided
210 + // Default to the last 30 days, measured on the SITE's clock. created_at is
211 + // written by current_time('mysql') and compared here as a raw string, while
212 + // PHP's default timezone is UTC under WordPress — so a bare new \DateTime()
213 + // would close the window at the end of the UTC day and drop everything
214 + // submitted since local midnight on any site east of UTC.
210 215 if (!$startDate || !$endDate) {
211 - $now = new \DateTime();
212 - $endDate = $now->format('Y-m-d 23:59:59');
216 + $today = current_time('Y-m-d');
213 217
214 - $thirtyDaysAgo = new \DateTime();
215 - $thirtyDaysAgo->modify('-30 days');
216 - $startDate = $thirtyDaysAgo->format('Y-m-d 00:00:00');
218 + $endDate = $today . ' 23:59:59';
219 + $startDate = (new \DateTime($today))->modify('-30 days')->format('Y-m-d 00:00:00');
217 220 }
218 221
219 222 return [
220 223 'start_date' => $startDate,