From fe3f8609536bac17566ab9dbeef6d0fd5df0bdec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jul 2011 21:33:38 +0000 Subject: [PATCH] Fix: Object should never be a global variable as there is several object in a context. Also object type must be fixed for each "trigger code". So we add trigger code and object on parameter because only caller of a function know which object type we use and what trigger code we want to trigger. --- build/exe/doliwamp/doliwamp.iss | 16 ++++++++-------- htdocs/filefunc.inc.php | 4 ++-- .../interface_modAgenda_ActionsAuto.class.php | 14 ++++++++++---- htdocs/install/inc.php | 4 ++-- htdocs/langs/fr_FR/categories.lang | 2 +- htdocs/lib/files.lib.php | 12 +++++++----- 6 files changed, 30 insertions(+), 22 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index f89ff75f410..c731758148d 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -10,7 +10,7 @@ ; only the root user with no password, stop server and catch ; files user.MY* to put them in the Dolibarr build/exe/doliwamp/mysql directory. ; -; Version: $Id$ +; Version: $Id: doliwamp.iss,v 1.82 2011/07/13 21:09:30 eldy Exp $ ;---------------------------------------------------------------------------------------- @@ -18,12 +18,12 @@ ; ----- Change this ----- AppName=DoliWamp ; DoliWamp-x.x.x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta -AppVerName=DoliWamp-3.1.0-alpha +AppVerName=DoliWamp-3.1.0-beta ; DoliWamp-x.x x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta -OutputBaseFilename=DoliWamp-3.1.0-alpha +OutputBaseFilename=DoliWamp-3.1.0-beta ; Define full path from wich all relative path are defined ; You must modify this to put here your dolibarr root directory -SourceDir=C:\Work\Data\Workspace\dolibarr +SourceDir=C:\Mes Developpements\dolibarr ; ----- End of change ;OutputManifestFile=build\doliwampbuild.log AppId=doliwamp @@ -101,10 +101,10 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi ; PhpMyAdmin, Apache, Php, Mysql ; Put here path of Wampserver applications ; Value OK: apache 2.2.6, php 5.2.5 (5.2.11 fails if php_exif is on), mysql 5.0.45 or 5.1.36 -Source: "C:\Work\Applis\Wamp\apps\phpmyadmin3.2.0.1\*.*"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log" -Source: "C:\Work\Applis\Wamp\bin\apache\apache2.2.6\*.*"; DestDir: "{app}\bin\apache\apache2.2.6"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" -Source: "C:\Work\Applis\Wamp\bin\php\php5.2.5\*.*"; DestDir: "{app}\bin\php\php5.2.5"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" -Source: "C:\Work\Applis\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" +Source: "C:\Program Files\Wamp\apps\phpmyadmin3.2.0.1\*.*"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log" +Source: "C:\Program Files\Wamp\bin\apache\apache2.2.6\*.*"; DestDir: "{app}\bin\apache\apache2.2.6"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" +Source: "C:\Program Files\Wamp\bin\php\php5.2.5\*.*"; DestDir: "{app}\bin\php\php5.2.5"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" +Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" ; Mysql data files (does not overwrite if exists) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db" ; Dolibarr diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 54a53fc9175..4e96c341f34 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -28,10 +28,10 @@ * \file htdocs/filefunc.inc.php * \ingroup core * \brief File that include conf.php file and functions.lib.php - * \version $Id: filefunc.inc.php,v 1.17 2011/06/28 12:25:43 hregis Exp $ + * \version $Id: filefunc.inc.php,v 1.18 2011/07/13 21:19:58 eldy Exp $ */ -define('DOL_VERSION','3.1.0-alpha'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z) +define('DOL_VERSION','3.1.0-beta'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z) define('EURO',chr(128)); // Definition des constantes syslog diff --git a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php index 2ff7b4003b3..e2987f224ee 100644 --- a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php +++ b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php @@ -22,7 +22,7 @@ * \file htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php * \ingroup agenda * \brief Trigger file for agenda module - * \version $Id: interface_modAgenda_ActionsAuto.class.php,v 1.33 2011/07/07 09:18:27 simnandez Exp $ + * \version $Id: interface_modAgenda_ActionsAuto.class.php,v 1.34 2011/07/13 18:05:27 eldy Exp $ */ @@ -550,8 +550,14 @@ class InterfaceActionsAuto { $now=dol_now(); + require_once(DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'); + require_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'); + $contactforaction=new Contact($this->db); + $societeforaction=new Societe($this->db); + if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); + if ($object->socid > 0) $societeforaction->fetch($object->socid); + // Insertion action - require_once(DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'); require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'); $actioncomm = new ActionComm($this->db); $actioncomm->type_code = $object->actiontypecode; @@ -562,8 +568,8 @@ class InterfaceActionsAuto $actioncomm->durationp = 0; $actioncomm->punctual = 1; $actioncomm->percentage = -1; // Not applicable - $actioncomm->contact = new Contact($this->db,$object->sendtoid); - $actioncomm->societe = new Societe($this->db,$object->socid); + $actioncomm->contact = $contactforaction; + $actioncomm->societe = $societeforaction; $actioncomm->author = $user; // User saving action //$actioncomm->usertodo = $user; // User affected to action $actioncomm->userdone = $user; // User doing action diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 1fd1774d185..bb49200a208 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -22,10 +22,10 @@ /** \file htdocs/install/inc.php * \ingroup core * \brief File that define environment for install pages - * \version $Id: inc.php,v 1.134 2011/07/11 10:53:37 eldy Exp $ + * \version $Id: inc.php,v 1.135 2011/07/13 21:19:58 eldy Exp $ */ -define('DOL_VERSION','3.1.0-alpha'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z) +define('DOL_VERSION','3.1.0-beta'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z) require_once('../core/class/translate.class.php'); require_once('../lib/functions.lib.php'); diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 092becf4c98..484cc8ce9a3 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -42,7 +42,7 @@ ErrCatAlreadyExists=Ce nom est déjà utilisé AddProductToCat=Ajouter ce produit à une catégorie ? ImpossibleAddCat=Impossible d'ajouter la catégorie ImpossibleAssociateCategory=Impossible d'associer la catégorie -WasAddedSuccessfully=%s a été ajoutée avec succès. +WasAddedSuccessfully=%s a été ajouté avec succès. ObjectAlreadyLinkedToCategory=L'élément est déjà lié à cette catégorie. CategorySuccessfullyCreated=La catégorie %s a été ajouté avec succès. ProductIsInCategories=Ce produit/service est dans les catégories suivantes diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php index 3dbbef2c6b2..5dda38dcc5c 100644 --- a/htdocs/lib/files.lib.php +++ b/htdocs/lib/files.lib.php @@ -20,7 +20,7 @@ /** * \file htdocs/lib/files.lib.php * \brief Library for file managing functions - * \version $Id: files.lib.php,v 1.68 2011/07/11 06:23:22 hregis Exp $ + * \version $Id: files.lib.php,v 1.69 2011/07/13 21:33:38 eldy Exp $ */ /** @@ -590,12 +590,13 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param disableglob Disable usage of glob like * * @param nophperrors Disable all PHP output errors * @param notrigger Disable all triggers + * @param triggercode Code of trigger + * @param object Object for trigger * @return boolean True if file is deleted, False if error */ -function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0) +function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$triggercode='FILE_DELETE',$object=null) { - global $conf, $user, $langs; - global $object; + global $db, $conf, $user, $langs; //print "x".$file." ".$disableglob; $ok=true; @@ -611,12 +612,13 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0) dol_syslog("Removed file ".$filename,LOG_DEBUG); if (! $notrigger) { + if (! is_object($object)) $object=(object) 'dummy'; $object->src_file=$file; // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($db); - $result=$interface->run_triggers('FILE_DELETE',$object,$user,$langs,$conf); + $result=$interface->run_triggers($triggercode,$object,$user,$langs,$conf); if ($result < 0) { $error++; $errors=$interface->errors; } // Fin appel triggers }