Skip to content

Instantly share code, notes, and snippets.

View dmulvi's full-sized avatar

Danny Mulvihill dmulvi

View GitHub Profile
@dmulvi
dmulvi / subpanels.php
Last active December 29, 2015 13:29
Hide (or re-order) subpanels for specific module in SugarCRM 7
<?php
/*
* This example will hide the core notes subpanel on Opportunities detailview.
* In this case it is to allow a custom many-to-many relationship to notes
* to replace the core relationship.
*
* You just need to comment out the subpanel in question and the Quick Repair & Rebuild.
*
* this file is located at custom/modules/Opportunities/clients/base/layouts/subpanels/
@dmulvi
dmulvi / dashboard_pusher.php
Last active November 17, 2015 21:23
Push out dashboard to other users in SugarCRM 7.
<?php
/**
* SugarCRM 7 Intelligence Pane Pusher
* Make it possible to push dashboards out to users.
*
* Run this as an entryPoint.
*
* Here is a really long, ugly link (that probably won't work when
* you need it) that describes how to setup an entrypoint.
@dmulvi
dmulvi / someview.js
Created August 26, 2015 18:55
Export records SugarCRM
// this is used in coremark custom/modules/Accounts/clients/base/views/nearby-stores/nearby-stores.js
({
exportData: function() {
app.alert.show('massexport_loading', {
level: 'process',
title: app.lang.getAppString('LBL_LOADING')
});
var fields = [
'name',
@dmulvi
dmulvi / custom_import.php
Last active January 29, 2016 14:54
Basic code for a custom importer to sugarcrm
<?php
global $db;
if (($handle = fopen('/var/www/html/crm/custom/ninjacode/nvw-contacts.csv', 'r')) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$sql = "UPDATE contacts c
INNER JOIN contacts_cstm cc ON cc.id_c = c.id
SET c.first_name = '$data[1]',
cc.preferred_name_c = '$data[2]',
@dmulvi
dmulvi / panel-top.js
Last active August 29, 2015 14:27
create a custom panel-top row action
({
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var newEvents = {
'click a[name=custom_button]': 'customAction'
}
@dmulvi
dmulvi / subpanel-list.js
Created August 14, 2015 20:52
create a custom subpanel-list row action
// this file also goes in custom/SUBPANEL_MODULE_NAME/clients/base/views/subpanel-list/
({
extendsFrom: 'SubpanelListView',
initialize: function(options) {
this._super('initialize', [options]);
this.context.on('button:custom_action:click', this.customAction, this);
},
@dmulvi
dmulvi / CustomMODULE_NAMEApi.php
Last active June 30, 2016 23:49
SugarCRM - Add item to action menu on Record View
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class CustomMODULE_NAMEApi extends SugarApi
{
public function registerApiRest() {
return array(
'CasesLinkedTestsEndpoint' => array(
'reqType' => 'POST',
@dmulvi
dmulvi / CustomSugarpdf.php
Last active June 5, 2020 08:46
Save File as Note Attachment or Document in SugarCRM
<?php
require_once 'include/Sugarpdf/Sugarpdf.php';
class CustomSugarpdf extends Sugarpdf
{
function Footer() {
// just need to remove the unwanted hr
}
}
@dmulvi
dmulvi / EmailExample.php
Last active August 29, 2015 14:23
SugarCRM - Email w/ Attachment in Code
<?php
require_once('modules/Emails/Email.php');
require_once('include/SugarPHPMailer.php');
$emailObj = new Email();
$mail = new SugarPHPMailer();
// Create an id for the email
$emailObj->id = create_guid();
$emailObj->new_with_id = true;
@dmulvi
dmulvi / filterContactsFromRelatedAccounts.php
Created June 1, 2015 16:31
Pre-filter Contacts by Account on Cases
<?php
// file location: /custom/Extension/modules/Contacts/Ext/clients/base/filters/basic/filterContactsFromRelatedAccounts.php
$viewdefs['Contacts']['base']['filter']['basic']['filters'][] = array(
'id' => 'filterContactsFromRelatedAccount',
'name' => 'Contacts of Related Account',
'filter_definition' => array(
array(
'account_id' => ''