Client Exits > Show result or redirect to Client

I dislike the way IP tells me a Client Exists when trying to add it.

I’m talking about the // Set validation rule based on is_update found at
modules/clients/controllers/Clients.php

$this->session->set_flashdata('alert_error', trans('client_already_exists'));
                redirect('clients/form');

Not worth it something like:

  1. Ajax Search and show result as you fill the fields of the new customer
  2. Upon matching redirect to the customer profile , something like this:
if (!empty($check)) {
				$client = $this->mdl_clients->where('client_name', $this->input->post('client_name'))->get();
				$client_id = $client->row()->client_id;
				redirect('clients/view/' . $client_id);
                //$this->session->set_flashdata('alert_error', trans('client_already_exists'));
                //redirect('clients/form');
            } else {
                $new_client = true;
            }

I think is just easier instead of throw that error Clietn Exits! than having to navigate the Client List or make the search.

What do you guys think?

1 Like

Can you make a PR for it?

Also, i don’t know if its relevant, but if i want to create an invoice and i quickly want to create a client, i don’t want to ve redirected to the client’s view page

if i want to create an invoice and i quickly want to create a client, i don’t want to ve redirected to the client’s view page

It’s working nicely with the other redirect I’ve done for new customer > create receipt.

If the Client exist > Go View > Automated pop up window to create a receipt (that indeed is what I do on the software most of the time).