Skip to content

Instantly share code, notes, and snippets.

@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',
<?php
/*
*custom/Extension/modules/Accounts/Ext/clients/base/filters/basic/FilerAccountTemplate.php
* Ajay Kumar
*/
$viewdefs['Accounts']['base']['filter']['basic']['filters'][] = array(
'id' => 'FilterAccountTemplate',
'name' => 'LBL_FILTER_ACCOUNT_TEMPLATE',
'filter_definition' => array(
'name' => array(
@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_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 / panel-top.js
Created April 9, 2016 07:20
Disabling create and link existing button action in subpanel based on parent module.
({
/* Disabling create and link existing button action in subpanel based on parent module.
* Ajay Kumar
* Path : sugar/custom/modules/Leads/clients/base/views/panel-top/panel-top.js
*/
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var industryValue = this.context.parent.get('model').get("industry");
var parentModule = this.context.parent.get('module');
@AjayKumar01
AjayKumar01 / panel-top.js
Created April 9, 2016 07:24
Disabling create and link existing button action in subpanel based on parent module and parent module field value
({
/* Disabling create and link existing button action in subpanel based on parent module.
* Ajay Kumar
* Path : sugar/custom/modules/Leads/clients/base/views/panel-top/panel-top.js
*/
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var parentModule = this.context.parent.get('model').module;
var parentCollection = this.context.parent.get('collection');
@AjayKumar01
AjayKumar01 / hidetabs.php
Created April 9, 2016 07:28
Hiding tabs using dependency in Record view
<?php
/* Hiding tabs using dependency in Record view
* Ajay Kumar
* Path : custom/Extension/modules/Opportunities/Ext/Dependencies/hidetabs.php
*/
$dependencies['Opportunities']['hide_tabs'] = array(
'hooks' => array(
"edit",
"view"
),
@AjayKumar01
AjayKumar01 / header.php
Created April 9, 2016 07:34
Removing import menu option from Accounts module menu.
<?php
/* Removing import menu option from Accounts module menu.
* Ajay Kumar
* Path : /custom/modules/Accounts/clients/base/menus/header/header.php.
*/
$moduleName = 'Accounts';
$viewdefs[$moduleName]['base']['menu']['header'] = array(
array(
'label' =>'LNK_NEW_ACCOUNT',
'acl_action'=>'create',
@AjayKumar01
AjayKumar01 / record.js
Created April 9, 2016 07:41
Making field required dynamically based on condition
({
/* Making field required dynamically based on condition
* Ajay Kumar
* Path : custom/modules/Opportunities/clients/base/views/record/record.js
*/
extendsFrom: 'RecordView',
initialize: function(options) {
this._super('initialize', [options]);
this.on('render', this.testFunc, this);
this.model.on('change:probability', this.testFunc, this);
({
/*Disabling button ,condition based or dynamically on RecordView.
* AjayKumar
* custom/modules/Accounts/clients/base/views/record/reord.js
*/
extendsFrom:'RecordView',
initialize:function(options){
this._super('initialize',[options]);
this.on('render',this.makedisableButton,this);
},