diff --git a/admin-dev/themes/default/template/controllers/customer_threads/message.tpl b/admin-dev/themes/default/template/controllers/customer_threads/message.tpl
index 533d12610..a181a2f79 100644
--- a/admin-dev/themes/default/template/controllers/customer_threads/message.tpl
+++ b/admin-dev/themes/default/template/controllers/customer_threads/message.tpl
@@ -57,14 +57,14 @@
- {l s='Sent on:'}
- - {$message.date_add}
+ - {$message.date_add}
{if empty($message.id_employee)}
- {l s='Browser:'}
- - {$message.user_agent}
+ - {$message.user_agent}
{/if}
@@ -79,34 +79,35 @@
{/if}
- {if !empty($message.id_order) && empty($message.id_employee)}
+ {if !empty($message.id_order) && $is_valid_order_id && empty($message.id_employee)}
- {l s='Order #'}
- -
- {$message.id_order}
-
+ - {$message.id_order}
+
{/if}
{if !empty($message.id_product) && empty($message.id_employee)}
- {l s='Product #'}
- -
- {$message.id_product}
-
+ - {$message.id_product}

{/if}
diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php
index c53945a5b..da3f4b15c 100644
--- a/controllers/admin/AdminCustomerThreadsController.php
+++ b/controllers/admin/AdminCustomerThreadsController.php
@@ -605,6 +605,12 @@ class AdminCustomerThreadsControllerCore extends AdminController
ENT_QUOTES, 'UTF-8')
);
+ $is_valid_order_id = true;
+ $order = new Order((int)$message['id_order']);
+
+ if (!Validate::isLoadedObject($order))
+ $is_valid_order_id = false;
+
$tpl->assign(array(
'current' => self::$currentIndex,
'token' => $this->token,
@@ -615,7 +621,8 @@ class AdminCustomerThreadsControllerCore extends AdminController
'PS_SHOP_NAME' => Configuration::get('PS_SHOP_NAME'),
'file_name' => file_exists(_PS_UPLOAD_DIR_.$message['file_name']),
'contacts' => $contacts,
- 'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang']))
+ 'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])),
+ 'is_valid_order_id' => $is_valid_order_id
));
return $tpl->fetch();