Merge pull request #22295 from frederic34/adminbadgeextrafields
NEW show badge with number of extrafields in setup
This commit is contained in:
commit
871ae1d65e
@ -851,6 +851,7 @@ class ExtraFields
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$count = 0;
|
||||
if ($this->db->num_rows($resql)) {
|
||||
while ($tab = $this->db->fetch_object($resql)) {
|
||||
if ($tab->entity != 0 && $tab->entity != $conf->entity) {
|
||||
@ -890,10 +891,12 @@ class ExtraFields
|
||||
$this->attributes[$tab->elementtype]['csslist'][$tab->name] = $tab->csslist;
|
||||
|
||||
$this->attributes[$tab->elementtype]['loaded'] = 1;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if ($elementtype) {
|
||||
$this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded'
|
||||
$this->attributes[$elementtype]['count'] = $count;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -19,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/agenda.lib.php
|
||||
* \brief Set of function for the agenda module
|
||||
* \file htdocs/core/lib/agenda.lib.php
|
||||
* \brief Set of function for the agenda module
|
||||
*/
|
||||
|
||||
|
||||
@ -313,7 +314,7 @@ function show_array_last_actions_done($max = 5)
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$staticaction->type_code = $obj->code;
|
||||
$staticaction->libelle = $obj->label;
|
||||
$staticaction->label = $obj->label;
|
||||
$staticaction->id = $obj->id;
|
||||
print '<td>'.$staticaction->getNomUrl(1, 34).'</td>';
|
||||
|
||||
@ -362,7 +363,11 @@ function show_array_last_actions_done($max = 5)
|
||||
*/
|
||||
function agenda_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('actioncomm');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -395,6 +400,10 @@ function agenda_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['actioncomm']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018-2022 OpenDSI <support@open-dsi.fr>
|
||||
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -28,7 +29,11 @@
|
||||
*/
|
||||
function assetAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('asset');
|
||||
$extrafields->fetch_name_optionals_label('asset_model');
|
||||
|
||||
$langs->load("assets");
|
||||
|
||||
@ -52,11 +57,19 @@ function assetAdminPrepareHead()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/asset/admin/asset_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['asset']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'asset_extrafields';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/asset/admin/assetmodel_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsAssetModel");
|
||||
$nbExtrafields = $extrafields->attributes['asset_model']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'assetmodel_extrafields';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -108,7 +108,11 @@ function contract_prepare_head(Contrat $object)
|
||||
*/
|
||||
function contract_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('contrat');
|
||||
$extrafields->fetch_name_optionals_label('contratdet');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -126,11 +130,19 @@ function contract_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contract_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['contrat']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contractdet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$nbExtrafields = $extrafields->attributes['contratdet']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -28,7 +28,10 @@
|
||||
*/
|
||||
function donation_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('don');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -46,6 +49,10 @@ function donation_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/don/admin/donation_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['don']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2014 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
|
||||
* 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 = $extrafields->attributes['ecm_files']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$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 = $extrafields->attributes['ecm_directories']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes_ecm_directories';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/product.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module produit et service
|
||||
* \ingroup product
|
||||
* \file htdocs/core/lib/product.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module produit et service
|
||||
* \ingroup product
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -279,7 +279,11 @@ function productlot_prepare_head($object)
|
||||
*/
|
||||
function product_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('product');
|
||||
$extrafields->fetch_name_optionals_label('product_fournisseur_price');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -306,11 +310,19 @@ function product_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ProductSupplierExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['product_fournisseur_price']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'supplierAttributes';
|
||||
$h++;
|
||||
|
||||
@ -322,9 +334,9 @@ function product_admin_prepare_head()
|
||||
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @return array head array with tabs
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function product_lot_admin_prepare_head()
|
||||
{
|
||||
@ -556,11 +568,11 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
|
||||
// MO
|
||||
if (!empty($conf->mrp->enabled) && $user->rights->mrp->read) {
|
||||
if (!empty($conf->mrp->enabled) && !empty($user->rights->mrp->read)) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_mo($socid);
|
||||
if ($ret < 0) {
|
||||
setEventMessage($product->error, 'errors');
|
||||
setEventMessages($product->error, $product->errors, 'errors');
|
||||
}
|
||||
$langs->load("mrp");
|
||||
print '<tr><td>';
|
||||
@ -585,7 +597,9 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$parameters = array('socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('addMoreProductStat', $parameters, $product, $nblines); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/project.lib.php
|
||||
* \brief Functions used by project module
|
||||
* \ingroup project
|
||||
* \file htdocs/core/lib/project.lib.php
|
||||
* \brief Functions used by project module
|
||||
* \ingroup project
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
@ -487,11 +487,14 @@ function project_timesheet_prepare_head($mode, $fuser = null)
|
||||
*/
|
||||
function project_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('projet');
|
||||
$extrafields->fetch_name_optionals_label('projet_task');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/admin/project.php";
|
||||
$head[$h][1] = $langs->trans("Projects");
|
||||
@ -502,11 +505,19 @@ function project_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php";
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsProject");
|
||||
$nbExtrafields = $extrafields->attributes['projet']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/admin/project_task_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsProjectTask");
|
||||
$nbExtrafields = $extrafields->attributes['projet_task']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes_task';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/propal.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module propal
|
||||
* \ingroup propal
|
||||
* \file htdocs/core/lib/propal.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module propal
|
||||
* \ingroup propal
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -122,7 +122,11 @@ function propal_prepare_head($object)
|
||||
*/
|
||||
function propal_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('propal');
|
||||
$extrafields->fetch_name_optionals_label('propaldet');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -140,11 +144,19 @@ function propal_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['propal']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$nbExtrafields = $extrafields->attributes['propaldet']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/stock.lib.php
|
||||
* \brief Library file with function for stock module
|
||||
* \file htdocs/core/lib/stock.lib.php
|
||||
* \brief Library file with function for stock module
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -88,7 +88,12 @@ function stock_prepare_head($object)
|
||||
*/
|
||||
function stock_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('entrepot');
|
||||
$extrafields->fetch_name_optionals_label('stock_mouvement');
|
||||
$extrafields->fetch_name_optionals_label('inventory');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -106,16 +111,28 @@ function stock_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['entrepot']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_mouvement_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("StockMouvementExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['stock_mouvement']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'stockMouvementAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("InventoryExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['inventory']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'inventoryAttributes';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file core/lib/ticket.lib.php
|
||||
* \ingroup ticket
|
||||
* \brief This file is a library for Ticket module
|
||||
* \file core/lib/ticket.lib.php
|
||||
* \ingroup ticket
|
||||
* \brief This file is a library for Ticket module
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -30,7 +30,10 @@
|
||||
*/
|
||||
function ticketAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('ticket');
|
||||
|
||||
$langs->load("ticket");
|
||||
|
||||
@ -44,6 +47,10 @@ function ticketAdminPrepareHead()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/ticket_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsTicket");
|
||||
$nbExtrafields = $extrafields->attributes['ticket']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -250,7 +250,11 @@ function group_prepare_head($object)
|
||||
*/
|
||||
function user_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('user');
|
||||
$extrafields->fetch_name_optionals_label('usergroup');
|
||||
|
||||
$langs->load("users");
|
||||
$h = 0;
|
||||
@ -268,11 +272,19 @@ function user_admin_prepare_head()
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Users").")";
|
||||
$nbExtrafields = $extrafields->attributes['user']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Groups").")";
|
||||
$nbExtrafields = $extrafields->attributes['usergroup']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes_group';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
|
||||
* Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
|
||||
* Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
|
||||
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -21,7 +22,7 @@
|
||||
|
||||
/**
|
||||
* \file hrm/lib/hrm.lib.php
|
||||
* \ingroup hr
|
||||
* \ingroup hrm
|
||||
* \brief Library files with common functions for Workstation
|
||||
*/
|
||||
|
||||
@ -32,10 +33,15 @@
|
||||
*/
|
||||
function hrmAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $db;
|
||||
|
||||
$langs->load("hrm");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('hrm_evaluation');
|
||||
$extrafields->fetch_name_optionals_label('hrm_job');
|
||||
$extrafields->fetch_name_optionals_label('hrm_skill');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT . "/admin/hrm.php";
|
||||
@ -43,37 +49,37 @@ function hrmAdminPrepareHead()
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
|
||||
$head[$h][1] = $langs->trans("Establishments");
|
||||
$head[$h][2] = 'establishments';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("EvaluationsExtraFields");
|
||||
$head[$h][2] = 'evaluationsAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("JobsExtraFields");
|
||||
$head[$h][2] = 'jobsAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("SkillsExtraFields");
|
||||
$head[$h][2] = 'skillsAttributes';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = dol_buildpath("/workstation/admin/myobject_extrafields.php", 1);
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'myobject_extrafields';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
|
||||
$head[$h][1] = $langs->trans("Establishments");
|
||||
$head[$h][2] = 'establishments';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
/*$head[$h][0] = require_once "/admin/about.php";
|
||||
$head[$h][1] = $langs->trans("About");
|
||||
$head[$h][2] = 'about';
|
||||
$h++;*/
|
||||
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("EvaluationsExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['hrm_evaluation']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'evaluationsAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("JobsExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['hrm_job']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'jobsAttributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("SkillsExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['hrm_skill']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'skillsAttributes';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
@ -85,7 +91,7 @@ function hrmAdminPrepareHead()
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin');
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove');
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -30,6 +30,10 @@ function mymoduleAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
// global $db;
|
||||
// $extrafields = new ExtraFields($db);
|
||||
// $extrafields->fetch_name_optionals_label('myobject');
|
||||
|
||||
$langs->load("mymodule@mymodule");
|
||||
|
||||
$h = 0;
|
||||
@ -43,6 +47,10 @@ function mymoduleAdminPrepareHead()
|
||||
/*
|
||||
$head[$h][0] = dol_buildpath("/mymodule/admin/myobject_extrafields.php", 1);
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = is_countable($extrafields->attributes['myobject']['label']) ? count($extrafields->attributes['myobject']['label']) : 0;
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= ' <span class="badge">' . $nbExtrafields . '</span>';
|
||||
}
|
||||
$head[$h][2] = 'myobject_extrafields';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user