Skip to content

Instantly share code, notes, and snippets.

@maranemil
maranemil / gist:924f4dcfb59b2ec022b9
Last active February 5, 2020 10:56
Custom AutoIncrement Field in SugarCRM
/**
April 22, 2014 in Desarrollo, Sugar
1.) Custom AutoIncrement Field(having unique value):
For declaring “autoincrement” field in sugacrm do as follows:
Suppose we have to declare “Au Pair number” field as an autoincrement field in suagcrm. For this we have to declare vardef in custom/Extension/modules/oss_auPairs/Ext/Vardefs/vardefs.ext.php as follows:
*/
$dictionary["oss_auPairs"]["fields"]["aupair_number"] =array (
@maranemil
maranemil / gist:bf2aa32fadefe8f74d75
Last active August 29, 2015 14:18
SugarCRM7 Ajax Request
$.ajax({
beforeSend: function (request) {
request.setRequestHeader("OAuth-Token", SUGAR.App.api.getOAuthToken());
},
url: "rest/v10/cplus_ContactsPlus/create_cplus",
data: { type: "cplus", societyname: this.model.get('name') },
dataType: "json",
type: "GET",
success: function (data) {
var obj = jQuery.parseJSON(data);
@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);
@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: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: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: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: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: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: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