Skip to content

Instantly share code, notes, and snippets.

@AjayKumar01
AjayKumar01 / email turned on
Last active November 25, 2016 07:13
To Enable sugar to work with email accounts,we need to ensure that it is turned for "Access for less secure apps" in below link
https://www.google.com/settings/u/0/security/lesssecureapps
@AjayKumar01
AjayKumar01 / daily_file_dump
Created July 7, 2016 09:48
Script to take backup of file system daily basis
#!/bin/bash
#Script to take autodump of directories
#Written by Ajay Kumar
#Dated: 07 July 2016
BACKUPDIR="/home/restore/CRM_Backup/"
TODAY=`date +"%A"`
#enter directories to be backedup here
FILES=( '/var/www/html/sugarhome' )
@AjayKumar01
AjayKumar01 / daily_db_dump
Last active November 15, 2016 10:43
Script to take automatic db backup daily basis
#!/bin/bash
#Script to take automatic db dump
#Written by Ajay Kumar
#Dated 07 July 2016
DBUSERNAME="root"
DBPASS="*******"
BACKUPDIR="/home/restore/"
TODAY=`date +"%A"`
@AjayKumar01
AjayKumar01 / clearcache.sh
Created July 7, 2016 09:42
Clear Os cache automatically -To Improve Server Performance
#!/usr/bin/sh
echo 3 > /proc/sys/vm/drop_caches
//Execute this file in cron with difference (based on RAM size)
In terminal
>crontab -e
//then add the below with correct path,we have given 45 mins as diff
@AjayKumar01
AjayKumar01 / subpanel-list.js
Last active April 26, 2022 19:14
Limiting the subpanel records based on parent module
({
/**
* Purpose:Limiting the subpanel records based on parent module
* Here we are limiting contacts module records based on parent module(Opporunities,Accounts and other module) *
* Path : sugar/custom/modules/contacts/clients/base/views/subpanel-list/subpanel-list.js
* Written by: Ajay Kumar
* Dated: 31 May 2016
*/
extendsFrom:'RecordlistView',
fallbackFieldTemplate: 'list',
@AjayKumar01
AjayKumar01 / record.js
Last active October 3, 2016 20:32
Duplicate primary Email validation in record.js
({
extendsFrom: 'RecordView',
initialize: function(options) {
this._super('initialize', [options]);
this.model.addValidationTask('check_email', _.bind(this._doValidateEmail, this));
},
_doValidateEmail: function(fields, errors, callback) {
console.log("test function");
_.each(this.model.get('email'), function(emailObject) {
if (emailObject.primary_address) { //check if primary
@AjayKumar01
AjayKumar01 / recordlist.js
Last active October 3, 2016 20:32
Adding button in list view
({
extendsFrom:'RecordlistView',
initialize:function(options){
this._super('initialize',[options]);
this.context.on('list:updatecurrentsize:fire',this.mass_update_currentsize,this);
},
/**
* Function to mass update the current size
* for all selected accounts
* Written by: Ajay Kumar
@AjayKumar01
AjayKumar01 / record.js
Last active October 3, 2016 20:32
Email Validation through api(Note : this will work in both record.js and create-actions.js as well)
var emailAddress="test@test.com";
var self = this,
data = {
results: [],
},
options = {},
callbacks = {},
url;
// add the search term to the URL params
options.q = emailAddress;
@AjayKumar01
AjayKumar01 / enableAudit.php
Created April 9, 2016 08:52
Enabling 'View Change Log' Button in record view of module or Enabling Audit for module
<php
/*
* Enabling Audit for module
* Ajay Kumar
* Path : /crm//custom/Extension/modules/Project/Ext/Vardefs/enableAudit.php
*/
$dictionary['Project']['audited'] = true;
?>
@AjayKumar01
AjayKumar01 / alert
Last active October 3, 2016 20:32
Making Alert Close after 10 seconds
app.alert.show('success', {
level : 'success',
messages : 'Successful',
autoClose : true,
autoCloseDelay : 10000,
});