';
print ''.img_object('',$picto).' '.$objMod->getName();
print ' ';
diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example
index 89e1458d4fd..356e76ba374 100644
--- a/htdocs/conf/conf.php.example
+++ b/htdocs/conf/conf.php.example
@@ -324,14 +324,4 @@ $dolibarr_nocsrfcheck='0';
// External module
//##############################
-// multicompany_transverse_mode
-// Prerequisite: Need external module "multicompany"
-// Pyramidal (0): The rights and groups are managed in each entity. Each user belongs to the entity he was created into.
-// Transversal (1): The user is created and managed only into master entity but can login to all entities if he is admmin
-// of entity or belongs to at least one user group created into entity.
-
-// Default value: 0 (pyramidal)
-// Examples:
-// $multicompany_transverse_mode='1';
-
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 578ed17049e..7a70549a2d1 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville
* Copyright (C) 2003 Xavier Dutoit
* Copyright (C) 2004-2016 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2005-2017 Regis Houssin
* Copyright (C) 2006 Jean Heimburger
*
* This program is free software; you can redistribute it and/or modify
@@ -132,14 +132,7 @@ class Conf
$sql = "SELECT ".$db->decrypt('name')." as name,";
$sql.= " ".$db->decrypt('value')." as value, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
- if (! empty($this->multicompany->transverse_mode))
- {
- $sql.= " WHERE entity IN (0,1,".$this->entity.")";
- }
- else
- {
- $sql.= " WHERE entity IN (0,".$this->entity.")";
- }
+ $sql.= " WHERE entity IN (0,".$this->entity.")";
$sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
$resql = $db->query($sql);
@@ -320,7 +313,7 @@ class Conf
// For backward compatibility
$this->user->dir_output=$rootforuser."/users";
$this->user->dir_temp=$rootforuser."/users/temp";
-
+
// UserGroup
$this->usergroup->dir_output=$rootforuser."/usergroups";
$this->usergroup->dir_temp=$rootforuser."/usergroups/temp";
@@ -386,13 +379,13 @@ class Conf
$this->global->MAIN_ACTIVATE_HTML5=1;
$this->global->MAIN_MAIL_USE_MULTI_PART=1;
-
+
// societe
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
-
+
// Security
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask
@@ -425,7 +418,7 @@ class Conf
$this->currency=$this->global->MAIN_MONNAIE;
if (empty($conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
-
+
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
@@ -434,7 +427,7 @@ class Conf
// MAIN_HTML_TITLE
if (! isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly';
-
+
// conf->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
@@ -461,7 +454,7 @@ class Conf
$this->mailing->email_from=$this->email_from;
if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM;
if (! isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID=1;
-
+
// Format for date (used by default when not found or not searched in lang)
$this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
$this->format_date_short_java="dd/MM/yyyy"; // Format of day with Java tags
@@ -485,7 +478,7 @@ class Conf
// Default pdf option
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1; // use dash between lines
if (! isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT=1; // allow html content into free footer text
-
+
// Set default value to MAIN_SHOW_LOGO
if (! isset($this->global->MAIN_SHOW_LOGO)) $this->global->MAIN_SHOW_LOGO=1;
@@ -500,7 +493,7 @@ class Conf
// By default, we open card if one found
if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1;
-
+
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
@@ -568,12 +561,12 @@ class Conf
$this->expensereport->payment = new stdClass();
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
}
-
+
if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
{
$this->global->PRODUIT_MULTIPRICES_LIMIT = 5;
}
-
+
// For modules that want to disable top or left menu
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU;
@@ -585,7 +578,7 @@ class Conf
{
$conf->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
}
-
+
// For backward compatibility
if (isset($this->product)) $this->produit=$this->product;
if (isset($this->facture)) $this->invoice=$this->facture;
@@ -633,7 +626,7 @@ class Conf
$this->loghandlers[$handler] = $loghandlerinstance;
}
}
-
+
}
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b14f72a1b7b..52f46ba6863 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1468,7 +1468,7 @@ class Form
}
else
{
- if (! empty($conf->multicompany->transverse_mode))
+ if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " ON ug.fk_user = u.rowid";
@@ -1565,7 +1565,7 @@ class Form
$moreinfo++;
}
}
- if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
+ if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
if ($obj->admin && ! $obj->entity)
{
@@ -6196,7 +6196,7 @@ class Form
$out.= '>';
$out.= $obj->name;
- if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
+ if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1)
{
$out.= " (".$obj->label.")";
}
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index 419f31dca4d..e77a1196530 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -60,7 +60,7 @@ class InfoBox
$sql.= " d.rowid as box_id, d.file, d.note, d.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
$sql.= " WHERE b.box_id = d.rowid";
- $sql.= " AND b.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
+ $sql.= " AND b.entity IN (0,".$conf->entity.")";
if ($zone >= 0) $sql.= " AND b.position = ".$zone;
if (is_object($user)) $sql.= " AND b.fk_user IN (0,".$user->id.")";
else $sql.= " AND b.fk_user = 0";
@@ -70,9 +70,9 @@ class InfoBox
{
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
- $sql.= " WHERE d.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
+ $sql.= " WHERE d.entity IN (0,".$conf->entity.")";
}
-
+
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php
index ed6b9929a32..a6770b57c37 100644
--- a/htdocs/core/class/menubase.class.php
+++ b/htdocs/core/class/menubase.class.php
@@ -508,7 +508,7 @@ class Menubase
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
- $sql.= " WHERE m.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
+ $sql.= " WHERE m.entity IN (0,".$conf->entity.")";
$sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index c3d8714ab89..b68d7706e43 100755
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -98,7 +98,7 @@ function dolGetModulesDirs($subdir='')
while (($file = readdir($handle))!==false)
{
if (preg_match('/disabled/',$file)) continue; // We discard module if it contains disabled into name.
-
+
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
{
if (is_dir($dirroot . '/' . $file . '/core/modules'.$subdir.'/'))
@@ -207,7 +207,7 @@ function dol_print_object_info($object, $usetable=0)
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
if ($usetable) print '';
-
+
// Import key
if (! empty($object->import_key))
{
@@ -378,7 +378,7 @@ function dol_print_object_info($object, $usetable=0)
if ($usetable) print '';
else print ' ';
}
-
+
// Date approve
if (! empty($object->date_approve2))
{
@@ -391,7 +391,7 @@ function dol_print_object_info($object, $usetable=0)
if ($usetable) print '';
else print ' ';
}
-
+
// User close
if (! empty($object->user_cloture))
{
@@ -476,7 +476,7 @@ function dol_print_object_info($object, $usetable=0)
if ($usetable) print '';
else print ' ';
}
-
+
if ($usetable) print ' ';
}
@@ -799,7 +799,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if(!empty($user->array_options['options_'.$extra])){
$mask = preg_replace('#('.$start.')(.*?)('.$end.')#si', $user->array_options['options_'.$extra], $mask);
}
- }
+ }
$maskwithonlyymcode=$mask;
$maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$maskcounter,$maskwithonlyymcode);
$maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode);
@@ -928,11 +928,11 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset." \n";
// Define $sqlstring
- if (function_exists('mb_strrpos'))
+ if (function_exists('mb_strrpos'))
{
$posnumstart=mb_strrpos($maskwithnocode,$maskcounter, 'UTF-8');
- }
- else
+ }
+ else
{
$posnumstart=strrpos($maskwithnocode,$maskcounter);
} // Pos of counter in final string (from 0 to ...)
@@ -1123,7 +1123,7 @@ function get_string_between($string, $start, $end){
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
- $ini += strlen($start);
+ $ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}
@@ -1539,9 +1539,9 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
$sql = "SELECT nom as id, nom as lib, libelle as label, description as description";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
- $sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
+ $sql.= " AND entity IN (0,".$conf->entity.")";
$sql.= " ORDER BY description DESC";
-
+
dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
@@ -1625,7 +1625,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
/**
* This function evaluates a string that should be a valid IPv4
* Note: For ip 169.254.0.0, it returns 0 with some PHP (5.6.24) and 2 with some minor patchs of PHP (5.6.25). See https://github.com/php/php-src/pull/1954.
- *
+ *
* @param string $ip IP Address
* @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP
*/
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 1c919237f44..f39e6ecd628 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2010-2012 Regis Houssin
+ * Copyright (C) 2010-2017 Regis Houssin
* Copyright (C) 2015 Alexandre Spangaro
*
* This program is free software; you can redistribute it and/or modify
@@ -76,7 +76,7 @@ function user_prepare_head($object)
{
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
-
+
$i=1;
$nbagenda = 0;
while ($i <= $MAXAGENDA)
@@ -87,10 +87,10 @@ function user_prepare_head($object)
$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
$i++;
-
+
if (! empty($object->conf->$name)) $nbagenda++;
}
-
+
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' '.$nbagenda.'' : '');
$head[$h][2] = 'extsites';
@@ -238,8 +238,6 @@ function group_prepare_head($object)
return $head;
}
-
-
/**
* Prepare array with list of tabs
*
@@ -283,32 +281,6 @@ function user_admin_prepare_head()
return $head;
}
-
-
-/**
- * Prepare array with list of tabs
- *
- * @param Object $object Object related to tabs
- * @param array $aEntities Entities array
- * @return array Array of tabs
- */
-function entity_prepare_head($object, $aEntities)
-{
- global $mc;
-
- $head = array();
-
- foreach($aEntities as $entity)
- {
- $mc->getInfo($entity);
- $head[$entity][0] = $_SERVER['PHP_SELF'].'?id='.$object->id.'&entity='.$entity;
- $head[$entity][1] = $mc->label;
- $head[$entity][2] = $entity;
- }
-
- return $head;
-}
-
/**
* Show list of themes. Show all thumbs of themes
*
@@ -485,7 +457,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print ' | ';
}
-
+
// Background color THEME_ELDY_BACKBODY
if ($foruserprofile)
{
@@ -508,7 +480,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
else print '';
}
if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
- print '';*/
+ print '';*/
}
else
{
@@ -530,7 +502,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print '';
}
-
+
// TopMenuBackgroundColor
if ($foruserprofile)
{
@@ -553,13 +525,13 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
else print '';
}
if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
- print '';*/
+ print '';*/
}
else
{
$default='5a6482';
if ($conf->theme == 'md') $default='5a3278';
-
+
print '