diff --git a/src/messenger/webim/operator/history.php b/src/messenger/webim/operator/history.php index c328a8c6..1b3efaa4 100644 --- a/src/messenger/webim/operator/history.php +++ b/src/messenger/webim/operator/history.php @@ -68,10 +68,9 @@ if ($query !== false) { $searchConditions[] = "({chatthread}.userName LIKE :query)"; $searchConditions[] = "({chatthread}.remote LIKE :query)"; } - select_with_pagintation("DISTINCT {chatthread}.dtmcreated as created, " . - "{chatthread}.dtmmodified as modified, {chatthread}.threadid, " . - "{chatthread}.remote, {chatthread}.agentName, {chatthread}.userName, groupid, " . - "messageCount as size", + + // Load threads + select_with_pagintation("DISTINCT {chatthread}.*", "{chatthread}, {chatmessage}", array( "{chatmessage}.threadid = {chatthread}.threadid", @@ -80,6 +79,11 @@ if ($query !== false) { "order by {chatthread}.dtmcreated DESC", "DISTINCT {chatthread}.dtmcreated", $values); + // Build Thread object + foreach ($page['pagination.items'] as $key => $item) { + $page['pagination.items'][$key] = Thread::createFromDbInfo($item); + } + $page['formq'] = topage($query); } else { setup_empty_pagination(); diff --git a/src/messenger/webim/view/thread_search.php b/src/messenger/webim/view/thread_search.php index da2d826d..68c0d2e7 100644 --- a/src/messenger/webim/view/thread_search.php +++ b/src/messenger/webim/view/thread_search.php @@ -84,24 +84,24 @@ if( $page['pagination.items'] ) { foreach( $page['pagination.items'] as $chatthread ) { ?>