@@ -52,8 +52,9 @@ public function data($ticketList = 'active')
5252
5353 $ collection
5454 ->join ('users ' , 'users.id ' , '= ' , 'panichd_tickets.user_id ' )
55+ ->join ('panichd_members ' , 'panichd_members.id ' , '= ' , 'panichd_tickets.user_id ' )
5556 ->join ('panichd_statuses ' , 'panichd_statuses.id ' , '= ' , 'panichd_tickets.status_id ' )
56- ->join ('users as agent ' , 'agent.id ' , '= ' , 'panichd_tickets.agent_id ' )
57+ ->join ('panichd_members as agent ' , 'agent.id ' , '= ' , 'panichd_tickets.agent_id ' )
5758 ->join ('panichd_priorities ' , 'panichd_priorities.id ' , '= ' , 'panichd_tickets.priority_id ' )
5859 ->join ('panichd_categories ' , 'panichd_categories.id ' , '= ' , 'panichd_tickets.category_id ' )
5960
@@ -97,7 +98,7 @@ public function data($ticketList = 'active')
9798 \DB ::raw ('group_concat(agent.name) AS agent_name ' ),
9899 'panichd_priorities.name AS priority ' ,
99100 'panichd_priorities.magnitude AS priority_magnitude ' ,
100- 'users .name AS owner_name ' ,
101+ 'panichd_members .name AS owner_name ' ,
101102 'panichd_tickets.user_id ' ,
102103 'panichd_tickets.creator_id ' ,
103104 'panichd_tickets.category_id ' ,
@@ -114,7 +115,7 @@ public function data($ticketList = 'active')
114115 // Department joins
115116 $ collection
116117 ->leftJoin ('panichd_departments_persons ' , function ($ join1 ) {
117- $ join1 ->on ('users .person_id ' ,'= ' ,'panichd_departments_persons.person_id ' );
118+ $ join1 ->on ('panichd_members .person_id ' ,'= ' ,'panichd_departments_persons.person_id ' );
118119 })
119120 ->leftJoin ('panichd_departments ' ,'panichd_departments_persons.department_id ' ,'= ' ,'panichd_departments.id ' );
120121
@@ -728,7 +729,7 @@ protected function validation_common($request, $new_ticket = true)
728729
729730 $ fields = [
730731 'subject ' => 'required|min:3 ' ,
731- 'owner_id ' => 'required|exists:users ,id ' ,
732+ 'owner_id ' => 'required|exists:panichd_members ,id ' ,
732733 'category_id ' => 'required|in: ' .$ allowed_categories ,
733734 'content ' => 'required|min:6 ' ,
734735 ];
@@ -998,20 +999,25 @@ public function viewAttachment($attachment_id)
998999 */
9991000 public function show ($ id )
10001001 {
1001- $ ticket = $ this ->tickets ->with ('category.closingReasons ' )->with ('tags ' );
10021002 $ user = $ this ->member ->find (auth ()->user ()->id );
10031003
1004+ $ ticket = $ this ->tickets
1005+ ->with ('category.closingReasons ' )
1006+ ->with ('tags ' )
1007+ ->join ('panichd_members ' , 'panichd_members.id ' , '= ' , 'panichd_tickets.user_id ' );
1008+
10041009 if ($ user ->currentLevel ()>1 and Setting::grab ('departments_feature ' )){
10051010 // Departments related
1006- $ ticket = $ ticket ->join ('users ' , 'users.id ' , '= ' , 'panichd_tickets.user_id ' )
1007- ->leftJoin ('panichd_departments_persons ' , function ($ join1 ) {
1008- $ join1 ->on ('users.person_id ' ,'= ' ,'panichd_departments_persons.person_id ' );
1011+ $ ticket = $ ticket ->leftJoin ('panichd_departments_persons ' , function ($ join1 ) {
1012+ $ join1 ->on ('panichd_members.person_id ' ,'= ' ,'panichd_departments_persons.person_id ' );
10091013 })
10101014 ->leftJoin ('panichd_departments ' ,'panichd_departments_persons.department_id ' ,'= ' ,'panichd_departments.id ' )
10111015 ->select ('panichd_tickets.* ' , 'panichd_departments.department ' , 'panichd_departments.sub1 ' );
10121016 }
10131017
1014- $ ticket = $ ticket ->findOrFail ($ id );
1018+ $ ticket = $ ticket
1019+ ->select (['panichd_tickets.* ' , 'panichd_members.name as owner_name ' , 'panichd_members.email as owner_email ' ])
1020+ ->findOrFail ($ id );
10151021
10161022 if ($ ticket ->hidden and $ user ->currentLevel () == 1 ){
10171023 return redirect ()->route (Setting::grab ('main_route ' ).'.index ' )->with ('warning ' , trans ('panichd::lang.you-are-not-permitted-to-access ' ));
0 commit comments