Skip to content

Commit

Permalink
FIX: implement mdeweerd review
Browse files Browse the repository at this point in the history
  • Loading branch information
altairis-noe committed Jan 28, 2025
1 parent 2589feb commit 966d079
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/propal/class/propaleligne.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class PropaleLigne extends CommonObjectLine
*/
public $multicurrency_total_ttc;

/**
/**
* @var float
*/
public $packaging;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3185,7 +3185,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $t
if ($qty < $this->line->packaging) {
$qty = $this->line->packaging;
} else {
if (!empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) {
if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) {
$coeff = intval($qty / $this->line->packaging) + 1;
$qty = $this->line->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4316,7 +4316,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_star
if ($qty < $this->line->packaging) {
$qty = $this->line->packaging;
} else {
if (!empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) {
if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) {
$coeff = intval($qty / $this->line->packaging) + 1;
$qty = $this->line->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ public function update($id, $user, $notrigger = 0, $action = 'update', $updatety
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
$sql .= ", mandatory_period = ".($this->mandatory_period);
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') && !empty($this->packaging)) {
$sql .= ", packaging = ".($this->packaging);
$sql .= ", packaging = " . (int) $this->packaging;
}
// stock field is not here because it is a denormalized value from product_stock.
$sql .= " WHERE rowid = ".((int) $id);
Expand Down
12 changes: 6 additions & 6 deletions htdocs/product/price.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
$psq = empty($newpsq) ? 0 : $newpsq;
$maxpricesupplier = $object->min_recommended_price();

// Packaging / Conditionnement
// Packaging
$packaging = getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') ? GETPOST('packaging') : null;

if (isModEnabled('dynamicprices')) {
Expand Down Expand Up @@ -484,9 +484,9 @@
if (!$error) {
$db->begin();

// Packaging / Conditionnement
// Packaging
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
$object->packaging = (double) $packaging;
$object->packaging = (float) $packaging;
}

foreach ($pricestoupdate as $key => $val) {
Expand Down Expand Up @@ -1429,7 +1429,7 @@
}
print '</td></tr>';

// Packaging / Conditionnement
// Packaging
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
print '<tr class="field_price_label"><td>'.$form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductSellDesc")).'</td><td>';
print $object->packaging;
Expand Down Expand Up @@ -1758,13 +1758,13 @@ function on_change() {
print '</td>';
print '</tr>';

// Packaging / Conditionnement
// Packaging
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
print '<tr><td>';
print $form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductSellDesc"));
print '</td><td>';
$packaging = $object->packaging;
print '<input class="flat" name="packaging" size="5" value="'.$packaging.'">';
print '<input class="flat" name="packaging" size="5" value="' . price2num($packaging, 2).'">';
print '</td>';
print '</tr>';
}
Expand Down

0 comments on commit 966d079

Please sign in to comment.