Fix import of contact on already existing contacts

This commit is contained in:
osaajani 2020-06-13 19:10:55 +02:00
parent aa4e528778
commit cc1a85f030
1 changed files with 20 additions and 6 deletions

View File

@ -162,12 +162,19 @@ namespace controllers\internals;
} }
$datas = json_encode($datas); $datas = json_encode($datas);
try
{
$success = $this->create($id_user, $line['number'], $line['name'], $datas); $success = $this->create($id_user, $line['number'], $line['name'], $datas);
if ($success) if ($success)
{ {
++$nb_insert; ++$nb_insert;
} }
} }
catch (\Exception $e)
{
continue;
}
}
return $nb_insert; return $nb_insert;
} }
@ -218,12 +225,19 @@ namespace controllers\internals;
$datas = $contact['datas'] ?? []; $datas = $contact['datas'] ?? [];
$datas = json_encode($datas); $datas = json_encode($datas);
try
{
$success = $this->create($id_user, $contact['number'], $contact['name'], $datas); $success = $this->create($id_user, $contact['number'], $contact['name'], $datas);
if ($success) if ($success)
{ {
++$nb_insert; ++$nb_insert;
} }
} }
catch (\Exception $e)
{
continue;
}
}
return $nb_insert; return $nb_insert;
} }