2004-10-19 22:35:36 +02:00
< ? php
2007-04-07 13:52:16 +02:00
/* Copyright ( C ) 2003 - 2007 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2006-07-15 20:29:46 +02:00
* Copyright ( C ) 2003 Xavier Dutoit < doli @ sydesy . com >
2011-04-03 13:59:10 +02:00
* Copyright ( C ) 2004 - 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
2011-05-31 19:42:51 +02:00
* Copyright ( C ) 2005 - 2011 Regis Houssin < regis @ dolibarr . fr >
2007-04-05 09:11:17 +02:00
* Copyright ( C ) 2006 Jean Heimburger < jean @ tiaris . info >
2006-07-15 20:29:46 +02:00
*
2003-06-24 16:11:21 +02:00
* 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
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:45:11 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2003-06-24 16:11:21 +02:00
*/
2005-04-02 16:29:10 +02:00
/**
2010-06-08 01:52:43 +02:00
* \file htdocs / core / class / conf . class . php
2008-11-28 00:24:50 +01:00
* \ingroup core
2011-07-30 12:23:24 +02:00
* \brief File of class to manage storage of current setup
* Config is stored into file conf . php
2008-11-28 00:24:50 +01:00
*/
2003-09-12 14:50:22 +02:00
2003-09-12 19:29:16 +02:00
2006-07-15 20:29:46 +02:00
/**
2008-11-28 00:24:50 +01:00
* \class Conf
2011-02-16 20:59:16 +01:00
* \brief Class to stock current configuration
2008-11-28 00:24:50 +01:00
*/
2004-08-22 12:03:01 +02:00
class Conf
2003-06-24 16:11:21 +02:00
{
2009-08-30 03:39:40 +02:00
/** \public */
2008-11-28 00:02:49 +01:00
//! Object with database handler
2008-12-09 21:14:04 +01:00
var $db ;
2009-05-08 04:39:10 +02:00
//! To store properties found in conf file
var $file ;
2010-01-12 23:57:12 +01:00
//! To store if javascript/ajax is enabked
var $use_javascript_ajax ;
2008-12-09 21:14:04 +01:00
2009-11-09 17:56:30 +01:00
//! Used to store current currency
var $monnaie ;
//! Used to store current css (from theme)
2010-08-26 04:07:52 +02:00
var $theme ; // Contains current theme ("eldy", "auguria", ...)
var $css ; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
//! Used to store current menu handlers
2009-01-12 16:35:06 +01:00
var $top_menu ;
2010-09-23 15:02:15 +02:00
var $smart_menu ;
2009-02-20 21:28:16 +01:00
2011-03-09 17:17:56 +01:00
//! Used to store instance for multi-company (default 1)
2009-11-09 17:56:30 +01:00
var $entity = 1 ;
2009-04-20 17:39:36 +02:00
2010-08-24 11:52:06 +02:00
var $css_modules = array ();
var $tabs_modules = array ();
var $triggers_modules = array ();
var $hooks_modules = array ();
var $login_method_modules = array ();
var $modules = array ();
2011-04-18 12:49:39 +02:00
var $entities = array ();
2009-02-20 21:28:16 +01:00
2010-08-24 11:52:06 +02:00
var $logbuffer = array ();
2009-04-16 20:46:26 +02:00
2010-10-03 17:42:01 +02:00
var $filesystem_forbidden_chars = array ( '<' , '>' , ':' , '/' , '\\' , '?' , '*' , '|' , '"' );
2009-05-08 04:39:10 +02:00
/**
* Constructor
*
* @ return Conf
*/
function Conf ()
{
//! Charset for HTML output and for storing data in memory
$this -> file -> character_set_client = 'UTF-8' ; // UTF-8, ISO-8859-1
2011-05-16 18:20:14 +02:00
// $this->agendas_modules['comm/action'][]= 'ActionAgenda';
2009-05-08 04:39:10 +02:00
}
2007-04-07 13:52:16 +02:00
2007-10-22 01:04:06 +02:00
/**
2010-12-20 11:45:00 +01:00
* Load setup values into conf object ( read llx_const )
* @ param $db Handler d ' acces base
* @ return int < 0 if KO , >= 0 if OK
2009-08-30 03:39:40 +02:00
*/
2009-04-23 15:19:28 +02:00
function setValues ( $db )
2007-10-22 01:04:06 +02:00
{
2009-02-20 21:28:16 +01:00
dol_syslog ( " Conf::setValues " );
2010-04-19 01:17:41 +02:00
2010-04-02 19:09:26 +02:00
// Directory of core triggers
2011-03-09 17:17:56 +01:00
$this -> triggers_modules [] = " /includes/triggers " ; // Default relative path to triggers file
2009-05-07 17:37:47 +02:00
2009-06-29 16:21:17 +02:00
// Avoid warning if not defined
if ( empty ( $this -> db -> dolibarr_main_db_encryption )) $this -> db -> dolibarr_main_db_encryption = 0 ;
if ( empty ( $this -> db -> dolibarr_main_db_cryptkey )) $this -> db -> dolibarr_main_db_cryptkey = '' ;
2007-10-22 01:04:06 +02:00
/*
2009-04-29 21:54:34 +02:00
* Definition de toutes les constantes globales d ' environnement
2009-03-09 22:59:29 +01:00
* - En constante php ( TODO a virer )
2007-10-22 01:04:06 +02:00
* - En $this -> global -> key = value
*/
2011-03-09 17:38:44 +01:00
$sql = " SELECT " . $db -> decrypt ( 'name' ) . " as name, " ;
$sql .= " " . $db -> decrypt ( 'value' ) . " as value, entity " ;
2009-05-04 12:27:01 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " const " ;
2009-04-27 22:37:50 +02:00
$sql .= " WHERE entity IN (0, " . $this -> entity . " ) " ;
2009-11-29 15:38:21 +01:00
$sql .= " ORDER BY entity " ; // This is to have entity 0 first, then entity 1 that overwrite.
2009-05-05 19:06:05 +02:00
2007-10-22 01:04:06 +02:00
$result = $db -> query ( $sql );
if ( $result )
{
$numr = $db -> num_rows ( $result );
2011-04-18 19:31:10 +02:00
$multicompany_sharing = array ();
2007-10-22 01:04:06 +02:00
$i = 0 ;
2009-02-20 21:28:16 +01:00
2007-10-22 01:04:06 +02:00
while ( $i < $numr )
{
$objp = $db -> fetch_object ( $result );
$key = $objp -> name ;
2009-04-17 20:26:21 +02:00
$value = $objp -> value ;
2007-10-22 01:04:06 +02:00
if ( $key )
2007-10-29 13:47:43 +01:00
{
if ( ! defined ( " $key " )) define ( " $key " , $value ); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install)
$this -> global -> $key = $value ;
2009-11-29 15:38:21 +01:00
2011-03-05 12:22:42 +01:00
if ( $value && preg_match ( '/^MAIN_MODULE_/' , $key ))
2010-04-02 19:09:26 +02:00
{
2010-04-19 01:17:41 +02:00
// If this is constant for a css file activated by a module
if ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)_CSS$/i' , $key ))
2009-04-30 01:39:04 +02:00
{
2010-04-19 01:17:41 +02:00
$this -> css_modules [] = $value ;
2009-04-30 01:39:04 +02:00
}
2010-04-19 01:17:41 +02:00
// If this is constant for a new tab page activated by a module
elseif ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)_TABS_/i' , $key ))
2009-04-30 01:39:04 +02:00
{
2010-04-19 01:17:41 +02:00
$params = explode ( ':' , $value , 2 );
$this -> tabs_modules [ $params [ 0 ]][] = $value ;
//print 'xxx'.$params[0].'-'.$value;
}
// If this is constant for triggers activated by a module
2010-08-06 18:10:03 +02:00
elseif ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i' , $key , $reg ))
2010-04-19 01:17:41 +02:00
{
2010-08-06 18:10:03 +02:00
$modulename = strtolower ( $reg [ 1 ]);
2011-08-01 15:26:21 +02:00
$this -> triggers_modules [] = '/' . $modulename . '/includes/triggers/' ;
2010-04-19 01:17:41 +02:00
}
2010-08-24 11:52:06 +02:00
// If this is constant for login method activated by a module
elseif ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)_LOGIN_METHOD$/i' , $key , $reg ))
{
$modulename = strtolower ( $reg [ 1 ]);
2011-09-03 17:27:23 +02:00
$this -> login_method_modules [] = dol_buildpath ( '/' . $modulename . '/includes/login/' );
2010-08-24 11:52:06 +02:00
}
2011-07-02 01:05:39 +02:00
// If this is constant for hook activated by a module. Value is list of hooked tabs separated with :
2010-08-06 18:10:03 +02:00
elseif ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i' , $key , $reg ))
{
$modulename = strtolower ( $reg [ 1 ]);
$params = explode ( ':' , $value );
foreach ( $params as $value )
{
$this -> hooks_modules [ $modulename ][] = $value ;
}
}
2011-03-09 17:17:56 +01:00
// If this is constant for a sms engine
2011-03-05 12:22:42 +01:00
elseif ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)_SMS$/i' , $key , $reg ))
{
$module = strtolower ( $reg [ 1 ]);
2011-08-11 01:29:50 +02:00
// Add this module in list of modules that provide SMS
2011-03-06 16:45:46 +01:00
$this -> sms_engine [ $module ] = $module ;
2011-03-05 12:22:42 +01:00
}
2010-04-19 01:17:41 +02:00
// If this is a module constant
elseif ( preg_match ( '/^MAIN_MODULE_([A-Z_]+)$/i' , $key , $reg ))
{
$module = strtolower ( $reg [ 1 ]);
//print "Module ".$module." is enabled<br>\n";
$this -> $module -> enabled = true ;
// Add this module in list of enabled modules
$this -> modules [] = $module ;
2009-04-30 01:39:04 +02:00
}
2008-11-28 00:02:49 +01:00
}
2011-04-18 12:49:39 +02:00
// Sharings between entities
else if ( $value && preg_match ( '/^MULTICOMPANY_([A-Z_]+)_SHARING$/' , $key , $reg ))
{
$module = strtolower ( $reg [ 1 ]);
2011-04-18 19:31:10 +02:00
$multicompany_sharing [ $module ] = $value ;
2011-04-18 12:49:39 +02:00
}
2007-10-29 13:47:43 +01:00
}
2007-10-22 01:04:06 +02:00
$i ++ ;
}
2011-04-23 01:18:25 +02:00
2011-04-18 19:31:10 +02:00
// Sharings between entities
2011-04-20 16:30:32 +02:00
if ( isset ( $this -> multicompany -> enabled ) && $this -> multicompany -> enabled && ! empty ( $multicompany_sharing ))
2011-04-18 19:31:10 +02:00
{
2011-04-18 21:27:15 +02:00
$ret = @ dol_include_once ( '/multicompany/class/actions_multicompany.class.php' );
if ( $ret )
2011-04-18 19:31:10 +02:00
{
2011-04-18 21:27:15 +02:00
$mc = new ActionsMulticompany ( $db );
2011-04-23 01:18:25 +02:00
2011-04-18 21:27:15 +02:00
foreach ( $multicompany_sharing as $key => $value )
{
$this -> entities [ $key ] = $mc -> check_entity ( $value );
}
2011-04-18 19:31:10 +02:00
}
}
2007-10-22 01:04:06 +02:00
}
$db -> free ( $result );
2010-04-19 01:17:41 +02:00
//var_dump($this->modules);
2007-10-22 01:04:06 +02:00
2009-05-08 04:39:10 +02:00
// Clean some variables
2011-02-13 15:05:53 +01:00
if ( empty ( $this -> global -> MAIN_MENU_STANDARD )) $this -> global -> MAIN_MENU_STANDARD = " eldy_backoffice.php " ;
if ( empty ( $this -> global -> MAIN_MENUFRONT_STANDARD )) $this -> global -> MAIN_MENUFRONT_STANDARD = " eldy_frontoffice.php " ;
2011-02-18 09:09:29 +01:00
if ( empty ( $this -> global -> MAIN_MENU_SMARTPHONE )) $this -> global -> MAIN_MENU_SMARTPHONE = " eldy_backoffice.php " ; // Use eldy by default because smartphone does not work on all phones
if ( empty ( $this -> global -> MAIN_MENUFRONT_SMARTPHONE )) $this -> global -> MAIN_MENUFRONT_SMARTPHONE = " eldy_frontoffice.php " ; // Ue eldy by default because smartphone does not work on all phones
2007-10-22 01:04:06 +02:00
// Variable globales LDAP
2007-12-27 00:05:09 +01:00
if ( empty ( $this -> global -> LDAP_FIELD_FULLNAME )) $this -> global -> LDAP_FIELD_FULLNAME = '' ;
2007-10-24 01:28:13 +02:00
if ( ! isset ( $this -> global -> LDAP_KEY_USERS )) $this -> global -> LDAP_KEY_USERS = $this -> global -> LDAP_FIELD_FULLNAME ;
if ( ! isset ( $this -> global -> LDAP_KEY_GROUPS )) $this -> global -> LDAP_KEY_GROUPS = $this -> global -> LDAP_FIELD_FULLNAME ;
if ( ! isset ( $this -> global -> LDAP_KEY_CONTACTS )) $this -> global -> LDAP_KEY_CONTACTS = $this -> global -> LDAP_FIELD_FULLNAME ;
if ( ! isset ( $this -> global -> LDAP_KEY_MEMBERS )) $this -> global -> LDAP_KEY_MEMBERS = $this -> global -> LDAP_FIELD_FULLNAME ;
2007-10-22 01:04:06 +02:00
2008-11-28 00:02:49 +01:00
// Load translation object with current language
2008-08-07 08:33:35 +02:00
if ( empty ( $this -> global -> MAIN_LANG_DEFAULT )) $this -> global -> MAIN_LANG_DEFAULT = " en_US " ;
2007-10-22 01:04:06 +02:00
2010-08-10 03:39:40 +02:00
// By default, we repeat info on all tabs
2010-09-19 14:50:53 +02:00
if ( ! isset ( $this -> global -> MAIN_REPEATCONTACTONEACHTAB )) $this -> global -> MAIN_REPEATCONTACTONEACHTAB = 1 ;
2010-08-10 03:39:40 +02:00
2009-04-29 21:54:34 +02:00
$rootfordata = DOL_DATA_ROOT ;
2009-05-06 16:02:39 +02:00
$rootforuser = DOL_DATA_ROOT ;
2009-04-29 21:54:34 +02:00
// If multicompany module is enabled, we redefine the root of data
2009-05-06 15:45:42 +02:00
if ( ! empty ( $this -> global -> MAIN_MODULE_MULTICOMPANY ) && ! empty ( $this -> entity ) && $this -> entity > 1 ) $rootfordata .= '/' . $this -> entity ;
2009-04-29 21:54:34 +02:00
2009-05-04 13:06:49 +02:00
// For backward compatibility
2009-06-04 23:45:29 +02:00
// TODO Replace this->xxx->enabled by this->modulename->enabled to remove this code
2011-03-09 17:17:56 +01:00
if ( isset ( $this -> comptabilite -> enabled )) $this -> compta -> enabled = $this -> comptabilite -> enabled ;
if ( isset ( $this -> propale -> enabled )) $this -> propal -> enabled = $this -> propale -> enabled ;
2009-05-04 13:06:49 +02:00
2009-04-29 21:54:34 +02:00
// Define default dir_output and dir_temp for directories of modules
foreach ( $this -> modules as $module )
{
2011-03-09 17:17:56 +01:00
$this -> $module -> dir_output = $rootfordata . " / " . $module ;
$this -> $module -> dir_temp = $rootfordata . " / " . $module . " /temp " ;
2009-04-29 21:54:34 +02:00
}
2009-04-29 20:38:45 +02:00
2009-07-02 02:16:50 +02:00
// For mycompany setup
$this -> mycompany -> dir_output = $rootfordata . " /mycompany " ;
$this -> mycompany -> dir_temp = $rootfordata . " /mycompany/temp " ;
// For admin features
$this -> admin -> dir_output = $rootfordata . '/admin' ;
$this -> admin -> dir_temp = $rootfordata . '/admin/temp' ;
2009-04-29 21:58:56 +02:00
2009-04-30 15:28:08 +02:00
// Module user
2009-05-06 16:02:39 +02:00
$this -> user -> dir_output = $rootforuser . " /users " ;
$this -> user -> dir_temp = $rootforuser . " /users/temp " ;
2009-05-04 13:06:49 +02:00
2009-07-02 02:16:50 +02:00
// Exception: Some dir are not the name of module. So we keep exception here
// for backward compatibility.
2008-05-20 02:09:11 +02:00
// Sous module bons d'expedition
$this -> expedition_bon -> enabled = defined ( " MAIN_SUBMODULE_EXPEDITION " ) ? MAIN_SUBMODULE_EXPEDITION : 0 ;
2006-06-24 19:10:32 +02:00
// Sous module bons de livraison
2008-05-20 02:09:11 +02:00
$this -> livraison_bon -> enabled = defined ( " MAIN_SUBMODULE_LIVRAISON " ) ? MAIN_SUBMODULE_LIVRAISON : 0 ;
2006-07-15 20:29:46 +02:00
2009-04-29 20:28:55 +02:00
// Module fournisseur
2009-04-29 20:38:45 +02:00
$this -> fournisseur -> commande -> dir_output = $rootfordata . " /fournisseur/commande " ;
$this -> fournisseur -> commande -> dir_temp = $rootfordata . " /fournisseur/commande/temp " ;
$this -> fournisseur -> facture -> dir_output = $rootfordata . " /fournisseur/facture " ;
$this -> fournisseur -> facture -> dir_temp = $rootfordata . " /fournisseur/facture/temp " ;
2010-06-02 10:57:27 +02:00
// Module product/service
$this -> product -> dir_output = $rootfordata . " /produit " ;
$this -> product -> dir_temp = $rootfordata . " /produit/temp " ;
2009-04-29 20:38:45 +02:00
$this -> service -> dir_output = $rootfordata . " /produit " ;
$this -> service -> dir_temp = $rootfordata . " /produit/temp " ;
2009-04-29 20:28:55 +02:00
// Module contrat
2009-04-29 20:38:45 +02:00
$this -> contrat -> dir_output = $rootfordata . " /contracts " ;
2009-04-29 22:15:14 +02:00
$this -> contrat -> dir_temp = $rootfordata . " /contracts/temp " ;
2009-02-20 21:28:16 +01:00
2010-09-29 20:38:47 +02:00
2006-06-03 01:20:36 +02:00
/*
2009-09-29 19:39:50 +02:00
* Set some default values
2006-06-03 01:20:36 +02:00
*/
2006-07-15 20:29:46 +02:00
2006-06-03 01:20:36 +02:00
// societe
2008-01-10 16:53:12 +01:00
if ( empty ( $this -> global -> SOCIETE_CODECLIENT_ADDON )) $this -> global -> SOCIETE_CODECLIENT_ADDON = " mod_codeclient_leopard " ;
if ( empty ( $this -> global -> SOCIETE_CODEFOURNISSEUR_ADDON )) $this -> global -> SOCIETE_CODEFOURNISSEUR_ADDON = $this -> global -> SOCIETE_CODECLIENT_ADDON ;
if ( empty ( $this -> global -> SOCIETE_CODECOMPTA_ADDON )) $this -> global -> SOCIETE_CODECOMPTA_ADDON = " mod_codecompta_panicum " ;
2011-08-27 17:40:08 +02:00
if ( empty ( $this -> global -> COMPANY_AQUARIUM_MASK_SUPPLIER )) $this -> global -> COMPANY_AQUARIUM_MASK_SUPPLIER = '401' ;
if ( empty ( $this -> global -> COMPANY_AQUARIUM_MASK_CUSTOMER )) $this -> global -> COMPANY_AQUARIUM_MASK_CUSTOMER = '411' ;
2006-07-15 20:29:46 +02:00
2011-08-27 17:40:08 +02:00
// Security
2011-03-09 17:24:56 +01:00
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
2006-07-15 20:29:46 +02:00
2008-05-19 03:31:46 +02:00
// conf->box_max_lines
$this -> box_max_lines = 5 ;
2008-05-19 10:12:21 +02:00
if ( isset ( $this -> global -> MAIN_BOXES_MAXLINES )) $this -> box_max_lines = $this -> global -> MAIN_BOXES_MAXLINES ;
2009-02-20 21:28:16 +01:00
2006-06-03 01:20:36 +02:00
// conf->use_preview_tabs
2008-04-17 13:30:04 +02:00
$this -> use_preview_tabs = 0 ;
2006-06-03 01:20:36 +02:00
if ( isset ( $this -> global -> MAIN_USE_PREVIEW_TABS )) $this -> use_preview_tabs = $this -> global -> MAIN_USE_PREVIEW_TABS ;
2006-07-15 20:29:46 +02:00
2008-01-06 16:24:23 +01:00
// conf->use_javascript_ajax
$this -> use_javascript_ajax = 1 ;
if ( isset ( $this -> global -> MAIN_DISABLE_JAVASCRIPT )) $this -> use_javascript_ajax =! $this -> global -> MAIN_DISABLE_JAVASCRIPT ;
// If no javascript_ajax, Ajax features are disabled.
2009-02-20 21:28:16 +01:00
if ( ! $this -> use_javascript_ajax )
2007-02-10 02:49:49 +01:00
{
$this -> global -> PRODUIT_USE_SEARCH_TO_SELECT = 0 ;
}
2006-07-15 20:29:46 +02:00
2006-06-03 01:20:36 +02:00
// conf->monnaie
2008-01-10 16:53:12 +01:00
if ( empty ( $this -> global -> MAIN_MONNAIE )) $this -> global -> MAIN_MONNAIE = 'EUR' ;
2010-10-21 15:34:31 +02:00
$this -> monnaie = $this -> global -> MAIN_MONNAIE ; // TODO deprecated
$this -> currency = $this -> global -> MAIN_MONNAIE ;
2006-07-15 20:29:46 +02:00
2008-02-16 18:50:25 +01:00
// $this->compta->mode = Option du module Comptabilite (simple ou expert):
// Defini le mode de calcul des etats comptables (CA,...)
$this -> compta -> mode = 'RECETTES-DEPENSES' ; // By default
2011-03-09 17:38:44 +01:00
if ( isset ( $this -> global -> COMPTA_MODE )) $this -> compta -> mode = $this -> global -> COMPTA_MODE ; // Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
2006-07-15 20:29:46 +02:00
2006-06-03 01:20:36 +02:00
// $this->liste_limit = constante de taille maximale des listes
2008-01-10 16:53:12 +01:00
if ( empty ( $this -> global -> MAIN_SIZE_LISTE_LIMIT )) $this -> global -> MAIN_SIZE_LISTE_LIMIT = 25 ;
2006-06-03 01:20:36 +02:00
$this -> liste_limit = $this -> global -> MAIN_SIZE_LISTE_LIMIT ;
2006-07-15 20:29:46 +02:00
2010-06-02 10:34:44 +02:00
// $this->product->limit_size = constante de taille maximale des select de produit
2007-12-04 20:21:17 +01:00
if ( ! isset ( $this -> global -> PRODUIT_LIMIT_SIZE )) $this -> global -> PRODUIT_LIMIT_SIZE = 100 ;
2010-06-02 10:34:44 +02:00
$this -> product -> limit_size = $this -> global -> PRODUIT_LIMIT_SIZE ;
2006-07-15 20:29:46 +02:00
2006-06-03 01:20:36 +02:00
// $this->theme et $this->css
2010-07-15 02:28:12 +02:00
if ( empty ( $this -> global -> MAIN_THEME )) $this -> global -> MAIN_THEME = " eldy " ;
2006-06-03 01:20:36 +02:00
$this -> theme = $this -> global -> MAIN_THEME ;
2010-06-25 21:52:11 +02:00
$this -> css = " /theme/ " . $this -> theme . " /style.css.php " ;
2009-02-20 21:28:16 +01:00
2007-06-11 09:29:37 +02:00
// $this->email_from = email pour envoi par dolibarr des mails automatiques
$this -> email_from = " dolibarr-robot@domain.com " ;
2011-03-09 17:38:44 +01:00
if ( ! empty ( $this -> global -> MAIN_MAIL_EMAIL_FROM )) $this -> email_from = $this -> global -> MAIN_MAIL_EMAIL_FROM ;
2007-06-11 09:29:37 +02:00
// $this->notification->email_from = email pour envoi par Dolibarr des notifications
2009-08-30 03:39:40 +02:00
$this -> notification -> email_from = $this -> email_from ;
2011-03-09 17:38:44 +01:00
if ( ! empty ( $this -> global -> NOTIFICATION_EMAIL_FROM )) $this -> notification -> email_from = $this -> global -> NOTIFICATION_EMAIL_FROM ;
2006-08-05 18:44:43 +02:00
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings
2011-03-09 17:38:44 +01:00
$this -> mailing -> email_from = $this -> email_from ;
if ( ! empty ( $this -> global -> MAILING_EMAIL_FROM )) $this -> mailing -> email_from = $this -> global -> MAILING_EMAIL_FROM ;
2006-07-15 20:29:46 +02:00
2006-12-06 01:28:04 +01:00
// Defini MAIN_GRAPH_LIBRARY
2011-03-09 17:38:44 +01:00
if ( empty ( $this -> global -> MAIN_GRAPH_LIBRARY )) $this -> global -> MAIN_GRAPH_LIBRARY = 'artichow' ;
2009-02-20 21:28:16 +01:00
2011-04-23 01:18:25 +02:00
if ( ! isset ( $this -> global -> FCKEDITOR_EDITORNAME )) $this -> global -> FCKEDITOR_EDITORNAME = 'ckeditor' ; // fckeditor to switch
2011-03-25 23:07:35 +01:00
2010-08-28 01:42:10 +02:00
// Format for date (used by default when not found or 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
$this -> format_hour_short = " %H:%M " ;
$this -> format_hour_short_duration = " %H:%M " ;
$this -> format_date_text_short = " %d %b %Y " ;
$this -> format_date_text = " %d %B %Y " ;
$this -> format_date_hour_short = " %d/%m/%Y %H:%M " ;
$this -> format_date_hour_text_short = " %d %b %Y %H:%M " ;
$this -> format_date_hour_text = " %d %B %Y %H:%M " ;
2010-09-15 15:29:17 +02:00
2008-01-10 16:53:12 +01:00
// Limites decimales si non definie (peuvent etre egale a 0)
2007-06-16 15:06:05 +02:00
if ( ! isset ( $this -> global -> MAIN_MAX_DECIMALS_UNIT )) $this -> global -> MAIN_MAX_DECIMALS_UNIT = 5 ;
2007-06-19 00:48:05 +02:00
if ( ! isset ( $this -> global -> MAIN_MAX_DECIMALS_TOT )) $this -> global -> MAIN_MAX_DECIMALS_TOT = 2 ;
2007-06-16 15:06:05 +02:00
if ( ! isset ( $this -> global -> MAIN_MAX_DECIMALS_SHOWN )) $this -> global -> MAIN_MAX_DECIMALS_SHOWN = 8 ;
2011-04-03 13:59:10 +02:00
// Timeouts
if ( empty ( $this -> global -> MAIN_USE_CONNECT_TIMEOUT )) $this -> global -> MAIN_USE_CONNECT_TIMEOUT = 10 ;
if ( empty ( $this -> global -> MAIN_USE_RESPONSE_TIMEOUT )) $this -> global -> MAIN_USE_RESPONSE_TIMEOUT = 30 ;
2010-09-29 20:38:47 +02:00
// Set default variable to calculate VAT as if option tax_mode was 0 (standard)
if ( empty ( $this -> global -> TAX_MODE_SELL_PRODUCT )) $this -> global -> TAX_MODE_SELL_PRODUCT = 'invoice' ;
if ( empty ( $this -> global -> TAX_MODE_BUY_PRODUCT )) $this -> global -> TAX_MODE_BUY_PRODUCT = 'invoice' ;
if ( empty ( $this -> global -> TAX_MODE_SELL_SERVICE )) $this -> global -> TAX_MODE_SELL_SERVICE = 'payment' ;
if ( empty ( $this -> global -> TAX_MODE_BUY_SERVICE )) $this -> global -> TAX_MODE_BUY_SERVICE = 'payment' ;
/* We always show vat menus if module tax is enabled .
* Because even when vat option is 'franchise' and vat rate is 0 , we have to pay vat .
2006-06-03 01:20:36 +02:00
*/
2010-09-29 20:38:47 +02:00
$this -> compta -> tva = 1 ; // This option means "Show vat menus"
2006-07-15 20:29:46 +02:00
2011-01-16 19:47:33 +01:00
// Delay before warnings
2010-11-14 15:53:10 +01:00
$this -> actions -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_ACTIONS_TODO ) ? $this -> global -> MAIN_DELAY_ACTIONS_TODO : 7 ) * 24 * 60 * 60 ;
$this -> commande -> client -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_ORDERS_TO_PROCESS ) ? $this -> global -> MAIN_DELAY_ORDERS_TO_PROCESS : 2 ) * 24 * 60 * 60 ;
$this -> commande -> fournisseur -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS ) ? $this -> global -> MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7 ) * 24 * 60 * 60 ;
2011-01-16 19:47:33 +01:00
$this -> propal -> cloture -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_PROPALS_TO_CLOSE ) ? $this -> global -> MAIN_DELAY_PROPALS_TO_CLOSE : 0 ) * 24 * 60 * 60 ;
$this -> propal -> facturation -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_PROPALS_TO_BILL ) ? $this -> global -> MAIN_DELAY_PROPALS_TO_BILL : 0 ) * 24 * 60 * 60 ;
$this -> facture -> client -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_CUSTOMER_BILLS_UNPAYED ) ? $this -> global -> MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0 ) * 24 * 60 * 60 ;
$this -> facture -> fournisseur -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_SUPPLIER_BILLS_TO_PAY ) ? $this -> global -> MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0 ) * 24 * 60 * 60 ;
$this -> contrat -> services -> inactifs -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_NOT_ACTIVATED_SERVICES ) ? $this -> global -> MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0 ) * 24 * 60 * 60 ;
$this -> contrat -> services -> expires -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_RUNNING_SERVICES ) ? $this -> global -> MAIN_DELAY_RUNNING_SERVICES : 0 ) * 24 * 60 * 60 ;
$this -> adherent -> cotisation -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_MEMBERS ) ? $this -> global -> MAIN_DELAY_MEMBERS : 0 ) * 24 * 60 * 60 ;
$this -> bank -> rappro -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE ) ? $this -> global -> MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0 ) * 24 * 60 * 60 ;
2007-12-27 00:05:09 +01:00
$this -> bank -> cheque -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_CHEQUES_TO_DEPOSIT ) ? $this -> global -> MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0 ) * 24 * 60 * 60 ;
2010-06-02 10:34:44 +02:00
// For backward compatibility
$this -> produit = $this -> product ;
2006-06-03 01:20:36 +02:00
2011-02-16 20:59:16 +01:00
// Define menu manager in setup
if ( empty ( $user -> societe_id )) // If internal user or not defined
{
$this -> top_menu = ( empty ( $this -> global -> MAIN_MENU_STANDARD_FORCED ) ? $this -> global -> MAIN_MENU_STANDARD : $this -> global -> MAIN_MENU_STANDARD_FORCED );
$this -> smart_menu = ( empty ( $this -> global -> MAIN_MENU_SMARTPHONE_FORCED ) ? $this -> global -> MAIN_MENU_SMARTPHONE : $this -> global -> MAIN_MENU_SMARTPHONE_FORCED );
}
else // If external user
{
$this -> top_menu = ( empty ( $this -> global -> MAIN_MENUFRONT_STANDARD_FORCED ) ? $this -> global -> MAIN_MENUFRONT_STANDARD : $this -> global -> MAIN_MENUFRONT_STANDARD_FORCED );
$this -> smart_menu = ( empty ( $this -> global -> MAIN_MENUFRONT_SMARTPHONE_FORCED ) ? $this -> global -> MAIN_MENUFRONT_SMARTPHONE : $this -> global -> MAIN_MENUFRONT_SMARTPHONE_FORCED );
}
2011-03-09 17:38:44 +01:00
// For backward compatibility
if ( $this -> top_menu == 'eldy.php' ) $this -> top_menu = 'eldy_backoffice.php' ;
elseif ( $this -> top_menu == 'rodolphe.php' ) $this -> top_menu = 'eldy_backoffice.php' ;
2011-02-16 20:59:16 +01:00
}
2003-06-24 16:11:21 +02:00
}
?>