diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 72aab83ac21..b8cfedf697d 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -580,7 +580,7 @@ class BOM extends CommonObject
*
* @param int $fk_product Id of product
* @param float $qty Quantity
- * @param int $qty_frozen Frozen quantity
+ * @param float $qty_frozen Frozen quantity
* @param int $disable_stock_change Disable stock change on using in MO
* @param float $efficiency Efficiency in MO
* @param int $position Position of BOM-Line in BOM-Lines
@@ -689,7 +689,7 @@ class BOM extends CommonObject
*
* @param int $rowid Id of line to update
* @param float $qty Quantity
- * @param int $qty_frozen Frozen quantity
+ * @param float $qty_frozen Frozen quantity
* @param int $disable_stock_change Disable stock change on using in MO
* @param float $efficiency Efficiency in MO
* @param int $position Position of BOM-Line in BOM-Lines
@@ -1531,8 +1531,8 @@ class BOM extends CommonObject
/**
* Get Net needs by product
*
- * @param array $TNetNeeds Array of ChildBom and infos linked to
- * @param int $qty qty needed
+ * @param array $TNetNeeds Array of ChildBom and infos linked to
+ * @param float $qty qty needed
* @return void
*/
public function getNetNeeds(&$TNetNeeds = array(), $qty = 0)
@@ -1557,7 +1557,7 @@ class BOM extends CommonObject
* Get Net needs Tree by product or bom
*
* @param array $TNetNeeds Array of ChildBom and infos linked to
- * @param int $qty qty needed
+ * @param float $qty qty needed
* @param int $level level of recursivity
* @return void
*/
@@ -1763,7 +1763,7 @@ class BOMLine extends CommonObjectLine
public $qty;
/**
- * @var int qty frozen
+ * @var float qty frozen
*/
public $qty_frozen;
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 9ea34ae4d3a..6a10c7fbb14 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -413,8 +413,8 @@ class Propal extends CommonObject
* $this->thirdparty should be loaded
*
* @param int $idproduct Product Id to add
- * @param int $qty Quantity
- * @param int $remise_percent Discount effected on Product
+ * @param float $qty Quantity
+ * @param float $remise_percent Discount effected on Product
* @return int Return integer <0 if KO, >0 if OK
*
* TODO Replace calls to this function by generation object Ligne
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 17cc796ff97..7c1aabdf072 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -818,7 +818,7 @@ class Facture extends CommonInvoice
// Complete vat rate with code
$vatrate = $newinvoiceline->tva_tx;
- if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) {
+ if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
}
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index f7a2026903d..ece32e1d3a5 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -820,8 +820,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Warning
print '
';
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]." ";
- if (!empty($amounts[$invoice->id]) && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id]))
- || !empty($multicurrency_amounts[$invoice->id]) && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id]))) {
+ if (!empty($amounts[$invoice->id]) && (abs((float) $amounts[$invoice->id]) > abs((float) $amountsresttopay[$invoice->id]))
+ || !empty($multicurrency_amounts[$invoice->id]) && (abs((float) $multicurrency_amounts[$invoice->id]) > abs((float) $multicurrency_amountsresttopay[$invoice->id]))) {
print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay"));
}
print ' ';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 1202e840bd7..36763b00e96 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -3473,7 +3473,7 @@ class ContratLigne extends CommonObjectLine
$this->label = trim($this->label);
$this->description = trim($this->description);
$this->vat_src_code = trim($this->vat_src_code);
- $this->tva_tx = trim($this->tva_tx);
+ $this->tva_tx = trim((string) $this->tva_tx);
$this->localtax1_tx = trim($this->localtax1_tx);
$this->localtax2_tx = trim($this->localtax2_tx);
$this->qty = trim($this->qty);
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index ab0186f9e2f..64857afa535 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -195,7 +196,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
}
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
- $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
+ $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
$db->commit();
@@ -233,7 +234,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
continue;
}
} else {
- if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type']) && $object->fields[$key]['type']!=='checkbox') {
+ if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type']) && $object->fields[$key]['type'] !== 'checkbox') {
continue; // The field was not submitted to be saved
}
}
@@ -334,8 +335,8 @@ if ($action == 'update' && !empty($permissiontoadd)) {
$result = $object->update($user);
if ($result > 0) {
$action = 'view';
- $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
- $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
+ $urltogo = $backtopage ? str_replace('__ID__', (string) $result, $backtopage) : $backurlforlist;
+ $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
if ($urltogo && empty($noback)) {
header("Location: " . $urltogo);
exit;
diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php
index f5c38a55820..df06707fe5b 100644
--- a/htdocs/core/class/antivir.class.php
+++ b/htdocs/core/class/antivir.class.php
@@ -3,6 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo
* Copyright (C) 2004-2009 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -137,11 +138,11 @@ class AntiVir
$command = getDolGlobalString('MAIN_ANTIVIRUS_COMMAND');
$param = getDolGlobalString('MAIN_ANTIVIRUS_PARAM');
- $param = preg_replace('/%maxreclevel/', $maxreclevel, $param);
- $param = preg_replace('/%maxfiles/', $maxfiles, $param);
- $param = preg_replace('/%maxratio/', $maxratio, $param);
- $param = preg_replace('/%bz2archivememlim/', $bz2archivememlim, $param);
- $param = preg_replace('/%maxfilesize/', $maxfilesize, $param);
+ $param = preg_replace('/%maxreclevel/', (string) $maxreclevel, $param);
+ $param = preg_replace('/%maxfiles/', (string) $maxfiles, $param);
+ $param = preg_replace('/%maxratio/', (string) $maxratio, $param);
+ $param = preg_replace('/%bz2archivememlim/', (string) $bz2archivememlim, $param);
+ $param = preg_replace('/%maxfilesize/', (string) $maxfilesize, $param);
$param = preg_replace('/%file/', trim($file), $param);
if (!preg_match('/%file/', getDolGlobalString('MAIN_ANTIVIRUS_PARAM'))) {
diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php
index 2acb44310aa..f60f5c44183 100644
--- a/htdocs/core/class/comment.class.php
+++ b/htdocs/core/class/comment.class.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -239,7 +240,7 @@ class Comment extends CommonObject
// Clean parameters
if (isset($this->fk_element)) {
- $this->fk_project = (int) trim($this->fk_element);
+ $this->fk_project = (int) trim((string) $this->fk_element);
}
if (isset($this->description)) {
$this->description = trim($this->description);
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 251442a9b72..ab8c695c143 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -1044,13 +1044,13 @@ abstract class CommonDocGenerator
/**
* Rect pdf
*
- * @param TCPDF $pdf Object PDF
- * @param float $x Abscissa of first point
- * @param float $y Ordinate of first point
- * @param float $l ??
- * @param float $h ??
- * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
- * @param int $hidebottom Hide bottom
+ * @param TCPDI|TCPDF $pdf Pdf object
+ * @param float $x Abscissa of first point
+ * @param float $y Ordinate of first point
+ * @param float $l ??
+ * @param float $h ??
+ * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
+ * @param int $hidebottom Hide bottom
* @return void
*/
public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
@@ -1248,7 +1248,7 @@ abstract class CommonDocGenerator
/**
* print standard column content
*
- * @param TCPDF $pdf pdf object
+ * @param TCPDI|TCPDF $pdf Pdf object
* @param float $curY current Y position
* @param string $colKey the column key
* @param string $columnText column text
@@ -1291,7 +1291,7 @@ abstract class CommonDocGenerator
/**
* print description column content
*
- * @param TCPDF $pdf pdf object
+ * @param TCPDI|TCPDF $pdf Pdf object
* @param float $curY current Y position
* @param string $colKey the column key
* @param object $object CommonObject
@@ -1600,12 +1600,12 @@ abstract class CommonDocGenerator
/**
* Print standard column content
*
- * @param TCPDI $pdf Pdf object
- * @param float $tab_top Tab top position
- * @param float $tab_height Default tab height
- * @param Translate $outputlangs Output language
- * @param int $hidetop Hide top
- * @return float Height of col tab titles
+ * @param TCPDI|TCPDF $pdf Pdf object
+ * @param float $tab_top Tab top position
+ * @param float $tab_height Default tab height
+ * @param Translate $outputlangs Output language
+ * @param int $hidetop Hide top
+ * @return float Height of col tab titles
*/
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
{
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index a4843eff0ba..680e15fccfb 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -1908,8 +1908,8 @@ abstract class CommonInvoiceLine extends CommonObjectLine
public $vat_src_code;
/**
- * VAT %
- * @var float
+ * VAT % Vat rate can be like "21.30 (CODE)"
+ * @var string|float
*/
public $tva_tx;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 9bd531eb262..b826ea69205 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3864,7 +3864,7 @@ abstract class CommonObject
$diff = price2num($total_tva_by_vats[$obj->vatrate] - $tmpvat, 'MT', 1);
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")." \n";
if ($diff) {
- if (abs($diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) {
+ if (abs((float) $diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) {
// If error is more than 10 times the accuracy of rounding. This should not happen.
$errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your lines may be corrupted. Try to edit each line manually to fix this before restarting.';
dol_syslog($errmsg, LOG_WARNING);
@@ -7413,7 +7413,7 @@ abstract class CommonObject
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
- $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]);
} else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
@@ -7592,7 +7592,7 @@ abstract class CommonObject
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
- $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]);
} else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 9f87c8bccc1..56fad852290 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1258,7 +1258,7 @@ class ExtraFields
if (!empty($InfoFieldList[4])) {
// can use current entity filter
if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
- $InfoFieldList[4] = str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace('$ENTITY$', (string) $conf->entity, $InfoFieldList[4]);
}
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -1267,7 +1267,7 @@ class ExtraFields
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
- $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]);
} else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
@@ -1428,7 +1428,7 @@ class ExtraFields
if (!empty($InfoFieldList[4])) {
// can use current entity filter
if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
- $InfoFieldList[4] = str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace('$ENTITY$', (string) $conf->entity, $InfoFieldList[4]);
}
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -1437,7 +1437,7 @@ class ExtraFields
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
- $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
+ $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]);
} elseif (preg_match("#^.*list.php$#", $_SERVER["PHP_SELF"])) {
// Pattern for word=$ID$
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 019930cc28d..6850bdb80b8 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -7057,10 +7057,8 @@ class Form
$retstring .= ' ';
}
for ($min = 0; $min < 60; $min += $stepminutes) {
- if (strlen($min) < 2) {
- $min = "0" . $min;
- }
- $retstring .= '' . $min . ' ';
+ $min_str = sprintf("%02d", $min);
+ $retstring .= '' . $min_str . ' ';
}
$retstring .= '';
@@ -8827,7 +8825,7 @@ class Form
// submitted to nothing.
$out .= ' ';
// Output select component
- $out .= '' . "\n";
+ $out .= '' . "\n";
if (is_array($array) && !empty($array)) {
if ($value_as_key) {
$array = array_combine($array, $array);
diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php
index 6b00c3bc17b..3b10ea563a1 100644
--- a/htdocs/core/class/utils.class.php
+++ b/htdocs/core/class/utils.class.php
@@ -1228,7 +1228,7 @@ class Utils
} elseif (is_string($row[$j]) && $row[$j] == '') {
// if it's an empty string, we set it as an empty string
$row[$j] = "''";
- } elseif (is_numeric($row[$j]) && !strcmp($row[$j], $row[$j] + 0)) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
+ } elseif (is_numeric($row[$j]) && !strcmp((string) $row[$j], (string) ($row[$j] + 0))) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
// if it's a number, we return it as-is
// $row[$j] = $row[$j];
} else { // else for all other cases we escape the value and put quotes around
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index ecb9b0f0df9..cba500c0a0e 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -8,6 +8,7 @@
* Copyright (C) 2012 Yann Droneaud
* Copyright (C) 2012 Florian Henry
* Copyright (C) 2015 Marcos García
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -416,7 +417,7 @@ class DoliDBPgsql extends DoliDB
$login = str_replace(array("\\", "'"), array("\\\\", "\\'"), $login);
$passwd = str_replace(array("\\", "'"), array("\\\\", "\\'"), $passwd);
$name = str_replace(array("\\", "'"), array("\\\\", "\\'"), $name);
- $port = str_replace(array("\\", "'"), array("\\\\", "\\'"), $port);
+ $port = str_replace(array("\\", "'"), array("\\\\", "\\'"), (string) $port);
if (!$name) {
$name = "postgres"; // When try to connect using admin user
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 0bbe8499662..f50649ba55b 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2005-2018 Laurent Destailleur
* Copyright (C) 2005-2014 Regis Houssin
* Copyright (C) 2015 Raphaël Doursenaud
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1162,7 +1163,7 @@ function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + deci
*
*/
function pricejs(amount, mode = 'MT', currency_code = '', force_locale = '') {
- var main_max_dec_shown = ;
+ var main_max_dec_shown = ;
var main_rounding_unit = ;
var main_rounding_tot = ;
var main_decimal_separator = ;
@@ -1240,7 +1241,7 @@ function price2numjs(amount) {
var dec = ;
var thousand = ;
- var main_max_dec_shown = ;
+ var main_max_dec_shown = ;
var main_rounding_unit = ;
var main_rounding_tot = ;
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 36cb26e4b6d..b290bb713eb 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -1385,7 +1385,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if (!empty($yearoffsettype) && !is_numeric($yearoffsettype) && $yearoffsettype != '=') { // yearoffsettype is - or +, so we don't want current year
$numFinal = preg_replace('/\{yyyy\}/i', (string) ((int) date("Y", $date) + $yearoffset), $numFinal);
$numFinal = preg_replace('/\{yy\}/i', (string) ((int) date("y", $date) + $yearoffset), $numFinal);
- $numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1) + $yearoffset, $numFinal);
+ $numFinal = preg_replace('/\{y\}/i', (string) ((int) substr((string) date("y", $date), 1, 1) + $yearoffset), $numFinal);
} else { // we want yyyy to be current year
$numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date), $numFinal);
$numFinal = preg_replace('/\{yy\}/i', date("y", $date), $numFinal);
diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php
index 7e1f5f1ed31..7e16ff46de1 100644
--- a/htdocs/core/lib/functionsnumtoword.lib.php
+++ b/htdocs/core/lib/functionsnumtoword.lib.php
@@ -43,7 +43,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
return false;
}
- if ($centimes && strlen($num) == 1) {
+ if ($centimes && strlen((string) $num) == 1) {
$num = $num * 10;
}
@@ -105,7 +105,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
$langs->transnoentitiesnoconv('quadrillion')
);
- $num_length = strlen($num);
+ $num_length = strlen((string) $num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index d7bc551cd5c..62131255b72 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -123,7 +123,7 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup')
* @param string $format Array(width,height). Keep empty to use default setup.
* @param string $metric Unit of format ('mm')
* @param string $pagetype 'P' or 'l'
- * @return TCPDF PDF object
+ * @return TCPDF|TCPDI PDF object
*/
function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P')
{
diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php
index 0d448eb4142..9da3eaf69c2 100644
--- a/htdocs/core/lib/price.lib.php
+++ b/htdocs/core/lib/price.lib.php
@@ -6,6 +6,7 @@
* Copyright (C) 2012 Cédric Salvador
* Copyright (C) 2012-2014 Raphaël Doursenaud
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,7 +38,7 @@
* '5' : local tax apply on services without vat (localtax is calculated on amount without tax)
* '6' : local tax apply on services including vat (localtax is calculated on amount + tax)
*
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param float $pu Unit price (HT or TTC depending on price_base_type. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2)
* @param float $remise_percent_ligne Discount for line
* @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array)
diff --git a/htdocs/core/lib/profid.lib.php b/htdocs/core/lib/profid.lib.php
index 88c21d2f4d7..fa5a75aae7e 100644
--- a/htdocs/core/lib/profid.lib.php
+++ b/htdocs/core/lib/profid.lib.php
@@ -204,7 +204,7 @@ function isValidTinForES($str)
for ($i = 1; $i < 8; $i += 2) {
$sum += intval(substr((string) (2 * $num[$i]), 0, 1)) + intval(substr((string) (2 * $num[$i]), 1, 1));
}
- $n = 10 - substr((string) $sum, strlen($sum) - 1, 1);
+ $n = 10 - substr((string) $sum, strlen((string) $sum) - 1, 1);
//Check special NIF
if (preg_match('/^[KLM]{1}/', $str)) {
@@ -217,7 +217,7 @@ function isValidTinForES($str)
//Check CIF
if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $str)) {
- if ($num[8] == chr(64 + $n) || $num[8] == substr((string) $n, strlen($n) - 1, 1)) {
+ if ($num[8] == chr(64 + $n) || $num[8] == substr((string) $n, strlen((string) $n) - 1, 1)) {
return 2;
} else {
return -2;
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index f3c8910f646..10b86bc497c 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -1097,7 +1097,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Budget task
if (count($arrayfields) > 0 && !empty($arrayfields['t.budget_amount']['checked'])) {
print '';
- if (strcmp($total_budget_amount, '')) {
+ if (strcmp((string) $total_budget_amount, '')) {
print price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
}
print ' ';
@@ -2527,7 +2527,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$project_year_filter = 0;
$title = $langs->trans("Projects");
- if (strcmp($status, '') && $status >= 0) {
+ if (!strcmp((string) $status, '') && $status >= 0) {
$title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
}
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 94efaf2864a..706ccde141f 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -376,7 +376,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$objectid = 0;
}
if ($objectid) {
- $objectid = preg_replace('/[^0-9\.\,]/', '', $objectid); // For the case value is coming from a non sanitized user input
+ $objectid = preg_replace('/[^0-9\.\,]/', '', (string) $objectid); // For the case value is coming from a non sanitized user input
}
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php
index 593f050d4c7..fde4d4128f9 100644
--- a/htdocs/core/login/functions_ldap.php
+++ b/htdocs/core/login/functions_ldap.php
@@ -1,6 +1,7 @@
* Copyright (C) 2008-2021 Regis Houssin
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -247,7 +248,9 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
*/
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP for '".$usertotest."'", LOG_NOTICE);
if (is_resource($ldap->connection) || is_object($ldap->connection)) { // If connection ok but bind ko
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal Expects LDAP\Connection, not 'resource'
$ldap->ldapErrorCode = ldap_errno($ldap->connection);
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal Expects LDAP\Connection, not 'resource'
$ldap->ldapErrorText = ldap_error($ldap->connection);
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
}
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index fafec559fad..c4165030427 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -8,6 +8,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017-2018 Ferran Marcet
* Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -723,7 +724,7 @@ class pdf_einstein extends ModelePDFCommandes
$lib_condition_paiement = ($outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
if ($object->deposit_percent > 0) {
- $lib_condition_paiement = str_replace('__DEPOSIT_PERCENT__', $object->deposit_percent, $lib_condition_paiement);
+ $lib_condition_paiement = str_replace('__DEPOSIT_PERCENT__', (string) $object->deposit_percent, $lib_condition_paiement);
}
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
@@ -938,8 +939,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
@@ -970,8 +971,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
@@ -1033,8 +1034,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
@@ -1068,8 +1069,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index 4b9e85e2589..7eb01987cf1 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -8,6 +8,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
* Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -930,7 +931,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$lib_condition_paiement = ($outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
if ($object->deposit_percent > 0) {
- $lib_condition_paiement = str_replace('__DEPOSIT_PERCENT__', $object->deposit_percent, $lib_condition_paiement);
+ $lib_condition_paiement = str_replace('__DEPOSIT_PERCENT__', (string) $object->deposit_percent, $lib_condition_paiement);
}
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
@@ -1140,8 +1141,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
@@ -1172,8 +1173,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
@@ -1235,8 +1236,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
@@ -1270,8 +1271,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php
index 73eac71322f..9173655e122 100644
--- a/htdocs/core/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/core/modules/dons/html_cerfafr.modules.php
@@ -5,6 +5,7 @@
* Copyright (C) 2012 Marcos García
* Copyright (C) 2014-2020 Alexandre Spangaro
* Copyright (C) 2015 Benoit Bruchard
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -151,7 +152,7 @@ class html_cerfafr extends ModeleDon
// Define contents
$donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_cerfafr.html";
$form = implode('', file($donmodel));
- $form = str_replace('__REF__', $don->id, $form);
+ $form = str_replace('__REF__', (string) $don->id, $form);
$form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form);
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
$form = str_replace('__AMOUNT__', price($don->amount), $form);
@@ -166,7 +167,7 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__DONATOR_FIRSTNAME__', $don->firstname, $form);
$form = str_replace('__DONATOR_LASTNAME__', $don->lastname, $form);
$form = str_replace('__DONATOR_SOCIETE__', $don->societe, $form);
- $form = str_replace('__DONATOR_STATUT__', $don->statut, $form);
+ $form = str_replace('__DONATOR_STATUT__', (string) $don->statut, $form);
$form = str_replace('__DONATOR_ADDRESS__', $don->address, $form);
$form = str_replace('__DONATOR_ZIP__', $don->zip, $form);
$form = str_replace('__DONATOR_TOWN__', $don->town, $form);
diff --git a/htdocs/core/modules/dons/html_generic.modules.php b/htdocs/core/modules/dons/html_generic.modules.php
index 49bd1a7a29a..2f3b8ae30cd 100644
--- a/htdocs/core/modules/dons/html_generic.modules.php
+++ b/htdocs/core/modules/dons/html_generic.modules.php
@@ -6,6 +6,7 @@
* Copyright (C) 2014-2020 Alexandre Spangaro
* Copyright (C) 2015 Benoit Bruchard
* Copyright (C) 2015 Benjamin Neumann
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -123,7 +124,7 @@ class html_generic extends ModeleDon
$donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_generic.html";
$form = implode('', file($donmodel));
$form = str_replace('__NOW__', dol_print_date($now, 'day', false, $outputlangs), $form);
- $form = str_replace('__REF__', $don->id, $form);
+ $form = str_replace('__REF__', (string) $don->id, $form);
$form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form);
$form = str_replace('__BENEFICIARY_NAME__', $mysoc->name, $form);
@@ -227,7 +228,7 @@ class html_generic extends ModeleDon
if (file_exists($dir)) {
$this->saveFile($file, $this->getContents($don, $outputlangs, $currency));
- $this->result = array('fullpath'=>$file);
+ $this->result = array('fullpath' => $file);
return 1;
} else {
diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
index afbd1664e96..63938b77da2 100644
--- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php
+++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
@@ -152,12 +152,12 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
}
} else {
$newref = 1;
- while (strlen($newref) < $num_car) {
+ while (strlen((string) $newref) < $num_car) {
$newref = "0".$newref;
}
}
- $ref_number_int = ($newref + 1) - 1;
+ $ref_number_int = (int) $newref;
$user_author_infos = dolGetFirstLastname($fuser->firstname, $fuser->lastname);
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 4be06d41f7d..2af6846e4e4 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -11,6 +11,7 @@
* Copyright (C) 2018-2020 Frédéric France
* Copyright (C) 2022 Anthony Berton
* Copyright (C) 2022 Charlene Benke
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1413,8 +1414,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
@@ -1447,8 +1448,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
@@ -1511,8 +1512,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
@@ -1543,8 +1544,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index b4e95f3fa18..24888f2b052 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -1675,8 +1675,8 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
@@ -1709,8 +1709,8 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
@@ -1796,8 +1796,8 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
@@ -1831,8 +1831,8 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
index 81e910d4e19..5d6e29c13d1 100644
--- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
+++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
@@ -6,6 +6,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
* Copyright (C) 2018-2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -847,7 +848,7 @@ class pdf_vinci extends ModelePDFMo
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
- $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
+ $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@@ -877,7 +878,7 @@ class pdf_vinci extends ModelePDFMo
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
- $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
+ $totalvat .= vatrate(abs((float) $tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php
index b09f6bc3ff5..c3e3aa36648 100644
--- a/htdocs/core/modules/product_batch/mod_lot_standard.php
+++ b/htdocs/core/modules/product_batch/mod_lot_standard.php
@@ -104,7 +104,7 @@ class mod_lot_standard extends ModeleNumRefBatch
$max = 0;
}
}
- if ($max && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $max)) {
+ if ($max && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', (string) $max)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorNumRefModel', $max);
return false;
diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php
index 6f5f673562e..4354bb57328 100644
--- a/htdocs/core/modules/product_batch/mod_sn_standard.php
+++ b/htdocs/core/modules/product_batch/mod_sn_standard.php
@@ -104,7 +104,7 @@ class mod_sn_standard extends ModeleNumRefBatch
$max = 0;
}
}
- if ($max && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $max)) {
+ if ($max && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', (string) $max)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorNumRefModel', $max);
return false;
diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
index 7ff56fc4a2c..3327e63506d 100644
--- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
@@ -3,6 +3,7 @@
* Copyright (C) 2010-2014 Laurent Destailleur
* Copyright (C) 2015 Marcos García
* Copyright (C) 2018-2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -714,8 +715,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
@@ -739,8 +740,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
index f46c832db98..1861620567d 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
@@ -7,6 +7,7 @@
* Copyright (C) 2017 Ferran Marcet
* Copyright (C) 2018-2024 Frédéric France
* Copyright (C) 2023 William Mead
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1015,8 +1016,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
@@ -1045,8 +1046,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
index 8b735fd88e3..405ab5933b4 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
@@ -6,6 +6,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
* Copyright (C) 2018-2023 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -891,8 +892,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
@@ -921,8 +922,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
- if (preg_match('/\*/', $tvakey)) {
- $tvakey = str_replace('*', '', $tvakey);
+ if (preg_match('/\*/', (string) $tvakey)) {
+ $tvakey = str_replace('*', '', (string) $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php
index d57a25e96ba..9b964889136 100644
--- a/htdocs/delivery/class/delivery.class.php
+++ b/htdocs/delivery/class/delivery.class.php
@@ -633,7 +633,7 @@ class Delivery extends CommonObject
* Add line
*
* @param int $origin_id Origin id
- * @param int $qty Qty
+ * @param float $qty Qty
* @param array $array_options Array options
* @return void
*/
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index dac6efee52c..3f01aceb4e0 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -493,7 +493,7 @@ class Expedition extends CommonObject
*
* @param int $entrepot_id Id of warehouse
* @param int $origin_line_id Id of source line
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $rang Rang
* @param array $array_options extrafields array
* @return int Return integer <0 if KO, line_id if OK
@@ -895,7 +895,7 @@ class Expedition extends CommonObject
*
* @param int $entrepot_id Id of warehouse
* @param int $id Id of source line (order line)
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param array $array_options extrafields array
* @return int Return integer <0 if KO, >0 if OK
*/
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index a809866be18..0a3dffdf3dc 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -8,6 +8,7 @@
* Copyright (C) 2016-2023 Charlene Benke
* Copyright (C) 2019-2024 Frédéric France
* Copyright (C) 2020 Pierre Ardoin
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -224,7 +225,7 @@ class ProductFournisseur extends Product
$this->db = $db;
$langs->load("suppliers");
- $this->reputations = array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'), 'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
+ $this->reputations = array('-1' => '', 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -512,7 +513,7 @@ class ProductFournisseur extends Product
$productfournisseurprice = new ProductFournisseurPrice($this->db);
$res = $productfournisseurprice->fetch($this->product_fourn_price_id);
if ($res > 0) {
- foreach ($options as $key=>$value) {
+ foreach ($options as $key => $value) {
$productfournisseurprice->array_options[$key] = $value;
}
$res = $productfournisseurprice->update($user);
@@ -616,7 +617,7 @@ class ProductFournisseur extends Product
$productfournisseurprice = new ProductFournisseurPrice($this->db);
$res = $productfournisseurprice->fetch($this->product_fourn_price_id);
if ($res > 0) {
- foreach ($options as $key=>$value) {
+ foreach ($options as $key => $value) {
$productfournisseurprice->array_options[$key] = $value;
}
$res = $productfournisseurprice->update($user);
@@ -881,7 +882,7 @@ class ProductFournisseur extends Product
* Load properties for minimum price
*
* @param int $prodid Product id
- * @param int $qty Minimum quantity
+ * @param float $qty Minimum quantity
* @param int $socid get min price for specific supplier
* @return int Return integer <0 if KO, 0=Not found of no product id provided, >0 if OK
* @see list_product_fournisseur_price()
@@ -1391,7 +1392,7 @@ class ProductFournisseur extends Product
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
- $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
+ $parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 17aa0d9a6bb..22dd897127c 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -4447,7 +4447,7 @@ class Product extends CommonObject
*
* @param int $id_pere Id of parent product/service
* @param int $id_fils Id of child product/service
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @param int $notrigger Disable triggers
* @return int Return integer < 0 if KO, > 0 if OK
@@ -4520,7 +4520,7 @@ class Product extends CommonObject
*
* @param int $id_pere Id of parent product/service
* @param int $id_fils Id of child product/service
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @param int $notrigger Disable triggers
* @return int Return integer < 0 if KO, > 0 if OK
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index e49a1904246..d4899512a9d 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -166,7 +166,7 @@ class MouvementStock extends CommonObject
* @param User $user User object
* @param int $fk_product Id of product
* @param int $entrepot_id Id of warehouse
- * @param int $qty Qty of movement (can be <0 or >0 depending on parameter type)
+ * @param float $qty Qty of movement (can be <0 or >0 depending on parameter type)
* @param int $type Direction of movement:
* 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer),
* 2=output (stock decrease), 3=input (stock increase)
@@ -747,7 +747,7 @@ class MouvementStock extends CommonObject
* @param User $user Object user
* @param int $idProduct Id product
* @param int $entrepot_id Warehouse id
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $type Type
* @param int $price Price
* @param string $label Label of movement
@@ -810,7 +810,7 @@ class MouvementStock extends CommonObject
* @param User $user Object user
* @param int $fk_product Id product
* @param int $entrepot_id Warehouse id
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $price Price
* @param string $label Label of stock movement
* @param int|string $datem Force date of movement
@@ -837,7 +837,7 @@ class MouvementStock extends CommonObject
* @param User $user Object user
* @param int $fk_product Id product
* @param int $entrepot_id Warehouse id
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $price Price
* @param string $label Label of stock movement
* @param integer|string $eatby eat-by date
@@ -893,7 +893,7 @@ class MouvementStock extends CommonObject
* @param array|int $dluo Could be either
* - int if row id of product_batch table (for update)
* - or complete array('fk_product_stock'=>, 'batchnumber'=>)
- * @param int $qty Quantity of product with batch number. May be a negative amount.
+ * @param float $qty Quantity of product with batch number. May be a negative amount.
* @return int Return integer <0 if KO, -2 if we try to update a product_batchid that does not exist, else return productbatch id
*/
private function createBatch($dluo, $qty)
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 5a9257f8259..c0a57b045f7 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -817,7 +817,7 @@ class Reception extends CommonObject
*
* @param int $entrepot_id Id of warehouse
* @param int $id Id of source line (supplier order line)
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param array $array_options extrafields array
* @param string $comment Comment for stock movement
* @param int $eatby eat-by date
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 05f790292a4..06b5a8078cf 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -16,6 +16,7 @@
* Copyright (C) 2019-2024 Frédéric France
* Copyright (C) 2020 Tobias Sekan
* Copyright (C) 2022 Gauthier VERDOL
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -244,7 +245,7 @@ class SupplierProposal extends CommonObject
* Add line into array ->lines
*
* @param int $idproduct Product Id to add
- * @param int $qty Quantity
+ * @param float $qty Quantity
* @param int $remise_percent Discount effected on Product
* @return int Return integer <0 if KO, >0 if OK
*
@@ -1164,7 +1165,7 @@ class SupplierProposal extends CommonObject
if (!$error) {
// Hook of thirdparty module
if (is_object($hookmanager)) {
- $parameters = array('objFrom'=>$objFrom);
+ $parameters = array('objFrom' => $objFrom);
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@@ -2588,7 +2589,7 @@ class SupplierProposal extends CommonObject
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
- $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
+ $parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@@ -2781,7 +2782,7 @@ class SupplierProposal extends CommonObject
$return .= ''.$langs->trans("DateEnd").' : '.dol_print_date($this->delivery_date).' ';
}
if (property_exists($this, 'total_ttc')) {
- $return .=''.$langs->trans("AmountHT").' : '.price($this->total_ttc).' ';
+ $return .= ''.$langs->trans("AmountHT").' : '.price($this->total_ttc).' ';
}
if (method_exists($this, 'getLibStatut')) {
$return .= ''.$this->getLibStatut(3).'
';