Is there a simple way to set the Department to a default when creating a new ticket in the Staff interface? For example, I'd like to set Support as the default I'm just not sure exactly where to do this.

default department

By default if a department is not selected then the dept_id value is zero. To achieve what you want you would insert an if statement when setting up the string for the sql statement (located in class.ticket.php about line 1385). You will need to find the department value from your sql table, in the example below I'm using '2'.

For example the original code:

$sql= 'INSERT INTO '.TICKET_TABLE.' SET created=NOW() '.

',ticketID='.db_input($extId).

',dept_id='.db_input($deptId).

',topic_id='.db_input($topicId).

',priority_id='.db_input($priorityId).

',email='.db_input($var).

',name='.db_input(Format:($var)).

',subject='.db_input(Format:($var)).

',helptopic='.db_input(Format:($topicDesc)).

',phone="'.db_input($var,false).'"'.

',phone_ext='.db_input($var?$var:'').

',ip_address='.db_input($ipaddress).

',source='.db_input($source);

would become:

$sql= 'INSERT INTO '.TICKET_TABLE.' SET created=NOW() '.

',ticketID='.db_input($extId);

if (!db_input($deptId)) {

$sql.=',dept_id=2';

} else {

$sql.=',dept_id='.db_input($deptId);

}

$sql.=',topic_id='.db_input($topicId).

',priority_id='.db_input($priorityId).

',email='.db_input($var).

',name='.db_input(Format:($var)).

',subject='.db_input(Format:($var)).

',helptopic='.db_input(Format:($topicDesc)).

',phone="'.db_input($var,false).'"'.

',phone_ext='.db_input($var?$var:'').

',ip_address='.db_input($ipaddress).

',source='.db_input($source);

Thanks for the reply. The department value is 1 from the database. When I copy and replace the code in the class.ticket.php file for some reason I'm unable to load any of the pages in the ticket system. I then reverted back to the original code and everything worked fine. Any ideas what might be causing it to not work properly?

Thanks for the reply. The department value is 1 from the database. When I copy and replace the code in the class.ticket.php file for some reason I'm unable to load any of the pages in the ticket system. I then reverted back to the original code and everything worked fine. Any ideas what might be causing it to not work properly?

I have corrected the code, I had a character out of place.

I updated the code in the class.ticket.php file. Now the ticket staff center opens fine however when I go to add a new ticket the department field is not pre-populated. Is there something else we might be missing?

20 days later

Any ideas on this? Its been awhile and I never heard back.

22 days later

Setting Department Default

Hi Hoffmana,

In our use of OSTciket we only have 1 department ("support") and I want to set this as the default for tickets created by staff. It seems silly to have to satisfy a required field when there is only one valid option anyway...

Did you ever get an answer to this issue or did you figure it out?

Thanks

Alec

8 months later

Setting Department Default

You will need to find the department value from your sql table, in the example below I'm using '1'.

Edit include\staff\newticket.inc.php as follows:

Below:

add:

then comment out the whole Department row so that it is not shown:

Department:

Select Department

<?

$services= db_query('SELECT dept_id,dept_name FROM '.DEPT_TABLE.' ORDER BY dept_name');

while (list($deptId,$dept) = db_fetch_row($services)){

$selected = ($info==$deptId)?'selected':''; ?>

"<?=$selected?>><?=$dept?>

<?

}?>

 * <?=$errors?>

Write a Reply...