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 >
2016-10-14 18:22:07 +02:00
* Copyright ( C ) 2004 - 2016 Laurent Destailleur < eldy @ users . sourceforge . net >
2017-06-06 07:57:03 +02:00
* Copyright ( C ) 2005 - 2017 Regis Houssin < regis . houssin @ capnetworks . com >
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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2003-06-24 16:11:21 +02:00
* ( 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
/**
2012-02-19 17:12:17 +01:00
* Class to stock current configuration
2008-11-28 00:24:50 +01:00
*/
2016-03-25 15:34:37 +01:00
class Conf
2003-06-24 16:11:21 +02:00
{
2009-08-30 03:39:40 +02:00
/** \public */
2009-05-08 04:39:10 +02:00
//! To store properties found in conf file
var $file ;
2011-12-03 20:21:45 +01:00
//! Object with database handler
var $db ;
2011-10-29 19:50:25 +02:00
//! To store properties found into database
var $global ;
2018-06-28 12:09:13 +02:00
//! To store browser info
var $browser ;
2011-10-29 19:50:25 +02:00
2010-01-12 23:57:12 +01:00
//! To store if javascript/ajax is enabked
2011-12-03 20:21:45 +01:00
public $use_javascript_ajax ;
2018-10-05 13:58:38 +02:00
//! Used to store current currency (ISO code like 'USD', 'EUR', ...)
2011-12-03 20:21:45 +01:00
public $currency ;
2009-11-09 17:56:30 +01:00
//! Used to store current css (from theme)
2011-12-03 20:21:45 +01:00
public $theme ; // Contains current theme ("eldy", "auguria", ...)
public $css ; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
2013-04-03 15:20:56 +02:00
//! Used to store current menu handler
2013-01-17 18:39:15 +01:00
public $standard_menu ;
2009-02-20 21:28:16 +01:00
2012-02-23 14:28:50 +01:00
public $modules = array (); // List of activated modules
2016-08-16 02:55:18 +02:00
public $modules_parts = array ( 'css' => array (), 'js' => array (), 'tabs' => array (), 'triggers' => array (), 'login' => array (), 'substitutions' => array (), 'menus' => array (), 'theme' => array (), 'sms' => array (), 'tpl' => array (), 'barcode' => array (), 'models' => array (), 'societe' => array (), 'hooks' => array (), 'dir' => array (), 'syslog' => array ());
2013-01-10 06:13:02 +01:00
2012-02-23 14:28:50 +01:00
var $logbuffer = array ();
2015-02-25 18:24:36 +01:00
/**
* @ var LogHandlerInterface []
*/
2012-12-02 14:33:24 +01:00
var $loghandlers = array ();
2010-10-03 17:42:01 +02:00
2012-02-19 17:12:17 +01:00
//! To store properties of multi-company
public $multicompany ;
//! Used to store running instance for multi-company (default 1)
2012-02-23 14:28:50 +01:00
public $entity = 1 ;
2012-02-19 17:12:17 +01:00
//! Used to store list of entities to use for each element
2012-02-23 14:28:50 +01:00
public $entities = array ();
2012-02-19 17:12:17 +01:00
2013-06-05 16:24:32 +02:00
public $dol_hide_topmenu ; // Set if we force param dol_hide_topmenu into login url
public $dol_hide_leftmenu ; // Set if we force param dol_hide_leftmenu into login url
public $dol_optimize_smallscreen ; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone
public $dol_no_mouse_hover ; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
public $dol_use_jmobile ; // Set if we force param dol_use_jmobile into login url
2012-02-19 17:12:17 +01:00
2010-10-03 17:42:01 +02:00
2009-05-08 04:39:10 +02:00
/**
* Constructor
*/
2012-07-30 17:17:33 +02:00
function __construct ()
2009-05-08 04:39:10 +02:00
{
2014-05-04 17:38:26 +02:00
// Properly declare multi-modules objects.
2013-01-19 14:32:37 +01:00
$this -> file = new stdClass ();
$this -> db = new stdClass ();
$this -> global = new stdClass ();
$this -> mycompany = new stdClass ();
$this -> admin = new stdClass ();
$this -> user = new stdClass ();
$this -> syslog = new stdClass ();
$this -> browser = new stdClass ();
2017-09-09 17:48:04 +02:00
$this -> medias = new stdClass ();
2013-01-19 14:32:37 +01:00
$this -> multicompany = new stdClass ();
2012-04-10 12:38:10 +02:00
2014-05-04 17:38:26 +02:00
//! Charset for HTML output and for storing data in memory
$this -> file -> character_set_client = 'UTF-8' ; // UTF-8, ISO-8859-1
2012-03-23 17:18:33 +01:00
// First level object
2014-05-04 17:38:26 +02:00
// TODO Remove this part.
2013-01-19 14:32:37 +01:00
$this -> expedition_bon = new stdClass ();
2018-04-13 11:20:21 +02:00
$this -> livraison_bon = new stdClass ();
2013-01-19 14:32:37 +01:00
$this -> fournisseur = new stdClass ();
$this -> product = new stdClass ();
$this -> service = new stdClass ();
$this -> contrat = new stdClass ();
$this -> actions = new stdClass ();
$this -> commande = new stdClass ();
$this -> propal = new stdClass ();
$this -> facture = new stdClass ();
$this -> contrat = new stdClass ();
2018-04-13 11:20:21 +02:00
$this -> usergroup = new stdClass ();
2013-01-19 14:32:37 +01:00
$this -> adherent = new stdClass ();
$this -> bank = new stdClass ();
$this -> notification = new stdClass ();
$this -> mailing = new stdClass ();
2018-04-13 11:20:21 +02:00
$this -> expensereport = new stdClass ();
$this -> productbatch = new stdClass ();
2009-05-08 04:39:10 +02:00
}
2007-04-07 13:52:16 +02:00
2007-10-22 01:04:06 +02:00
/**
2011-11-04 09:09:53 +01:00
* Load setup values into conf object ( read llx_const )
2012-12-19 13:06:45 +01:00
* Note that this -> db -> xxx , this -> file -> xxx and this -> multicompany have been already loaded when setValues is called .
2011-11-04 09:09:53 +01:00
*
2012-12-19 13:06:45 +01:00
* @ param DoliDB $db Database handler
2011-11-04 09:09:53 +01:00
* @ 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
{
2016-08-16 02:55:18 +02:00
global $conf ;
2011-12-03 20:21:45 +01:00
dol_syslog ( get_class ( $this ) . " ::setValues " );
2009-05-07 17:37:47 +02:00
2017-04-14 12:38:52 +02:00
//Define all global constants into $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 " ;
2017-06-06 07:57:03 +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
2011-12-05 00:25:01 +01:00
$resql = $db -> query ( $sql );
if ( $resql )
2012-02-05 15:13:31 +01:00
{
2007-10-22 01:04:06 +02:00
$i = 0 ;
2011-12-05 00:25:01 +01:00
$numr = $db -> num_rows ( $resql );
2007-10-22 01:04:06 +02:00
while ( $i < $numr )
{
2011-12-05 00:25:01 +01:00
$objp = $db -> fetch_object ( $resql );
2007-10-22 01:04:06 +02:00
$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
{
2017-04-14 12:38:52 +02:00
//if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install)
2007-10-29 13:47:43 +01:00
$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
{
2014-01-12 20:02:41 +01:00
// If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
2012-11-12 19:09:53 +01:00
if ( preg_match ( '/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i' , $key ))
2009-04-30 01:39:04 +02:00
{
2013-01-07 13:28:14 +01:00
$partname = 'tabs' ;
2010-04-19 01:17:41 +02:00
$params = explode ( ':' , $value , 2 );
2013-01-07 13:28:14 +01:00
if ( ! isset ( $this -> modules_parts [ $partname ]) || ! is_array ( $this -> modules_parts [ $partname ])) { $this -> modules_parts [ $partname ] = array (); }
2014-01-12 20:02:41 +01:00
$this -> modules_parts [ $partname ][ $params [ 0 ]][] = $value ; // $value may be a string or an array
2012-02-23 19:42:57 +01:00
}
2014-01-12 20:02:41 +01:00
// If this is constant for all generic part activated by a module. It initializes
// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
// modules_parts['models'], modules_parts['theme']
// modules_parts['sms'],
// modules_parts['css'], ...
2012-11-12 19:09:53 +01:00
elseif ( preg_match ( '/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i' , $key , $reg ))
2012-02-23 14:28:50 +01:00
{
$modulename = strtolower ( $reg [ 1 ]);
$partname = strtolower ( $reg [ 2 ]);
2012-03-03 16:44:05 +01:00
if ( ! isset ( $this -> modules_parts [ $partname ]) || ! is_array ( $this -> modules_parts [ $partname ])) { $this -> modules_parts [ $partname ] = array (); }
2012-03-18 19:59:38 +01:00
$arrValue = json_decode ( $value , true );
2012-02-23 17:34:17 +01:00
if ( is_array ( $arrValue ) && ! empty ( $arrValue )) $value = $arrValue ;
2013-01-08 13:45:52 +01:00
else if ( in_array ( $partname , array ( 'login' , 'menus' , 'substitutions' , 'triggers' , 'tpl' ))) $value = '/' . $modulename . '/core/' . $partname . '/' ;
2013-01-08 15:21:56 +01:00
else if ( in_array ( $partname , array ( 'models' , 'theme' ))) $value = '/' . $modulename . '/' ;
2013-01-07 13:28:14 +01:00
else if ( in_array ( $partname , array ( 'sms' ))) $value = $modulename ;
else if ( $value == 1 ) $value = '/' . $modulename . '/core/modules/' . $partname . '/' ; // ex: partname = societe
2014-01-12 20:02:41 +01:00
$this -> modules_parts [ $partname ] = array_merge ( $this -> modules_parts [ $partname ], array ( $modulename => $value )); // $value may be a string or an array
2012-02-23 14:28:50 +01:00
}
2012-02-22 16:18:03 +01:00
// If this is a module constant (must be at end)
2012-11-12 19:09:53 +01:00
elseif ( preg_match ( '/^MAIN_MODULE_([0-9A-Z_]+)$/i' , $key , $reg ))
2010-04-19 01:17:41 +02:00
{
2012-02-29 22:54:34 +01:00
$modulename = strtolower ( $reg [ 1 ]);
2012-03-22 08:33:44 +01:00
if ( $modulename == 'propale' ) $modulename = 'propal' ;
2015-11-15 18:23:42 +01:00
if ( $modulename == 'supplierproposal' ) $modulename = 'supplier_proposal' ;
2013-01-19 14:32:37 +01:00
if ( ! isset ( $this -> $modulename ) || ! is_object ( $this -> $modulename )) $this -> $modulename = new stdClass ();
2012-02-29 22:54:34 +01:00
$this -> $modulename -> enabled = true ;
$this -> modules [] = $modulename ; // Add this module in list of enabled modules
2009-04-30 01:39:04 +02:00
}
2008-11-28 00:02:49 +01:00
}
2007-10-29 13:47:43 +01:00
}
2007-10-22 01:04:06 +02:00
$i ++ ;
}
2012-07-06 20:25:00 +02:00
2012-02-19 17:12:17 +01:00
$db -> free ( $resql );
2007-10-22 01:04:06 +02:00
}
2016-08-16 02:55:18 +02:00
2017-04-14 12:38:52 +02:00
// Include other local consts.php files and fetch their values to the corresponding database constants.
2016-05-21 16:01:14 +02:00
if ( ! empty ( $this -> global -> LOCAL_CONSTS_FILES )) {
$filesList = explode ( " : " , $this -> global -> LOCAL_CONSTS_FILES );
foreach ( $filesList as $file ) {
$file = dol_sanitizeFileName ( $file );
include_once DOL_DOCUMENT_ROOT . " / " . $file . " / " . $file . " _consts.php " ;
foreach ( $file2bddconsts as $key => $value ) {
2017-04-29 18:30:36 +02:00
$this -> global -> $key = $value ;
2016-05-21 16:01:14 +02:00
}
}
}
2010-04-19 01:17:41 +02:00
//var_dump($this->modules);
2013-01-08 13:45:52 +01:00
//var_dump($this->modules_parts['theme']);
2012-04-10 12:38:10 +02:00
2014-03-21 18:05:08 +01:00
// If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
// In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
//$this->global->MAIN_SERVER_TZ='Europe/Paris';
2014-04-09 17:07:27 +02:00
if ( ! empty ( $this -> global -> MAIN_SERVER_TZ ) && $this -> global -> MAIN_SERVER_TZ != 'auto' )
{
try {
date_default_timezone_set ( $this -> global -> MAIN_SERVER_TZ );
}
catch ( Exception $e )
{
dol_syslog ( " Error: Bad value for parameter MAIN_SERVER_TZ= " . $this -> global -> MAIN_SERVER_TZ , LOG_ERR );
}
}
2014-03-21 18:35:50 +01:00
2012-07-02 19:30:37 +02:00
// Object $mc
if ( ! defined ( 'NOREQUIREMC' ) && ! empty ( $this -> multicompany -> enabled ))
{
global $mc ;
$ret = @ dol_include_once ( '/multicompany/class/actions_multicompany.class.php' );
if ( $ret ) $mc = new ActionsMulticompany ( $db );
2012-04-06 22:39:40 +02:00
}
2012-04-10 12:38:10 +02:00
2009-05-08 04:39:10 +02:00
// Clean some variables
2013-02-24 03:29:03 +01:00
if ( empty ( $this -> global -> MAIN_MENU_STANDARD )) $this -> global -> MAIN_MENU_STANDARD = " eldy_menu.php " ;
if ( empty ( $this -> global -> MAIN_MENUFRONT_STANDARD )) $this -> global -> MAIN_MENUFRONT_STANDARD = " eldy_menu.php " ;
if ( empty ( $this -> global -> MAIN_MENU_SMARTPHONE )) $this -> global -> MAIN_MENU_SMARTPHONE = " eldy_menu.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_menu.php " ; // Use eldy by default because smartphone does not work on all phones
2014-03-31 02:16:49 +02:00
// Clean var use vat for company
2014-04-10 17:51:42 +02:00
if ( ! isset ( $this -> global -> FACTURE_TVAOPTION )) $this -> global -> FACTURE_TVAOPTION = 1 ;
else if ( ! empty ( $this -> global -> FACTURE_TVAOPTION ) && ! is_numeric ( $this -> global -> FACTURE_TVAOPTION ))
2014-03-31 02:16:49 +02:00
{
// Old value of option, we clean to use new value (0 or 1)
2014-04-10 17:51:42 +02:00
if ( $this -> global -> FACTURE_TVAOPTION != " franchise " ) $this -> global -> FACTURE_TVAOPTION = 1 ;
else $this -> global -> FACTURE_TVAOPTION = 0 ;
2014-03-31 02:16:49 +02:00
}
2014-04-09 17:07:27 +02:00
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 ;
2017-09-16 17:51:18 +02:00
if ( ! isset ( $this -> global -> LDAP_KEY_MEMBERS_TYPES )) $this -> global -> LDAP_KEY_MEMBERS_TYPES = $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
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
2012-04-06 22:39:40 +02:00
if ( ! empty ( $this -> multicompany -> enabled ) && ! empty ( $this -> entity ) && $this -> entity > 1 )
2012-02-15 19:35:19 +01:00
{
$rootfordata .= '/' . $this -> entity ;
}
2009-04-29 21:54:34 +02:00
// Define default dir_output and dir_temp for directories of modules
foreach ( $this -> modules as $module )
{
2016-12-23 14:52:25 +01:00
//var_dump($module);
2012-09-05 17:34:56 +02:00
// For multicompany sharings
2012-07-02 19:30:37 +02:00
$this -> $module -> multidir_output = array ( $this -> entity => $rootfordata . " / " . $module );
2012-04-06 23:24:31 +02:00
$this -> $module -> multidir_temp = array ( $this -> entity => $rootfordata . " / " . $module . " /temp " );
// For backward compatibility
$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
2012-09-05 17:34:56 +02:00
// External modules storage
if ( ! empty ( $this -> modules_parts [ 'dir' ]))
{
2012-09-07 17:23:16 +02:00
foreach ( $this -> modules_parts [ 'dir' ] as $module => $dirs )
2012-09-05 17:34:56 +02:00
{
2017-09-25 09:01:47 +02:00
if ( ! empty ( $this -> $module -> enabled ))
2012-09-05 17:34:56 +02:00
{
2017-09-25 09:01:47 +02:00
foreach ( $dirs as $type => $name )
{
$subdir = ( $type == 'temp' ? '/temp' : '' );
// For multicompany sharings
$varname = 'multidir_' . $type ;
$this -> $module -> $varname = array ( $this -> entity => $rootfordata . " / " . $name . $subdir );
// For backward compatibility
$varname = 'dir_' . $type ;
$this -> $module -> $varname = $rootfordata . " / " . $name . $subdir ;
}
2012-09-05 17:34:56 +02:00
}
}
}
2011-12-04 22:25:49 +01:00
// For mycompany storage
2009-07-02 02:16:50 +02:00
$this -> mycompany -> dir_output = $rootfordata . " /mycompany " ;
$this -> mycompany -> dir_temp = $rootfordata . " /mycompany/temp " ;
2011-12-04 22:25:49 +01:00
// For admin storage
2009-07-02 02:16:50 +02:00
$this -> admin -> dir_output = $rootfordata . '/admin' ;
$this -> admin -> dir_temp = $rootfordata . '/admin/temp' ;
2009-04-29 21:58:56 +02:00
2011-12-04 22:25:49 +01:00
// For user storage
2012-07-02 19:30:37 +02:00
$this -> user -> multidir_output = array ( $this -> entity => $rootfordata . " /users " );
2018-06-23 00:07:56 +02:00
$this -> user -> multidir_temp = array ( $this -> entity => $rootfordata . " /users/temp " );
2012-04-06 23:24:31 +02:00
// For backward compatibility
2009-05-06 16:02:39 +02:00
$this -> user -> dir_output = $rootforuser . " /users " ;
$this -> user -> dir_temp = $rootforuser . " /users/temp " ;
2017-06-06 07:57:03 +02:00
2018-06-23 00:07:56 +02:00
// For usergroup storage
2017-03-08 11:34:21 +01:00
$this -> usergroup -> dir_output = $rootforuser . " /usergroups " ;
$this -> usergroup -> dir_temp = $rootforuser . " /usergroups/temp " ;
2012-04-10 12:38:10 +02:00
2018-06-23 00:07:56 +02:00
// For proposal storage
2018-02-25 17:43:19 +01:00
$this -> propal -> multidir_output = array ( $this -> entity => $rootfordata . " /propale " );
2018-06-23 00:07:56 +02:00
$this -> propal -> multidir_temp = array ( $this -> entity => $rootfordata . " /propale/temp " );
2018-02-25 17:43:19 +01:00
// For backward compatibility
2012-08-01 19:34:42 +02:00
$this -> propal -> dir_output = $rootfordata . " /propale " ;
$this -> propal -> dir_temp = $rootfordata . " /propale/temp " ;
2009-05-04 13:06:49 +02:00
2017-09-09 17:48:04 +02:00
// For medias storage
$this -> medias -> multidir_output = array ( $this -> entity => $rootfordata . " /medias " );
2018-06-23 00:07:56 +02:00
$this -> medias -> multidir_temp = array ( $this -> entity => $rootfordata . " /medias/temp " );
2017-09-09 17:48:04 +02:00
2017-04-14 12:38:52 +02:00
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
2009-07-02 02:16:50 +02:00
2008-05-20 02:09:11 +02:00
// Sous module bons d'expedition
2017-06-19 09:50:13 +02:00
$this -> expedition_bon -> enabled = ( ! empty ( $this -> global -> MAIN_SUBMODULE_EXPEDITION ) ? $this -> global -> MAIN_SUBMODULE_EXPEDITION : 0 );
2006-06-24 19:10:32 +02:00
// Sous module bons de livraison
2017-06-19 09:50:13 +02:00
$this -> livraison_bon -> enabled = ( ! empty ( $this -> global -> MAIN_SUBMODULE_LIVRAISON ) ? $this -> global -> MAIN_SUBMODULE_LIVRAISON : 0 );
2006-07-15 20:29:46 +02:00
2009-04-29 20:28:55 +02:00
// Module fournisseur
2014-04-30 15:30:20 +02:00
if ( ! empty ( $this -> fournisseur ))
{
$this -> fournisseur -> commande = new stdClass ();
$this -> fournisseur -> commande -> dir_output = $rootfordata . " /fournisseur/commande " ;
$this -> fournisseur -> commande -> dir_temp = $rootfordata . " /fournisseur/commande/temp " ;
$this -> fournisseur -> facture = new stdClass ();
$this -> fournisseur -> facture -> dir_output = $rootfordata . " /fournisseur/facture " ;
$this -> fournisseur -> facture -> dir_temp = $rootfordata . " /fournisseur/facture/temp " ;
2018-04-18 16:21:20 +02:00
$this -> supplierproposal = new stdClass ();
$this -> supplierproposal -> dir_output = $rootfordata . " /supplier_proposal " ;
$this -> supplierproposal -> dir_temp = $rootfordata . " /supplier_proposal/temp " ;
2017-02-14 12:00:56 +01:00
$this -> fournisseur -> payment = new stdClass ();
$this -> fournisseur -> payment -> dir_output = $rootfordata . " /fournisseur/payment " ;
$this -> fournisseur -> payment -> dir_temp = $rootfordata . " /fournisseur/payment/temp " ;
2016-08-16 02:55:18 +02:00
2016-01-14 13:24:49 +01:00
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
2016-01-14 23:48:47 +01:00
if ( ! empty ( $this -> fournisseur -> enabled ) && empty ( $this -> global -> MAIN_USE_NEW_SUPPLIERMOD )) // By default, if module supplier is on, we set new properties
2016-01-14 13:24:49 +01:00
{
$this -> supplier_order = new stdClass ();
$this -> supplier_order -> enabled = 1 ;
$this -> supplier_order -> dir_output = $rootfordata . " /fournisseur/commande " ;
$this -> supplier_order -> dir_temp = $rootfordata . " /fournisseur/commande/temp " ;
$this -> supplier_invoice = new stdClass ();
$this -> supplier_invoice -> enabled = 1 ;
2017-05-04 19:05:02 +02:00
$this -> supplier_invoice -> dir_output = $rootfordata . " /fournisseur/facture " ;
$this -> supplier_invoice -> dir_temp = $rootfordata . " /fournisseur/facture/temp " ;
2018-04-18 16:21:20 +02:00
$this -> supplierproposal = new stdClass ();
$this -> supplierproposal -> dir_output = $rootfordata . " /supplier_proposal " ;
$this -> supplierproposal -> dir_temp = $rootfordata . " /supplier_proposal/temp " ;
2016-01-14 13:24:49 +01:00
}
2014-04-30 15:30:20 +02:00
}
2012-04-10 12:38:10 +02:00
2010-06-02 10:57:27 +02:00
// Module product/service
2012-04-06 23:24:31 +02:00
$this -> product -> multidir_output = array ( $this -> entity => $rootfordata . " /produit " );
$this -> product -> multidir_temp = array ( $this -> entity => $rootfordata . " /produit/temp " );
$this -> service -> multidir_output = array ( $this -> entity => $rootfordata . " /produit " );
$this -> service -> multidir_temp = array ( $this -> entity => $rootfordata . " /produit/temp " );
// For backward compatibility
2012-07-02 19:30:37 +02:00
$this -> product -> dir_output = $rootfordata . " /produit " ;
$this -> product -> dir_temp = $rootfordata . " /produit/temp " ;
$this -> service -> dir_output = $rootfordata . " /produit " ;
2012-04-06 23:24:31 +02:00
$this -> service -> dir_temp = $rootfordata . " /produit/temp " ;
2012-04-10 12:38:10 +02:00
2018-04-12 15:10:37 +02:00
// Module productbatch
$this -> productbatch -> multidir_output = array ( $this -> entity => $rootfordata . " /produitlot " );
$this -> productbatch -> multidir_temp = array ( $this -> entity => $rootfordata . " /produitlot/temp " );
2009-04-29 20:28:55 +02:00
// Module contrat
2018-06-06 23:56:59 +02:00
$this -> contrat -> multidir_output = array ( $this -> entity => $rootfordata . " /contract " );
$this -> contrat -> multidir_temp = array ( $this -> entity => $rootfordata . " /contract/temp " );
// For backward compatibility
2018-06-06 23:47:48 +02:00
$this -> contrat -> dir_output = $rootfordata . " /contract " ;
$this -> contrat -> dir_temp = $rootfordata . " /contract/temp " ;
2018-06-06 23:56:59 +02:00
2015-09-04 21:16:43 +02:00
// Module bank
$this -> bank -> dir_output = $rootfordata . " /bank " ;
$this -> bank -> dir_temp = $rootfordata . " /bank/temp " ;
2009-02-20 21:28:16 +01:00
2010-09-29 20:38:47 +02:00
2011-12-05 00:25:01 +01:00
// Set some default values
2018-06-23 00:07:56 +02:00
//$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
2016-05-24 16:02:43 +02:00
$this -> global -> MAIN_ACTIVATE_HTML5 = 1 ;
2017-04-05 00:39:32 +02:00
$this -> global -> MAIN_MAIL_USE_MULTI_PART = 1 ;
2017-06-06 07:57:03 +02:00
2006-06-03 01:20:36 +02:00
// societe
2011-12-03 20:21:45 +01:00
if ( empty ( $this -> global -> SOCIETE_CODECLIENT_ADDON )) $this -> global -> SOCIETE_CODECLIENT_ADDON = " mod_codeclient_leopard " ;
if ( empty ( $this -> global -> SOCIETE_CODECOMPTA_ADDON )) $this -> global -> SOCIETE_CODECOMPTA_ADDON = " mod_codecompta_panicum " ;
2006-07-15 20:29:46 +02:00
2016-10-02 16:12:40 +02:00
if ( empty ( $this -> global -> CHEQUERECEIPTS_ADDON )) $this -> global -> CHEQUERECEIPTS_ADDON = 'mod_chequereceipt_mint' ;
2017-06-06 07:57:03 +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-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.
2014-02-04 20:49:07 +01:00
if ( empty ( $this -> use_javascript_ajax ))
{
unset ( $this -> global -> PRODUIT_USE_SEARCH_TO_SELECT );
unset ( $this -> global -> COMPANY_USE_SEARCH_TO_SELECT );
unset ( $this -> global -> CONTACT_USE_SEARCH_TO_SELECT );
2014-12-04 11:18:40 +01:00
unset ( $this -> global -> PROJECT_USE_SEARCH_TO_SELECT );
2014-02-04 20:49:07 +01:00
}
2006-07-15 20:29:46 +02:00
2016-05-21 16:01:14 +02:00
if ( ! empty ( $this -> productbatch -> enabled ))
2014-12-05 16:01:01 +01:00
{
$this -> global -> STOCK_CALCULATE_ON_BILL = 0 ;
$this -> global -> STOCK_CALCULATE_ON_VALIDATE_ORDER = 0 ;
$this -> global -> STOCK_CALCULATE_ON_SHIPMENT = 1 ;
2016-05-14 19:22:27 +02:00
$this -> global -> STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0 ;
2014-12-05 16:01:01 +01:00
$this -> global -> STOCK_CALCULATE_ON_SUPPLIER_BILL = 0 ;
$this -> global -> STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0 ;
$this -> global -> STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1 ;
}
2011-11-23 14:55:36 +01:00
// conf->currency
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 -> currency = $this -> global -> MAIN_MONNAIE ;
2006-07-15 20:29:46 +02:00
2018-03-20 11:27:47 +01:00
if ( empty ( $this -> global -> MAIN_BROWSER_NOTIFICATION_FREQUENCY )) $this -> global -> MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30 ; // Less than 1 minutes to be sure
2017-06-06 07:57:03 +02:00
2014-09-21 20:30:55 +02:00
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if ( empty ( $this -> global -> ACCOUNTING_MODE )) $this -> global -> ACCOUNTING_MODE = 'RECETTES-DEPENSES' ; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
2006-07-15 20:29:46 +02:00
2015-09-26 16:51:51 +02:00
// By default, suppliers objects can be linked to all projects
$this -> global -> PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1 ;
2014-12-05 16:01:01 +01:00
2016-02-01 01:19:37 +01:00
// MAIN_HTML_TITLE
2016-05-21 16:01:14 +02:00
if ( ! isset ( $this -> global -> MAIN_HTML_TITLE )) $this -> global -> MAIN_HTML_TITLE = 'noapp,thirdpartynameonly,contactnameonly,projectnameonly' ;
2017-06-06 07:57:03 +02:00
2011-12-05 00:25:01 +01:00
// conf->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
2011-12-05 00:25:01 +01:00
// conf->product->limit_size = constante de taille maximale des select de produit
2016-06-26 23:15:20 +02:00
if ( ! isset ( $this -> global -> PRODUIT_LIMIT_SIZE )) $this -> global -> PRODUIT_LIMIT_SIZE = 1000 ;
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
2011-12-05 00:25:01 +01:00
// conf->theme et $this->css
2012-04-17 10:27:42 +02:00
if ( empty ( $this -> global -> MAIN_THEME )) $this -> global -> MAIN_THEME = " eldy " ;
2013-01-08 13:45:52 +01:00
if ( ! empty ( $this -> global -> MAIN_FORCETHEME )) $this -> global -> MAIN_THEME = $this -> global -> MAIN_FORCETHEME ;
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
2011-12-05 00:25:01 +01:00
// conf->email_from = email pour envoi par dolibarr des mails automatiques
2015-06-08 17:13:23 +02:00
$this -> email_from = " robot@example.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 ;
2011-12-05 00:25:01 +01:00
// conf->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
2011-12-05 00:25:01 +01:00
// conf->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 ;
2016-05-21 16:01:14 +02:00
if ( ! isset ( $this -> global -> MAIN_EMAIL_ADD_TRACK_ID )) $this -> global -> MAIN_EMAIL_ADD_TRACK_ID = 1 ;
2017-06-06 07:57:03 +02:00
2013-01-02 18:43:59 +01:00
// Format for date (used by default when not found or not searched in lang)
2011-09-20 12:30:56 +02:00
$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
2010-08-28 01:42:10 +02:00
$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 " ;
2013-01-10 06:13:02 +01:00
$this -> format_date_hour_sec_short = " %d/%m/%Y %H:%M:%S " ;
2010-08-28 01:42:10 +02:00
$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
2012-08-19 09:05:50 +02:00
// Duration of workday
2012-12-19 13:06:45 +01:00
if ( ! isset ( $this -> global -> MAIN_DURATION_OF_WORKDAY )) $this -> global -> MAIN_DURATION_OF_WORKDAY = 86400 ;
2012-08-19 09:05:50 +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 ;
2015-10-19 14:39:55 +02:00
// Default pdf option
if ( ! isset ( $this -> global -> MAIN_PDF_DASH_BETWEEN_LINES )) $this -> global -> MAIN_PDF_DASH_BETWEEN_LINES = 1 ; // use dash between lines
2018-04-06 11:25:48 +02:00
if ( ! isset ( $this -> global -> PDF_ALLOW_HTML_FOR_FREE_TEXT )) $this -> global -> PDF_ALLOW_HTML_FOR_FREE_TEXT = 1 ; // allow html content into free footer text
2017-06-06 07:57:03 +02:00
2015-03-24 14:08:56 +01:00
// Set default value to MAIN_SHOW_LOGO
if ( ! isset ( $this -> global -> MAIN_SHOW_LOGO )) $this -> global -> MAIN_SHOW_LOGO = 1 ;
2012-08-13 16:18:02 +02:00
// Default max file size for upload
2018-06-29 20:02:40 +02:00
$this -> maxfilesize = ( empty ( $this -> global -> MAIN_UPLOAD_DOC ) ? 0 : ( int ) $this -> global -> MAIN_UPLOAD_DOC * 1024 );
2013-01-02 18:43:59 +01:00
2016-07-28 19:02:23 +02:00
// By default, we propagate contacts
if ( ! isset ( $this -> global -> MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN )) $this -> global -> MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN = '*' ; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
2016-08-16 02:55:18 +02:00
2017-06-23 11:20:29 +02:00
// By default, we do not use the zip town table but the table of third parties
2017-06-19 19:23:00 +02:00
if ( ! isset ( $this -> global -> MAIN_USE_ZIPTOWN_DICTIONNARY )) $this -> global -> MAIN_USE_ZIPTOWN_DICTIONNARY = 0 ;
2016-08-16 02:55:18 +02:00
2017-01-22 23:35:32 +01:00
// By default, we open card if one found
if ( ! isset ( $this -> global -> MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE )) $this -> global -> MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1 ;
2017-06-06 07:57:03 +02:00
2018-09-04 10:10:47 +02:00
// By default, we show state code in combo list
if ( ! isset ( $this -> global -> MAIN_SHOW_STATE_CODE )) $this -> global -> MAIN_SHOW_STATE_CODE = 1 ;
2016-10-14 18:22:07 +02:00
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
2017-12-16 21:36:36 +01:00
if ( ! isset ( $this -> global -> MAIN_MODULES_FOR_EXTERNAL )) $this -> global -> MAIN_MODULES_FOR_EXTERNAL = 'user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog' ; // '' means 'all'. Note that contact is added here as it should be a module later.
2018-06-08 15:37:25 +02:00
if ( ! empty ( $this -> modules_parts [ 'moduleforexternal' ])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
{
foreach ( $this -> modules_parts [ 'moduleforexternal' ] as $key => $value ) $this -> global -> MAIN_MODULES_FOR_EXTERNAL .= " , " . $key ;
}
2018-04-05 16:23:17 +02:00
2014-12-05 13:26:47 +01:00
// Enable select2
2015-11-08 18:40:12 +01:00
if ( empty ( $this -> global -> MAIN_USE_JQUERY_MULTISELECT ) || $this -> global -> MAIN_USE_JQUERY_MULTISELECT == '1' ) $this -> global -> MAIN_USE_JQUERY_MULTISELECT = 'select2' ;
2015-03-24 14:08:56 +01:00
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' ;
2011-01-16 19:47:33 +01:00
// Delay before warnings
2014-04-30 15:30:20 +02:00
// Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
2015-12-14 09:14:34 +01:00
if ( isset ( $this -> agenda )) {
2016-09-24 06:48:40 +02:00
$this -> adherent -> subscription = new stdClass ();
$this -> adherent -> subscription -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_MEMBERS ) ? $this -> global -> MAIN_DELAY_MEMBERS : 0 ) * 24 * 60 * 60 ;
2015-12-14 09:14:34 +01:00
}
2016-01-18 15:56:51 +01:00
if ( isset ( $this -> agenda )) $this -> agenda -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_ACTIONS_TODO ) ? $this -> global -> MAIN_DELAY_ACTIONS_TODO : 7 ) * 24 * 60 * 60 ;
2016-08-16 02:55:18 +02:00
if ( isset ( $this -> projet ))
2016-01-18 15:56:51 +01:00
{
$this -> projet -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_PROJECT_TO_CLOSE ) ? $this -> global -> MAIN_DELAY_PROJECT_TO_CLOSE : 7 ) * 24 * 60 * 60 ;
$this -> projet -> task = new StdClass ();
2016-06-15 13:37:50 +02:00
$this -> projet -> task -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_TASKS_TODO ) ? $this -> global -> MAIN_DELAY_TASKS_TODO : 7 ) * 24 * 60 * 60 ;
2016-01-18 15:56:51 +01:00
}
2016-08-16 02:55:18 +02:00
2015-12-14 09:14:34 +01:00
if ( isset ( $this -> commande )) {
$this -> commande -> client = new stdClass ();
$this -> commande -> fournisseur = new stdClass ();
$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 ;
}
if ( isset ( $this -> propal )) {
$this -> propal -> cloture = new stdClass ();
$this -> propal -> facturation = new stdClass ();
$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 ;
}
if ( isset ( $this -> facture )) {
$this -> facture -> client = new stdClass ();
$this -> facture -> fournisseur = new stdClass ();
$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 ;
}
if ( isset ( $this -> contrat )) {
$this -> contrat -> services = new stdClass ();
$this -> contrat -> services -> inactifs = new stdClass ();
$this -> contrat -> services -> expires = new stdClass ();
$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 ;
}
if ( isset ( $this -> commande )) {
$this -> bank -> rappro = new stdClass ();
$this -> bank -> cheque = new stdClass ();
$this -> bank -> rappro -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE ) ? $this -> global -> MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0 ) * 24 * 60 * 60 ;
$this -> bank -> cheque -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_CHEQUES_TO_DEPOSIT ) ? $this -> global -> MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0 ) * 24 * 60 * 60 ;
}
if ( isset ( $this -> expensereport )) {
2016-12-22 15:33:43 +01:00
$this -> expensereport -> approve = new stdClass ();
$this -> expensereport -> approve -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_EXPENSEREPORTS ) ? $this -> global -> MAIN_DELAY_EXPENSEREPORTS : 0 ) * 24 * 60 * 60 ;
2015-12-14 09:14:34 +01:00
$this -> expensereport -> payment = new stdClass ();
$this -> expensereport -> payment -> warning_delay = ( isset ( $this -> global -> MAIN_DELAY_EXPENSEREPORTS_TO_PAY ) ? $this -> global -> MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0 ) * 24 * 60 * 60 ;
}
2017-06-06 07:57:03 +02:00
2017-03-04 20:10:50 +01:00
if ( ! empty ( $this -> global -> PRODUIT_MULTIPRICES ) && empty ( $this -> global -> PRODUIT_MULTIPRICES_LIMIT ))
{
$this -> global -> PRODUIT_MULTIPRICES_LIMIT = 5 ;
}
2017-06-06 07:57:03 +02:00
2014-06-22 13:33:31 +02:00
// For modules that want to disable top or left menu
if ( ! empty ( $this -> global -> MAIN_HIDE_TOP_MENU )) $this -> dol_hide_topmenu = $this -> global -> MAIN_HIDE_TOP_MENU ;
if ( ! empty ( $this -> global -> MAIN_HIDE_LEFT_MENU )) $this -> dol_hide_leftmenu = $this -> global -> MAIN_HIDE_LEFT_MENU ;
2017-03-01 11:18:11 +01:00
if ( empty ( $this -> global -> MAIN_SIZE_SHORTLIST_LIMIT )) $this -> global -> MAIN_SIZE_SHORTLIST_LIMIT = 3 ;
2017-12-16 20:52:49 +01:00
if ( ! isset ( $this -> global -> THEME_HIDE_BORDER_ON_INPUT )) $this -> global -> THEME_HIDE_BORDER_ON_INPUT = 0 ;
2017-05-19 18:03:49 +02:00
// Save inconsistent option
2018-03-20 11:27:47 +01:00
if ( empty ( $this -> global -> AGENDA_USE_EVENT_TYPE ) && ( ! isset ( $this -> global -> AGENDA_DEFAULT_FILTER_TYPE ) || $this -> global -> AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO' ))
2017-05-19 18:03:49 +02:00
{
2018-03-20 11:27:47 +01:00
$this -> global -> AGENDA_DEFAULT_FILTER_TYPE = '0' ; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
2017-05-19 18:03:49 +02:00
}
2017-06-06 07:57:03 +02:00
2018-03-20 11:26:41 +01:00
if ( ! isset ( $this -> global -> MAIN_EXTRAFIELDS_IN_ONE_TD )) $this -> global -> MAIN_EXTRAFIELDS_IN_ONE_TD = 1 ;
2018-03-20 11:27:47 +01:00
$this -> global -> MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com' ;
$this -> global -> MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567' ;
2017-08-22 14:47:01 +02:00
2010-06-02 10:34:44 +02:00
// For backward compatibility
2012-04-10 12:38:10 +02:00
if ( isset ( $this -> product )) $this -> produit = $this -> product ;
if ( isset ( $this -> facture )) $this -> invoice = $this -> facture ;
if ( isset ( $this -> commande )) $this -> order = $this -> commande ;
if ( isset ( $this -> contrat )) $this -> contract = $this -> contrat ;
if ( isset ( $this -> categorie )) $this -> category = $this -> categorie ;
2006-06-03 01:20:36 +02:00
2012-07-02 19:30:37 +02:00
// Object $mc
if ( ! defined ( 'NOREQUIREMC' ) && ! empty ( $this -> multicompany -> enabled ))
2012-04-06 22:39:40 +02:00
{
2012-07-02 19:30:37 +02:00
if ( is_object ( $mc )) $mc -> setValues ( $this );
2012-03-20 15:28:21 +01:00
}
2012-12-02 14:33:24 +01:00
2016-08-16 02:55:18 +02:00
// We init log handlers
2017-04-14 12:38:52 +02:00
if ( ! empty ( $this -> global -> SYSLOG_HANDLERS )) {
$handlers = json_decode ( $this -> global -> SYSLOG_HANDLERS );
2016-08-16 02:55:18 +02:00
} else {
$handlers = array ();
}
foreach ( $handlers as $handler ) {
$handler_files = array ();
2017-03-04 20:10:50 +01:00
$dirsyslogs = array_merge ( array ( '/core/modules/syslog/' ), $this -> modules_parts [ 'syslog' ]);
2016-08-16 02:55:18 +02:00
foreach ( $dirsyslogs as $reldir ) {
$dir = dol_buildpath ( $reldir , 0 );
$newdir = dol_osencode ( $dir );
if ( is_dir ( $newdir )) {
$file = $newdir . $handler . '.php' ;
if ( file_exists ( $file )) {
$handler_files [] = $file ;
}
}
}
if ( empty ( $handler_files )) {
throw new Exception ( 'Missing log handler file ' . $handler . '.php' );
}
require_once $handler_files [ 0 ];
$loghandlerinstance = new $handler ();
if ( ! $loghandlerinstance instanceof LogHandlerInterface ) {
throw new Exception ( 'Log handler does not extend LogHandlerInterface' );
}
if ( empty ( $this -> loghandlers [ $handler ])) {
$this -> loghandlers [ $handler ] = $loghandlerinstance ;
}
}
2017-06-06 07:57:03 +02:00
2011-02-16 20:59:16 +01:00
}
2003-06-24 16:11:21 +02:00
}