diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index c7e1f769d9a..26fc4c57063 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -115,7 +115,8 @@ $actioncomm_fields= array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('actioncomm',true); -if (count($extrafields)>0) { +$extrafield_array=null; +if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index cab58268f57..f5da8324521 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -120,7 +120,8 @@ $contact_fields = array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true); -if (count($extrafields)>0) { +$extrafield_array=null; +if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 1bc0fa6a60e..cad29aa3252 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -116,7 +116,8 @@ $line_fields = array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('commandedet',true); -if (count($extrafields)>0) { +$extrafield_line_array=null; +if (is_array($extrafields) && count($extrafields)>0) { $extrafield_line_array = array(); } foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index cf926c6409e..0df33d5955f 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -134,7 +134,8 @@ $productorservice_fields = array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); -if (count($extrafields)>0) { +$extrafield_array=null; +if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 5400e069c3f..bd2659306bc 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -163,7 +163,8 @@ $project_fields = array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('project',true); -if (count($extrafields)>0) { +$extrafield_array=null; +if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } foreach($extrafields->attribute_label as $key=>$label) diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 6b2c94a36fd..a367020e6d4 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -124,7 +124,8 @@ $thirdparty_fields= array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('societe',true); -if (count($extrafields)>0) { +$extrafield_array=null; +if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } foreach($extrafields->attribute_label as $key=>$label) @@ -780,7 +781,7 @@ function deleteThirdParty($authentication,$id='',$ref='',$ref_ext='') $errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; } dol_syslog("Function: deleteThirdParty 1"); - + if (! $error) { $fuser->getrights(); @@ -789,21 +790,21 @@ function deleteThirdParty($authentication,$id='',$ref='',$ref_ext='') { $thirdparty=new Societe($db); $result=$thirdparty->fetch($id,$ref,$ref_ext); - + if ($result > 0) { $db->begin(); - + $result=$thirdparty->delete($thirdparty->id, $fuser); - + if ($result > 0) { $db->commit(); - + $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); } else - { + { $db->rollback(); $error++; $errorcode='KO'; @@ -815,7 +816,7 @@ function deleteThirdParty($authentication,$id='',$ref='',$ref_ext='') { $error++; $errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; - + } } else diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 3de5ef815c9..3718378f8ce 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -187,7 +187,8 @@ $thirdpartywithuser_fields = array( // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true); -if (count($extrafields)>0) { +$extrafield_array=null; +if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } foreach($extrafields->attribute_label as $key=>$label)