From cc1a85f030ed139c60291ebd38ebda21a9c3835c Mon Sep 17 00:00:00 2001 From: osaajani <> Date: Sat, 13 Jun 2020 19:10:55 +0200 Subject: [PATCH] Fix import of contact on already existing contacts --- controllers/internals/Contact.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/controllers/internals/Contact.php b/controllers/internals/Contact.php index a9de476..a953f2d 100644 --- a/controllers/internals/Contact.php +++ b/controllers/internals/Contact.php @@ -162,10 +162,17 @@ namespace controllers\internals; } $datas = json_encode($datas); - $success = $this->create($id_user, $line['number'], $line['name'], $datas); - if ($success) + try { - ++$nb_insert; + $success = $this->create($id_user, $line['number'], $line['name'], $datas); + if ($success) + { + ++$nb_insert; + } + } + catch (\Exception $e) + { + continue; } } @@ -218,10 +225,17 @@ namespace controllers\internals; $datas = $contact['datas'] ?? []; $datas = json_encode($datas); - $success = $this->create($id_user, $contact['number'], $contact['name'], $datas); - if ($success) + try { - ++$nb_insert; + $success = $this->create($id_user, $contact['number'], $contact['name'], $datas); + if ($success) + { + ++$nb_insert; + } + } + catch (\Exception $e) + { + continue; } }