Can we assign ticket to whoever created it from admin panel?
Moderator: mkoch227
Can we assign ticket to whoever created it from admin panel?
As the subject reads, I am trying to find a way to automatically assign a ticket to whoever (admin/staff) creates it. The auto-assign feature doesn't really help me since I do not want one staff member to create it and get it assigned to another one.
Any thoughts?
Thank you!
Any thoughts?
Thank you!
Re: Can we assign ticket to whoever created it from admin pa
Simply select your name from the "Assign ticket to" list.
Or leave "Unassigned" and click the "Assign to me" link when the ticket is created.
Or leave "Unassigned" and click the "Assign to me" link when the ticket is created.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Can we assign ticket to whoever created it from admin pa
Thank you but that only works if you are an admin. If it's staff they don't have that option when creating the ticket. I'm looking for a way to automatically do this when the user submits the form without asking them
Thank you
Thank you
Re: Can we assign ticket to whoever created it from admin pa
It does work for non-admins too, just make sure they have "Can assign tickets to self" feature selected.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Can we assign ticket to whoever created it from admin pa
Got you, thank you!
Re: Can we assign ticket to whoever created it from admin pa
hey, here's a way to make it so you never have an unassigned ticket or assigned to the wrong user...
to your /admin/new_ticket.php add
right below
to /language/en/text.php add
around line 50-60 under /* ERROR MESSAGES */
to /admin/admin_submit_ticket.php add
around like 50-56
to your /admin/new_ticket.php add
Code: Select all
<option value="">-- Please select --</option>
Code: Select all
<?php echo $hesklang['asst2']; ?> <select name="owner" <?php if (in_array('owner',$_SESSION['iserror'])) {echo ' class="isError" ';} ?>>
Code: Select all
$hesklang['selectowner']='Please select owner of the ticket';
to /admin/admin_submit_ticket.php add
Code: Select all
$tmpvar['owner'] = hesk_input($_POST['owner']) or $hesk_error_buffer['owner']=$hesklang['selectowner'];
Re: Can we assign ticket to whoever created it from admin pa
would be nice to get some help, but i'm going to start researching a way to atleast have the box already selecting the logged in user i'm sure this can be done with php
if user id ="" or username select option for their username in the owner drop down .. maybe i'd have to do this for every user id or something.... but i wouldn't care...
if user id ="" or username select option for their username in the owner drop down .. maybe i'd have to do this for every user id or something.... but i wouldn't care...
Re: Can we assign ticket to whoever created it from admin pa
I don't use ticket assignment at all. So I just set EVERY ticket to Ower = 1, here is how I did it.
open /inc/admin_submit_ticket.php
find
Replace with
You would have to do something similar for submit_ticket.php also.
open /inc/admin_submit_ticket.php
find
Code: Select all
/* Owner */
$owner = 0;
if (hesk_checkPermission('can_assign_others',0))
{
$owner = intval($_REQUEST['owner']);
/* If ID is -1 the ticket will be unassigned */
if ($owner == -1)
{
$owner = 0;
}
/* Automatically assign owner? */
elseif ($owner == -2 && $hesk_settings['autoassign'] == 1)
{
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
if ($autoassign_owner)
{
$owner = $autoassign_owner['id'];
$history .= sprintf($hesklang['thist10'],hesk_date(),$autoassign_owner['name'].' ('.$autoassign_owner['user'].')');
}
else
{
$owner = 0;
}
}
/* Check for invalid owner values */
elseif ($owner < 1)
{
$owner = 0;
}
else
{
/* Has the new owner access to the selected category? */
$sql = "SELECT `name`,`isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`=".hesk_dbEscape($owner)." LIMIT 1";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) == 1)
{
$row = hesk_dbFetchAssoc($res);
if (!$row['isadmin'])
{
$row['categories']=explode(',',$row['categories']);
if (!in_array($tmpvar['category'],$row['categories']))
{
$_SESSION['isnotice'][] = 'category';
$hesk_error_buffer['owner']=$hesklang['onasc'];
}
}
}
else
{
$_SESSION['isnotice'][] = 'category';
$hesk_error_buffer['owner']=$hesklang['onasc'];
}
}
}
elseif (hesk_checkPermission('can_assign_self',0) && hesk_okCategory($tmpvar['category'],0) && !empty($_POST['assing_to_self']))
{
$owner = intval($_SESSION['id']);
}
Code: Select all
/* Owner */
$owner = 1;
-Steve
Re: Can we assign ticket to whoever created it from admin pa
You want the owner drop down box in admin/new_ticket.php to show the name of the currently logged in user?dr_patso wrote:would be nice to get some help, but i'm going to start researching a way to atleast have the box already selecting the logged in user i'm sure this can be done with php
if user id ="" or username select option for their username in the owner drop down .. maybe i'd have to do this for every user id or something.... but i wouldn't care...
-Steve
Re: Can we assign ticket to whoever created it from admin pa
it's not a huge deal really.
But i'd like to modify it so it automatically selects the logged in user in the drop down, that way the user doesn't have to mess with it unless they want to assign it to somebody else.
But i'd like to modify it so it automatically selects the logged in user in the drop down, that way the user doesn't have to mess with it unless they want to assign it to somebody else.
Re: Can we assign ticket to whoever created it from admin pa
i turned auto assign.. it can't be hard to change the logic in the auto assign function in admin_submit_ticket to just choose to sessions user ID as the value if auto assigned is selected
Re: Can we assign ticket to whoever created it from admin pa
ah here we go.. I think I nailed it, can someone confirm? enable auto assign tickets then
in admin_submit_ticket.php I changed...
to
change the line 115 for me to
in admin_submit_ticket.php I changed...
Code: Select all
/* Automatically assign owner? */
elseif ($owner == -2 && $hesk_settings['autoassign'] == 1)
{
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
if ($autoassign_owner)
{
$owner = $autoassign_owner['id'];
Code: Select all
/* Automatically assign owner? */
elseif ($owner == -2 && $hesk_settings['autoassign'] == 1)
{
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
if ($autoassign_owner)
{
$owner = $_SESSION['id'];
Code: Select all
$owner = $autoassign_owner['id'];
Code: Select all
$owner = $autoassign_owner['id'];
Re: Can we assign ticket to whoever created it from admin pa
this has been working for me for about 10 tickets on 3 different users.... I'm scared some other conditional logic will cause it not to work in the future... Klemen if you have time could you approve this as a way for auto assign to always assign to the logged in user??
i don't use the customer interface, if i did i would modify it to not use the auto assign function.
i don't use the customer interface, if i did i would modify it to not use the auto assign function.
Re: Can we assign ticket to whoever created it from admin pa
Here is how I would do it.
Change
To
That way I don't have to worry about any other variables.
Change
Code: Select all
/* Owner */
$owner = 0;
if (hesk_checkPermission('can_assign_others',0))
{
$owner = intval($_REQUEST['owner']);
/* If ID is -1 the ticket will be unassigned */
if ($owner == -1)
{
$owner = 0;
}
/* Automatically assign owner? */
elseif ($owner == -2 && $hesk_settings['autoassign'] == 1)
{
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
if ($autoassign_owner)
{
$owner = $autoassign_owner['id'];
$history .= sprintf($hesklang['thist10'],hesk_date(),$autoassign_owner['name'].' ('.$autoassign_owner['user'].')');
}
else
{
$owner = 0;
}
}
/* Check for invalid owner values */
elseif ($owner < 1)
{
$owner = 0;
}
else
{
/* Has the new owner access to the selected category? */
$sql = "SELECT `name`,`isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`=".hesk_dbEscape($owner)." LIMIT 1";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) == 1)
{
$row = hesk_dbFetchAssoc($res);
if (!$row['isadmin'])
{
$row['categories']=explode(',',$row['categories']);
if (!in_array($tmpvar['category'],$row['categories']))
{
$_SESSION['isnotice'][] = 'category';
$hesk_error_buffer['owner']=$hesklang['onasc'];
}
}
}
else
{
$_SESSION['isnotice'][] = 'category';
$hesk_error_buffer['owner']=$hesklang['onasc'];
}
}
}
elseif (hesk_checkPermission('can_assign_self',0) && hesk_okCategory($tmpvar['category'],0) && !empty($_POST['assing_to_self']))
{
$owner = intval($_SESSION['id']);
}
Code: Select all
$owner = $_SESSION['id'];
-Steve
Re: Can we assign ticket to whoever created it from admin pa
hm that breaks the ability to assign to others if needed...
what about this ? The /* Automatically assign owner? */ is the only section that addresses the -2 (auto assign) value... so it should be okay no??
what about this ? The /* Automatically assign owner? */ is the only section that addresses the -2 (auto assign) value... so it should be okay no??
Code: Select all
/* Owner */
$owner = 0;
if (hesk_checkPermission('can_assign_others',0))
{
$owner = intval($_REQUEST['owner']);
/* If ID is -1 the ticket will be unassigned */
if ($owner == -1)
{
$owner = 0;
}
/* Automatically assign owner? */
elseif ($owner == -2 && $hesk_settings['autoassign'] == 1)
{
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
if ($autoassign_owner)
{
$owner = $_SESSION['id'];
}
else
{
$owner = 0;
}
}
/* Check for invalid owner values */
elseif ($owner < 1)
{
$owner = 0;
}
else
{
/* Has the new owner access to the selected category? */
$sql = "SELECT `name`,`isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`=".hesk_dbEscape($owner)." LIMIT 1";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) == 1)
{
$row = hesk_dbFetchAssoc($res);
if (!$row['isadmin'])
{
$row['categories']=explode(',',$row['categories']);
if (!in_array($tmpvar['category'],$row['categories']))
{
$_SESSION['isnotice'][] = 'category';
$hesk_error_buffer['owner']=$hesklang['onasc'];
}
}
}
else
{
$_SESSION['isnotice'][] = 'category';
$hesk_error_buffer['owner']=$hesklang['onasc'];
}
}
}
elseif (hesk_checkPermission('can_assign_self',0) && hesk_okCategory($tmpvar['category'],0) && !empty($_POST['assing_to_self']))
{
$owner = intval($_SESSION['id']);
}