FIX error for duplicate thirdparty found correctly returned by ws
This commit is contained in:
parent
965ee16270
commit
512a570b63
@ -329,7 +329,6 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
|
|||||||
* @param array $authentication Array of authentication information
|
* @param array $authentication Array of authentication information
|
||||||
* @param int $idthirdparty Id thirdparty
|
* @param int $idthirdparty Id thirdparty
|
||||||
* @return array Array result
|
* @return array Array result
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function getSupplierInvoicesForThirdParty($authentication, $idthirdparty)
|
function getSupplierInvoicesForThirdParty($authentication, $idthirdparty)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -298,14 +298,16 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
|
|||||||
|
|
||||||
// Init and check authentication
|
// Init and check authentication
|
||||||
$objectresp = array();
|
$objectresp = array();
|
||||||
$errorcode = ''; $errorlabel = '';
|
$errorcode = '';
|
||||||
|
$errorlabel = '';
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
|
if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
|
$errorcode = 'BAD_PARAMETERS';
|
||||||
|
$errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -316,8 +318,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
|
|||||||
{
|
{
|
||||||
$thirdparty = new Societe($db);
|
$thirdparty = new Societe($db);
|
||||||
$result = $thirdparty->fetch($id, $ref, $ref_ext);
|
$result = $thirdparty->fetch($id, $ref, $ref_ext);
|
||||||
if ($result > 0)
|
if ($result > 0) {
|
||||||
{
|
|
||||||
$thirdparty_result_fields = array(
|
$thirdparty_result_fields = array(
|
||||||
'id' => $thirdparty->id,
|
'id' => $thirdparty->id,
|
||||||
'ref' => $thirdparty->name,
|
'ref' => $thirdparty->name,
|
||||||
@ -380,8 +381,10 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
|
|||||||
$objectresp = array(
|
$objectresp = array(
|
||||||
'result'=>array('result_code'=>'OK', 'result_label'=>''),
|
'result'=>array('result_code'=>'OK', 'result_label'=>''),
|
||||||
'thirdparty'=>$thirdparty_result_fields);
|
'thirdparty'=>$thirdparty_result_fields);
|
||||||
}
|
} elseif ($result == -2) {
|
||||||
else {
|
$error++;
|
||||||
|
$errorcode = 'DUPLICATE_FOUND'; $errorlabel = 'Object found several times for id='.$id.' or ref='.$ref.' or ref_ext='.$ref_ext;
|
||||||
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
$errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
|
$errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user