From 168969a06dbf0a77be39ee44165282cdd6309a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 18:20:29 +0100 Subject: [PATCH] add extrafields count in admin --- htdocs/core/lib/holiday.lib.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 4f6da9f6d51..eb0ca243c90 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur + * 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 @@ -18,7 +19,7 @@ /** * \file htdocs/core/lib/holiday.lib.php - * \brief Ensemble de fonctions de base pour les adherents + * \brief base functions for holiday */ /** @@ -53,6 +54,8 @@ function holiday_prepare_head($object) $head[$h][2] = 'documents'; $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'core'); + $head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; @@ -62,7 +65,7 @@ function holiday_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'external'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove'); @@ -79,6 +82,9 @@ function holiday_admin_prepare_head() { global $db, $langs, $conf, $user; + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('holiday'); + $h = 0; $head = array(); @@ -95,6 +101,10 @@ function holiday_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['holiday']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++;