Is it possible to put custom_fields in the contact search criteria box ?
Is it possible to put custom_fields in the contact search results columns ?
Do you have existing hooks for these, or will XRMS need new ones ?
There are hooks available in the some.php pages and in the GU_Pager code to allow what you're looking for.
This is a feature that I really want in XRMS, but I haven't had time to work on it, and no one has either done the work or sponsored the work.
I think that it would be ideal if all custom fields on a company/contact/ etc showed up in the advanced search page for that object, and all custom fields were available as columns on the pager.
This will be non-trivial to implement, but I'll help as much as I can if you want to work on it.
Absolutely, I love a challenge :)
If you want to send me a few starter pointers to my email (avoid unwieldy discussions in here)
I'll get right on it.
I also think this feature will be an excellent enhancement, and give compelling new reasons for people to implement XRMS.
Looking forward to the results already ... optimism unbounded.
I'll put the starter pointers here, since others who want to do interesting things with the custom fields plugin may benefit. Feel free to follow up with me via email if you have specific technical questions.
I was incorrect when I said that the some.php pages have hooks for modifying the search parameters and SQL queries. Those hooks will need to be added. The edit.php and edit-2.php pages should provide a good template for this, or I can provide some additional guidance if you get stuck. The setup.php script for the custom_fields plugin will also need to register to handle these new hooks.
So, how would we add more search fields?
I'd look at the custom_fields functions get_display and get_column. the column display, set to 'EDIT' as though this were a new record should create the widgets you'll need for search, or a minor modification to that function should do the trick.
Once the extra fields are created on the search form, they'll be submitted automatically. In the process hook for the some.php page, you'll need to modify the query to add another join to get data from the cf_ tables, and obviously additional field list and where clauses (based on your search parameters)
The pager column list array will need to be modified to add the extra columns. I'd just add them first as optional columns, and then work on matchign the logic that says that if I searched on a column it should always be displayed.
I hope thisd gets you started at least investigating the code, and will let you ask more specific questions once you get under the covers.
Thanks for contributing to XRMS!
Log in to post a comment.