File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -211,13 +211,19 @@ public static function getSyncIssuesRequest() : AbstractQuery {
211
211
];
212
212
213
213
// assistance requests having only one generated ticket (reuse query2)
214
- $ query3 = $ query2 ;
215
- // replace LEFT JOIN with INNER JOIN to exclude tickets not linked to a Formanswer object
216
- $ query3 ['INNER JOIN ' ][$ itemTicketTable ] = $ query3 ['LEFT JOIN ' ][$ itemTicketTable ];
217
- unset($ query3 ['LEFT JOIN ' ][$ itemTicketTable ]);
218
- // Only 1 relation to a Formanswer object
219
- $ query3 ['GROUPBY ' ] = ["$ itemTicketTable.items_id " ];
220
- $ query3 ['HAVING ' ] = new QueryExpression ("COUNT(` $ itemTicketTable`.`items_id`) = 1 " );
214
+ $ query3 = [
215
+ 'SELECT ' => $ query2 ['SELECT ' ],
216
+ 'FROM ' => $ query2 ['FROM ' ],
217
+ 'INNER JOIN ' => [$ itemTicketTable => $ query2 ['LEFT JOIN ' ][$ itemTicketTable ]],
218
+ 'LEFT JOIN ' => [
219
+ $ query2 ['LEFT JOIN ' ][0 ], // This is the TABLE => [...] subquery
220
+ $ ticketValidationTable => $ query2 ['LEFT JOIN ' ][$ ticketValidationTable ],
221
+ ],
222
+ 'WHERE ' => $ query2 ['WHERE ' ],
223
+ 'GROUPBY ' => ["$ itemTicketTable.items_id " ],
224
+ // Only 1 relation to a Formanswer object
225
+ 'HAVING ' => new QueryExpression ("COUNT(` $ itemTicketTable`.`items_id`) = 1 " ),
226
+ ];
221
227
222
228
// Union of the 3 previous queries
223
229
$ union = new QueryUnion ([
You can’t perform that action at this time.
0 commit comments