SugarCRM 7 — Roll SugarCRM with Docker

I find trying to replicate the SugarCRM environment locally a real pain. One of the main issues is simply that Sugar requires such old versions of PHP to be installed, especially compared to other web projects I have that implement the latest/greatest versions of PHP. Running multiple PHP versions simultaneously can be a pain. One solution is to use Vagrant but I find that too heavy for my needs, so I gave docker a go and found it a much faster/elegant solution. ...

April 7, 2015 · Shane Dowling

Solving boot2docker's fail to start error

I’m putting this obvious solution up as I couldn’t see it anywhere online. If you try to start up boot2docker with boot2docker start and it returns. error in run: Failed to start machine “boot2docker-vm”: exit status 1 Before destroying everything and wiping your ~/Virtualbox VMs folder, try starting up Virtualbox and seeing if the vm simply hasn’t been suspended due to an OSX suspend or shutdown. Unpause the machine Send a shutdown signal Try boot2docker start again. And that’s it, hope it works for you. ...

February 7, 2015 · Shane Dowling

R — Cleaning/Merging Excel files

This is just a useful snippet of code I’ve been using a lot to tidy up messy exports I’ve been getting lately. Takes in a bunch of excel files, rewrites some variable column names in column 3 then outputs them as a list of dataframes. These then get merged into a single csv file. library(gdata) filenames <- list.files("excels", pattern="*.xlsx", full.names=TRUE) ldf <- lapply(filenames, function(file) { df = read.xls(file) names = names(df) sectionName = names[3] names(df)[names(df)==sectionName] <- "section" df }) library(reshape) result = reshape::merge_all(ldf) write.csv(result, "result.csv", row.names=FALSE)

February 5, 2015 · Shane Dowling

SugarCRM — Git Version Control Strategy

I’ve found SugarCRM an utter pain to work with in terms of version control for a number of reasons, but the most annoying is simply that certain critical elements of the SugarCRM configuration are stored on the database. Over time I’ve worked out a system that circumvents this and I’ve managed to create a very useful gitflow based workflow. I won’t go over what gitflow is or does, there’s a great explanation here and if you need a more visual explanation this cheatsheet is a terrific reference. ...

November 10, 2014 · Shane Dowling

Better PHP Debugging with Emacs

Recently I came across an app called CodeBug, a really nice PHP debugger for Mac. I find debugging PHP really painful within editors such as Vim or Emacs, so up until now I’d been stuck using the incredibly bloated PHPStorm. On Emacs you can currently use Geben for debugging but I find it’s install really painful and it’s usage even more so. I figured it was worth knocking up an Emacs plugin that allows you to set breakpoints in Codebug. ...

October 2, 2014 · Shane Dowling

Shellshock — Am I vulnerable and what do I do?

`Shellshock `__ is the latest Heartbleed level vulnerability to be discovered. It’s a pretty long running exploit in how bash handles environment variables. It’s a good thing to fix asap, especially if you’re running any old services like telnet, ftp or an old version of apache. Is my server vulnerable? Run this. env x='() { :;}; echo vulnerable' bash -c 'echo test' If you see vulnerable test You should patch immediately. ...

September 25, 2014 · Shane Dowling

SugarCRM 7 — Fix to re-enable ElasticSearch on custom modules

I had an issue in Sugar where some custom modules refused to appear in the Global Search settings, meaning I couldn’t index them in ElasticSearch. When I checked the module oddly enough unified search would be enabled: modules//vardefs.php 1. Re-enable the module To force it to be re-enabled update/create this file custom/Extension/modules//Ext/Vardefs/vardefs.php and add this setting. $dictionary['<MODULE>']['unified_search'] = true; 2. Re-enable a field You’ll also need a field using the unified index before SugarCRM ...

September 18, 2014 · Shane Dowling

SugarCRM 7 — Enable Importing on Custom Modules

I’ve been wracking my brain trying to get this guide to work with SugarCRM 7. Add to the fact that it “looks” like this is also how it’s done in SugarCRM 7, if you peruse the code under Accounts or Contacts. However it isn’t. This is how I’ve added importing support to custom modules. Set Module as Importable Under modules//_sugar.php set public $importable = true; Add Menu Item Under modules//clients/base/menus/header/header.php you should have something like ...

September 11, 2014 · Shane Dowling

DOMpdf failing to render certain accented characters

I’ve noticed some issues with DOMpdf when trying to generate PDFs using their internal Helvetica font. After banging my head against a wall for a few hours trying to “fix” UTF-8 support, it turned out UTF-8 support was working fine. Essentially DOMpdf’s internal Helvetica font didn’t support a few polish characters. Specifically the Sacute, sacute and a few others like this. This was a bit of a killer problem for my requirements so I needed a work-around. My workaround was to use Arial fonts(they were close enough), but if you really need Helvetica you could source a copy of the .ttfs and replicate these steps. ...

August 21, 2014 · Shane Dowling

Yii — Convert database to migrations

It happens to be best of us. You start a new Yii project, generate a few tables and fields, create the models in Gii and totally forget to use any migrations. There’s an easy way to move yourself to a db backed migration. Put txDbMigration in your codebase. Create a new seed migration file Update your console config file Only use migrations from now on.

August 21, 2014 · Shane Dowling