I NEVER get a good answer here so I stopped posting and just post on PHP Phreaks but this is way too confusing so I have to try here. I can NOT for the life of me figure out what is going on with this code. It's so horribly coded and I'm new to php so it's like trying to learn Mandarin from a special needs kid. I created a class called Customers by mimicking the staff class. I can populate my grid with all the customers but when I try to search by a specific customer I have to know the full name WITH all the right capitalization. I'm trying to track down where the query is called but these coders don't use stored procedures they dynamically build them and it's one of the most complicated things I've ever seen. Here's the line of code I'm trying to trace, I think....if ($filters) {    $custs->filter($filters);}Now I can find this function and when I echo what it returns it returns the querystring WHERE A1.`cust_name` = 'test' which is exactly what I am looking for. However, I can't trace it any further than that. This is the code in that function foreach (func_get_args() as $Q) {            $this->constraints = $Q instanceof Q ? $Q : new Q($Q);}The Query looks like SELECT A1.`cust_name` FROM `ost_customer` A1 WHERE A1.`cust_name` = 'test'I have spent HOURS searching this code for A1 (returns thousands of rows), SELECT (which returns even more rows), CUST_TABLE which is the variable my customer table name is stored and I have found NOTHING. Can anyone help me find where this code is located so I can change it? I really wish they just used stored procedures. It would make this whole project so much more readable.

I think that you may get more flies with honey then ... opinionated negativity.  It certainly doesn't make me want to help or even reply to you. What version of osTicket are you running?Please help us to help you by reading and following the posting guidelines located in this thread: Please read before requesting assistance.  The more information you give us the better we will be able to assist you. Thank you. 

I'm not trying to offend anyone but there is still an issue that I have asked on here, probably a month ago, that still isn't resolved. I apologize if I am being negative but when someone puts out code (even code that's in beta) you would think they would have at least tested it. Paging or sorting did not work right on one single page because they didn't even build the query string into the paging! I apologize for being negative. It's just dealing with code that should never be released is frustrating. I have spent weeks just getting the paging and sorting to work right on all the pages! I am running the beta version of OS Tickets. v 1.10

You appear to be laboring under the false impression that v1.10DPR was made to be used by just anyone. Version 1.10 is a DPR (Developer Preview Release) and it is not intended to be used in a production environment.  It's intended to showcase coming changes, give mod authors a change to update their mods, and other developers to get ready for changes to their plugins.  You're running what amounts to Alpha software... which means you are a tester if you use it at all.  The devs call it a beta because they setup and tested it quickly and have been working on making it stable.  There have been quite a few commits to fix things since it was released on May 13th.  See here:https://github.com/osTicket/osTicket-1.8/pull/2056As you can see there is still a lot of things outstanding before it is even made into a Release Candidate, and that's when the real testing starts.As for this thread...$custs->filter($filters); does not appear in the project that I can find.func_get_args()appears 11 times:https://github.com/osTicket/osTicket-1.8/search?p=1&q=func_get_args%28%29&type=Code&utf8=%E2%9C%93You appear to be modding the course and then asking for support for your mods.  We do not really provide support for your custom modifications.

@[deleted] -- We've started overhauling osTicket to be ORM based as a step towards supporting other databases other than MySQL (e.g MSSQL, Oracle..etc). This means you won't find bare SQL statement as you described -- they're compiler generated. I agree with you that it's the most abstract code you'll ever find (if you're new to ORM world), but it does makes sense in the big picture.We do develop osTicket openly and would more than welcome your contributions.

Ntozier, the code I am trying to track down is already coded into the system. I copied it straight from the staffmembers.inc.php page. Peter, I have been coding a while, though I haven't done much in years because I wanted to get away from corporate america, but I've never done php and due to the complexity of the code it's hard to track down. Do you know the easiest way to change a query from = to like? It's doing exactly what I want it to otherwise.If it helps, since my page is an addition, how would I change the staff members page to look for a department LIKE "Lion Tamers" rather than a department = "Lion Tamers"?

Oh an ntozier, sorry I just noticed that you couldn't find this code $custs->filter($filters); you can do a search for $agents->filter($filters); and you'll call exactly the same methods and functions. I just changed $agents to $custs for my custom page and added the customer class but you would be hitting the exact same code just passing in a customer object rather than a staff object.

And Peter, thanks for explaining why it's so complicated. Now I understand why you didn't at least use stored procedures and put the sql there.

Perhaps you can post the section of the code you're having trouble with and I'll be happy to point you in the right direction.We supports a couple of matching methods e.g contains, startsWith and endsWith -- for example you can use array('cut_name__contains' ='kip') as part of the filter.Cheers,

That, I believe Peter, is all I needed. I got it working now and you are awesome! I just did a search for _contains, found a snipit of code and altered it for my class and now it's working!

Write a Reply...