AnsweredAssumed Answered

Select all records from popup with condition

Question asked by a.kramov on May 19, 2015
Hi all!

I'm using SugarCRM 6.15 CE.

When I choose "Select all records" from popup window with condition I get the message "Database failure". I watched in sugarcrm.log file and as I understood query uses 'where' condition. Problem is that this condition uses data from another related table but there is no join for this table in query.

Here is a query:

SELECT  ts_parcel.* ,ts_parcel_cstm.value_c , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner  , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner  , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner  , 'Users' assigned_user_name_mod, '                                                                                                                                                                                                                                                              ' ts_parcel_ts_dispatch_name , '                                    '  ts_parcel_ts_dispatchts_dispatch_ida , '                                                                                                                                                                                                                                                              ' ts_parcel_ts_dispatch_name_advanced , '                                                                                                                                                                                                                                                              ' ts_delivery_ts_parcel_1_name , '                                    '  ts_delivery_ts_parcel_1ts_delivery_ida  FROM ts_parcel  LEFT JOIN ts_parcel_cstm ON ts_parcel.id = ts_parcel_cstm.id_c   LEFT JOIN  users jt0 ON ts_parcel.modified_user_id=jt0.id AND jt0.deleted=0

 AND jt0.deleted=0  LEFT JOIN  users jt1 ON ts_parcel.created_by=jt1.id AND jt1.deleted=0

 AND jt1.deleted=0  LEFT JOIN  users jt2 ON ts_parcel.assigned_user_id=jt2.id AND jt2.deleted=0

 AND jt2.deleted=0 where ((jt3.name like '92%')) AND ts_parcel.deleted=0

I find out the code of Save2.php file and try to research it. I didn't find the strings that should render join string.

Thanks for a reply!

Outcomes