From bafadb799120e1b05cfd094e99fba45e882cd0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 17 Sep 2022 21:16:02 +0200 Subject: [PATCH] wip --- htdocs/core/lib/stock.lib.php | 23 ++++++++++++++++++++--- htdocs/core/lib/ticket.lib.php | 15 +++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index afad01ebcff..79844f5aed7 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -17,8 +17,8 @@ */ /** - * \file htdocs/core/lib/stock.lib.php - * \brief Library file with function for stock module + * \file htdocs/core/lib/stock.lib.php + * \brief Library file with function for stock module */ /** @@ -88,7 +88,12 @@ function stock_prepare_head($object) */ function stock_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('entrepot'); + $extrafields->fetch_name_optionals_label('stock_mouvement'); + $extrafields->fetch_name_optionals_label('inventory'); $h = 0; $head = array(); @@ -106,16 +111,28 @@ function stock_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['entrepot']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_mouvement_extrafields.php'; $head[$h][1] = $langs->trans("StockMouvementExtraFields"); + $nbExtrafields = $extrafields->attributes['stock_mouvement']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'stockMouvementAttributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php'; $head[$h][1] = $langs->trans("InventoryExtraFields"); + $nbExtrafields = $extrafields->attributes['inventory']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'inventoryAttributes'; $h++; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 5fd2682d175..eb814cb1295 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -18,9 +18,9 @@ */ /** - * \file core/lib/ticket.lib.php - * \ingroup ticket - * \brief This file is a library for Ticket module + * \file core/lib/ticket.lib.php + * \ingroup ticket + * \brief This file is a library for Ticket module */ /** @@ -30,7 +30,10 @@ */ function ticketAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('ticket'); $langs->load("ticket"); @@ -44,6 +47,10 @@ function ticketAdminPrepareHead() $head[$h][0] = DOL_URL_ROOT.'/admin/ticket_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsTicket"); + $nbExtrafields = $extrafields->attributes['ticket']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++;