{"action":"closed","issue":{"url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/1164","repository_url":"https://api.github.com/repos/salesagility/SuiteCRM","labels_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/1164/labels{/name}","comments_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/1164/comments","events_url":"https://api.github.com/repos/salesagility/SuiteCRM/issues/1164/events","html_url":"https://github.com/salesagility/SuiteCRM/issues/1164","id":143299374,"number":1164,"title":"Upgrading to SuiteCRM:  Timesheet module SQL error","user":{"login":"CaptainChainsaw","id":3913259,"avatar_url":"https://avatars.githubusercontent.com/u/3913259?v=3","gravatar_id":"","url":"https://api.github.com/users/CaptainChainsaw","html_url":"https://github.com/CaptainChainsaw","followers_url":"https://api.github.com/users/CaptainChainsaw/followers","following_url":"https://api.github.com/users/CaptainChainsaw/following{/other_user}","gists_url":"https://api.github.com/users/CaptainChainsaw/gists{/gist_id}","starred_url":"https://api.github.com/users/CaptainChainsaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CaptainChainsaw/subscriptions","organizations_url":"https://api.github.com/users/CaptainChainsaw/orgs","repos_url":"https://api.github.com/users/CaptainChainsaw/repos","events_url":"https://api.github.com/users/CaptainChainsaw/events{/privacy}","received_events_url":"https://api.github.com/users/CaptainChainsaw/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-03-24T16:50:39Z","updated_at":"2016-07-06T22:18:35Z","closed_at":"2016-07-06T22:18:35Z","body":"I had an issue when doing an upgrade with the timesheet module:\r\n\r\n`SELECT count(*) c FROM securitygroups LEFT JOIN securitygroups_cstm ON securitygroups.id = securitygroups_cstm.id_c INNER JOIN securitygroups_records ON securitygroups.id=securitygroups_records.securitygroup_id AND securitygroups_records.record_id=N'a8ef002f-7c2a-1747-7d0d-56f3c87000e5' AND securitygroups_records.deleted=0 AND securitygroups_records.module = N'Timesheet' where securitygroups.deleted=0 )`\r\n\r\n`SQL Error : Incorrect syntax near ')'.`\r\n\r\n\r\nThis is happening because of the trailing \")\".\r\n\r\nJust found out this is not part of Suite so can't commit a fix for it.  Here's the fix anyway:\r\n\r\nchange the following function in `modules/Timesheet/Timesheet.php`\r\n\r\n    'function _get_num_rows_in_query($query) {\r\n        $query = preg_replace(\"/^\\((.*?)\\)$/\", $matches[1], $query); \r\n        return parent::_get_num_rows_in_query($query);\r\n    }`"}}
{"actor":{"display_login":"willrennie"}}