Skip to content

Instantly share code, notes, and snippets.

@elchele
elchele / module-list.js
Created May 15, 2015 18:55
Customization for adding "alias" NavBar links to Sugar 7
({
/* File: ./custom/clients/base/layouts/module-list/module-list.js */
extendsFrom: 'ModuleListLayout',
_addDefaultMenus: function() {
var moduleList = app.metadata.getModuleNames({filter: 'display_tab', access: 'read'});
moduleList.push('Custom1');
@elchele
elchele / CustomSplitAttachFolder.php
Last active January 30, 2016 01:56
(6.6/6.7 Only) Custom UploadStream class extension. Modifies default upload behavior so as to store files using date of upload within directory structure, such as: ./upload/2015/04/02/myfile.txt
<?php
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/include/CustomSplitAttachFolder.php
*
* UploadStream extension to add use of date named
* subfolders to ./upload directory.
*
* e.g. ./upload/2015/04/02/<MyApril2nd2015File.docRepresentedAsGUID>
*
@elchele
elchele / StockApi.php
Created March 26, 2015 21:01
Custom endpoint for Sugar REST API, uses CURL to interact with external web service.
<?php
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/Accounts/clients/base/api/StockApi.php
*
* Custom Sugar REST API endpoint demonstrating use of CURL to
* interact with an external web service.
*
* Useful for circumventing XSS issues one may experience when calling
* a web service via JavaScript (e.g. Sidecar controller)
@elchele
elchele / subpanels.js
Last active May 16, 2017 21:22
Custom controller for subpanels layout, hides specific subpanels based on parent record data
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/<Module>/clients/base/layouts/subpanels/subpanels.js
*
* Extended subpanels layout controller for hiding
* subpanels upon record load and based on parent record data
*
*/
extendsFrom: 'SubpanelsLayout',
@elchele
elchele / record.js
Last active October 1, 2015 20:40
Custom record controller for dynamically loading view metadata based on current record data.
({
/*
File: ./custom/modules/<Module>/clients/base/views/record/record.js
Requires metadata for other view: ./custom/modules/<Module>/clients/base/views/<view>/<view>.php
*/
extendsFrom: 'RecordView',
/**
@elchele
elchele / record.js
Created February 21, 2015 03:03
Custom controller for automatically uppercasing last_name value when field loses focus
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/<Module>/clients/base/views/record/record.js
*
* Custom RecordView controller for automatically converting
* last_name value to upper when focus is lost
*/
extendsFrom:'RecordView',
@elchele
elchele / record.js
Created November 18, 2014 01:14
Custom controller for RecordView, demonstrates dynamic required fields based on current user
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/<Module>/clients/base/views/record/record.js
*
* Custom controller for RecordView demonstrating dynamic required attribute
* (leads module is used for the example)
*/
extendsFrom: 'RecordView',
@elchele
elchele / en_us.quota_gauge.ext.php
Last active August 29, 2015 14:08
Gauge for demonstrating progress towards assigned quota within current time period.
<?php
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/Extension/application/Ext/Language/en_us.quota_gauge.ext.php
*
* labels for 'Quota Metrics' custom gauge chart for Home Dashboard
* For Sugar Ent/Ult only as it is based off RLI data
*/
$app_strings['LBL_QUOTA_GAUGE'] = 'Quota Metrics';
@elchele
elchele / create-actions.js
Created October 15, 2014 22:24
Custom controller for setting a default value on a field upon record creation
({
/* file: ./custom/modules/Accounts/clients/base/views/create-actions/create-actions.js */
extendsFrom: 'CreateView',
initialize: function(options){
this._super('initialize', [options]);
/* this is where I set the default value for a given field, in this case
it is the value 'Angel Inc.' to the 'name' field in the Accounts module.
@elchele
elchele / flex-list.hbs
Last active August 29, 2015 14:06
Expanding the default width on the Name column
{{!--
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
* Copyright (C) SugarCRM Inc. All rights reserved.