Fix error management in duplicate trigger

This commit is contained in:
Laurent Destailleur 2017-03-18 11:36:48 +01:00
parent dfc1ed7d72
commit 597fb11d08
2 changed files with 21 additions and 21 deletions

View File

@ -107,27 +107,6 @@ class Interfaces
$nbfile++;
$modName = "Interface".ucfirst($reg[3]);
//print "file=$file - modName=$modName\n";
if (in_array($modName,$modules))
{
$langs->load("errors");
dol_syslog(get_class($this)."::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/core/triggers/"), LOG_ERR);
continue;
}
else
{
try {
//print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n";
include_once $newdir.'/'.$file;
//print 'Done for '.$modName."\n";
}
catch(Exception $e)
{
dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERROR);
}
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file)) continue;
// Check if trigger file is for a particular module
@ -145,8 +124,28 @@ class Interfaces
continue;
}
$modName = "Interface".ucfirst($reg[3]);
//print "file=$file - modName=$modName\n";
if (in_array($modName,$modules)) // $modules = list of modName already loaded
{
$langs->load("errors");
dol_syslog(get_class($this)."::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger", $newdir."/".$file, $fullpathfiles[$modName]), LOG_ERR);
continue;
}
try {
//print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n";
include_once $newdir.'/'.$file;
//print 'Done for '.$modName."\n";
}
catch(Exception $e)
{
dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERROR);
}
$modules[$i] = $modName;
$files[$i] = $file;
$fullpathfiles[$modName] = $newdir.'/'.$file;
$orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value
$i++;

View File

@ -183,6 +183,7 @@ ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter tim
ErrorTaskAlreadyAssigned=Task already assigned to user
ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format.
ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (<strong>%s</strong>) does not match expected name syntax: <strong>%s</strong>
ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s.
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.