Skip to content

Instantly share code, notes, and snippets.

View dmulvi's full-sized avatar

Danny Mulvihill dmulvi

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / SugarWidgetSubPanelDeleteButton.php
Last active December 30, 2015 20:19
SugarCRM 6.x - Replace remove action with a delete action on subpanel
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*
* For this file start by copying the file located in /include/generic/SugarWidgets/SugarWidgetSubPanelRemoveButton.php
* into this new file and place it in /custom/include/generic/SugarWidgets/ (create the directories if needed)
*
* Then make the below updates to the file to enable actually deleting the record that the
* subpanel links to instead of only deleting the relationship and retaining the record.
*/
@dmulvi
dmulvi / ExampleNonAuthApi.php
Last active February 9, 2016 13:08
SugarCRM 7 example of a noLoginRequired endpoint with simple client_id/access_key Authorization
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class ExampleNonAuthApi extends SugarApi
{
public function registerApiRest() {
return array(
'SampleEndpoint' => array(
'reqType' => 'POST',