| @@ -184,12 +184,9 @@ | ||
| 184 | 184 | $restrictedBusinessBoxes = PermissionManager::getRestrictedMailboxIds(); |
| 185 | 185 | |
| 186 | 186 | //Get lis of tickets which are waiting for reply |
| 187 | 187 | $tickets = Ticket::where('agent_id', $agentId) |
| 188 | - ->where(function ($q) use ($restrictedBusinessBoxes) { | |
| 189 | - $q->whereNotIn('mailbox_id', $restrictedBusinessBoxes); | |
| 190 | - $q->orWhereNull('mailbox_id'); | |
| 191 | - }) | |
| 188 | + ->whereNotIn('mailbox_id', $restrictedBusinessBoxes) | |
| 192 | 189 | ->where('status', '!=', 'closed') |
| 193 | 190 | ->applyFilters([ |
| 194 | 191 | 'waiting_for_reply' => 'yes' |
| 195 | 192 | ]) |
| @@ -208,12 +205,9 @@ | ||
| 208 | 205 | if($tickets->isEmpty() && PermissionManager::currentUserCan('fst_manage_unassigned_tickets')) { |
| 209 | 206 | //Get the ticket list which status is not closed and agent id is null or 0 |
| 210 | 207 | $tickets = Ticket::where('status', '!=', 'closed') |
| 211 | 208 | ->oldest('id') |
| 212 | - ->where(function ($q) use ($restrictedBusinessBoxes) { | |
| 213 | - $q->whereNotIn('mailbox_id', $restrictedBusinessBoxes); | |
| 214 | - $q->orWhereNull('mailbox_id'); | |
| 215 | - }) | |
| 209 | + ->whereNotIn('mailbox_id', $restrictedBusinessBoxes) | |
| 216 | 210 | ->where(function ($q) { |
| 217 | 211 | $q->whereNull('agent_id'); |
| 218 | 212 | $q->orWhere('agent_id', '0'); |
| 219 | 213 | }) |
| @@ -257,12 +251,9 @@ | ||
| 257 | 251 | 'tags', |
| 258 | 252 | 'agent' |
| 259 | 253 | ]) |
| 260 | 254 | ->limit(5) |
| 261 | - ->where(function ($q) use ($restrictedBusinessBoxes) { | |
| 262 | - $q->whereNotIn('mailbox_id', $restrictedBusinessBoxes); | |
| 263 | - $q->orWhereNull('mailbox_id'); | |
| 264 | - }) | |
| 255 | + ->whereNotIn('mailbox_id', $restrictedBusinessBoxes) | |
| 265 | 256 | ->join('fs_tag_pivot', 'fs_tag_pivot.source_id', '=', 'fs_tickets.id') |
| 266 | 257 | ->where('fs_tag_pivot.source_type', '=', 'ticket_watcher') |
| 267 | 258 | ->where('fs_tag_pivot.tag_id', '=', $agent->id) |
| 268 | 259 | ->select(['fs_tickets.*']) |
| @@ -334,11 +325,11 @@ | ||
| 334 | 325 | 'changeable_ticket_statuses' => Helper::changeableTicketStatuses(), |
| 335 | 326 | 'admin_priorities' => Helper::adminTicketPriorities(), |
| 336 | 327 | 'enable_draft_mode' => Helper::getBusinessSettings('enable_draft_mode', 'no'), |
| 337 | 328 | 'max_file_upload' => Helper::getBusinessSettings('max_file_upload', 3), |
| 338 | - 'support_products' => Product::select(['id', 'title'])->orderedByTitle()->get(), | |
| 329 | + 'support_products' => Product::select(['id', 'title'])->get(), | |
| 339 | 330 | 'ticket_tags' => TicketTag::select(['id', 'title'])->get()->toArray(), |
| 340 | - 'mailboxes' => MailBox::getAccessibleBoxes(), | |
| 331 | + 'mailboxes' => MailBox::select(['id', 'name', 'settings'])->get(), | |
| 341 | 332 | 'ticket_statuses' => Helper::ticketStatuses(), |
| 342 | 333 | ]; |
| 343 | 334 | |
| 344 | 335 | return $type ? $data[$type] : $data; |