How to disable button in sugarcrm dynamically
Let me explain how to disable button action dynamically thorough controller(ex.record.js) and when our condition meets.
I am creating one button as "Check Button" for Accounts module.
So i am copying record.php from /modules/Accounts/clients/base/views/record/record.php to
custom/modules/Accounts/clients/base/views/record/record.php
Above is the our custom button array to add to Accounts module.I Assume you know how to add button array in record.php
To Add label for custom button , I am creating new file in below path and adding content to that.
/custom/Extension/modules/Accounts/Ext/Language/en_us.check_button.php
Now button is ready.
Now we need to button action in controller file.I know you got what i mean,yes we need to add action for check_button in record.js.
Below is our scenario,
If Account type is customer ,then we should not allow user to edit that record.So we are going to disable "edit" and "check" button when condition meets.
Thats it. Make a repair and rebuild.
Creating custom keyboard shortcuts in sugarcrm
Let me say something about shortcut keyboard in sugarcrm,How it can be done.
Here is sample, Open any record in any module.And press "e".
Now you will be able to see the edit view of that record. like the same
To Save a record ,press "ctrl+s" or "ctrl+alt+a"
To Edit a record press "e" or "ctrl+alt+i"
To Cancel a edit view press "esc" or "ctrl+alt+l"
To Go to next record press "l"
To Go to previous record press "h"
To Get more action button press "m"
These all are default sugar shortcut keys.yes .Its interesting.Then why cant we try creating/registering our shortcut key.
Let we try to create our custom shortcut key.
Steps:
Step 1:
Create file record.js in below path
custom/modules/{module-name}/clients/base/layouts/record/record.js
custom/modules/Accounts/clients/base/layouts/record/record.js
Then copy content from
custom/modules/Accounts/clients/base/layouts/record/record.js
Then save this file
Step 2:
custom/modules/Accounts/clients/base/views/record/record.js
In this file
From above example
't', 'ctrl+alt+t' - shortcut key
Done.
Apply initial filter in relate fields and relationship fields with quick(popup) search sugarcrm 7.x
In this article,I will be explaining how to apply initial filter in relationship fields including quick(popup) search in Sugarcrm7.x.Lets say we have accounts module(sugarcrm out of the box module),is having one-to-many relationship with accounts module,for the purpose of linking new records to old(parent) record.This is not sugar out of the box relationship,we have build this relationship.
In record view of accounts,When user is trying choose account for "parent account" relationship field,the system should display records except current record,(current account should not to be available to select).Now we need to prevent user to choose same record as parent.
Lets go with example,We have one account named "Banque Lombard Odier & Cie SA" in accounts module.
This record should not link with same "Banque Lombard Odier & Cie SA".It can link with some other accounts.
To achieve this, we need to touch 3 files .There are 3 records in which starts with banq" in Accounts module.
Controller
In record view of accounts,When user is trying choose account for "parent account" relationship field,the system should display records except current record,(current account should not to be available to select).Now we need to prevent user to choose same record as parent.
Lets go with example,We have one account named "Banque Lombard Odier & Cie SA" in accounts module.
This record should not link with same "Banque Lombard Odier & Cie SA".It can link with some other accounts.
To achieve this, we need to touch 3 files .There are 3 records in which starts with banq" in Accounts module.
Below is the Record view of "Banque lombard odier & Cie SA" account.Here we are having parent account(relationship field) as field.I have added filter defintion for this field.Now if you type "banq" in parent account relationship field,current record name will not be available to select in quick(popup) search,open drawer and search in open drawer.(like below).
Lets dive into coding part,
Step 1 :
Creating filter template
First we need to create a filter template for accounts which will filter out only the accounts records except current account.
To do this we will create a new file in the following path.Let’s name this template as FilerAccountTemplate.
Create file in below path
/custom/Extension/modules/Accounts/Ext/clients/base/filters/basic/
FilerAccountTemplate.php
In this filter template,File name(FilerAccountTemplate) and id should be same(FilerAccountTemplate).
In this file we are defining filter definition in ("filter_definition") variable.Here i am using name is not equals in filter definition.We can use record id also instead of name.
Step 2:
Filter label
Now we need to give a display label for out filter template ,which we have created.
Create file in below path
/custom/Extension/modules/Accounts/Ext/Language/
en_us.FilterAccountTemplate.php
Add file to below code
Step 3:
Controller
Now we need to pass this template as filter options into the look up search when user try to select a account .For that we will create a new controller file for relate field and will extend it from parent controller.
Create file in below path
/custom/modules/Accounts/clients/base/fields/relate/relate.js
Add below code
Note
1. Accounts -module name
2. name- relationship field name
3. We are overriding getFilterOptions method.and we are defining our custom filter definition instead of default filter options.
This filter options is getting called in opendrawer function also,So the same definition will be apply openselect drawer function as well.
here we are creating instance of filter options,and configuring with filter template name,filter label and passing current record name to filter definition.(this only will prevent system to not display current record).
The above our filter definition is getting apply in quick(popup) search,when user clicks "select more accounts" and in open drawer search .
1. Accounts -module name
2. name- relationship field name
3. We are overriding getFilterOptions method.and we are defining our custom filter definition instead of default filter options.
This filter options is getting called in opendrawer function also,So the same definition will be apply openselect drawer function as well.
here we are creating instance of filter options,and configuring with filter template name,filter label and passing current record name to filter definition.(this only will prevent system to not display current record).
The above our filter definition is getting apply in quick(popup) search,when user clicks "select more accounts" and in open drawer search .
That's it.
Inevitably Administration > Repair > Quick Repair and Rebuild .
This is upgrade safe .
Inevitably Administration > Repair > Quick Repair and Rebuild .
This is upgrade safe .
Customize change theme in sugarcrm 7.x
To override the default theme colors, a new variables.php file will need to be created.
Copy the /sugarcrm/styleguide/themes/clients/base/default/variables.php to /sugarcrm/custom/themes/clients/base/default/variables.php and edit the following three HEX color values.
By defaul Sugar crm theme looks like
By default sugar crm theme, 'BorderColor' => '#E61718', I am changing that to 'BorderColor' => '#0adf31',
Inevitably Administration > Repair > Quick Repair and Rebuild .
Our customized theme looks like below.
Like BorderColor,we can change NavigationBar and PrimaryButton.
By default in sugarcrm theme, 'NavigationBar' => '#282828', I am changing that to 'NavigationBar' => #000099'.
Inevitably Administration > Repair > Quick Repair and Rebuild .
Our customized theme below.
PrimaryButton
By default in sugar theme 'PrimaryButton' => '#176de5', I am changing that to 'PrimaryButton' => '#000000'.
Inevitably Administration > Repair > Quick Repair and Rebuild .
Our customized theme looks like below.
SugarCRM Silent Upgrade
Prerequisites
1 - This is our current instance.
2 - silentUpgrade package(here we are going to upgrade to 7.5.0.1.so file will be like "silentUpgrade-PRO-7.5.0.1.zip").
3 - upgradation package SugarPro-Upgrade-6.5.20-to-7.5.0.1.zip(Here we are going to upgrade to sugarCRM 7.5.0.1 from sugarCRM 6.5.20 here our edition is Professional .so package will start with SugarPro, if it is enterprise edition, name will start like SugarEnt).
Steps
Now extract silentUpgrade zip package.Goto terminal and login as root .
Run silentupgrade command like below .
This command takes four parameter
1. path of cliUpgrader.php (it will be in extrated package of silentUpgrade)2.path of upgradation package
3.log file path (we are maintaining log file inside of extracted package,File also no need create ,just give file name like (install.log)).
4.path of sugar6 and admin of this instance(in my case admin).
Shortcut keys
Keyboard shortcuts:
Copy only active window to clipboard
1.To print particular window screenshot
Normally, the Print Screen key copies the entire display (or two displays if you got them), ALT + Print Screen only copies the currently active window to the clipboard.
2.Minimize all windows:
If suppose you need to minimize the all opened windows,you can use keyboard shortcut key
Window+D
3.Close the current window/tab
Use CTRL+W
Browsing Shortcuts:
1.Jump to address bar
There are a number of ways to jump right to the address bar from anywhere in browser. Pressing CTRL + L, F6, and ALT + D all accomplish this goal.
2.Bring back a closed tab
Accidentally closed a tab? Simply press CTRL + Shift + T to reopen the most recently closed tab and get back to what you were doing.
3.Cycle through open tabs
Pressing CTRL + TAB while in a browser will flip between each one. This can be much faster than moving the mouse and clicking on a tab. CTRL + NUM (1, 2, 3, 4, n..) will also take you to certain tab in that numeric order.
Copy only active window to clipboard
1.To print particular window screenshot
Normally, the Print Screen key copies the entire display (or two displays if you got them), ALT + Print Screen only copies the currently active window to the clipboard.
2.Minimize all windows:
If suppose you need to minimize the all opened windows,you can use keyboard shortcut key
Window+D
3.Close the current window/tab
Use CTRL+W
Browsing Shortcuts:
1.Jump to address bar
There are a number of ways to jump right to the address bar from anywhere in browser. Pressing CTRL + L, F6, and ALT + D all accomplish this goal.
2.Bring back a closed tab
Accidentally closed a tab? Simply press CTRL + Shift + T to reopen the most recently closed tab and get back to what you were doing.
3.Cycle through open tabs
Pressing CTRL + TAB while in a browser will flip between each one. This can be much faster than moving the mouse and clicking on a tab. CTRL + NUM (1, 2, 3, 4, n..) will also take you to certain tab in that numeric order.