New: early development of multi-company module

This commit is contained in:
Regis Houssin 2009-05-04 13:13:01 +00:00
parent 07bb5570dd
commit 115a0f5bfe
5 changed files with 6 additions and 66 deletions

View File

@ -429,7 +429,7 @@ foreach ($orders as $key => $value)
if (! empty($conf->global->$const_name))
{
// Module actif
if (! empty($objMod->always_enabled)) print $langs->trans("Required");
if (! empty($objMod->always_enabled) || ($conf->global->MAIN_MODULE_MULTICOMPANY && $conf->entity!=1 && $objMod->core_enabled)) print $langs->trans("Required");
else print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=reset&amp;value=" . $modName . "&amp;mode=" . $mode . "\">" . $langs->trans("Disable") . "</a></td>\n";
if (! empty($objMod->config_page_url))

View File

@ -442,10 +442,13 @@ class DolibarrModules
global $conf;
$err = 0;
// Common module
$entity = (isset($this->core_enabled) ? 0 : $conf->entity);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE name = '".$this->const_name."'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND entity = ".$entity;
dol_syslog("DolibarrModules::_unactive sql=".$sql);
$this->db->query($sql);

View File

@ -204,11 +204,7 @@ class modMultiCompany extends DolibarrModules
{
$sql = array();
$init = $this->_init($sql);
$result=$this->load_tables('/multicompany/sql/init/');
return $init;
return $this->_init($sql);
}
/**
@ -221,25 +217,12 @@ class modMultiCompany extends DolibarrModules
{
$sql = array();
$result=$this->load_tables('/multicompany/sql/remove/');
$result = $this->destroy_cookie();
return $this->_remove($sql);
}
/**
* \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/
* This function is called by this->init.
* \return int <=0 if KO, >0 if OK
*/
function load_tables($path)
{
return $this->_load_tables($path);
}
/**
* \brief Destroy a cookie
*/

View File

@ -1,23 +0,0 @@
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
--
--
-- Constantes communes de configuration
--
-- UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_MULTICOMPANY' AND entity=1;

View File

@ -1,23 +0,0 @@
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
--
--
-- Constantes communes de configuration
--
-- DELETE FROM llx_const WHERE name='MAIN_MODULE_MULTICOMPANY';