Fix regression introduced with task comments

This commit is contained in:
Laurent Destailleur 2017-12-15 20:07:35 +01:00
parent db91a88c59
commit 929893bd49
5 changed files with 21 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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