From 141a321ff645562b02ed3eeca4d95282a8331aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 16 Dec 2022 16:59:23 +0100 Subject: [PATCH] Update expedition.lib.php --- htdocs/core/lib/expedition.lib.php | 33 ++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index 1a4ddf4d335..21076122903 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -73,9 +73,11 @@ function expedition_prepare_head(Expedition $object) */ function expedition_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; $langs->load("sendings"); + $extrafields = new ExtraFields($db); + $h = 0; $head = array(); @@ -87,23 +89,29 @@ function expedition_admin_prepare_head() */ if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { + $extrafields->fetch_name_optionals_label('expedition'); + $extrafields->fetch_name_optionals_label('expeditiondet'); + $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; $head[$h][1] = $langs->trans("Shipment"); $head[$h][2] = 'shipment'; $h++; - } - - if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['expedition']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_shipment'; $h++; - } - if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['expeditiondet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines_shipment'; $h++; } @@ -114,15 +122,24 @@ function expedition_admin_prepare_head() $h++; if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { + $extrafields->fetch_name_optionals_label('delivery'); + $extrafields->fetch_name_optionals_label('deliverydet'); + $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['delivery']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_receivings'; $h++; - } - if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['deliverydet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines_receivings'; $h++; }