From 597fb11d08b4c3b270d8bdb033747260244f6365 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Mar 2017 11:36:48 +0100 Subject: [PATCH] Fix error management in duplicate trigger --- htdocs/core/class/interfaces.class.php | 41 +++++++++++++------------- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 127bf46f2fa..e0265920f89 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -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++; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 22a1000d436..77a99994fef 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -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 (%s) does not match expected name syntax: %s +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.