PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.5
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.5
2.4.5 2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 All 69 releases
← All changes | app/Services/TicketQueryService.php +14 -11 2.3.0 → 2.4.5 View file →
@@ -41,20 +41,23 @@
41 41 $ticketsQuery = Ticket::with($this->args['with']);
42 42
43 43 if ($this->args['filter_type'] == 'advanced') {
44 44 $filtersGroups = $this->args['filters_groups'];
45 - foreach ($filtersGroups as $groupIndex => $group) {
46 - $method = 'orWhere';
47 - if ($groupIndex == 0) {
48 - $method = 'where';
45 + // One closure keeps the OR chain from swallowing the AND-ed agent scopes added later.
46 + $ticketsQuery->where(function ($groupsQuery) use ($filtersGroups) {
47 + foreach ($filtersGroups as $groupIndex => $group) {
48 + $method = 'orWhere';
49 + if ($groupIndex == 0) {
50 + $method = 'where';
51 + }
52 + $groupsQuery->{$method}(function ($q) use ($group) {
53 + foreach ($group as $providerName => $items) {
54 + //Call doSearchForAdvancedFilter/filterTicketByUser dynamically from pro
55 + do_action_ref_array('fluent_support\tickets_filter_' . $providerName, [&$q, $items]);
56 + }
57 + });
49 58 }
50 - $ticketsQuery->{$method}(function ($q) use ($group) {
51 - foreach ($group as $providerName => $items) {
52 - //Call doSearchForAdvancedFilter/filterTicketByUser dynamically from pro
53 - do_action_ref_array('fluent_support\tickets_filter_' . $providerName, [&$q, $items]);
54 - }
55 - });
56 - }
59 + });
57 60 } else {
58 61
59 62 if($simpleFilters = $this->args['simple_filters']) {
60 63 $ticketsQuery->applyFilters($simpleFilters);