{"action":"created","issue":{"url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/6476","repository_url":"https://api.github.com/repos/salesagility/SuiteCRM","labels_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/6476/labels{/name}","comments_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/6476/comments","events_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/6476/events","html_url":"https://github.com/salesagility/SuiteCRM/issues/6476","id":378651966,"node_id":"MDU6SXNzdWUzNzg2NTE5NjY=","number":6476,"title":"Lead detail view fails when has scheduled call","user":{"login":"tech-ch1","id":37901650,"node_id":"MDQ6VXNlcjM3OTAxNjUw","avatar_url":"https://avatars2.githubusercontent.com/u/37901650?v=4","gravatar_id":"","url":"https://api.github.com/users/tech-ch1","html_url":"https://github.com/tech-ch1","followers_url":"https://api.github.com/users/tech-ch1/followers","following_url":"https://api.github.com/users/tech-ch1/following{/other_user}","gists_url":"https://api.github.com/users/tech-ch1/gists{/gist_id}","starred_url":"https://api.github.com/users/tech-ch1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tech-ch1/subscriptions","organizations_url":"https://api.github.com/users/tech-ch1/orgs","repos_url":"https://api.github.com/users/tech-ch1/repos","events_url":"https://api.github.com/users/tech-ch1/events{/privacy}","received_events_url":"https://api.github.com/users/tech-ch1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-11-08T09:46:02Z","updated_at":"2018-11-09T12:37:22Z","closed_at":null,"author_association":"NONE","body":"#### Issue\r\nOn leads having scheduled calls, detailed view is broken (ajax disabled).\r\n\r\n#### Expected Behavior\r\nThe call should be displayed in the Activities SubPannel, detailed view shouldn't be broken.\r\n\r\n#### Actual Behavior\r\nOn call add, prints a \"database failure\" message. On page refresh, all subpannels are missing and a \"database failure\" message is printed at the bottom of the page.\r\n\r\n`Thu Nov  8 10:20:22 2018 [9215][1b0e19a9-67ac-8ce6-6ae3-5a69b21c1c5f][FATAL] Mysqli_query failed.\r\nThu Nov  8 10:20:22 2018 [9215][1b0e19a9-67ac-8ce6-6ae3-5a69b21c1c5f][FATAL] Error retrieving Lead list:  Query Failed: (SELECT meetings.id ,  meetings.assigned_user_id  ,  meetings.name ,  meetings.status ,  '                                                                                                                                                                                                                                                              ' contact_name ,  '                                    '  contact_id ,  meetings.date_end  as date_due  ,  jt1.user_name assigned_user_name ,  jt1.created_by assigned_user_name_owner  ,  'Users' assigned_user_name_mod,  '                                                                                                                                                                                                                                                              ' contact_name_owner ,  '                                                                                                                                                                                                                                                              ' contact_name_mod ,  meetings.recurring_source ,  meetings.created_by  ,  'meetings' panel_name  FROM meetings  LEFT JOIN meetings_cstm ON meetings.id = meetings_cstm.id_c   LEFT JOIN  users jt1 ON meetings.assigned_user_id=jt1.id AND jt1.deleted=0\r\n\r\n AND jt1.deleted=0 INNER JOIN  meetings_leads ON meetings.id=meetings_leads.meeting_id AND meetings_leads.lead_id='7be1a585-8ca0-f09b-b915-5be3f7532b47' AND meetings_leads.deleted=0\r\n\r\n  where ((meetings.status !='Held' AND meetings.status !='Not Held')) AND meetings.deleted=0) UNION ALL ( SELECT meetings.id ,  meetings.assigned_user_id  ,  meetings.name ,  meetings.status ,  '                                                                                                                                                                                                                                                              ' contact_name ,  '                                    '  contact_id ,  meetings.date_end  as date_due  ,  jt1.user_name assigned_user_name ,  jt1.created_by assigned_user_name_owner  ,  'Users' assigned_user_name_mod,  '                                                                                                                                                                                                                                                              ' contact_name_owner ,  '                                                                                                                                                                                                                                                              ' contact_name_mod ,  meetings.recurring_source ,  meetings.created_by  ,  'oldmeetings' panel_name  FROM meetings  LEFT JOIN meetings_cstm ON meetings.id = meetings_cstm.id_c   LEFT JOIN  users jt1 ON meetings.assigned_user_id=jt1.id AND jt1.deleted=0\r\n\r\n AND jt1.deleted=0  where ( meetings.parent_id = '7be1a585-8ca0-f09b-b915-5be3f7532b47'\r\n            AND meetings.parent_type = 'Leads' AND meetings.id NOT IN ( SELECT meeting_id FROM meetings_leads )  AND (meetings.status !='Held' AND meetings.status !='Not Held')) AND meetings.deleted=0 ) UNION ALL ( SELECT tasks.id ,  tasks.assigned_user_id  ,  tasks.name ,  tasks.status  ,  LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,'')))) contact_name ,  tasks.contact_id  , NULL date_due,  jt1.user_name assigned_user_name ,  jt1.created_by assigned_user_name_owner  ,  'Users' assigned_user_name_mod,  '                                                                                                                                                                                                                                                              ' contact_name_owner ,  '                                                                                                                                                                                                                                                              ' contact_name_mod , NULL recurring_source,  tasks.created_by  ,  'tasks' panel_name  FROM tasks   LEFT JOIN  contacts contacts ON tasks.contact_id=contacts.id AND contacts.deleted=0\r\n\r\n AND contacts.deleted=0  LEFT JOIN  users jt1 ON tasks.assigned_user_id=jt1.id AND jt1.deleted=0\r\n\r\n AND jt1.deleted=0 INNER JOIN  leads tasks_rel ON tasks.parent_id=tasks_rel.id AND tasks_rel.deleted=0\r\n AND tasks.parent_type = 'Leads'\r\n  where ( tasks.parent_id='7be1a585-8ca0-f09b-b915-5be3f7532b47' AND (tasks.status != 'Completed' AND tasks.status != 'Deferred')) AND tasks.deleted=0 ) UNION ALL ( SELECT calls.id ,  calls.assigned_user_id  ,  calls.name ,  calls.status ,  '                                                                                                                                                                                                                                                              ' contact_name ,  '                                    '  contact_id ,  calls.date_end  as date_due  ,  jt1.user_name assigned_user_name ,  jt1.created_by assigned_user_name_owner  ,  'Users' assigned_user_name_mod,  '                                                                                                                                                                                                                                                              ' contact_name_owner ,  '                                                                                                                                                                                                                                                              ' contact_name_mod ,  calls.recurring_source ,  calls.created_by  ,  'calls' panel_name  FROM calls  LEFT JOIN calls_cstm ON calls.id = calls_cstm.id_c   LEFT JOIN  users jt1 ON calls.assigned_user_id=jt1.id AND jt1.deleted=0\r\n\r\n AND jt1.deleted=0 INNER JOIN  calls_leads ON calls.id=calls_leads.call_id AND calls_leads.lead_id='7be1a585-8ca0-f09b-b915-5be3f7532b47' AND calls_leads.deleted=0\r\n\r\n  where ((calls.status != 'Held' AND calls.status != 'Not Held')) AND calls.deleted=0 ) UNION ALL ( SELECT calls.id ,  calls.assigned_user_id  ,  calls.name ,  calls.status ,  '                                                                                                                                                                                                                                                              ' contact_name ,  '                                    '  contact_id ,  calls.date_end  as date_due  ,  jt1.user_name assigned_user_name ,  jt1.created_by assigned_user_name_owner  ,  'Users' assigned_user_name_mod,  '                                                                                                                                                                                                                                                              ' contact_name_owner ,  '                                                                                                                                                                                                                                                              ' contact_name_mod ,  calls.recurring_source ,  calls.created_by  ,  'oldcalls' panel_name  FROM calls  LEFT JOIN calls_cstm ON calls.id = calls_cstm.id_c   LEFT JOIN  users jt1 ON calls.assigned_user_id=jt1.id AND jt1.deleted=0\r\n\r\n AND jt1.deleted=0  where ( calls.parent_id = '7be1a585-8ca0-f09b-b915-5be3f7532b47'\r\n            AND calls.parent_type = 'Leads' AND calls.id NOT IN ( SELECT call_id FROM calls_leads )  AND (calls.status != 'Held' AND calls.status != 'Not Held')) AND calls.deleted=0 ) ORDER BY date_start desc LIMIT 0,10: MySQL error 1054: Unknown column 'date_start' in 'order clause'\r\nThu Nov  8 10:20:22 2018 [9215][1b0e19a9-67ac-8ce6-6ae3-5a69b21c1c5f][FATAL] Exception handling in /srv/ch1/suitecrm/include/MVC/Controller/SugarController.php:400\r\nThu Nov  8 10:20:22 2018 [9215][1b0e19a9-67ac-8ce6-6ae3-5a69b21c1c5f][FATAL] Exception in Controller: Défaillance de la base de données. Veuillez consulter suitecrm.log pour plus de détails.\r\nThu Nov  8 10:20:22 2018 [9215][1b0e19a9-67ac-8ce6-6ae3-5a69b21c1c5f][FATAL] backtrace:\r\n#0 /srv/ch1/suitecrm/include/database/DBManager.php(353): sugar_die('D\\xC3\\xA9faillance de...')\r\n#1 /srv/ch1/suitecrm/include/database/DBManager.php(328): DBManager->registerError('Error retrievin...', 'Error retrievin...', true)\r\n#2 /srv/ch1/suitecrm/include/database/MysqliManager.php(179): DBManager->checkError('Error retrievin...', true)\r\n#3 /srv/ch1/suitecrm/include/database/MysqlManager.php(285): MysqliManager->query('(SELECT meeting...', true, 'Error retrievin...')\r\n#4 /srv/ch1/suitecrm/data/SugarBean.php(1284): MysqlManager->limitQuery('(SELECT meeting...', 0, 10, true, 'Error retrievin...')\r\n#5 /srv/ch1/suitecrm/data/SugarBean.php(1016): SugarBean->process_union_list_query(Object(Lead), '(SELECT meeting...', 0, 10, 10, '', Object(aSubPanel), '( SELECT count(...', Array)\r\n#6 /srv/ch1/suitecrm/include/ListView/ListView.php(1141): SugarBean::get_union_related_list(Object(Lead), 'date_start desc', 'desc', '', 0, -1, 10, '', Object(aSubPanel))\r\n#7 /srv/ch1/suitecrm/include/ListView/ListViewSubPanel.php(142): ListView->processUnionBeans(Object(Lead), Object(aSubPanel), 'activities_CELL', false)\r\n#8 /srv/ch1/suitecrm/include/SubPanel/SubPanel.php(220): ListViewSubPanel->process_dynamic_listview('Leads', Object(Lead), Object(aSubPanel), false)\r\n#9 /srv/ch1/suitecrm/include/SubPanel/SubPanelTiles.php(357): SubPanel->ProcessSubPanelListView('include/SubPane...', Array)\r\n#10 /srv/ch1/suitecrm/include/MVC/View/SugarView.php(1167): SubPanelTiles->display()\r\n#11 /srv/ch1/suitecrm/include/MVC/View/SugarView.php(239): SugarView->_displaySubPanels()\r\n#12 /srv/ch1/suitecrm/include/MVC/Controller/SugarController.php(435): SugarView->process()\r\n#13 /srv/ch1/suitecrm/include/MVC/Controller/SugarController.php(375): SugarController->processView()\r\n#14 /srv/ch1/suitecrm/include/MVC/SugarApplication.php(113): SugarController->execute()\r\n#15 /srv/ch1/suitecrm/index.php(52): SugarApplication->execute()\r\n#16 {main}\r\n`\r\n\r\n#### Possible Fix\r\nAs a workaround, I edited modules/Leads/metadata/subpaneldefs.php and removed line 51 `'sort_by' => 'date_start'`. It fixes the problem.\r\n\r\n#### Steps to Reproduce\r\n0. Disable AJAX for Leads and Calls\r\n1. Create a lead L\r\n2. Go to lead detailed view\r\n3. Create a call for L\r\n4. You got an error message.\r\n5. Refresh\r\n6. Detailed view is broken\r\n\r\n\r\n#### Your Environment\r\n* SuiteCRM Version used: 7.10.10\r\n* Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Firefox 64.0 64bit\r\n* Environment name and version (e.g. MySQL, PHP 7): php-fpm 7.2, MariaDB 10.1.26\r\n* Operating System and version (e.g Ubuntu 16.04): Debian Stretch 9.0 (stable)"},"comment":{"url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/comments/437347508","html_url":"https://github.com/salesagility/SuiteCRM/issues/6476#issuecomment-437347508","issue_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/6476","id":437347508,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzM0NzUwOA==","user":{"login":"markbond1007","id":17045461,"node_id":"MDQ6VXNlcjE3MDQ1NDYx","avatar_url":"https://avatars2.githubusercontent.com/u/17045461?v=4","gravatar_id":"","url":"https://api.github.com/users/markbond1007","html_url":"https://github.com/markbond1007","followers_url":"https://api.github.com/users/markbond1007/followers","following_url":"https://api.github.com/users/markbond1007/following{/other_user}","gists_url":"https://api.github.com/users/markbond1007/gists{/gist_id}","starred_url":"https://api.github.com/users/markbond1007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbond1007/subscriptions","organizations_url":"https://api.github.com/users/markbond1007/orgs","repos_url":"https://api.github.com/users/markbond1007/repos","events_url":"https://api.github.com/users/markbond1007/events{/privacy}","received_events_url":"https://api.github.com/users/markbond1007/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T12:37:22Z","updated_at":"2018-11-09T12:37:22Z","author_association":"CONTRIBUTOR","body":"Ahh sorry I thought you wanted the log file.\r\n\r\n[layoutdefs.ext.txt](https://github.com/salesagility/SuiteCRM/files/2565831/layoutdefs.ext.txt)\r\n\r\nI have uploaded the offending generated file, its not currently got the problem becuase as mentioned I manually updated the file in custom that casued the problem in this file. However I can now tell you which file caused it:\r\n\r\n`// ModuleInstaller->merge_files(): found custom/Extension/modules/FP_events/Ext/Layoutdefs/fp_events_activities_1_calls_FP_events.php`\r\n\r\nThis file is merged into the file after tasks one, the calls version had the date_start instead of date_due (and thus over-wrote the correct information provided by tasks).\r\n\r\nThe _override files must have been generated by studio as I certainly didn't create them ;-) but looking at them they don't appear to be anything that would cause this.\r\n"}}
{"actor":{"display_login":"markbond1007"}}