Use date_add
This commit is contained in:
parent
713c316914
commit
013e705e94
@ -39,16 +39,18 @@ class AdminCustomerThreads extends AdminTab
|
||||
$this->delete = true;
|
||||
|
||||
$this->_select = 'CONCAT(c.firstname," ",c.lastname) as customer, cl.name as contact, l.name as language, group_concat(message) as messages, (
|
||||
SELECT IFNULL(CONCAT(LEFT(e.firstname, 1),". ",e.lastname), "--")
|
||||
FROM '._DB_PREFIX_.'customer_message cm2 INNER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm2.id_employee
|
||||
WHERE cm2.id_employee > 0 AND cm2.`id_customer_thread` = a.`id_customer_thread`
|
||||
ORDER BY cm2.date_add DESC LIMIT 1) as employee';
|
||||
SELECT IFNULL(CONCAT(LEFT(e.firstname, 1),". ",e.lastname), "--")
|
||||
FROM '._DB_PREFIX_.'customer_message cm2 INNER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm2.id_employee
|
||||
WHERE cm2.id_employee > 0 AND cm2.`id_customer_thread` = a.`id_customer_thread`
|
||||
ORDER BY cm2.date_add DESC LIMIT 1
|
||||
) as employee';
|
||||
|
||||
$this->_group = 'GROUP BY cm.id_customer_thread';
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = a.`id_customer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_message` cm ON cm.`id_customer_thread` = a.`id_customer_thread`
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON l.`id_lang` = a.`id_lang`
|
||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$cookie->id_lang.')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = a.`id_customer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_message` cm ON cm.`id_customer_thread` = a.`id_customer_thread`
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON l.`id_lang` = a.`id_lang`
|
||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$cookie->id_lang.')';
|
||||
|
||||
$contactArray = array();
|
||||
$contacts = Contact::getContacts($cookie->id_lang);
|
||||
@ -92,7 +94,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
'id_product' => array('title' => $this->l('> 10€'), 'width' => 50, 'maxlength' => 0, 'align' =>'center'),
|
||||
'id_order' => array('title' => $this->l('Nb products'), 'width' => 50, 'maxlength' => 0, 'align' =>'center text-bold','search'=>false),
|
||||
'order' => array('title' => $this->l('Total cmd'), 'width' => 50, 'maxlength' => 0, 'align' =>'center text-bold'),
|
||||
'date_upd' => array('title' => $this->l('Last message'), 'width' => 50, 'type'=>'datetimeLight')
|
||||
'date_add' => array('title' => $this->l('Open at'), 'width' => 50, 'type'=>'datetimeLight')
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
@ -242,7 +244,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
$this->viewcustomer_thread();
|
||||
else
|
||||
{
|
||||
$this->getList((int)$cookie->id_lang, !Tools::getValue($this->table.'Orderby') ? 'date_upd' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->getList((int)$cookie->id_lang, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user