diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 37d551e2dc4..70bce59f557 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3243,7 +3243,7 @@ class Commande extends CommonOrder if ($product_stock < $qty) { $langs->load("errors"); - $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); + $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', (string) $product->ref); $this->errors[] = $this->error; dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b6f466a72d5..f1ac01ac182 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4647,7 +4647,7 @@ class Facture extends CommonInvoice if ($product_stock < $qty) { $langs->load("errors"); - $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); + $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', (string) $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 37dc1df4f6a..568188d0c13 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1913,7 +1913,7 @@ function dol_meta_create($object) if ($dir) { $object->fetch_thirdparty(); - $objectref = dol_sanitizeFileName($object->ref); + $objectref = dol_sanitizeFileName((string) $object->ref); $dir = $dir."/".$objectref; $file = $dir."/".$objectref.".meta"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c01ef4ad3e9..aad567193dc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3429,7 +3429,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } $tmptxt = $object->getLibStatut(6, $object->alreadypaid); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { - $tmptxt = $object->getLibStatut(5, $object->alreadypaid); + $tmptxt = $object->getLibStatut(5, (float) $object->alreadypaid); } $morehtmlstatus .= $tmptxt; } elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid like for invoices @@ -8831,7 +8831,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' // We will enhance here a common way of forging path for document storage. // In a future, we may distribute directories on several levels depending on setup and object. // Here, $object->id, $object->ref and $modulepart are required. - if (in_array($modulepart, array('societe', 'thirdparty')) && $object instanceOf Societe) { + if (in_array($modulepart, array('societe', 'thirdparty')) && $object instanceof Societe) { // Special case for thirdparty, where the ref is a company name that is not unique so path on disk is using the ID instead of the ref $path = dol_sanitizeFileName((string) $object->id); } else { @@ -11650,14 +11650,14 @@ function dol_eval_new($s) { // Only this global variables can be read by eval function and returned to caller global $conf, // Read of const is done with getDolGlobalString() but we need $conf->currency for example - $db, $langs, $user, $website, $websitepage, - $action, $mainmenu, $leftmenu, - $mysoc, - $objectoffield, // To allow the use of $objectoffield in computed fields + $db, $langs, $user, $website, $websitepage, + $action, $mainmenu, $leftmenu, + $mysoc, + $objectoffield, // To allow the use of $objectoffield in computed fields - // Old variables used - $object, - $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object + // Old variables used + $object, + $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object // PHP < 7.4.0 defined('T_COALESCE_EQUAL') || define('T_COALESCE_EQUAL', PHP_INT_MAX); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index b8f713dbd62..b6b4c56356f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -1179,7 +1179,7 @@ class pdf_espadon extends ModelePdfExpedition } $Yoff += 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); - $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); + $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities((string) $text), 0, 'R'); $Yoff += 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index e051869f3c8..7cc6234a744 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -1035,7 +1035,7 @@ class pdf_rouget extends ModelePdfExpedition } $Yoff += 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); - $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); + $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities((string) $text), 0, 'R'); $Yoff += 3; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 2434f07a908..3ec4f84b215 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1082,7 +1082,7 @@ class pdf_azur extends ModelePDFPropales $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } $account = new Account($this->db); - $account->fetch($bankid); + $account->fetch((int) $bankid); $curx = $this->marge_gauche; $cury = $posy; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index dd9e78421ab..21c3dcf9bcc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1250,7 +1250,7 @@ class pdf_cyan extends ModelePDFPropales $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } $account = new Account($this->db); - $account->fetch($bankid); + $account->fetch((int) $bankid); $curx = $this->marge_gauche; $cury = $posy; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ada2a2015e2..7a58f5f7a87 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -891,7 +891,7 @@ class Product extends CommonObject //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), 'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000), - 'stockable_product' =>array('type' => 'integer', 'label' => 'stockable_product', 'enabled' => 1, 'visible' => 1, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 502), + 'stockable_product' => array('type' => 'integer', 'label' => 'stockable_product', 'enabled' => 1, 'visible' => 1, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 502), ); /** @@ -1148,7 +1148,9 @@ class Product extends CommonObject $sql .= ", fk_unit"; $sql .= ", mandatory_period"; $sql .= ", stockable_product"; - if (!empty($this->default_vat_code)) $sql.=", default_vat_code"; + if (!empty($this->default_vat_code)) { + $sql .= ", default_vat_code"; + } $sql .= ") VALUES ("; $sql .= "'".$this->db->idate($this->date_creation)."'"; $sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity); @@ -1181,7 +1183,9 @@ class Product extends CommonObject $sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL'); $sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'"; $sql .= ", ".((int) $this->stockable_product); - if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'"; + if (!empty($this->default_vat_code)) { + $sql .= ", '".$this->db->escape($this->default_vat_code)."'"; + } $sql .= ")"; dol_syslog(get_class($this)."::Create", LOG_DEBUG); @@ -7233,7 +7237,7 @@ class Product extends CommonObject $return .= '