diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index a684be57701..f42444a986c 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -20,13 +20,11 @@ * \file htdocs/ecm/class/ecmdirectory.class.php * \ingroup ecm * \brief This file is an example for a class file - * \author Laurent Destailleur */ /** * \class EcmDirectory * \brief Class to manage ECM directories - * \remarks Initialy built by build_class_from_table on 2008-02-24 19:24 */ class EcmDirectory // extends CommonObject { diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 30a90e1c26d..5cf1deb331b 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -124,7 +124,7 @@ if ($action == 'add' && $user->rights->ecm->setup) } // Suppression fichier -if ($action == 'confirm_deletesection' && $confirm == 'yes') +else if ($action == 'confirm_deletesection' && $confirm == 'yes') { $result=$ecmdir->delete($user); setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label)); 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 001c21dad2f..f9ad48af159 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 @@ -7,7 +7,7 @@ -- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; --- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60); +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); -- To restrict request to Mysql version x.y use -- VMYSQLx.y -- To restrict request to Pgsql version x.y use -- VPGSQLx.y @@ -43,8 +43,8 @@ ALTER TABLE llx_mailing MODIFY COLUMN body mediumtext; ALTER TABLE llx_mailing ADD COLUMN extraparams varchar(255); -ALTER TABLE llx_product MODIFY ref varchar(128) NOT NULL; -ALTER TABLE llx_product MODIFY ref_ext varchar(128); +ALTER TABLE llx_product MODIFY COLUMN ref varchar(128) NOT NULL; +ALTER TABLE llx_product MODIFY COLUMN ref_ext varchar(128); ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur; ALTER TABLE llx_product_fournisseur_price ADD charges DOUBLE( 24, 8 ) DEFAULT 0 AFTER unitprice; @@ -64,9 +64,9 @@ alter table llx_propaldet drop column pa_ht; alter table llx_propaldet drop column marge_tx; alter table llx_propaldet drop column marque_tx; -ALTER TABLE llx_commande CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; -ALTER TABLE llx_propal CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; -ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0; +ALTER TABLE llx_commande CHANGE COLUMN fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; +ALTER TABLE llx_propal CHANGE COLUMN fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; +ALTER TABLE llx_commande_fournisseur CHANGE COLUMN fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0; INSERT INTO llx_const (name, value, type, note, visible) values ('PRODUCT_CODEPRODUCT_ADDON','mod_codeproduct_leopard','yesno','Module to control product codes',0); @@ -85,3 +85,41 @@ ALTER TABLE llx_accountingaccount ADD COLUMN active tinyint DEFAULT 1 NOT NULL ALTER TABLE llx_actioncomm MODIFY elementtype VARCHAR(32); +-- TASK #107 +ALTER TABLE llx_ecm_directories MODIFY COLUMN label varchar(64) NOT NULL; +ALTER TABLE llx_ecm_directories ADD COLUMN acl text; +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c); +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m); +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_c FOREIGN KEY (fk_user_c) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_m FOREIGN KEY (fk_user_m) REFERENCES llx_user (rowid); + +ALTER TABLE llx_ecm_documents DROP INDEX idx_ecm_documents; +ALTER TABLE llx_ecm_documents DROP COLUMN manualkeyword; +ALTER TABLE llx_ecm_documents DROP COLUMN fullpath_orig; +ALTER TABLE llx_ecm_documents DROP COLUMN private; +ALTER TABLE llx_ecm_documents DROP COLUMN crc; +ALTER TABLE llx_ecm_documents DROP COLUMN cryptkey; +ALTER TABLE llx_ecm_documents DROP COLUMN cipher; +ALTER TABLE llx_ecm_documents CHANGE COLUMN fullpath_dol fullpath varchar(255) NOT NULL; +ALTER TABLE llx_ecm_documents MODIFY COLUMN filemime varchar(128) NOT NULL; +ALTER TABLE llx_ecm_documents ADD COLUMN metadata text after description; +ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_directory FOREIGN KEY (fk_directory) REFERENCES llx_ecm_directories (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_create FOREIGN KEY (fk_create) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_update FOREIGN KEY (fk_update) REFERENCES llx_user (rowid); + +create table llx_element_tag +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + lang varchar(5) NOT NULL, + tag varchar(255) NOT NULL, + fk_element integer NOT NULL, + element varchar(64) NOT NULL + +)ENGINE=innodb; + +ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element); +-- END TASK #107 diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.key.sql b/htdocs/install/mysql/tables/llx_ecm_directories.key.sql index 8423185a73d..bd474c4d52a 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories.key.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ --- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- 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 @@ -18,4 +19,8 @@ ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX idx_ecm_directories (label, fk_parent, entity); - \ No newline at end of file +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c); +ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m); + +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_c FOREIGN KEY (fk_user_c) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_directories ADD CONSTRAINT fk_ecm_directories_fk_user_m FOREIGN KEY (fk_user_m) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.sql b/htdocs/install/mysql/tables/llx_ecm_directories.sql index 3ea75bcbea1..ea4da6e4a36 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2008 Laurent Destailleur --- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2008-2012 Laurent Destailleur +-- Copyright (C) 2009-2012 Regis Houssin -- -- 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 @@ -21,14 +21,16 @@ create table llx_ecm_directories ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - label varchar(32) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - fk_parent integer, - description varchar(255) NOT NULL, - cachenbofdoc integer NOT NULL DEFAULT 0, - date_c datetime, - date_m timestamp, - fk_user_c integer, - fk_user_m integer + rowid integer AUTO_INCREMENT PRIMARY KEY, + label varchar(64) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_parent integer, + description varchar(255) NOT NULL, + cachenbofdoc integer NOT NULL DEFAULT 0, + date_c datetime, + date_m timestamp, + fk_user_c integer, + fk_user_m integer, + acl text + ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ecm_documents.key.sql b/htdocs/install/mysql/tables/llx_ecm_documents.key.sql index 79475d499ed..a29292dea1c 100644 --- a/htdocs/install/mysql/tables/llx_ecm_documents.key.sql +++ b/htdocs/install/mysql/tables/llx_ecm_documents.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ --- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2012 Regis Houssin -- -- 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 @@ -17,5 +18,11 @@ -- ============================================================================ -ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents (fullpath_dol); +ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create); +ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update); + +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_directory FOREIGN KEY (fk_directory) REFERENCES llx_ecm_directories (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_create FOREIGN KEY (fk_create) REFERENCES llx_user (rowid); +ALTER TABLE llx_ecm_documents ADD CONSTRAINT fk_ecm_documents_fk_update FOREIGN KEY (fk_update) REFERENCES llx_user (rowid); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_ecm_documents.sql b/htdocs/install/mysql/tables/llx_ecm_documents.sql index 860b44e25bd..876262dcb7c 100644 --- a/htdocs/install/mysql/tables/llx_ecm_documents.sql +++ b/htdocs/install/mysql/tables/llx_ecm_documents.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2008 Laurent Destailleur --- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2008-2012 Laurent Destailleur +-- Copyright (C) 2009-2012 Regis Houssin -- -- 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 @@ -20,24 +20,20 @@ create table llx_ecm_documents ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(16) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - filename varchar(255) NOT NULL, - filesize integer NOT NULL, - filemime varchar(32) NOT NULL, - fullpath_dol varchar(255) NOT NULL, - fullpath_orig varchar(255) NOT NULL, - description text, - manualkeyword text, - fk_create integer NOT NULL, - fk_update integer, - date_c datetime NOT NULL, - date_u timestamp, - fk_directory integer, - fk_status smallint DEFAULT 0, - private smallint DEFAULT 0, - crc varchar(32) NOT NULL DEFAULT '', -- checksum - cryptkey varchar(50) NOT NULL DEFAULT '', -- crypt key - cipher varchar(50) NOT NULL DEFAULT 'twofish' -- crypt cipher + rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(16) NOT NULL, + entity integer DEFAULT 1 NOT NULL, + filename varchar(255) NOT NULL, + filesize integer NOT NULL, + filemime varchar(128) NOT NULL, + description text, + metadata text, + fullpath varchar(255) NOT NULL, + fk_directory integer, + fk_create integer NOT NULL, + fk_update integer, + date_c datetime NOT NULL, + date_u timestamp, + fk_status smallint DEFAULT 0 + ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql new file mode 100644 index 00000000000..6d798826e7a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql @@ -0,0 +1,20 @@ +-- ============================================================================ +-- Copyright (C) 2012 Regis Houssin +-- +-- 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, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag, fk_element, element); diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql new file mode 100644 index 00000000000..4752b12e200 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.sql @@ -0,0 +1,29 @@ +-- ============================================================================ +-- Copyright (C) 2012 Regis Houssin +-- +-- 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, see . +-- +-- =========================================================================== + +create table llx_element_tag +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + lang varchar(5) NOT NULL, + tag varchar(255) NOT NULL, + fk_element integer NOT NULL, + element varchar(64) NOT NULL + +)ENGINE=innodb; + diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 41f0b6099f6..1ee92b5444d 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -383,4 +383,4 @@ if ($db->connected) $db->close(); // Return code if ran from command line if ($ret) exit($ret); -?> +?> \ No newline at end of file