From 293fa740491b9dd20391661206226c1d6d94b96a Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Sat, 2 Nov 2013 02:51:57 +0000 Subject: [PATCH] Fix install and initial data issues --- include/class.dept.php | 2 +- include/class.mailer.php | 4 ++-- include/class.topic.php | 2 ++ include/i18n/en_US/help_topic.yaml | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/class.dept.php b/include/class.dept.php index 2bc2f30b3..8f1542b73 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -355,7 +355,7 @@ class Dept { && (!$vars['email_id'] || !is_numeric($vars['email_id']))) $errors['email_id']='Email selection required'; - if(!is_numeric($vars['tpl_id'])) + if(isset($vars['tpl_id']) && !is_numeric($vars['tpl_id'])) $errors['tpl_id']='Template selection required'; if(!$vars['name']) { diff --git a/include/class.mailer.php b/include/class.mailer.php index 36bd1a4b6..0e89ddad5 100644 --- a/include/class.mailer.php +++ b/include/class.mailer.php @@ -141,7 +141,7 @@ class Mailer { // the message appears to be HTML -- that is, the first // non-whitespace char is a '<' character if (!(isset($options['text']) && $options['text']) - && $cfg->isHtmlThreadEnabled()) { + && (!$cfg || $cfg->isHtmlThreadEnabled())) { // Make sure nothing unsafe has creeped into the message $message = Format::safe_html($message); //XXX?? $mime->setTXTBody(Format::html2text($message, 90, false)); @@ -152,7 +152,7 @@ class Mailer { } $domain = 'local'; - if ($isHtml && $ost->getConfig()->isHtmlThreadEnabled()) { + if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) { // TODO: Lookup helpdesk domain $domain = substr(md5($ost->getConfig()->getURL()), -12); // Format content-ids with the domain, and add the inline images diff --git a/include/class.topic.php b/include/class.topic.php index 881d33afa..e4ac4c98c 100644 --- a/include/class.topic.php +++ b/include/class.topic.php @@ -261,6 +261,8 @@ class Topic { $errors['err']='Unable to update topic. Internal error occurred'; } else { + if (isset($vars['topic_id'])) + $sql .= ', topic_id='.db_input($vars['topic_id']); $sql='INSERT INTO '.TOPIC_TABLE.' SET '.$sql.',created=NOW()'; if(db_query($sql) && ($id=db_insert_id())) return $id; diff --git a/include/i18n/en_US/help_topic.yaml b/include/i18n/en_US/help_topic.yaml index e002905d3..508590a57 100644 --- a/include/i18n/en_US/help_topic.yaml +++ b/include/i18n/en_US/help_topic.yaml @@ -34,7 +34,7 @@ notes: | Tickets that primarily concern the sales and billing departments -- id: 10 +- topic_id: 10 isactive: 1 ispublic: 1 dept_id: 1 -- GitLab