PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Services/Report/SourceReportService.php +22 -0 1.3.27 → 1.6.5 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace FluentCart\App\Services\Report;
4 4
5 5 use FluentCart\App\App;
6 +use FluentCart\Framework\Database\Query\Builder as Query;
6 7
7 8 class SourceReportService extends ReportService
8 9 {
9 10 public function getSourceReportData($params = [])
@@ -31,8 +32,29 @@
31 32 ])
32 33 ->orderByRaw('gross_sales DESC');
33 34
34 35 $query = $this->applyFilters($query, $params);
36 +
37 + /**
38 + * Let listeners narrow the Order Sources report query.
39 + *
40 + * The free plugin only forwards the request params ('filter_type' and the
41 + * raw 'advanced_filters' JSON among them) — it never parses or applies the
42 + * advanced filters itself. FluentCart Pro owns that: it reads the params,
43 + * builds the condition groups through the Orders filter engine and adds
44 + * the constraints to this query.
45 + *
46 + * @param \FluentCart\Framework\Database\Query\Builder $query
47 + * @param array $params Processed report params.
48 + */
49 + $filteredQuery = apply_filters('fluent_cart/report/sources_query', $query, $params);
50 +
51 + // A callback that returns something other than a query builder (null,
52 + // an array, a thrown-away clone of the wrong type) would fatal the whole
53 + // report, so fall back to the unmodified query instead.
54 + if ($filteredQuery instanceof Query) {
55 + $query = $filteredQuery;
56 + }
35 57
36 58 return $query->get();
37 59 }
38 60