diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index cffbffa545e..74a85dc883e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -385,7 +385,7 @@ class MyObject extends CommonObject if (!$error) { // copy external contacts if same company - if (!empty($object->socid) && ((property_exists($this, 'fk_soc') && ($this->fk_soc == $object->socid)) || (property_exists($this, 'socid') && ($this->socid == $object->socid)))) { + if (!empty($object->socid) && ((property_exists($this, 'fk_soc') && ($this->fk_soc == $object->socid)) || (property_exists($this, 'socid') && ($this->socid == $object->socid)))) { // @phpstan-ignore-line if ($this->copy_linked_contact($object, 'external') < 0) { $error++; } diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 23fa60e9928..1f21a7fcd97 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -674,7 +674,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) * Create order * * @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information - * @param array{id:string,ref:string,ref_client:string,ref_ext:string,thirdparty_id:int,status:int,billed:string,total_net:float,total_vat:float,total_localtax1:float,total_localtax2:float,total:float,date:string,date_creation:string,date_validation:string,date_modification:string,source:string,note_private:string,note_public:string,project_id:string,mode_reglement_id:string,mode_reglement_code:string,mode_reglement:string,cond_reglement_id:string,cond_reglement_code:string,cond_reglement:string,cond_reglement_doc:string,date_livraison:int,demand_reason_id:string,lines:array} $order Order info + * @param array{id:string,ref:string,ref_client:string,ref_ext:string,thirdparty_id:int,status:int,billed:string,total_net:float,total_vat:float,total_localtax1:float,total_localtax2:float,total:float,date:string,date_creation:string,date_validation:string,date_modification:string,source:string,note_private:string,note_public:string,project_id:string,mode_reglement_id:string,mode_reglement_code:string,mode_reglement:string,cond_reglement_id:string,cond_reglement_code:string,cond_reglement:string,cond_reglement_doc:string,date_livraison:int,demand_reason_id:string,lines:array} $order Order info * @return array{result:array{result_code:string,result_label:string}} Array result */ function createOrder($authentication, $order) @@ -715,6 +715,7 @@ function createOrder($authentication, $order) $newobject->note_private = $order['note_private']; $newobject->note_public = $order['note_public']; $newobject->statut = Commande::STATUS_DRAFT; // We start with status draft + $newobject->status = Commande::STATUS_DRAFT; // We start with status draft $newobject->billed = (int) $order['billed']; $newobject->fk_project = (int) $order['project_id']; $newobject->cond_reglement_id = (int) $order['cond_reglement_id'];