Fix pb of compatibility

This commit is contained in:
Laurent Destailleur 2009-04-16 18:46:26 +00:00
parent 2efd3db4c8
commit 200923595f
5 changed files with 47 additions and 20 deletions

View File

@ -55,7 +55,7 @@ class Conf
var $logbuffer=array(); var $logbuffer=array();
var $entity; var $entity = 1; // By default for backward compatibility
/** /**
@ -71,12 +71,15 @@ class Conf
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1; $this->global->PRODUIT_CONFIRM_DELETE_LINE=1;
// Load entity cookie // Load entity cookie
/* TODO Removed: La classe conf est une classe de stockage de conf independante
de la couche presentation et de la gestion des acces IHM, donc ne doit pas acceder des cookies.
$entityCookieName = "DOLENTITYID_dolibarr"; $entityCookieName = "DOLENTITYID_dolibarr";
if (!$_COOKIE[$entityCookieName]){ if (!$_COOKIE[$entityCookieName]){
$this->entity = 1; $this->entity = 1;
}else{ }else{
$this->entity = $_COOKIE[$entityCookieName]; $this->entity = $_COOKIE[$entityCookieName];
} }
*/
/* /*
* Definition de toutes les Constantes globales d'environnement * Definition de toutes les Constantes globales d'environnement

View File

@ -393,7 +393,8 @@ class DolibarrModules
$err = 0; $err = 0;
if ($this->family == "base") $conf->entity = 0; // Common module // Removed because create pb of compatibility
// if ($this->family == "base") $conf->entity = 0; // Common module
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const ";
$sql.= "WHERE name = '".$this->const_name."' "; $sql.= "WHERE name = '".$this->const_name."' ";
@ -423,7 +424,8 @@ class DolibarrModules
$err = 0; $err = 0;
if ($this->family == "base") $conf->entity = 0; // Common module // Removed because create pb of compatibility
// if ($this->family == "base") $conf->entity = 0; // Common module
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const ";
$sql.= "WHERE name = '".$this->const_name."'"; $sql.= "WHERE name = '".$this->const_name."'";

View File

@ -126,4 +126,5 @@ ALTER TABLE llx_categorie_association ADD UNIQUE INDEX uk_categorie_association_
-- Multi company -- Multi company
ALTER TABLE llx_const ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER tms; ALTER TABLE llx_const ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER tms;
ALTER TABLE llx_const DROP INDEX name; ALTER TABLE llx_const DROP INDEX name;
ALTER TABLE llx_const ADD UNIQUE INDEX(name, entity);
ALTER TABLE llx_const ADD UNIQUE INDEX uk_const (name, entity);

View File

@ -0,0 +1,22 @@
-- ============================================================================
-- Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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$
-- ============================================================================
ALTER TABLE llx_const ADD UNIQUE INDEX uk_const (name, entity);

View File

@ -34,8 +34,7 @@ create table llx_const
visible tinyint DEFAULT 1 NOT NULL, visible tinyint DEFAULT 1 NOT NULL,
note text, note text,
tms timestamp, tms timestamp,
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL -- multi company id
UNIQUE INDEX(name)
) type=innodb; ) type=innodb;
-- --