diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a1a3b9306bb..13dd05eff14 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1510,11 +1510,11 @@ class Societe extends CommonObject $this->capital = ($this->capital != '') ? (float) price2num(trim((string) $this->capital)) : null; - $this->effectif_id = (int) trim((string) $this->effectif_id); - $this->forme_juridique_code = (int) trim((string) $this->forme_juridique_code); + $this->effectif_id = (int) $this->effectif_id; + $this->forme_juridique_code = (int) $this->forme_juridique_code; //Gencod - $this->barcode = trim($this->barcode); + $this->barcode = trim((string) $this->barcode); // For automatic creation if ($this->code_client == -1 || $this->code_client === 'auto') { @@ -1524,10 +1524,10 @@ class Societe extends CommonObject $this->get_codefournisseur($this, 1); } - $this->accountancy_code_customer_general = trim($this->accountancy_code_customer_general); - $this->code_compta_client = trim($this->code_compta_client); - $this->accountancy_code_supplier_general = trim($this->accountancy_code_supplier_general); - $this->code_compta_fournisseur = trim($this->code_compta_fournisseur); + $this->accountancy_code_customer_general = trim((string) $this->accountancy_code_customer_general); + $this->code_compta_client = trim((string) $this->code_compta_client); + $this->accountancy_code_supplier_general = trim((string) $this->accountancy_code_supplier_general); + $this->code_compta_fournisseur = trim((string) $this->code_compta_fournisseur); // Check parameters. More tests are done later in the ->verify() if (!is_numeric($this->client) && !is_numeric($this->fournisseur)) { @@ -1563,15 +1563,15 @@ class Societe extends CommonObject } //Web services - $this->webservices_url = $this->webservices_url ? clean_url($this->webservices_url, 0) : ''; - $this->webservices_key = trim($this->webservices_key); + $this->webservices_url = empty($this->webservices_url) ? '' : clean_url($this->webservices_url, 0); + $this->webservices_key = trim((string) $this->webservices_key); $this->accountancy_code_buy = (empty($this->accountancy_code_buy) ? '' : trim($this->accountancy_code_buy)); $this->accountancy_code_sell = (empty($this->accountancy_code_sell) ? '' : trim($this->accountancy_code_sell)); //Incoterms $this->fk_incoterms = (int) $this->fk_incoterms; - $this->location_incoterms = trim($this->location_incoterms); + $this->location_incoterms = trim((string) $this->location_incoterms); $this->db->begin();