diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 0930f7dfa94..6c49a1c2143 100755 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -1,7 +1,18 @@ +/* Copyright (C) 2013 Laurent Destailleur * - * Licensed under the GNU GPL v3 or higher (See file gpl-3.0.html) + * 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 3 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 . */ /** @@ -184,10 +195,11 @@ class modOpenSurvey extends DolibarrModules */ function init($options='') { + // Permissions + $this->remove($options); + $sql = array(); - $result=$this->load_tables(); - return $this->_init($sql,$options); } @@ -205,20 +217,6 @@ class modOpenSurvey extends DolibarrModules return $this->_remove($sql,$options); } - - - /** - * Create tables and keys required by module - * Files mymodule.sql and mymodule.key.sql with create table and create keys - * commands must be stored in directory /mymodule/sql/ - * This function is called by this->init. - * - * @return int <=0 if KO, >0 if OK - */ - function load_tables() - { - return $this->_load_tables('/opensurvey/sql/'); - } } ?> diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index b8542349f5f..957dadf2845 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -306,3 +306,44 @@ create table llx_projet_task_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; ALTER TABLE llx_projet_task_extrafields ADD INDEX idx_projet_task_extrafields (fk_object); + + +CREATE TABLE llx_opensurvey_comments ( + id_comment INTEGER unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, + id_sondage CHAR(16) NOT NULL, + comment text NOT NULL, + tms timestamp, + usercomment text +) ENGINE=InnoDB; + +CREATE TABLE llx_opensurvey_sondage ( + id_sondage VARCHAR(16) PRIMARY KEY, + id_sondage_admin CHAR(24), + commentaires text, + mail_admin VARCHAR(128), + nom_admin VARCHAR(64), + titre text, + date_fin datetime, + format VARCHAR(2), + mailsonde varchar(2) DEFAULT '0', + survey_link_visible integer DEFAULT 1, + canedit integer DEFAULT 0, + origin varchar(64), + tms timestamp, + sujet TEXT +) ENGINE=InnoDB; +CREATE TABLE llx_opensurvey_user_studs ( + id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + nom VARCHAR(64) NOT NULL, + id_sondage VARCHAR(16) NOT NULL, + reponses VARCHAR(100) NOT NULL, + tms timestamp +) ENGINE=InnoDB; + +ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_comment (id_comment); +ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage (id_sondage); +ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin (id_sondage_admin); +ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin (date_fin); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_users (id_users); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom); +ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage); diff --git a/htdocs/opensurvey/sql/llx_opensurvey_comments.key.sql b/htdocs/opensurvey/sql/llx_opensurvey_comments.key.sql deleted file mode 100755 index 3f7460f3e8a..00000000000 --- a/htdocs/opensurvey/sql/llx_opensurvey_comments.key.sql +++ /dev/null @@ -1,22 +0,0 @@ --- ============================================================================ --- Copyright (C) 2013 Laurent Destailleur --- --- 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 3 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_opensurvey_comments ADD INDEX idx_id_comment id_comment; -ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage id_sondage; - - - diff --git a/htdocs/opensurvey/sql/llx_opensurvey_comments.sql b/htdocs/opensurvey/sql/llx_opensurvey_comments.sql deleted file mode 100755 index 613627c46aa..00000000000 --- a/htdocs/opensurvey/sql/llx_opensurvey_comments.sql +++ /dev/null @@ -1,25 +0,0 @@ --- ============================================================================ --- Copyright (C) 2013 Laurent Destailleur --- --- 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 3 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_opensurvey_comments ( - id_comment INTEGER unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, - id_sondage CHAR(16) NOT NULL, - comment text NOT NULL, - tms timestamp, - usercomment text -) ENGINE=InnoDB; - diff --git a/htdocs/opensurvey/sql/llx_opensurvey_sondage.key.sql b/htdocs/opensurvey/sql/llx_opensurvey_sondage.key.sql deleted file mode 100755 index 377f8abc45e..00000000000 --- a/htdocs/opensurvey/sql/llx_opensurvey_sondage.key.sql +++ /dev/null @@ -1,19 +0,0 @@ --- ============================================================================ --- Copyright (C) 2013 Laurent Destailleur --- --- 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 3 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_opensurvey_sondage ADD INDEX idx_id_sondage_admin id_sondage_admin; -ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin date_fin; diff --git a/htdocs/opensurvey/sql/llx_opensurvey_sondage.sql b/htdocs/opensurvey/sql/llx_opensurvey_sondage.sql deleted file mode 100755 index 1704938a6f7..00000000000 --- a/htdocs/opensurvey/sql/llx_opensurvey_sondage.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ============================================================================ --- Copyright (C) 2013 Laurent Destailleur --- --- 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 3 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_opensurvey_sondage ( - id_sondage VARCHAR(16) PRIMARY KEY, - id_sondage_admin CHAR(24), - commentaires text, - mail_admin VARCHAR(128), - nom_admin VARCHAR(64), - titre text, - date_fin datetime, - format VARCHAR(2), - mailsonde varchar(2) DEFAULT '0', - survey_link_visible integer DEFAULT 1, - canedit integer DEFAULT 0, - origin varchar(64), - tms timestamp, - sujet TEXT -) ENGINE=InnoDB; diff --git a/htdocs/opensurvey/sql/llx_opensurvey_user_studs.key.sql b/htdocs/opensurvey/sql/llx_opensurvey_user_studs.key.sql deleted file mode 100755 index 041b2d0593d..00000000000 --- a/htdocs/opensurvey/sql/llx_opensurvey_user_studs.key.sql +++ /dev/null @@ -1,20 +0,0 @@ --- ============================================================================ --- Copyright (C) 2013 Laurent Destailleur --- --- 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 3 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_opensurvey_user_studs ADD INDEX idx_id_users (id_users); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom); -ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage); diff --git a/htdocs/opensurvey/sql/llx_opensurvey_user_studs.sql b/htdocs/opensurvey/sql/llx_opensurvey_user_studs.sql deleted file mode 100755 index 78d7fa69c4d..00000000000 --- a/htdocs/opensurvey/sql/llx_opensurvey_user_studs.sql +++ /dev/null @@ -1,24 +0,0 @@ --- ============================================================================ --- Copyright (C) 2013 Laurent Destailleur --- --- 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 3 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_opensurvey_user_studs ( - id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - nom VARCHAR(64) NOT NULL, - id_sondage VARCHAR(16) NOT NULL, - reponses VARCHAR(100) NOT NULL, - tms timestamp -) ENGINE=InnoDB;