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

This commit is contained in:
Laurent Destailleur 2011-11-05 03:18:19 +01:00
commit 97573659c2
24 changed files with 236 additions and 190 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ default.properties
dolibarr_install.log dolibarr_install.log
doxygen_warnings.log doxygen_warnings.log
/.project /.project
.DS_Store

View File

@ -151,7 +151,7 @@ $db->commit();
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND entity in (".(!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)?"1,":"").$conf->entity.")"; $sql.= " AND entity in (".(!empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
$sql.= " ORDER BY r.module, r.id"; $sql.= " ORDER BY r.module, r.id";

View File

@ -279,4 +279,17 @@ $dolibarr_main_prod='0';
#$dolibarr_font_DOL_DEFAULT_TTF="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"; #$dolibarr_font_DOL_DEFAULT_TTF="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf";
#$dolibarr_font_DOL_DEFAULT_TTF_BOLD="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf"; #$dolibarr_font_DOL_DEFAULT_TTF_BOLD="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf";
##############################
# Extrernal module #
##############################
# multicompany_transverse_mode
# Pyramidal (0): The rights and groups are managed in each entity,
# users belong to the entity for their rights.
# Transversal (1): The groups can belong only to the master entity
# and that the user belongs to a particular entity
# Default value: 0 (pyramidal)
# Examples:
# $multicompany_transverse_mode='1';
?> ?>

View File

@ -50,6 +50,12 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
$fk_element = GETPOST('fk_element'); $fk_element = GETPOST('fk_element');
$type = GETPOST('type'); $type = GETPOST('type');
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}
if ($element == 'fichinter') $element = 'ficheinter'; if ($element == 'fichinter') $element = 'ficheinter';
if ($user->rights->$element->lire || $user->rights->$element->read) if ($user->rights->$element->lire || $user->rights->$element->read)
@ -72,7 +78,7 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
} }
else else
{ {
echo $langs->trans('NotEnoughPermissions'); echo $langs->transnoentities('NotEnoughPermissions');
} }
} }

View File

@ -56,6 +56,12 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
$return=array(); $return=array();
$error=0; $error=0;
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}
if ($element == 'fichinter') $element = 'ficheinter'; if ($element == 'fichinter') $element = 'ficheinter';
if ($user->rights->$element->creer || $user->rights->$element->write) if ($user->rights->$element->creer || $user->rights->$element->write)

View File

@ -53,6 +53,8 @@ class Conf
var $top_menu; var $top_menu;
var $smart_menu; var $smart_menu;
//! To store properties of multi-company
var $multicompany;
//! Used to store instance for multi-company (default 1) //! Used to store instance for multi-company (default 1)
var $entity=1; var $entity=1;
@ -89,9 +91,10 @@ class Conf
/** /**
* Load setup values into conf object (read llx_const) * Load setup values into conf object (read llx_const)
* @param $db Handler d'acces base *
* @return int < 0 if KO, >= 0 if OK * @param DoliDB $db Handler d'acces base
* @return int < 0 if KO, >= 0 if OK
*/ */
function setValues($db) function setValues($db)
{ {
@ -112,7 +115,14 @@ class Conf
$sql = "SELECT ".$db->decrypt('name')." as name,"; $sql = "SELECT ".$db->decrypt('name')." as name,";
$sql.= " ".$db->decrypt('value')." as value, entity"; $sql.= " ".$db->decrypt('value')." as value, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (0,".$this->entity.")"; if (! empty($this->multicompany->transverse_mode))
{
$sql.= " WHERE entity IN (0,1,".$this->entity.")";
}
else
{
$sql.= " WHERE entity IN (0,".$this->entity.")";
}
$sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite. $sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -973,7 +973,7 @@ class Form
} }
$out.= $userstatic->getFullName($langs); $out.= $userstatic->getFullName($langs);
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
if ($obj->admin && ! $obj->entity) $out.=" (".$langs->trans("AllEntities").")"; if ($obj->admin && ! $obj->entity) $out.=" (".$langs->trans("AllEntities").")";
else $out.=" (".$obj->label.")"; else $out.=" (".$obj->label.")";
@ -3734,7 +3734,7 @@ class Form
$out.= '>'; $out.= '>';
$out.= $obj->nom; $out.= $obj->nom;
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) if(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
{ {
$out.= " (".$obj->label.")"; $out.= " (".$obj->label.")";
} }

View File

@ -7,9 +7,9 @@
$(document).ready(function() { $(document).ready(function() {
var element = $('#element').html(); var element = $('#jeditable_element').html();
var table_element = $('#table_element').html(); var table_element = $('#jeditable_table_element').html();
var fk_element = $('#fk_element').html(); var fk_element = $('#jeditable_fk_element').html();
$('.edit_textarea').editable(urlSaveInPlace, { $('.edit_textarea').editable(urlSaveInPlace, {
type : 'textarea', type : 'textarea',
@ -131,7 +131,7 @@ $(document).ready(function() {
id : 'field', id : 'field',
onblur : 'ignore', onblur : 'ignore',
tooltip : tooltipInPlace, tooltip : tooltipInPlace,
placeholder : placeholderInPlace, placeholder : '&nbsp;',
cancel : cancelInPlace, cancel : cancelInPlace,
submit : submitInPlace, submit : submitInPlace,
indicator : indicatorInPlace, indicator : indicatorInPlace,

View File

@ -771,54 +771,55 @@ function dol_delete_preview($object)
} }
/** /**
* Create a meta file with document file into same directory. * Create a meta file with document file into same directory.
* This should allow rgrep search * This should allow rgrep search
* *
* @param Object $object Object * @param Object $object Object
* @return void * @return void
*/ */
function dol_meta_create($object) function dol_meta_create($object)
{ {
global $langs,$conf; global $langs,$conf;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$facref = dol_sanitizeFileName($object->ref); $facref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output . "/" . $facref ; $dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".meta"; $file = $dir . "/" . $facref . ".meta";
if (! is_dir($dir)) if (! is_dir($dir))
{ {
create_exdir($dir); create_exdir($dir);
} }
if (is_dir($dir)) if (is_dir($dir))
{ {
$nblignes = count($object->lines); $nblignes = count($object->lines);
$client = $object->client->nom . " " . $object->client->address . " " . $object->client->cp . " " . $object->client->ville; $client = $object->client->nom . " " . $object->client->address . " " . $object->client->cp . " " . $object->client->ville;
$meta = "REFERENCE=\"" . $object->ref . "\" $meta = "REFERENCE=\"" . $object->ref . "\"
DATE=\"" . dol_print_date($object->date,'') . "\" DATE=\"" . dol_print_date($object->date,'') . "\"
NB_ITEMS=\"" . $nblignes . "\" NB_ITEMS=\"" . $nblignes . "\"
CLIENT=\"" . $client . "\" CLIENT=\"" . $client . "\"
TOTAL_HT=\"" . $object->total_ht . "\" TOTAL_HT=\"" . $object->total_ht . "\"
TOTAL_TTC=\"" . $object->total_ttc . "\"\n"; TOTAL_TTC=\"" . $object->total_ttc . "\"\n";
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
//Pour les articles //Pour les articles
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\" $meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\"
ITEM_" . $i . "_UNIT_PRICE=\"" . $object->lines[$i]->price . "\" ITEM_" . $i . "_UNIT_PRICE=\"" . $object->lines[$i]->price . "\"
ITEM_" . $i . "_TVA=\"" .$object->lines[$i]->tva_tx . "\" ITEM_" . $i . "_TVA=\"" .$object->lines[$i]->tva_tx . "\"
ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($object->lines[$i]->desc)) . "\" ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($object->lines[$i]->desc)) . "\"
"; ";
} }
} }
$fp = fopen($file,"w");
fputs($fp,$meta); $fp = fopen($file,"w");
fclose($fp); fputs($fp,$meta);
if (! empty($conf->global->MAIN_UMASK)) fclose($fp);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
} }
} }

View File

@ -599,9 +599,9 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
// Parameters for edit in place // Parameters for edit in place
if (! empty($GLOBALS['object'])) if (! empty($GLOBALS['object']))
{ {
$out.='<div id="element" class="hidden">'.$GLOBALS['object']->element.'</div>'."\n"; $out.='<div id="jeditable_element" class="hidden">'.$GLOBALS['object']->element.'</div>'."\n";
$out.='<div id="table_element" class="hidden">'.$GLOBALS['object']->table_element.'</div>'."\n"; $out.='<div id="jeditable_table_element" class="hidden">'.$GLOBALS['object']->table_element.'</div>'."\n";
$out.='<div id="fk_element" class="hidden">'.$GLOBALS['object']->id.'</div>'."\n"; $out.='<div id="jeditable_fk_element" class="hidden">'.$GLOBALS['object']->id.'</div>'."\n";
} }
return $out; return $out;
@ -4445,4 +4445,4 @@ function printCommonFooter($zone='private')
} }
?> ?>

View File

@ -86,6 +86,7 @@ if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0; if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8'; if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8';
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;
// Security: CSRF protection // Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST']) // This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])

View File

@ -71,17 +71,30 @@ DROP TABLE IF EXISTS llx_pos_tmp;
ALTER TABLE llx_deplacement ADD COLUMN fk_user_modif integer AFTER fk_user_author; ALTER TABLE llx_deplacement ADD COLUMN fk_user_modif integer AFTER fk_user_author;
CREATE TABLE IF NOT EXISTS `llx_localtax` ( CREATE TABLE IF NOT EXISTS llx_localtax
`rowid` int(11) NOT NULL AUTO_INCREMENT, (
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, rowid integer AUTO_INCREMENT PRIMARY KEY,
`datep` date DEFAULT NULL, entity integer NOT NULL DEFAULT '1',
`datev` date DEFAULT NULL, tms timestamp,
`amount` double NOT NULL DEFAULT '0', datep date DEFAULT NULL,
`label` varchar(255) DEFAULT NULL, datev date DEFAULT NULL,
`entity` int(11) NOT NULL DEFAULT '1', amount double NOT NULL DEFAULT '0',
`note` text, label varchar(255) DEFAULT NULL,
`fk_bank` int(11) DEFAULT NULL, note text,
`fk_user_creat` int(11) DEFAULT NULL, fk_bank integer DEFAULT NULL,
`fk_user_modif` int(11) DEFAULT NULL, fk_user_creat integer DEFAULT NULL,
PRIMARY KEY (`rowid`) fk_user_modif integer DEFAULT NULL
) ENGINE=InnoDB; ) ENGINE=InnoDB;
ALTER TABLE llx_propal MODIFY ref_int varchar(255);
ALTER TABLE llx_propal MODIFY ref_ext varchar(255);
ALTER TABLE llx_propal MODIFY ref_client varchar(255);
ALTER TABLE llx_commande MODIFY ref_int varchar(255);
ALTER TABLE llx_commande MODIFY ref_ext varchar(255);
ALTER TABLE llx_commande MODIFY ref_client varchar(255);
ALTER TABLE llx_facture MODIFY ref_int varchar(255);
ALTER TABLE llx_facture MODIFY ref_ext varchar(255);
ALTER TABLE llx_facture MODIFY ref_client varchar(255);

View File

@ -21,24 +21,24 @@
create table llx_commande create table llx_commande
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- order reference number ref varchar(30) NOT NULL, -- order reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(50), -- reference into an external system (not used by dolibarr) ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
ref_int varchar(50), -- reference into an internal system (used by dolibarr) ref_int varchar(255), -- reference into an internal system (used by dolibarr)
ref_client varchar(50), -- reference for customer ref_client varchar(255), -- reference for customer
fk_soc integer NOT NULL, fk_soc integer NOT NULL,
fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande
tms timestamp, tms timestamp,
date_creation datetime, -- date de creation date_creation datetime, -- date de creation
date_valid datetime, -- date de validation date_valid datetime, -- date de validation
date_cloture datetime, -- date de cloture date_cloture datetime, -- date de cloture
date_commande date, -- date de la commande date_commande date, -- date de la commande
fk_user_author integer, -- createur de la commande fk_user_author integer, -- createur de la commande
fk_user_valid integer, -- valideur de la commande fk_user_valid integer, -- valideur de la commande
fk_user_cloture integer, -- auteur cloture fk_user_cloture integer, -- auteur cloture
source smallint, source smallint,
fk_statut smallint default 0, fk_statut smallint default 0,
amount_ht real default 0, amount_ht real default 0,
@ -46,8 +46,8 @@ create table llx_commande
remise_absolue real default 0, remise_absolue real default 0,
remise real default 0, remise real default 0,
tva double(24,8) default 0, tva double(24,8) default 0,
localtax1 double(24,8) default 0, -- total localtax1 localtax1 double(24,8) default 0, -- total localtax1
localtax2 double(24,8) default 0, -- total localtax2 localtax2 double(24,8) default 0, -- total localtax2
total_ht double(24,8) default 0, total_ht double(24,8) default 0,
total_ttc double(24,8) default 0, total_ttc double(24,8) default 0,
note text, note text,
@ -55,11 +55,11 @@ create table llx_commande
model_pdf varchar(255), model_pdf varchar(255),
facture tinyint default 0, facture tinyint default 0,
fk_cond_reglement integer, -- condition de reglement fk_cond_reglement integer, -- condition de reglement
fk_mode_reglement integer, -- mode de reglement fk_mode_reglement integer, -- mode de reglement
date_livraison date default NULL, date_livraison date default NULL,
fk_availability integer NULL, fk_availability integer NULL,
fk_demand_reason integer, -- should be named fk_input_reason fk_demand_reason integer, -- should be named fk_input_reason
fk_adresse_livraison integer, -- delivery address (deprecated) fk_adresse_livraison integer, -- delivery address (deprecated)
import_key varchar(14) import_key varchar(14)
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -24,28 +24,28 @@ create table llx_facture
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
facnumber varchar(30) NOT NULL, -- invoice reference number facnumber varchar(30) NOT NULL, -- invoice reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(50), -- reference into an external system (not used by dolibarr) ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
ref_int varchar(50), -- reference into an internal system (used by dolibarr) ref_int varchar(255), -- reference into an internal system (used by dolibarr)
ref_client varchar(50), -- reference for customer ref_client varchar(255), -- reference for customer
type smallint DEFAULT 0 NOT NULL, -- type of invoice type smallint DEFAULT 0 NOT NULL, -- type of invoice
increment varchar(10), increment varchar(10),
fk_soc integer NOT NULL, fk_soc integer NOT NULL,
datec datetime, -- date de creation de la facture datec datetime, -- date de creation de la facture
datef date, -- date de la facture datef date, -- date de la facture
date_valid date, -- date de validation date_valid date, -- date de validation
tms timestamp, -- date creation/modification tms timestamp, -- date creation/modification
paye smallint DEFAULT 0 NOT NULL, paye smallint DEFAULT 0 NOT NULL,
amount double(24,8) DEFAULT 0 NOT NULL, amount double(24,8) DEFAULT 0 NOT NULL,
remise_percent real DEFAULT 0, -- remise relative remise_percent real DEFAULT 0, -- remise relative
remise_absolue real DEFAULT 0, -- remise absolue remise_absolue real DEFAULT 0, -- remise absolue
remise real DEFAULT 0, -- remise totale calculee remise real DEFAULT 0, -- remise totale calculee
close_code varchar(16), -- Code motif cloture sans paiement complet close_code varchar(16), -- Code motif cloture sans paiement complet
close_note varchar(128), -- Commentaire cloture sans paiement complet close_note varchar(128), -- Commentaire cloture sans paiement complet
tva double(24,8) DEFAULT 0, -- montant tva apres remise totale tva double(24,8) DEFAULT 0, -- montant tva apres remise totale
localtax1 double(24,8) DEFAULT 0, -- amount localtax1 localtax1 double(24,8) DEFAULT 0, -- amount localtax1
@ -55,15 +55,15 @@ create table llx_facture
fk_statut smallint DEFAULT 0 NOT NULL, fk_statut smallint DEFAULT 0 NOT NULL,
fk_user_author integer, -- createur de la facture fk_user_author integer, -- createur de la facture
fk_user_valid integer, -- valideur de la facture fk_user_valid integer, -- valideur de la facture
fk_facture_source integer, -- facture origine si facture avoir fk_facture_source integer, -- facture origine si facture avoir
fk_projet integer, -- projet auquel est associee la facture fk_projet integer, -- projet auquel est associee la facture
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement)
date_lim_reglement date, -- date limite de reglement date_lim_reglement date, -- date limite de reglement
note text, note text,
note_public text, note_public text,

View File

@ -1,7 +1,6 @@
-- =================================================================== -- ===================================================================
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> -- Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by -- it under the terms of the GNU General Public License as published by
@ -21,22 +20,15 @@
create table llx_localtax create table llx_localtax
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
tms timestamp, tms timestamp,
datep date, -- date of payment datep date, -- date of payment
datev date, -- date of value datev date, -- date of value
amount real NOT NULL DEFAULT 0, amount double,
label varchar(255), label varchar(255),
entity integer DEFAULT 1 NOT NULL,
note text, note text,
fk_bank integer, fk_bank integer,
fk_user_creat integer, fk_user_creat integer,
fk_user_modif integer fk_user_modif integer
)ENGINE=innodb; )ENGINE=innodb;
--
-- List of codes for the field entity
--
-- 1 : first company vat
-- 2 : second company vat
-- 3 : etc...
--

View File

@ -23,14 +23,14 @@ create table llx_propal
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- proposal reference number ref varchar(30) NOT NULL, -- proposal reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(50), -- reference into an external system (not used by dolibarr) ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
ref_int varchar(50), -- reference into an internal system (used by dolibarr) ref_int varchar(255), -- reference into an internal system (used by dolibarr)
ref_client varchar(50), -- customer proposal number ref_client varchar(255), -- customer proposal number
fk_soc integer, fk_soc integer,
fk_projet integer DEFAULT 0, -- projet auquel est rattache la propale fk_projet integer DEFAULT 0, -- projet auquel est rattache la propale
tms timestamp, tms timestamp,
datec datetime, -- date de creation datec datetime, -- date de creation

View File

@ -43,31 +43,31 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/conf.class.php");
$conf = new Conf(); $conf = new Conf();
// Identifiant propres au serveur base de donnee // Identifiant propres au serveur base de donnee
$conf->db->host = $dolibarr_main_db_host; $conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port; $conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name; $conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user; $conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass; $conf->db->pass = $dolibarr_main_db_pass;
$conf->db->type = $dolibarr_main_db_type; $conf->db->type = $dolibarr_main_db_type;
$conf->db->prefix = $dolibarr_main_db_prefix; $conf->db->prefix = $dolibarr_main_db_prefix;
$conf->db->character_set=$dolibarr_main_db_character_set; $conf->db->character_set = $dolibarr_main_db_character_set;
$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation; $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
$conf->file->main_limit_users = $dolibarr_main_limit_users; $conf->file->main_limit_users = $dolibarr_main_limit_users;
$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; $conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // For test purpose if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // For test purpose
// Identifiant autres // Identifiant autres
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication;
// Force https // Force https
$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; $conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https;
// Define charset for HTML Output (can set hidden value force_charset in conf file) // Define charset for HTML Output (can set hidden value force_charset in conf file)
$conf->file->character_set_client=strtoupper($force_charset_do_notuse); $conf->file->character_set_client = strtoupper($force_charset_do_notuse);
// Cookie cryptkey // Cookie cryptkey
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; $conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey;
// Define array of document root directories // Define array of document root directories
$conf->file->dol_document_root=array('main' => DOL_DOCUMENT_ROOT); $conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT);
if (! empty($dolibarr_main_document_root_alt)) if (! empty($dolibarr_main_document_root_alt))
{ {
// dolibarr_main_document_root_alt contains several directories // dolibarr_main_document_root_alt contains several directories
@ -78,6 +78,9 @@ if (! empty($dolibarr_main_document_root_alt))
} }
} }
// Multi-Company transverse mode
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
// Chargement des includes principaux de librairies communes // Chargement des includes principaux de librairies communes
if (! defined('NOREQUIREUSER')) require_once(DOL_DOCUMENT_ROOT ."/user/class/user.class.php"); // Need 500ko memory if (! defined('NOREQUIREUSER')) require_once(DOL_DOCUMENT_ROOT ."/user/class/user.class.php"); // Need 500ko memory
if (! defined('NOREQUIRETRAN')) require_once(DOL_DOCUMENT_ROOT ."/core/class/translate.class.php"); if (! defined('NOREQUIRETRAN')) require_once(DOL_DOCUMENT_ROOT ."/core/class/translate.class.php");

View File

@ -502,7 +502,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->global->MULTICOMPANY_TRANSVERSE_MODE)?"1,":"").$conf->entity.")"; $sql.= " AND r.entity in (0,".(!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)."'";

View File

@ -64,7 +64,7 @@ if ($id)
} }
//Multicompany in mode transversal //Multicompany in mode transversal
if(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multicompany->transverse_mode)
{ {
accessforbidden(); accessforbidden();
} }
@ -205,7 +205,7 @@ if ($action == 'add' && $canadduser)
// If multicompany is off, admin users must all be on entity 0. // If multicompany is off, admin users must all be on entity 0.
if($conf->multicompany->enabled) if($conf->multicompany->enabled)
{ {
if($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ! empty($_POST["superadmin"])) if($conf->multicompany->transverse_mode || ! empty($_POST["superadmin"]))
{ {
$edituser->entity=0; $edituser->entity=0;
} }
@ -261,8 +261,8 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
$edituser = new User($db); $edituser = new User($db);
$edituser->fetch($id); $edituser->fetch($id);
if ($action == 'addgroup') $edituser->SetInGroup($group,($conf->global->MULTICOMPANY_TRANSVERSE_MODE?GETPOST("entity"):$editgroup->entity)); if ($action == 'addgroup') $edituser->SetInGroup($group,($conf->multicompany->transverse_mode?GETPOST("entity"):$editgroup->entity));
if ($action == 'removegroup') $edituser->RemoveFromGroup($group,($conf->global->MULTICOMPANY_TRANSVERSE_MODE?GETPOST("entity"):$editgroup->entity)); if ($action == 'removegroup') $edituser->RemoveFromGroup($group,($conf->multicompany->transverse_mode?GETPOST("entity"):$editgroup->entity));
if ($result > 0) if ($result > 0)
{ {
@ -319,7 +319,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$edituser->phenix_pass = $_POST["phenix_pass"]; $edituser->phenix_pass = $_POST["phenix_pass"];
if($conf->multicompany->enabled) if($conf->multicompany->enabled)
{ {
if($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ! empty($_POST["superadmin"])) if($conf->multicompany->transverse_mode || ! empty($_POST["superadmin"]))
{ {
$edituser->entity=0; $edituser->entity=0;
} }
@ -704,7 +704,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print '<td>'; print '<td>';
print $form->selectyesno('admin',$_POST["admin"],1); print $form->selectyesno('admin',$_POST["admin"],1);
if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode))
{ {
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
@ -744,7 +744,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
//Multicompany //Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
@ -1076,7 +1076,7 @@ else
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">'; print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">';
if ($fuser->admin && ! $fuser->entity) if ($fuser->admin && ! $fuser->entity)
@ -1237,7 +1237,7 @@ else
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($caneditfield && (empty($conf->multicompany->enabled) || (($fuser->entity == $conf->entity) || $fuser->entity == $user->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)) ) if ($caneditfield && (empty($conf->multicompany->enabled) || (($fuser->entity == $conf->entity) || $fuser->entity == $user->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
{ {
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
{ {
@ -1249,7 +1249,7 @@ else
} }
} }
elseif ($caneditpassword && ! $fuser->ldap_sid && elseif ($caneditpassword && ! $fuser->ldap_sid &&
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)) ) (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
{ {
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=edit">'.$langs->trans("EditPassword").'</a>'; print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=edit">'.$langs->trans("EditPassword").'</a>';
} }
@ -1258,13 +1258,13 @@ else
if ($conf->global->USER_PASSWORD_GENERATED != 'none') if ($conf->global->USER_PASSWORD_GENERATED != 'none')
{ {
if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid && if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid &&
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
{ {
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=password">'.$langs->trans("ReinitPassword").'</a>'; print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=password">'.$langs->trans("ReinitPassword").'</a>';
} }
if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid && if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid &&
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)) ) (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
{ {
if ($fuser->email) print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=passwordsend">'.$langs->trans("SendNewPassword").'</a>'; if ($fuser->email) print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a>'; else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a>';
@ -1273,19 +1273,19 @@ else
// Activer // Activer
if ($user->id <> $id && $candisableuser && $fuser->statut == 0 && if ($user->id <> $id && $candisableuser && $fuser->statut == 0 &&
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)) ) (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
{ {
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=enable">'.$langs->trans("Reactivate").'</a>'; print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=enable">'.$langs->trans("Reactivate").'</a>';
} }
// Desactiver // Desactiver
if ($user->id <> $id && $candisableuser && $fuser->statut == 1 && if ($user->id <> $id && $candisableuser && $fuser->statut == 1 &&
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)) ) (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
{ {
print '<a class="butActionDelete" href="fiche.php?action=disable&amp;id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>'; print '<a class="butActionDelete" href="fiche.php?action=disable&amp;id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>';
} }
// Delete // Delete
if ($user->id <> $id && $candisableuser && if ($user->id <> $id && $candisableuser &&
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)) ) (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
{ {
print '<a class="butActionDelete" href="fiche.php?action=delete&amp;id='.$fuser->id.'">'.$langs->trans("DeleteUser").'</a>'; print '<a class="butActionDelete" href="fiche.php?action=delete&amp;id='.$fuser->id.'">'.$langs->trans("DeleteUser").'</a>';
} }
@ -1311,7 +1311,7 @@ else
if (! empty($groupslist)) if (! empty($groupslist))
{ {
if( ! ($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if( ! ($conf->multicompany->enabled && $conf->multicompany->transverse_mode))
{ {
foreach($groupslist as $groupforuser) foreach($groupslist as $groupforuser)
{ {
@ -1334,7 +1334,7 @@ else
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if ($conf->entity == 1 && $conf->multicompany->transverse_mode)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
print '</td><td valign="top">'.$langs->trans("Entity").'</td>'; print '</td><td valign="top">'.$langs->trans("Entity").'</td>';
@ -1362,7 +1362,7 @@ else
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>'; print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>';
if(! empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>'; print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>';
} }
@ -1387,7 +1387,7 @@ else
print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom; print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom;
} }
print '</td>'; print '</td>';
if(! empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
$mc->getInfo($group->usergroup_entity); $mc->getInfo($group->usergroup_entity);
@ -1544,7 +1544,7 @@ else
{ {
print $form->selectyesno('admin',$fuser->admin,1); print $form->selectyesno('admin',$fuser->admin,1);
if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode))
{ {
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
@ -1602,7 +1602,7 @@ else
//Multicompany //Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if(empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';

View File

@ -51,7 +51,7 @@ $userid=GETPOST("user","int");
// Security check // Security check
$result = restrictedArea($user, 'user', $_GET["id"], 'usergroup', 'user'); $result = restrictedArea($user, 'user', $_GET["id"], 'usergroup', 'user');
if(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multicompany->transverse_mode)
{ {
accessforbidden(); accessforbidden();
} }
@ -95,7 +95,7 @@ if ($action == 'add')
if (! $message) if (! $message)
{ {
$object->nom = trim($_POST["nom"]); $object->nom = trim($_POST["nom"]);
if($conf->multicompany->enabled && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode))
$object->entity = 0; $object->entity = 0;
else else
$object->entity = $_POST["entity"]; $object->entity = $_POST["entity"];
@ -141,8 +141,8 @@ if ($action == 'adduser' || $action =='removeuser')
$edituser = new User($db); $edituser = new User($db);
$edituser->fetch($userid); $edituser->fetch($userid);
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,($conf->global->MULTICOMPANY_TRANSVERSE_MODE?GETPOST("entity"):$object->entity)); if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,($conf->multicompany->transverse_mode?GETPOST("entity"):$object->entity));
if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,($conf->global->MULTICOMPANY_TRANSVERSE_MODE?GETPOST("entity"):$object->entity)); if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,($conf->multicompany->transverse_mode?GETPOST("entity"):$object->entity));
if ($result > 0) if ($result > 0)
{ {
@ -176,7 +176,7 @@ if ($action == 'update')
$object->oldcopy=dol_clone($object); $object->oldcopy=dol_clone($object);
$object->nom = trim($_POST["group"]); $object->nom = trim($_POST["group"]);
if($conf->multicompany->enabled && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode))
$object->entity = 0; $object->entity = 0;
else else
$object->entity = $_POST["entity"]; $object->entity = $_POST["entity"];
@ -231,7 +231,7 @@ if ($action == 'create')
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
@ -317,7 +317,7 @@ else
print "</td></tr>\n"; print "</td></tr>\n";
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
$mc->getInfo($object->entity); $mc->getInfo($object->entity);
@ -366,7 +366,7 @@ else
if (! empty($object->members)) if (! empty($object->members))
{ {
if( !($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if( !($conf->multicompany->enabled && $conf->multicompany->transverse_mode))
{ {
foreach($object->members as $useringroup) foreach($object->members as $useringroup)
{ {
@ -388,7 +388,7 @@ else
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) if ($conf->entity == 1 && $conf->multicompany->transverse_mode)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
print '</td><td valign="top">'.$langs->trans("Entity").'</td>'; print '</td><td valign="top">'.$langs->trans("Entity").'</td>';
@ -486,7 +486,7 @@ else
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>'; print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';

View File

@ -58,7 +58,7 @@ print_fiche_titre($langs->trans("ListOfGroups"));
$sql = "SELECT g.rowid, g.nom, g.entity, g.datec, COUNT(ugu.rowid) as nb"; $sql = "SELECT g.rowid, g.nom, g.entity, g.datec, COUNT(ugu.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
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->multicompany->transverse_mode || ($user->admin && ! $user->entity)))
{ {
$sql.= " WHERE g.entity IS NOT NULL"; $sql.= " WHERE g.entity IS NOT NULL";
} }
@ -85,7 +85,7 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Group"),$_SERVER["PHP_SELF"],"g.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Group"),$_SERVER["PHP_SELF"],"g.nom",$param,"","",$sortfield,$sortorder);
//multicompany //multicompany
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) if(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
{ {
print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],"g.entity",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],"g.entity",$param,"",'align="center"',$sortfield,$sortorder);
} }
@ -106,7 +106,7 @@ if ($resql)
} }
print "</td>"; print "</td>";
//multicompany //multicompany
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) if(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
{ {
dol_include_once("/multicompany/class/actions_multicompany.class.php"); dol_include_once("/multicompany/class/actions_multicompany.class.php");
$mc = new ActionsMulticompany($db); $mc = new ActionsMulticompany($db);

View File

@ -169,7 +169,7 @@ if ($id)
$sql.= " WHERE ugr.fk_id = r.id"; $sql.= " WHERE ugr.fk_id = r.id";
if(! empty($conf->multicompany->enabled)) if(! empty($conf->multicompany->enabled))
{ {
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if(empty($conf->multicompany->transverse_mode))
{ {
$sql.= " AND r.entity = ".$conf->entity; $sql.= " AND r.entity = ".$conf->entity;
} }
@ -250,7 +250,7 @@ if ($id)
//$sql.= " AND r.entity = ".(empty($conf->multicompany->enabled) ? $conf->entity : $fgroup->entity); //$sql.= " AND r.entity = ".(empty($conf->multicompany->enabled) ? $conf->entity : $fgroup->entity);
if(! empty($conf->multicompany->enabled)) if(! empty($conf->multicompany->enabled))
{ {
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if(empty($conf->multicompany->transverse_mode))
{ {
$sql.= " AND r.entity = ".$conf->entity; $sql.= " AND r.entity = ".$conf->entity;
} }

View File

@ -99,7 +99,7 @@ $sql = "SELECT u.rowid, u.name, u.firstname, u.admin, u.login, u.fk_societe, u.d
$sql.= " s.nom, s.canvas"; $sql.= " s.nom, s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid";
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->multicompany->transverse_mode || ($user->admin && ! $user->entity)))
{ {
$sql.= " WHERE u.entity IS NOT NULL"; $sql.= " WHERE u.entity IS NOT NULL";
} }
@ -196,7 +196,7 @@ if ($canreadperms)
$sql = "SELECT g.rowid, g.nom, g.note, g.entity, g.datec"; $sql = "SELECT g.rowid, g.nom, g.note, g.entity, g.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $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->multicompany->transverse_mode || ($user->admin && ! $user->entity)))
{ {
$sql.= " WHERE g.entity IS NOT NULL"; $sql.= " WHERE g.entity IS NOT NULL";
} }

View File

@ -69,7 +69,7 @@ $sql.= " u.ldap_sid, u.statut, u.entity,";
$sql.= " s.nom, s.canvas"; $sql.= " s.nom, s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid";
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->multicompany->transverse_mode || ($user->admin && ! $user->entity)))
{ {
$sql.= " WHERE u.entity IS NOT NULL"; $sql.= " WHERE u.entity IS NOT NULL";
} }