Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-03-24 18:28:23 +01:00
commit a1b44651e5
5 changed files with 29 additions and 57 deletions

View File

@ -1038,7 +1038,7 @@ class Ticketsup extends CommonObject
{
global $langs;
if (count($this->cache_types_tickets)) {
if (! empty($this->cache_types_tickets) && count($this->cache_types_tickets)) {
return 0;
}
// Cache deja charge
@ -1078,7 +1078,7 @@ class Ticketsup extends CommonObject
{
global $langs;
if (count($this->cache_category_tickets)) {
if (! empty($this->cache_category_ticket) && count($this->cache_category_tickets)) {
return 0;
}
// Cache deja charge
@ -1118,7 +1118,7 @@ class Ticketsup extends CommonObject
{
global $langs;
if (count($this->cache_severity_tickets)) {
if (! empty($this->cache_severity_tickets) && count($this->cache_severity_tickets)) {
return 0;
}
// Cache deja charge

View File

@ -215,7 +215,7 @@ print '<tr class="liste_titre"><th >' . $langs->trans("Statistics") . ' ' . img_
print '<tr><td>';
// don't display graph if no series
if (count($dataseries) >1) {
if (! empty($dataseries) && count($dataseries) > 1) {
$data = array();
foreach ($dataseries as $key => $value) {
$data[] = array($value['label'], $value['data']);

View File

@ -2744,7 +2744,11 @@ class User extends CommonObject
*/
function get_full_tree($deleteafterid=0, $filter='')
{
global $conf,$user;
global $conf, $user;
global $hookmanager;
// Actions hooked (by external module)
$hookmanager->initHooks(array('userdao'));
$this->users = array();
@ -2754,23 +2758,11 @@ class User extends CommonObject
// Init $this->users array
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
// TODO add hook
if (! empty($conf->multicompany->enabled)) {
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (! empty($user->admin) && empty($user->entity)) {
if ($conf->entity == 1) {
$sql.= " WHERE u.entity IS NOT NULL";
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
} else {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('user').")";
}
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printUserListWhere',$parameters); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
$sql.=$hookmanager->resPrint;
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}

View File

@ -46,6 +46,10 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
$companystatic = new Societe($db);
$fuserstatic = new User($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$contextpage=array('userhome');
$hookmanager->initHooks($contextpage);
/*
* View
@ -101,23 +105,11 @@ $sql.= ", s.code_client";
$sql.= ", s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
// TODO add hook
if (! empty($conf->multicompany->enabled)) {
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (! empty($user->admin) && empty($user->entity)) {
if ($conf->entity == 1) {
$sql.= " WHERE u.entity IS NOT NULL";
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
} else {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('user').")";
}
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printUserListWhere',$parameters); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
$sql.=$hookmanager->resPrint;
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
@ -225,7 +217,7 @@ if ($canreadperms)
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g";
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity)))
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity)))
{
$sql.= " WHERE g.entity IS NOT NULL";
}

View File

@ -191,23 +191,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user_extrafields as ef on (u.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
// TODO add hook
if (! empty($conf->multicompany->enabled)) {
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (! empty($user->admin) && empty($user->entity)) {
if ($conf->entity == 1) {
$sql.= " WHERE u.entity IS NOT NULL";
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
} else {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('user').")";
}
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printUserListWhere',$parameters); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
$sql.=$hookmanager->resPrint;
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}