Fixes : contact webservice fix update using ref_ext

This commit is contained in:
Arnaud Aujon 2015-04-22 12:47:45 +02:00
parent 54ffaea000
commit 97fc99517e

View File

@ -627,9 +627,15 @@ function updateContact($authentication,$contact)
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
// Check parameters
if (empty($contact['id'])) {
$error++; $errorcode='KO'; $errorlabel="Contact id is mandatory.";
if (empty($contact['id']) && empty($contact['ref_ext']) {
$error++; $errorcode='KO'; $errorlabel="Contact id or ref_ext is mandatory.";
}
// Check parameters
if (! $error && ($id && $ref_ext))
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id and ref_ext can't be all provided. You must choose one of them.";
}
if (! $error)
{
@ -638,7 +644,7 @@ function updateContact($authentication,$contact)
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$object=new Contact($db);
$result=$object->fetch($contact['id']);
$result=$object->fetch($contact['id'],0,$contact['ref_ext']);
if (!empty($object->id)) {