[-] BO : #PSCFV-3039 : Add customer thread when i have a order message
This commit is contained in:
@@ -483,6 +483,27 @@ abstract class PaymentModuleCore extends Module
|
||||
$message = new Message((int)$old_message['id_message']);
|
||||
$message->id_order = (int)$order->id;
|
||||
$message->update();
|
||||
|
||||
// Add this message in the customer thread
|
||||
$customer_thread = new CustomerThread();
|
||||
$customer_thread->id_contact = 0;
|
||||
$customer_thread->id_customer = (int)$order->id_customer;
|
||||
$customer_thread->id_shop = (int)$this->context->shop->id;
|
||||
$customer_thread->id_order = (int)$order->id;
|
||||
$customer_thread->id_lang = (int)$this->context->language->id;
|
||||
$customer_thread->email = $customer->email;
|
||||
$customer_thread->status = 'open';
|
||||
$customer_thread->token = Tools::passwdGen(12);
|
||||
$customer_thread->add();
|
||||
|
||||
$customer_message = new CustomerMessage();
|
||||
$customer_message->id_customer_thread = $customer_thread->id;
|
||||
$customer_message->id_employee = 0;
|
||||
$customer_message->message = htmlentities($message->message, ENT_COMPAT, 'UTF-8');
|
||||
$customer_message->private = 0;
|
||||
|
||||
if (!$customer_message->add())
|
||||
$this->errors[] = Tools::displayError('An error occurred while saving message');
|
||||
}
|
||||
|
||||
// Hook validate order
|
||||
|
||||
Reference in New Issue
Block a user