'."\n";
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 36320d98fb5..f0c1d6c19aa 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1102,7 +1102,7 @@ function GETPOSTINT($paramname, $method = 0)
* Return the value of a $_GET or $_POST supervariable, converted into float.
*
* @param string $paramname Name of the $_GET or $_POST parameter
- * @param string|int $rounding Type of rounding ('', 'MU', 'MT, 'MS', 'CU', 'CT', integer) {@see price2num()}
+ * @param ''|'MU'|'MT'|'MS'|'CU'|'CT'|int $rounding Type of rounding ('', 'MU', 'MT, 'MS', 'CU', 'CT', integer) {@see price2num()}
* @return float Value converted into float
* @since Dolibarr V20
*/
@@ -6670,8 +6670,8 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0,
* @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.
- * @param int $rounding MINIMUM number of decimal to show: 0=no change, -1=we use min(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), getDolGlobalString('MAIN_MAX_DECIMALS_TOT'))
- * @param int|string $forcerounding MAXIMUM number of decimal to forcerounding decimal: -1=no change, -2=keep non zero part, 'MU' or 'MT' or a numeric to round to MU or MT or to a given number of decimal
+ * @param int<-1,max> $rounding MINIMUM number of decimal to show: 0=no change, -1=we use min(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), getDolGlobalString('MAIN_MAX_DECIMALS_TOT'))
+ * @param ''|'MU'|'MT'|'MS'|'CU'|'CT'|int<-2,max> $forcerounding MAXIMUM number of decimal to forcerounding decimal: -1=no change, -2=keep non zero part, 'MU' or 'MT' or a numeric to round to MU or MT or to a given number of decimal
* @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency)
* @return string String with formatted amount
*
@@ -6786,14 +6786,14 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
* should be roundtext2num().
*
* @param string|float $amount Amount to convert/clean or round
- * @param string|int $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)
- * 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
- * 'CU'=Round to Max unit price of foreign currency accuracy
- * 'CT'=Round to Max for totals with Tax of foreign currency accuracy
- * Numeric = Nb of digits for rounding (For example 2 for a percentage)
- * @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
+ * @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)
+ * 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
+ * 'CU'=Round to Max unit price of foreign currency accuracy
+ * 'CT'=Round to Max for totals with Tax of foreign currency accuracy
+ * Numeric = Nb of digits for rounding (For example 2 for a percentage)
+ * @param int<0,2> $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
* Put 2 if you know that number is a user input (so we know we have to fix decimal separator).
* @return string Amount with universal numeric format (Example: '99.99999'), or error message.
* If conversion fails to return a numeric, it returns:
@@ -6931,7 +6931,7 @@ function price2num($amount, $rounding = '', $option = 0)
* @param int $unit Unit scale of dimension (Example: 0=kg, -3=g, -6=mg, 98=ounce, 99=pound, ...)
* @param string $type 'weight', 'volume', ...
* @param Translate $outputlangs Translate language object
- * @param int $round -1 = non rounding, x = number of decimal
+ * @param int<-1,max> $round -1 = non rounding, x = number of decimal
* @param string $forceunitoutput 'no' or numeric (-3, -6, ...) compared to $unit (In most case, this value is value defined into $conf->global->MAIN_WEIGHT_DEFAULT_UNIT)
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
* @return string String to show dimensions
diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php
index 1d4df75aaf2..5319b83156e 100644
--- a/htdocs/core/modules/project/mod_project_simple.php
+++ b/htdocs/core/modules/project/mod_project_simple.php
@@ -123,7 +123,7 @@ class mod_project_simple extends ModeleNumRefProjects
/**
* Return next value
*
- * @param Societe $objsoc Object third party
+ * @param ?Societe $objsoc Object third party
* @param Project $project Object project
* @return string|int<-1,0> Value if OK, 0 if KO
*/
diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php
index 93215ba2bf0..2be62efa5f3 100644
--- a/htdocs/core/modules/project/mod_project_universal.php
+++ b/htdocs/core/modules/project/mod_project_universal.php
@@ -133,7 +133,7 @@ class mod_project_universal extends ModeleNumRefProjects
/**
* Return next value
*
- * @param Societe $objsoc Object third party
+ * @param ?Societe $objsoc Object third party
* @param Project $project Object project
* @return string|int<-1,0> Value if OK, 0 if KO
*/
diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php
index 92bd6d61c77..48885f0e4c7 100644
--- a/htdocs/core/modules/project/modules_project.php
+++ b/htdocs/core/modules/project/modules_project.php
@@ -87,7 +87,7 @@ abstract class ModeleNumRefProjects extends CommonNumRefGenerator
/**
* Return next value
*
- * @param Societe $objsoc Object third party
+ * @param ?Societe $objsoc Object third party
* @param Project $project Object project
* @return string|int<-1,0> Value if OK, 0 if KO
*/
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index a2634994085..331ff7d85fc 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -518,14 +518,14 @@ if (empty($reshook)) {
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
$object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
if ($object->price_base_type == 'TTC') {
- $object->price_ttc = GETPOST('price');
+ $object->price_ttc = GETPOSTFLOAT('price');
} else {
- $object->price = GETPOST('price');
+ $object->price = GETPOSTFLOAT('price');
}
if ($object->price_base_type == 'TTC') {
- $object->price_min_ttc = GETPOST('price_min');
+ $object->price_min_ttc = GETPOSTFLOAT('price_min');
} else {
- $object->price_min = GETPOST('price_min');
+ $object->price_min = GETPOSTFLOAT('price_min');
}
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
@@ -570,13 +570,13 @@ if (empty($reshook)) {
$object->localtax2_type = $localtax2_type;
$object->type = $type;
- $object->status = GETPOST('statut');
- $object->status_buy = GETPOST('statut_buy');
- $object->status_batch = GETPOST('status_batch');
+ $object->status = GETPOSTINT('statut');
+ $object->status_buy = GETPOSTINT('statut_buy');
+ $object->status_batch = GETPOSTINT('status_batch');
$object->sell_or_eat_by_mandatory = GETPOSTINT('sell_or_eat_by_mandatory');
$object->batch_mask = GETPOST('batch_mask');
- $object->barcode_type = GETPOST('fk_barcode_type');
+ $object->barcode_type = GETPOSTINT('fk_barcode_type');
$object->barcode = GETPOST('barcode');
// Set barcode_type_xxx from barcode_type id
$stdobject = new GenericObject($db);
@@ -821,7 +821,7 @@ if (empty($reshook)) {
$object->fk_unit = null;
}
- $object->barcode_type = GETPOST('fk_barcode_type');
+ $object->barcode_type = GETPOSTINT('fk_barcode_type');
$object->barcode = GETPOST('barcode');
// Set barcode_type_xxx from barcode_type id
$stdobject = new GenericObject($db);
@@ -1183,7 +1183,7 @@ if (empty($reshook)) {
'',
'',
'',
- 0,
+ array(),
$object->fk_unit
);
if ($result > 0) {
@@ -1344,7 +1344,7 @@ if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM'))
}
if ($res > 0) {
$modBarCodeProduct = new $module();
- '@phan-var-force ModeleBarCode $modBarCodeProduct';
+ '@phan-var-force ModeleNumRefBarCode $modBarCodeProduct';
}
}
diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php
index 27636098c5a..b0f9850423f 100644
--- a/htdocs/product/class/productfournisseurprice.class.php
+++ b/htdocs/product/class/productfournisseurprice.class.php
@@ -120,39 +120,141 @@ class ProductFournisseurPrice extends CommonObject
'fk_barcode_type' => array('type' => 'integer', 'label' => 'Fkbarcodetype', 'enabled' => '1', 'position' => 175, 'notnull' => 0, 'visible' => -1,),
'packaging' => array('type' => 'varchar(64)', 'label' => 'Packaging', 'enabled' => '1', 'position' => 180, 'notnull' => 0, 'visible' => -1,),
);
+ /**
+ * @var int
+ */
public $rowid;
+ /**
+ * @var int
+ */
public $entity;
+ /**
+ * @var int|string
+ */
public $datec;
+ /**
+ * @var int
+ */
public $fk_product;
+ /**
+ * @var int
+ */
public $fk_soc;
+ /**
+ * @var string
+ */
public $ref_fourn;
+ /**
+ * @var string
+ */
public $desc_fourn;
+ /**
+ * @var int
+ */
public $fk_availability;
+ /**
+ * @var float
+ */
public $price;
+ /**
+ * @var float
+ */
public $quantity;
+ /**
+ * @var float
+ */
public $remise_percent;
+ /**
+ * @var float
+ */
public $remise;
+ /**
+ * @var float
+ */
public $unitprice;
+ /**
+ * @var float
+ */
public $charges;
+ /**
+ * @var string
+ */
public $default_vat_code;
+ /**
+ * @var float
+ */
public $tva_tx;
+ /**
+ * @var int
+ */
public $info_bits;
+ /**
+ * @var int
+ */
public $fk_user;
+ /**
+ * @var int
+ */
public $fk_supplier_price_expression;
+ /**
+ * @var string
+ */
public $import_key;
+ /**
+ * @var int
+ */
public $delivery_time_days;
+ /**
+ * @var string
+ */
public $supplier_reputation;
+ /**
+ * @var int
+ */
public $fk_multicurrency;
+ /**
+ * @var string
+ */
public $multicurrency_code;
+ /**
+ * @var float
+ */
public $multicurrency_tx;
+ /**
+ * @var float
+ */
public $multicurrency_price;
+ /**
+ * @var float
+ */
public $multicurrency_unitprice;
+ /**
+ * @var float
+ */
public $localtax1_tx;
+ /**
+ * @var string
+ */
public $localtax1_type;
+ /**
+ * @var float
+ */
public $localtax2_tx;
+ /**
+ * @var string
+ */
public $localtax2_type;
+ /**
+ * @var string
+ */
public $barcode;
+ /**
+ * @var int
+ */
public $fk_barcode_type;
+ /**
+ * @var string
+ */
public $packaging;
// END MODULEBUILDER PROPERTIES
@@ -601,11 +703,11 @@ class ProductFournisseurPrice extends CommonObject
/**
* Return a link to the object card (with optionally the picto)
*
- * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
- * @param string $option On what the link point to ('nolink', ...)
- * @param int $notooltip 1=Disable tooltip
- * @param string $morecss Add more css on link
- * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+ * @param string $option On what the link point to ('nolink', ...)
+ * @param int<0,1> $notooltip 1=Disable tooltip
+ * @param string $morecss Add more css on link
+ * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
@@ -826,6 +928,7 @@ class ProductFournisseurPrice extends CommonObject
if (class_exists($classname)) {
$obj = new $classname();
+ '@phan-var-force CommonNumRefGenerator $obj';
$numref = $obj->getNextValue($this);
if ($numref != '' && $numref != '-1') {
@@ -850,10 +953,10 @@ class ProductFournisseurPrice extends CommonObject
*
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs object lang a utiliser pour traduction
- * @param int $hidedetails Hide details of lines
- * @param int $hidedesc Hide description
- * @param int $hideref Hide ref
- * @param null|array $moreparams Array to provide more information
+ * @param int<0,1> $hidedetails Hide details of lines
+ * @param int<0,1> $hidedesc Hide description
+ * @param int<0,1> $hideref Hide ref
+ * @param ?array $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php
index e1d9b2cdf8b..463b39d5723 100644
--- a/htdocs/product/stock/massstockmove.php
+++ b/htdocs/product/stock/massstockmove.php
@@ -88,6 +88,9 @@ if (GETPOST('init')) {
$listofdata = array();
if (!empty($_SESSION['massstockmove'])) {
$listofdata = json_decode($_SESSION['massstockmove'], true);
+ if (!is_array($listofdata)) {
+ $listofdata = array();
+ }
}
$error = 0;
@@ -693,17 +696,17 @@ if (getDolGlobalInt('PRODUIT_LIMIT_SIZE') <= 0) {
$limit = getDolGlobalString('PRODUIT_LIMIT_SIZE');
}
print img_picto($langs->trans("Product"), 'product', 'class="paddingright"');
-print $form->select_produits((isset($id_product)?$id_product:0), 'productid', $filtertype, $limit, 0, -1, 2, '', 1, array(), 0, '1', 0, 'minwidth200imp maxwidth300', 1, '', null, 1);
+print $form->select_produits((isset($id_product) ? $id_product : 0), 'productid', $filtertype, $limit, 0, -1, 2, '', 1, array(), 0, '1', 0, 'minwidth200imp maxwidth300', 1, '', null, 1);
print '';
// Batch number
if (isModEnabled('productbatch')) {
print '
';
diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php
index c7bac77a67b..e5c9b2333aa 100644
--- a/htdocs/product/stock/tpl/stocktransfer.tpl.php
+++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php
@@ -1,6 +1,7 @@
* Copyright (C) 2018 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
@@ -25,9 +26,15 @@ if (empty($conf) || !is_object($conf)) {
exit(1);
}
+'
+@phan-var-force Entrepot|MouvementStock $object
+@phan-var-force FormProduct $formproduct
+@phan-var-force string $backtopage
+';
+
?>
-
+
element == 'product') {
@@ -82,7 +89,7 @@ if ($object->element == 'stockmouvement') {
print '