Disable any field in SugarCRM

November 17, 2011

In *viewdefs.php you can define the following:

array (
‘name’ => ‘myfield’,
‘label’ => ‘LBL_MYFIELD’,
‘displayParams’ => array(‘javascript’=>’disabled=”disabled”‘)
),


How to remove side quick create form

September 21, 2011

Get rid of the quick create. to make this customization upgrade safe we need to do the following.
1) create a new folder in custom/modules// with the name “views”
2) In this folder “views” create a file with the name view.sidequickcreate.php
3) add the following code to this file.

<?php

require_once(‘include/MVC/View/views/view.sidequickcreate.php’);

class ViewSidequickcreate extends ViewSidequickcreate {
function display() {
return ”;
}
}
?>

4) save the file and quick repair/rebuild the sugar instance
5) repeat these steps for any module that you want to hide the quick create form for.
6) BEWARE do not forget to RENAME the Class name in the view.sidequickcreate.php to the correct module.


Adding Custom Modules to Global Search

June 24, 2011

An upgrade-safe way of adding a custom module to Global Search.

Open the file(or create): custom/Extension/modules/CUSTOM_MODULE/Ext/Vardefs/vardefs.php

Append the file with these lines:

$dictionary['CUSTOM_MODULE']['unified_search'] = true;
$dictionary['CUSTOM_MODULE']['unified_search_default_enabled'] = true;
$dictionary['CUSTOM_MODULE']['fields']['NAME_OF_FIELD_TO_SEARCH']['unified_search'] = true;

Run a Quick Repair & Rebuild


Adding a Link in a SugarCRM Dashlet

June 16, 2011

Open::
/modules/<MODULE>/Dashlets/My<MODULE>Dashlet/My<MODULE>Dashlet.data.php

Let we want to make link for “opportunity” field of any Dashlet.

Initially “opportunity” array looks like this:

'opportunity' =>
array (
'width' => '10%',
'label' => 'LBL_OPPORTUNITY',
'name' => 'opportunity',
'default' => false,
),

Then make it likes:

‘opportunity’ =>
array (
'width' => '10%',
'label' => 'LBL_OPPORTUNITY',
'name' => 'opportunity',
'link' => true,
'action' => 'DetailView',
'module' => 'Opportunity',
'id' => 'OPPORTUNITY_ID',
'related_fields' => array('opportunity_id'),
'default' => false,
),

The main array keys which we need:

link: True/False; True will make it link.
module: Destination Module Name.
action: View Name; DetailView or EditView
id: The field that contains the ID for the related field. Use uppercase to ignore any problem.
related_fields: The field that contains the relation ID, should be the same as ‘id’


remove buttom from sugarcrm module detail view

June 15, 2011

create a file “view.detail.php” at custom\modules\<MODULE NAME>\

add code:

require_once(‘include/MVC/View/views/view.detail.php’);

class <MODULE NAME>ViewDetail extends ViewDetail {

function <MODULE NAME>ViewDetail(){
parent::ViewDetail();
}

function display() {

$button = “<BUTTON NAME>”;

if(in_array($button , $this->dv->defs['templateMeta']['form']['buttons'])) {

foreach($this->dv->defs['templateMeta']['form']['buttons'] as $key => $value) {

if ($value == $button ) unset($this->dv->defs['templateMeta']['form']['buttons'][$key]);
}
}

parent::display();
}
}

then clear cache and repair.


update admin password of sugarcrm

June 13, 2011

login to mysql, select your database by “use” command, then just execute this command :

update users set user_hash = md5(‘<USERPASSWORD>’) where user_name =
‘admin’;


Conditionally hide subpanel in SugarCRM

June 12, 2011

Let your module name is “company”, table name is “company” and subpanel is ["Company"]["subpanel_setup"]["sales"];

Create a new file “custom.php” at in/custom/Extension/modules/Company/Ext/Layoutdefs/

Write/follow below code as you need:

<?php

global $bean,$db; $id = $_GET["record"];

$query_cstm=”SELECT * FROM company WHERE id=’$id’”;
$result_cstm=$db–>query($query_cstm,true);
$row_cstm=$db->fetchByAssoc($result_cstm);
$city= $row_cstm["city"];

if($city != ‘dhaka’){
unset($layout_defs["Company"]["subpanel_setup"]["sales"]);
}

?>

And then just repair Extension from admin.


install centos 5.5 in vm

June 11, 2011

Download netinstaller from http://www.chrisgountanis.com/technical/45-centos-netinstall.html you can use it with vmWare player or VirtualBox.

At the time of giving images info use:
vault.centos.org as server name and 5.5/os/i386 as directory path.


how to get attribute’s value of selected option of a list by jquery

May 22, 2011

solution 1: var attrValue = $(‘#id :selected’).attr(‘attr_name’);
solution 2: var attrValue = $(“option:selected”,this).attr(‘attr_name’);
solution 3: var attrValue = $(“#id”).find(‘:selected’).attr(‘attr_name’);


How to install Android SDK v1.0 – Easy Step by Step

May 21, 2011

Step 1: Download The Eclipse IDE for Java EE Developers, 206 MB

Step 2: Download the Android SDK as provided by google.

You need to unzip both Eclipse and the Android SDK when you download them.

Step 3: Run Eclipse by double click “eclipse.exe, go to Help > Software Updates and choose the “Available Software” tab, select add site, input:

“https://dl-ssl.google.com/android/eclipse/”

It will then find the plugin and you simply select all the android updates that pops up and you select install.

Step 4: Next what you need to do is to go to window menu -> preferences, go to Android and here you input in the empty path field the path for where you downloaded and unzipped the Android SDK.

Now it should be working.


Follow

Get every new post delivered to your Inbox.