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.
This commit is contained in:
Laurent Destailleur 2012-09-10 16:20:34 +02:00
parent 09d3d0a37d
commit 4847e946a4
10 changed files with 29 additions and 39 deletions

View File

@ -2,7 +2,6 @@
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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 '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><select class="flat" name="enabled">
<option value="0"'.(isset($_POST['enabled']) ? ($_POST['enabled'] == 0 ? 'selected="true"' : '') : 'selected="true"').'>'.$langs->trans('No').'</option>
<option value="1"'.(isset($_POST['enabled']) && ($_POST['enabled'] == 1) ? 'selected="true"' : '').'>'.$langs->trans('Yes').'</option>
</select></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.$_POST["enabled"].'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
// Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.$_POST["perms"].'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
@ -418,10 +414,7 @@ elseif ($action == 'edit')
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><select class="flat" name="enabled">
<option value="0"'.($menu->enabled == 0 ? 'selected="true"' : '').'>'.$langs->trans('No').'</option>
<option value="1"'.($menu->enabled == 1 ? 'selected="true"' : '').'>'.$langs->trans('Yes').'</option>
</select></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.$menu->enabled.'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
// Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.$menu->perms.'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';

View File

@ -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';

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)