Skip to content

Instantly share code, notes, and snippets.

@eggsurplus
eggsurplus / action_file_map.php
Last active August 29, 2015 13:56
File mapping example for Sugar 7. Part 3.
<?php
$action_file_map['helloworld'] = 'custom/modules/Campaigns/HelloWorld.php';
@eggsurplus
eggsurplus / manifest.php
Last active August 29, 2015 13:56
File mapping example for Sugar 7. Part 2.
<?php
$installdefs = array(
//...shorten for brevity
'action_file_map' => array(
array(
'from' => '<basepath>/extensions/custom/modules/Campaigns/ActionFileMap/HelloWorld.php',
'to_module' => 'Campaigns',
),
),
@eggsurplus
eggsurplus / HelloWorld.php
Last active August 29, 2015 13:56
File mapping example for Sugar 7. Part 1.
<?php
echo "Hello World!";
@eggsurplus
eggsurplus / logic_hooks.php
Created December 1, 2013 20:13
Logic hooks file for the assignment script
<?php
/**
* /custom/modules/Accounts/logic_hooks.php
*/
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'account_type_change', 'custom/modules/Accounts/ReassignSecurityGroup.php','ReassignSecurityGroup', 'account_type_change');
@eggsurplus
eggsurplus / ReassignSecurityGroup.php
Last active December 29, 2015 22:59
Add a SecurityGroup when Account type is set to Customer
<?php
/**
* /custom/modules/Accounts/ReassignSecurityGroup.php
*/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class ReassignSecurityGroup {
function account_type_change(&$bean, $event, $arguments)
{
@eggsurplus
eggsurplus / header.php
Created November 20, 2013 20:25
Tell the layout to use a custom view in SugarCRM 7
<?php
$viewdefs['base']['layout']['header'] = array(
'components' =>
array(
array(
'view' => 'modulelist',
),
array(
'view' => 'quickcreate',
),
@eggsurplus
eggsurplus / wiki-profileactions.js
Created November 20, 2013 20:20
Extending a core view js in SugarCRM 7
({
extendsFrom: 'ProfileactionsView',
setCurrentUserData: function() {
this.wiki_user = app.user.get("wiki_user");
app.view.invokeParent(this, {type: 'view', name: 'profileactions', method: 'setCurrentUserData'});
}
})
@eggsurplus
eggsurplus / profileactions.hbt
Last active December 28, 2015 08:39
Changes in template to display wiki user url
......abbreviated
<li class="profileactions-logout"><a href="#logout/?clear=1">{{str "LBL_LOGOUT"}}</a></li>
{{#if wiki_user}}
<li class="profileactions-wiki"><a href="http://www.oursite.com/wiki/{{wiki_user}}">{{wiki_user}}'s Wiki Profile</a></li>
{{/if}}
............
@eggsurplus
eggsurplus / WikiCurrentUserApi.php
Last active December 28, 2015 06:29
custom/clients/base/api/WikiCurrentUserApi.php
require_once 'clients/base/api/CurrentUserApi.php';
class WikiCurrentUserApi extends CurrentUserApi
{
/**
* Override the core api with our own versoin of retrieveCurrentUser
*/
public function registerApiRest()
{
return array(
@eggsurplus
eggsurplus / profileactions.js
Last active December 28, 2015 06:29
profileactions.js
setCurrentUserData: function() {
this.fullName = app.user.get("full_name");
this.userName = app.user.get("user_name");
// **** our custom data to be pass through
this.wiki_user = app.user.get("wiki_user");
//........abbreviated
}