--- /tmp/dsg/dolibarr/htdocs/product/inventory/lib/github_19.0.3_inventory.lib.php +++ /tmp/dsg/dolibarr/htdocs/product/inventory/lib/client_inventory.lib.php @@ -32 +32 @@ - global $langs, $conf; + global $langs, $conf; @@ -34 +34 @@ - $langs->load("inventory"); + $langs->load("inventory"); @@ -36,2 +36,2 @@ - $h = 0; - $head = array(); + $h = 0; + $head = array(); @@ -39,4 +39,4 @@ - $head[$h][0] = DOL_URL_ROOT."/admin/inventory.php"; - $head[$h][1] = $langs->trans("Parameters"); - $head[$h][2] = 'settings'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/inventory.php"; + $head[$h][1] = $langs->trans("Parameters"); + $head[$h][2] = 'settings'; + $h++; @@ -45,9 +45,9 @@ - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - //$this->tabs = array( - // 'entity:+tabname:Title:@inventory:/inventory/mypage.php?id=__ID__' - //); // to add new tab - //$this->tabs = array( - // 'entity:-tabname:Title:@inventory:/inventory/mypage.php?id=__ID__' - //); // to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'inventory'); + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@inventory:/inventory/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@inventory:/inventory/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, null, $head, $h, 'inventory'); @@ -55,3 +55 @@ - complete_head_from_modules($conf, $langs, null, $head, $h, 'inventory', 'remove'); - - return $head; + return $head; @@ -71 +69 @@ - global $langs, $conf; + global $langs; @@ -73 +71 @@ - $head = array( + return array( @@ -76,0 +75 @@ +} @@ -78 +76,0 @@ - $h=2; @@ -80,2 +77,0 @@ - complete_head_from_modules($conf, $langs, $inventory, $head, $h, 'inventory'); - complete_head_from_modules($conf, $langs, $inventory, $head, $h, 'inventory', 'remove'); @@ -83 +79,41 @@ - return $head; +/** + * Define head array for tabs of inventory tools setup pages + * + * @param Inventory $inventory Object inventory + * + * @return string html of products + */ +function inventorySelectProducts(&$inventory) +{ + global $conf, $db, $langs; + + $except_product_id = array(); + + foreach ($inventory->Inventorydet as $Inventorydet) + { + $except_product_id[] = $Inventorydet->fk_product; + } + + ob_start(); + $form = new Form($db); + $form->select_produits(-1, 'fk_product'); + + $TChildWarehouses = array($inventory->fk_warehouse); + $e = new Entrepot($db); + $e->fetch($inventory->fk_warehouse); + if (method_exists($e, 'get_children_warehouses')) $e->get_children_warehouses($e->id, $TChildWarehouses); + + $Tab = array(); + $sql = 'SELECT rowid, label + FROM '.MAIN_DB_PREFIX.'entrepot WHERE rowid IN('.implode(', ', $TChildWarehouses).')'; + if (method_exists($e, 'get_children_warehouses')) $sql .= ' ORDER BY fk_parent'; + $resql = $db->query($sql); + while ($res = $db->fetch_object($resql)) { + $Tab[$res->rowid] = $res->label; + } + print '   '; + print $langs->trans('Warehouse').' : '.$form::selectarray('fk_warehouse', $Tab); + + $select_html = ob_get_clean(); + + return $select_html;