Skip to content

Instantly share code, notes, and snippets.

View mmarum-sugarcrm's full-sized avatar

Matt Marum mmarum-sugarcrm

View GitHub Profile
@mmarum-sugarcrm
mmarum-sugarcrm / custom_clients_base_layouts_record_record.php
Last active January 30, 2018 23:21
Adding a new view to base Record layout in Sugar 7
<?php
/*
* By installing or using this file, you are confirming on behalf of the entity
* subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
* the SugarCRM Inc. Master Subscription Agreement ("MSA"), which is viewable at:
* http://www.sugarcrm.com/master-subscription-agreement
*
* If Company is not bound by the MSA, then by installing or using this file
* you are agreeing unconditionally that Company will be bound by the MSA and
@mmarum-sugarcrm
mmarum-sugarcrm / Extending Record View to customize prefill when a user copies a record.js
Last active November 22, 2016 09:46
custom/modules/MODULE-NAME/clients/base/views/record/record.js
({
//The below jsdoc was copied from base RecordView controller in Sugar 7.2
extendsFrom: 'RecordView',
/**
* Called when current record is being duplicated to allow customization of
* fields that will be copied into new record.
*
* Override to setup the fields on this bean prior to being displayed in
* Create dialog.
*
@mmarum-sugarcrm
mmarum-sugarcrm / case-count-by-status.js
Last active March 3, 2016 04:27
Case Count by Status example dashlet controller
/**
* Case Count by Status example dashlet controller
*
* Controller logic watches the current collection on display and updates the
* dashlet automatically whenever the current collection changes.
*
* This is a simple example of a dashlet for List Views in Sugar 7.x.
*
**/
({
<?php
/*
* By installing or using this file, you are confirming on behalf of the entity
* subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
* the SugarCRM Inc. Master Subscription Agreement ("MSA"), which is viewable at:
* http://www.sugarcrm.com/master-subscription-agreement
*
* If Company is not bound by the MSA, then by installing or using this file
* you are agreeing unconditionally that Company will be bound by the MSA and
@mmarum-sugarcrm
mmarum-sugarcrm / highcharts-example.hbs
Last active January 28, 2016 17:11
Highcharts Sugar Dashlet Example
{{! Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. }}
<h3>Example Button</h3>
{{! Unicorn UI styled buttons }}
<span class="button-wrap">
<a class="button button-pill button-raised button-royal">Go</a>
</span>
<a class="button button-3d button-primary button-rounded">Check out the new site!</a>
<h3>Example Highchart</h3>
{{!
div element we are reserving for use with our Highchart.
@mmarum-sugarcrm
mmarum-sugarcrm / CssLoader.js
Created January 28, 2016 16:23
CssLoader.js
/**
* Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
(function (app) {
app.events.on('app:init', function () {
/**
* This plugin allows components to dynamically load CSS files.
*
* <pre><code>
* // Sample component:
@mmarum-sugarcrm
mmarum-sugarcrm / ScriptLoader.js
Created January 28, 2016 16:03
ScriptLoader plug-in example
/**
* Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
(function (app) {
/**
* Allow jquery and moment.js to be used in requirejs modules.
*/
var bootstrapScriptLoader = function() {
define('jquery', [], function() {
return jQuery;
@mmarum-sugarcrm
mmarum-sugarcrm / AccountsOnSaveHooksTest.php
Last active January 12, 2016 06:39
PHPUnit tests for example AccountsOnSave logic hooks
<?php
/*
* Copyright 2015 SugarCRM Inc.
*/
require_once 'custom/modules/Accounts/AccountsOnSaveHooks.php';
/**
* Example tests for our custom Logic Hook.
*/
@mmarum-sugarcrm
mmarum-sugarcrm / apache22.sh
Created December 22, 2015 18:42
Set up Apache 2.2 for Ubuntu 12.04 for easy development by Vagrant user
#!/bin/bash
# Add phpinfo to web dir as a convenience
echo "<?php phpinfo();" > /var/www/phpinfo.php
# We will have Apache run as Vagrant user because this will help prevent permissions issues on a dev setup
sed -i "s/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=vagrant/" /etc/apache2/envvars
chown -R vagrant /var/www/
usermod -a -G www-data vagrant
@mmarum-sugarcrm
mmarum-sugarcrm / php54.sh
Last active December 22, 2015 18:32
Provision Apache 2, MySQL 5.5, Elasticsearch and PHP 5.4.x on an Ubuntu 12.04 machine
#!/bin/bash
#
# Setup the the box. This runs as root
apt-get -y update
# MySQL default username and password is "root"
echo "mysql-server-5.5 mysql-server/root_password password root" | debconf-set-selections
echo "mysql-server-5.5 mysql-server/root_password_again password root" | debconf-set-selections