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 / foo.php
Created March 25, 2015 16:12
Foo view that uses the bar controller
$viewdefs['base']['view']['foo'] = array(
'buttons' => array(
array(
'type' => 'button',
'name' => 'save',
),
),
'name' => 'bar',
),
@mmarum-sugarcrm
mmarum-sugarcrm / foo.php
Created March 25, 2015 16:23
Foo layout that uses the bar template
$viewdefs['base']['layout']['foo'] = array(
'components' => array(),
'type' => 'foo',
'name' => 'bar',
),
@mmarum-sugarcrm
mmarum-sugarcrm / foo.php
Last active August 29, 2015 14:17
Foo view that uses detail template
$viewdefs['base']['view']['foo'] = array(
'buttons' => array(),
'type' => 'foo',
'name' => 'bar',
'template' => 'detail',
),
@mmarum-sugarcrm
mmarum-sugarcrm / addFooterAction.ext.php
Last active August 29, 2015 14:20
MyAppAction footer extension (tested on Sugar 7.5, 7.6)
<?php
// Append new View to Footer layout's list of components
$viewdefs['base']['layout']['footer']['components'][] = array (
'view' => 'my-app-action',
);
@mmarum-sugarcrm
mmarum-sugarcrm / sugarfield_next_step_c.php
Created June 5, 2015 18:44
Example Sugar Logic message field
<?php
// created: 2015-06-05 10:27:18
$dictionary['Lead']['fields']['next_step_c']['duplicate_merge_dom_value']=0;
$dictionary['Lead']['fields']['next_step_c']['labelValue']='Next Step';
$dictionary['Lead']['fields']['next_step_c']['full_text_search']=array (
'boost' => '0',
'enabled' => false,
);
$dictionary['Lead']['fields']['next_step_c']['calculated']='1';
$dictionary['Lead']['fields']['next_step_c']['formula']='ifElse(equal(count($tasks),0),"You must create a follow up Task for this Lead!",concat("Complete ",toString(related($tasks,"name"))))';
@mmarum-sugarcrm
mmarum-sugarcrm / MobileContractsMobileFilterApi.php
Last active August 29, 2015 14:22
Mobile Contracts Proxy API example
<?php
require_once 'clients/base/api/FilterApi.php';
/**
* Class MobileContractsMobileFilterApi
*
* Tested with Sugar 7.6
*
* Example of how to build a simple proxy API that can be used to make API requests to one module pull data from another module.
@mmarum-sugarcrm
mmarum-sugarcrm / RestrictedOAuth2MobileApi.php
Last active August 29, 2015 14:22
Restricting login to SugarCRM Mobile by Role in Sugar 7
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once 'clients/mobile/api/OAuth2MobileApi.php';
/**
* Example of how to override the core OAuth2MobileApi class in order to alter SugarCRM Mobile authentication behavior
**/
class RestrictedOAuth2MobileApi extends OAuth2MobileApi {
@mmarum-sugarcrm
mmarum-sugarcrm / MobileApiLogicHook.php
Last active August 29, 2015 14:22
Sugar 7 Mobile API Logic Hook example
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Example Mobile API Logic Hooks class
**/
class MobileApiLogicHook
{
/**
@mmarum-sugarcrm
mmarum-sugarcrm / case-count-by-status.php
Last active August 29, 2015 14:24
Case Count by Status Dashlet Metadata
<?php
/**
* Metadata for the Case Count by Status example dashlet view
*
* This dashlet is only allowed to appear on the Case module's list view
* which is also known as the 'records' layout.
*/
$viewdefs['base']['view']['case-count-by-status'] = array(
'dashlets' => array(
@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.
*
**/
({