From 597b36e57cb7d466934eaac24607726a7aff162e Mon Sep 17 00:00:00 2001 From: hystepik Date: Sat, 10 Jun 2023 10:47:36 +0200 Subject: [PATCH] Fix : php8.1 warnings with strict mode --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/db/DoliDB.class.php | 2 +- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d7fb02e14f3..05a7ff7a823 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1674,7 +1674,7 @@ class Propal extends CommonObject $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; $this->deposit_percent = $obj->deposit_percent; - $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4036eca225c..ebd637bd43d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1980,7 +1980,7 @@ class Commande extends CommonOrder $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); $this->lines = array(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d86c7349aa1..72b56e3920c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2244,7 +2244,7 @@ class Facture extends CommonInvoice $this->retained_warranty_date_limit = $this->db->jdate($obj->retained_warranty_date_limit); $this->retained_warranty_fk_cond_reglement = $obj->retained_warranty_fk_cond_reglement; - $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); //Incoterms $this->fk_incoterms = $obj->fk_incoterms; diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 30b3ea76975..b29b3cb7385 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -283,7 +283,7 @@ abstract class DoliDB implements Database * @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'. Note: If the quantity fo sortorder values is lower than sortfield, we used the last value for missing values. * @return string String to provide syntax of a sort sql string */ - public function order($sortfield = null, $sortorder = null) + public function order($sortfield = '', $sortorder = '') { if (!empty($sortfield)) { $oldsortorder = ''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 182f15b5aa5..8f81d15cffc 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -285,7 +285,7 @@ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { } } if ($mysoc->useLocalTax(2)) { - if (($seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) { + if (( isset($seller->country_code) && isset($buyer->thirdparty->country_code) && $seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) { $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->total_localtax2); } else { $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").'';