Thursday, March 15, 2012

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

Tuesday, October 4, 2011

Using Rsync to synchronize files/folders from Windows to Linux with SSH tunnel


Rsync Server on Linux

1. Rsync can be found in Linux repository and is easy to install using yum or apt-get commands.
                >> yum install rsync
                >> apt-get install rsync

2. Create a file rsyncd.conf at /etc and add following lines
                >> nano /etc/rsyncd.conf
               [your_user_sync]
                path = /home/your_user/backup
                comment = backup
                uid = your_user
                gid = your_user
                read only = false
                auth users = your_user
                secrets file = /etc/rsyncd.secrets
Here your_user is the username in your Linux machine.

Thursday, July 28, 2011

Nagios Client (NRPE) installation in Linux

i. Create Account Information
Become the root user. You may have to use sudo -s on Ubuntu and other distros.
su -l
Create a new nagios user account and give it a password.
/usr/sbin/useradd nagios
passwd nagios

ii. Install the Nagios Plugins
Create a directory for storing the downloads.
mkdir ~/downloads
cd ~/downloads

Nagios Client(NSClient) Installation in Windows

Installing nagios client is very simple. Download NSClient from location:
http://nsclient.org/nscp/downloads

You can download NSClient for 64 or 32 bit computer as required.

Copy NSClient in any folder. For e.g. D:\Nagios

Double click and install it. You will be asked for following information:
Allowed host: 'IP of your nagios server'
NSClient Password: 'Password you used when installing nagios server'
Also, enable the modules you need.

 Now configuration is finished. Restart NSClient. Fo this, go to 
Control Panel->Administrative Tools->Services->NSClient++
Start/Restart it.

Quick Installation of Nagios in CentOS

Nagios is a system and network monitoring application. Installation process is as below:

Prerequisites:
Before installing Nagios, you need to install the following on your linux machine:
     Apache
     PHP
     GCC compiler
     GD development libraries
You can use yum to install these packages by running the command:
yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel

Thursday, July 21, 2011

Completely Unistall MySQL

Whenever you install MySQL, uninstall it and try to install it again, you might not be able to do so because MySQL will ask for the old password. You cannot install MySQL if you do not have the old password. Solution for this is:

  • Uninstall MySQL
  • Go to your MySQL installation folder for e.g. C:\Program Files and delete the MySQL folder
  • Delete MySQL from your AppData folder. I am using windows XP and in my case, the location is C:\Documents and Settings\All Users\Application Data. Here you will find MySQL folder. Delete this folder.
  • Finally, reinstall MySQL and you should be able to install it successfully.

Sunday, July 17, 2011

Transferring cake baked code from windows to centos (linux)

First thing to do is to install cakephp in centos. Please refer to my previous blog on this(http://codebyte.blogspot.com/2011/07/installing-cakephp-in-centos.html) if you have not already installed cakphp.

Now, transfer your code to your document root (For e.g. /var/www/html in my case). Suppose, the name of your application is myapp, then
1. Open var/www/html/myapp/webroot/index.php

  • Search for if (!defined('CAKE_CORE_INCLUDE_PATH')).
  • You may find something like: define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS. 'xampp' .DS. 'cake' if you used xampp in windows.
  • Change this to the location of your installed cakephp folder. For e.g. define('CAKE_CORE_INCLUDE_PATH', .DS . 'var' . DS. 'www' .DS. 'html' .DS. 'cake')

2. Open /var/www/html/myapp/config/database.php and provide appropriate database settings.

Finally, restart your apache server (/etc/init.d/httpd restart).

Installing CakePHP on CentOS

Download Cakephp
https://github.com/cakephp/cakephp/downloads

Rename it to something like cake. Extract from .tar.gz files.
tar -xvzf cake

Put 'cake' folder inside your document root. For e.g. if your document root is /var/www/html, put the cake folder inside it. Then follow some guidelines below.
1. Give appropriate permission setting for your 'cake' folder.
2. Open /cake/app/config/core.php. Go to the line where security.salt is defined and change it to some other value. Also do the same for security.cipherSeed.
3. Rename database.default.php to database.php and provide appropriate database settings

Now, open your browser and go to http://localhost/cake.

If you do no see any color in the page, you might want to check two things. Go to /etc/httpds/conf/httpd.conf and
1.  Search for mod_rewrite.so and check if LoadModule rewrite_module_modules modules/mod_rewrite.so is commented. If so, remove the comment.
2. Search for 'Options Indexed FollowSymLinks' and change 'AllowOverride None' to 'AllowOverride All' as below:
   <Directory />
    Options Indexed FollowSymLinks
    AllowOverride All
   </Directory>
 Note: Make sure you make the change in 'Options Indexed FollowSymLinks' and not in 'Options FollowSymLinks'.

Finally, restart apache (/etc/init.d/httpd restart).

Slow Connection to MySQL installed on windows from linux (Solved)

If you have MySQL installed in Windows server and you are querying from Linux, you might notice that the performance of you application is very slow. This is because, when your application in Linux connects to database in Windows, even a simple query takes 3-4 seconds to execute.

The solution for this problem is to put a line 'skip-nam-resovle' in my.ini of your mysql server. Search for [mysqld] in my.ini and put that line below it as below.

[mysqld]
skip-name-resolve