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 * Function to use on each input amount before any numeric test or database insert. A better name for this function
* should be roundtext2num(). * 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 * @param ''|'MU'|'MT'|'MS'|'CU'|'CT'|int<0,max> $rounding ''=No rounding
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * '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) // 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 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 int<0,1> $movement 0 = add, 1 = remove
* @param string $label Label of stock movement * @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 $inventorycode Inventory code
* @param string $origin_element Origin element type * @param string $origin_element Origin element type
* @param ?int $origin_id Origin id of element * @param ?int $origin_id Origin id of element

View File

@@ -1198,7 +1198,7 @@ if ($resql) {
print '</td>'; print '</td>';
} else { } else {
if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
//PMP Expected // PMP Expected
if (!empty($obj->pmp_expected)) { if (!empty($obj->pmp_expected)) {
$pmp_expected = $obj->pmp_expected; $pmp_expected = $obj->pmp_expected;
} else { } else {
@@ -1206,7 +1206,7 @@ if ($resql) {
} }
$pmp_valuation = $pmp_expected * $valuetoshow; $pmp_valuation = $pmp_expected * $valuetoshow;
print '<td class="right">'; print '<td class="right">';
print price($pmp_expected); print is_null($pmp_expected) ? '' : price($pmp_expected);
print '</td>'; print '</td>';
print '<td class="right">'; print '<td class="right">';
print price($pmp_valuation); print price($pmp_valuation);
@@ -1216,7 +1216,7 @@ if ($resql) {
print $obj->qty_view; // qty found print $obj->qty_view; // qty found
print '</td>'; print '</td>';
//PMP Real // PMP Real
print '<td class="right">'; print '<td class="right">';
if (!empty($obj->pmp_real)) { if (!empty($obj->pmp_real)) {
$pmp_real = $obj->pmp_real; $pmp_real = $obj->pmp_real;
@@ -1224,7 +1224,7 @@ if ($resql) {
$pmp_real = $product_static->pmp; $pmp_real = $product_static->pmp;
} }
$pmp_valuation_real = $pmp_real * $obj->qty_view; $pmp_valuation_real = $pmp_real * $obj->qty_view;
print price($pmp_real); print is_null($pmp_real) ? '' : price($pmp_real);
print '</td>'; print '</td>';
print '<td class="right">'; print '<td class="right">';
print price($pmp_valuation_real); print price($pmp_valuation_real);

View File

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