Skip to content

Instantly share code, notes, and snippets.

@maranemil
maranemil / gist:9852c2b307438893bc21
Created December 10, 2014 09:41
SugarCRM htaccess with new expires rules - boost speed
RewriteEngine on
# BEGIN SUGARCRM RESTRICTIONS
RedirectMatch 403 (?i).*\.log$
RedirectMatch 403 (?i)/+not_imported_.*\.txt
RedirectMatch 403 (?i)/+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules)/+.*\.(php|tpl)
RedirectMatch 403 (?i)/+emailmandelivery\.php
RedirectMatch 403 (?i)/+upload/
RedirectMatch 403 (?i)/+custom/+blowfish
RedirectMatch 403 (?i)/+cache/+diagnostic
@maranemil
maranemil / gist:c088fbfe57ccbb2c33ea
Created December 12, 2014 12:51
How to trigger onReady/onComplete in DetailPage in SugarCRM 7.X
/**
File Location
/custom/modules/<YourModule>/clients/base/layouts/subpanels/subpanels.js
*/
({
extendsFrom: 'SubpanelsLayout',
events: {
@maranemil
maranemil / gist:c26d814178817220e60d
Created February 1, 2015 21:10
how to install oro crm on ubuntu
###############################################
#
# Install ORO CRM
#
###############################################
cd /var/www/html/OroCrm # go to your install OroCrm folder
@maranemil
maranemil / gist:be7c0e988725100884fd
Last active August 29, 2015 14:15
Quick Delete for Activities for Test/Dev Mode - SugarCRM
TRUNCATE TABLE `activities`;
TRUNCATE TABLE `calls`;
TRUNCATE TABLE `calls_contacts`;
TRUNCATE TABLE `meetings`;
TRUNCATE TABLE `meetings_contacts`;
TRUNCATE TABLE `tasks`;
TRUNCATE TABLE `notes`;
@maranemil
maranemil / gist:29c4f26ae69402baa4b3
Last active August 29, 2015 14:15
SugarCRM Reset User Password
// MySQL
update users set user_hash = md5('jim') where user_name = 'jim';
// MSSQL
update users set user_hash = '5e027396789a18c37aeda616e3d7991b' where user_name = 'jim';
@maranemil
maranemil / gist:d0ceaf42822ac431d38b
Last active August 29, 2015 14:15
SugarCRM 7 How to load the same javascript function in more extended views
Example usage common function defined in sidecar:
-------------------
// "custom-record": {"controller":
({
// Record View (base)
extendsFrom: 'RecordView',
initialize: function (options) {
//this.plugins = _.union(this.plugins, ['MyAmazingFunctionFour']); // Call function through plugins
//app.MyAmazingFunction() // Call function through app
//SUGAR.util.MyAmazingFunctionTwo(); // Call function through SUGAR.util
@maranemil
maranemil / gist:246a86c567db42e12379
Last active August 29, 2015 14:16
svg fix for leaflet routing on sugarcrm 7 against route error lineOptions
<style>
/* svg fix for leaflet on sugar 7 against styles from styleguide/assets/css/nvd3.css */
svg {
width: auto;
height: auto;
max-height: 1900px;
max-width: 1900px;
}
</style>
@maranemil
maranemil / gist:30a442d0b8ea29a52a7a
Last active August 29, 2015 14:16
Init Gmaps SugarCRM 7
if($.isEmptyObject(google)) {
$.getScript('https://www.google.com/jsapi', function () {
google.load("maps", "3", {'other_params' : 'sensor=true' });
});
}
@maranemil
maranemil / gist:38ea83be9ad4ef3bc3ae
Last active August 29, 2015 14:18
Generate New Random ID in SugarCRM
require_once('include/utils.php');
$newID = create_guid();
@maranemil
maranemil / gist:2bd059ca20e8db8c8ce7
Last active August 29, 2015 14:18
Using DB in SugarCRM
global $db;
$db = DBManagerFactory::getInstance();
$sql = "SELECT your_qurey_here";
$res = $db->query($sql);
$row = $db->fetchByAssoc($res);
$cnt = $db->getRowCount($res);