I don't know how it works if you've made your custom fields via the Design Studio of the Admin panel, because then the way these fields are then managed is different from the core program. So I can only tell you about how to do this, supposing you've hardcoded your new fields just as any standard sugarcrm field.
So let me take the story at that very stage where you've already added your new field in every single place where it should (*.php, *.hlml and in your db) and where the only question that remains at that stage is how you can eventually get that filed inserted in the advanced search panel and have it to work properly.
To make things concrete, let's say you've added your new field into the Account module (same principle applies for every other module). Searchwise, everything seems to be ruled from the 2 following files:
- SearchForm.html
- ListView.php
In SearchForm.html, things are pretty plain: just insert your new field like you've done in the other *.HTML files (EditView.html, DetailView.html).
In ListView.php, you basically have 3 inserts to do, as described here (new code to enter is in red):
1) First insert to be done after: }
if(isset($_REQUEST['query']))
{
if (isset($_REQUEST['new_field'])) $new_field = $_REQUEST['new_field'];
2) Second insert to be done after: $where_clauses = Array();
if(isset($new_field) && $new_field != "") array_push($where_clauses, "accounts.new_field like '".PearDatabase::quote($new_field)."%'");
Please note that accounts.new_field depends on the module you're in (it would be contact.new_field if you were working in the Contact module).
3) Third insert to be done after: }
echo get_form_header($current_module_strings['LBL_SEARCH_FORM_TITLE'], $header_text, false);
if (isset($_REQUEST['advanced']) && $_REQUEST['advanced'] == 'true') {
if(isset($new_field)) $search_form->assign("NEW_FIELD", $new_field);
Should your new field be a "Dropdown List" type one, the last insert should read:
if (isset($new_field)) $search_form->assign("NEW_FIELD_OPTIONS", get_select_options_with_id($app_list_strings['new_field_dom'], $new_field));
else $search_form->assign("NEW_FIELD_OPTIONS", get_select_options_with_id($app_list_strings['new_field_dom'], ''));
In that case, "new_field_dom" should read the name you've given to your dropdown list when creating it via the Design Studio.
Hope this help!
Thierry
Bookmarks