Finished some TODOs and related articles
This commit is contained in:
parent
4aa23af770
commit
96a0269983
@ -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;
|
||||
|
@ -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 '</p>';
|
||||
}
|
||||
|
||||
// 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 '<fieldset><legend>'.$hesklang['relart'].'</legend>';
|
||||
foreach ($related_articles as $id => $subject)
|
||||
{
|
||||
echo '<img src="'.HESK_PATH.'img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle;padding:2px;" /> <a href="knowledgebase_private.php?article='.$id.'">'.$subject.'</a><br />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($article['catid']==1)
|
||||
@ -314,26 +268,81 @@ function hesk_show_kb_article($artid)
|
||||
}
|
||||
?>
|
||||
<br><br>
|
||||
<h4><?php echo $hesklang['ad']; ?></h4>
|
||||
<div class="footerWithBorder blankSpace"></div>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td><?php echo $hesklang['aid']; ?>: </td>
|
||||
<td><?php echo $article['id']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $hesklang['category']; ?>: </td>
|
||||
<td><a href="<?php echo $link; ?>"><?php echo $article['cat_name']; ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $hesklang['dta']; ?>: </td>
|
||||
<td><?php echo hesk_date($article['dt'], true); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $hesklang['views']; ?>: </td>
|
||||
<td><?php echo (isset($_GET['rated']) ? $article['views'] : $article['views']+1); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="row">
|
||||
<?php
|
||||
$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']) );
|
||||
|
||||
// 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) ) {
|
||||
$column = 'col-md-6';
|
||||
$showRelated = true;
|
||||
}
|
||||
?>
|
||||
<div class="<?php echo $column; ?> col-sm-12">
|
||||
<h4><?php echo $hesklang['ad']; ?></h4>
|
||||
<div class="footerWithBorder blankSpace"></div>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td><?php echo $hesklang['aid']; ?>: </td>
|
||||
<td><?php echo $article['id']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $hesklang['category']; ?>: </td>
|
||||
<td><a href="<?php echo $link; ?>"><?php echo $article['cat_name']; ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $hesklang['dta']; ?>: </td>
|
||||
<td><?php echo hesk_date($article['dt'], true); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $hesklang['views']; ?>: </td>
|
||||
<td><?php echo (isset($_GET['rated']) ? $article['views'] : $article['views']+1); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($showRelated) { ?>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<h4><?php echo $hesklang['relart']; ?></h4>
|
||||
<div class="footerWithBorder blankSpace"></div>
|
||||
<?php
|
||||
// Related articles
|
||||
foreach ($related_articles as $id => $subject)
|
||||
{
|
||||
echo '<span class="glyphicon glyphicon-file" style="font-size: 16px;"></span> <a href="knowledgebase_private.php?article='.$id.'">'.$subject.'</a><br />';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (!isset($_GET['back']))
|
||||
@ -358,7 +367,6 @@ function hesk_show_kb_category($catid, $is_search = 0) {
|
||||
if ($is_search == 0)
|
||||
{
|
||||
/* Print header */
|
||||
require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
|
||||
hesk_kb_header($hesk_settings['kb_link'], $catid);
|
||||
|
||||
if ($catid == 1)
|
||||
@ -567,4 +575,4 @@ function show_subnav($hide='', $catid=1)
|
||||
|
||||
<?php
|
||||
} // End show_subnav()
|
||||
?>
|
||||
?>
|
@ -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');
|
||||
|
||||
|
@ -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 '<fieldset><legend>'.$hesklang['relart'].'</legend>';
|
||||
foreach ($related_articles as $id => $subject)
|
||||
{
|
||||
echo '<img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle;padding:2px;" /> <a href="knowledgebase.php?article='.$id.'">'.$subject.'</a><br />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
$column = 'col-md-6';
|
||||
$showRelated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,37 +363,54 @@ function hesk_show_kb_article($artid)
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<h4 class="text-left"><?php echo $hesklang['ad']; ?></h4>
|
||||
<div class="text-left">
|
||||
<p><?php echo $hesklang['aid']; ?>: <?php echo $article['id']; ?></p>
|
||||
<p><?php echo $hesklang['category']; ?>: <a href="<?php echo $link; ?>"><?php echo $article['cat_name']; ?></a></p>
|
||||
<div class="row">
|
||||
<div class="<?php echo $column; ?> col-sm-12">
|
||||
<h4 class="text-left"><?php echo $hesklang['ad']; ?></h4>
|
||||
<div class="text-left">
|
||||
<p><?php echo $hesklang['aid']; ?>: <?php echo $article['id']; ?></p>
|
||||
<p><?php echo $hesklang['category']; ?>: <a href="<?php echo $link; ?>"><?php echo $article['cat_name']; ?></a></p>
|
||||
|
||||
<?php
|
||||
if ($hesk_settings['kb_date'])
|
||||
{
|
||||
?>
|
||||
<p><?php echo $hesklang['dta']; ?>: <?php echo hesk_date($article['dt'], true); ?></p>
|
||||
<?php
|
||||
}
|
||||
<?php
|
||||
if ($hesk_settings['kb_date'])
|
||||
{
|
||||
?>
|
||||
<p><?php echo $hesklang['dta']; ?>: <?php echo hesk_date($article['dt'], true); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($hesk_settings['kb_views'])
|
||||
{
|
||||
?>
|
||||
<p><?php echo $hesklang['views']; ?>: <?php echo (isset($_GET['rated']) ? $article['views'] : $article['views']+1); ?></p>
|
||||
<?php
|
||||
}
|
||||
if ($hesk_settings['kb_views'])
|
||||
{
|
||||
?>
|
||||
<p><?php echo $hesklang['views']; ?>: <?php echo (isset($_GET['rated']) ? $article['views'] : $article['views']+1); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($hesk_settings['kb_rating'])
|
||||
{
|
||||
$alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated'];
|
||||
echo '
|
||||
if ($hesk_settings['kb_rating'])
|
||||
{
|
||||
$alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated'];
|
||||
echo '
|
||||
<p>'.$hesklang['rating'].' ('.$hesklang['votes'].'): <img src="img/star_'.(hesk_round_to_half($article['rating'])*10).'.png" width="85" height="16" alt="'.$alt.'" title="'.$alt.'" border="0" style="vertical-align:text-bottom" /> ('.$article['votes'].')</p>
|
||||
';
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($showRelated) { ?>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<h4 class="text-left"><?php echo $hesklang['relart']; ?></h4>
|
||||
<div class="text-left">
|
||||
<?php
|
||||
foreach ($related_articles as $id => $subject)
|
||||
{
|
||||
echo '<span class="glyphicon glyphicon-file" style="font-size: 16px"></span> <a href="knowledgebase.php?article='.$id.'">'.$subject.'</a><br />';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
if (!isset($_GET['suggest']))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user