diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 4c647c156ad..a447d64bffc 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -266,7 +266,12 @@ 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, $fk_unit, $array_options); + $fk_default_workstation = $bomline->fk_default_workstation; + if (isModEnabled('workstation') && GETPOSTISSET('idworkstations')) { + $fk_default_workstation = GETPOST('idworkstations', 'int'); + } + + $result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key, $fk_unit, $array_options, $fk_default_workstation); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index f6a5620c51c..a55be2898af 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -708,9 +708,10 @@ class BOM extends CommonObject * @param string $import_key Import Key * @param int $fk_unit Unit of line * @param array $array_options extrafields array + * @param int $fk_default_workstation Default workstation * @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, $fk_unit = 0, $array_options = 0) + public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = 0, $fk_default_workstation = null) { global $mysoc, $conf, $langs, $user; @@ -789,6 +790,9 @@ class BOM extends CommonObject $line->array_options[$key] = $array_options[$key]; } } + if ($line->fk_default_workstation != $fk_default_workstation) { + $line->fk_default_workstation = $fk_default_workstation; + } $result = $line->update($user); diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 45d0d281c33..6d7ab47a822 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -155,6 +155,7 @@ if ($filtertype != 1) { $coldisplay++; print ''; + print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1); print ''; $coldisplay++;