Expand the ability to restrict a Customers list to a specific Mailbox

The results now include Customers created through the admin interface,
not only the ones created from a Conversation.
This commit is contained in:
Antoine Le Gonidec 2024-07-08 11:48:31 +02:00
parent 2227620cc7
commit 509058ec46
Signed by: vv221
GPG key ID: 636B78F91CEB80D8

View file

@ -159,11 +159,7 @@ class ConversationsController extends BaseConversationsController {
->whereIn('customers.mailbox_id', $mailbox_ids); ->whereIn('customers.mailbox_id', $mailbox_ids);
if (!empty($filters['mailbox']) && in_array($filters['mailbox'], $mailbox_ids)) { if (!empty($filters['mailbox']) && in_array($filters['mailbox'], $mailbox_ids)) {
$query_customers->join('conversations', function ($join) use ($filters) { $query_customers->where('customers.mailbox_id', '=', $filters['mailbox']);
$join->on('conversations.customer_id', '=', 'customers.id');
//$join->on('conversations.mailbox_id', '=', $filters['mailbox']);
});
$query_customers->where('conversations.mailbox_id', '=', $filters['mailbox']);
} }
$query_customers = \Eventy::filter('search.customers.apply_filters', $query_customers, $filters, $q); $query_customers = \Eventy::filter('search.customers.apply_filters', $query_customers, $filters, $q);