I think I've found an issue in the list view code whilst working on some custom modules (hence I can't say for sure if this is reproduceable in all given situations).
SugarCRM v5.1.0RC
Steps to reproduce:
1. in moduleBuilder, created new module based on Basic. Deploy it.
2. go into accounts and create one-to-many relationship with new module
3. create some new module entries, going via the accounts screen
4. Set list view to show only name and assigned to fields
What happens is that the module entries won't display in the list view of the module because the list query is all messed up. I've tracked this down to it doing a strange bit of SQL in SugarBean::create_new_list_query(). Around line 3208-3210, this is where it checks for related fields that aren't many-to-many. It reaches a !$table_joined check and when it goes in it does this line:
so at the end of create_new_list_query(), $ret_array looks like this (amisc is my module name):Code:$ret_array['from'] .= ' ' . $join['join']. ' AND ' . $params['join_table_alias'].'.deleted=0';
This is wrong in 2 ways, it doesn't add a join with the jt0 table, and it adds a where clause to the from field.Code:array(5) { ["select"]=> string(91) " SELECT amisc.id , amisc.name , jt0.user_name assigned_user_name, amisc.assigned_user_id " ["from"]=> string(31) " FROM amisc AND jt0.deleted=0" ["from_min"]=> string(12) " FROM amisc " ["where"]=> string(22) " where amisc.deleted=0" ["order_by"]=> string(0) "" }
The workaround is to simply not display the assigned to field in this situation. I have not investigated this fully as I don't need this field, but as it took long enough to find and is in base code I thought it was worth publishing.
It's possible that it's the result of the moduleBuilder not establishing a proper relationship with the user information, or in the way I've created my custom module.


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks