Hi All,

I found a strange behaviour of basic_search/advanced_search panels in ListView.

How To Reproduce:
1. When in ListView view in any module (XXX) click "Advanced Search" link
2. Click Save
3. Click link "Basic Search"
4. Go to other module
5. Go back to XXX module - the "Advanced Search" panel is allways visible (by default) in module XXX.
This is even when user logs out & logs in

I would expect that a default search form (upon entering a module's ListView) will allways be "Basic View".
Is this a Bug or a Feature?

Workaround:
3. a Click save when, again om "Basic Search" mode.


I've found out that this is the case due to Sugar remembering the search panel configuration for any user/module (contents column in user_preferences table). This done when user clicks the "Save" button.

This configuration is later automatically aplied in
ViewList->Prepare by issuing
Code:
$this->storeQuery->loadQuery($this->module);
$this->storeQuery->populateRequest(); // this modifies the $_REQUEST variable.
I've found a non-upgradesafe fix. in ListView class (list.view.php):
Code:
      $this->storeQuery = new StoreQuery();
>>  if (isset($_REQUEST["searchFromTab"])) {
            if (!isset($_REQUEST['query'])){
                        $this->storeQuery->loadQuery($this->module);
                        $this->storeQuery->populateRequest();
            } else {
                        $this->storeQuery->saveFromRequest($this->module);
           }
>>  }
}

Could you please propose something beter?

Best Regards,
Marcin