Showing posts with label sugarcrm. Show all posts
Showing posts with label sugarcrm. Show all posts

Tuesday, May 22, 2012

Dependent Dropdown in SugarCRM (SugarCE)

In order to make dependent dropdown, first you need to create 2 independent dropdown list from sugar admin panel. Let's say country_c and city_c with Item Name as below:

For country_c menu:
Item Name                    Display Name
AAA                             Thailand
BBB                              Nepal

For city_c menu:
Item Name                   Display Name
AAA_1                        Bangkok
AAA_2                        Phuket
BBB_1                         Lumbini
BBB_2                         Pokhara

Here you can see that if Item Name for country is AAA then the corresponding Item Name for city is AAA_1, AAA_2 i.e. it starts with AAA.

Monday, March 19, 2012

[Solved] Kinamu Reporter 'Invalid argument supplied' Problem

You might have seen the below error in Kinamu Reporter:
Warning: Invalid argument supplied for foreach() in \modules\KReports\KReportQuery.php on line 401
Warning: reset() expects parameter 1 to be array, null given in \modules\KReports\KReportQuery.php on line 784
Warning: Invalid argument supplied for foreach() in \modules\KReports\KReportQuery.php on line 785

This problem comes when you have not added any field in the selection criteria.
While creating report, on the right panel under Report Definition, you can see 2 things: Selectioncriteria and Display Fields. Problem occurs when you add fields only in Display Field but not in Selectioncriteria.

Let us suppose that you added first name and last name from module contacts in Display Fields, then the query will be:
select first name, last name from contacts

This statement should work but in basic version of Kinamu Reporter, this statement alone does not work. So you need to specify parameters in Selectioncriteria also. Adding parameters in Selectioncriteria means that you are specifying where clause for the query statement. For e.g. if you set first_name = 'Poonam' in Selectioncriteria, then the query will be:
select first name, last name from contacts where first_name = 'Poonam'

This solves the problem.

Thursday, March 15, 2012

Remove 'View Change Log' from SugarCRM Detail View

For 'Contacts' Module

1. Copy file from  'sugarcrm\modules\Contacts\metadata\detailviewdefs.php' to  sugarcrm\custom\modules\Contacts\metadata\detailviewdefs.php

Inside the form array, add 1 line,
'hideAudit' => true,

Go to Admin->Repair->Quick Repair and Rebuild. This will execute the code.

Do the same for other modules replacing 'Contacts' by 'your-module'.

Remove 'Direct Reports' from SugarCRM Contacts subpanel

Create Directory: sugarcrm\custom\Extension\modules\Contacts\Ext\Layoutdefs

Create a file named layoutdefs.ext.php inside this directory with code as below:
<?php unset($layout_defs['Contacts']['subpanel_setup']['contacts']); ?>

Go to Admin->Repair->Quick Repair and Rebuld. This will execute the code

Remove 'Duplicate' from Detail View of SugarCRM

1. Copy file from  'sugarcrm\modules\Contacts\metadata\detailviewdefs.php' to  sugarcrm\custom\modules\Contacts\metadata\detailviewdefs.php

2. Inside the form arrary, you will see an array with values 'edit', 'delete', 'duplicate'. Remove 'duplicate' from the array.

Go to Admin->Repair->Quick Repair and Rebuild. This will execute the code.

Remove 'Import Contacts' from SugarCRM

1. Go to directory: sugarcrm\custom\Extension\modules\Contacts\Ext\Menus
   (Create the directory if you already don't have one)
2. Create a file: menu.ext.php
   
Write the below code in that file

foreach ($final_module_menu as $key => $val){
if($val[1] == $mod_strings['LNK_IMPORT_CONTACTS'])
unset($final_module_menu[$key]);
}

If you check the file sugarcrm\modules\Contacts\Menu.php, you can see the code for all menus that are seen in Action Menu of contacts.

$final_module_menu is the array which contains all those values:
$final_module_array =
Array (
    [0] =>Array ( [0] => index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index [1] => Create Contact [2] => CreateContacts [3] => Contacts )
    [1] => Array ( [0] => index.php?module=Contacts&action=ImportVCard [1] => Create Contact From vCard [2] => CreateContacts [3] => Contacts )
    [2] => Array ( [0] => index.php?module=Contacts&action=index&return_module=Contacts&return_action=DetailView [1] => View Contacts [2] => Contacts [3] => Contacts )
    [3] => Array ( [0] => index.php?module=Import&action=Step1&import_module=Contacts&return_module=Contacts&return_action=index [1] => Import Contacts [2] => Import [3] => Contacts ) )

So comparing $val[1] with the value of the item we want to remove, gives the required $key value.

After making any changes in the file, go to Admin->Repair->Quick Repair and Rebuild. This will execute the code.

Note: Sugarcrm Version - Sugarcrm 6.0.2

Saturday, June 25, 2011

Installing SugarCRM on Apache Web Server

Steps:
1. Create a database say 'sugarcrm'.

2. If you want to use open source SugarCRM, download SugarCRM Community Edition
   http://www.sugarcrm.com/crm/download/sugar-suite.html

3. Unzip it and place inside your application server deployment folder. Rename it with some name for e.g. sugarcrm.

4. Open your browser and type the url of your sugarcrm. For e.g. http://localhost/sugarcrm in my case. You will then see the sugarcrm page, click next. After that you will see a page as shown below.



  • Check if  php, database and web server are of supported version. If you are working in linux:     
    • You might need to give enough write permission to session variables by giving read and write access to 'session' located in  /var/lib/php/session
    •  Give appropriate read and write permission to config.php file located inside sugarcrm folder
    •  Give appropriate read and write permission to folders inside sugarcrm like custom, cache and modules
    • To install MB string and curl
      • yum install php_curl, php_mbstring (for CentOS)
    • If you are working in windows and want to  install MB strings, go to php.ini and    
      • ;extension=php_mbstring.dll with
      • extension=php_mbstring.dll
        check if php_mbstring.dll is present inside php 'ext' folder. 
      • To enable curl, uncheck php_curl.dll and check if it is present inside php 'ext' folder
    • Restart web server

5. Finally, you should be able to see 'Confirm Setting' page as shown below. In this page, if you see some of the modules not found, then you can enable the modules in php.ini as mentioned in step 4.


Now, after some steps, you will be redirected to sugarcrm login page. Login to the page and make the settings according to your requirement.