Editor’s Note: This tip comes from a forums post by our very prolific community member, Jason Eggers ( probably better known by his forums, Twitter, and IRC handle ‘eggsurplus’ ). He’s contributed several bug fixes and features to SugarCRM over the years, including the dashlet auto-refresh feature in the recently released Sugar 6.2. He’s also built several add-on modules for Sugar; you can check them out at https://www.eggsurplus.com/store/.
I recently ran into an issue where I did not want the default query for a dashlet to be used. The biggest issue was the table_name.deleted = 0 condition that was being added to the where clause by default. Looking through the code there is no option to remove this. So to trick Sugar into giving the desired query I had to do the following:
1. Open the dashlet file. This one was a custom module so it was modules/CustomModule/Dashlets/CustomModuleDashlet/CustomModuleDashlet.php
2. Add a buildWhere function to override the DashletGeneric buildWhere:
3. Override/add a process function:
This then creates the following where clause:
Which turns the custom_module.deleted condition into a string. That along with the 1=1 will cause it to always return true making it return all rows as desired.