2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2025-07-05 12:09:45 +02:00
parent b70943db59
commit 84879c15e9
5 changed files with 8 additions and 8 deletions

View File

@@ -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 int|float|string $amount Amount to convert/clean or round
* @param int|float|string|null $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)

View File

@@ -122,7 +122,7 @@ if ($idprod > 0) {
}
}
$prices[] = array("id" => 'pmpprice', "price" => price2num((float) $price, 'MU'), "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($price, 'MU'), "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)

View File

@@ -6111,7 +6111,7 @@ class Product extends CommonObject
* @param float $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove)
* @param int<0,1> $movement 0 = add, 1 = remove
* @param string $label Label of stock movement
* @param float $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.
* @param int|float $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.
* @param string $inventorycode Inventory code
* @param string $origin_element Origin element type
* @param ?int $origin_id Origin id of element

View File

@@ -1206,7 +1206,7 @@ if ($resql) {
}
$pmp_valuation = $pmp_expected * $valuetoshow;
print '<td class="right">';
print price($pmp_expected);
print is_null($pmp_expected) ? '' : price($pmp_expected);
print '</td>';
print '<td class="right">';
print price($pmp_valuation);
@@ -1224,7 +1224,7 @@ if ($resql) {
$pmp_real = $product_static->pmp;
}
$pmp_valuation_real = $pmp_real * $obj->qty_view;
print price($pmp_real);
print is_null($pmp_real) ? '' : price($pmp_real);
print '</td>';
print '<td class="right">';
print price($pmp_valuation_real);

View File

@@ -216,7 +216,7 @@ if ($action == 'createmovements' && $user->hasRight('stock', 'mouvement', 'creer
// Define value of products moved
$pricesrc = 0;
if (!empty($product->pmp)) {
$pricesrc = $product->pmp;
$pricesrc = (float) $product->pmp;
}
$pricedest = $pricesrc;