From d93bb51be76a5ccbc9ff4df6a8e6c9d2c326c016 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@enhancesoft.com> Date: Wed, 22 Aug 2018 02:44:34 +0000 Subject: [PATCH] Help Topic: Ignore invalid help topics This is necessary because ticket filters or API can set an invalid help topic id. Either deleted or no longer active. --- include/class.ticket.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/class.ticket.php b/include/class.ticket.php index 409804f86..73fcdaf0b 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -3708,15 +3708,15 @@ implements RestrictedAccess, Threadable, Searchable { $errors += $form->errors(); if ($vars['topicId']) { - if ($topic=Topic::lookup($vars['topicId'])) { + if (($topic=Topic::lookup($vars['topicId'])) + && $topic->isActive()) { foreach ($topic_forms as $topic_form) { $TF = $topic_form->getForm($vars); if (!$TF->isValid($field_filter('topic'))) $errors = array_merge($errors, $TF->errors()); } - } - else { - $errors['topicId'] = 'Invalid help topic selected'; + } else { + $vars['topicId'] = 0; } } -- GitLab