|
8 | 8 | use DB; |
9 | 9 | use Validator; |
10 | 10 | use Illuminate\Http\Request; |
| 11 | +use Illuminate\Support\Facades\Schema; |
11 | 12 | use PanicHD\PanicHD\Helpers\LaravelVersion; |
12 | 13 | use Intervention\Image\ImageManagerStatic as Image; |
13 | 14 | use PanicHD\PanicHD\Events\TicketCreated; |
@@ -111,6 +112,17 @@ public function data($ticketList = 'active') |
111 | 112 | \DB::raw('group_concat(panichd_tags.text_color) AS tags_text_color'), |
112 | 113 | ]; |
113 | 114 |
|
| 115 | + // Check if member is soft deleted |
| 116 | + if (Schema::hasColumn('panichd_members', 'deleted_at')){ |
| 117 | + if (config('database.default')=='sqlite'){ |
| 118 | + $a_select[] = \DB::raw('CASE panichd_members.deleted_at WHEN NULL THEN 0 ELSE 1 END as deleted_owner'); |
| 119 | + }else{ |
| 120 | + $a_select[] = \DB::raw('CASE WHEN panichd_members.deleted_at IS NULL THEN 0 ELSE 1 END as deleted_owner'); |
| 121 | + } |
| 122 | + }else{ |
| 123 | + $a_select[] = '0 as deleted_owner'; |
| 124 | + } |
| 125 | + |
114 | 126 | if (Setting::grab('departments_feature')){ |
115 | 127 | // Department joins |
116 | 128 | $collection |
@@ -281,6 +293,13 @@ public function renderTicketTable($collection) |
281 | 293 |
|
282 | 294 | $collection->editColumn('owner_name', function ($ticket) { |
283 | 295 | $return = str_replace (" ", " ", $ticket->owner_name); |
| 296 | + |
| 297 | + if ($ticket->deleted_owner == '1'){ |
| 298 | + $return = "<span class=\"tooltip-info\" data-toggle=\"tooltip\" data-placement=\"auto bottom\" title=\"".trans('panichd::lang.deleted-member')."\">" |
| 299 | + ."<span class=\"glyphicon glyphicon-exclamation-sign text-danger\"></span>" |
| 300 | + ." " . $return . "</span>"; |
| 301 | + } |
| 302 | + |
284 | 303 | if (Setting::grab('user_route') != 'disabled'){ |
285 | 304 | $return = '<a href="'.route(Setting::grab('user_route'), ['id' => $ticket->user_id]).'">'.$return.'</a>'; |
286 | 305 | } |
@@ -1015,9 +1034,21 @@ public function show($id) |
1015 | 1034 | ->select('panichd_tickets.*', 'panichd_departments.department', 'panichd_departments.sub1'); |
1016 | 1035 | } |
1017 | 1036 |
|
1018 | | - $ticket = $ticket |
1019 | | - ->select(['panichd_tickets.*', 'panichd_members.name as owner_name', 'panichd_members.email as owner_email']) |
1020 | | - ->findOrFail($id); |
| 1037 | + $a_select = ['panichd_tickets.*', 'panichd_members.name as owner_name', 'panichd_members.email as owner_email']; |
| 1038 | + |
| 1039 | + // Check if member is soft deleted |
| 1040 | + if (Schema::hasColumn('panichd_members', 'deleted_at')){ |
| 1041 | + if (config('database.default')=='sqlite'){ |
| 1042 | + $a_select[] = \DB::raw('CASE panichd_members.deleted_at WHEN NULL THEN 0 ELSE 1 END as deleted_owner'); |
| 1043 | + }else{ |
| 1044 | + $a_select[] = \DB::raw('CASE WHEN panichd_members.deleted_at IS NULL THEN 0 ELSE 1 END as deleted_owner'); |
| 1045 | + } |
| 1046 | + }else{ |
| 1047 | + $a_select[] = '0 as deleted_owner'; |
| 1048 | + } |
| 1049 | + |
| 1050 | + // Select Ticket and properties |
| 1051 | + $ticket = $ticket->select($a_select)->findOrFail($id); |
1021 | 1052 |
|
1022 | 1053 | if ($ticket->hidden and $user->currentLevel() == 1){ |
1023 | 1054 | return redirect()->route(Setting::grab('main_route').'.index')->with('warning', trans('panichd::lang.you-are-not-permitted-to-access')); |
|
0 commit comments