ticket : update date_last_msg_sent on message sending from backend or public interface
This commit is contained in:
parent
b21fdbb21e
commit
26648e4f12
@ -279,7 +279,10 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
if ($mailfile->error) {
|
||||
dol_syslog($mailfile->error, LOG_DEBUG);
|
||||
} else {
|
||||
$result = $mailfile->sendfile();
|
||||
$result = $mailfile->sendfile();
|
||||
// update last_msg_sent date
|
||||
$object->date_last_msg_sent = dol_now();
|
||||
$object->update($user);
|
||||
}
|
||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
||||
|
||||
@ -177,6 +177,11 @@ class Ticket extends CommonObject
|
||||
*/
|
||||
public $date_read = '';
|
||||
|
||||
/**
|
||||
* @var int Last message date
|
||||
*/
|
||||
public $date_last_msg_sent = '';
|
||||
|
||||
/**
|
||||
* @var int Close ticket date
|
||||
*/
|
||||
@ -266,6 +271,7 @@ class Ticket extends CommonObject
|
||||
//'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ?
|
||||
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
|
||||
'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1),
|
||||
'date_last_msg_sent' => array('type'=>'datetime', 'label'=>'TicketLastMessageDate', 'visible'=>0, 'enabled'=>1, 'position'=>502, 'notnull'=>-1),
|
||||
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax125'),
|
||||
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
|
||||
@ -568,6 +574,7 @@ class Ticket extends CommonObject
|
||||
$sql .= " t.severity_code,";
|
||||
$sql .= " t.datec,";
|
||||
$sql .= " t.date_read,";
|
||||
$sql .= " t.date_last_msg_sent,";
|
||||
$sql .= " t.date_close,";
|
||||
$sql .= " t.tms,";
|
||||
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||
@ -635,6 +642,7 @@ class Ticket extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_read = $this->db->jdate($obj->date_read);
|
||||
$this->date_validation = $this->db->jdate($obj->date_read);
|
||||
$this->date_last_msg_sent = $this->db->jdate($obj->date_last_msg_sent);
|
||||
$this->date_close = $this->db->jdate($obj->date_close);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
@ -695,6 +703,7 @@ class Ticket extends CommonObject
|
||||
$sql .= " t.severity_code,";
|
||||
$sql .= " t.datec,";
|
||||
$sql .= " t.date_read,";
|
||||
$sql .= " t.date_last_msg_sent,";
|
||||
$sql .= " t.date_close,";
|
||||
$sql .= " t.tms";
|
||||
$sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||
@ -801,6 +810,7 @@ class Ticket extends CommonObject
|
||||
|
||||
$line->datec = $this->db->jdate($obj->datec);
|
||||
$line->date_read = $this->db->jdate($obj->date_read);
|
||||
$line->date_last_msg_sent = $this->db->jdate($obj->date_last_msg_sent);
|
||||
$line->date_close = $this->db->jdate($obj->date_close);
|
||||
|
||||
// Extra fields
|
||||
@ -923,6 +933,7 @@ class Ticket extends CommonObject
|
||||
$sql .= " severity_code=".(isset($this->severity_code) ? "'".$this->db->escape($this->severity_code)."'" : "null").",";
|
||||
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||
$sql .= " date_read=".(dol_strlen($this->date_read) != 0 ? "'".$this->db->idate($this->date_read)."'" : 'null').",";
|
||||
$sql .= " date_last_msg_sent=".(dol_strlen($this->date_last_msg_sent) != 0 ? "'".$this->db->idate($this->date_last_msg_sent)."'" : 'null').",";
|
||||
$sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null')."";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
@ -1116,6 +1127,7 @@ class Ticket extends CommonObject
|
||||
$this->severity_code = 'SEVERITYCODE';
|
||||
$this->datec = '';
|
||||
$this->date_read = '';
|
||||
$this->date_last_msg_sent = '';
|
||||
$this->date_close = '';
|
||||
$this->tms = '';
|
||||
return 1;
|
||||
@ -2747,6 +2759,10 @@ class Ticket extends CommonObject
|
||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
|
||||
}
|
||||
}
|
||||
|
||||
// update last_msg_sent date
|
||||
$object->date_last_msg_sent = dol_now();
|
||||
$object->update($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2755,7 +2771,6 @@ class Ticket extends CommonObject
|
||||
if ($object->fk_statut < 3 && !$user->socid) {
|
||||
$object->setStatut(3);
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -3093,6 +3108,11 @@ class TicketsLine
|
||||
*/
|
||||
public $date_read = '';
|
||||
|
||||
/**
|
||||
* @var int Last message date
|
||||
*/
|
||||
public $date_last_msg_sent = '';
|
||||
|
||||
/**
|
||||
* Close ticket date
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user