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 / en_us.case-count-by-status.php
Created July 6, 2015 19:32
Case Count by Status English language extension
<?php
// This file will provide English strings for our new labels.
// Additional extensions could be created so that our dashlet supports other languages.
$app_strings['LBL_CASE_COUNT_BY_STATUS'] = 'Case Count By Status';
$app_strings['LBL_CASE_COUNT_BY_STATUS_DESCRIPTION'] = 'Shows the number of Cases on the Cases List view by status.';
$app_strings['LBL_CASE_COUNT_BY_STATUS_TOTAL'] = 'Total Cases:';
@mmarum-sugarcrm
mmarum-sugarcrm / case-count-by-status.hbs
Created July 6, 2015 18:48
Case Count by Status example dashlet Handlebars template
{{!
Case Count by Status example dashlet Handlebars template
We are reusing styling from the Sugar 7 Styleguide for our example dashlet.
Here we are borrowing CSS used in our Forecast Details dashlet which is suitable for display any set of name value pairs.
}}
<div class="forecast-details">
{{#each values}}
<div class="row-fluid">
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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',
),