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++;