diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 373a211bdad..fd39396163f 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/class/menubase.class.php * \ingroup core - * \version $Id$ + * \version $Id: menubase.class.php,v 1.25 2011/07/13 22:18:48 eldy Exp $ * \brief File of class to manage dynamic menu entries * \remarks Initialy built by build_class_from_table on 2008-01-12 14:19 */ @@ -78,7 +78,7 @@ class Menubase * @param user User that create * @return int <0 if KO, Id of record if OK */ - function create($user) + function create($user=0) { global $conf, $langs; 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/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index ccf074c5150..b41e2e2b31f 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -24,7 +24,7 @@ /** * \file htdocs/includes/modules/DolibarrModules.class.php * \brief Fichier de description et activation des modules Dolibarr - * \version $Id: DolibarrModules.class.php,v 1.159 2011/06/28 20:31:23 eldy Exp $ + * \version $Id: DolibarrModules.class.php,v 1.161 2011/07/13 22:15:19 eldy Exp $ */ @@ -926,7 +926,7 @@ class DolibarrModules /** * Insert permissions definitions related to the module into llx_rights_def - * @param $reinitadminperms If 1, we also grant them to admin user + * @param $reinitadminperms If 1, we also grant them to all admin users * @return int Number of error (0 if OK) */ function insert_permissions($reinitadminperms=0) @@ -955,7 +955,7 @@ class DolibarrModules { $r_id = $this->rights[$key][0]; $r_desc = $this->rights[$key][1]; - $r_type = $this->rights[$key][2]; + $r_type = isset($this->rights[$key][2])?$this->rights[$key][2]:''; $r_def = $this->rights[$key][3]; $r_perms = $this->rights[$key][4]; $r_subperms = isset($this->rights[$key][5])?$this->rights[$key][5]:''; @@ -1004,12 +1004,15 @@ class DolibarrModules } // If we are into a logged session and we are an admin user, we take permission of new activated module - if ($reinitadminperms && ! empty($user->admin)) + if ($reinitadminperms) { - $user->addrights($r_id); - // We reload permissions - $user->clearrights(); - $user->getrights(); + if (! empty($user->admin)) // FIXME. We must loop on each admin records and make grant on each fuser object. We must removed global $user. + { + $user->addrights($r_id); + // We reload permissions + $user->clearrights(); + $user->getrights(); + } } } } @@ -1056,8 +1059,6 @@ class DolibarrModules */ function insert_menus() { - global $user; - require_once(DOL_DOCUMENT_ROOT."/core/class/menubase.class.php"); $err=0; @@ -1118,7 +1119,7 @@ class DolibarrModules if (! $err) { - $result=$menu->create($user); + $result=$menu->create(); if ($result > 0) { $this->menu[$key]['rowid']=$result; 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/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 }