Merge branch 'NEW_develop_sub_BOM' of github.com:atm-adrien/dolibarr into NEW_develop_sub_BOM
This commit is contained in:
commit
4d96c5d345
@ -7,7 +7,7 @@ $current_bom_id = GETPOST('current_bom_id', 'alphanohtml');
|
|||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
switch ($action){
|
switch ($action) {
|
||||||
case 'select_BOM':
|
case 'select_BOM':
|
||||||
//Selection of nomenclatures corresponding to the selected product
|
//Selection of nomenclatures corresponding to the selected product
|
||||||
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
|
||||||
@ -17,8 +17,7 @@ switch ($action){
|
|||||||
if ($resql && $db->num_rows($resql) > 0) {
|
if ($resql && $db->num_rows($resql) > 0) {
|
||||||
$options = array();
|
$options = array();
|
||||||
$cpt=0;
|
$cpt=0;
|
||||||
while ($obj = $db->fetch_object($resql)){
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
|
||||||
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
|
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
|
||||||
$cpt++;
|
$cpt++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ $tmpproduct = new Product($object->db);
|
|||||||
$tmpproduct->fetch($line->fk_product);
|
$tmpproduct->fetch($line->fk_product);
|
||||||
$tmpbom = new BOM($object->db);
|
$tmpbom = new BOM($object->db);
|
||||||
$res = $tmpbom->fetch($line->fk_bom_child);
|
$res = $tmpbom->fetch($line->fk_bom_child);
|
||||||
if (!empty($tmpbom->id)){
|
if (!empty($tmpbom->id)) {
|
||||||
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' </a>';
|
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' </a>';
|
||||||
}
|
}
|
||||||
print $tmpproduct->getNomUrl(1);
|
print $tmpproduct->getNomUrl(1);
|
||||||
@ -185,9 +185,9 @@ $sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomlin
|
|||||||
$sql.= ' WHERE fk_bom = '.$tmpbom->id;
|
$sql.= ' WHERE fk_bom = '.$tmpbom->id;
|
||||||
$resql = $object->db->query($sql);
|
$resql = $object->db->query($sql);
|
||||||
|
|
||||||
if ($resql){
|
if ($resql) {
|
||||||
// Loop on all the sub-BOM lines if they exist
|
// Loop on all the sub-BOM lines if they exist
|
||||||
while ($obj = $object->db->fetch_object($resql)){
|
while ($obj = $object->db->fetch_object($resql)) {
|
||||||
$sub_bom_product = new Product($object->db);
|
$sub_bom_product = new Product($object->db);
|
||||||
$sub_bom_product->fetch($obj->fk_product);
|
$sub_bom_product->fetch($obj->fk_product);
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ if ($resql){
|
|||||||
$sub_bom_line->fetch($obj->rowid);
|
$sub_bom_line->fetch($obj->rowid);
|
||||||
|
|
||||||
//If hidden conf is set, we show directly all the sub-BOM lines
|
//If hidden conf is set, we show directly all the sub-BOM lines
|
||||||
if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
|
if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
|
||||||
print '<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.'">';
|
print '<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.'">';
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="sub_bom_lines" parentid="'.$line->id.'">';
|
print '<tr class="sub_bom_lines" parentid="'.$line->id.'">';
|
||||||
@ -239,7 +239,7 @@ if ($resql){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PMP if cost price isn't defined
|
// PMP if cost price isn't defined
|
||||||
else if ($sub_bom_product->pmp > 0) {
|
elseif ($sub_bom_product->pmp > 0) {
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
|
||||||
$total_cost.= $sub_bom_product->pmp * $line->qty;
|
$total_cost.= $sub_bom_product->pmp * $line->qty;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user