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 1/7] 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++; From 65b85adcaf3d4b4e3780baa1f4f327754803e6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 18:26:26 +0100 Subject: [PATCH 2/7] Update expensereport.lib.php --- htdocs/core/lib/expensereport.lib.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index 19e2e0ca00d..ae9ca936c47 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.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 @@ -130,11 +131,14 @@ function payment_expensereport_prepare_head(PaymentExpenseReport $object) */ function expensereport_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; $h = 0; $head = array(); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('expensereport'); + $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/expensereport.php"; @@ -162,6 +166,10 @@ function expensereport_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/expensereport_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['expensereport']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; From 100c7998110d9bf226aa8ac4e951bb291a5ffdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 18:32:31 +0100 Subject: [PATCH 3/7] Update supplier_proposal.lib.php --- htdocs/core/lib/supplier_proposal.lib.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/supplier_proposal.lib.php b/htdocs/core/lib/supplier_proposal.lib.php index 3c9915bc951..11c0786802f 100644 --- a/htdocs/core/lib/supplier_proposal.lib.php +++ b/htdocs/core/lib/supplier_proposal.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * 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 @@ -110,7 +111,11 @@ function supplier_proposal_prepare_head($object) */ function supplier_proposal_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('supplier_proposal'); + $extrafields->fetch_name_optionals_label('supplier_proposaldet'); $h = 0; $head = array(); @@ -128,11 +133,19 @@ function supplier_proposal_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposal_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['supplier_proposal']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['supplier_proposaldet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines'; $h++; From 82fc43fa75a0dab1ab734460ca609b516efa5568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 18:52:11 +0100 Subject: [PATCH 4/7] Update fourn.lib.php --- htdocs/core/lib/fourn.lib.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 93ac290e08c..c658916e359 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand + * 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 @@ -249,7 +250,13 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) */ function supplierorder_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('commande_fournisseur'); + $extrafields->fetch_name_optionals_label('commande_fournisseurdet'); + $extrafields->fetch_name_optionals_label('facture_fourn'); + $extrafields->fetch_name_optionals_label('facture_fourn_det'); $h = 0; $head = array(); @@ -273,21 +280,37 @@ function supplierorder_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); + $nbExtrafields = $extrafields->attributes['commande_fournisseur']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierorder'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines"); + $nbExtrafields = $extrafields->attributes['commande_fournisseurdet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierorderdet'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); + $nbExtrafields = $extrafields->attributes['facture_fourn']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierinvoice'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLines"); + $nbExtrafields = $extrafields->attributes['facture_fourn_det']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierinvoicedet'; $h++; From 88d8bdd9c15efbd16ffb6416272e240ab4c0d6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 22:01:37 +0100 Subject: [PATCH 5/7] add admin extrafields count --- .../lib/knowledgemanagement.lib.php | 14 ++++++++------ htdocs/partnership/lib/partnership.lib.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php index 2f189b05f5c..d1de9e5e401 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php @@ -28,10 +28,13 @@ */ function knowledgemanagementAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; $langs->load("knowledgemanagement"); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('knowledgemanagement_knowledgerecord'); + $h = 0; $head = array(); @@ -43,14 +46,13 @@ function knowledgemanagementAdminPrepareHead() $head[$h][0] = DOL_URL_ROOT.'/admin/knowledgerecord_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['knowledgemanagement_knowledgerecord']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'extra'; $h++; - /*$head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/admin/about.php'; - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++;*/ - // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index abf8dcca63b..5c30be6ffd1 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -28,10 +28,13 @@ */ function partnershipAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; $langs->loadLangs(array("members", "partnership")); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('partnership'); + $h = 0; $head = array(); @@ -43,6 +46,10 @@ function partnershipAdminPrepareHead() $head[$h][0] = dol_buildpath("/partnership/admin/partnership_extrafields.php", 1); $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['partnership']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'partnership_extrafields'; $h++; @@ -51,13 +58,6 @@ function partnershipAdminPrepareHead() $head[$h][2] = 'website'; $h++; - /* - $head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; - */ - // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( From 7e97c611f89094474c7e9483b84bb7e4fd579970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 22:07:25 +0100 Subject: [PATCH 6/7] add admin extrafields count --- htdocs/core/lib/product.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 79d8ac57834..e919bf2c8b6 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -374,7 +374,10 @@ function product_admin_prepare_head() */ function product_lot_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('product_lot'); $h = 0; $head = array(); @@ -392,6 +395,10 @@ function product_lot_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_lot_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['product_lot']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; From 3f82f3f7f4f38c67b7a0261ee080bc6542403d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 22:12:35 +0100 Subject: [PATCH 7/7] add admin extrafields count --- htdocs/core/lib/reception.lib.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 7f5c6e865de..e697908e8cb 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -110,9 +110,13 @@ function reception_prepare_head(Reception $object) */ function reception_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; $langs->load("receptions"); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('reception'); + $extrafields->fetch_name_optionals_label('commande_fournisseur_dispatch'); + $h = 0; $head = array(); @@ -126,6 +130,10 @@ function reception_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['reception']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_reception'; $h++; } @@ -133,6 +141,10 @@ function reception_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['commande_fournisseur_dispatch']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines_reception'; $h++; }