Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Auto Assign ticket to the staff member that created it

I have implemented the mod to add the "assign to" drop down when creating a new ticket

image

We have a pretty small support team right now, so I am trying to make it so that this drop down by default selects the staff member who is creating the ticket while still allowing the option to select a different staff member.


This is the current code
<select id=\"staffId\" name=\"staffId\">
<option value=\"0\" selected=\"selected\">-Assign To Staff-</option>
<?
//TODO: make sure the user's group is also active....DO a join.
$sql=' SELECT staff_id,CONCAT_WS(\", \",lastname,firstname) as name FROM '.STAFF_TABLE.' WHERE isactive=1 AND onvacation=0 ';
$depts= db_query($sql.' ORDER BY lastname,firstname ');
while (list($staffId,$staffName) = db_fetch_row($depts)){
$selected = ($info['staffId']==$staffId)?'selected':''; ?>
<option value=\"<?=$staffId?>\"<?=$selected?>><?=$staffName?></option>
<?
}?>
</select><font class='error'><b>*</b>&nbsp;<?=$errors['staffId']?></font>
&nbsp;&nbsp;&nbsp;
<BR><input type=\"checkbox\" name=\"alertstaff\" <?=(!$errors || $info['alertstaff'])? 'checked': ''?>>Send alert to assigned staff.



I don't really know php too well but I think I should be using $thisuser to determine the current logged in staff but I really don't know php to well and everything I try wont load the newticket page.

Comments

  • figured it out

    I think this works.
    Again, I am an amateur so any suggestions would be appreciated.

    between this
    <select id=\"staffId\" name=\"staffId\">     


    and this
    <?
    //TODO: make sure the user's group is also active....DO a join.
    $sql=' SELECT staff_id,CONCAT_WS(\", \",lastname,firstname) as name FROM '.STAFF_TABLE.' WHERE isactive=1 AND onvacation=0 ';



    add this
    /* This sets the default as the staff member that created the ticket.*/
    <?
    $default=$thisuser->getId();
    $defaultname=$thisuser->getName();
    ?>
    <option value=\"<?=$default?>\" selected=\"selected\"><?=$defaultname?></option>
  • Is this on the viewticket.inc.php page?
  • Nevermind, I found it also on the newticket.inc.php which is where I needed to make that change.

    Thank you so much for this! I've been looking all over trying to figure this one out!!!
  • Updated for 1.7

    With just a small change this also works for 1.7



    /* This sets the default as the staff member that created the ticket.*/
    <?
    $default=$thisstaff->getId();
    $defaultname=$thisstaff->getName();
    ?>
    <option value=\"<?=$default?>\" selected=\"selected\"><?=$defaultname?></option>



    ~Cheers
  • edited November 2013
    Hi Roinokae, this is really great and I need to install on 1.7.2 going 3 but in which file does the mod go ?
Sign In or Register to comment.