From 4847e946a4c75632c4be4db5fe513807e9797747 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Sep 2012 16:20:34 +0200 Subject: [PATCH] Fix: Use varchar instead of char (for better compatibility, char is an old directive) Fix: Restore usage of text field for "enabled" menu because, even if in standard code, we use 0 or 1, into external module, or menu editor we should be able to use full condition dynamic string. --- htdocs/admin/menus/edit.php | 13 +++------- .../install/mysql/migration/3.2.0-3.3.0.sql | 26 +++++++++---------- htdocs/install/mysql/tables/llx_c_tva.sql | 4 +-- .../tables/llx_commande_fournisseurdet.sql | 4 +-- .../install/mysql/tables/llx_commandedet.sql | 4 +-- htdocs/install/mysql/tables/llx_document.sql | 3 +-- .../mysql/tables/llx_facture_fourn_det.sql | 4 +-- .../install/mysql/tables/llx_facturedet.sql | 4 +-- htdocs/install/mysql/tables/llx_menu.sql | 2 +- htdocs/install/mysql/tables/llx_propaldet.sql | 4 +-- 10 files changed, 29 insertions(+), 39 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index d0619ec80de..c859e80e553 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -2,7 +2,6 @@ /* Copyright (C) 2007 Patrick Raguin * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2009-2011 Regis Houssin - * Copyright (C) 2012 Marcos GarcĂ­a * * 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 @@ -165,7 +164,7 @@ if ($action == 'add') $menu->url=$_POST['url']; $menu->langs=$_POST['langs']; $menu->position=$_POST['position']; - $menu->enabled=(int)$_POST['enabled']; + $menu->enabled=$_POST['enabled']; $menu->perms=$_POST['perms']; $menu->target=$_POST['target']; $menu->user=$_POST['user']; @@ -335,10 +334,7 @@ if ($action == 'create') print ''.$langs->trans('DetailTarget').''; // Enabled - print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').''; + print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').''; // Perms print ''.$langs->trans('Rights').''.$langs->trans('DetailRight').''; @@ -418,10 +414,7 @@ elseif ($action == 'edit') print ''.$langs->trans('DetailTarget').''; // Enabled - print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').''; + print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').''; // Perms print ''.$langs->trans('Rights').''.$langs->trans('DetailRight').''; diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 2147b0d1959..a79bfe48ea2 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -188,23 +188,21 @@ ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (entity, box_id, position, fk_us UPDATE llx_boxes as b SET b.entity = (SELECT bd.entity FROM llx_boxes_def as bd WHERE bd.rowid = b.box_id); -- TASK #204 -alter table llx_c_tva add column localtax1_type char(1) default '0' after localtax1; -alter table llx_c_tva add column localtax2_type char(1) default '0' after localtax2; +alter table llx_c_tva add column localtax1_type varchar(1) default '0' after localtax1; +alter table llx_c_tva add column localtax2_type varchar(1) default '0' after localtax2; -alter table llx_commande_fournisseurdet add column localtax1_type char(1) after localtax1_tx; -alter table llx_commande_fournisseurdet add column localtax2_type char(1) after localtax2_tx; +alter table llx_commande_fournisseurdet add column localtax1_type varchar(1) after localtax1_tx; +alter table llx_commande_fournisseurdet add column localtax2_type varchar(1) after localtax2_tx; -alter table llx_commandedet add column localtax1_type char(1) after localtax1_tx; -alter table llx_commandedet add column localtax2_type char(1) after localtax2_tx; +alter table llx_commandedet add column localtax1_type varchar(1) after localtax1_tx; +alter table llx_commandedet add column localtax2_type varchar(1) after localtax2_tx; -alter table llx_facture_fourn_det add column localtax1_type char(1) after localtax1_tx; -alter table llx_facture_fourn_det add column localtax2_type char(1) after localtax2_tx; +alter table llx_facture_fourn_det add column localtax1_type varchar(1) after localtax1_tx; +alter table llx_facture_fourn_det add column localtax2_type varchar(1) after localtax2_tx; -alter table llx_facturedet add column localtax1_type char(1) after localtax1_tx; -alter table llx_facturedet add column localtax2_type char(1) after localtax2_tx; +alter table llx_facturedet add column localtax1_type varchar(1) after localtax1_tx; +alter table llx_facturedet add column localtax2_type varchar(1) after localtax2_tx; -alter table llx_propaldet add column localtax1_type char(1) after localtax1_tx; -alter table llx_propaldet add column localtax2_type char(1) after localtax2_tx; +alter table llx_propaldet add column localtax1_type varchar(1) after localtax1_tx; +alter table llx_propaldet add column localtax2_type varchar(1) after localtax2_tx; -- END TASK #204 - -ALTER TABLE llx_menu MODIFY COLUMN enabled TINYINT(1) UNSIGNED NULL DEFAULT '1'; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_c_tva.sql b/htdocs/install/mysql/tables/llx_c_tva.sql index 85fe4bdd34c..9c289ebb811 100644 --- a/htdocs/install/mysql/tables/llx_c_tva.sql +++ b/htdocs/install/mysql/tables/llx_c_tva.sql @@ -23,9 +23,9 @@ create table llx_c_tva fk_pays integer NOT NULL, taux double NOT NULL, localtax1 double NOT NULL DEFAULT 0, - localtax1_type char(1) NOT NULL DEFAULT '0', + localtax1_type varchar(1) NOT NULL DEFAULT '0', localtax2 double NOT NULL DEFAULT 0, - localtax2_type char(1) NOT NULL DEFAULT '0', + localtax2_type varchar(1) NOT NULL DEFAULT '0', recuperableonly integer NOT NULL DEFAULT 0, note varchar(128), active tinyint DEFAULT 1 NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql index 532e0a1b3fd..6c4ecd15798 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql @@ -28,9 +28,9 @@ create table llx_commande_fournisseurdet description text, tva_tx double(6,3) DEFAULT 0, -- taux tva localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate - localtax1_type char(1) NULL, -- localtax1 type + localtax1_type varchar(1) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate - localtax2_type char(1) NULL, -- localtax2 type + localtax2_type varchar(1) NULL, -- localtax2 type qty real, -- quantity remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise diff --git a/htdocs/install/mysql/tables/llx_commandedet.sql b/htdocs/install/mysql/tables/llx_commandedet.sql index c14d1ed01b4..38138f54a3e 100644 --- a/htdocs/install/mysql/tables/llx_commandedet.sql +++ b/htdocs/install/mysql/tables/llx_commandedet.sql @@ -29,9 +29,9 @@ create table llx_commandedet description text, tva_tx double(6,3), -- vat rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate - localtax1_type char(1) NULL, -- localtax1 type + localtax1_type varchar(1) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate - localtax2_type char(1) NULL, -- localtax2 type + localtax2_type varchar(1) NULL, -- localtax2 type qty real, -- quantity remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise diff --git a/htdocs/install/mysql/tables/llx_document.sql b/htdocs/install/mysql/tables/llx_document.sql index 4f1d5d5b292..0dc9cc376ec 100644 --- a/htdocs/install/mysql/tables/llx_document.sql +++ b/htdocs/install/mysql/tables/llx_document.sql @@ -25,6 +25,5 @@ create table llx_document date_generation datetime NULL, fk_owner integer NULL, fk_group integer NULL, - permissions char(9) DEFAULT 'rw-rw-rw' - + permissions varchar(9) DEFAULT 'rw-rw-rw' )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 58c9b14ee0c..f1f105fbd75 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -31,9 +31,9 @@ create table llx_facture_fourn_det qty real, -- quantity of product/service tva_tx double(6,3), -- TVA taux product/service localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate - localtax1_type char(1) NULL, -- localtax1 type + localtax1_type varchar(1) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate - localtax2_type char(1) NULL, -- localtax2 type + localtax2_type varchar(1) NULL, -- localtax2 type total_ht double(24,8), -- Total line price of product excluding tax tva double(24,8), -- Total TVA of line total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 4abfbe83d6b..4dd8ba15a39 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -30,9 +30,9 @@ create table llx_facturedet description text, tva_tx double(6,3), -- Taux tva produit/service (exemple 19.6) localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate - localtax1_type char(1) NULL, -- localtax1 type + localtax1_type varchar(1) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate - localtax2_type char(1) NULL, -- localtax2 type + localtax2_type varchar(1) NULL, -- localtax2 type qty real, -- Quantity (exemple 2) remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20) diff --git a/htdocs/install/mysql/tables/llx_menu.sql b/htdocs/install/mysql/tables/llx_menu.sql index c92bdb0809d..d611291042c 100644 --- a/htdocs/install/mysql/tables/llx_menu.sql +++ b/htdocs/install/mysql/tables/llx_menu.sql @@ -39,7 +39,7 @@ CREATE TABLE llx_menu langs varchar(100), -- Lang file to load for translation level smallint, -- Deprecated. Not used. perms varchar(255), -- Condition to show enabled or disabled - enabled tinyint(1) UNSIGNED NULL DEFAULT 1, -- Condition to show or hide + enabled varchar(255) NULL default '1', -- Condition to show or hide usertype integer NOT NULL DEFAULT 0, -- 0 if menu for all users, 1 for external only, 2 for internal only tms timestamp diff --git a/htdocs/install/mysql/tables/llx_propaldet.sql b/htdocs/install/mysql/tables/llx_propaldet.sql index 3b2deef6bb3..fb438a53830 100644 --- a/htdocs/install/mysql/tables/llx_propaldet.sql +++ b/htdocs/install/mysql/tables/llx_propaldet.sql @@ -29,9 +29,9 @@ create table llx_propaldet fk_remise_except integer NULL, -- Lien vers table des remises fixes tva_tx double(6,3) DEFAULT 0, -- taux tva localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate - localtax1_type char(1) NULL, -- localtax1 type + localtax1_type varchar(1) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate - localtax2_type char(1) NULL, -- localtax2 type + localtax2_type varchar(1) NULL, -- localtax2 type qty real, -- quantity remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise (obsolete)