Merge pull request #19759 from FHenry/new_refproduct_bom_tooltip
NEW: add product ref into BOM tooltips
This commit is contained in:
commit
6871a480e5
@ -789,6 +789,15 @@ class BOM extends CommonObject
|
|||||||
if (isset($this->label)) {
|
if (isset($this->label)) {
|
||||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||||
}
|
}
|
||||||
|
if (!empty($this->fk_product) && $this->fk_product > 0) {
|
||||||
|
include_once DOL_DOCUMENT_ROO.'/product/class/product.class.php';
|
||||||
|
$product = new Product($db);
|
||||||
|
$resultFetch = $product->fetch($this->fk_product);
|
||||||
|
if ($resultFetch > 0) {
|
||||||
|
$label .= "<br><b>".$langs->trans("Product").'</b>: '.$product->label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;
|
||||||
|
|
||||||
|
|||||||
@ -155,7 +155,7 @@ print '</div><div class="fichetwothirdright">';
|
|||||||
|
|
||||||
$max = 5;
|
$max = 5;
|
||||||
|
|
||||||
$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
|
$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as a";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as a";
|
||||||
$sql .= " WHERE a.entity IN (".getEntity('bom').")";
|
$sql .= " WHERE a.entity IN (".getEntity('bom').")";
|
||||||
$sql .= $db->order("a.tms", "DESC");
|
$sql .= $db->order("a.tms", "DESC");
|
||||||
@ -176,6 +176,7 @@ if ($resql) {
|
|||||||
|
|
||||||
$staticbom->id = $obj->rowid;
|
$staticbom->id = $obj->rowid;
|
||||||
$staticbom->ref = $obj->ref;
|
$staticbom->ref = $obj->ref;
|
||||||
|
$staticbom->fk_product = $obj->fk_product;
|
||||||
$staticbom->date_modification = $obj->datem;
|
$staticbom->date_modification = $obj->datem;
|
||||||
$staticbom->status = $obj->status;
|
$staticbom->status = $obj->status;
|
||||||
|
|
||||||
|
|||||||
@ -133,7 +133,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
|
|
||||||
|
|
||||||
//Qauntity to produce
|
//Qauntity to produce
|
||||||
$sql = "SELECT b.rowid as rowid, b.ref, b.status, b.date_valid,";
|
$sql = "SELECT b.rowid as rowid, b.ref, b.status, b.date_valid, b.fk_product,";
|
||||||
$sql .= " b.qty as qty_toproduce";
|
$sql .= " b.qty as qty_toproduce";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b";
|
||||||
$sql .= " WHERE ";
|
$sql .= " WHERE ";
|
||||||
@ -166,6 +166,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$bomtmp->id = $objp->rowid;
|
$bomtmp->id = $objp->rowid;
|
||||||
$bomtmp->ref = $objp->ref;
|
$bomtmp->ref = $objp->ref;
|
||||||
|
$bomtmp->fk_product = $objp->fk_product;
|
||||||
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
|
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
|
||||||
$bom_data_result[$objp->rowid]['qty_toproduce'] += ($objp->qty_toproduce > 0 ? $objp->qty_toproduce : 0);
|
$bom_data_result[$objp->rowid]['qty_toproduce'] += ($objp->qty_toproduce > 0 ? $objp->qty_toproduce : 0);
|
||||||
$bom_data_result[$objp->rowid]['qty_toconsume'] = 0;
|
$bom_data_result[$objp->rowid]['qty_toconsume'] = 0;
|
||||||
@ -180,7 +181,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$db->free($result);
|
$db->free($result);
|
||||||
|
|
||||||
//Qauntity to consume
|
//Qauntity to consume
|
||||||
$sql = "SELECT b.rowid as rowid, b.ref, b.status, b.date_valid,";
|
$sql = "SELECT b.rowid as rowid, b.ref, b.status, b.date_valid, b.fk_product,";
|
||||||
$sql .= " SUM(bl.qty) as qty_toconsume";
|
$sql .= " SUM(bl.qty) as qty_toconsume";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b";
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid";
|
||||||
@ -214,6 +215,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$bomtmp->id = $objp->rowid;
|
$bomtmp->id = $objp->rowid;
|
||||||
$bomtmp->ref = $objp->ref;
|
$bomtmp->ref = $objp->ref;
|
||||||
|
$bomtmp->fk_product = $objp->fk_product;
|
||||||
|
|
||||||
if (!array_key_exists($objp->rowid, $bom_data_result)) {
|
if (!array_key_exists($objp->rowid, $bom_data_result)) {
|
||||||
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
|
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user