diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index 8ff1dbb97ae..ee69ccf4a87 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -80,7 +80,10 @@ function categories_prepare_head(Categorie $object, $type) */ function categoriesadmin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('categorie'); $langs->load("categories"); @@ -94,6 +97,10 @@ function categoriesadmin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsCategories"); + $nbExtrafields = $extrafields->attributes['categorie']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_categories'; $h++; diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index f235be0d070..5cad13a6e57 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -20,8 +20,8 @@ */ /** - * \file htdocs/core/lib/member.lib.php - * \brief Functions for module members + * \file htdocs/core/lib/member.lib.php + * \brief Functions for module members */ /** @@ -184,7 +184,11 @@ function member_type_prepare_head(AdherentType $object) */ function member_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('adherent'); + $extrafields->fetch_name_optionals_label('adherent_type'); $h = 0; $head = array(); @@ -207,11 +211,19 @@ function member_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/member_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsMember"); + $nbExtrafields = $extrafields->attributes['adherent']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/member_type_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsMemberType"); + $nbExtrafields = $extrafields->attributes['adherent_type']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_type'; $h++; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 80d2c0c534d..5c77f8ab821 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -42,7 +42,7 @@ function commande_prepare_head(Commande $object) $h = 0; $head = array(); - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id; $head[$h][1] = $langs->trans("CustomerOrder"); $head[$h][2] = 'order'; @@ -61,27 +61,27 @@ function commande_prepare_head(Commande $object) } if ((isModEnabled('expedition_bon') && $user->hasRight('expedition', 'lire')) - || ($conf->delivery_note->enabled && $user->hasRight('expedition', 'delivery', 'lire'))) { + || (isModEnabled('delivery_note') && $user->hasRight('expedition', 'delivery', 'lire'))) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; - if ($conf->expedition_bon->enabled) { + if (isModEnabled('expedition_bon')) { $text .= $langs->trans("Shipments"); } - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled) { + if (isModEnabled('expedition_bon') && isModEnabled('delivery_note')) { $text .= ' - '; } - if ($conf->delivery_note->enabled) { + if (isModEnabled('delivery_note')) { $text .= $langs->trans("Receivings"); } if ($nbShipments > 0 || $nbReceiption > 0) { $text .= ''.($nbShipments ? $nbShipments : 0); } - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) { + if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ' - '; } - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) { + if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ($nbReceiption ? $nbReceiption : 0); } if ($nbShipments > 0 || $nbReceiption > 0) { @@ -147,7 +147,11 @@ function commande_prepare_head(Commande $object) */ function order_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('commande'); + $extrafields->fetch_name_optionals_label('commandedet'); $h = 0; $head = array(); @@ -161,11 +165,19 @@ function order_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['commande']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['commandedet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines'; $h++; @@ -188,7 +200,7 @@ function getCustomerOrderPieChart($socid = 0) $result = ''; - if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) { + if (!isModEnabled('commande') || !$user->hasRight('commande', 'lire')) { return ''; } @@ -278,7 +290,7 @@ function getCustomerOrderPieChart($socid = 0) $result .= "\n"; } } - if ($conf->use_javascript_ajax) { + if (!empty($conf->use_javascript_ajax)) { $result .= ''; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';