Skip to content
Snippets Groups Projects
Commit ca28aa77 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: multicompany transverse mode compatibility

parent e9de1230
No related branches found
No related tags found
No related merge requests found
...@@ -512,7 +512,7 @@ class User extends CommonObject ...@@ -512,7 +512,7 @@ class User extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.id = ur.fk_id"; $sql.= " WHERE r.id = ur.fk_id";
$sql.= " AND r.entity IN (0,".(!empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND r.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
$sql.= " AND ur.fk_user= ".$this->id; $sql.= " AND ur.fk_user= ".$this->id;
$sql.= " AND r.perms IS NOT NULL"; $sql.= " AND r.perms IS NOT NULL";
if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'"; if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'";
...@@ -557,11 +557,14 @@ class User extends CommonObject ...@@ -557,11 +557,14 @@ class User extends CommonObject
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; $sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,";
$sql.= " ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.id = gr.fk_id"; $sql.= " WHERE r.id = gr.fk_id";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) {
$sql.= " AND gu.entity IN (0,".$conf->entity.")";
} else {
$sql.= " AND r.entity = ".$conf->entity;
}
$sql.= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql.= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql.= " AND gu.fk_user = ".$this->id; $sql.= " AND gu.fk_user = ".$this->id;
$sql.= " AND r.perms IS NOT NULL"; $sql.= " AND r.perms IS NOT NULL";
$sql.= " AND r.entity = ".$conf->entity;
$sql.= " AND gu.entity IN (0,".$conf->entity.")";
if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'"; if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'";
dol_syslog(get_class($this).'::getrights sql='.$sql, LOG_DEBUG); dol_syslog(get_class($this).'::getrights sql='.$sql, LOG_DEBUG);
...@@ -1418,7 +1421,7 @@ class User extends CommonObject ...@@ -1418,7 +1421,7 @@ class User extends CommonObject
} }
if (! empty($dolibarr_main_force_https) if (! empty($dolibarr_main_force_https)
|| (! empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on')) $urlwithouturlroot=preg_replace('/http:/i','https:',$urlwithouturlroot); || (! empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on')) $urlwithouturlroot=preg_replace('/http:/i','https:',$urlwithouturlroot);
// TODO Use outputlangs to translate messages // TODO Use outputlangs to translate messages
if (! $changelater) if (! $changelater)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment