Results 1 to 3 of 3

Thread: Search mechanizm - SearchFields.php and listviewdefs.php

  1. #1
    wojkal is offline Sugar Community Member
    Join Date
    Jan 2006
    Posts
    10

    Angry Search mechanizm - SearchFields.php and listviewdefs.php

    I have found, that search mechanism doesn't work on fields (which use relation mechanism) that are not defined both in SearchFields.php and in listviewdefs.php (in that file the field has to have the 'default' attribute set), Which means , that I can only search on columns which are displayed in a list view. I think it is a big ograniczenie (I have added about 60 fields stright to source code in different modules, and want just search through them from different modules).

    To check it , please just comment the 'default' attribute in modules/Contacts/metadata/listviewdefs.php in ACCOUNT_NAME entry and still try search through the account name field in contacts module. I the sugarcrm.log you can find error on where clause (column not found), which comes from not loading realation accounts. Why dooesn't it the realation?


    I’m upgrading form 4.0.1 by moving all changes to clean 4.5.0f installation. And there was a simply mechanism to build where clause in old version in ListView.php and in conjunction with sql query defined in for example Project.php (in create_list_query method) I could search in the way I could only dream....


    Is that mechanism in 4.5.0f OK or is it a bug??????
    How to search through not-displayed-fields in listview from other modules in 4.5?



    Wojtek.

    Server:
    SugarCrm 4.5.0f OS,
    Linux Debian,
    Apache 2.0.55,
    mysql 5.0.20,
    php 5.1.2

    Client:
    WinXp
    Mozilla

  2. #2
    wojkal is offline Sugar Community Member
    Join Date
    Jan 2006
    Posts
    10

    Talking Re: Search mechanizm - SearchFields.php and listviewdefs.php

    I spent about 12 hours looking the solution and at least found the lines in modules/Project/ListView.php:
    foreach($listViewDefs['Project'] as $col => $params) {
    if(!empty($params['default']) && $params['default'])
    $displayColumns[$col] = $params;
    }

    and commented the 3rd line: if(!empty($params['default']) && $params['default'])

    So, now I can search through not-displayed-fieled in Project module....

    Wojtek

  3. #3
    wojkal is offline Sugar Community Member
    Join Date
    Jan 2006
    Posts
    10

    Smile Re: Search mechanizm - SearchFields.php and listviewdefs.php

    Actually I was wrong presenting the solution in the previous post. I spent some more hours on analyzing the code and at least I made some changes in modules/Project/ListView.php to below ones:

    //$lv->setup($seedProject, 'include/ListView/ListViewGeneric.tpl', $where, $params);
    foreach($listViewDefs['Project'] as $columname => $attribs) {
    //wk - prepare filter_fileds array for enabling searching through not displayed fields but defined in listviewdefs.php

    $filter_fields[strtolower($columname)] = true;
    if(!empty($attribs['related_fields'])) {
    foreach($attribs['related_fields'] as $field) {
    $filter_fields[$field] = true;
    }
    }
    }
    $GLOBALS['log']->info("filter fields ListView.php" . print_r($filter_fields, true));
    $lv->setup($seedProject, 'include/ListView/ListViewGeneric.tpl', $where, $params,0,-1, $filter_fields);

    Wojtek

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •