Hello guys!I had some trouble with this feature, and I'm not sure how to fix it.I added a new field to the Ticket Information form, a simply drop-down list with some available Courses.Works like a charm when creating the ticket, the new field appears at the advanced search form, but when I select one of the options of this new field and submit, the search returns nothing (even when I create a new ticket with this field filled).Can anybody help me?Thanks and sorry for my bad english, thats not my native language.

There is no default form called "Ticket Information".  There is "Client Information" and "Ticket Details", which one do you actually mean?

That is true. Sorry, my bad.I meant  the "Ticket Details" form.

Okay.  Now that I know which one you mean... do you actually have any tickets with information in that additional field?

Yes, I have.I am sending two printscreens with the custom field.The first, we have the field filled. Then we have the second one with the result of the search, filtered by this field.Thanks.

screen1.png

screen2.png

So I have to admit that I cringe a little when ever I see a installation that isn't in English, because it measnt athy you either translated it yourself or got it from some where else.  Most of the time its the later.Your Advanced search screen does not look like mine. The Priority and Drop down are reversed. So I am going to presume that is because whoever translated it changed something.  Or that you do not have the field attached to the default Ticket Details form.  I believe that there is an issue in the current version with the Advanced search if its not attached to the Ticket Details form.

About the translation, I know that feel. And that's why I did the translation myself.I am sure that everything worked as it should after the translation.Anyway, I will do a fresh installation of the version that I am using (v1.8.0.2, forgot to mention this) and another one of the latest version to test the same feature. I'll post the results after that.This feature (filter by a custom field) works fine in your installation?Thanks.

Well, I did the tests. About the results:1) The priority and drop down are the same way of the pictures I send. Reliaves me to know that I didn't change that. =D2) The filtering didn't worked in the 1.8.0.4 installation but worked perfectly in the 1.8.1.2 installation. So I believe there was a bug that has been corrected in this new version. The problem now is to know what has changed from one version to another. Any idea?Thanks.

Hi.I think I found the problem.When I create a new custom field, a column is appended to the "PREFIX_ticket__cdata" table with the name of the that represents the new field. Apparently another column also has to be created: the _id, and that's not happening.Another thing is that when the is called at the file, it is returning false always.I have created manually the new column, set the values of this column manually, created a new funcion that returns true always in the file and referenced this function instead of the other one. All that for testing purposes. It works! YAY!My problem now is to find where the insertion of the column in the ticket__cdata table are made (yes, I am having trouble with that. Can't find anywhere), so I can fix that. Also I have to insert the _id value in the column when a new ticket is created with the new field or this field is edited through ticket edition (that is not happening).Can you help me? Thanks!

That sounds like a question for the devs.  I'll point them at this thread and hope that they reply. :)

7 days later

Well, after some time reading the code, I've come to a solution.I have found the part where the column is created. It is a conditional block, and one of the conditions was the function that always returns false.So, I just changed the return of that function to return always true. Now, the column_id is created correctly. I didn't understand why that function always returned false, and I don't know for sure how this change affects the rest of the system, but has been some time since I did that, and the system works perfectly by now.If I did a bad thing, please let me know.Thanks for the help, ntozier!

Very welcome.  Can you post here where the change you made is?  (file and line)

4 days later

Sure I can.In the we have two methods , one of the class FormField (line 452) and another of the class PriorityField (line 819). The first one returns always "false". The second one returns always "true". When we create a new form field, it is instantiated as a FormField class. So, in the file at line 216, the condition is always false, once that the object is a FormField class instance, and because of this the ID column was never created.So, I changed the return of the first (, line 452) method from "false" to "true". After this change, the column is created in the database as it should and the advanced search works fine when the filter used is a new custom form.I have checked this two methods on the recent version of osTicket, and it looks the same as the old version, but the advanced search works. I wonder why. =PI hope this helps someone with the same problem.Thanks and if another information is needed, just ask.

Write a Reply...