Fix: Triggers path should be relative to allow usage of alternate search.
This commit is contained in:
parent
53d0704350
commit
c4bb69b7bf
@ -82,16 +82,16 @@ class Conf
|
||||
|
||||
|
||||
/**
|
||||
* \brief 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 $db Handler d'acces base
|
||||
* @return int < 0 if KO, >= 0 if OK
|
||||
*/
|
||||
function setValues($db)
|
||||
{
|
||||
dol_syslog("Conf::setValues");
|
||||
|
||||
// Directory of core triggers
|
||||
$this->triggers_modules[] = DOL_DOCUMENT_ROOT . "/includes/triggers";
|
||||
$this->triggers_modules[] = "/includes/triggers"; // Relative path
|
||||
|
||||
// Avoid warning if not defined
|
||||
if (empty($this->db->dolibarr_main_db_encryption)) $this->db->dolibarr_main_db_encryption=0;
|
||||
@ -142,8 +142,7 @@ class Conf
|
||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$reg))
|
||||
{
|
||||
$modulename = strtolower($reg[1]);
|
||||
if ($value == 1) $this->triggers_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/inc/triggers/';
|
||||
else if ($value == 2) $this->triggers_modules[] = DOL_DOCUMENT_ROOT_ALT.'/'.$modulename.'/inc/triggers/';
|
||||
$this->triggers_modules[] = '/'.$modulename.'/inc/triggers/';
|
||||
}
|
||||
// If this is constant for login method activated by a module
|
||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_LOGIN_METHOD$/i',$key,$reg))
|
||||
|
||||
@ -68,8 +68,11 @@ class Interfaces
|
||||
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
|
||||
}
|
||||
|
||||
foreach($conf->triggers_modules as $dir)
|
||||
foreach($conf->triggers_modules as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
//print "xx".$dir;exit;
|
||||
|
||||
// Check if directory exists
|
||||
if (!is_dir($dir)) continue;
|
||||
|
||||
@ -173,8 +176,9 @@ class Interfaces
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return list of triggers.
|
||||
* \param workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated
|
||||
* Return list of triggers. Function used by admin page htdoc/admin/triggers
|
||||
* @param workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated
|
||||
* @return array Array list of triggers
|
||||
*/
|
||||
function getTriggersList($workflow=0)
|
||||
{
|
||||
@ -187,8 +191,11 @@ class Interfaces
|
||||
$orders = array();
|
||||
$i = 0;
|
||||
|
||||
foreach($conf->triggers_modules as $dir)
|
||||
foreach($conf->triggers_modules as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
//print "xx".$dir;exit;
|
||||
|
||||
// Check if directory exists
|
||||
if (!is_dir($dir)) continue;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user