Merge pull request #19713 from atm-maxime/fix_missing_resource_stat
Fix : add missing resource stats on stat box
This commit is contained in:
commit
828826c6a2
@ -105,7 +105,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'supplier_invoices',
|
||||
'contracts',
|
||||
'interventions',
|
||||
'ticket'
|
||||
'ticket',
|
||||
'dolresource'
|
||||
);
|
||||
$conditions = array(
|
||||
'users' => $user->rights->user->user->lire,
|
||||
@ -132,7 +133,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire,
|
||||
'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
|
||||
'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read,
|
||||
'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read
|
||||
'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read,
|
||||
'dolresource' => !empty($conf->resource->enabled) && $user->rights->resource->read
|
||||
);
|
||||
$classes = array(
|
||||
'users' => 'User',
|
||||
@ -156,6 +158,7 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'expensereports' => 'ExpenseReport',
|
||||
'holidays' => 'Holiday',
|
||||
'ticket' => 'Ticket',
|
||||
'dolresource' => 'Dolresource'
|
||||
);
|
||||
$includes = array(
|
||||
'users' => DOL_DOCUMENT_ROOT . "/user/class/user.class.php",
|
||||
@ -178,7 +181,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'projects' => DOL_DOCUMENT_ROOT . "/projet/class/project.class.php",
|
||||
'expensereports' => DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php",
|
||||
'holidays' => DOL_DOCUMENT_ROOT . "/holiday/class/holiday.class.php",
|
||||
'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php"
|
||||
'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php",
|
||||
'dolresource' => DOL_DOCUMENT_ROOT . "/resource/class/dolresource.class.php"
|
||||
);
|
||||
$links = array(
|
||||
'users' => DOL_URL_ROOT . '/user/list.php',
|
||||
@ -201,7 +205,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'projects' => DOL_URL_ROOT . '/projet/list.php?mainmenu=project',
|
||||
'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
|
||||
'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
|
||||
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket'
|
||||
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket',
|
||||
'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=tools',
|
||||
);
|
||||
$titres = array(
|
||||
'users' => "Users",
|
||||
@ -225,6 +230,7 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'expensereports' => "ExpenseReports",
|
||||
'holidays' => "Holidays",
|
||||
'ticket' => "Ticket",
|
||||
'dolresource' => "Resources",
|
||||
);
|
||||
$langfile = array(
|
||||
'customers' => "companies",
|
||||
|
||||
@ -1016,4 +1016,35 @@ class Dolresource extends CommonObject
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Charge indicateurs this->nb de tableau de bord
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function load_state_board()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$this->nb = array();
|
||||
|
||||
$sql = "SELECT count(r.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."resource as r";
|
||||
$sql .= " WHERE r.entity IN (".getEntity('resource').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$this->nb["dolresource"] = $obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user