/** * Prepare array with list of tabs * * @param Product $object Object related to tabs * @return array Array of tabs to show */ function product_prepare_head($object) { global $langs, $conf, $user; $langs->load("products"); $h = 0; $head = array(); $head[$h][0] = DOL_URL_ROOT . "/product/card.php?id=" . $object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; $head[$h][0] = DOL_URL_ROOT . "/product/price.php?id=" . $object->id; $head[$h][1] = $langs->trans("SellingPrices"); $head[$h][2] = 'price'; $h++; if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire || !empty($conf->margin->enabled) && $user->rights->margin->liretous) { $head[$h][0] = DOL_URL_ROOT . "/product/fournisseurs.php?id=" . $object->id; $head[$h][1] = $langs->trans("BuyingPrices"); $head[$h][2] = 'suppliers'; $h++; } // Show category tab /* No more required. Replaced with new multiselect component if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $type = Categorie::TYPE_PRODUCT; $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type; $head[$h][1] = $langs->trans('Categories'); $head[$h][2] = 'category'; $h++; }*/ // Multilangs if (!empty($conf->global->MAIN_MULTILANGS)) { $head[$h][0] = DOL_URL_ROOT . "/product/traduction.php?id=" . $object->id; $head[$h][1] = $langs->trans("Translation"); $head[$h][2] = 'translation'; $h++; } // Sub products if (!empty($conf->global->PRODUIT_SOUSPRODUITS)) { $head[$h][0] = DOL_URL_ROOT . "/product/composition/card.php?id=" . $object->id; $head[$h][1] = $langs->trans('AssociatedProducts'); $head[$h][2] = 'subproduct'; $h++; } $head[$h][0] = DOL_URL_ROOT . "/product/stats/card.php?id=" . $object->id; $head[$h][1] = $langs->trans('Statistics'); $head[$h][2] = 'stats'; $h++; $head[$h][0] = DOL_URL_ROOT . "/product/stats/facture.php?id=" . $object->id; $head[$h][1] = $langs->trans('Referers'); $head[$h][2] = 'referers'; $h++; if ($object->isProduct() || $object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (!empty($conf->stock->enabled) && $user->rights->stock->lire) { $head[$h][0] = DOL_URL_ROOT . "/product/stock/product.php?id=" . $object->id; $head[$h][1] = $langs->trans("Stock"); $head[$h][2] = 'stock'; $h++; } } // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'product'); /* Merged into the Join files tab $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id; $head[$h][1] = $langs->trans("Photos"); $head[$h][2] = 'photos'; $h++; */ // Attachments require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; if (!empty($conf->product->enabled)) { $upload_dir = $conf->product->multidir_output[$object->entity] . '/' . dol_sanitizeFileName($object->ref); } elseif (!empty($conf->service->enabled)) { $upload_dir = $conf->service->multidir_output[$object->entity] . '/' . dol_sanitizeFileName($object->ref); } $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$')); $head[$h][0] = DOL_URL_ROOT . '/product/document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if ($nbFiles > 0) { $head[$h][1] .= ' <span class="badge">' . $nbFiles . '</span>'; } $head[$h][2] = 'documents'; $h++; complete_head_from_modules($conf, $langs, $object, $head, $h, 'product', 'remove'); // Log $head[$h][0] = DOL_URL_ROOT . '/product/info.php?id=' . $object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; return $head; }