PDA

View Full Version : [MOD] Show "Assigned To" in Ticket View


webPragmatist
08-14-2008, 06:20 PM
Hello again,

The code below allows you to show the person the ticket is assigned to in the staff control panel. I include a few of the previous lines to help you find where to paste the code as always.

/include/staff/tickets.inc.php (line 157)
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default...if all fails.
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;

// *** Edited by webPragmatist
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist

/include/staff/tickets.inc.php (line 330)
<th width="110">
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th>
<!-- Addition by webPragmatist -->
<th width="150" ><a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Assignee <?=$negorder?>">Assigned To</a></th>
<!-- End addition by webPragmatist -->

/include/staff/tickets.inc.php (line 367)
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=($row['username']) ? $row['username'] : 'Not assigned';?></td>
<!-- End addition by webPragmatist -->

/include/staff/tickets.inc.php (line 140)
endif;

//I admit this crap sucks...but who cares??
// Addition by webPragmatist
$sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'username');
// End addition by webPragmatist

Thanks Tonyb for the sorting addition!

Tonyb
08-19-2008, 05:34 PM
great Work

webPragmatist
08-19-2008, 06:46 PM
great Work
Glad I could help!

gabi_cavaller
08-21-2008, 06:32 AM
This was perfect for me too, so clear to follow and works.

Thank you ever so much.

Have you done any other modifications that could help ?

Tonyb
08-22-2008, 03:06 AM
<a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Assigned To</a></th>

//I admit this crap sucks...but who cares??
$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','ass'=>'username');

also in the same file tickets.inc.php

adding this to your above mentioned mod will allow you to also sort it using the assigned to field.

saaiber
08-22-2008, 03:08 AM
<a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Assigned To</a></th>

//I admit this crap sucks...but who cares??
$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','ass'=>'username');

also in the same file tickets.inc.php

adding this to your above mentioned mod will allow you to also sort it using the assigned to field.

Where exactly can I put this code? Can you give me some linenumbers as reference please?

Grtz,

Nic

Tonyb
08-22-2008, 06:56 AM
line 330 for the first part

and line 140 for 2nd part.

just first do the above webPragmatist part.

IanBrooks
08-22-2008, 10:00 AM
I've followed the instructions for this to the letter, and although it shows the "assigned to" column, it doesn't matter who I assign a ticket to, it always shows the as unassigned in the list view. Is there a reason that this is happening? Have I forgotten to change something I should have done?

Thanks

SLMHC
08-22-2008, 10:10 AM
Just tested mine and this mod works like a charm.
________
volcano vaporizers (http://vaporizer.org/reviews)

webPragmatist
08-22-2008, 10:12 AM
@ Tonyb,
Thanks for the info I will update the above code with this mod here in a few.

@IanBrooks
Most likely this is because your $row['username'] is empty. Try:
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=$row['username']; ?></td>
<!-- End addition by webPragmatist -->
for the last edit just to see if it echos anything.

IanBrooks
08-22-2008, 10:47 AM
@ Tonyb,
Thanks for the info I will update the above code with this mod here in a few.

@IanBrooks
Most likely this is because your $row['username'] is empty. Try:
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=$row['username']; ?></td>
<!-- End addition by webPragmatist -->
for the last edit just to see if it echos anything.

I've tried that, and I now get the "Assigned to" column but it's blank all the way down. Any ideas on where I'm going wrong here?

IanBrooks
08-27-2008, 05:56 AM
Still not having any luck with this, is there a way that I can check the contents of $row['username'] to ensure that it isn't empty?

stendum
08-27-2008, 10:27 AM
For you guys who is having problems regarding seeing: "Not Assigned To" you need to comment away the original query on row: 171.

/* RS: Removed
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
*/

webPragmatist
08-27-2008, 01:57 PM
For you guys who is having problems regarding seeing: "Not Assigned To" you need to comment away the original query on row: 171.

/* RS: Removed
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
*/

Thanks for helping out! With any of the MODS I do I try to include the line prior and after so be sure to pay attention :)

IanBrooks
08-28-2008, 09:45 AM
I've done that too, and it still isn't working! Could it be something to do with the names of tables within the database or something of that nature?

Everything within osticket works fine, and when I go into a ticket it tells me who it's assigned to, so it must be that this is pointing somewhere incorrectly!

IanBrooks
08-29-2008, 07:15 AM
Just to let you all know, this is now working, not sure what I did exactly, but after looking at the contents of the table using MySQL administrator to ensure it contained data, it just started working!

Thanks for all your help

jpowers40828
09-03-2008, 05:34 PM
I added a cool feature to your code, where if the ticket is unassigned, a link shows up allowing the logged in user to "claim" it.

http://www.osticket.com/forums/showthread.php?t=1123 (http://www.osticket.com/forums/showthread.php?t=1123)

spances
09-18-2008, 03:38 AM
Hello, i tried this add but its shows me like IanBrooks...
I tried to locate 'username' field in table database but i didnt found it.
Can i get some directions...?
Thank you.

spances
09-18-2008, 03:58 AM
i found username in staff table but is still not working
the qselect and qfrom part is deleted right now and the username part is like

<td nowrap><?=$row['username']; ?></td>

webPragmatist
09-18-2008, 10:28 AM
i found username in staff table but is still not working
the qselect and qfrom part is deleted right now and the username part is like

<td nowrap><?=$row['username']; ?></td>

I don't follow, the qselect and qfrom part is deleted? :confused:

spances
09-19-2008, 05:38 AM
yes, i follow the idea from:
For you guys who is having problems regarding seeing: "Not Assigned To" you need to comment away the original query on row: 171.

/* RS: Removed
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
*/

dajaes
10-22-2008, 07:59 PM
Thanks for a great mod. Worked perfectly first time. Hopefully this will be included in the next version.
________
RC111 (http://www.cyclechaos.com/wiki/Honda_RC111)

v100
10-29-2008, 12:12 PM
Mis-posted...sorry

Nyquest
02-09-2009, 01:29 AM
I know this is a bit late of a response, but for anyone having problems with the getting 'Not Assigned' Listing, I'll clarify what Stendum already said, as it is the proper fix.


In Web's addition you'll see:

/include/staff/tickets.inc.php (line 157)
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default...if all fails.
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;

// *** Edited by webPragmatist
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist


If you look directly below this, the next lines should be something like:
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';

These lines need to be commented out. To comment them out you replace them with what Stendum said, shown here:

/* RS: Removed
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
*/

After adding Stendums fix, Web's code worked great for me!

Regards,

kiwifan
02-26-2009, 02:08 AM
/include/staff/tickets.inc.php (line 140)
...........
'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'username');



should be

'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','ass'=>'username');

ahs10
03-17-2009, 12:20 PM
in the last part of your instructions for /include/staff/tickets.inc.php (line 140), you need to comment out the old $sortOptions array, otherwise it won't sort correctly. the code should look like this instead....


endif;

//I admit this crap sucks...but who cares??
// Addition by webPragmatist
$sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'username');
// End addition by webPragmatist
//$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name');

wyotriumphrider
04-01-2009, 11:27 AM
I have but one small problem, now...ticket assignments do not show in completed tickets...
They ALL show unassigned in closed ticket view...

Thanks, and great work!

craigreilly
04-01-2009, 12:19 PM
That is a function of the code.
around line 330 of class.ticket.php I removed
staff_id=0,
and now my assigned staff remain when a ticket is closed.

wyotriumphrider
04-01-2009, 03:39 PM
I deleted the cited text. My php looks like this now, but the closed tickets all still show not assigned...
Did I screw something up?

//Close the ticket
function close(){

$sql= 'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',isoverdue=0,updated= NOW(),closed=NOW() '.
' WHERE ticket_id='.db_input($this->getId());
return (db_query($sql) && db_affected_rows())?true:false;

Thanks for the assist!

wyotriumphrider
04-01-2009, 03:57 PM
Your script deletion indeed did the trick. All newly closed tickets are showing the assignee, though those closed prior to this mod are still showing "not assigned".
I'll take it, though!!

Thanks!

craigreilly
04-02-2009, 12:56 PM
Luckily I caught this early and only had 15 tickets in the system. There were only 2 staffers responding so I knew who worked on what and updated the table accordingly.
Glad I could help...

alexjhart
04-02-2009, 05:21 PM
webPragmatist,

do you plan on updating your original post to include the recent fixes?

alexjhart
04-02-2009, 06:15 PM
should be

'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','ass'=>'username');

I was having trouble seeing the difference at first. The problem above is the space between dept and _name in 'dept _name'.

Thanks kiwifan

tompangborn
04-07-2009, 12:30 PM
First, thank you WebPragmatist very useful modification. I finally got it working correctly. Sorting was giving me fits until I found the space in the typo posted by Kiwifan, it's all good now and I can't believe I got through my first modification w/o getting beat up very much.

Thank you all!
Tom

MPGehrisch
04-08-2009, 11:49 AM
Thanks for a great MOD! It will make it much easier for us to keep track of our support tickets. Works like a charm!

-MG

talen7
07-28-2009, 02:53 PM
After making all the changes (typo and commenting out old sort string and old query) i receive the following in the Admin Dashboard:

[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username ,status,source,isoverdue,ticket.created,pri.* ,count(attach.attach_id) as attachments FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND status='open' AND isanswered=0 GROUP BY ticket.ticket_id ORDER BY priority_urgency,ticket.created DESC LIMIT 0,25]

Not unique table/alias: 'pri'

Ideas?

jrex
07-28-2009, 05:47 PM
After making all the changes (typo and commenting out old sort string and old query) i receive the following in the Admin Dashboard:



Ideas?

I got the same thing this morning. After I made changes to the original mod in tickets.inc.php to comment (//) out the following lines it worked.

// *** Edited by webPragmatist
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username '.
',ticket.status,ticket.source,isoverdue,isanswered ,ticket.created,pri.* ,count(attach.attach_id) as attachments';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
// ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
// ' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist

scottro
08-05-2009, 11:18 AM
Has anyone gotten this to work with recent editions of osTickets? I've tried all the different edits as well and have had no success. Either all the tickets show unassigned or I get no tickets to show up at all (even though it shows that we have open tickets up above).

scottro
08-05-2009, 11:47 AM
Ok, with some further testing I got everything working.

The following is what I have for all of my entries. I will include one line prior to the code so you can search for where to enter it.

All entries are in include/staff/tickets.inc.php

~Line 171
//I admit this crap sucks...but who cares??
// Addition by webPragmatist
$sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'firstname');
// End addition by webPragmatist
//$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name');

~Line 198
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default...if all fails.
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;

// *** Edited by webPragmatist
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname '.
',ticket.status,ticket.source,isoverdue,ticket.cre ated,pri.*,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
// ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
// ' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist

/*
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',ticket.status,ticket.source,isoverdue,isanswered ,ticket.created,pri.* ,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket '.
' LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id ';
*/

~Line 392
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th>
<!-- Addition by webPragmatist -->
<th width="150" ><a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Assignee <?=$negorder?>">Assigned To</a></th>
<!-- End addition by webPragmatist -->

~Line 435
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=($row['firstname']) ? $row['firstname'] : '&nbsp;';?>&nbsp;<?=($row['lastname']) ? $row['lastname'] : '';?></td>
<!-- End addition by webPragmatist -->

You may notice that my entries have firstname and lastname instead of username as I wanted to have the full name show up of the person thats been assigned to it instead of just a username.

Please let me know if you have any issues with any of this.

Thanks

talen7
08-07-2009, 04:15 PM
I just tried this and am getting the following error:

[SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastn\
ame ,ticket.status,ticket.source,isoverdue,ticket.crea ted,pri.*,count(attach.attach_id) as attachments ,count(attach.attach_id) as attachments FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND status='open' AND isanswered=0 GROUP BY ticket.ticket_id ORDER BY priority_urgency,ticket.created DESC LIMIT 0,25]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\
ame ,ticket.status,ticket.source,isoverdue,ticket.crea ted,pri.*,count(attach.a' at line 1

talen7
08-07-2009, 04:17 PM
Nevermind ... I'm a dofus. :o

Working great!

Thanks.

mango
08-20-2009, 04:14 PM
Added a little code to allow search by user
Edit include/staff/tickets.inc.php

Line ~144
Before //department
ADD
//assignment-staffid
if($_REQUEST['staffid']) {
//This is staffid based search
$qwhere.=' AND ticket.staff_id='.db_input($_REQUEST['staffid']);
$qstr.='&staffid='.urlencode($_REQUEST['staffid']);
}


Line ~305
After
<option value="<?=$deptId?>"<?=$selected?>><?=$deptName?></option>
<?
}?>
</select>
</td>
ADD
<td>Staff:</td>
<td><select name="staffid"><option value=0>All Staff</option>
<?
//Showing only departments the user has access to...
$sql='SELECT staff_id,username FROM '.STAFF_TABLE;

$staff= db_query($sql);
while (list($staffId,$username) = db_fetch_row($staff)){
$selected = ($_GET['staffid']==$staffId)?'selected':''; ?>
<option value="<?=$staffId?>"<?=$selected?>><?=$username?></option>
<?
}?>
</select>
</td>

Skeyelab
08-21-2009, 12:49 PM
i am still getting "Not Assigned"

i am using the most recent version of osticket.

i have tried both webPragmatist and scottro's versions

any idea?

userpoint
09-06-2009, 09:22 AM
I am using the latest version of OSticket.
Pretty tried everything whats been written in this thread.

But still saying "not assigned"

Any updates?


Brgds,

chiefer
09-22-2009, 04:28 PM
Just so you all know, I have to newest version of osTicket and I was having the "Not Assigned" issue and this post fixed it for me! : )


Ok, with some further testing I got everything working.

The following is what I have for all of my entries. I will include one line prior to the code so you can search for where to enter it.

All entries are in include/staff/tickets.inc.php

~Line 171
//I admit this crap sucks...but who cares??
// Addition by webPragmatist
$sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'firstname');
// End addition by webPragmatist
//$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name');

~Line 198
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default...if all fails.
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;

// *** Edited by webPragmatist
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname '.
',ticket.status,ticket.source,isoverdue,ticket.cre ated,pri.*,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
// ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
// ' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist

/*
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',ticket.status,ticket.source,isoverdue,isanswered ,ticket.created,pri.* ,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket '.
' LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id ';
*/

~Line 392
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th>
<!-- Addition by webPragmatist -->
<th width="150" ><a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Assignee <?=$negorder?>">Assigned To</a></th>
<!-- End addition by webPragmatist -->

~Line 435
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=($row['firstname']) ? $row['firstname'] : '&nbsp;';?>&nbsp;<?=($row['lastname']) ? $row['lastname'] : '';?></td>
<!-- End addition by webPragmatist -->

You may notice that my entries have firstname and lastname instead of username as I wanted to have the full name show up of the person thats been assigned to it instead of just a username.

Please let me know if you have any issues with any of this.

Thanks

search engine optimisation techniques (http://www.seomediasite.com)
locksmith (http://www.denverlocksmiths.com)

mianos
09-23-2009, 08:45 AM
hey guys,
i'm on v1.6 RC5

ist there /osticket/include/staff/tickets.inc.php customized for the current osticket version? or will it be included to the next RC?
i think all these mods will make updates in the future very complicated till impossible... wouldn't it be much better to submit the code to the project itself (cvs/svn/git whateve is used) ?

i would like to see the feature in the ticket-view
- field for staff-username(or full name)
- sort by ^^
- a "assign to me"-Button
- a pull menu where i can pick users and assign

drozenski
09-23-2009, 11:22 AM
Nevermind ... I'm a dofus. :o

Working great!

Thanks.



What did you do to fix this error?

SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name ,ticket.status,ticket.source,isoverdue,isanswered, ticket.created,pri.* ,count(attach.attach_id) as attachments ,count(attach.attach_id) as attachments FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND status='open' AND isanswered=0 GROUP BY ticket.ticket_id ORDER BY dept _name DESC LIMIT 0,25]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '_name DESC LIMIT 0,25' at line 1



Nothing i do will get that to go away and the names of the people that are assigned to the tickets arnt showing up.

amlife
09-29-2009, 12:16 PM
Worked with V 1.6 RC 5 :D

Dano1
10-01-2009, 11:19 AM
I applied this mod to my company's ticket system and although it worked fine I found that my search feature no longer worked, whatever I typed in it would come up with 0 results, I also received several messages like the one below.

[SELECT COUNT(DISTINCT ticket.ticket_id) FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id WHERE (ticket.dept_id IN (1) OR ticket.staff_id=2) AND ( ticket.email LIKE '%test%' OR ticket.name LIKE '%test%' OR responses.response LIKE '%test%' OR ticket.subject LIKE '%test%' ) ] - Unknown column 'responses.response' in 'where clause'

Each message was diffrent but they all ended with the "Unknown column 'responses.response' in 'where clause'", is anyone else having this problem, or know of a solution.

I also have this (http://osticket.com/forums/showthread.php?t=699) mod installed as well so I don't know if they are conflicting or something, the search mod worked fine without the assigned one, I haven't tried the other way yet.

Dano1
10-02-2009, 05:31 AM
After going through the steps one by one I found that the problem appeared when doing the following step.

For you guys who is having problems regarding seeing: "Not Assigned To" you need to comment away the original query on row: 171.

/* RS: Removed
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
*/

It looks like that the previous person who worked on the system in my company installed a mod that added in the 'responses.response' section, so I just had to put responses.response into the $qselect ='SELECT' section and copy some other items from my previous code to the new one.

My code now looks like this and it works fine.

$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username,responses.response'.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_RESPONSE_TABLE.' responses ON ticket.ticket_id=responses.ticket_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';

gottoast
10-15-2009, 06:23 PM
I made the following mod as the assigned to field was blank and when I go to edit a ticket and close it the ticket still stays on the My Tickets page yet when I go to the Closed Tickets page I see it there now with the assigned show up.

How do I get it off the My Tickets Page? Any ideas?

Luckily I caught this early and only had 15 tickets in the system. There were only 2 staffers responding so I knew who worked on what and updated the table accordingly.
Glad I could help...

scottro
11-04-2009, 04:22 PM
It was requested of me that I combine the "Assigned To" MOD along with my own MOD "Age of Tickets". As I'm tired of updating multiple places for both of these MODs I have set them up over at my own site. Please see the following article and request assistance there.

http://tinyurl.com/age-assigned

Thank you,
Scott

royale
11-09-2009, 10:00 AM
Hey guys,
is it also possible to show the ticket count in Ticket View, like in the viewticket.php?

Regards
David

scottro
11-09-2009, 10:50 AM
David,

I'm not following what it is that you are requesting. Can you be more descriptive or perhaps post a pic of what you would like to see?

royale
11-09-2009, 11:32 AM
Hi!
maybe this picture will make it clearer... The "(XX)" is already fully functionally clickable, but i dont know how to show the ticket count in the ticket overview. The function in viewticket.inc.php should be getRelatedTicketsCount(). I posted the request in this topic because i thought the problem might be familiar.

http://s4.directupload.net/images/091109/u8h3m38h.jpg

scottro
11-09-2009, 12:46 PM
David,

I'm not having much luck so far. Can you send what code you do have so far that gets the (XX) to show up?

royale
11-09-2009, 01:28 PM
<a href="tickets.php?a=search&query=<?=Format::truncate($row['email'])?>" title="Related Tickets">(XX)
</a>

scottro
11-12-2009, 11:58 AM
Thanks, I'm working on a few other things at present but I'll return to it when I can.

scottro
11-12-2009, 12:02 PM
There is an issue with MySQL that it is unable to count past 3020399 seconds (or 838:59:59). I have added a few lines of code and you can check this out over at my previously mentioned page:

http://tinyurl.com/age-assigned

royale
11-12-2009, 12:25 PM
If you want to show the time passed to last general activity in this ticket (created,last response,last message) you can try this (tickets first sorted by last activity):

(please regard that this is a modification of THIS (http://sudobash.net/index.php?view=article&catid=46%3Aosticket&id=71%3Aqassigned-toq-and-qage-of-ticketsq&option=com_content&Itemid=111)mod)

/include/staff/tickets.inc.php

$sortOptions=array('timeopen'=>'timeopen','date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','ass'=>'firstname');


$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname '.',ticket.status,ticket.source,isoverdue,ticket.c reated,pri.*,CASE WHEN status = "open" THEN FLOOR(TIME_TO_SEC(TIMEDIFF(now(),ticket.lastmessag e))/60) ELSE FLOOR(TIME_TO_SEC(TIMEDIFF(ticket.closed,ticket.la stmessage))/60) END AS timeopen,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';

Might be more significant than just to sort it by date of creation! :)

ksdprasad
11-12-2009, 04:44 PM
how to add resolved by column for closed ticket page? i am using $ticket->staff_id but this is showing 0. how can i get resolved/closed by person name for a closed ticket.

scottro
11-13-2009, 04:34 PM
how to add resolved by column for closed ticket page? i am using $ticket->staff_id but this is showing 0. how can i get resolved/closed by person name for a closed ticket.
Are you saying you want a column that shows who it was assigned to or who actually closed it?

Let me know and I'll check it out.

scottro
11-13-2009, 06:09 PM
I don't believe this is exactly what you are looking for, however, this is a simple mod that you can do in order to tell who closed and reopened a ticket:

include/class.ticket.php
Inside of the function close(){ information just above the return line add the following:
$this->postNote('Ticket Closed');
return (db_query($sql) && db_affected_rows())?true:false;

Then repeat the step down in the function reopen(){
$this->postNote('Re-Opened Ticket');
return (db_query($sql) && db_affected_rows())?true:false;

Now any time someone closes a ticket or reopens a ticket an "Internal Note" will be created stating either "Ticket Closed" or "Re-Opened Ticket".

catzemis
11-25-2009, 02:34 PM
All, after multiple db errors this finnally worked as I systematically went through the suggestions (commenting out the left joins finnally did it). Thank you all for a great job.

systech
01-27-2010, 03:47 PM
Thank you everyone for your help on this mod. There are a few things I need to clean up but its working great, thanks!

-Matt

shinshigumi
02-13-2010, 09:40 AM
helo sir,

it seems i can't apply this mod due to the lines we're changed because i applied different mods.

is there any clear guide how to apply the codes?

Thanks!

scottro
02-13-2010, 10:17 AM
If you want to send all the needed files to scott (at) sudobash (dot) net I'll take a look at them and get it working.

wyotriumphrider
05-21-2010, 09:57 AM
I've had difficulties with database errors around searching and redundant aliases whenever I try to mod ST...

Thanks!

sec
06-02-2010, 03:22 AM
Hi,

I used this method to get the message of the last response and last update from TICKET_RESPONSE_TABLE and TICKET_MESSAGE_TABLE. It works for the response table but not for the message table, I dont understand, I used the same syntax for both of it.


$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name'.
',MAX(restab.created) AS date1'.
',MAX(messtab.created) AS date2'.
',status,source,isoverdue,ticket.created,pri.*';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.TICKET_RESPONSE_TABLE.' restab ON ticket.ticket_id=restab.ticket_id'.
' LEFT JOIN '.TICKET_MESSAGE_TABLE.' messtab ON ticket.ticket_id=messtab.ticket_id'.
'';



<td nowrap><?=$row['date1']?>&nbsp; by client&nbsp;</td> <!-- Addition by me -->
<td nowrap><?=$row['date2']?>&nbsp; by staff&nbsp;</td> <!-- Addition by me -->



thanks in advance for your help!

Regards,
Sec.

ediaz
06-22-2010, 12:01 PM
hi guys,

i try to implement the code, but the data bases give me the next error DB 1066

[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username ,status,source,isoverdue,ticket.created,pri.* ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND status='open' GROUP BY ticket.ticket_id ORDER BY priority_urgency,effective_date DESC ,ticket.created DESC LIMIT 0,25]

Not unique table/alias: 'pri' 127.0.0.1
please help me!:p

ediaz
06-22-2010, 12:16 PM
dear webPragmatist


i try to implement the code, but the data bases give me the next error DB 1066

in the system logs appears>

[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username ,status,source,isoverdue,ticket.created,pri.* ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND status='open' GROUP BY ticket.ticket_id ORDER BY username ASC LIMIT 0,25]

Not unique table/alias: 'pri' 127.0.0.1


Hello again,

The code below allows you to show the person the ticket is assigned to in the staff control panel. I include a few of the previous lines to help you find where to paste the code as always.

/include/staff/tickets.inc.php (line 157)
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default...if all fails.
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;

// *** Edited by webPragmatist
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username '.
',status,source,isoverdue,ticket.created,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist/include/staff/tickets.inc.php (line 330)
<th width="110">
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th>
<!-- Addition by webPragmatist -->
<th width="150" ><a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Assignee <?=$negorder?>">Assigned To</a></th>
<!-- End addition by webPragmatist -->/include/staff/tickets.inc.php (line 367)
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=($row['username']) ? $row['username'] : 'Not assigned';?></td>
<!-- End addition by webPragmatist -->/include/staff/tickets.inc.php (line 140)
endif;

//I admit this crap sucks...but who cares??
// Addition by webPragmatist
$sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'username');
// End addition by webPragmatistThanks Tonyb for the sorting addition!

plsiskin
07-27-2010, 06:37 PM
Could someone email me the ticket.inc.php file with the changes? I addedd all the entries but the last one (line 140) kills it.

psiskin@yahoo.com

scottro
07-28-2010, 12:01 AM
Could someone email me the ticket.inc.php file with the changes? I addedd all the entries but the last one (line 140) kills it.

psiskin@yahoo.com
Did you comment out the original $sortOptions line ?

Just put the // in front of the original line and then add your new modified line. Thats probably the problem. Otherwise I will go ahead and post a "from standard" modded file.

plsiskin
07-30-2010, 04:58 PM
I think perhaps my line 140 is different. 140 on my file looks like it is in hte middle of a statement:

" OR MATCH(note.note) AGAINST('$queryterm')".
' ) ';
}else{
$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR message.message LIKE '%$queryterm%'".
" OR response.response LIKE '%$queryterm%'".
" OR note.note LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
' ) ';

scottro
07-30-2010, 05:05 PM
Ah, then don't go by the line its supposed to be on. The line can definitely be different for you or I depending on whatever other MODs and whatnot that we have in place. The important thing to do is just find the sortOptions entry and replace it with webPragmatists

plsiskin
08-13-2010, 11:30 AM
I am making progress. I see "assigned to" but that box is blank. I followed all the instructions. Is there someplace I need to modify the code and put something else in like first_name should be my name or something like that? Looking at the post the only one that I was not sure of was line 157 reference. The first 2 lines I found. The other lines I copied and pasted in after those first 2 lines. Am I suppose to replace something or add these lines?

The other lines it was obvious that I was added a new line to the code.

Sorry but who if you can be real specific on what is needed....

Something like " this first line you can cut and paste in the find tool then every line below it needs to be added"... These kind of instructions will help.

scottro
08-13-2010, 11:38 AM
Do you have any other mods in place in the tickets.inc.php file? If not I'll just send you a working file.

plsiskin
08-13-2010, 04:43 PM
No, I am using the one from the download. This is the only feature I would like right now.

psiskin@yahoo.com

Thanks

scottro
08-16-2010, 11:43 AM
Looks like you were missing the change for the qselect and qfrom code. The email I sent you with an attached file should work for you.

vflopez
08-20-2010, 11:03 AM
This is great but when I look at the closed tickets view they are all unassigned. Is there any way to get the last assigned user to display?

scottro
08-20-2010, 11:12 AM
This is great but when I look at the closed tickets view they are all unassigned. Is there any way to get the last assigned user to display?

http://sudobash.net/hacks-a-mods/osticket/66-assigned-to-column.html

See the information starting at:

Now you may notice that after you close a ticket that is assigned to someone that assignment gets removed. I have found this undesirable so we'll edit the following

maknet
09-02-2010, 03:00 PM
I've followed the instructions for this to the letter, and although it shows the "assigned to" column, it doesn't matter who I assign a ticket to, it always shows the as unassigned in the list view. Is there a reason that this is happening? Have I forgotten to change something I should have done?

Thanks

I have the same issue. The only other "mod" i did was the "display subject using JS" mod. Did you use that one too?

http://www.osticket.com/forums/showthread.php?t=4483&highlight=spam

Lawrence

scottro
09-02-2010, 04:28 PM
I have the same issue. The only other "mod" i did was the "display subject using JS" mod. Did you use that one too?

http://www.osticket.com/forums/showthread.php?t=4483&highlight=spam

Lawrence
If thats empty it probably means that its not pulling that information from the database. Are you sure you have the new code here AND have commented out the original?

$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname '.
',ticket.status,ticket.source,isoverdue,ticket.cre ated,pri.*,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
// ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
// ' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';

What it appears to be missing is the "staff.firstname,staff.lastname" from that select information. Otherwise you'd be missing alot more info too.

icepicknz
09-08-2010, 12:37 AM
This mod no longer appears to work, shows all tickets as "Not Assigned".

scottro
09-08-2010, 09:16 AM
This mod no longer appears to work, shows all tickets as "Not Assigned".Several people, myself included on a test server, all have it working on 1.6RC5 and 1.6ST. Did you get it working or do you still need help?

brouiller
09-29-2010, 01:22 PM
Hey scottro, thanks for all of your work on this. I'm having a problem. I'm running 1.6ST and the mods work. However, when I'm in the scp the 'My Tickets' only shows up if I have a ticket that's open and not answered. When I click the link that takes me to ?status=assigned, it shows all the tickets that are open including the answered ones. The number that's shown beside 'My Tickets' only counts the ones that are open and not answered.

I would like for the 'My Tickets' to show up when I have any open tickets that are assigned.

Here's a screenshot. http://i.imgur.com/jy2DW.png

Thanks again for the great mod.

scottro
10-06-2010, 04:31 PM
Hey scottro, thanks for all of your work on this. I'm having a problem. I'm running 1.6ST and the mods work. However, when I'm in the scp the 'My Tickets' only shows up if I have a ticket that's open and not answered. When I click the link that takes me to ?status=assigned, it shows all the tickets that are open including the answered ones. The number that's shown beside 'My Tickets' only counts the ones that are open and not answered.

I would like for the 'My Tickets' to show up when I have any open tickets that are assigned.

Here's a screenshot. http://i.imgur.com/jy2DW.png

Thanks again for the great mod.
http://sudobash.net/hacks-a-mods/osticket/66-assigned-to-column.html

Do you have the last section of code listed here implemented? I believe this should make it so that its showing so long as its open and assigned.

brouiller
10-06-2010, 05:02 PM
I do have the last bit implemented. It does show tickets that are open and assigned, but it doesn't show tickets that are open, assigned, and answered. (I believe the tickets are answered when you post a reply, but not closed unless you check a box to do so.)

scottro
10-08-2010, 12:07 PM
I do have the last bit implemented. It does show tickets that are open and assigned, but it doesn't show tickets that are open, assigned, and answered. (I believe the tickets are answered when you post a reply, but not closed unless you check a box to do so.)

What do you get when you run the following command from a mysql prompt or phpmyadmin? Replace '11' with your actual staff_id.

SELECT * FROM ost_ticket WHERE status='Open' AND staff_id='11'\G

Does that list both isanswered=0 AND isanswered=1 entries?

For instance I get:
mysql> SELECT * FROM ost_ticket WHERE status='Open' AND staff_id='11'\G
*************************** 1. row ***************************
ticket_id: 72260
ticketID: 72260
dept_id: 5
priority_id: 2
staff_id: 11
email: <snip>
name: <snip>
subject: <snip>
topic:
phone:
phone_ext:
ip_address:
status: open
source: Email
isoverdue: 0
isanswered: 1
duedate: NULL
reopened: NULL
closed: NULL
lastmessage: 2010-06-11 11:28:01
lastresponse: 2010-06-14 12:53:39
created: 2010-06-11 11:28:01
updated: 2010-06-14 12:53:39
*************************** 2. row ***************************
ticket_id: 75331
ticketID: 75331
dept_id: 5
priority_id: 2
staff_id: 11
email: <snip>
name: <snip>
subject: <snip>
topic:
phone:
phone_ext:
ip_address:
status: open
source: Email
isoverdue: 0
isanswered: 1
duedate: NULL
reopened: 2010-09-28 23:03:01
closed: 2010-09-28 16:51:37
lastmessage: 2010-09-28 23:03:01
lastresponse: 2010-09-29 08:03:28
created: 2010-08-30 14:55:01
updated: 2010-09-29 08:03:28
*************************** 3. row ***************************
ticket_id: 75573
ticketID: 75573
dept_id: 5
priority_id: 2
staff_id: 11
email: <snip>
name: <snip>
subject: <snip>
topic:
phone:
phone_ext:
ip_address:
status: open
source: Email
isoverdue: 0
isanswered: 0
duedate: NULL
reopened: 2010-10-07 14:47:01
closed: 2010-10-07 13:07:28
lastmessage: 2010-10-07 14:47:01
lastresponse: 2010-09-29 23:49:00
created: 2010-09-09 12:05:02
updated: 2010-10-07 14:47:01
3 rows in set (0.00 sec)

brouiller
10-08-2010, 01:06 PM
When I ran the query SELECT * FROM ost_ticket WHERE status='Open' AND staff_id='4'\G from phpmyadmin, I received
"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\G LIMIT 0, 30' at line 1"

I took of the \G at the end and it came back with the 4 tickets that are assigned to me. 3 of them are answered, 1 is not. So, to answer your question, yes; it shows both answered and not answered tickets.

scottro
10-08-2010, 01:16 PM
When I ran the query SELECT * FROM ost_ticket WHERE status='Open' AND staff_id='4'\G from phpmyadmin, I received
"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\G LIMIT 0, 30' at line 1"

I took of the \G at the end and it came back with the 4 tickets that are assigned to me. 3 of them are answered, 1 is not. So, to answer your question, yes; it shows both answered and not answered tickets.

I don't this should matter but just to make sure can you run

SELECT * FROM ost_ticket WHERE open.status='Open' AND assigned.staff_id='4'This is near to exactly the code that should be running in the file.

brouiller
10-08-2010, 01:51 PM
When I ran it, I received this error: #1054 - Unknown column 'open.status' in 'where clause'

Here's my code from tickets.inc.php
//Sub-statuses Trust me!
if($staffId && ($staffId==$thisuser->getId())) { //Staff's assigned tickets.
$results_type='Assigned Tickets';
$qwhere.=' AND ticket.status="open" AND ticket.staff_id='.db_input($staffId);
//original $qwhere.=' AND ticket.staff_id='.db_input($staffId);
}elseif($showoverdue) { //overdue
$qwhere.=' AND isoverdue=1 ';
}elseif($showanswered) { ////Answered
$qwhere.=' AND isanswered=1 ';
}elseif(!$search && !$cfg->showAnsweredTickets() && !strcasecmp($status,'open')) {
$qwhere.=' AND isanswered=0 ';
}
Here's my code from scp\tickets.php
if($stats['assigned']) {
if(!$sysnotice && $stats['assigned']>10)
$sysnotice=$stats['assigned'].' assigned to you!';

$nav->addSubMenu(array('desc'=>'My Tickets ('.$stats['assigned'].')','title'=>'Assigned Tickets',
'href'=>'tickets.php?status=assigned','iconclass'=>'assignedTickets'));
}

scottro
10-08-2010, 03:04 PM
can you email me your scp/tickets.php file?

scott (at) sudobash (dot) net

wjcollector
01-26-2011, 04:49 PM
Ok, with some further testing I got everything working.

The following is what I have for all of my entries. I will include one line prior to the code so you can search for where to enter it.

All entries are in include/staff/tickets.inc.php

~Line 171
//I admit this crap sucks...but who cares??
// Addition by webPragmatist
$sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept _name','ass'=>'firstname');
// End addition by webPragmatist
//$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name');

~Line 198
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default...if all fails.
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;

// *** Edited by webPragmatist
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname '.
',ticket.status,ticket.source,isoverdue,ticket.cre ated,pri.*,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
// ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
// ' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
// *** End edit by webPragmatist

/*
$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',ticket.status,ticket.source,isoverdue,isanswered ,ticket.created,pri.* ,count(attach.attach_id) as attachments ';
$qfrom=' FROM '.TICKET_TABLE.' ticket '.
' LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id ';
*/

~Line 392
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th>
<!-- Addition by webPragmatist -->
<th width="150" ><a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Assignee <?=$negorder?>">Assigned To</a></th>
<!-- End addition by webPragmatist -->

~Line 435
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=($row['firstname']) ? $row['firstname'] : '&nbsp;';?>&nbsp;<?=($row['lastname']) ? $row['lastname'] : '';?></td>
<!-- End addition by webPragmatist -->

You may notice that my entries have firstname and lastname instead of username as I wanted to have the full name show up of the person thats been assigned to it instead of just a username.

Please let me know if you have any issues with any of this.

Thanks


This worked for me! Thank you!

waterc
01-26-2011, 06:10 PM
I've tried this mod with 1.6 ST and I also show "Not Assigned" for every entry.
Regards
-B

scottro
01-26-2011, 06:16 PM
I have it running on 1.6ST. Are you using the latest code?

waterc
01-27-2011, 03:45 PM
Sorry. It looks like most of our tickets just weren't assigned to a staff after all. I'm withdrawing the problem report.

freddyvangeel
02-20-2011, 10:35 AM
hi,

i'd really like this mod, but can't get it to work.
i've zipped the code,
thanks a lot if you would help me!

this is the error on mysql
[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username ,status,source,isoverdue,ticket.created,pri.* ,count(attach.attach_id) as attachments FROM _ticket ticket LEFT JOIN _department dept ON ticket.dept_id=dept.dept_id LEFT JOIN _ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN _ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN _staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN _ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN _ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN _ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND status='open' AND isanswered=0 GROUP BY ticket.ticket_id ORDER BY priority_urgency,ticket.created DESC LIMIT 0,25]

fixed, by reading thru thread...
tnx

scottro
02-20-2011, 04:43 PM
fixed, by reading thru thread...
tnx
Sweet! Let me know if you need any further assistance with this or any of my other mods and I'd be happy to help when I have the time :)

Chrisl
02-25-2011, 09:12 AM
If I have a ticket assigned to person 1, then re-assign it to person 2 for some reason person 1 can still see the ticket?

If I go in and release the ticket, then re-assign it only the person it is assigned to can see the ticket.


Is this a bug? Or is something wrong on my part?

-Chris

scottro
02-28-2011, 12:19 PM
Does this happen even when my MOD isn't installed? It sounds like a bug in the system not something related to my MOD.

Chrisl
03-01-2011, 04:16 PM
I am not sure how to uninstall it, nor do I really want to. Was just wondering if there was anyone else having the same issue / how they worked around it.

What would be great is a "Unassign" option in the drop down box that would remove all assignments (Both department and Staff) from the ticket....

Any ideas?

ryanp
03-11-2011, 02:16 PM
This worked for me! Thank you!

It works beautifully for me also.

:cool:TIP: Ignore the line numbers and search for the line prior to
<!-- Addition by webPragmatist -->

It worked perfectly in 1.6ST

mrevelle
03-23-2011, 11:24 AM
Good addition, we've got a few minor issues with this contribution. When searching for closed tickets we're getting the following db error

[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username ,status,source,isoverdue,ticket.created,pri.* ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_message message ON (ticket.ticket_id=message.ticket_id ) LEFT JOIN ost_ticket_response response ON (ticket.ticket_id=response.ticket_id ) LEFT JOIN ost_ticket_note note ON (ticket.ticket_id=note.ticket_id ) LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND ( ticket.email LIKE '%Sandra%' OR ticket.name LIKE '%Sandra%' OR ticket.subject LIKE '%Sandra%' OR message.message LIKE '%Sandra%' OR response.response LIKE '%Sandra%' OR note.note LIKE '%Sandra%' OR note.title LIKE '%Sandra%' ) GROUP BY ticket.ticket_id ORDER BY priority_urgency,effective_date DESC ,ticket.created DESC LIMIT 0,50]

Column 'source' in field list is ambiguous

scottro
03-23-2011, 11:36 AM
Good addition, we've got a few minor issues with this contribution. When searching for closed tickets we're getting the following db error

[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.username ,status,source,isoverdue,ticket.created,pri.* ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_message message ON (ticket.ticket_id=message.ticket_id ) LEFT JOIN ost_ticket_response response ON (ticket.ticket_id=response.ticket_id ) LEFT JOIN ost_ticket_note note ON (ticket.ticket_id=note.ticket_id ) LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND ( ticket.email LIKE '%Sandra%' OR ticket.name LIKE '%Sandra%' OR ticket.subject LIKE '%Sandra%' OR message.message LIKE '%Sandra%' OR response.response LIKE '%Sandra%' OR note.note LIKE '%Sandra%' OR note.title LIKE '%Sandra%' ) GROUP BY ticket.ticket_id ORDER BY priority_urgency,effective_date DESC ,ticket.created DESC LIMIT 0,50]

Column 'source' in field list is ambiguous

Hmm, I have not run into that before. You may trying changing the code from 'source' to 'ticket.source' (assuming thats where the source field is).

consumedsoul
04-04-2011, 05:09 PM
Hmm, I have not run into that before. You may trying changing the code from 'source' to 'ticket.source' (assuming thats where the source field is).

Getting database errors as well when performing any search (no results produced, and db errors result). Examples:

[SELECT count(DISTINCT ticket.ticket_id) FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id WHERE 1 AND ( ticket.email LIKE '%assigned%' OR ticket.name LIKE '%assigned%' OR ticket.subject LIKE '%assigned%' OR message.message LIKE '%assigned%' OR response.response LIKE '%assigned%' OR note.note LIKE '%assigned%' OR note.title LIKE '%assigned%' ) ]

Unknown column 'message.message' in 'where clause'

[SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname ,ticket.status,ticket.source,isoverdue,ticket.crea ted,pri.*,count(attach.attach_id) as attachments ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND ( ticket.email LIKE '%assigned%' OR ticket.name LIKE '%assigned%' OR ticket.subject LIKE '%assigned%' OR message.message LIKE '%assigned%' OR response.response LIKE '%assigned%' OR note.note LIKE '%assigned%' OR note.title LIKE '%assigned%' ) GROUP BY ticket.ticket_id ORDER BY priority_urgency,effective_date DESC ,ticket.created DESC LIMIT 0,50]

Unknown column 'message.message' in 'where clause'

[SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,ticket.email,dept_name ,staff.firstname,staff.lastname ,ticket.status,ticket.source,isoverdue,ticket.crea ted,pri.*,count(attach.attach_id) as attachments ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND ( ticket.email LIKE '%assign%' OR ticket.name LIKE '%assign%' OR ticket.subject LIKE '%assign%' OR message.message LIKE '%assign%' OR response.response LIKE '%assign%' OR note.note LIKE '%assign%' OR note.title LIKE '%assign%' ) GROUP BY ticket.ticket_id ORDER BY priority_urgency,effective_date DESC ,ticket.created DESC LIMIT 0,50]

Unknown column 'message.message' in 'where clause'


[SELECT count(DISTINCT ticket.ticket_id) FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_id WHERE 1 AND ( ticket.email LIKE '%assign%' OR ticket.name LIKE '%assign%' OR ticket.subject LIKE '%assign%' OR message.message LIKE '%assign%' OR response.response LIKE '%assign%' OR note.note LIKE '%assign%' OR note.title LIKE '%assign%' ) ]

Unknown column 'message.message' in 'where clause'

consumedsoul
04-05-2011, 04:26 AM
Hmm, I have not run into that before. You may trying changing the code from 'source' to 'ticket.source' (assuming thats where the source field is).

Here's a screenshot of the admin errors/logs when I just try to run a search for 'test search' (0 results produced):

consumedsoul
04-05-2011, 04:28 AM
Here's a screenshot of the admin errors/logs when I just try to run a search for 'test search' (0 results produced):

Oops - image compressed, here's a better image:

http://ghkim.com/downloads/errors.png

scottro
04-05-2011, 10:52 AM
The important part to take away from this is

Unknown column 'message.message' in 'where clause'

I've looked at even the original unedited source code for osTickets that message.message is present. Have you modified your database at all to not include this column? You should have a table ost_ticket_message and within that a column 'message'. I can't imagine that its not there though or your tickets would be all or nearly blank and you'd be getting database errors all over the place.

consumedsoul
04-05-2011, 12:26 PM
The important part to take away from this is

Unknown column 'message.message' in 'where clause'

I've looked at even the original unedited source code for osTickets that message.message is present. Have you modified your database at all to not include this column? You should have a table ost_ticket_message and within that a column 'message'. I can't imagine that its not there though or your tickets would be all or nearly blank and you'd be getting database errors all over the place.

I haven't touched the database, just modified code to files - here's my 3 associated tickets...files if that helps.

Thx!

scottro
04-05-2011, 03:44 PM
Are you running 1.6ST?

For tickets.inc.php (under include/staff/)
I have the following with 1.6RC5:
//query
if($searchTerm){
$qstr.='&query='.urlencode($searchTerm);
$queryterm=db_real_escape($searchTerm,false); //escape the term ONLY...no quotes.
if(is_numeric($searchTerm)){
$qwhere.=" AND ticket.ticketID LIKE '$queryterm%'";
}elseif(strpos($searchTerm,'@') && Validator::is_email($searchTerm)){ //pulling all tricks!
$qwhere.=" AND ticket.email='$queryterm'";
}else{//Deep search!
//This sucks..mass scan! search anything that moves!

$deep_search=true;

$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR message.message LIKE '%$queryterm%'".
" OR response.response LIKE '%$queryterm%'".
" OR note.note LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
' ) ';
}
}

and yours has the following:
//query
if($searchTerm){
$qstr.='&query='.urlencode($searchTerm);
$queryterm=db_real_escape($searchTerm,false); //escape the term ONLY...no quotes.
if(is_numeric($searchTerm)){
$qwhere.=" AND ticket.ticketID LIKE '$queryterm%'";
}elseif(strpos($searchTerm,'@') && Validator::is_email($searchTerm)){ //pulling all tricks!
$qwhere.=" AND ticket.email='$queryterm'";
}else{//Deep search!
//This sucks..mass scan! search anything that moves!

$deep_search=true;
if($_REQUEST['stype'] && $_REQUEST['stype']=='FT') { //Using full text on big fields.
$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
" OR MATCH(message.message) AGAINST('$queryterm')".
" OR MATCH(response.response) AGAINST('$queryterm')".
" OR MATCH(note.note) AGAINST('$queryterm')".
' ) ';
}else{
$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR message.message LIKE '%$queryterm%'".
" OR response.response LIKE '%$queryterm%'".
" OR note.note LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
' ) ';
}
}
}

I assume the big difference is from a version variance?

consumedsoul
04-05-2011, 04:34 PM
Are you running 1.6ST?

For tickets.inc.php (under include/staff/)
I have the following with 1.6RC5:
//query
if($searchTerm){
$qstr.='&query='.urlencode($searchTerm);
$queryterm=db_real_escape($searchTerm,false); //escape the term ONLY...no quotes.
if(is_numeric($searchTerm)){
$qwhere.=" AND ticket.ticketID LIKE '$queryterm%'";
}elseif(strpos($searchTerm,'@') && Validator::is_email($searchTerm)){ //pulling all tricks!
$qwhere.=" AND ticket.email='$queryterm'";
}else{//Deep search!
//This sucks..mass scan! search anything that moves!

$deep_search=true;

$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR message.message LIKE '%$queryterm%'".
" OR response.response LIKE '%$queryterm%'".
" OR note.note LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
' ) ';
}
}

and yours has the following:
//query
if($searchTerm){
$qstr.='&query='.urlencode($searchTerm);
$queryterm=db_real_escape($searchTerm,false); //escape the term ONLY...no quotes.
if(is_numeric($searchTerm)){
$qwhere.=" AND ticket.ticketID LIKE '$queryterm%'";
}elseif(strpos($searchTerm,'@') && Validator::is_email($searchTerm)){ //pulling all tricks!
$qwhere.=" AND ticket.email='$queryterm'";
}else{//Deep search!
//This sucks..mass scan! search anything that moves!

$deep_search=true;
if($_REQUEST['stype'] && $_REQUEST['stype']=='FT') { //Using full text on big fields.
$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
" OR MATCH(message.message) AGAINST('$queryterm')".
" OR MATCH(response.response) AGAINST('$queryterm')".
" OR MATCH(note.note) AGAINST('$queryterm')".
' ) ';
}else{
$qwhere.=" AND ( ticket.email LIKE '%$queryterm%'".
" OR ticket.name LIKE '%$queryterm%'".
" OR ticket.subject LIKE '%$queryterm%'".
" OR message.message LIKE '%$queryterm%'".
" OR response.response LIKE '%$queryterm%'".
" OR note.note LIKE '%$queryterm%'".
" OR note.title LIKE '%$queryterm%'".
' ) ';
}
}
}

I assume the big difference is from a version variance?

Yep - running ST - does this mean I won't be able to implement the assigned to column (w/o sacrificing search functionality)?

consumedsoul
04-05-2011, 05:01 PM
Yep - running ST - does this mean I won't be able to implement the assigned to column (w/o sacrificing search functionality)?

btw sorting by 'department' causes 0 results and these errors in db:

http://ghkim.com/downloads/errors2.JPG

scottro
04-05-2011, 05:45 PM
I just went and installed a fresh install of osTickets 1.6ST and then rewrote my HowTo article. I also made a zip file of the files needed for this mod alone.

I then went and did a couple of searches and had no problems.

File is attached - updated code is at:
http://sudobash.net/?p=158

consumedsoul
04-05-2011, 05:57 PM
I just went and installed a fresh install of osTickets 1.6ST and then rewrote my HowTo article. I also made a zip file of the files needed for this mod alone.

I then went and did a couple of searches and had no problems.

File is attached - updated code is at:
http://sudobash.net/?p=158

Magical, replacing those files worked wonders. :] Search and sort column functions all work now.

Thx again!

scottro
04-05-2011, 05:59 PM
Magical, replacing those files worked wonders. :] Search and sort column functions all work now.

Thx again!
Awesome, glad its all working now!

consumedsoul
04-05-2011, 06:16 PM
Awesome, glad its all working now!

Hmm - now that I updated your 3 files, the cc/bcc is not functional after I modify the include/class.ticket.php file per:

http://sudobash.net/?p=234

That should be the only file I need to tweak (to add cc/bcc functionality again) right?

Result is I can't browse to website after applying the code in that file...

consumedsoul
04-05-2011, 06:39 PM
Hmm - now that I updated your 3 files, the cc/bcc is not functional after I modify the include/class.ticket.php file per:

http://sudobash.net/?p=234

That should be the only file I need to tweak (to add cc/bcc functionality again) right?

Result is I can't browse to website after applying the code in that file...

Additional details, seems to be when I apply the following code replacement:

// Just in case they wiped out the send address we still need to make sure it gets somewhere.
***************if($_POST['send_to']){
*******************$email->send($_POST['send_to'],$subj,$body,$file);
*******************}else{
*******************$email->send($this->getEmail(),$subj,$body,$file);
***************}

Result is following in browser:

Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

consumedsoul
04-05-2011, 06:47 PM
Additional details, seems to be when I apply the following code replacement:

// Just in case they wiped out the send address we still need to make sure it gets somewhere.
***************if($_POST['send_to']){
*******************$email->send($_POST['send_to'],$subj,$body,$file);
*******************}else{
*******************$email->send($this->getEmail(),$subj,$body,$file);
***************}

Result is following in browser:

Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

Weird - removed the 'spaces' (clue was my **'s above) and now functional again (copied/pasted your code from blog).

Disregard!

scottro
04-05-2011, 08:28 PM
Weird - removed the 'spaces' (clue was my **'s above) and now functional again (copied/pasted your code from blog).

Disregard!

Ah, sure - I blame Windows - I've ran into it inserting invisible characters before with other scripting :\

claudiocerda
05-17-2011, 01:19 PM
I just went and installed a fresh install of osTickets 1.6ST and then rewrote my HowTo article. I also made a zip file of the files needed for this mod alone.

I then went and did a couple of searches and had no problems.

File is attached - updated code is at:
http://sudobash.net/?p=158

Works great!!!! thanks!!!

m450n
05-29-2011, 07:19 AM
I just went and installed a fresh install of osTickets 1.6ST and then rewrote my HowTo article. I also made a zip file of the files needed for this mod alone.

I then went and did a couple of searches and had no problems.

File is attached - updated code is at:
http://sudobash.net/?p=158

OMG... lifesaver of a file!!!

arnst19
05-29-2011, 06:58 PM
needed this so bad, and it works great even being 3 years old. thanks

ecastedo
10-27-2011, 03:32 PM
webPragmatist, I have added all you code, but I have a problem, in the fiel assigned, even when the ticket is assigned to someone it stills showing "Not assigned" how can i fix it.

Follow the tickets.inc.php part that I believe is realted to it.

<td><a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?>
href="tickets.php?id=<?=$row['ticket_id']?>"><?=$subject?></a>
&nbsp;<?=$row['attachments']?"<span class='Icon file'>&nbsp;</span>":''?></td>
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
<!-- Addition by webPragmatist -->
<td nowrap><?=($row['username']) ? $row['username'] : 'Not assigned';?></td>
<!-- End addition by webPragmatist -->
<td class="nohover" align="center" style="background-color:<?=$row['priority_color']?>;"><?=$row['priority_desc']?></td>
<td nowrap><?=Format::truncate($row['name'],22,strpos($row['name'],'@'))?>&nbsp;</td>

scottro
10-27-2011, 06:36 PM
ecastedo,

Webpragmatist no longer maintains this MOD. I have taken over this MOD, see my full code here: http://sudobash.net/?p=158

ecastedo
10-28-2011, 07:59 AM
Hello Scott, how are you, I have also tried your files, but did not worked, I do not know why, maybe you could help me.
I'm using a osticket with translation call, osticket-reload.com so maybe the files are a little different.

when I install your files the tables dissapear I will try again today to see, what happen, I have only copy the complete file.

ecastedo
10-28-2011, 08:19 AM
Scott follow my original ticket.inc.php file

scottro
10-28-2011, 09:44 AM
Hello Scott, how are you, I have also tried your files, but did not worked, I do not know why, maybe you could help me.
I'm using a osticket with translation call, osticket-reload.com so maybe the files are a little different.

when I install your files the tables dissapear I will try again today to see, what happen, I have only copy the complete file.
ecastedo,
Yes the reloaded fork has alot of changes in every single file (I've worked with it recently quite a bit). If you want to send me ALL of your files in a zip and a copy of your database (or at least just the structure) then I can install it on my test server and see whats going wrong for you. It won't be super soon though as I'm currently working on a commercial MOD for someone so that takes priority. I could probably get to it sometime next week.

axiscars
11-27-2011, 01:12 PM
After following pragmitists MOD & doing all the code changes, plus all the extra's added then..
STILL NOT WORKING .!

OH but at end of post.. !!!!

This dosen't work go here,

Crap when You have editted it all.. then don't know where you are..

BLOODY BRILLIANT !! NOT !!!

axiscars
11-27-2011, 01:27 PM
Scott Rowley , I applaud you, excellent , Work..

GOD I wish i had read all the way through & GOT YOUR MOD FIRST ..

Took me few minutes, after following orginal topic.. For 3 Hours got no where..


Then your MOD was fantastic.. well done
Cheers,
kaj