diff --git a/admin/index.php b/admin/index.php index 8be6bb81..9abe808e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -263,9 +263,10 @@ function do_login() // Notify customer of closed ticket? if ($hesk_settings['notify_closed']) { - //TODO Change status ID to the ID which customer's replies update the status to. + $closedStatusRs = hesk_dbQuery('SELECT `ID` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsDefaultStaffReplyStatus` = 1'); + $closedStatus = hesk_dbFetchAssoc($closedStatusRs); // Get list of tickets - $result = hesk_dbQuery("SELECT * FROM `".$hesk_settings['db_pfix']."tickets` WHERE `status` = '2' AND `lastchange` <= '".hesk_dbEscape($dt)."' "); + $result = hesk_dbQuery("SELECT * FROM `".$hesk_settings['db_pfix']."tickets` WHERE `status` = ".$closedStatus['ID']." AND `lastchange` <= '".hesk_dbEscape($dt)."' "); if (hesk_dbNumRows($result) > 0) { global $ticket; diff --git a/admin/knowledgebase_private.php b/admin/knowledgebase_private.php index 52c8759b..39cb99a4 100644 --- a/admin/knowledgebase_private.php +++ b/admin/knowledgebase_private.php @@ -113,6 +113,7 @@ function hesk_kb_header($kb_link, $catid=1) global $hesk_settings, $hesklang, $can_man_kb; /* Print admin navigation */ + require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> @@ -152,8 +153,6 @@ function hesk_kb_search($query) define('HESK_NO_ROBOTS',1); - /* Print header */ - require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); hesk_kb_header($hesk_settings['kb_link']); $res = hesk_dbQuery('SELECT t1.`id`, t1.`subject`, LEFT(`t1`.`content`, '.max(200, $hesk_settings['kb_substrart'] * 2).') AS `content`, t1.`rating` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_articles` AS t1 LEFT JOIN `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_categories` AS t2 ON t1.`catid` = t2.`id` '." WHERE t1.`type` IN ('0','1') AND MATCH(`subject`,`content`,`keywords`) AGAINST ('".hesk_dbEscape($query)."') LIMIT ".intval($hesk_settings['kb_search_limit'])); @@ -232,7 +231,6 @@ function hesk_show_kb_article($artid) // Print header $hesk_settings['tmp_title'] = $article['subject']; - require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); hesk_kb_header($hesk_settings['kb_link'], $article['catid']); // Update views by 1 @@ -258,50 +256,6 @@ function hesk_show_kb_article($artid) echo '

'; } - // TODO Check how this looks - // Related articles - if ($hesk_settings['kb_related']) - { - require(HESK_PATH . 'inc/mail/email_parser.php'); - - $query = hesk_dbEscape( $article['subject'] . ' ' . convert_html_to_text($article['content']) ); - - // Get relevant articles from the database - $res = hesk_dbQuery("SELECT `id`, `subject`, MATCH(`subject`,`content`,`keywords`) AGAINST ('{$query}') AS `score` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `type` IN ('0','1') AND MATCH(`subject`,`content`,`keywords`) AGAINST ('{$query}') LIMIT ".intval($hesk_settings['kb_related']+1)); - - // Array with related articles - $related_articles = array(); - - while ($related = hesk_dbFetchAssoc($res)) - { - // Get base match score from the first (this) article - if ( ! isset($base_score) ) - { - $base_score = $related['score']; - continue; - } - - // Stop when articles reach less than 10% of base score - if ($related['score'] / $base_score < 0.10) - { - break; - } - - // This is a valid related article - $related_articles[$related['id']] = $related['subject']; - } - - // Print related articles if we have any valid matches - if ( count($related_articles) ) - { - echo '
'.$hesklang['relart'].''; - foreach ($related_articles as $id => $subject) - { - echo ' '.$subject.'
'; - } - echo '
'; - } - } if ($article['catid']==1) @@ -314,26 +268,81 @@ function hesk_show_kb_article($artid) } ?>

-

-
- - - - - - - - - - - - - - - - - -
:
:
:
:
+
+ +
+

+
+ + + + + + + + + + + + + + + + + +
:
:
:
:
+
+ +
+

+
+ $subject) + { + echo ' '.$subject.'
'; + } + ?> +
+ +
+?> \ No newline at end of file diff --git a/admin/lock.php b/admin/lock.php index ed03cf36..891d3e6f 100644 --- a/admin/lock.php +++ b/admin/lock.php @@ -82,9 +82,17 @@ else } $ticket = hesk_dbFetchAssoc($result); - //TODO Update this to look at any "closed" status; not just ID 3 + $closedStatusRS = hesk_dbQuery('SELECT `ID` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 1'); + $ticketIsOpen = true; + while ($row = hesk_dbFetchAssoc($closedStatusRS)) + { + if ($ticket['status'] == $row['ID']) + { + $ticketIsOpen = false; + } + } // Notify customer, but only if ticket is not already closed - if ($ticket['status'] != 3) + if ($ticketIsOpen) { require(HESK_PATH . 'inc/email_functions.inc.php'); diff --git a/knowledgebase.php b/knowledgebase.php index 22bea8b0..75c43c89 100644 --- a/knowledgebase.php +++ b/knowledgebase.php @@ -309,6 +309,8 @@ function hesk_show_kb_article($artid) // Related articles if ($hesk_settings['kb_related']) { + $showRelated = false; + $column = 'col-md-12'; require(HESK_PATH . 'inc/mail/email_parser.php'); $query = hesk_dbEscape( $article['subject'] . ' ' . convert_html_to_text($article['content']) ); @@ -346,12 +348,8 @@ function hesk_show_kb_article($artid) // Print related articles if we have any valid matches if ( count($related_articles) ) { - echo '
'.$hesklang['relart'].''; - foreach ($related_articles as $id => $subject) - { - echo ' '.$subject.'
'; - } - echo '
'; + $column = 'col-md-6'; + $showRelated = true; } } @@ -365,37 +363,54 @@ function hesk_show_kb_article($artid) } ?> - -

-
-

:

-

:

- - -

:

- -

:

- +
+

+
+

:

+

:

+ + +

:

+ +

:

+ '.$hesklang['rating'].' ('.$hesklang['votes'].'): '.$alt.' ('.$article['votes'].')

'; - } - ?> + } + ?> +
+
+ +
+

+
+ $subject) + { + echo ' '.$subject.'
'; + } + ?> +
+
+
+