Reset date_upd

This commit is contained in:
Michael RICOIS 2018-02-23 12:10:14 +01:00
parent 2cdfbdb833
commit a09de51ac2

View File

@ -169,9 +169,15 @@ class ContactController extends ContactControllerCore {
if ($contact->customer_service)
{
$ctStatusLast = false;
if ((int)$id_customer_thread)
{
$ct = new CustomerThread($id_customer_thread);
$ctStatusLast = $ct->status;
$ctStatusDate = $ct->date_upd;
$ct->status = 'open';
$ct->id_lang = (int)self::$cookie->id_lang;
$ct->id_contact = (int)($id_contact);
@ -202,6 +208,12 @@ class ContactController extends ContactControllerCore {
if ($ct->id)
{
// Update date_upd to the last interesting date
if ($ctStatusLast !== false && $ctStatusLast == 'open') {
$sql = 'UPDATE `'._DB_PREFIX_.'customer_threads` SET `date_upd` = "'.$ctStatusDate.'" WHERE id_customer_thread='. $ct->id;
Db::getInstance()->Execute($sql);
}
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = htmlentities($message, ENT_COMPAT, 'UTF-8');