diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl
index b42bea915..471eeb0ba 100644
--- a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl
+++ b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl
@@ -36,6 +36,7 @@
{/if}
+ {if $can_edit}
+ {/if}
@@ -97,6 +99,7 @@
{/foreach}
+{if $can_edit}
-
+{/if}
{if count($timeline_items)}
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 1e12404ef..23acd57c7 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -704,9 +704,10 @@ abstract class PaymentModuleCore extends Module
// Specify order id for message
$old_message = Message::getMessageByCartId((int)$this->context->cart->id);
- if ($old_message && $old_message['private']) {
+ if ($old_message && !$old_message['private']) {
$update_message = new Message((int)$old_message['id_message']);
$update_message->id_order = (int)$order->id;
+ $update_message->private = !Tools::getValue('visibility');
$update_message->update();
if (Tools::getValue('visibility')) {
// Add this message in the customer thread
@@ -725,7 +726,7 @@ abstract class PaymentModuleCore extends Module
$customer_message->id_customer_thread = $customer_thread->id;
$customer_message->id_employee = 0;
$customer_message->message = $update_message->message;
- $customer_message->private = !Tools::getValue('visibility');
+ $customer_message->private = 0;
if (!$customer_message->add()) {
$this->errors[] = Tools::displayError('An error occurred while saving message');
}
diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php
index 8d41f81e8..616b4154c 100644
--- a/controllers/admin/AdminCustomerThreadsController.php
+++ b/controllers/admin/AdminCustomerThreadsController.php
@@ -985,6 +985,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
'count_ok' => isset($orders_ok) ? count($orders_ok) : false,
'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', (int)$thread->id_lang)),
'timeline_items' => $timeline_items,
+ 'can_edit' => $this->tabAccess['edit'],
);
return parent::renderView();
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index b80854ae0..d83d80207 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -1833,7 +1833,6 @@ class AdminOrdersControllerCore extends AdminController
} else {
$customer_thread = new CustomerThread((int)$id_customer_thread);
}
-
$customer_message = new CustomerMessage();
$customer_message->id_customer_thread = $customer_thread->id;
$customer_message->id_employee = (int)$this->context->employee->id;
@@ -1857,7 +1856,7 @@ class AdminOrdersControllerCore extends AdminController
'{order_name}' => $order->getUniqReference(),
'{message}' => $message
);
- if (@Mail::Send(
+ Mail::Send(
(int)$order->id_lang,
'order_merchant_comment',
Mail::l('New message regarding your booking', (int)$order->id_lang),
@@ -1871,9 +1870,7 @@ class AdminOrdersControllerCore extends AdminController
_PS_MAIL_DIR_,
true,
(int)$order->id_shop
- )) {
- Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=11'.'&token='.$this->token);
- }
+ );
}
$this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.');
}