From 580e201c48cee8214bb997e86dd18c3e2db961b8 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 29 Oct 2013 11:38:48 +0100 Subject: [PATCH] [-] BO : FixBug #PSCFV-9319 - display only valid order id --- .../controllers/customer_threads/message.tpl | 35 ++++++++++--------- .../admin/AdminCustomerThreadsController.php | 9 ++++- 2 files changed, 26 insertions(+), 18 deletions(-) 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} {l s='View'} -
+
{$message.id_order} {l s='View'} +
{/if} {if !empty($message.id_product) && empty($message.id_employee)}
{l s='Product #'}
-
- {$message.id_product} {l s='View'} -
+
{$message.id_product} {l s='View'}
{/if}
- {l s='Subject:'} - +
+
{l s='Subject:'}
+
+ +
+
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();