can edit bomline workstation

This commit is contained in:
Frédéric FRANCE 2023-09-04 13:59:28 +02:00
parent 24d03009e9
commit f413a7b6d8
3 changed files with 12 additions and 2 deletions

View File

@ -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');

View File

@ -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);

View File

@ -155,6 +155,7 @@ if ($filtertype != 1) {
$coldisplay++;
print '<td class="nobottom nowrap linecolworkstation right">';
print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1);
print '</td>';
$coldisplay++;