Sunday, January 28, 2018

Developer Centric Logging

A few weeks ago I wrote some posts about overriding the CRON handler and I showed code about Developer Communication.   Since then I have talked to a few people and they all wanted to know what that cryptic function call did so I thought I would look into releasing it.   When I looked at the code I realized that I could not release it as it was crap.  So I took a week and rewrote it into this.  What we have here is a custom logger.  I found scant few examples of custom loggers on the internet so I hope someone finds this useful.

I think it adds all the missing pieces into SugarCRM's SugarLogger function like timers, headers, line tracing, email, and notifications.

Friday, January 19, 2018

Use Rows & Columns reports in Dashlets



I have been thinking about this dashlet for about 7 years.  Its been on my 'to-do' list for probably 4 years.  It found its way to the top of that list January 1st.  I finally coded it this week.  I have been dreading it, the Reports module can be difficult to decode let alone customize.  But, after all of that it was far easier than I had imagined.  I really only had 3 issues.

Monday, January 15, 2018

Add a JQuery plugin style to a SugarCRM field - Phone Fields to jQuery-mask

This is the second in a series where I will show ways to add JQuery custom UI elements to SugarCRM views.   This is fairly easy to do for most JQuery plugins.
In this post we are going to use jQuery-mask.  This JQuery plugin will convert normal text fields to masked input fields where the input is dynamically formatted as the user types it in.  For example you can do phone numbers, IP addresses, Money or percents.   It has a few options but in this first part we are just going to stick to the defaults.  First we have to get the plugin loading into SugarCRM.  We could use the JS loader plugin they released a while back but I had issues with that loading the script multiple times so we are going to stick to the tried and true JSGroupings for this one.

Sunday, January 14, 2018

Overriding MysqliManager.php

Overriding the stock SQL Managers


It took me a while to figure out how to override the core MysqliManager class so that I could add some code to email me the SQL errors that usually just go to my logs.  At first I tried just creating the custom file, expecting it to be read like others I had created, but I found that you actually  have to tell the system to use your custom class in the config_override.php file like this

Customizing cron.php

Customize cron.php without replacing the stock file

I wanted to add functionality where I would be emailed if any of the cron jobs failed for any reason.  I found in $sugar_config there is an option to override the cron class that is used to run scheduled jobs and normal cron related things. You can add it to the config_override.php file like this...

Adding custom, global, upgrade-safe PHP functions to SugarCRM

PHP Functions
This falls into the category of hard to find.  It is clearly outlined in the SugarCRM Developers Guide but I have never seen anyone use it.  There were no postings on the message boards about it and I simply stumbled upon it one day.  I wanted to consolidate some code written by others, there were functions that were repeated over and over again in module after module.  So I wanted to find a way to easily move these functions into someplace that was shareable by all modules and was upgrade safe.

Add a JQuery plugin style to a SugarCRM field - Checkboxes to Switchery

Switchery
This is the first in a series where I will show ways to add JQuery custom UI elements to SugarCRM views.   This is fairly easy to do for most JQuery plugins.



In this post we are going to use Switchery.  This JQuery plugin will convert normal checkboxes to iOS style buttons as shown above.   It has a few options but in this first part we are just going to stick to the defaults.  First we have to get the plugin loading into SugarCRM.  We could use the JS loader plugin they released a while back but I had issues with that loading the script multiple times so we are going to stick to the tried and true JSGroupings for this one.