When a large number of clients exists. the system generates a large query that results in a error when using the CI query builder.
To reproduce the problem
- Create a large number of clients (about 4000 to 5000)
- Create a new quest user and assign all clients to the user
- From the main menu, add a new customer.
The issue arises in the function get_not_assigned_to_user() in the file application/modules/clients/models/Mdl_clients.php
The variable $assigned_clients, with a few thousand client ids are passed to the query builder function where_not_in()
This effectively builds a large query with a few thousand WHERE clauses