Qual: Uniformize code
Perf: Very small per enhancement
This commit is contained in:
parent
b8b1a4f60d
commit
e903719c36
@ -160,7 +160,7 @@ print "<br>\n";
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
// List of sending methods
|
||||
$listofmethods=(is_array($conf->sms_engine)?$conf->sms_engine:array());
|
||||
$listofmethods=(is_array($conf->sms_engine_modules)?$conf->sms_engine_modules:array());
|
||||
asort($listofmethods);
|
||||
|
||||
if ($action == 'edit')
|
||||
|
||||
@ -28,8 +28,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class Conf
|
||||
* \brief Class to stock current configuration
|
||||
* Class to stock current configuration
|
||||
*/
|
||||
class Conf
|
||||
{
|
||||
@ -43,7 +42,6 @@ class Conf
|
||||
|
||||
//! To store if javascript/ajax is enabked
|
||||
public $use_javascript_ajax;
|
||||
|
||||
//! Used to store current currency
|
||||
public $currency;
|
||||
//! Used to store current css (from theme)
|
||||
@ -53,6 +51,17 @@ class Conf
|
||||
public $top_menu;
|
||||
public $smart_menu;
|
||||
|
||||
public $modules = array(); // List of activated modules
|
||||
public $css_modules = array();
|
||||
public $tabs_modules = array();
|
||||
public $triggers_modules = array();
|
||||
public $menus_modules = array();
|
||||
public $hooks_modules = array();
|
||||
public $login_method_modules = array();
|
||||
public $sms_engine_modules = array();
|
||||
|
||||
var $logbuffer = array();
|
||||
|
||||
//! To store properties of multi-company
|
||||
public $multicompany;
|
||||
//! Used to store running instance for multi-company (default 1)
|
||||
@ -60,15 +69,6 @@ class Conf
|
||||
//! Used to store list of entities to use for each element
|
||||
public $entities = array();
|
||||
|
||||
public $modules = array(); // List of modules
|
||||
public $css_modules = array();
|
||||
public $tabs_modules = array();
|
||||
public $triggers_modules = array('/core/triggers'); // TODO default triggers should not be into the module list
|
||||
public $menus_modules = array();
|
||||
public $hooks_modules = array();
|
||||
public $login_method_modules = array();
|
||||
|
||||
var $logbuffer = array();
|
||||
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ class Conf
|
||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_SMS$/i',$key,$reg))
|
||||
{
|
||||
$module=strtolower($reg[1]);
|
||||
$this->sms_engine[$module]=$module; // Add this module in list of modules that provide SMS
|
||||
$this->sms_engine_modules[$module]=$module; // Add this module in list of modules that provide SMS
|
||||
}
|
||||
// If this is a module constant
|
||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
|
||||
@ -209,8 +209,8 @@ class Conf
|
||||
$mc->setValues($this);
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
$db->free($resql);
|
||||
//var_dump($this->modules);
|
||||
|
||||
// Clean some variables
|
||||
@ -289,8 +289,6 @@ class Conf
|
||||
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";
|
||||
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';
|
||||
|
||||
// Security
|
||||
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
|
||||
|
||||
@ -46,7 +46,7 @@ class Interfaces
|
||||
/**
|
||||
* Function called when a Dolibarr business event occurs
|
||||
* This function call all qualified triggers.
|
||||
*
|
||||
*
|
||||
* @param string $action Trigger event code
|
||||
* @param Object $object Objet concern
|
||||
* @param User $user Objet user
|
||||
@ -68,13 +68,14 @@ class Interfaces
|
||||
}
|
||||
|
||||
$nbfile = $nbtotal = $nbok = $nbko = 0;
|
||||
|
||||
|
||||
$files = array();
|
||||
$modules = array();
|
||||
$orders = array();
|
||||
$i=0;
|
||||
|
||||
foreach($conf->triggers_modules as $reldir)
|
||||
$dirtriggers=array_merge(array('/core/triggers'),$conf->triggers_modules);
|
||||
foreach($dirtriggers as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
//print "xx".$dir;exit;
|
||||
@ -92,7 +93,7 @@ class Interfaces
|
||||
$part1=$reg[1];
|
||||
$part2=$reg[2];
|
||||
$part3=$reg[3];
|
||||
|
||||
|
||||
$nbfile++;
|
||||
|
||||
$modName = "Interface".ucfirst($reg[3]);
|
||||
@ -124,17 +125,17 @@ class Interfaces
|
||||
dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$modules[$i] = $modName;
|
||||
$files[$i] = $file;
|
||||
$orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
asort($orders);
|
||||
|
||||
// Loop on each trigger
|
||||
@ -189,7 +190,7 @@ class Interfaces
|
||||
/**
|
||||
* Return list of triggers. Function used by admin page htdoc/admin/triggers.
|
||||
* List is sorted by trigger filename so by priority to run.
|
||||
*
|
||||
*
|
||||
* @return array Array list of triggers
|
||||
*/
|
||||
function getTriggersList()
|
||||
@ -203,7 +204,8 @@ class Interfaces
|
||||
$orders = array();
|
||||
$i = 0;
|
||||
|
||||
foreach($conf->triggers_modules as $reldir)
|
||||
$dirtriggers=array_merge(array('/core/triggers'),$conf->triggers_modules);
|
||||
foreach($dirtriggers as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
//print "xx".$dir;exit;
|
||||
@ -221,7 +223,7 @@ class Interfaces
|
||||
$part1=$reg[1];
|
||||
$part2=$reg[2];
|
||||
$part3=$reg[3];
|
||||
|
||||
|
||||
$modName = 'Interface'.ucfirst($reg[3]);
|
||||
//print "file=$file"; print "modName=$modName"; exit;
|
||||
if (in_array($modName,$modules))
|
||||
@ -237,7 +239,7 @@ class Interfaces
|
||||
$files[$i] = $file;
|
||||
$modules[$i] = $modName;
|
||||
$orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ function group_prepare_head($object)
|
||||
|
||||
/**
|
||||
* Show list of themes. Show all thumbs of themes
|
||||
*
|
||||
*
|
||||
* @param User $fuser User concerned or '' for global theme
|
||||
* @param int $edit 1 to add edit form
|
||||
* @param boolean $foruserprofile Show for user profile view
|
||||
|
||||
@ -27,16 +27,15 @@ require_once(DOL_DOCUMENT_ROOT."/core/modules/societe/modules_societe.class.php"
|
||||
|
||||
|
||||
/**
|
||||
* \class mod_codecompta_aquarium
|
||||
* \brief Class to manage accountancy code of thirdparties with Aquarium rules
|
||||
* Class to manage accountancy code of thirdparties with Aquarium rules
|
||||
*/
|
||||
class mod_codecompta_aquarium extends ModeleAccountancyCode
|
||||
{
|
||||
var $nom='Aquarium';
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
var $prefixcustomeraccountancycode='411';
|
||||
var $prefixsupplieraccountancycode='401';
|
||||
var $prefixcustomeraccountancycode;
|
||||
var $prefixsupplieraccountancycode;
|
||||
|
||||
|
||||
/**
|
||||
@ -45,15 +44,17 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
|
||||
function mod_codecompta_aquarium()
|
||||
{
|
||||
global $conf;
|
||||
$this->prefixcustomeraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
|
||||
if (empty($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
|
||||
if (empty($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
|
||||
$this->prefixcustomeraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
|
||||
$this->prefixsupplieraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER;
|
||||
}
|
||||
|
||||
|
||||
/** Return description of module
|
||||
*
|
||||
* @param string $langs Object langs
|
||||
* @return string Description of module
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
*/
|
||||
function info($langs)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user