Add email_date for job applications and tickets

This commit is contained in:
Laurent Destailleur 2022-08-02 20:37:42 +02:00
parent 528d54ba79
commit 3f5b3020b0
6 changed files with 29 additions and 8 deletions

View File

@ -1855,8 +1855,8 @@ class EmailCollector extends CommonObject
$actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
$actioncomm->note_private = $descriptionfull;
$actioncomm->fk_project = $projectstatic->id;
$actioncomm->datep = $date;
$actioncomm->datef = $date;
$actioncomm->datep = $date; // date of email
$actioncomm->datef = $date; // date of email
$actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $thirdpartystatic->id;
$actioncomm->contact_id = $contactstatic->id;
@ -2103,7 +2103,7 @@ class EmailCollector extends CommonObject
$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
$projecttocreate->title = $subject;
$projecttocreate->date_start = $date;
$projecttocreate->date_start = $date; // date of email
$projecttocreate->date_end = '';
$projecttocreate->opp_status = $id_opp_status;
$projecttocreate->opp_percent = $percent_opp_status;
@ -2211,12 +2211,13 @@ class EmailCollector extends CommonObject
$tickettocreate->severity_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_severity', 'use_default', 'code', 1));
$tickettocreate->origin_email = $from;
$tickettocreate->fk_user_create = $user->id;
$tickettocreate->datec = $date;
$tickettocreate->datec = dol_now();
$tickettocreate->fk_project = $projectstatic->id;
$tickettocreate->notify_tiers_at_create = 0;
$tickettocreate->note_private = $descriptionfull;
$tickettocreate->entity = $conf->entity;
$tickettocreate->email_msgid = $msgid;
$tickettocreate->email_date = $date;
//$tickettocreate->fk_contact = $contactstatic->id;
$savesocid = $tickettocreate->socid;
@ -2311,12 +2312,13 @@ class EmailCollector extends CommonObject
$candidaturetocreate->email = $from;
//$candidaturetocreate->lastname = $langs->trans("Anonymous").' - '.$from;
$candidaturetocreate->fk_user_creat = $user->id;
$candidaturetocreate->date_creation = $date;
$candidaturetocreate->date_creation = dol_now();
$candidaturetocreate->fk_project = $projectstatic->id;
$candidaturetocreate->description = $description;
$candidaturetocreate->note_private = $descriptionfull;
$candidaturetocreate->entity = $conf->entity;
$candidaturetocreate->email_msgid = $msgid;
$candidaturetocreate->email_date = $date; // date of email
$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
//$candidaturetocreate->fk_contact = $contactstatic->id;

View File

@ -70,3 +70,6 @@ ALTER TABLE llx_bank ADD COLUMN position integer DEFAULT 0;
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_product (fk_product);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD email_date datetime after email_msgid;
ALTER TABLE llx_ticket ADD email_date datetime after email_msgid;

View File

@ -38,6 +38,7 @@ CREATE TABLE llx_recruitment_recruitmentcandidature(
remuneration_requested integer,
remuneration_proposed integer,
email_msgid varchar(175), -- Do not use a too large value, it generates trouble with unique index
email_date datetime,
fk_recruitment_origin INTEGER NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@ -34,12 +34,13 @@ CREATE TABLE llx_ticket
type_code varchar(32),
category_code varchar(32),
severity_code varchar(32),
datec datetime,
datec datetime, -- date of creation of record
date_read datetime,
date_last_msg_sent datetime,
date_close datetime,
notify_tiers_at_create tinyint,
email_msgid varchar(255), -- if ticket is created by email collector, we store here MSG ID
email_date datetime, -- if ticket is created by email collector, we store here Date of message
ip varchar(250),
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
import_key varchar(14)

View File

@ -124,6 +124,7 @@ class RecruitmentCandidature extends CommonObject
'phone' => array('type'=>'phone', 'label'=>'Phone', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'picto'=>'phone', 'csslist'=>'tdoverflowmax150'),
'date_birth' => array('type'=>'date', 'label'=>'DateOfBirth', 'enabled'=>'1', 'position'=>70, 'visible'=>-1,),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541),
//'fk_recruitment_origin' => array('type'=>'integer:CRecruitmentOrigin:recruitment/class/crecruitmentorigin.class.php', 'label'=>'Origin', 'enabled'=>'1', 'position'=>45, 'visible'=>1, 'index'=>1),
'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,),
'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,),
@ -149,6 +150,7 @@ class RecruitmentCandidature extends CommonObject
public $phone;
public $date_birth;
public $email_msgid;
public $email_date;
public $remuneration_requested;
public $remuneration_proposed;
public $fk_recruitment_origin;

View File

@ -203,16 +203,23 @@ class Ticket extends CommonObject
public $notify_tiers_at_create;
/**
* @var string msgid
* @var string Email MSGID
*/
public $email_msgid;
/**
* @var string Email Date
*/
public $email_date;
public $lines;
/**
* @var string Regex pour les images
*/
public $regeximgext = '\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff';
public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into images.lib.php
/**
* Status
@ -277,6 +284,7 @@ class Ticket extends CommonObject
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541),
'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'),
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1),
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')),
@ -437,6 +445,7 @@ class Ticket extends CommonObject
$sql .= "fk_user_create,";
$sql .= "fk_user_assign,";
$sql .= "email_msgid,";
$sql .= "email_date,";
$sql .= "subject,";
$sql .= "message,";
$sql .= "fk_statut,";
@ -460,6 +469,7 @@ class Ticket extends CommonObject
$sql .= " ".($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')).",";
$sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').",";
$sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").",";
$sql .= " ".(empty($this->email_date) ? 'NULL' : "'".$this->db->idate($this->email_date)."'").",";
$sql .= " ".(!isset($this->subject) ? 'NULL' : "'".$this->db->escape($this->subject)."'").",";
$sql .= " ".(!isset($this->message) ? 'NULL' : "'".$this->db->escape($this->message)."'").",";
$sql .= " ".(!isset($this->fk_statut) ? '0' : "'".$this->db->escape($this->fk_statut)."'").",";
@ -570,6 +580,7 @@ class Ticket extends CommonObject
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_assign,";
$sql .= " t.email_msgid,";
$sql .= " t.email_date,";
$sql .= " t.subject,";
$sql .= " t.message,";
$sql .= " t.fk_statut as status,";
@ -620,6 +631,7 @@ class Ticket extends CommonObject
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_assign = $obj->fk_user_assign;
$this->email_msgid = $obj->email_msgid;
$this->email_date = $this->db->jdate($obj->email_date);
$this->subject = $obj->subject;
$this->message = $obj->message;