Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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