Custom relationship to Leads broke "ALL checkbox" mass update

Hello everyone

I’ve copy Leads-Contacts, Leads-Accounts, and Leads-Opportunity converted relationship logic
I mean the logic that created relationship and update lead column "contacs_id", "account_id", "opportunity_id" in MySQL during the leads conversion

so I check that logic in PHP files and just add my own custom module named “people” so it works well = it also created a new ‘people’ record during leads conversion and update “people_id” in Leds MySQL

My issue was found later when I try to update ALL my leads
I have ~80 leads and it contains 2 pages with 40 records
I trying to use “select ALL” and do mass update and got “database fail”

It only happens if I “select all” like the screenshot
But if I just select all manually it will work well

I attached the log and here is main lin MySQL error 1054: Unknown column '' in 'on clause'

The problem in this line
LEFT JOIN leads jt8 ON AND jt8.deleted=0

If I comment my custom code (disable my own custom relationship to leads)
then this line in a new “selected and update all query” will be work and this line will look a little different LEFT JOIN people jt8 ON AND jt8.deleted=0


Mysqli_query failed.
Query Failed:  SELECT  leads.* , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , 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, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , campaign_name , jt3.assigned_user_id campaign_name_owner  , 'Campaigns' campaign_name_mod, jtl4.call_id call_id, accept_status_id, jtl4.accept_status accept_status_name, jtl5.meeting_id meeting_id, fp_events_leads_1.fp_events_leads_1fp_events_ida fp_events_leads_1fp_events_ida, event_invite_id, fp_events_leads_1.invite_status event_status_name, event_status_id, fp_events_leads_1.accept_status event_accept_status , LTRIM(RTRIM(CONCAT(IFNULL(jt8.first_name,''),' ',IFNULL(jt8.last_name,'')))) people_leads_1_name , jt8.assigned_user_id people_leads_1_name_owner  , 'Leads' people_leads_1_name_mod , initiatives_leads_1_name, jtl9.initiatives_leads_1initiatives_ida initiatives_leads_1initiatives_ida, home_region , lead_owner , work_region , initiatives , organization_relate  ,email_addresses.email_address email1 FROM leads   LEFT JOIN  users jt0 ON AND jt0.deleted=0

 AND jt0.deleted=0  LEFT JOIN  users jt1 ON AND jt1.deleted=0

 AND jt1.deleted=0  LEFT JOIN  users jt2 ON AND jt2.deleted=0

 AND jt2.deleted=0  LEFT JOIN  campaigns jt3 ON AND jt3.deleted=0

 AND jt3.deleted=0  LEFT JOIN  calls_leads jtl4 ON AND jtl4.deleted=0

 LEFT JOIN  calls jt4 ON AND jt4.deleted=0
 AND jt4.deleted=0  LEFT JOIN  meetings_leads jtl5 ON AND jtl5.deleted=0

 LEFT JOIN  meetings jt5 ON AND jt5.deleted=0
 AND jt5.deleted=0  LEFT JOIN  fp_events_leads_1_c fp_events_leads_1 ON AND fp_events_leads_1.deleted=0

 LEFT JOIN  fp_events jt6 ON AND jt6.deleted=0
 AND jt6.deleted=0  LEFT JOIN  leads jt8 ON AND jt8.deleted=0

 AND jt8.deleted=0  LEFT JOIN  initiatives_leads_1_c jtl9 ON AND jtl9.deleted=0

 LEFT JOIN  initiatives jt9 ON AND jt9.deleted=0
 AND jt9.deleted=0 LEFT JOIN regions jt10 ON leads.regions_id = AND jt10.deleted=0  LEFT JOIN people jt11 ON leads.people_relate_id = AND jt11.deleted=0  LEFT JOIN regions jt12 ON leads.regions_id1 = AND jt12.deleted=0  LEFT JOIN initiatives jt13 ON leads.initiatives_id = AND jt13.deleted=0  LEFT JOIN organizations jt14 ON leads.organizations_id = AND jt14.deleted=0  LEFT JOIN email_addr_bean_rel on = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Leads' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on = email_addr_bean_rel.email_address_id  where leads.deleted=0: MySQL error 1054: Unknown column '' in 'on clause'


seems I double define relationship between people and leads
first by this SuiteCRM Nice Relationships
and second by step 1. this Get leads converted custom module ID

I deleted the first one and all selected and mass update works right now and 80 records getting update during ~ 120 sec hah :no_mouth: