From 7a087327e123bd0418a006e0d97d56bd51787961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jan 2018 19:33:40 +0100 Subject: [PATCH] Fix deprecated code --- htdocs/core/class/extrafields.class.php | 6 +++--- htdocs/core/lib/functions.lib.php | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 139fcb65162..1cd545c409c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -624,9 +624,10 @@ class ExtraFields { $this->db->begin(); - if(is_array($param) && count($param) > 0) + if (is_array($param)) { - $param = $this->db->escape(serialize($param)); + if (count($param) > 0) $param = $this->db->escape(serialize($param)); + else $param=''; } $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; @@ -698,7 +699,6 @@ class ExtraFields { return 0; } - } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a9693c118da..713086013e4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4685,14 +4685,16 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, { global $conf; + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + // Note: possible values for tva_assuj are 0/1 or franchise/reel $seller_use_vat=((is_numeric($thirdparty_seller->tva_assuj) && ! $thirdparty_seller->tva_assuj) || (! is_numeric($thirdparty_seller->tva_assuj) && $thirdparty_seller->tva_assuj=='franchise'))?0:1; - $seller_country_code=$thirdparty_seller->country_code; - $seller_in_cee=$thirdparty_seller->isInEEC(); + $seller_country_code = $thirdparty_seller->country_code; + $seller_in_cee = isInEEC($thirdparty_seller); - $buyer_country_code=$thirdparty_buyer->country_code; - $buyer_in_cee=$thirdparty_buyer->isInEEC(); + $buyer_country_code = $thirdparty_buyer->country_code; + $buyer_in_cee = isInEEC($thirdparty_buyer); dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".$seller_in_cee.", buyer country=".$buyer_country_code.", buyer in cee=".$buyer_in_cee.", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(! empty($conf->global->SERVICES_ARE_ECOMMERCE_200238EC)?$conf->global->SERVICES_ARE_ECOMMERCE_200238EC:''));