diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index b5056c2cce3..393a2f618a0 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -21,9 +21,9 @@ */ /** - * \file htdocs/core/lib/product.lib.php - * \brief Ensemble de fonctions de base pour le module produit et service - * \ingroup product + * \file htdocs/core/lib/product.lib.php + * \brief Ensemble de fonctions de base pour le module produit et service + * \ingroup product */ /** @@ -279,7 +279,11 @@ function productlot_prepare_head($object) */ function product_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('product'); + $extrafields->fetch_name_optionals_label('product_fournisseur_price'); $h = 0; $head = array(); @@ -306,11 +310,19 @@ function product_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['product']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php'; $head[$h][1] = $langs->trans("ProductSupplierExtraFields"); + $nbExtrafields = $extrafields->attributes['product_fournisseur_price']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'supplierAttributes'; $h++; @@ -322,9 +334,9 @@ function product_admin_prepare_head() /** - * Return array head with list of tabs to view object informations. + * Return array head with list of tabs to view object informations. * - * @return array head array with tabs + * @return array head array with tabs */ function product_lot_admin_prepare_head() { @@ -556,11 +568,11 @@ function show_stats_for_company($product, $socid) } // MO - if (!empty($conf->mrp->enabled) && $user->rights->mrp->read) { + if (!empty($conf->mrp->enabled) && !empty($user->rights->mrp->read)) { $nblines++; $ret = $product->load_stats_mo($socid); if ($ret < 0) { - setEventMessage($product->error, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } $langs->load("mrp"); print ''; @@ -585,7 +597,9 @@ function show_stats_for_company($product, $socid) } $parameters = array('socid'=>$socid); $reshook = $hookmanager->executeHooks('addMoreProductStat', $parameters, $product, $nblines); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } print $hookmanager->resPrint; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 47fb9b6f186..6c4dbeffd8a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -21,9 +21,9 @@ */ /** - * \file htdocs/core/lib/project.lib.php - * \brief Functions used by project module - * \ingroup project + * \file htdocs/core/lib/project.lib.php + * \brief Functions used by project module + * \ingroup project */ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -487,11 +487,14 @@ function project_timesheet_prepare_head($mode, $fuser = null) */ function project_admin_prepare_head() { - global $langs, $conf, $user; - $h = 0; - $head = array(); + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('projet'); + $extrafields->fetch_name_optionals_label('projet_task'); $h = 0; + $head = array(); $head[$h][0] = DOL_URL_ROOT."/projet/admin/project.php"; $head[$h][1] = $langs->trans("Projects"); @@ -502,11 +505,19 @@ function project_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php"; $head[$h][1] = $langs->trans("ExtraFieldsProject"); + $nbExtrafields = $extrafields->attributes['projet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/projet/admin/project_task_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsProjectTask"); + $nbExtrafields = $extrafields->attributes['projet_task']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes_task'; $h++; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 9a28f2e331f..06fae0dd81d 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -18,9 +18,9 @@ */ /** - * \file htdocs/core/lib/propal.lib.php - * \brief Ensemble de fonctions de base pour le module propal - * \ingroup propal + * \file htdocs/core/lib/propal.lib.php + * \brief Ensemble de fonctions de base pour le module propal + * \ingroup propal */ /**