Ajout gestion fk_unit

This commit is contained in:
atm-lena 2022-08-24 11:53:25 +02:00
parent 6e5d395ac8
commit f5d7f66ca0
2 changed files with 7 additions and 4 deletions

View File

@ -183,7 +183,7 @@ if (empty($reshook)) {
}
if (!$error) {
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null);
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit);
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -223,7 +223,7 @@ if (empty($reshook)) {
$bomline = new BOMLine($db);
$bomline->fetch($lineid);
$result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key);
$result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key, $fk_unit);
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -234,6 +234,7 @@ if (empty($reshook)) {
unset($_POST['qty']);
unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']);
}
$object->fetchLines();

View File

@ -569,7 +569,7 @@ class BOM extends CommonObject
* @param string $import_key Import Key
* @return int <0 if KO, Id of created object if OK
*/
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null)
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit='')
{
global $mysoc, $conf, $langs, $user;
@ -637,6 +637,7 @@ class BOM extends CommonObject
$this->line->fk_bom_child = $fk_bom_child;
$this->line->import_key = $import_key;
$this->line->position = $rankToUse;
$this->line->fk_unit = $fk_unit;
$result = $this->line->create($user);
@ -668,7 +669,7 @@ class BOM extends CommonObject
* @param string $import_key Import Key
* @return int <0 if KO, Id of updated BOM-Line if OK
*/
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null)
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit)
{
global $mysoc, $conf, $langs, $user;
@ -738,6 +739,7 @@ class BOM extends CommonObject
$this->line->efficiency = $efficiency;
$this->line->import_key = $import_key;
$this->line->position = $rankToUse;
$this->line->fk_unit = $fk_unit;
$result = $this->line->update($user);