Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: BUG In Search/Edit Layout???

  1. #1
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default BUG In Search/Edit Layout???

    (see my version info at bottom of this post)

    Is there a bug in the layout editor with regard to custimization of search functionality?
    I've been days trying to work out either a custom prioritized default sort order in ListView,
    (gave up a week ago) OR, implimentation of custom fields in either basic or advanced search.

    To the best of my limited ability, I have tried EVERYTHING offered in the forums and then some
    to address this with NO LUCK AT ALL. Ultimatlely I found that while there has been no shortage of inquiry
    on the subject, without exception the threads all end with NO indication of resolution (see below).
    Among the few responses on the subject which actually presume to offer advise I find but ONE that
    offers any but the following consistant and apparantly incomplete answer:

    1. create the fields in the custom fields editor,
    2. select layout editor, and check "edit in place,"
    3. select the module tab, click on the edit (pencil) icon, and
    4. drag the desired fields into place from the "Sugar Fields" menu.
    5. Save Layout

    It's just that easy! Right?

    But I'm here to tell you that I've been there and done that -- with both custom and OEM fields --
    and while the prescribed process IS EASY, and the fields look really good there on the
    search bar, IT JUST DOESN'T WORK!

    As you will see if you read further, I am not alone in this experience, and given the breivety of authoritative response on the subject, and the apparent and curiously complete lack of resolution I can't help but wonder if this isn't something that SugarCRM would just rather not discuss?

    The following (culled from these forums) date back to May, 2005

    http://www.sugarcrm.com/forums/showt...arch#post30810
    Quote Originally Posted by levar98
    Any one figured out how to add items to the search of a module?

    For example... I am tryin to add a user selection box to the calendar and activities module.
    To which "SugarTeam Member" Julian replied:
    Quote Originally Posted by julian
    Hello levar98,

    Module searches are handled in SearchForm.html and ListView.php-- you can also use the Field Layout Editor to add search columns (although you won't be able to select the file from the list).

    To use the Field Layout Editor, click Admin -> Field Layout Editor, then click the "Edit in Place" checkbox. A pencil icon will now appear throughout the application wherever you can edit the layout.
    But this (as I have discovered within the forums and my own expreience) is the SHORT ANSWER which doesn't always work!


    http://www.sugarcrm.com/forums/showt...arch#post30159
    Quote Originally Posted by leejordan
    Hi,

    I know this has been asked before but I haven't been able to find an answer that I can understand

    I have added a custom field to the Projects top level List, Display and Edit. I would like to be able to search on the value of that field on the Project List screen to only show projects that match the value in my new Custom Field.

    Could someone kindly tell me how this can be done. I'm a bit of a newbie to PHP and associated areas so be gentle with me!

    Thanks,

    Lee.
    It doesn't appear that anyone ever got back to Lee on his question. Hope he figured it out. You out there Lee???

    http://www.sugarcrm.com/forums/showt...arch#post28550
    Quote Originally Posted by nicoageis
    Hi

    I'm currently trying to customize the account tab.
    So first, I added new fields which suit well my case. But now I try to change the fields of the search and I can't find the way to do it.
    Any suggestions ? Is it possible ?

    thanks
    To which "Senior Member" stevec responded:
    http://www.sugarcrm.com/forums/showt...arch#post29667
    Quote Originally Posted by stevec
    If I understand the question correctly, you can add search fields - certainly to advanced search page, and also to the basic search page but it may be harder to label.

    Go to field layout in admin, select 'edit in place', then browse to the account page. The search panel will have an edit icon next to it which allows you to remove, edit and add criteria.
    After which the thread died, but apparantly, this established "METHOD" for adding fields (standard-issue OR custom) is hit and miss at best as Senior Member "stevec" found out only 7 days later. Watch...
    http://www.sugarcrm.com/forums/showt...arch#post30524
    Quote Originally Posted by stevec
    Hi,

    I'm modifying the search criteria for the accounts module. We have re-labeled company type to status and altered the default values of that dropdown list. By default - this is available on the advanced search.

    We are now trying to move this field up into the basic search. I can see that the labeling is slightly different but that's no matter. I've used the field editor to modify it inline and dragged the dropdown box up to the basic search panel. However, when going back to Accounts, the dropdown is empty.

    I've down similar with custom dropdowns and that works OK. It's just this standard field dropdown that is not working.

    Any ideas?
    Thanks
    Hmmm???

    http://www.sugarcrm.com/forums/showt...=7781#post7781
    Quote Originally Posted by pikebu
    hi,

    is it possible to add new fields to the search views, e.g. in the contacts search and then be able to search for this new field.a possible scenario would be to add the field haircolor for all contacts and then search for people only with blue hair etc. i'm only able to edit the detail, edit and list view of the contacts module. if it's not possible yet, it would be a good thing for future versions :-)
    To which member "Thierry" offered this well considered response (which still didn't work for me):
    Quote Originally Posted by Thierry
    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
    Thierry's response was followed by:

    Quote Originally Posted by sansbury
    I've tried this in the PopupProspectsPicker.html and it does not work. Tried using both standard fields (title) and a custom field. In both cases I got a result back as if my term was not being included in the query. Naturally there are no error messages whatsoever because those might help tell me what is wrong.

    Does anybody know where the searches are handled for dispatching? All there is in the source files is a <form> tag so I can't quite tell which .php file is doing the actual searching. I have a feeling it is ProspectFormBase.php which seems to hard-code everything but I can't tell for certain.

    EDIT: PopupProspects is the place where searches are dispatched and the search does seem to be hardcoded. If you know your way around PHP/SQL you shouldn't have too much trouble figuring it out. It's not automatic though by any means.
    and the thread died. Could someone (From Team Sugar/One of the Moderators perhapse) please offer a difinitive guide to customizing the various search bars???

    OR .... BETTER STILL! IMPLIMENT PRIORITIZATION OF SORT FUNCTIONALITY IN LIST VIEW!!!


    Should anyone be interested, here is my system/version info.

    OS type and version: (WIndows XP 5.1sp2)
    SugarCRM version: 4.0.1c
    PHP version: 4.4.2
    Web Server and version: Apache/2.0.55 (Win32)
    mySQL version 5.0.18-nt
    Last edited by tj@estreet.com; 2006-03-08 at 03:58 PM.

  2. #2
    wkcarlson is offline Sugar Community Member
    Join Date
    Jan 2006
    Location
    Alvarado, TX
    Posts
    28

    Default Re: BUG In Search/Edit Layout???

    Let's open this dialog here. I've added custom search fields that do exactly what I want them to do. However I had to go through the backdoor. In reading your post I have simplified things a little. I'll go one step at a time as I'm not totally clear on what part hangs you up... adding the search fields or making them actually function.

    To add the fields:
    1. Go to admin and select Field Layout.
    2. Select the "Edit in Place' checkbox
    3. Now for the less than intuitive part. This control requires a postback to the server in order to activate. Simply checking the box won't do the trick. You have to check mark the box and then click anywhere outside of the box to initiate the postback that actually gets you into the Edit in Place function.
    4. Now you should be on your home page and see all the pencil icons.
    5. Navigate to the page where you want to add the search field.
    6. Select the pencil icon right next to the search and this will allow you to add items to the search windows.

    This should allow you to add your custom search fields for both the basic and advanced searches. I must say though that I have not tested this to see if simply adding the search field actually makes the control actually search like desired. It wouldn't surprise me if all this does is add the custom field but nothing more. If this is the case I can walk you through the code changes I made to make my custom searches function.

  3. #3
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: BUG In Search/Edit Layout???

    Hi,

    Having been referenced in the original post, I'll detail the issue I had. I followed the same routine as you described (FireFox just requires the tick in the box to initiate the post-back). Anyway...

    The field 'company type' was relabelled to 'status'. The contents of the drop down were edited for different values.

    This drop down is in the advanced search and it works fine. As it is in the advanced search part of the screen, it is not available in the list of sugar fields. To get around this we tried three things.

    1. Dragged it up from the advanced search to one of the field locations in the basic search - the two fields swapped over.
    2. Deleted it from the advanced search - then copied it over to the basic search

    (both of these methods left the formatting slightly odd as the label and control are 'joined' in the basic search but separate in the advanced search. No matter, can be hacked later).

    3. Edit the relevant html file (can't recall the name) to duplicate the 'status' field in the basic search so it is in the same format as the others but referencing the status/company_type field.

    However, each of these resulted in the status drop-down being empty in the basic search panel. Confirmed when looking at the html code - no options. It just appears that that field cannot be used in the basic search for some reason.

  4. #4
    wagnerbl is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    330

    Default Re: BUG In Search/Edit Layout???

    You must have something like this on the /modules/module/ListView.php
    PHP Code:
        if (isset($_REQUEST['advanced']) && $_REQUEST['advanced'] == 'true') { 
    The problem is that this IF states that only on advanced module you can have something like this;
    PHP Code:
        if (!empty($assigned_user_id)) $search_form->assign("USER_FILTER"get_select_options_with_id(get_user_array(FALSE), $assigned_user_id));
            else 
    $search_form->assign("USER_FILTER"get_select_options_with_id(get_user_array(FALSE), '')); 
    That sort of line loads the menu you are looking for (this one loads the users dropdown).

  5. #5
    wkcarlson is offline Sugar Community Member
    Join Date
    Jan 2006
    Location
    Alvarado, TX
    Posts
    28

    Default Re: BUG In Search/Edit Layout???

    Wagnerbl beat me to it. Thanks! That's exactly my experience. You have to bind the dropdown items with the control. The second group of code Wagnerbl posted will get you there.
    Last edited by wkcarlson; 2006-03-10 at 12:38 PM.

  6. #6
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Re: BUG In Search/Edit Layout???

    Thanks everyone!

    I got it sorted out. My Bad! I had a discrepancy with user ID's that was preventing a search by user, and a similar discrepancy in dropdown keys that stood in the way of searching custom fields that otherwise looked fine.
    I do appreciate the input!

    Thanks again.
    T.J.

  7. #7
    lyenlawner is offline Junior Member
    Join Date
    Mar 2006
    Posts
    1

    Question Re: BUG In Search/Edit Layout???

    I have experienced the same issue as described above. I followed the simple editing steps and tried to add the provided field and title "Title:" to the advance search module. It does not function, and although the {title} field identifier is present when you move and save the edited search module, when I reopen search in edit mode the block where {title} was, is blank.

    Amending the script as above corrects this? Or works around it?

    I have found that custom fields I added to the advance search work without any code modification.

    ?

  8. #8
    marlo is offline Member
    Join Date
    Mar 2006
    Posts
    5

    Default Re: BUG In Search/Edit Layout???

    I want to add the Assigned to user multi select to the search on the Tasks module. I have been trying the examples I have found in the forums, but have not been able to get it to work yet. I notice that the Assigned to select is only in the advanced searches in all the modules. Is it possible to put it in the basic search? Tasks does not have the advanced search. I am trying to use similar code from the Leads module advanced search.

    I added this to modules/Tasks/SearchForm.html:
    Code:
    <td class="dataLabel" noWrap><slot>{MOD.LBL_ASSIGNED_TO}</slot>&nbsp;&nbsp;<slot><select size="3" name='assigned_user_id[]' multiple="multiple">{USER_FILTER}</select></slot></td>
    The select box is displaying, but there are no values in it. Does USER_FILTER need to be defined somewhere else?

    I also added the code from the lead module in modules/Tasks/ListView.php, but I can't test that without the select box working.

    Any help is appreciated.

    Thanks,
    Marlo

    Sugar version 4.0.1e open source

  9. #9
    marlo is offline Member
    Join Date
    Mar 2006
    Posts
    5

    Default Re: BUG In Search/Edit Layout???

    I figured out how to add the assigned to field to the basic search in Tasks. The search works fine, but the navigation and pagination links are not working properly. The field I added is in the URL befor the ? and the rest of the variables. I have been searching for 2 days to try to see where to change this. Is there a list of variables or order that I need to change somewhere? This is the URL that is generated for the next link....

    /sugartest/index.php&assigned_user_id[]=6d8d379b-712c-9cc7-3811-424b022d04df?action=index&query=true&module=Tasks& button=Search&Tasks_TASK_offset=20

    When I manually move &assigned_user_id[]=6d8d379b-712c-9cc7-3811-424b022d04df to the end of the url in the browser address window the link works fine.

    This order problem is for all the navigation links (the sort by links also) on this page now that I added the new field.

    Thanks for any help on this.

    Marlo

  10. #10
    marlo is offline Member
    Join Date
    Mar 2006
    Posts
    5

    Default Re: BUG In Search/Edit Layout???

    I figured out a solution to the link problem. The code does not check for the existance of a ? in the URL if the variable is an array. Here is my fix.

    In include/ListView/ListView.php, around line 825...

    Change this...

    Code:
    foreach($value as $valuename=>$valuevalue){
         $baseurl      .= "&{$name}[]=".$valuevalue;
    }

    To this....


    Code:
    foreach($value as $valuename=>$valuevalue){
         If (substr_count($baseurl, '?') > 0) {
              $baseurl      .= "&{$name}[]=".$valuevalue;
         } else {
              $baseurl      .= "?{$name}[]=".$valuevalue;
         }
    }
    Marlo

Page 1 of 2 12 LastLast

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
  •