Skip to content

Instantly share code, notes, and snippets.

@eggsurplus
eggsurplus / profileactions.hbt
Last active November 19, 2023 17:38
SugarCRM 7 - Adding a Menu Item - profile actions
...abbreviated
<div class="dropdown-menu scroll pull-right">
<ul role="menu">
<li class="profileactions-profile"><a href="{{profileUrl}}">{{str "LBL_PROFILE"}}</a></li>
<li class="profileactions-employees"><a href="{{employeesUrl}}">{{str "LBL_EMPLOYEES"}}</a></li>
{{#if showAdmin}}
<li class="administration"><a href="#Administration">{{str "LBL_ADMIN"}}</a></li>
{{/if}}
<li class="profileactions-about"><a href="#bwc/index.php?module=Home&action=About">{{str "LNK_ABOUT"}}</a></li>
<li class="profileactions-logout"><a href="#logout/?clear=1">{{str "LBL_LOGOUT"}}</a></li>
@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
}
@eggsurplus
eggsurplus / vardefs.php
Created September 25, 2013 16:21
Support all editions of SugarCRM while working with team security
<?php
$dictionary['my_Module'] = array(
'table'=>'my_module',
'audited'=>false,
'fields'=>array (
//....removed for gist
),
);
//check to see which edition we are installed on and enable/disable team_security as appropriate
global $sugar_flavor;
@eggsurplus
eggsurplus / view.step4.php
Last active December 18, 2015 19:09
Import: update by email address
<?php
// Jason Eggers - SugarOutfitters.com
// /custom/modules/Import/views/view.step4.php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* @author eggsurplus
*
* Override to set ID based on email address match
*/