Update expensereport.lib.php

This commit is contained in:
Frédéric FRANCE 2022-11-30 18:26:26 +01:00 committed by GitHub
parent 168969a06d
commit 65b85adcaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
<?php
/* 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
* 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] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;