Merge pull request #23244 from frederic34/patch-10

add extrafields count in admin
This commit is contained in:
Laurent Destailleur 2022-12-17 00:41:29 +01:00 committed by GitHub
commit 86a4e2e824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 9 deletions

View File

@ -73,9 +73,11 @@ function expedition_prepare_head(Expedition $object)
*/ */
function expedition_admin_prepare_head() function expedition_admin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user, $db;
$langs->load("sendings"); $langs->load("sendings");
$extrafields = new ExtraFields($db);
$h = 0; $h = 0;
$head = array(); $head = array();
@ -87,23 +89,29 @@ function expedition_admin_prepare_head()
*/ */
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$extrafields->fetch_name_optionals_label('expedition');
$extrafields->fetch_name_optionals_label('expeditiondet');
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
$head[$h][1] = $langs->trans("Shipment"); $head[$h][1] = $langs->trans("Shipment");
$head[$h][2] = 'shipment'; $head[$h][2] = 'shipment';
$h++; $h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['expedition']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_shipment'; $head[$h][2] = 'attributes_shipment';
$h++; $h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_shipment'; $head[$h][2] = 'attributeslines_shipment';
$h++; $h++;
} }
@ -114,15 +122,24 @@ function expedition_admin_prepare_head()
$h++; $h++;
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
$extrafields->fetch_name_optionals_label('delivery');
$extrafields->fetch_name_optionals_label('deliverydet');
$head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['delivery']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_receivings'; $head[$h][2] = 'attributes_receivings';
$h++; $h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['deliverydet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_receivings'; $head[$h][2] = 'attributeslines_receivings';
$h++; $h++;
} }

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh <testldr9@dolicloud.com> /* Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh <testldr9@dolicloud.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
@ -28,7 +29,11 @@
*/ */
function recruitmentAdminPrepareHead() function recruitmentAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('recruitment_recruitmentjobposition');
$extrafields->fetch_name_optionals_label('recruitment_recruitmentcandidature');
$langs->load("recruitment"); $langs->load("recruitment");
@ -52,11 +57,19 @@ function recruitmentAdminPrepareHead()
$head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1); $head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtrafieldsJobPosition"); $head[$h][1] = $langs->trans("ExtrafieldsJobPosition");
$nbExtrafields = $extrafields->attributes['recruitment_recruitmentjobposition']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'jobposition_extrafields'; $head[$h][2] = 'jobposition_extrafields';
$h++; $h++;
$head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1); $head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtrafieldsApplication"); $head[$h][1] = $langs->trans("ExtrafieldsApplication");
$nbExtrafields = $extrafields->attributes['recruitment_recruitmentcandidature']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'candidature_extrafields'; $head[$h][2] = 'candidature_extrafields';
$h++; $h++;