Fixing AOR sql queries for custom fields
Fixing AOR sql queries for custom fields

(cherry picked from commit c589846)

cumanacr/SuiteCRM,MikeyJC/SuiteCRM,samus-aran/SuiteCRM,gcoop-libre/SuiteCRM,lionixevolve/LionixCRM,salesagility-davidthomson/SuiteCRM,daniel-samson/SuiteCRM,pribeiro42/SuiteCRM,JanSiero/SuiteCRM,lionixevolve/SuiteCRM,pribeiro42/SuiteCRM,daniel-samson/SuiteCRM,samus-aran/SuiteCRM,ChangezKhan/SuiteCRM,ChangezKhan/SuiteCRM,MikeyJC/SuiteCRM,salesagility/SuiteCRM,Dillon-Brown/SuiteCRM,noelhunter/SuiteCRM,pribeiro42/SuiteCRM,lionixevolve/LionixCRM,lionixevolve/SuiteCRM,lionixevolve/SuiteCRM,JimMackin/SuiteCRM,noelhunter/SuiteCRM,gcoop-libre/SuiteCRM,dfstrauss/SuiteCRM,dfstrauss/SuiteCRM,JanSiero/SuiteCRM,JanSiero/SuiteCRM,willrennie/SuiteCRM,pgorod/SuiteCRM,pgorod/SuiteCRM,MikeyJC/SuiteCRM,gcoop-libre/SuiteCRM,dfstrauss/SuiteCRM,horus68/SuiteCRM,cumanacr/SuiteCRM,gody01/SuiteCRM,horus68/SuiteCRM-Horus68,gody01/SuiteCRM,JimMackin/SuiteCRM,dfstrauss/SuiteCRM,horus68/SuiteCRM-Horus68,willrennie/SuiteCRM,JanSiero/SuiteCRM,ChangezKhan/SuiteCRM,willrennie/SuiteCRM,Dillon-Brown/SuiteCRM,noelhunter/SuiteCRM,JimMackin/SuiteCRM,cumanacr/SuiteCRM,lionixevolve/LionixCRM,horus68/SuiteCRM-Horus68,lionixevolve/LionixCRM,salesagility-davidthomson/SuiteCRM,lionixevolve/LionixCRM,daniel-samson/SuiteCRM,daniel-samson/SuiteCRM,pgorod/SuiteCRM,gody01/SuiteCRM,ChangezKhan/SuiteCRM,lionixevolve/LionixCRM,noelhunter/SuiteCRM,pgorod/SuiteCRM,gody01/SuiteCRM,lionixevolve/SuiteCRM,Dillon-Brown/SuiteCRM,MikeyJC/SuiteCRM,salesagility/SuiteCRM,willrennie/SuiteCRM,samus-aran/SuiteCRM,cumanacr/SuiteCRM,salesagility-davidthomson/SuiteCRM,JimMackin/SuiteCRM,gcoop-libre/SuiteCRM,horus68/SuiteCRM,pribeiro42/SuiteCRM,salesagility-davidthomson/SuiteCRM,horus68/SuiteCRM,samus-aran/SuiteCRM,Dillon-Brown/SuiteCRM,salesagility/SuiteCRM,horus68/SuiteCRM-Horus68,salesagility/SuiteCRM