Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Mar 24, 2018
2 parents 6ef1dbb + 0d563ad commit a1b4465
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 57 deletions.
6 changes: 3 additions & 3 deletions htdocs/ticketsup/class/ticketsup.class.php
Expand Up @@ -1038,7 +1038,7 @@ public function loadCacheTypesTickets()
{
global $langs;

if (count($this->cache_types_tickets)) {
if (! empty($this->cache_types_tickets) && count($this->cache_types_tickets)) {
return 0;
}
// Cache deja charge
Expand Down Expand Up @@ -1078,7 +1078,7 @@ public function loadCacheCategoriesTickets()
{
global $langs;

if (count($this->cache_category_tickets)) {
if (! empty($this->cache_category_ticket) && count($this->cache_category_tickets)) {
return 0;
}
// Cache deja charge
Expand Down Expand Up @@ -1118,7 +1118,7 @@ public function loadCacheSeveritiesTickets()
{
global $langs;

if (count($this->cache_severity_tickets)) {
if (! empty($this->cache_severity_tickets) && count($this->cache_severity_tickets)) {
return 0;
}
// Cache deja charge
Expand Down
2 changes: 1 addition & 1 deletion htdocs/ticketsup/index.php
Expand Up @@ -215,7 +215,7 @@
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']);
Expand Down
28 changes: 10 additions & 18 deletions htdocs/user/class/user.class.php
Expand Up @@ -2744,7 +2744,11 @@ private function load_parentof()
*/
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();

Expand All @@ -2754,23 +2758,11 @@ function get_full_tree($deleteafterid=0, $filter='')
// 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').")";
}
Expand Down
28 changes: 10 additions & 18 deletions htdocs/user/home.php
Expand Up @@ -46,6 +46,10 @@
$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
Expand Down Expand Up @@ -101,23 +105,11 @@
$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').")";
}
Expand Down Expand Up @@ -225,7 +217,7 @@

$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";
}
Expand Down
22 changes: 5 additions & 17 deletions htdocs/user/index.php
Expand Up @@ -191,23 +191,11 @@
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').")";
}
Expand Down

0 comments on commit a1b4465

Please sign in to comment.