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
doxygen_warnings.log
/.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.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$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
$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_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');
$type = GETPOST('type');
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}
if ($element == 'fichinter') $element = 'ficheinter';
if ($user->rights->$element->lire || $user->rights->$element->read)
@ -72,7 +78,7 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
}
else
{
echo $langs->trans('NotEnoughPermissions');
echo $langs->transnoentities('NotEnoughPermissions');
}
}

View File

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

View File

@ -53,6 +53,8 @@ class Conf
var $top_menu;
var $smart_menu;
//! To store properties of multi-company
var $multicompany;
//! Used to store instance for multi-company (default 1)
var $entity=1;
@ -89,9 +91,10 @@ class Conf
/**
* Load setup values into conf object (read llx_const)
* @param $db Handler d'acces base
* @return int < 0 if KO, >= 0 if OK
* Load setup values into conf object (read llx_const)
*
* @param DoliDB $db Handler d'acces base
* @return int < 0 if KO, >= 0 if OK
*/
function setValues($db)
{
@ -112,7 +115,14 @@ class Conf
$sql = "SELECT ".$db->decrypt('name')." as name,";
$sql.= " ".$db->decrypt('value')." as value, entity";
$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.
$result = $db->query($sql);

View File

@ -973,7 +973,7 @@ class Form
}
$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").")";
else $out.=" (".$obj->label.")";
@ -3734,7 +3734,7 @@ class Form
$out.= '>';
$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.")";
}

View File

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

View File

@ -771,54 +771,55 @@ function dol_delete_preview($object)
}
/**
* Create a meta file with document file into same directory.
* This should allow rgrep search
*
* @param Object $object Object
* @return void
*/
* Create a meta file with document file into same directory.
* This should allow rgrep search
*
* @param Object $object Object
* @return void
*/
function dol_meta_create($object)
{
global $langs,$conf;
$object->fetch_thirdparty();
if ($conf->facture->dir_output)
{
$facref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".meta";
if (! is_dir($dir))
{
create_exdir($dir);
}
if (is_dir($dir))
{
$nblignes = count($object->lines);
$client = $object->client->nom . " " . $object->client->address . " " . $object->client->cp . " " . $object->client->ville;
$meta = "REFERENCE=\"" . $object->ref . "\"
global $langs,$conf;
$object->fetch_thirdparty();
if ($conf->facture->dir_output)
{
$facref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".meta";
if (! is_dir($dir))
{
create_exdir($dir);
}
if (is_dir($dir))
{
$nblignes = count($object->lines);
$client = $object->client->nom . " " . $object->client->address . " " . $object->client->cp . " " . $object->client->ville;
$meta = "REFERENCE=\"" . $object->ref . "\"
DATE=\"" . dol_print_date($object->date,'') . "\"
NB_ITEMS=\"" . $nblignes . "\"
CLIENT=\"" . $client . "\"
TOTAL_HT=\"" . $object->total_ht . "\"
TOTAL_TTC=\"" . $object->total_ttc . "\"\n";
for ($i = 0 ; $i < $nblignes ; $i++)
{
//Pour les articles
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\"
for ($i = 0 ; $i < $nblignes ; $i++)
{
//Pour les articles
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\"
ITEM_" . $i . "_UNIT_PRICE=\"" . $object->lines[$i]->price . "\"
ITEM_" . $i . "_TVA=\"" .$object->lines[$i]->tva_tx . "\"
ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($object->lines[$i]->desc)) . "\"
";
}
}
$fp = fopen($file,"w");
fputs($fp,$meta);
fclose($fp);
if (! empty($conf->global->MAIN_UMASK))
ITEM_" . $i . "_TVA=\"" .$object->lines[$i]->tva_tx . "\"
ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($object->lines[$i]->desc)) . "\"
";
}
}
$fp = fopen($file,"w");
fputs($fp,$meta);
fclose($fp);
if (! empty($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
if (! empty($GLOBALS['object']))
{
$out.='<div id="element" class="hidden">'.$GLOBALS['object']->element.'</div>'."\n";
$out.='<div id="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_element" class="hidden">'.$GLOBALS['object']->element.'</div>'."\n";
$out.='<div id="jeditable_table_element" class="hidden">'.$GLOBALS['object']->table_element.'</div>'."\n";
$out.='<div id="jeditable_fk_element" class="hidden">'.$GLOBALS['object']->id.'</div>'."\n";
}
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_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8';
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;
// Security: CSRF protection
// 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;
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,
`datep` date DEFAULT NULL,
`datev` date DEFAULT NULL,
`amount` double NOT NULL DEFAULT '0',
`label` varchar(255) DEFAULT NULL,
`entity` int(11) NOT NULL DEFAULT '1',
`note` text,
`fk_bank` int(11) DEFAULT NULL,
`fk_user_creat` int(11) DEFAULT NULL,
`fk_user_modif` int(11) DEFAULT NULL,
PRIMARY KEY (`rowid`)
CREATE TABLE IF NOT EXISTS llx_localtax
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer NOT NULL DEFAULT '1',
tms timestamp,
datep date DEFAULT NULL,
datev date DEFAULT NULL,
amount double NOT NULL DEFAULT '0',
label varchar(255) DEFAULT NULL,
note text,
fk_bank integer DEFAULT NULL,
fk_user_creat integer DEFAULT NULL,
fk_user_modif integer DEFAULT NULL
) 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
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- order reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref varchar(30) NOT NULL, -- order reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(50), -- reference into an external system (not used by dolibarr)
ref_int varchar(50), -- reference into an internal system (used by dolibarr)
ref_client varchar(50), -- reference for customer
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
ref_int varchar(255), -- reference into an internal system (used by dolibarr)
ref_client varchar(255), -- reference for customer
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,
date_creation datetime, -- date de creation
date_valid datetime, -- date de validation
date_cloture datetime, -- date de cloture
date_commande date, -- date de la commande
fk_user_author integer, -- createur de la commande
fk_user_valid integer, -- valideur de la commande
fk_user_cloture integer, -- auteur cloture
date_creation datetime, -- date de creation
date_valid datetime, -- date de validation
date_cloture datetime, -- date de cloture
date_commande date, -- date de la commande
fk_user_author integer, -- createur de la commande
fk_user_valid integer, -- valideur de la commande
fk_user_cloture integer, -- auteur cloture
source smallint,
fk_statut smallint default 0,
amount_ht real default 0,
@ -46,8 +46,8 @@ create table llx_commande
remise_absolue real default 0,
remise real default 0,
tva double(24,8) default 0,
localtax1 double(24,8) default 0, -- total localtax1
localtax2 double(24,8) default 0, -- total localtax2
localtax1 double(24,8) default 0, -- total localtax1
localtax2 double(24,8) default 0, -- total localtax2
total_ht double(24,8) default 0,
total_ttc double(24,8) default 0,
note text,
@ -55,11 +55,11 @@ create table llx_commande
model_pdf varchar(255),
facture tinyint default 0,
fk_cond_reglement integer, -- condition de reglement
fk_mode_reglement integer, -- mode de reglement
fk_cond_reglement integer, -- condition de reglement
fk_mode_reglement integer, -- mode de reglement
date_livraison date default NULL,
fk_availability integer NULL,
fk_demand_reason integer, -- should be named fk_input_reason
fk_adresse_livraison integer, -- delivery address (deprecated)
fk_demand_reason integer, -- should be named fk_input_reason
fk_adresse_livraison integer, -- delivery address (deprecated)
import_key varchar(14)
)ENGINE=innodb;

View File

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

View File

@ -1,7 +1,6 @@
-- ===================================================================
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
--
-- 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
@ -21,22 +20,15 @@
create table llx_localtax
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
tms timestamp,
datep date, -- date of payment
datev date, -- date of value
amount real NOT NULL DEFAULT 0,
label varchar(255),
entity integer DEFAULT 1 NOT NULL,
datep date, -- date of payment
datev date, -- date of value
amount double,
label varchar(255),
note text,
fk_bank integer,
fk_user_creat integer,
fk_user_modif integer
fk_user_modif integer
)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,
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_int varchar(50), -- reference into an internal system (used by dolibarr)
ref_client varchar(50), -- customer proposal number
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
ref_int varchar(255), -- reference into an internal system (used by dolibarr)
ref_client varchar(255), -- customer proposal number
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,
datec datetime, -- date de creation

View File

@ -43,31 +43,31 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/conf.class.php");
$conf = new Conf();
// Identifiant propres au serveur base de donnee
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$conf->db->type = $dolibarr_main_db_type;
$conf->db->prefix = $dolibarr_main_db_prefix;
$conf->db->character_set=$dolibarr_main_db_character_set;
$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_cryptkey = $dolibarr_main_db_cryptkey;
$conf->file->main_limit_users = $dolibarr_main_limit_users;
$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$conf->db->type = $dolibarr_main_db_type;
$conf->db->prefix = $dolibarr_main_db_prefix;
$conf->db->character_set = $dolibarr_main_db_character_set;
$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_cryptkey = $dolibarr_main_db_cryptkey;
$conf->file->main_limit_users = $dolibarr_main_limit_users;
$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
// 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
$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)
$conf->file->character_set_client=strtoupper($force_charset_do_notuse);
$conf->file->character_set_client = strtoupper($force_charset_do_notuse);
// 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
$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))
{
// 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
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");

View File

@ -502,7 +502,7 @@ class User extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
$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 r.perms IS NOT NULL";
if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'";

View File

@ -64,7 +64,7 @@ if ($id)
}
//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();
}
@ -205,7 +205,7 @@ if ($action == 'add' && $canadduser)
// If multicompany is off, admin users must all be on entity 0.
if($conf->multicompany->enabled)
{
if($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ! empty($_POST["superadmin"]))
if($conf->multicompany->transverse_mode || ! empty($_POST["superadmin"]))
{
$edituser->entity=0;
}
@ -261,8 +261,8 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
$edituser = new User($db);
$edituser->fetch($id);
if ($action == 'addgroup') $edituser->SetInGroup($group,($conf->global->MULTICOMPANY_TRANSVERSE_MODE?GETPOST("entity"):$editgroup->entity));
if ($action == 'removegroup') $edituser->RemoveFromGroup($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->multicompany->transverse_mode?GETPOST("entity"):$editgroup->entity));
if ($result > 0)
{
@ -319,7 +319,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$edituser->phenix_pass = $_POST["phenix_pass"];
if($conf->multicompany->enabled)
{
if($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ! empty($_POST["superadmin"]))
if($conf->multicompany->transverse_mode || ! empty($_POST["superadmin"]))
{
$edituser->entity=0;
}
@ -704,7 +704,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print '<td>';
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)
{
@ -744,7 +744,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
//Multicompany
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);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
@ -1076,7 +1076,7 @@ else
print '</td></tr>'."\n";
// 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">';
if ($fuser->admin && ! $fuser->entity)
@ -1237,7 +1237,7 @@ else
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))
{
@ -1249,7 +1249,7 @@ else
}
}
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>';
}
@ -1258,13 +1258,13 @@ else
if ($conf->global->USER_PASSWORD_GENERATED != 'none')
{
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>';
}
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>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a>';
@ -1273,19 +1273,19 @@ else
// Activer
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>';
}
// Desactiver
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>';
}
// Delete
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>';
}
@ -1311,7 +1311,7 @@ else
if (! empty($groupslist))
{
if( ! ($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE))
if( ! ($conf->multicompany->enabled && $conf->multicompany->transverse_mode))
{
foreach($groupslist as $groupforuser)
{
@ -1334,7 +1334,7 @@ else
// Multicompany
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);
print '</td><td valign="top">'.$langs->trans("Entity").'</td>';
@ -1362,7 +1362,7 @@ else
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
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>';
}
@ -1387,7 +1387,7 @@ else
print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom;
}
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->getInfo($group->usergroup_entity);
@ -1544,7 +1544,7 @@ else
{
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)
{
@ -1602,7 +1602,7 @@ else
//Multicompany
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);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';

View File

@ -51,7 +51,7 @@ $userid=GETPOST("user","int");
// Security check
$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();
}
@ -95,7 +95,7 @@ if ($action == 'add')
if (! $message)
{
$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;
else
$object->entity = $_POST["entity"];
@ -141,8 +141,8 @@ if ($action == 'adduser' || $action =='removeuser')
$edituser = new User($db);
$edituser->fetch($userid);
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,($conf->global->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 == 'adduser') $result=$edituser->SetInGroup($object->id,($conf->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)
{
@ -176,7 +176,7 @@ if ($action == 'update')
$object->oldcopy=dol_clone($object);
$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;
else
$object->entity = $_POST["entity"];
@ -231,7 +231,7 @@ if ($action == 'create')
// Multicompany
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);
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
@ -317,7 +317,7 @@ else
print "</td></tr>\n";
// 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->getInfo($object->entity);
@ -366,7 +366,7 @@ else
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)
{
@ -388,7 +388,7 @@ else
// Multicompany
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);
print '</td><td valign="top">'.$langs->trans("Entity").'</td>';
@ -486,7 +486,7 @@ else
// Multicompany
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);
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.= " FROM ".MAIN_DB_PREFIX."usergroup as g";
$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";
}
@ -85,7 +85,7 @@ if ($resql)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Group"),$_SERVER["PHP_SELF"],"g.nom",$param,"","",$sortfield,$sortorder);
//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);
}
@ -106,7 +106,7 @@ if ($resql)
}
print "</td>";
//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");
$mc = new ActionsMulticompany($db);

View File

@ -169,7 +169,7 @@ if ($id)
$sql.= " WHERE ugr.fk_id = r.id";
if(! empty($conf->multicompany->enabled))
{
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
if(empty($conf->multicompany->transverse_mode))
{
$sql.= " AND r.entity = ".$conf->entity;
}
@ -250,7 +250,7 @@ if ($id)
//$sql.= " AND r.entity = ".(empty($conf->multicompany->enabled) ? $conf->entity : $fgroup->entity);
if(! empty($conf->multicompany->enabled))
{
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
if(empty($conf->multicompany->transverse_mode))
{
$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.= " FROM ".MAIN_DB_PREFIX."user as u";
$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";
}
@ -196,7 +196,7 @@ if ($canreadperms)
$sql = "SELECT g.rowid, g.nom, 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->multicompany->transverse_mode || ($user->admin && ! $user->entity)))
{
$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.= " FROM ".MAIN_DB_PREFIX."user as u";
$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";
}