//oups part 2

This commit is contained in:
vAugagneur
2012-09-04 12:39:56 +00:00
parent 0a41c84666
commit 0351df3e67
2 changed files with 9 additions and 5 deletions
+2
View File
@@ -36,6 +36,7 @@ class CustomerMessageCore extends ObjectModel
public $user_agent;
public $private;
public $date_add;
public $read;
/**
* @see ObjectModel::$definition
@@ -52,6 +53,7 @@ class CustomerMessageCore extends ObjectModel
'user_agent' => array('type' => self::TYPE_STRING),
'private' => array('type' => self::TYPE_INT),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'read' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')
),
);
+7 -5
View File
@@ -72,15 +72,17 @@ class CustomerThreadCore extends ObjectModel
return (parent::delete());
}
public static function getCustomerMessages($id_customer)
public static function getCustomerMessages($id_customer, $read = null)
{
return Db::getInstance()->executeS('
SELECT *
$sql = 'SELECT *
FROM '._DB_PREFIX_.'customer_thread ct
LEFT JOIN '._DB_PREFIX_.'customer_message cm
ON ct.id_customer_thread = cm.id_customer_thread
WHERE id_customer = '.(int)$id_customer
);
WHERE id_customer = '.(int)$id_customer;
if (!is_null($read))
$sql .= ' AND cm.`read` = '.(int)$read;
return Db::getInstance()->executeS($sql);
}
public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order)