Page 1 of 1

How to display specific category to specific user?

Posted: Sat Jun 26, 2010 12:45 pm
by bexter
Latest version

Hi Klemen

how to display specific category to specific user?
i dont want to display specific category to all user when they submit a new ticket
current version just restict them to see specific category in report but not restrict when submit a new ticket.
maybe u can give me express modification, no need waiting for 2.3 version

thanks Klemen

Posted: Sat Jun 26, 2010 5:07 pm
by Klemen
You mean so that a staff member may only post a new ticket to the category he/she is allowed in?

Haven't tested it, but you can try opening admin/new_ticket.php and changing

Code: Select all

$sql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'categories` ORDER BY `cat_order` ASC'; 
with

Code: Select all

$sql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'categories` WHERE '.hesk_myCategories('id').' ORDER BY `cat_order` ASC'; 

Posted: Sat Jun 26, 2010 5:47 pm
by bexter
thats what i mean
thank u very much klemen!! it's working
:D
my problem settle for submit new ticket

actually fyi i want to use category as department thats why i want restrict certain category to my users

but in report menu > choose report type> ticket per category
user still can see all category.what can i do?

Posted: Sat Jun 26, 2010 6:05 pm
by bexter
one more problem
my user still can move tickets to the category he/she is not allowed in

i think i can modify in admin/admin_ticket.php

Code: Select all

    	<form style="margin-bottom:0;" action="move_category.php" method="post">
    	'.$category['name'].'&nbsp;&nbsp;&nbsp;<i>'.$hesklang['move_to_catgory'].'</i> <select name="category">
	    <option value="" selected="selected">'.$hesklang['select'].'</option>
        '.$categories_options.'
        </select>
	    <input type="submit" value="'.$hesklang['move'].'" class="orangebutton" onmouseover="hesk_btn(this,\'orangebuttonover\');" onmouseout="hesk_btn(this,\'orangebutton\');" /><input type="hidden" name="track" value="'.$trackingID.'" />
        <input type="hidden" name="token" value="'.hesk_token_echo(0).'" />
        </form>
but i have no idea :D

Posted: Sat Jun 26, 2010 7:40 pm
by Klemen
Try using the same logic in other SQL statements extracting data from the categories table. Or, if you need more customization, consider hiring someone who can help you out.