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

Trouble searching by ticket number

I have osticket 1.9.14 running on a ubuntu server and all is well except when I try to use the search box with the ticket number it returns ALL tickets - open and closed tickets. Not the one I put in the field. Keyword & User's name searches work fine. I tried with the ticket prefix and without - no change. My ticket format is: NNCC-######  ... Am I missing something simple? Thanks!


  • Ok let me ask this: Is anyone else able to search by ticket number? At least then I will know if its something with my setup or if its just not an option
  • Try removing the prefix (NNCC-) and see what happens

  • I did and same thing - shows every ticket no matter what ticket number i try searching for but i can do by user and keywords
  • Sounds like a bug in the search for tickets that use custom prefixes in their formating.
  • If I changed the ticket format to remove the custom prefix would it leave all the current tickets as is?
  • I don't know, I've never tried.  I would think so,
  • I went into mysql and did a select * from ost_tickets and looked at all the tickets currently in there and see what field the ticket number was under (number which is a varchar) and found the original ticket still in there from install without the custom prefix. The only ticket in fact. And I tried putting in that number and it came right up. So there is an issue with using a custom prefix. I doubt I will be able to make heads or tails of any of the code for the search but I will look for anything that stands out. so far I am looking in and class.ticket.php .. Is there any other files you might suggest?
  • I might have found where the issue is but I dont know how to fix it. In the file there is this starting at line 131:

            if (is_numeric($searchTerm)) {
                $qwhere.=" AND ticket.`number` LIKE '$queryterm%'";

    Im guessing its the "is_numeric" part that is where the problem is? If so is there a way to modify that to accept the NNCC- in the beginning of the ticket number? Im hoping there is a way to compare the searchTerm with the default ticket number format. I just dont know enough to do that. 
  • I've reported this thread to the devs to take a look at.
  • Awesome, thank you. I hope they can tell me how to fix this. I am making barcodes of the ticket number on the labels we print out on the pcs and it would be nice to be able to just scan the barcode into the search box.
  • I'd love for there to be a barcode scanning component. :)
  • Ive almost got it all working. The custom print page I did creates the labels which i send to a brother label printer. Currently it makes QR Codes and I put a button on the ticket view page that opened a scanner app on android phones. When the QR Code is scanned the ticket is opened by the ticket id within the url, but we decided to go with a 1d barcode so we could scan on the computer and the search box seemed much easier rather than a more expensive pc qr scanner. With the 1d barcode scanner you just put focus in the search text box and scan the code and bam the ticket number is in there, just need to hit enter. Im working on generating the 1d barcode on the fly now. Google has a great way to do QR codes within an img tag, not sure about the 1d ones yet. Once these issues are resolved it will be 100% functioning for us.
  • I'd be be interesting in seeing your osTicket side mods once you get this done.  :)
  • Absolutely. Once this is resolved Ill throw up a quick little mod thread with my code and maybe some pics.
  • I have got it working with the following manual change to line 131 :

    if (fnmatch("NNCC-*",$searchTerm, FNM_CASEFOLD)) {

    but it would be nice to do a compare based on the ost_config table entry that has the ticket default rather than my manual entry of the format.
Sign In or Register to comment.