From 196c1c2c4a0e4158caed7b683fd1e9334aabf3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 15 Sep 2022 21:43:57 +0200 Subject: [PATCH] add badges --- htdocs/core/lib/ecm.lib.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index 97eeffd4337..f10f2ba2917 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2022 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +18,9 @@ */ /** - * \file htdocs/core/lib/ecm.lib.php - * \brief Ensemble de fonctions de base pour le module ecm - * \ingroup ecm + * \file htdocs/core/lib/ecm.lib.php + * \brief Ensemble de fonctions de base pour le module ecm + * \ingroup ecm */ @@ -160,7 +161,12 @@ function ecm_prepare_head_fm($object) */ function ecm_admin_prepare_head() { - global $langs, $conf; + global $langs, $conf, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('ecm_files'); + $extrafields->fetch_name_optionals_label('ecm_directories'); + $langs->load("ecm"); $h = 0; @@ -173,11 +179,19 @@ function ecm_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/ecm_files_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsEcmFiles"); + $nbExtrafields = is_countable($extrafields->attributes['ecm_files']['label']) ? count($extrafields->attributes['ecm_files']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes_ecm_files'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/ecm_directories_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsEcmDirectories"); + $nbExtrafields = is_countable($extrafields->attributes['ecm_directories']['label']) ? count($extrafields->attributes['ecm_directories']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes_ecm_directories'; $h++;