diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 23d340d2daa..0104c6f7020 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -46,7 +46,7 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add') if ($_GET["action"] == 'delete') { - if (! dolibarr_del_const($db, $_GET["rowid"])); + if (! dolibarr_del_const($db, $_GET["rowid"],$_GET["entity"])); { print $db->error(); } @@ -66,6 +66,7 @@ print ''; print ''.$langs->trans("Name").''; print ''.$langs->trans("Value").''; print ''.$langs->trans("Note").''; +if ($conf->multicompany->enabled) print ''.$langs->trans("Entity").''; print ''.$langs->trans("Action").''; print "\n"; @@ -83,7 +84,18 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; +if ($conf->multicompany->enabled) +{ + print ''; + print ''; + print ''; +} +else +{ + print ''; +} +print ''; print '
'; print "\n"; print ''; @@ -120,7 +132,6 @@ if ($result) print ''; print ''; print ''; - print ''; print "$obj->name\n"; @@ -131,9 +142,23 @@ if ($result) // Note print ''; - print ''; + print ''; + + // Entity + if ($conf->multicompany->enabled) + { + print ''; + print ''; + print ''; + } + else + { + print ''; + } + + print ''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; print "\n"; print ''; diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index b4de67b9a5d..77382bf6e62 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -392,6 +392,8 @@ class DolibarrModules global $conf; $err = 0; + + if ($this->family == "base") $conf->entity = 0; // Common module $sql = "DELETE FROM ".MAIN_DB_PREFIX."const "; $sql.= "WHERE name = '".$this->const_name."' "; @@ -420,6 +422,8 @@ class DolibarrModules global $conf; $err = 0; + + if ($this->family == "base") $conf->entity = 0; // Common module $sql = "DELETE FROM ".MAIN_DB_PREFIX."const "; $sql.= "WHERE name = '".$this->const_name."'"; diff --git a/htdocs/includes/modules/modMultiCompany.class.php b/htdocs/includes/modules/modMultiCompany.class.php index dec385d196b..b8b812b7742 100644 --- a/htdocs/includes/modules/modMultiCompany.class.php +++ b/htdocs/includes/modules/modMultiCompany.class.php @@ -83,7 +83,7 @@ class modMultiCompany extends DolibarrModules $this->depends = array(); // List of modules id that must be enabled if this module is enabled $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->phpmin = array(4,3); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(2,5); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(2,6); // Minimum version of Dolibarr required by module $this->langfiles = array("multicompany"); // Constants @@ -204,7 +204,7 @@ class modMultiCompany extends DolibarrModules { $sql = array(); - $result=$this->load_tables(); + //$result=$this->load_tables(); return $this->_init($sql); } @@ -217,10 +217,12 @@ class modMultiCompany extends DolibarrModules */ function remove() { - $sql = array(); - - return $this->_remove($sql); - } + $sql = array(); + + $result = $this->destroy_cookie(); + + return $this->_remove($sql); + } /** @@ -232,8 +234,18 @@ class modMultiCompany extends DolibarrModules */ function load_tables() { - return $this->_load_tables('/mymodule/sql/'); + return $this->_load_tables('/multicompany/sql/'); + } + + /** + * \brief Destroy a cookie + */ + function destroy_cookie() + { + // Destroy entity cookie + $entityCookieName = "DOLENTITYID_dolibarr"; + setcookie($entityCookieName, '', 1, "/"); } } -?> +?> \ No newline at end of file diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 0298235f08b..30c43d01c33 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -385,8 +385,8 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not } else { - $this->error=$db->lasterror(); - dol_syslog("admin.lib::dolibarr_set_const ".$this->error, LOG_ERR); + $error=$db->lasterror(); + dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR); $db->rollback(); return -1; }