@@ -280,73 +280,73 @@ public function data($ticketList = 'active')
280280 })
281281 ->leftJoin ('panichd_tags ' , 'panichd_taggables.tag_id ' , '= ' , 'panichd_tags.id ' );
282282
283- if (config ('database.default ' ) == 'sqlite ' ) {
284- $ int_start_date = 'cast(julianday(panichd_tickets.start_date) as real) ' ;
285- $ int_limit_date = 'cast(julianday(panichd_tickets.limit_date) as real) ' ;
286- } else {
287- $ int_start_date = "CONVERT(date_format(panichd_tickets.start_date, '%Y%m%d%h%i%s'), SIGNED INTEGER) " ;
288- $ int_limit_date = "CONVERT(date_format(panichd_tickets.limit_date, '%Y%m%d%h%i%s'), SIGNED INTEGER) " ;
289- }
290-
291- $ a_select = [
292- 'panichd_tickets.id ' ,
293- 'panichd_tickets.created_at ' ,
294- 'panichd_tickets.subject AS subject ' ,
295- 'panichd_tickets.hidden as hidden ' ,
296- 'panichd_tickets.content AS content ' ,
297- 'panichd_tickets.intervention AS intervention ' ,
298- 'panichd_tickets.status_id as status_id ' ,
299- 'panichd_statuses.name AS status ' ,
300- 'panichd_statuses.color AS color_status ' ,
301- 'panichd_priorities.color AS color_priority ' ,
302- 'panichd_categories.color AS color_category ' ,
303- 'panichd_tickets.start_date as start_date ' ,
304- \DB ::raw (' 0- ' .$ int_start_date .' as inverse_start_date ' ),
305- \DB ::raw ('CASE panichd_tickets.limit_date WHEN NULL THEN 0 ELSE 1 END as has_limit ' ),
306- 'panichd_tickets.limit_date as limit_date ' ,
307- \DB ::raw (' 0- ' .$ int_limit_date .' as inverse_limit_date ' ),
308- 'panichd_tickets.limit_date as calendar ' ,
309- 'panichd_tickets.updated_at AS updated_at ' ,
310- 'panichd_tickets.completed_at AS completed_at ' ,
311- 'panichd_tickets.agent_id ' ,
312- 'panichd_tickets.read_by_agent ' ,
313- 'agent.name as agent_name ' ,
314- 'panichd_priorities.name AS priority ' ,
315- 'panichd_priorities.magnitude AS priority_magnitude ' ,
316- 'members.name AS owner_name ' ,
317- 'creator.name as creator_name ' ,
318- 'panichd_tickets.user_id ' ,
319- 'panichd_tickets.creator_id ' ,
320- 'panichd_categories.id as category_id ' ,
321- 'panichd_categories.name AS category ' ,
322-
323- // Tag Columns
324- \DB ::raw ('group_concat(panichd_tags.id) AS tags_id ' ),
325- \DB ::raw ('group_concat(panichd_tags.name) AS tags ' ),
326- \DB ::raw ('group_concat(panichd_tags.bg_color) AS tags_bg_color ' ),
327- \DB ::raw ('group_concat(panichd_tags.text_color) AS tags_text_color ' ),
328- ];
329-
330- if (Setting::grab ('departments_feature ' )) {
331- $ collection ->leftJoin ('panichd_departments ' , 'panichd_departments.id ' , '= ' , 'members.department_id ' )
332- ->leftJoin ('panichd_departments as dep_ancestor ' , 'panichd_departments.department_id ' , '= ' , 'dep_ancestor.id ' );
333283
334- // Department columns
335- $ a_select [] = \DB ::raw ('CASE panichd_departments.department_id WHEN NULL THEN "" ELSE dep_ancestor.name END as dep_ancestor_name ' );
336-
337- if (config ('database.default ' ) == 'sqlite ' ) {
338- $ a_select [] = \DB ::raw ('dep_ancestor.name + panichd_departments.name as dept_full_name ' ); //\''.trans('panichd::lang.colon').' +
339- } else {
340- $ a_select [] = \DB ::raw ('concat_ws( \'' .trans ('panichd::lang.colon ' ).' \', dep_ancestor.name, panichd_departments.name) as dept_full_name ' );
341- }
342- } else {
343- $ a_select [] = '"" as dep_ancestor_name ' ;
344- }
345-
346- $ currentLevel = $ this ->member ->currentLevel ();
347-
348- $ collection
349- ->groupBy ('panichd_tickets.id ' )
284+ if (config ('database.default ' )=='sqlite ' ){
285+ $ int_start_date = 'cast(julianday(panichd_tickets.start_date) as real) ' ;
286+ $ int_limit_date = 'cast(julianday(panichd_tickets.limit_date) as real) ' ;
287+ }else {
288+ $ int_start_date = "CONVERT(date_format(panichd_tickets.start_date, '%Y%m%d%h%i%s'), SIGNED INTEGER) " ;
289+ $ int_limit_date = "CONVERT(date_format(panichd_tickets.limit_date, '%Y%m%d%h%i%s'), SIGNED INTEGER) " ;
290+ }
291+
292+ $ a_select = [
293+ 'panichd_tickets.id ' ,
294+ 'panichd_tickets.created_at ' ,
295+ 'panichd_tickets.subject AS subject ' ,
296+ 'panichd_tickets.hidden as hidden ' ,
297+ 'panichd_tickets.content AS content ' ,
298+ 'panichd_tickets.intervention AS intervention ' ,
299+ 'panichd_tickets.status_id as status_id ' ,
300+ 'panichd_statuses.name AS status ' ,
301+ 'panichd_statuses.color AS color_status ' ,
302+ 'panichd_priorities.color AS color_priority ' ,
303+ 'panichd_categories.color AS color_category ' ,
304+ 'panichd_tickets.start_date as start_date ' ,
305+ \DB ::raw (' 0- ' .$ int_start_date .' as inverse_start_date ' ),
306+ \DB ::raw ('CASE panichd_tickets.limit_date WHEN NULL THEN 0 ELSE 1 END as has_limit ' ),
307+ 'panichd_tickets.limit_date as limit_date ' ,
308+ \DB ::raw (' 0- ' .$ int_limit_date .' as inverse_limit_date ' ),
309+ 'panichd_tickets.limit_date as calendar ' ,
310+ 'panichd_tickets.updated_at AS updated_at ' ,
311+ 'panichd_tickets.completed_at AS completed_at ' ,
312+ 'panichd_tickets.agent_id ' ,
313+ 'agent.name as agent_name ' ,
314+ 'panichd_priorities.name AS priority ' ,
315+ 'panichd_priorities.magnitude AS priority_magnitude ' ,
316+ 'members.name AS owner_name ' ,
317+ 'creator.name as creator_name ' ,
318+ 'panichd_tickets.user_id ' ,
319+ 'panichd_tickets.creator_id ' ,
320+ 'panichd_categories.id as category_id ' ,
321+ 'panichd_categories.name AS category ' ,
322+
323+ // Tag Columns
324+ \DB ::raw ('group_concat(panichd_tags.id) AS tags_id ' ),
325+ \DB ::raw ('group_concat(panichd_tags.name) AS tags ' ),
326+ \DB ::raw ('group_concat(panichd_tags.bg_color) AS tags_bg_color ' ),
327+ \DB ::raw ('group_concat(panichd_tags.text_color) AS tags_text_color ' ),
328+ ];
329+
330+ if (Setting::grab ('departments_feature ' )){
331+ $ collection ->leftJoin ('panichd_departments ' , 'panichd_departments.id ' , '= ' , 'members.department_id ' )
332+ ->leftJoin ('panichd_departments as dep_ancestor ' , 'panichd_departments.department_id ' , '= ' , 'dep_ancestor.id ' );
333+
334+ // Department columns
335+ $ a_select [] = \DB ::raw ('CASE panichd_departments.department_id WHEN NULL THEN "" ELSE dep_ancestor.name END as dep_ancestor_name ' );
336+
337+ if (config ('database.default ' )=='sqlite ' ){
338+ $ a_select [] = \DB ::raw ('dep_ancestor.name + panichd_departments.name as dept_full_name ' ); #\''.trans('panichd::lang.colon').' +
339+ }else {
340+ $ a_select [] = \DB ::raw ('concat_ws( \'' . trans ('panichd::lang.colon ' ) . ' \', dep_ancestor.name, panichd_departments.name) as dept_full_name ' );
341+ }
342+ }else {
343+ $ a_select [] = \DB ::raw ('"" as dep_ancestor_name ' );
344+ }
345+
346+ $ currentLevel = $ agent ->currentLevel ();
347+
348+ $ collection
349+ ->groupBy ('panichd_tickets.id ' )
350350 ->select ($ a_select )
351351 ->with ('creator ' )
352352 ->with ('agent ' )
0 commit comments