FIX accolade et gestion fk_unit

This commit is contained in:
atm-lena 2022-08-24 12:15:28 +02:00
parent 44caf380cf
commit ab2b445b53

View File

@ -183,7 +183,7 @@ if ($action == 'addline' && $user->rights->bom->write) {
} }
if (!$error) { 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) { if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -195,11 +195,12 @@ if ($action == 'addline' && $user->rights->bom->write) {
unset($_POST['qty_frozen']); unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']); unset($_POST['disable_stock_change']);
}
$object->fetchLines(); $object->fetchLines();
$object->calculateCosts(); $object->calculateCosts();
} }
}
} }
// Update line // Update line
@ -223,7 +224,7 @@ if ($action == 'updateline' && $user->rights->bom->write) {
$bomline = new BOMLine($db); $bomline = new BOMLine($db);
$bomline->fetch($lineid); $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) { if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -235,11 +236,12 @@ if ($action == 'updateline' && $user->rights->bom->write) {
unset($_POST['qty_frozen']); unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']); unset($_POST['disable_stock_change']);
}
$object->fetchLines(); $object->fetchLines();
$object->calculateCosts(); $object->calculateCosts();
} }
}
} }
@ -621,6 +623,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
} }
} }
}
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '</table>'; print '</table>';