Update card.php

add on card
This commit is contained in:
BENKE Charlene 2020-11-26 12:45:06 +01:00
parent c2bd30a7e9
commit 5b40950f50

View File

@ -17,7 +17,7 @@
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibo gxiv.net>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
* This program is free software; you can redistribute it and/or modify
@ -59,6 +59,7 @@ if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/command
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
if (!empty($conf->bom->enabled)) require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
// Load translation files required by the page
$langs->loadLangs(array('products', 'other'));
@ -454,6 +455,13 @@ if (empty($reshook))
$object->finished = null;
}
$fk_default_bom = GETPOST('fk_default_bom', 'int');
if ($fk_default_bom >= 0) {
$object->fk_default_bom = $fk_default_bom;
} else {
$object->fk_default_bom = null;
}
$units = GETPOST('units', 'int');
if ($units > 0) {
$object->fk_unit = $units;
@ -1567,6 +1575,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $formproduct->selectProductNature('finished', $object->finished);
print '</td></tr>';
if ($conf->bom->enabled) {
print '<tr><td>'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc")).'</td><td colspan="3">';
$bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".$object->id;
print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1);
print '</td></tr>';
}
// Brut Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
@ -2059,6 +2074,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $object->getLibFinished();
print '</td></tr>';
if ($conf->bom->enabled) {
print '<tr><td class="titlefield">'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc")).'</td><td colspan="2">';
if ($object->fk_default_bom) {
$bom_static = new BOM($db);
$bom_static->fetch($object->fk_default_bom);
print $bom_static->getNomUrl(1);
}
print '</td></tr>';
}
// Brut Weight
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td colspan="2">';
if ($object->weight != '')