// Fix customer thread notifications for multishop #PSCFV-2546
This commit is contained in:
@@ -50,8 +50,8 @@ class CustomerMessageCore extends ObjectModel
|
|||||||
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000),
|
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000),
|
||||||
'file_name' => array('type' => self::TYPE_STRING),
|
'file_name' => array('type' => self::TYPE_STRING),
|
||||||
'user_agent' => array('type' => self::TYPE_STRING),
|
'user_agent' => array('type' => self::TYPE_STRING),
|
||||||
'private' => array('type' => self::TYPE_STRING),
|
'private' => array('type' => self::TYPE_INT),
|
||||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -85,16 +85,19 @@ class NotificationCore
|
|||||||
ORDER BY `id_order` DESC
|
ORDER BY `id_order` DESC
|
||||||
';
|
';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'customer_message':
|
case 'customer_message':
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT c.`id_customer_message`, ct.`id_customer`, ct.`id_customer_thread`, ct.`email`
|
SELECT c.`id_customer_message`, ct.`id_customer`, ct.`id_customer_thread`, ct.`email`
|
||||||
FROM `'._DB_PREFIX_.'customer_message` as c
|
FROM `'._DB_PREFIX_.'customer_message` as c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer_thread` as ct ON (c.`id_customer_thread` = ct.`id_customer_thread`)
|
LEFT JOIN `'._DB_PREFIX_.'customer_thread` as ct ON (c.`id_customer_thread` = ct.`id_customer_thread`)
|
||||||
WHERE c.`id_customer_message` > '.(int)$id_last_element.'
|
WHERE c.`id_customer_message` > '.(int)$id_last_element.'
|
||||||
AND c.`id_employee` = 0
|
AND c.`id_employee` = 0
|
||||||
|
AND ct.id_shop IN ('.implode(', ', Shop::getContextListShopID()).')
|
||||||
ORDER BY c.`id_customer_message` DESC
|
ORDER BY c.`id_customer_message` DESC
|
||||||
';
|
';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT t.`id_'.bqSQL($type).'`
|
SELECT t.`id_'.bqSQL($type).'`
|
||||||
@@ -107,7 +110,7 @@ class NotificationCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
$json = array();
|
$json = array();
|
||||||
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql) as $key => $value)
|
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql) as $value)
|
||||||
{
|
{
|
||||||
$customer = null;
|
$customer = null;
|
||||||
$order = null;
|
$order = null;
|
||||||
@@ -148,8 +151,10 @@ class NotificationCore
|
|||||||
// We update the last item viewed
|
// We update the last item viewed
|
||||||
return Db::getInstance()->execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'employee`
|
UPDATE `'._DB_PREFIX_.'employee`
|
||||||
SET `id_last_'.bqSQL($type).'` = (SELECT MAX(`id_'.$type.'`)
|
SET `id_last_'.bqSQL($type).'` = (
|
||||||
FROM `'._DB_PREFIX_.(($type == 'order') ? bqSQL($type).'s' : bqSQL($type)).'`)
|
SELECT MAX(`id_'.$type.'`)
|
||||||
|
FROM `'._DB_PREFIX_.(($type == 'order') ? bqSQL($type).'s' : bqSQL($type)).'`
|
||||||
|
)
|
||||||
WHERE `id_employee` = '.(int)$cookie->id_employee);
|
WHERE `id_employee` = '.(int)$cookie->id_employee);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user