Skip to content
Snippets Groups Projects
Commit 33f0613f authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: More portable SQL

parent e99ec408
No related branches found
No related tags found
No related merge requests found
Showing
with 322 additions and 302 deletions
...@@ -116,7 +116,7 @@ class Menubase ...@@ -116,7 +116,7 @@ class Menubase
$sql.= "leftmenu,"; $sql.= "leftmenu,";
$sql.= "perms,"; $sql.= "perms,";
$sql.= "enabled,"; $sql.= "enabled,";
$sql.= "user"; $sql.= "usertype";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " '".$this->menu_handler."',"; $sql.= " '".$this->menu_handler."',";
$sql.= " '".$conf->entity."',"; $sql.= " '".$conf->entity."',";
...@@ -199,7 +199,7 @@ class Menubase ...@@ -199,7 +199,7 @@ class Menubase
$sql.= " leftmenu='".addslashes($this->leftmenu)."',"; $sql.= " leftmenu='".addslashes($this->leftmenu)."',";
$sql.= " perms='".addslashes($this->perms)."',"; $sql.= " perms='".addslashes($this->perms)."',";
$sql.= " enabled='".addslashes($this->enabled)."',"; $sql.= " enabled='".addslashes($this->enabled)."',";
$sql.= " user='".$this->user."'"; $sql.= " usertype='".$this->user."'";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog("Menubase::update sql=".$sql, LOG_DEBUG); dol_syslog("Menubase::update sql=".$sql, LOG_DEBUG);
...@@ -242,7 +242,7 @@ class Menubase ...@@ -242,7 +242,7 @@ class Menubase
$sql.= " t.leftmenu,"; $sql.= " t.leftmenu,";
$sql.= " t.perms,"; $sql.= " t.perms,";
$sql.= " t.enabled,"; $sql.= " t.enabled,";
$sql.= " t.user,"; $sql.= " t.usertype as user,";
$sql.= " ".$this->db->pdate('t.tms').""; $sql.= " ".$this->db->pdate('t.tms')."";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as t"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;
...@@ -365,8 +365,8 @@ class Menubase ...@@ -365,8 +365,8 @@ class Menubase
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE m.menu_handler in('".$menu_handler."','all')"; $sql.= " WHERE m.menu_handler in('".$menu_handler."','all')";
$sql.= " AND m.entity = ".$conf->entity; $sql.= " AND m.entity = ".$conf->entity;
if ($type_user == 0) $sql.= " AND m.user in (0,2)"; if ($type_user == 0) $sql.= " AND m.usertype in (0,2)";
if ($type_user == 1) $sql.= " AND m.user in (1,2)"; if ($type_user == 1) $sql.= " AND m.usertype in (1,2)";
// If type_user == 2, no test required // If type_user == 2, no test required
$sql.= " ORDER BY m.position, m.rowid"; $sql.= " ORDER BY m.position, m.rowid";
...@@ -593,8 +593,8 @@ class Menubase ...@@ -593,8 +593,8 @@ class Menubase
$sql.= " WHERE m.type = 'top'"; $sql.= " WHERE m.type = 'top'";
$sql.= " AND m.entity = ".$conf->entity; $sql.= " AND m.entity = ".$conf->entity;
$sql.= " AND m.menu_handler in('".$menu_handler."','all')"; $sql.= " AND m.menu_handler in('".$menu_handler."','all')";
if ($type_user == 0) $sql.= " AND m.user in (0,2)"; if ($type_user == 0) $sql.= " AND m.usertype in (0,2)";
if ($type_user == 1) $sql.= " AND m.user in (1,2)"; if ($type_user == 1) $sql.= " AND m.usertype in (1,2)";
// If type_user == 2, no test requires // If type_user == 2, no test requires
$sql.= " ORDER BY m.position"; $sql.= " ORDER BY m.position";
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -458,6 +458,8 @@ alter table llx_societe modify special_code integer NULL; ...@@ -458,6 +458,8 @@ alter table llx_societe modify special_code integer NULL;
ALTER TABLE llx_adherent_options ADD INDEX uk_adherent_options (adhid); ALTER TABLE llx_adherent_options ADD INDEX uk_adherent_options (adhid);
ALTER TABLE llx_bank_class ADD UNIQUE INDEX idx_bank_class_lineid (lineid); ALTER TABLE llx_bank_class ADD UNIQUE INDEX idx_bank_class_lineid (lineid);
ALTER TABLE llx_c_ecotaxe ADD INDEX uk_c_ecotaxe (code); ALTER TABLE llx_c_ecotaxe ADD UNIQUE INDEX uk_c_ecotaxe (code);
ALTER TABLE llx_c_methode_commande_fournisseur ADD UNIQUE INDEX uk_c_methode_commande_fournisseur (code);
ALTER TABLE llx_menu change user usertype integer NOT NULL default '0';
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2007 Regis Houssin <regis@dolibarr.fr> -- Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
-- $Id$ -- $Id$
-- ======================================================================== -- ========================================================================
ALTER TABLE llx_c_ecotaxe ADD INDEX uk_c_ecotaxe (code); ALTER TABLE llx_c_ecotaxe ADD UNIQUE INDEX uk_c_ecotaxe (code);
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2007 R�gis Houssin <regis@dolibarr.fr> -- Copyright (C) 2007 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
......
-- ========================================================================
-- Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005-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_c_methode_commande_fournisseur ADD UNIQUE INDEX uk_c_methode_commande_fournisseur (code);
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
...@@ -24,8 +24,6 @@ create table llx_c_methode_commande_fournisseur ...@@ -24,8 +24,6 @@ create table llx_c_methode_commande_fournisseur
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(30), code varchar(30),
libelle varchar(60), libelle varchar(60),
active tinyint default 1 NOT NULL, active tinyint default 1 NOT NULL
UNIQUE INDEX(code)
)type=innodb; )type=innodb;
...@@ -27,6 +27,6 @@ create table llx_cotisation ...@@ -27,6 +27,6 @@ create table llx_cotisation
dateadh datetime, dateadh datetime,
datef date, datef date,
cotisation real, cotisation real,
fk_bank int(11) DEFAULT NULL, fk_bank integer DEFAULT NULL,
note text note text
)type=innodb; )type=innodb;
...@@ -18,14 +18,12 @@ ...@@ -18,14 +18,12 @@
-- $Id$ -- $Id$
-- ======================================================================== -- ========================================================================
CREATE TABLE llx_droitpret_rapport (
CREATE TABLE `llx_droitpret_rapport` ( rowid integer AUTO_INCREMENT PRIMARY KEY,
`rowid` int(11) NOT NULL auto_increment, date_envoie datetime NOT NULL,
`date_envoie` datetime NOT NULL, format varchar(10) NOT NULL,
`format` varchar(10) NOT NULL, date_debut datetime NOT NULL,
`date_debut` datetime NOT NULL, date_fin datetime NOT NULL,
`date_fin` datetime NOT NULL, fichier varchar(255) NOT NULL,
`fichier` varchar(255) NOT NULL, nbfact integer NOT NULL
`nbfact` int(11) NOT NULL,
PRIMARY KEY (`rowid`)
) type=innodb; ) type=innodb;
...@@ -35,16 +35,14 @@ create table llx_facture_rec ...@@ -35,16 +35,14 @@ create table llx_facture_rec
total_ttc real DEFAULT 0, total_ttc real DEFAULT 0,
fk_user_author integer, -- createur fk_user_author integer, -- createur
fk_projet integer, -- projet auquel est associ la facture fk_projet integer, -- projet auquel est associ� la facture
fk_cond_reglement integer DEFAULT 0, -- condition de reglement fk_cond_reglement integer DEFAULT 0, -- condition de reglement
fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prlvement) fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Pr�l�vement)
date_lim_reglement date, -- date limite de reglement date_lim_reglement date, -- date limite de reglement
note text, note text,
note_public text, note_public text,
frequency char(2) DEFAULT NULL, frequency char(2) DEFAULT NULL,
last_gen varchar(7) DEFAULT NULL, last_gen varchar(7) DEFAULT NULL
INDEX idx_facture_rec_fksoc (fk_soc)
)type=innodb; )type=innodb;
...@@ -29,7 +29,7 @@ CREATE TABLE llx_menu ...@@ -29,7 +29,7 @@ CREATE TABLE llx_menu
module varchar(64), -- Module name if record is added by a module module varchar(64), -- Module name if record is added by a module
type varchar(4) NOT NULL, -- Menu top or left type varchar(4) NOT NULL, -- Menu top or left
mainmenu varchar(100) NOT NULL, -- Name family/module (home, companies, ...) mainmenu varchar(100) NOT NULL, -- Name family/module (home, companies, ...)
fk_menu int(11) NOT NULL, -- 0 or Id of mother menu line fk_menu integer NOT NULL, -- 0 or Id of mother menu line
position integer NOT NULL, -- Sort order of entry position integer NOT NULL, -- Sort order of entry
url varchar(255) NOT NULL, -- Relative (or absolute) url to go url varchar(255) NOT NULL, -- Relative (or absolute) url to go
target varchar(100) NULL, -- Target of Url link target varchar(100) NULL, -- Target of Url link
...@@ -39,7 +39,7 @@ CREATE TABLE llx_menu ...@@ -39,7 +39,7 @@ CREATE TABLE llx_menu
leftmenu varchar(1) NULL default '1', -- Say if left menu defined in pre.inc.php and used by top menu must be overwritten by dynamic databse menu (1=yes by default) leftmenu varchar(1) NULL default '1', -- Say if left menu defined in pre.inc.php and used by top menu must be overwritten by dynamic databse menu (1=yes by default)
perms varchar(255), -- Condition to show enabled or disabled perms varchar(255), -- Condition to show enabled or disabled
enabled varchar(255) NULL default '1', -- Condition to show or hide enabled varchar(255) NULL default '1', -- Condition to show or hide
user integer NOT NULL default '0', -- 0 if menu for all users, 1 for external only, 2 for internal only usertype integer NOT NULL default '0', -- 0 if menu for all users, 1 for external only, 2 for internal only
tms timestamp tms timestamp
) type=innodb; ) type=innodb;
......
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Marc Barilley / Ocbo <marc@ocebo.com> -- Copyright (C) 2005 Marc Barilley / Ocbo <marc@ocebo.com>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
create table llx_paiementfourn_facturefourn create table llx_paiementfourn_facturefourn
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_paiementfourn INT(11) DEFAULT NULL, fk_paiementfourn INTEGER DEFAULT NULL,
fk_facturefourn INT(11) DEFAULT NULL, fk_facturefourn INTEGER DEFAULT NULL,
amount DOUBLE DEFAULT '0' amount DOUBLE DEFAULT '0'
) TYPE=innodb; ) TYPE=innodb;
\ No newline at end of file
...@@ -22,7 +22,7 @@ CREATE TABLE llx_surveys_answers ( ...@@ -22,7 +22,7 @@ CREATE TABLE llx_surveys_answers (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_question integer NOT NULL, fk_question integer NOT NULL,
ip_adresse varchar(15) NOT NULL default '', ip_adresse varchar(15) NOT NULL default '',
datec date NOT NULL default '0000-00-00', datec date NOT NULL,
rep1 decimal(6,0) default NULL, rep1 decimal(6,0) default NULL,
rep2 decimal(6,0) default NULL, rep2 decimal(6,0) default NULL,
rep3 decimal(6,0) default NULL, rep3 decimal(6,0) default NULL,
......
...@@ -236,7 +236,8 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"])) ...@@ -236,7 +236,8 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"]))
// Les contraintes indesirables ont un nom qui commence par 0_ ou se termine par ibfk_999 // Les contraintes indesirables ont un nom qui commence par 0_ ou se termine par ibfk_999
$listtables=array( 'llx_adherent_options', $listtables=array( 'llx_adherent_options',
'llx_bank_class', 'llx_bank_class',
'llx_c_ecotaxe'); 'llx_c_ecotaxe',
'llx_c_methode_commande_fournisseur');
$listtables = $db->DDLListTables($conf->db->name,''); $listtables = $db->DDLListTables($conf->db->name,'');
foreach ($listtables as $val) foreach ($listtables as $val)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment