diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index fd5c40ed526..33ea4691b88 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -376,7 +376,7 @@ if ($mode == 'overwrite') { // If a cache for translation is on, show a warning. if (isModEnabled('memcached') || getDolGlobalInt('MAIN_USE_CACHE_FOR_TRANSLATION')) { - $infoOnTransProcess .= info_admin($langs->trans("CacheForTranslationIsUsed"), 0, 0, 1, 'warning'); + $infoOnTransProcess .= info_admin($langs->trans("CacheForTranslationIsUsed"), 0, 0, '1', 'warning'); } print $infoOnTransProcess; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d2ad124f7eb..3eea9d109c3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1080,7 +1080,7 @@ class Facture extends CommonInvoice 0, $fk_parent_line, $fk_product_fournisseur_price, - $buyprice, + is_null($buyprice) ? '' : $buyprice, // do not use (float) here, it may be '' $_facrec->lines[$i]->label, empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options, 100, // situation percent is undefined on recurring invoice lines diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 954c7bf66e9..5ed546716da 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9773,7 +9773,7 @@ abstract class CommonObject * @param float $unitPrice Product unit price * @param float $discountPercent Line discount percent * @param int $fk_product Product id - * @return float|int<-1,-1> Return buy price if OK, integer <0 if KO + * @return float|int<-2,-1> Return buy price if OK, integer <0 if KO */ public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_product = 0) { @@ -9826,7 +9826,8 @@ abstract class CommonObject } } } - return $buyPrice; + + return (float) $buyPrice; } /** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cecf472c14b..9628d02ecaa 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7058,7 +7058,7 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, * Function to format a value into an amount for visual output * Function used into PDF and HTML pages * - * @param string|float $amount Amount value to format + * @param int|float[string $amount Amount value to format * @param int<0,1> $form Type of formatting: 1=HTML, 0=no formatting (no by default) * @param Translate|string|null $outlangs Object langs for output. '' use default lang. 'none' use international separators. * @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accuracy) before being inserted into database or after a computation, so this parameter should be useless. @@ -7178,7 +7178,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ * Function to use on each input amount before any numeric test or database insert. A better name for this function * should be roundtext2num(). * - * @param string|float $amount Amount to convert/clean or round + * @param int|float|string $amount Amount to convert/clean or round * @param ''|'MU'|'MT'|'MS'|'CU'|'CT'|int<0,max> $rounding ''=No rounding * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 019c4809039..ef4663d724e 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -122,7 +122,7 @@ if ($idprod > 0) { } } - $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() + $prices[] = array("id" => 'pmpprice', "price" => price2num((float) $price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() } // Add price for costprice (at end) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 5e69da95eed..73f6fd0134f 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1149,7 +1149,7 @@ if ($resql) { } $pmp_valuation = $pmp_expected * $valuetoshow; print '