FIX Travis : global $db

This commit is contained in:
atm-lena 2022-02-21 10:05:18 +01:00
parent c2bc3b20bb
commit c4a8bffa48

View File

@ -22,19 +22,22 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
global $db;
if (!is_object($form)) { if (!is_object($form)) {
$form = new Form($db); $form = new Form($db);
} }
$qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1 ); $qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1 );
/*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) { /*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) {
$qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom']; $qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom'];
}*/ }*/
$qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS'); $qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS');
$tmpproduct = new Product($this->db); $tmpproduct = new Product($db);
$tmpproduct->fetch($line->fk_product); $tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($this->db); $tmpbom = new BOM($db);
$res = $tmpbom->fetch($line->fk_bom_child); $res = $tmpbom->fetch($line->fk_bom_child);
?> ?>
@ -89,20 +92,20 @@ print '</tr>'."\n";
// Select of all the sub-BOM lines // Select of all the sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; $sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
$resql = $this->db->query($sql); $resql = $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 = $this->db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
$sub_bom_product = new Product($this->db); $sub_bom_product = new Product($db);
$sub_bom_product->fetch($obj->fk_product); $sub_bom_product->fetch($obj->fk_product);
$sub_bom_product->load_stock(); $sub_bom_product->load_stock();
$sub_bom = new BOM($this->db); $sub_bom = new BOM($db);
$sub_bom->fetch($obj->fk_bom_child); $sub_bom->fetch($obj->fk_bom_child);
$sub_bom_line = new BOMLine($this->db); $sub_bom_line = new BOMLine($db);
$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