New data struture for references field in ticket

This commit is contained in:
Hystepik
2024-03-18 15:11:50 +01:00
parent 7b0aacc239
commit d82729e49d
3 changed files with 16 additions and 1 deletions

View File

@@ -242,6 +242,7 @@ ALTER TABLE llx_ticket ADD COLUMN model_pdf varchar(255);
ALTER TABLE llx_ticket ADD COLUMN last_main_doc varchar(255);
ALTER TABLE llx_ticket ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_ticket ADD COLUMN origin_replyto varchar(128);
ALTER TABLE llx_ticket ADD COLUMN origin_references mediumtext;
ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL;
ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL;

View File

@@ -26,6 +26,7 @@ CREATE TABLE llx_ticket
fk_contract integer DEFAULT 0,
origin_email varchar(128),
origin_replyto varchar(128),
origin_references mediumtext,
fk_user_create integer,
fk_user_assign integer,
subject varchar(255),

View File

@@ -193,6 +193,11 @@ class Ticket extends CommonObject
*/
public $origin_replyto;
/**
* References from origin email
*/
public $origin_references;
/**
* @var int Creation date
*/
@@ -327,7 +332,8 @@ class Ticket extends CommonObject
'fk_user_create' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Author', 'visible' => 1, 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'csslist' => 'tdoverflowmax100 maxwidth150onsmartphone'),
'origin_email' => array('type' => 'mail', 'label' => 'OriginEmail', 'visible' => -2, 'enabled' => 1, 'position' => 16, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'csslist' => 'tdoverflowmax150'),
'origin_replyto' => array('type' => 'mail', 'label' => 'EmailReplyto', 'visible' => -2, 'enabled' => 1, 'position' => 17, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Email to reply to", 'csslist' => 'tdoverflowmax150'),
'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 18, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1),
'origin_references' => array('type' => 'mediumtext', 'label' => 'EmailReferences', 'visible' => -2, 'enabled' => 1, 'position' => 18, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "References from origin email", 'csslist' => 'tdoverflowmax150'),
'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 1, 'enabled' => 1, 'position' => 19, 'notnull' => -1, 'searchall' => 1, 'help' => "", 'css' => 'maxwidth200 tdoverflowmax200', 'autofocusoncreate' => 1),
'type_code' => array('type' => 'varchar(32)', 'label' => 'Type', 'visible' => 1, 'enabled' => 1, 'position' => 20, 'notnull' => -1, 'help' => "", 'csslist' => 'maxwidth125 tdoverflowmax50'),
'category_code' => array('type' => 'varchar(32)', 'label' => 'TicketCategory', 'visible' => -1, 'enabled' => 1, 'position' => 21, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100 tdoverflowmax200'),
'severity_code' => array('type' => 'varchar(32)', 'label' => 'Severity', 'visible' => 1, 'enabled' => 1, 'position' => 22, 'notnull' => -1, 'help' => "", 'css' => 'maxwidth100'),
@@ -518,6 +524,7 @@ class Ticket extends CommonObject
$sql .= "fk_contract,";
$sql .= "origin_email,";
$sql .= "origin_replyto,";
$sql .= "origin_references,";
$sql .= "fk_user_create,";
$sql .= "fk_user_assign,";
$sql .= "email_msgid,";
@@ -546,6 +553,7 @@ class Ticket extends CommonObject
$sql .= " ".($this->fk_contract > 0 ? $this->db->escape($this->fk_contract) : "null").",";
$sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").",";
$sql .= " ".(!isset($this->origin_replyto) ? 'NULL' : "'".$this->db->escape($this->origin_replyto)."'").",";
$sql .= " ".(!isset($this->origin_references) ? 'NULL' : "'".$this->db->escape($this->origin_references)."'").",";
$sql .= " ".(!isset($this->fk_user_create) ? ($user->id > 0 ? $user->id : 'NULL') : ($this->fk_user_create > 0 ? $this->fk_user_create : 'NULL')).",";
$sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').",";
$sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").",";
@@ -672,6 +680,7 @@ class Ticket extends CommonObject
$sql .= " t.fk_contract,";
$sql .= " t.origin_email,";
$sql .= " t.origin_replyto,";
$sql .= " t.origin_references,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_assign,";
$sql .= " t.email_msgid,";
@@ -728,6 +737,7 @@ class Ticket extends CommonObject
$this->fk_contract = $obj->fk_contract;
$this->origin_email = $obj->origin_email;
$this->origin_replyto = $obj->origin_replyto;
$this->origin_references = $obj->origin_references;
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_assign = $obj->fk_user_assign;
$this->email_msgid = $obj->email_msgid;
@@ -808,6 +818,7 @@ class Ticket extends CommonObject
$sql .= " t.fk_contract,";
$sql .= " t.origin_email,";
$sql .= " t.origin_replyto,";
$sql .= " t.origin_references,";
$sql .= " t.fk_user_create, uc.lastname as user_create_lastname, uc.firstname as user_create_firstname,";
$sql .= " t.fk_user_assign, ua.lastname as user_assign_lastname, ua.firstname as user_assign_firstname,";
$sql .= " t.subject,";
@@ -926,6 +937,7 @@ class Ticket extends CommonObject
$line->fk_contract = $obj->fk_contract;
$line->origin_email = $obj->origin_email;
$line->origin_replyto = $obj->origin_replyto;
$line->origin_references = $obj->origin_references;
$line->fk_user_create = $obj->fk_user_create;
$line->fk_user_assign = $obj->fk_user_assign;
@@ -1079,6 +1091,7 @@ class Ticket extends CommonObject
$sql .= " fk_contract=".(isset($this->fk_contract) ? (int) $this->fk_contract : "null").",";
$sql .= " origin_email=".(isset($this->origin_email) ? "'".$this->db->escape($this->origin_email)."'" : "null").",";
$sql .= " origin_replyto=".(isset($this->origin_replyto) ? "'".$this->db->escape($this->origin_replyto)."'" : "null").",";
$sql .= " origin_references=".(isset($this->origin_references) ? "'".$this->db->escape($this->origin_references)."'" : "null").",";
$sql .= " fk_user_create=".(isset($this->fk_user_create) ? (int) $this->fk_user_create : "null").",";
$sql .= " fk_user_assign=".(isset($this->fk_user_assign) ? (int) $this->fk_user_assign : "null").",";
$sql .= " subject=".(isset($this->subject) ? "'".$this->db->escape($this->subject)."'" : "null").",";