diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php index 004eece6e6be..0e78a3d49207 100644 --- a/app/Repositories/ClientRepository.php +++ b/app/Repositories/ClientRepository.php @@ -102,7 +102,9 @@ class ClientRepository extends BaseRepository $data['name'] = $client->present()->name(); } - if(array_key_exists('contacts', $contact_data)) + //24-01-2023 when a logo is uploaded, no other data is set, so we need to catch here and not update + //the contacts array UNLESS there are no contacts and we need to maintain state. + if(array_key_exists('contacts', $contact_data) || $client->contacts()->count() == 0) $this->contact_repo->save($contact_data, $client); return $client;