Merge pull request #23057 from frederic34/patch-8

add extrafields count in admin
This commit is contained in:
Laurent Destailleur 2022-12-01 10:44:24 +01:00 committed by GitHub
commit c2e49df051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 97 additions and 22 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com> /* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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() function expensereport_admin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user, $db;
$h = 0; $h = 0;
$head = array(); $head = array();
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('expensereport');
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport.php"; $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][0] = DOL_URL_ROOT.'/admin/expensereport_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['expensereport']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Marc Barilley <marc@ocebo.com> * Copyright (C) 2006 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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() 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; $h = 0;
$head = array(); $head = array();
@ -273,21 +280,37 @@ function supplierorder_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders");
$nbExtrafields = $extrafields->attributes['commande_fournisseur']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierorder'; $head[$h][2] = 'supplierorder';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines");
$nbExtrafields = $extrafields->attributes['commande_fournisseurdet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierorderdet'; $head[$h][2] = 'supplierorderdet';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices");
$nbExtrafields = $extrafields->attributes['facture_fourn']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierinvoice'; $head[$h][2] = 'supplierinvoice';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLines"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLines");
$nbExtrafields = $extrafields->attributes['facture_fourn_det']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierinvoicedet'; $head[$h][2] = 'supplierinvoicedet';
$h++; $h++;

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,7 +19,7 @@
/** /**
* \file htdocs/core/lib/holiday.lib.php * \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'; $head[$h][2] = 'documents';
$h++; $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][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
@ -62,7 +65,7 @@ function holiday_prepare_head($object)
// Entries must be declared in modules descriptor with line // 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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a 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'); 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; global $db, $langs, $conf, $user;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('holiday');
$h = 0; $h = 0;
$head = array(); $head = array();
@ -95,6 +101,10 @@ function holiday_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['holiday']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;

View File

@ -374,7 +374,10 @@ function product_admin_prepare_head()
*/ */
function product_lot_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; $h = 0;
$head = array(); $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][0] = DOL_URL_ROOT.'/product/admin/product_lot_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['product_lot']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;

View File

@ -110,9 +110,13 @@ function reception_prepare_head(Reception $object)
*/ */
function reception_admin_prepare_head() function reception_admin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user, $db;
$langs->load("receptions"); $langs->load("receptions");
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('reception');
$extrafields->fetch_name_optionals_label('commande_fournisseur_dispatch');
$h = 0; $h = 0;
$head = array(); $head = array();
@ -126,6 +130,10 @@ function reception_admin_prepare_head()
if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['reception']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_reception'; $head[$h][2] = 'attributes_reception';
$h++; $h++;
} }
@ -133,6 +141,10 @@ function reception_admin_prepare_head()
if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['commande_fournisseur_dispatch']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_reception'; $head[$h][2] = 'attributeslines_reception';
$h++; $h++;
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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() 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; $h = 0;
$head = array(); $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][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposal_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['supplier_proposal']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposaldet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposaldet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['supplier_proposaldet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines'; $head[$h][2] = 'attributeslines';
$h++; $h++;

View File

@ -28,10 +28,13 @@
*/ */
function knowledgemanagementAdminPrepareHead() function knowledgemanagementAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf, $db;
$langs->load("knowledgemanagement"); $langs->load("knowledgemanagement");
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('knowledgemanagement_knowledgerecord');
$h = 0; $h = 0;
$head = array(); $head = array();
@ -43,14 +46,13 @@ function knowledgemanagementAdminPrepareHead()
$head[$h][0] = DOL_URL_ROOT.'/admin/knowledgerecord_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/knowledgerecord_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['knowledgemanagement_knowledgerecord']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'extra'; $head[$h][2] = 'extra';
$h++; $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 // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
//$this->tabs = array( //$this->tabs = array(

View File

@ -28,10 +28,13 @@
*/ */
function partnershipAdminPrepareHead() function partnershipAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf, $db;
$langs->loadLangs(array("members", "partnership")); $langs->loadLangs(array("members", "partnership"));
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('partnership');
$h = 0; $h = 0;
$head = array(); $head = array();
@ -43,6 +46,10 @@ function partnershipAdminPrepareHead()
$head[$h][0] = dol_buildpath("/partnership/admin/partnership_extrafields.php", 1); $head[$h][0] = dol_buildpath("/partnership/admin/partnership_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['partnership']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'partnership_extrafields'; $head[$h][2] = 'partnership_extrafields';
$h++; $h++;
@ -51,13 +58,6 @@ function partnershipAdminPrepareHead()
$head[$h][2] = 'website'; $head[$h][2] = 'website';
$h++; $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 // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
//$this->tabs = array( //$this->tabs = array(