Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fournisseur.product.class.php #28729

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions htdocs/fourn/class/fournisseur.product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
$fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $multicurrency_code);
}

$buyprice = price2num($buyprice, 'MU');
$charges = price2num($charges, 'MU');
$qty = price2num($qty, 'MS');
$unitBuyPrice = price2num($buyprice / $qty, 'MU');
$buyprice = (float) price2num($buyprice, 'MU');
$charges = (float) price2num($charges, 'MU');
$qty = (float) price2num($qty, 'MS');
$unitBuyPrice = (float) price2num($buyprice / $qty, 'MU');

// We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50.
//$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS');
Expand Down Expand Up @@ -359,10 +359,6 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
$localtax2 = 0; // If = '' then = 0
}

// Check parameters
if ($buyprice != '' && !is_numeric($buyprice)) {
}

$this->db->begin();

if ($this->product_fourn_price_id > 0) {
Expand Down Expand Up @@ -391,6 +387,7 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
}
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql .= " SET fk_user = ".((int) $user->id)." ,";
$sql .= " datec = '".$this->db->idate($now)."' ,"; // Note: Even if this is an update, we update the creation date as the log of each change is tracked into product_fournisseur_log.
$sql .= " ref_fourn = '".$this->db->escape($ref_fourn)."',";
$sql .= " desc_fourn = '".$this->db->escape($desc_fourn)."',";
$sql .= " price = ".((float) $buyprice).",";
Expand Down
Loading