mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes fot search by client
This commit is contained in:
parent
f2f71f892c
commit
7adaab984b
@ -62,20 +62,30 @@ class BaseTransformer
|
||||
public function getClient($client_name, $client_email) {
|
||||
$clients = $this->maps['company']->clients;
|
||||
|
||||
$clients = $clients->where( 'id_number', $client_name );
|
||||
$client_id_search = $clients->where( 'id_number', $client_name );
|
||||
|
||||
if ( $clients->count() >= 1 ) {
|
||||
return $clients->first()->id;
|
||||
if ( $client_id_search->count() >= 1 ) {
|
||||
return $client_id_search->first()->id;
|
||||
nlog("found via id number");
|
||||
}
|
||||
|
||||
$client_name_search = $clients->where( 'name', $client_name );
|
||||
|
||||
if ( $client_name_search->count() >= 1 ) {
|
||||
return $client_name_search->first()->id;
|
||||
nlog("found via name");
|
||||
}
|
||||
|
||||
if ( ! empty( $client_email ) ) {
|
||||
$contacts = ClientContact::where( 'company_id', $this->maps['company']->id )
|
||||
->where( 'email', $client_email );
|
||||
|
||||
if ( $contacts->count() >= 1 ) {
|
||||
return $contacts->first()->client_id;
|
||||
nlog("found via contact");
|
||||
}
|
||||
}
|
||||
nlog("did not find client");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user