diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 7c9b0f3326e..bf49e8730fb 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -452,17 +452,19 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10); -CREATE TABLE llx_projet_task_comment ( +DROP TABLE llx_projet_task_comment; + +CREATE TABLE llx_comment ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, tms timestamp, description text NOT NULL, - fk_user integer DEFAULT NULL, - fk_task integer DEFAULT NULL, + fk_user_author integer DEFAULT NULL, + fk_element integer DEFAULT NULL, + element_type varchar(50) DEFAULT NULL, entity integer DEFAULT 1, import_key varchar(125) DEFAULT NULL -) ENGINE=innodb; - +)ENGINE=innodb; DELETE FROM llx_const where name = __ENCRYPT('MAIN_SHOW_WORKBOARD')__; diff --git a/htdocs/install/mysql/tables/llx_projet_task_comment.sql b/htdocs/install/mysql/tables/llx_comment.sql similarity index 86% rename from htdocs/install/mysql/tables/llx_projet_task_comment.sql rename to htdocs/install/mysql/tables/llx_comment.sql index 561f8276455..df5f41ba91b 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_comment.sql +++ b/htdocs/install/mysql/tables/llx_comment.sql @@ -16,13 +16,15 @@ -- -- =========================================================================== -CREATE TABLE llx_projet_task_comment ( +CREATE TABLE llx_comment ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime DEFAULT NULL, tms timestamp, description text NOT NULL, - fk_user integer DEFAULT NULL, - fk_task integer DEFAULT NULL, + fk_user_author integer DEFAULT NULL, + fk_element integer DEFAULT NULL, + element_type varchar(50) DEFAULT NULL, entity integer DEFAULT 1, import_key varchar(125) DEFAULT NULL -) ENGINE=innodb; +)ENGINE=innodb; + diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index da754176386..7a42e77c644 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -388,6 +388,8 @@ class Project extends CommonObject */ function fetch($id, $ref='') { + global $conf; + if (empty($id) && empty($ref)) return -1; $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; @@ -443,7 +445,11 @@ class Project extends CommonObject // Retreive all extrafield for thirdparty $this->fetch_optionals(); - $this->fetchComments(); + + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) + { + $this->fetchComments(); + } return 1; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 25da5bb2e3e..14f3c7e37d4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -35,7 +35,7 @@ class Task extends CommonObject public $table_element='projet_task'; //!< Name of table without prefix where object is stored public $fk_element='fk_task'; public $picto = 'task'; - protected $childtables=array('projet_task_time','projet_task_comment'); // To test if we can delete object + protected $childtables=array('projet_task_time'); // To test if we can delete object var $fk_task_parent; var $label; diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 4e3d52a2f37..a51d4872c80 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -55,7 +55,6 @@ if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projectcard','globalcard')); -$object = new Project($db); $extrafields = new ExtraFields($db); $object = new Project($db);