I customized our installation of osTicket to have a default topic listed on the Open Ticket screen (instead of the default being 'Select One'). This is on 1.6ST.
MySQL
ALTER TABLE ost_help_topic ADD COLUMN isdefault TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER isactive;
/include/client/open.inc.php
The block containing the Help Topic (~Line 49) should look like this.
<tr>
<th>Help Topic:</th>
<td>
<select name="topicId">
<option value="" selected >Select One</option>
<?
//$services = db_query('SELECT topic_id,topic FROM '.TOPIC_TABLE.' WHERE isactive=1 ORDER BY topic');
$services = db_query('SELECT topic_id,topic,isdefault FROM '.TOPIC_TABLE.' WHERE isactive=1 ORDER BY topic');
if($services && db_num_rows($services)) {
//while (list($topicId,$topic) = db_fetch_row($services)){
while (list($topicId,$topic,$isdefault) = db_fetch_row($services)){
//$selected = ($info==$topicId)?'selected':'';
if ($info==$topicId) $selected = 'selected';
else if ($isdefault) $selected = 'selected';
else $selected = ""; ?>
<option value="<?=$topicId?>"<?=$selected?>><?=$topic?></option>
<?
}
}else{?>
<option value="0" >General Inquiry</option>
<?}?>
</select>
<font class="error">* <?=$errors?></font>
</td>
</tr>
/include/staff/topic.inc.php
Add a new block between "Auto Response" and "New Ticket Priority" (~Line 46).
<tr>
<th nowrap>Make Default</th>
<td>
<input type="checkbox" name="isdefault" value=1 <?=$info? 'checked': ''?> >
(<i>Makes this the default help topic on ticket open page</i>)
</td>
</tr>
/include/staff/helptopics.inc.php
Revise the SQL at the top (note the addition of topic.isdefault) like this...
$sql='SELECT topic_id,isactive,topic.noautoresp,topic.isdefault,topic.dept_id,topic,dept_name,priority_desc,topic.created,topic.updated FROM '.TOPIC_TABLE.' topic '.
' LEFT JOIN '.DEPT_TABLE.' dept ON dept.dept_id=topic.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON pri.priority_id=topic.priority_id ';
$services=db_query($sql.' ORDER BY topic');
...and add a Table Header for the Default column (~Line 21).
Default
/include/class.topic.php
Modify the load() function like this (~Line 51)...
$this->autoresp=$info?false;
$this->default_topic=$info?true;
$this->info=$info;
...and modify the save() function to add this section to make sure that only one item is set default (~Line 126)...
if ($vars) {
$sql='UPDATE '.TOPIC_TABLE.' SET isdefault = 0'; db_query($sql);
$sql='UPDATE '.TOPIC_TABLE.' SET isdefault = 1 WHERE topic_id = '.$id; db_query($sql);
}
...and lastly, the if(!$errors) item needs to be updated (~Line 140).
',isactive='.db_input($vars).
',isdefault='.db_input($vars).
',noautoresp='.db_input(isset($vars)?1);