Wednesday, May 27, 2009

vtiger Development

Developers How To's
From vtiger.com

vtiger CRM - Developer How To's is one of the most frequently visited document in vtiger Wiki. We are periodically moving most of the commonly asked questions from vtiger Forums and Developer Mailing List to this section.

Please help us updating this document by:

1. Answer to the new questions
2. Review the existing Q & A for accuracy (content, grammar, punctuation & spellings, etc.,)
3. Add your own Q & A
4. More...


Attention to Business Community: We have a separate section exclusively for Business Community: Vtiger CRM - How To's
Contents
[hide]

* 1 Activities, Calendars, Events, Notes & Tasks
o 1.1 How to change timezone on server which has different timezone
o 1.2 How to Create A New Notification
o 1.3 How to import Notes
o 1.4 How to set Activities status filter
o 1.5 How to add New Field On Events
o 1.6 How to add a new Activity Type or Event Type
o 1.7 Where is the insert query of a to do/event?
o 1.8 How to Change sort date from Ascending to Descending Date in Activity History
o 1.9 How to - Global update Leads -> Notes
o 1.10 How to resolve problem "Calendar page shows blank screen"
o 1.11 How to Re-create Notifications
o 1.12 How to set the hour view for day as a default
o 1.13 How to resolve error "Cannot redeclare class DateTime"
o 1.14 How to give sharing permission in calendar
o 1.15 How to display Location field of a new Meeting
* 2 Charts & Graphs
o 2.1 How to change titles in the chart of Pipeline By Sales Stage
* 3 Chat
o 3.1 How to add Sound for Chat
* 4 Contacts Related
o 4.1 How to determine if a contact has been marked as deleted
o 4.2 How to save extra data like the user id for every saved contact
o 4.3 How to create another column in the Contact Tab
o 4.4 How to make a column that is displayed sortable
o 4.5 Contacts Export works but Add Message doesn't
o 4.6 How to resolve problem "Unable to enter Contacts"
* 5 Customer Portal
o 5.1 How to change the default "assign to" for the customer portal and the corresponding email
o 5.2 How to fix the Customer portal address in response email
o 5.3 How to change ticket detail in Customer portal
o 5.4 How to remove Products from the Customer portal
* 6 Dashboard
o 6.1 How to resolve error message in Dashboard on install
o 6.2 How to resolve problem "Ghost Record in Dashboard"
o 6.3 How to resolve dashboard problem in new install (Fedora Core 4 Updated)
* 7 Database
o 7.1 How to back up data
o 7.2 How to change the crmid in vtiger_crmentity
o 7.3 How to migrate Sugar data to vtiger CRM
o 7.4 How to set up mysql service
o 7.5 How to see the database Schema
o 7.6 How to change the char set for the tables in the MySQL database to CP1251
o 7.7 How to Import using SQL
o 7.8 How to resolve problem "Database not created during Install"
o 7.9 How to back up and restore a 4.2 database
* 8 Email Related
o 8.1 How to make Opt-out default "Yes"
o 8.2 How to change email templates for notifications
o 8.3 How to handle $ truncated text in non-html email
o 8.4 How to set IMAP to not delete email
o 8.5 How to fix issues related to SMTP configuration
o 8.6 How to bulk email outside of vTiger and update records
o 8.7 How to do E-mail notifications translation
* 9 FAQ & HelpDesk Module
o 9.1 How to make the questions & answers in the FAQ module visible
* 10 Fields, Labels, Picklists
o 10.1 How to rearrange the order of custom fields
o 10.2 How to change default field names
o 10.3 How to resolve problem "Can't create picklist"
o 10.4 How to resolve problem "Unable to Update Custom Fields"
o 10.5 How to change a field length
o 10.6 How to change a field label
o 10.7 How to restore picklists after data restore
o 10.8 How to make Translatable Picklists
o 10.9 How to make Translatable Custom field labels
o 10.10 How to set up Auto-increment fields
o 10.11 How to show "read only" on the screen for a custom field
* 11 List Views
o 11.1 how to make custom view columns sortable
o 11.2 Listview: How to change the fields and columns displayed in Listviews
* 12 Detail Views
* 13 Popups
o 13.1 Search in popup: available fields
o 13.2 List of clickable names etc in popup
o 13.3 Calling a popup
* 14 Import, Export, File Uploads
o 14.1 How to view/change the attachment size limit
o 14.2 How to import a CSV file
* 15 Inventory
o 15.1 How to resolve problem "Settings > Inventory Notification produces no valid page"
o 15.2 How to enter and track serial numbers for each item in an inventory
* 16 Invoicing Related
o 16.1 How to set the due date automatically +## days from creation
o 16.2 How to format "Amount" field to include commas
o 16.3 How to stop rounding up the numbers in the quantity field
o 16.4 How to change the default currency
o 16.5 How to remove 2 page in invoice
o 16.6 How to add Invoice ID to list of fields to choose for custom view
o 16.7 How to add the same service a number of times on the same invoice
o 16.8 How to create a unique series of invoice numbers without gaps
o 16.9 How to get the "comment" from the area below product to add to an invoice
o 16.10 Installation & Configuration
o 16.11 How to host vtiger crm in a multitenant fashion
o 16.12 How to resolve Notices after install on Windows SBS2003
o 16.13 How to change or Migrate from one directory to another
o 16.14 How to install vtiger on Ubuntu (in German)
* 17 Leads & Potentials Related
o 17.1 How to determine which tables the Leads and Potentials are saved in
o 17.2 How to sort leads by company name instead of by contact
o 17.3 Localization
o 17.4 How to change the font to support other languages
o 17.5 How to build language packs
o 17.6 How to install new language packs
* 18 Login Page
o 18.1 How to Set the default login module
o 18.2 How to resolve problem getting blank page upon login
o 18.3 How to resolve problem "Unable to login" or "Blank page after login"
o 18.4 How to set username and password as default
o 18.5 How to reset password
* 19 Mail Merge
o 19.1 How to resolve problems merging an uploaded document
* 20 Misc
o 20.1 How to change or enable the settings in FCKeditor
o 20.2 How to remove the Java script edit per field
* 21 Modules
o 21.1 How to configure a filter
o 21.2 How to use variables when creating views
o 21.3 How to change the number of entries per page
o 21.4 How to submit a module for addition to vtiger CRM project
o 21.5 Automatically select a group instead of user on record creation
* 22 Navigation Menu & Tabs
o 22.1 How to hide or remove system details from the user
o 22.2 How to view/modify the Edit and Delete links
o 22.3 How to remove menu items from quick access
o 22.4 How to disable Help and About Us
o 22.5 How to remove main tabs
o 22.6 How to remove the secondary tabs under the main tabs
o 22.7 How to change tab ID
o 22.8 How to edit/modify tab names
o 22.9 How to add or remove Modules from tabs
o 22.10 How to remove dashboard tab
o 22.11 How to remove modules from the dashboard tab
o 22.12 How to create a new module or tab in vtiger 5
* 23 Patching, Subversion
o 23.1 How to use .diff patch
o 23.2 How to use .diff patch on Windows
* 24 PDF Related
o 24.1 How to reverse contact name on PDF layouts
o 24.2 How to change the PDF layout for invoices and quotes
* 25 Quotes
o 25.1 How to create a query to extract the products from a quote using the quote number
* 26 Smarty & Theming
o 26.1 How to find the browser tab image
o 26.2 How to determine what templates are being used
o 26.3 How to remove a theme
o 26.4 How to change default theme
o 26.5 How to create a new Color theme for vtiger CRM 5
* 27 Tags
o 27.1 How to make the tagclouds be organization level
o 27.2 How to have global Tag Clouds as well as user specific Tag Clouds
* 28 Troubleshooting
o 28.1 How to view 'vtigercrm.log' file WITHOUT having Apache root
o 28.2 How to handle dissappearing views in leads, contacts, accounts, and potential
o 28.3 How to resolve very slow performance
o 28.4 How to resolve error "Module name is missing"
o 28.5 How to resolve "Runtime Error #7 - out of memory"
* 29 Trouble Tickets
o 29.1 How to Change Format of Trouble Ticket Basic Info
o 29.2 How to move 'Trouble Tickets' to the Account Information Tab
o 29.3 How to customize Trouble ticket email sending
o 29.4 How to modify the trouble ticket email templates
o 29.5 How to send a copy of the email to the person who opened the trouble ticket
o 29.6 How to turn off notification mails of new tickets
o 29.7 How to resolve problem of duplicate email going to the person who posted the trouble ticket
* 30 Usability
o 30.1 How to disable the Alt-D hotkey in vtiger
* 31 User Related
o 31.1 How to remove "Delete" from custom views
o 31.2 How to set the user's home page
o 31.3 How to restrict users from adding new URL/Websites to this module
* 32 WebForms
o 32.1 How to add/edit a button within the forms
o 32.2 How to resolve problem "Webforms shows blank page"
o 32.3 How to customize vtiger Web Forms
o 32.4 How to call custom fields in a webform

Activities, Calendars, Events, Notes & Tasks
How to change timezone on server which has different timezone

1. Open 'index.php' of [vTiger CRM Installation Folder]

2. Find these codes on the file

global $entityDel;
global $display;

3. Add this code below those lines

putenv("TZ=US/Eastern");


How to Create A New Notification

* Open en_us.lang.php file on [vTiger CRM Installation]/modules/Users/language/
* Add new labels on the file

'LBL_NEWNOTIFICATION_TITLE'=>'New Notification',
'LBL_NEWNOTIFICATION_DESC'=>'New Notification Short Description',

* You may add the translation of these labels to other language files as necessary.

* Insert row into `vtiger_notificationscheduler`

$newnotifyid = $adb->getUniqueID("vtiger_notificationscheduler");
$adb->query("INSERT INTO `vtiger_notificationscheduler`
(`schedulednotificationid`, `schedulednotificationname`, `active`,
`notificationsubject`, `notificationbody`, `label`)
VALUES
($newnotifyid, 'LBL_NEWNOTIFICATION_TITLE', 1, 'Notification Subject',
'This is a reminder notification for ...', 'LBL_NEWNOTIFICATION_DESC');");

* Edit cron/intimateTaskStatus.php and add a new block of code to handle your new notification

How to import Notes

TBS
How to set Activities status filter

You probably need to give permission for users to use that field.

Insert a row into the profile2field table for each profile and one row into the def_org_field table. Here's some SQL to give you an idea of what needs to be done:

INSERT INTO profile2field (SELECT profileid, 9, (SELECT fieldid FROM field WHERE tabid = 9 AND columnname = 'eventstatus'), 0, 1 FROM profile);

and

INSERT INTO def_org_field (SELECT 9, fieldid, 0, 1 FROM field WHERE tabid = 9 AND columnname = 'eventstatus');

How to add New Field On Events

TBS
How to add a new Activity Type or Event Type

See the AddActivityType page.
Where is the insert query of a to do/event?

It comes under common framework. Look in data/CRMEntity.php file for all modules insert query.
How to Change sort date from Ascending to Descending Date in Activity History

Open include/RelatedListView.php for editing and go to code at around line 396:

//Appending the security parameter
global $current_user;
$rel_tab_id = getTabid("Calendar");

global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
$tab_id=getTabid('Calendar');
if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
{
$sec_parameter=getListViewSecurityParameter('Calendar');
$query .= ' '.$sec_parameter;

Add this line after line 407 (the last line shown above)

$query .= ' ORDER BY vtiger_activity.due_date DESC ';

How to - Global update Leads -> Notes

vtiger 4.2 OS - RedHat

Overview: We wanted to be able to update the LEADS>NOTES when we sent out an email marketing campaign. As there isn't a mass-mailer tool within vtiger, we have to script the mailouts and the related database inserts.

1. the mailer script
2. the format of the mailing list itself
3. the update script

marketing_mailer.sh

#!/bin/sh

# "Marketing_Mailer.sh" for marketing campaigns - all associated files are in the same directory.
# Tuesday February 13th 2007
# Usage: ./marketing_mailer.sh emails_and_firstname.txt

PATH=$PATH:$HOME/bin:.
BASH_ENV=$HOME/.bashrc
USERNAME=""
export USERNAME BASH_ENV PATH
PATH=.:/usr/local/bin:$PATH
REPLYTO="user@example.com"
export PATH REPLYTO
HOME=/home/admin; export HOME

maillist=`cat $1`

for i in $maillist
do
EMAIL=`echo $i | awk -F: '{ print $1 }'`
NAME=`echo $i | awk -F: '{ print $2 }'`
echo "sending email to ($NAME) at ($EMAIL)"
mutt -F /admin/marketing_email/Feb20/muttrc -s "mail-shot subject" $EMAIL -a attachment.pdf <Dear $NAME,



!EOF
done

The muttrc file I call is so that the email doesn't show as coming from 'user@server' but rather the person I specify.

muttrc

# To ensure that mutt does not put 'username@localhost.localdomain in From
set from="user@example.com"
set use_from=yes
set envelope_from="yes"
set editor=vi

The email list is a file with format email_address:first_name. Example:

ben@blah.com:Ben
bev@blah.co.uk:Beverley
bob@blah.co.uk:Bob

Now for the vtiger database update -

* email_campaign will be my note title in vtiger.
* email_body will be the note contents.
* user '148' is a user called 'admin' that I created specifically for these mass updates.

mass_notes_dbupdate.sh

#!/bin/sh

# Make certain the EMAIL_LIST file contains addresses that are in vtiger!

EMAIL_LIST=./email-list.txt
EMAIL_CAMPAIGN="20070220_Email"
EMAIL_BODY=" \
Email body text here
\
Name
Sig. "


# DO NOT CHANGE BELOW HERE


for i in `cat $EMAIL_LIST`
do
echo "Updating CRM with note for $i"

mysql -uusername -ppassword --host=mysql_host database_name <
set autocommit=0;
commit;

update crmentity_seq set id = id +1;

insert into crmentity
(crmid, smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted)
select id, 148, 148, 0, 'Notes', '', now(), now(), null, null, 0, 1, 0
from crmentity_seq;

insert into notes
(notesid, contact_id, title, filename, notecontent)
select id, 0, '$EMAIL_CAMPAIGN', null, '$EMAIL_BODY'
from crmentity_seq;

insert into senotesrel (crmid, notesid)
select ld.leadid, cs.id
from leaddetails ld, crmentity_seq cs
where ld.email = '$i';

commit;
!EOF
done

How to resolve problem "Calendar page shows blank screen"

This problem may occur due to following reasons:

1. Use of php short tags. Ensure that the files calendar_share.php and addEventUI.php do not have any short tags.

1. Unsupported PHP version. Currently, vtigerCRM is not tested with PHP 5.2. Downgrade your PHP.

How to Re-create Notifications

New Events and tasks with send notification, are not sending notifications.

Just add a task from the main calendar view -> Add -> Task When you save it even with send notification checked, NO notification will be sent. However if you then edit the task or event leaving the send notification checked, when you click Save, a notification WILL be sent.
How to set the hour view for day as a default

In modules/Calendar/new_calendar.php, replace the following line

$viewBox = 'listview';

with

$viewBox = 'hourview';

How to resolve error "Cannot redeclare class DateTime"

This appears to be a conflict with PHP 5.2.0.

1. Edit modules/Calendar/Date.php to make these two changes:

a. Change

class DateTime

to

class com_vtiger_DateTime

b. Search and replace

new DateTime

with

new com_vtiger_DateTime

at about a dozen places in Date.php.

2. Edit modules/Calendar/Appointment.php -- search and replace as per "b" above, two occurrences.

3. Edit include/utils/RecurringType.php -- same search and replace, several times.

http://forums.vtiger.com/viewtopic.php?t=11832&postdays=0&postorder=asc&start=20
How to give sharing permission in calendar

To give sharing permission, go to Calendar Settings (use Settings icon next to Open Calendar icon in Calendar Header). It will display a small popup layer consisting of two sections: Time Settings and Calendar Sharing. In the Calendar Sharing section, select the users to give sharing permission. Enable the Mark Public field in the create event form. Now all the events which are marked as public will be displayed in shared users calendar.
How to display Location field of a new Meeting

Include the following lines of code in your Smarty/templates/ActivityDetailView.tpl after the description field (near line 136):

{if $LABEL.location neq ''}

{$LABEL.location}
{$ACTIVITYDATA.location}

{if}

Charts & Graphs
How to change titles in the chart of Pipeline By Sales Stage

TBS
Chat
How to add Sound for Chat

Add an exec() statement to launch external sound file.

For example, to add a play sound feature when a private message is started:

Edit modules/Contacts/vtchat.php and add the following code after function showPopup() before the closing :

var soundfile="Notify.wav" //path to sound file, or pass in filename directly into playsound()
function playsound(soundfile){
document.getElementById("soundeffect").innerHTML= "";
}

Then add the playsound(soundfile) function call wherever you want to play a sound. E.g. on the creation of a private message at the begining of the function PrivChat(dt,to,w,h), right before the var conf = array...

Verified with Linux/Firefox. Windows users please inform.
Contacts Related
How to determine if a contact has been marked as deleted

There is a record in vtiger_crmentity table which matches the contact (crmid = vtiger_contactdetails.contactid). The crmentity table has a "deleted" column. When you have found the record in this table, check the value of this field.
How to save extra data like the user id for every saved contact

Edit modules/Contacts/Save.php, find the line

$focus->save("Contact");

and put your code there.

Just as a test you can do the following:

$focus->column_fields["title"] = $current_user->user_name;

Of course, you'd change the field from "title" to something else like "Last Modified by" or whatever.

Anyway, it's the start to what will follow soon which is on every saved instance a table similar to vtiger_tracker can be written to track a user customized activity, the user that did it and the date and time that it happened.

That will allow for MUCH better reporting.
How to create another column in the Contact Tab

see Listview below
How to make a column that is displayed sortable

http://forums.vtiger.com/viewtopic.php?p=43166#43166
Contacts Export works but Add Message doesn't

Edit modules/Emails/Emails.php to add the lines below after line 42, i.e. after

var $plugin_save = false;

var $rel_users_table = "vtiger_salesmanactivityrel";

var $rel_contacts_table = "vtiger_cntactivityrel"; var $rel_serel_table = "vtiger_seactivityrel";

(What is the real problem here, and how does this solution fix it?)
How to resolve problem "Unable to enter Contacts"

Please check for duplicates in the vt_field db table.

1. Change it to remove the comment, and save the file.

Now you will have the debug query thrown in your browser. Try to log in, and send us the debug code shown in the browser after the login attempt.
Customer Portal
How to change the default "assign to" for the customer portal and the corresponding email

If you want to assign the portal tickets to a user, then you can do the following. File name : contactserialize.php function name : create_ticket

In this function there is a line $ticket->save("HelpDesk"); (approx. line 1525). Before this line add the following line:

$ticket->column_fields[assigned_user_id]=1;

This will assign the tickets to the user with id 1.

In this same function there is line $_REQUEST['assigned_user_id'] = $parnet_id; Change this to $_REQUEST['assigned_user_id'] = 1; (This will send the email to user with id 1)

where 1 is the admin id. Now all the portal tickets will be assigned to admin and the mail will be sent to admin. If you want to assign the tickets to some other user then you can give that user id here. Please note that if you do like this then all the tickets whcih are created from portal will be assigned to that particular user only.
How to fix the Customer portal address in response email

To edit the email content, including the url, edit the file modules/Emails/Save.php at around line 127.

Add the following line of code:

$bodydetails .= "PORTAL_URL" [[/index.php?action=index&module=Tickets&ticketid=".$focus->id."&fun=detail|'''Ticket Details''']];

(Note: The above solution is no longer correct in current vtigerCRM.)
How to change ticket detail in Customer portal

Change modules/HelpDesk/Save.php line 127 to this:

$bodydetails .= ".$PORTAL_URL."/index.php?action=index&module=Tickets&ticketid=".$focus->id."&fun=detail' Ticket Details";

How to remove Products from the Customer portal

1. Move /$customerportaldir/Faq to Faq.old

2. Modify $customerportaldir/header.html and Comment out



Dashboard
How to resolve error message in Dashboard on install

This can be due to incorrect permissions on the cache/images directory in UNIX/Linux. Change the mode (chmod) to 777.
How to resolve problem "Ghost Record in Dashboard"

The vtiger_crmentity table holds a record for each contact/account/product/etc. you add, even for those deleted, probably for auditing reasons.


If you have a "ghost" record, then it is likely that the record was not set to "deleted", even though its information WAS deleted, therefore you can't find it!


Try setting deleted=1 for the specific record.


To do this, you will need the "crmid" of the object you're trying to remove, so that you locate it in vtiger_crmentity.


With respect to the type of item you're trying to remove (e.g. a contact), filter the table field "setype" (e.g. `setype`="Contacts") and the field "deleted" (`deleted`=0) and then you'll have a list of ids of relative items not deleted.


Compare that with the ids found in your actual table holding the information (e.g. vtiger_contactdetails or vtiger_contactscf) and the id(s) contained only in your filtered vtiger_crmentity is/are the ghost ones!
How to resolve dashboard problem in new install (Fedora Core 4 Updated)

If graphics related libraries are not installed, dashboard doesn't work. The error looks like this:

Fatal error: Call to undefined function ImagePNG() in /home/vtiger/vtigerCRM5/apache/htdocs/vtigerCRM/Image/Canvas/GD/PNG.php on line 119

Seems that there's not enough checks before the vt5 install scripts start its compilation, so GD is compiled without png and jpg support in FC/CENTOS/RHEL4 systems.

So before installing, please be sure to have these on your system:

* libpng-devel
* libjpeg-devel
* libpng10-devel
* fontconfig-devel

If your system is already installed, you must to decompress the .bin file (start it and when the license shows up just hit ctrl-c a couple of times) and enter to vtigerCRM_Linux, then go to gd subdir and:

./configure --prefix=pathtoyouyrvtigerinstall
make && make install

After this is compiled, go to php dir and follow the same procedure.
Database
How to back up data

In the Settings, configure the BackUp Server option. With the BackUp Server option set, a backup of the vtiger db will be taken every time a user logs out.

The backup file will be present in the home directory of the ftp server which you have specified in the backup server configuration. The name of the backup file will be in the following format:

backup_date_time.sql
How to change the crmid in vtiger_crmentity

In vtigerCRM we are not having the crmid in the vtiger_crmentity table as auto-increment because auto-increment is not supported in all databases for example oracle.

In order to make vtigerCRM compatible with different databases, we are using the ADODB framework. Right now to get the IDs we are using the getUniqueId() method provided by ADODB.

You can change the crmid as auto-increment but you have to make the necessary changes in the code.


How to migrate Sugar data to vtiger CRM

A tool for automagically migrating all Sugar data to vtiger:

http://www.vtiger.it/index.php?option=com_docman&task=cat_view&gid=17&Itemid=28
How to set up mysql service

An issue has been seen when re-installing on Windows 2000, that the mysql service does not get set up properly.

Run the following at a command prompt:

mysqld-nt --install MySQL --defaults-file=D:\vtigerCRM\vtigercrm5\mysql\my.ini

(Use the correct path for your installation)
How to see the database Schema

Use phpmyadmin to view the structure of the vtigercrm database.

A full dump of a typical schema, in HTML format, can be downloaded at http://forums.vtiger.com/download.php?id=1755
How to change the char set for the tables in the MySQL database to CP1251

You must change $default_charset parameter, in config.inc.php file, by correct charset (UTF-8, ...)
How to Import using SQL

If you want to import using SQL you'll need to add an entry in the crmentity table as well as the vendor table. crmentity should map one-to-one with vendor on crmentity.crmid = vendor.vendorid

Changing the sperator from a comma to a semicolon would require some code changes, probably somewhere in modules/Import/

If you get an error message that a directory doesn't exist or isn't writable, the first thing I would do is create the directory if it doesn't exist and make sure it's writable by whichever user PHP runs as on your webserver.

Additional info available at:

* [1] Importing notes into 5.0.2
* [2] Importing notes into 5.0.4

How to resolve problem "Database not created during Install"

One solution is:

1. Install vTiger in a local PC (I have not any problem with this method) and export the database created (with mysqldump command)
2. In your server install vTiger (without tables) and import the local DB.
3. Replace the following server files with the files that were installed in local PC:

* parent_tabdata.php
* tabdata.php
* user_privileges/sharing_privileges_1.php
* user_privileges/sharing_privileges_1.php
* user_privileges/user_privileges_1.php
* user_privileges/user_privileges_1.php

How to back up and restore a 4.2 database

The procedure below worked for 4.2. Hopefully the procedure is similar for 5.0.X:

Step:1 Dump the database

* Dump original database to a file:

mysqldump --user=root --password= --port=3306 -h localhost vtigercrm4_2 > vtigercrm_dump.txt

(Hint: Create batch file containing this line for future use.)

* Create and move the dump file to a new directory:

C:\Program Files\vtigerCRM4_2\mysql\bin and run


Step:2 Do a clean install of vTiger

Step:3 Install Patch 2

* Extract zip file to:

c:\program files\vtigercrm4_2\apache\htdocs\vtigerCRM

* Install the patch by browsing to:

http://localhost/vtigerpatch.php


Step:4 Modify file

* Open the file vtigerCRM4_2.txt in a text editor.
* At the start of the file, add the line:

set FOREIGN_KEY_CHECKS=0;

* At the end of the file, add the line:

set FOREIGN_KEY_CHECKS=1;

* Save the file in the directory

C:\Program Files\vtigerCRM4_2\mysql\bin

It is now necessary to 'drop' the old database. From a command prompt in the directory C:\Program Files\vtigerCRM4_2\mysql\bin type in the line:

mysql -u root -p

When prompted for the password, enter the password or press if none required. You will now be faced with teh mysql prompt. Drop the database with the command:

drop database vtigercrm4_2;

Once this is complete, create a new database with the command:

create database vtigercrm4_2;

Quit the database.

From the directory: C:\Program Files\vtigerCRM4_2\mysql\bin Run the following command to restore the database:

mysql --user=root --password= --port=3306 -h localhost vtigercrm4_2 --force < vtigercrm_dump.txt

(Once again, I placed this command in a batch file for later use.)


Email Related
How to make Opt-out default "Yes"

from forum topic #49318

There is a possible hack: Edit Smarty/templates/DisplayFields.tpl and search for "$uitype eq 56" to find the relevant section of code. ("56" is the id connected to the checkbox-type in vtiger forms)

Scroll down to the SECOND {if $fldvalue eq 1} - not the one within the "notime" part.

Add the following code below the mentioned if clause behind the tag:

{elseif $fldname eq emailoptout AND $MODE neq edit}




Now, when creating a new contact/account, the checkbox will be selected by default. It's not the optimal solution, but it worked.
How to change email templates for notifications

The Email content can be modified by editing the code. The function to send the email is function sendNotificationToOwner

This function is located in the file include/utils/CommonUtils.php.

You can edit the function to change the content of the email.

In that function the string variable $description is the email content. Change the value of the variable depends on your requirement and save it.

The variable $subject is the subject of the Email.

Note: Don't remove the conditions in that function, edit only the contents of the variable $description,$subject.
How to handle $ truncated text in non-html email

String "macros" of the form $xyz$ are used in email templates. For example, $leads-firstname$ will be replaced with the lead's actual first name by the webmailer. This is very useful for mass mailing. The special macro $test$ is not defined as a valid string, and will be removed only. For a full list of all strings goto Settings->email templates.

By the way: the string will not be substituted on the copy that is sent to yourself automatically. This behavior is correct because it can't be substituted if you have more than one receiver for a personalized email.
How to set IMAP to not delete email

Strip the code or remove the buttons in /modules/Emails that delete email.

* Delete.php
* Email.js
* ListView.php
* DetailView.php

How to fix issues related to SMTP configuration

Open config.inc.php Around line 101 manually enter your SMTP information in the

$mail_server = '';
$mail_server_username = '';
$mail_server_password = '';

How to bulk email outside of vTiger and update records

http://forums.vtiger.com/viewtopic.php?p=44666#44666
How to do E-mail notifications translation

Email notifications code are located in include/utils/CommonUtils.php, method sendNotificationToOwner.


FAQ & HelpDesk Module
How to make the questions & answers in the FAQ module visible

Execute this SQL command in your database:

UPDATE `vtiger_def_org_field` SET `visible`=0 WHERE `tabid`=15 AND `fieldid`=252 or `fieldid`=253

Because

* tabid = 15 => FAQ
* fieldid = 252 => question
* fieldid = 253 => answer

You should also look in the table vtiger_profile2field (if you have created new profile...) to change to visible=0 for each profile with an entry for tabid=15 and fieldid=252 or fieldid=253
Fields, Labels, Picklists
How to rearrange the order of custom fields

The order is defined in the vtiger_field db table.

First, you will have to define a new block. Go to the vtiger_blocks db table, where the blocklabels are defined. Insert an entry for the block you want to create. The blocklabel is the title you want your block to have. Note the ID of the new record you inserted.

Go to the vtiger_field db table, where the fields are defined. Find your custom field and change the value of the blockid to the one you created above. Enter the blocklabel in the language file of the module you are working on.

You can use phpmyadmin to make these changes to your database.

Example:

* Module to which block will be added = Accounts
* Block title set in the blocklabel field of vtiger_block = LBL_MYNEW_LABEL
* Language = en_us

Edit file modules/Accounts/language/en_us.lang.php Add the following line to the strings array:

'LBL_MYNEW_LABEL' => 'What ever the title in you language'

http://forums.vtiger.com/viewtopic.php?p=42598#42598
How to change default field names

The field names are stored in the vtiger_field db table.

Each module has a language file. All of the field labels are stored at the language files and you might change it there. (If you find fields names you can not change, please post a i18n bug.)

Another thing you can do is to create custom fields instead of renaming others.
How to resolve problem "Can't create picklist"

Make the following changes.

In include/CustomFieldUtil.php (around line 205), replace

elseif($label == 'PickList')

with

elseif($label == 'Pick List')

In modules/Settings/CreateCustomField.php (line 145), replace the line

$output .= ''.$mod_strings['LBL_EDIT_FIELD_TYPE'].' - '.$mod_strings[$customfield_typename].'';

with

$output .= ''.$mod_strings['LBL_EDIT_FIELD_TYPE'].' - '.$customfield_typename.'';

How to resolve problem "Unable to Update Custom Fields"

Turn on the DEBUG feature for troubleshooting.

Edit log4php.properties file in vtiger folder and change

log4php.rootLogger=FATAL,A1

to

log4php.rootLogger=DEBUG,A1

For more see Log4php.
How to change a field length

http://forums.vtiger.com/viewtopic.php?p=43900#43900
How to change a field label

http://forums.vtiger.com/viewtopic.php?p=43152#43152
How to restore picklists after data restore

Run the query:

SELECT fieldname FROM field WHERE fieldname LIKE 'cf_%' AND uitype = 15;

to get a list of all the tables you need to create.

Each table has the structure:

CREATE TABLE ( character varying(255));

After the missing tables have been created, you should be able to insert the picklist values through web interface as you were attempting before.

Refer to these Forums:

http://forums.vtiger.com/viewtopic.php?t=15041&postdays=0&postorder=asc&start=10

http://forums.vtiger.com/viewtopic.php?p=50180
How to make Translatable Picklists

The correct change is:

{if $MOD.$keyval}{$MOD.$keyval}{else}{$keyval}{/if}

I changed {$MOD.$keyval} for {if $MOD.$keyval}{$MOD.$keyval}{else}{$keyval}{/if}

Make the same change in DisplayFields.tpl
How to make Translatable Custom field labels

With a small change in the code we can get the custom field labels translated in the same way we translate picklsts.

In include/utils/DetailViewUtils.php, line 54, change

if($generatedtype == 2)

to

if($generatedtype == 2 and empty($mod_strings[$fieldlabel]))

In include/utils/EditViewUtils.php, line 61, change

if($generatedtype == 2)

to

if($generatedtype == 2 and empty($mod_strings[$fieldlabel]))

With these two changes you can now add translated strings of your custom field labels. For example if you add a field with a label "Address" in campaign module, you can now edit the modules/Campaigns/language/yourlanguagefile and add a line like:

'Address'=>'Direccion',

and you will get the label translated on the views.
How to set up Auto-increment fields

In data/CRMEntity.php at around line 410, replace the following code (from the patch):

if(($uitype == 102) && ($insertion_mode != 'edit') && ($fldvalue == 0))

with this code:

if(($uitype == 102) && ($insertion_mode != 'edit'))

Make sure your EditViewUtils.php contains the following code:

elseif ($uitype == 102)
{
$editview_fldname[] = $fieldname;
if ($mod_strings[$fieldlabel]) $editview_label[] = $mod_strings[$fieldlabel];
else $editview_label[] = $fieldlabel;
if ((! isset($value)) || (!$value)) $fieldvalue[] = "0";
else $fieldvalue[] = $value;
}

Setting fieldvalue to 0 when it is created is the main point.
How to show "read only" on the screen for a custom field

Consult

* Smarty/templates/DisplayFields.tpl
* include/utils/EditViewUtils.php, function getOutputHtml



==Listviews
List Views
how to make custom view columns sortable

The array in modules.php: var $sortby_fields = Array('...') is common to both default view and custom view: if you enter your column names in here, it makes these columns able to be brought into asc order (even for custom fields).
Listview: How to change the fields and columns displayed in Listviews

The var $list_fields = Array() and var $list_fields_name = Array() arrays now seem to be obsolete (5.0.4), at least for generation of the listview, maybe not for other purposes.

The default listview that is displayed is just one of the customviews defined to be the default. See tables vtiger_customview and vtiger_cvcustomview.

The following forums post explains the syntax of the entries: http://forums.vtiger.com/viewtopic.php?t=20416&highlight=customview
Detail Views
Popups
Search in popup: available fields

var $list_fields = Array() and var $list_fields_name = Array() contain the fields that are selectable in the search at the top of a popup.

Unfortunately, this also changes the columns available in the list of the relatedview.

If one adds new colums to this list, one needs to change the query that pulls the entries for the relatedlist from the db,

otherwise there will be an error message on each page displaying this relatedlist (from listviewutil.php)
List of clickable names etc in popup

var $search_fields = Array() and var $search_fields = Array() contain the fields that are displayed in the list of contacts ... or whatever list.
Calling a popup

for vtlib 2

//localhost/vt504vta/index.php?module=Contacts&action=Popup&html=Popup_picker&form=vtlibPopupView&forfield=LinkTo&srcmodule=Payslip&forrecord=6

module= Name of the module for which we want to display data in the popup

forfield: name of the field the result goes into

srcmodule: name of the module the calling editview belongs to

forrecord: id of the calling crm entry

the smarty template is in displayfields.tpl for uicode 10

for a standard detailview/relatedlist

//localhost/vt504vta/index.php?module=Contacts&return_module=Products&action=Popup&popuptype=detailview

&select=enable&form=EditView&form_submit=false&recordid=7&parenttab=Inventory


For an editview, e.g. vendor popup

//localhost/vt504vta/index.php?module=Vendors&action=Popup&html=Popup_picker&popuptype=specific&form=EditView

whereas the add account to contact page looks like

//localhost/vt504vta/index.php?module=Accounts&action=Popup&popuptype=specific_contact_account_address &form=TasksEditView&form_submit=false
Import, Export, File Uploads
How to view/change the attachment size limit

In current vtigerCRM, this value is set in the file config.inc.php:

// maximum file size for uploaded files in bytes also used when uploading import files
// upload_maxsize default value = 3000000
$upload_maxsize = 3000000;

If the above lines are not in your file, you may add them.

Then check your modules/uploads/upload.php file and look for MAX_FILE_SIZE. Currently it should look like this:



If it looks like



instead, change it to look like above.
How to import a CSV file

Consult the Users Manual. It includes a large section which describes the import format and gives instructions how to achieve well-formed files from Excel and other sources. Also consider using the Excel Export/Import tool, available at http://forge.vtiger.com/projects/excelimptool/ It is an Excel macro which helps to format the csv files properly.

Make sure that empty entries also put in double hyphens. Look for special characters and remove them (other , " ; ....)

After that you may switch on your logging by changing FATAL to DEBUG in log4php.properties.php (line 19). You will find the log files created in your /log directory. For more see Log4php.

Note: Starting with v5.0.4, imported data have to be in the UTF-8 character format. Linux users have sufficient system tools for this, but Windows users will have to make additional efforts for the conversion of their character format to UTF-8. A tool for the ISO 8859-1(5) to UTF-8 conversion is provided at http://forge.vtiger.com/projects/utf8converter/ (English) and http://forge.vtiger.com/projects/utf8konverter/ (German)

Never use an exported CRM file for reimports directly!
Inventory
How to resolve problem "Settings > Inventory Notification produces no valid page"

This type of problem can happen when we use PHP short tags with a server that doesn't support short tags. Open the file modules/Settings/listinventorynotifications.php In the first line we have used PHP short tag ie.,

to:


In this same file a close php tag is missing, so add this code:

?>

at the end of the file. After this close php tag there should not be any space or lines. We will update these changes in svn.
How to enter and track serial numbers for each item in an inventory

In normal inventory systems you track amounts of a product, not individual items. If you really want to do that, you need to add each item to the inventory database individually. Normally this is way too much work. The way to do this in vtiger is to track each specific serial number on the sales order when you sell one or more item. You can add the amount of items on the order as one item with the total amount, and all relevant serial numbers in the description field for that one item. Or you can add a item line for each item to the sales order and put the serial number for each item in the information field for that order line. (from http://forums.vtiger.com/viewtopic.php?p=37669#37669)
Invoicing Related
How to set the due date automatically +## days from creation

In Smarty/templates/DisplayFields.tpl

find the condition

{elseif $uitype eq 23 || $uitype eq 5 || $uitype eq 6}

in this if block you can find



the variable $date_val is the displayed value. You can add 30 days to this date and can display.

If you want the change only for due date, then add this condition

{if $fldname eq "duedate"}

How to format "Amount" field to include commas

Edit include/utils/DetailViewUtil.php. The function is getDetailVuewOutputHtml. You need to find the uitype code for currency in the tree of if/elses. Should be uitype 71 or 72, according to http://wiki.vtiger.com/index.php/Ui_types
How to stop rounding up the numbers in the quantity field

The quantity field in database is an integer. So, whatever value we give as float, it will be saved as integer and will skip the decimal part. Using phpmyadmin, view the structure of the vtiger_inventoryproductrel table. Look at the definition of the quantity field, and note that it is integer.

To change it to a floating-point decimal field, execute the following SQL:

alter table vtiger_inventoryproductrel change column quantity quantity decimal(11,3) default NULL;

(Note: The above only applies to vtigerCRM 4. In version 5, the quantity field has been changed to decimal(25,3).)


How to change the default currency

Create a new currency from Settings > Currencies and assign the new currecy to the user. Now, whenever that user creates and invoice or quote, it will use the selected currecy.

Technical details:

The default/base currency is defined in the db table "vtiger_currency_info". It normally just has one row.

You can set its "id" and "currency_name" fields to correspond to your preferred row in the "vtiger_currency" table. You will have to fill in "currency_symbol" and "conversion_rate". "currency_status" should be "Active", and "defaultid" should be -11.

Note: This just sets the default currency, which will be used in new entities. Existing entities are not affected, and keep their existing currency.
How to remove 2 page in invoice

see: How to change the PDF layout
How to add Invoice ID to list of fields to choose for custom view

You have to add an entry to the vtiger_field table. The new entry should look like this:

* tabid = 23
* fieldid = (auto fill)
* columnname = invoiceid
* tablename = vtgier_invoice
* generatedtype = 1
* uitype = 80 (not sure)
* fieldname = invoice_id
* fieldlabel = Invoice ID
* readonly = 1
* presence = 0
* selected = 0
* maxlen = 100
* seque = 1
* block = 69
* disp = 1
* type = I~0
* quick = 1
* quick = (blank)
* info = BAS

The invoice id should be then be available for you to select in the fields display menu.
How to add the same service a number of times on the same invoice

Edit include/js/Inventory.js around line 328 and comment out this block of code:

if(duplicate)
{
//alert("You have selected < "+duplicate_products+" > more than once in line items "+positions+".\n It is advisable to select the product just once but change the Qty. Thank You");
if(!confirm("You have selected the following product(s) more than once. \n"+duplicate_products+"\n Do you want to Continue?"))
return false;
}

How to create a unique series of invoice numbers without gaps

This issue has been addressed and solved since v5.0.3. For previous versions, you may use the following instructions, or upgrade your system to the latest version.

By: Pieter (http://forums.vtiger.com/viewtopic.php?p=42499#42499)

Requirement:

I needed a way to generate invoice numbers in a way that every year a counter starts at zero, and every new invoice has an ascending invoice ID, without gaps. eg; 20070001, 20070002, 20070003, 20070004, and so on.

I have implemented this on the following way, using the subject field in Invoice.

Append in EditView.php after line 40 ($rate = $rate_symbol['rate']

$invoice_number = getInvoiceNumber();
$focus->column_fields['subject'] = $invoice_number;

Place the function below in CommonUtils.php:

// Extra function to create unique invoice_number
function getInvoiceNumber() {
global $adb;
$sql="select max(subject) as aantal from vtiger_invoice where
Year(invoicedate) = year(now())";
$result = $adb->query($sql);
$invoice_subject= $adb->query_result($result,0,"aantal");

Strip off year from invoice_number/subject

$invoice_subject = substr($invoice_subject,4,4);
// raise last invoice_number of invoice with 1
$invoice_count = $invoice_subject + 1;
$invoice_count = str_repeat("0",4-strlen($invoice_count)).$invoice_count;
$invoice_year = date("Y");
$invoice_number= $invoice_year.$invoice_count;
return $invoice_number;
}

How to get the "comment" from the area below product to add to an invoice

Change include/utils/EditViewUtils.php line 1412 from:

$query="select vtiger_products.productname, vtiger_products.product_description, vtiger_products.unit_price, vtiger_products.qtyinstock, vtiger_inventoryproductrel.* from vtiger_inventoryproductrel inner join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid where id=".$focus->id." ORDER BY sequence_no";

to:

select vtiger_products.productname, vtiger_inventoryproductrel.comment, vtiger_products.unit_price, vtiger_products.qtyinstock, vtiger_inventoryproductrel.* from vtiger_inventoryproductrel inner join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid where id=".$focus->id." ORDER BY sequence_no

Change modules/Invoice/CreatePDF.php line 152 from:

$prod_description[$i] = $associated_products[$i]['productDescription'.$i];

to:

$prod_description[$i] = $associated_products[$i]['comment'.$i];

+++++++ Has this form /include/utils/EditViewUtils.php been changed ?? I cannot find it in V 5 I dont even have the utils folder thanks +++++++ [ 08/23/2007 Addition - 5.0.3]

In 5.0.3 in the same file, around line 1408 the line(s):

vtiger_inventoryproductrel.description AS product_description,

can be changed to:

vtiger_inventoryproductrel.comment AS product_description,

This way you don't have to modify any of the CreatePDF.php files.
Installation & Configuration
How to host vtiger crm in a multitenant fashion

You can find a script and instructions on how to do this on Linux servers here:

http://forums.vtiger.com/viewtopic.php?p=26681#26681

Forge Project has been requested.
How to resolve Notices after install on Windows SBS2003

Currently in vtigerCRM we have some Notices. We are working on those areas to minimise the warnings and Notices. You can suppress these Warnings and Notices by changing the value of error_reporting in php.ini file.

error_reporting = E_ALL & ~E_NOTICE
display_errors = Off

How to change or Migrate from one directory to another

If the installation is connecting to the same db you don't need to change it, but that type of config is in

config.inc.php
How to install vtiger on Ubuntu (in German)

You may get instruction in German from http://www.it-works.co.at/cms/content/view/289/23/
Leads & Potentials Related
How to determine which tables the Leads and Potentials are saved in

You can find the table names in the $tab_name array in the module file, module_name.php. For your convenience, the table names for the Leads and Potentials modules are listed here:

http://forums.vtiger.com/viewtopic.php?t=8455
How to sort leads by company name instead of by contact

You can set up your filter according to the data you wish to display; then, if you require further fields to be sortable, edit the module file (e.g. Leads.php), find the sortby line to add in additional sort fields.
Localization
How to change the font to support other languages

1. Support for multiple languages with auto-detect is encoded in the file include\utils\GraphUtils.php in the calculate_font_name function.

For example, to indicate to use Arial when the language is Polish (pl_pl), add a case in the switch statement like so:

function calculate_font_name($locale) {
global $log;
$log->debug("Entering calculate_font_name(".$locale.") method ...");
switch($locale) {
case 'pl_pl':
$log->debug("Exiting calculate_font_name method ...");
return FF_ARIAL;

The font path is set in Image\Canvas.php by the code:

if (isset($_SERVER['SystemRoot'])) {
define('IMAGE_CANVAS_SYSTEM_FONT_PATH', $_SERVER['SystemRoot'] . '/Fonts/');

2. Try using $default_charset (not a hard-coded codepage):

$text = iconv($default_charset, 'utf-8', $text);

and test to ICONV:

if(function_exists('iconv')
$text = iconv($default_charset, 'utf-8', $text);


How to build language packs

Follow the procedure given below to translate vtiger CRM 5 user interface from English to any international language.

Step 1: Copy the following files inside the vtigercrm home directory, say if your language is Russian, copy the en_us.lang.php files to "ru_ru.lang.php" in their respective location, edit the "ru_ru.lang.php" files, and translate the label values given in these files to Russian.

- take the english language files, they are located in:

each modules directory (subdirectory name lang)

include directory (subdirectory name language)

Include/js directory (language file)

Starting with v.5.0.4 - change your character set to UTF-8 coding. For convenience you may use a text editor which has this capability (e.g. Notepad++)

Step 2: Add an entry (say for Russian 'ru_ru'=>'Russian') to the language array ($languages) in the file config.inc.php, So the array will look like:

$languages = Array('en_us'=>'US English','ru_ru'=>'Russian',);

Step 3: Log in to vtigerCRM (if you have already logged in, Logout and re-login), select your Language (Russian) in the Login page.

Note: The key name given in the $languages array will be the prefix of the language files for that package. For example, with key name = 'ru_ru', the Russian language files will have the name ru_ru.lang.php.

Step 4: Starting with v5.0.4 change the character encoding:

$default_charset = 'ISO-8859-1';

to

$default_charset = 'UTF-8';

Follow the procedure given above to install language packs.
How to install new language packs

1. get the latest language pack of your language from the vtigerforge

2. Unzip and copy the language files to your vtiger system. The directory structure of the language files is equal to the directory structure of your vtiger system, your language files get copied into the /modules/... and /include/... directories at the same place where you can find the en_us.lang.php files

3. open the config.inc.php of your vtiger system and look for the line where you can find: $languages = Array('en_us'=>'US English',);

change it to the following by using the language file name (is this example Russian is used) $languages = Array('en_us'=>'US English','ru_ru'=>'Russian',);

The key name given in the $languages array, will be the prefix of the language files of your package. (here 'ru_ru' is the key name, therefore the Russian language files will have the name ru_ru.lang.php, the same rules apply for other language packages.)

4. Now call the login page of your vtiger system, the new language is available at the selection menu.
Login Page
How to Set the default login module

Step 1:

In include/utils/CommonUtils.php at line no 1302 replace the code:

if(in_array($tabid,$childArr))
{
$parent_tabname= $parent_tab_info_array[$parid];
}

with:

if(in_array($tabid,$childArr))
{
$parent_tabname= $parent_tab_info_array[$parid];
break;
}

Step 2:

In modules/Users/Authenticate.php remove the following line at line no 70:

header("Location: index.php?action=index&module=Home");

add a line at line no 129:

header("Location: index.php");

From this point go to the file config.inc.php and change the value of the "Default module".
How to resolve problem getting blank page upon login

To troubleshoot, to turn on the logging function by changing FATAL to DEBUG in log4php.properties. For more see Log4php.
How to resolve problem "Unable to login" or "Blank page after login"

The problem may be due to the duplication of user accounts, i.e if you have done your installation twice or clicked the 'Installation" button twice, because of this the user may get duplicated and during authentication, login permission will fail.

To check this possibility, log into your db vtiger database (vtiger503) and run this command:

select * from vtiger_users;

and check whether you have two user accounts with same name (e.g. admin).

If you have single user name and still get the error, Send us the log file logs/vtigercrm.log.

Alternatively:

1. Go the file include/database/PearDatabase.php.
2. Search for the following line:

//$this->database->debug = true;

How to set username and password as default

Refer to 5createTables.inc.php, where default values have been handled as "admin".
How to reset password

If you can get access to the database, try changing the user_password field value in vtiger_users table to:

adpexzg3FUZAk which makes the password as admin

You will also need to set the crypt_type field of vtiger_users to blank (empty value) if you are on 5.0.4 and above.

NOTE: Once you login make sure to update the password to a secure one through 'My Preferences' link.
Mail Merge
How to resolve problems merging an uploaded document

We are having a ActiveX component on our product to facilitate the Mail Merge Operation. To enable us to install this component & run it on your browser the following Internet Security options must be set in Microsoft Internet Explorer web browsers.

Once this is done, when you perform the template merge operation, the browser would seek your permission to run & install our ActiveX component. If you give the permission to do so, the control would then be downloaded and installed on your computer.

Do the following for Microsoft Internet Explorer: Choose Tools->Internet Options menu item In the dialog box click the "Security" Tab. On that Property Page click "Custom Level".

1. Select - Enable - "Download signed ActiveX controls"
2. Select - Enable - "Download unsigned ActiveX controls"
3. Select - Prompt - "Initialize and script ActiveX controls not marked as safe" (This will promt you each time you perform Merge operation.) You can enable this so that the browser will not prompt you for downloading activeX components
4. Select - Enable - "Run ActiveX controls & plug-ins
5. Select - Enable - "Script ActiveX controls marked safe for scripting" Press OK to save changes.

These are the necessary settings for executing the ActiveX component in your browser.

[quote:44106afbd6]If I merge an uploaded document it works fine the first time, however, if I then merge the same document with a 2nd Account/Contact etc the document opens but has the Account/Contact details from the first one. It does not update with the 2nd Account/Contact details. [/quote:44106afbd6]

This is because of the cache. You can get the new merged templates manually,by deleting the cache every time.

You can also make the browser to check for new data for every merge operation by doing this.

In the Internet Explorer, Internet Options->Browsing History(Settings)-> Select Every time I visit the webpage, so your browser will check for the new contents for every visit and you will get the updated merged document.
Misc
How to change or enable the settings in FCKeditor

http://forums.vtiger.com/viewtopic.php?t=12286&highlight=
How to remove the Java script edit per field

You can disable the hndMouseOver() function in include/js/dtlviewajax.js like this:

function hndMouseOver(uitype,fieldLabel)
{
return true;
var mouseArea="";
mouseArea="mouseArea_"+ fieldLabel;
...

The "return true" at the begining eliminates all "edit" labels from appearing and thus you cannot get at the ajax section.

If you only want it on the leads you will have to read the module variable and put an "if" condition around the "return true".
Modules
How to configure a filter

TBS
How to use variables when creating views

For example, to create a view where one filter would be current user, so people would only see entries which have been assigned to them. This would serve better than search with show only my items.

You may use the profile and role settings to restrict the user's access to data from other users. Hence people would only see entries which have been assigned to them.
How to change the number of entries per page

Change

// list_max_entries_per_page default value = 20
$list_max_entries_per_page = '20';

in config.inc.php and let us know if it works.

http://forums.vtiger.com/viewtopic.php?p=41866#41866
How to submit a module for addition to vtiger CRM project

I would like to know how to submit a module for you to evaluate for addition to your product. I have a fairly simple product module that I would like to submit when it is complete.

There are two ways:

1. You can host your own project based on vtiger CRM at: vtigerforge where hundreds of developers already submitted their projects. We have splitted the SVN repository into stable and development branches, so stable branch will have tested and qualified distribution, while development can proceed on a separate branch. In addition to the sources, we will always provide a fully packaged stable binary, for user convenience.After analyzing your code we can integrate it for you and check it into the CVS repository in SourceForge. We will ensure that proper credits are preserved.

2. If you want SVN access to the vtiger project, we will be happy to enable that as well.

Before you contribute, there is a standard legal requirement, basically asserting that "I have the right to contribute this, it is not someone else's proprietary code I am contributing" kind of thing. These can be found in the SourceForge Terms of Use.
Automatically select a group instead of user on record creation

In Smarty/templates/DisplayFields.tpl In condition $uitype eq 53

Replace,

{if $check eq 0}
{assign var=select_user value='checked'}
{assign var=style_user value='display:block'}
{assign var=style_group value='display:none'}
{else}
{assign var=select_group value='checked'}
{assign var=style_user value='display:none'}
{assign var=style_group value='display:block'}
{/if}

With,

{if $check neq 0}
{assign var=select_user value='checked'}
{assign var=style_user value='display:block'}
{assign var=style_group value='display:none'}
{else}
{assign var=select_group value='checked'}
{assign var=style_user value='display:none'}
{assign var=style_group value='display:block'}
{/if}

Navigation Menu & Tabs
How to hide or remove system details from the user

You can hide the system details by editing it on

* [vTiger CRM Folder]/Smarty/templates/SetMenu.tpl

* [vTiger CRM Folder]/Smarty/templates/Settings.tpl

Reference: http://forums.vtiger.com/viewtopic.php?p=43441#43441
How to view/modify the Edit and Delete links

Code is located in include/utils/ListViewUtils.php Search for LNK_EDIT.
How to remove menu items from quick access

http://forums.vtiger.com/viewtopic.php?t=13315&highlight=
How to disable Help and About Us

See "How to remove the secondary tabs under the main tabs"
How to remove main tabs

Edit the file parent_tabdata.php, find the array $parent_tab_info_array, and delete from it the entries you don't want.
How to remove the secondary tabs under the main tabs

In the vtiger home directory, open the parent_tabdata.php

Here is an example that only shows the home, marketing, tools and settings tabs:

//This file contains the commonly used variables

$parent_tab_info_array = array(1=>'My Home Page', 2=>'Marketing', 3=>'Sales', 4=>'Support', 5=>'Analytics', 6=>'Inventory', 7=>'Tools', 8=>'Settings');

$parent_child_tab_rel_array = array(1=>array(3,9,10,), 2=>array(26,6,4,10,7,9,8,), 3=>array(7,6,4,2,20,22,23,14,19,8,9,), 4=>array(13,15,6,4,14,8,10,9,), 5=>array(1,25,), 6=>array(14,18,19,21,22,20,23,), 7=>array(24,27,8,), 8=>array(),);
?>

$parent_tab_info_array: You can change the tab order just changing the array order. If you want some tab to disappear, delete or comment that tab.

For example, to "disappear" the Marketing tab and move the Support tab:

$parent_tab_info_array = array(1=>'My Home Page', /*2=>'Marketing',*/ 3=>'Sales', 5=>'Analytics', 6=>'Inventory', 4=>'Support', 7=>'Tools', 8=>'Settings');

$parent_child_tab_rel_array: Each array is related to $parent_tab_info_array for changing the child_tab order you have to change the elements of the array that you want to modify.

For My Home Page,

$parent_child_tab_rel_array=array( 1=>array(3,9,10,21,),

The numbers in the arrays correspond to child tabs, as set in the $tab_info_array array, which is defined in the tabdata.php file.

To finish removing you must delete an entry in the data base. Find the parenttabid in the table vtiger_parenttab rememeber it, you must find the number of the secondary tabs in tabdata.php $tab_info_array too. Go in table vtiger_parenttabrel find all record with the parenttabid find before, remove the entry where tabid correspond to your secondary number. Reload your page, the submenu has desapear.
How to change tab ID

Change the sequence of the fields in vtiger_fields table.

Select the vtiger_fields table and select the records of tablename='vtiger_invoice'. In that there is a column sequence. Just change the sequence which one you want to display first.

To change the block, there is a column block. in that you can change the block number (three blocks) where you want to display.
How to edit/modify tab names

Check the include/language/en_us.lang.php (or your language file, as appropriate). You can edit all elements there for your needs.

Around line 415 you'll see:

//Added language for Parent Tab

'My Home Page'=>'My Home Page',
'Marketing'=>'Marketing',
'Sales'=>'Sales',
'Support'=>'Support',
'Analytics'=>'Analytics',
'Inventory'=>'Inventory',
'Tools'=>'Tools',
'Settings'=>'Settings',

Rename them to what you like for everything. Also the title can be changed here.
How to add or remove Modules from tabs

For v4.2.x:

1. Login as an admin user.
2. Go to "My Account" (top right of any page).
3. Click "Customize Tabs".
4. There you can drag and drop to control which are displayed and which aren't.

For v5.0.x:

You can remove a tab if all subtabs (modules) are disabled at the profile settings. For instance, if you want to remove the "Analytics" tab, disable the "Dashboard" and the "Reports" modules at the profile.
How to remove dashboard tab

TBS
How to remove modules from the dashboard tab

Edit the table vtiger_parenttabrel.


How to create a new module or tab in vtiger 5

Creating a New Module
Patching, Subversion
How to use .diff patch

Note: .diff patch files cannot be used on Windows! These instructions only apply to UNIX/Linux.

Firstly, you need to find the correct patch for the version of vtiger you're currently running. Applying a patch to the wrong version won't work and may break things, potentially quite badly. You have been warned! Once you have the correct patch, the process is relatively simple:

1. Open a command prompt
2. Use the cd command to move to your vtiger root directory (this is the one where the confi.inc.php file is located)
3. Run the patch command:

patch -p0< $patchname

$patchname should be the full path and filename to the patch file. For example, c:\temp\mypatchfile.patch
How to use .diff patch on Windows

Download WinMerge for Windows.
PDF Related
How to reverse contact name on PDF layouts

The name is Last then First.. This will change it to First then Last.

edit include\utils\CommonUtils.php.

There at line no 508 you have to make the following changes

from

if (getFieldVisibilityPermission("Contacts", $current_user->id,'firstname') == '0') {
$contact_name .= ' '.$firstname;
}

to

if (getFieldVisibilityPermission("Contacts", $current_user->id,'firstname') == '0') {
$contact_name = $firstname . " ";
} else {
$contact_name = "";
}
$contact_name .= $lastname;
}

How to change the PDF layout for invoices and quotes

If you would like to modify the layout of the PDF for invoices and quotes see here.
Quotes
How to create a query to extract the products from a quote using the quote number

Look in the vtiger_inventoryproductrel table.
Smarty & Theming
How to find the browser tab image

Located in include/images/vtigercrm_icon.ico
How to determine what templates are being used

There are two ways to get this info.

1. Read the browser address and follow the code. For example, you propose: http://mydomain//index.php?module=Contacts&action=index&parenttab=Marketing

So you go to modules/Contact and view index.php. There you see that it loads ListView.php, and at the end of this script you see the template that is being used.

2. Edit Smarty/libs/Smarty.class.php, line 104:

var $debugging = false;

If you set this variable to true, you will get a popup with all the information of the templates and variables being used.
How to remove a theme

http://forums.vtiger.com/viewtopic.php?p=44922#44922
How to change default theme

Theme names are the names of the folders under the themes folder. For example, softed. Select the desired theme folder name, and assign it to $default_theme in config.inc.php. Example:

$default_theme = 'woodspice';

How to create a new Color theme for vtiger CRM 5

Click here to read the Color theme creation guide
A temporary guide to create your own color themes for vtiger CRM 5.0.0


Tags
How to make the tagclouds be organization level

In vtigerCRM 5.0.2, tagcloud is not organization level, it is user-based one. In vtigerCRM 5.0.2, Tag cloud cannot be turned off.

In order to make the tags displayed in home page be organization level: Edit the file modules/home/index.php and change the line

$smarty->assign("ALL_TAG",$freetag->get_tag_cloud_html("",$current_user->id));

to

$smarty->assign("ALL_TAG",$freetag->get_tag_cloud_html(""));

This function's definition is located in the file include/freetag/freetag.class.php

The first argument is modulename, second is the user ID, and third is entityid.

All three arguments are optional. If you don't pass any of the arguments, the tag cloud will be an organization level one.

You can narrow down the clouds by passing the arguments.

In vtigerCRM the cloud displayed in the Home Page uses only the userid, so the cloud will be a user-based one and displays the all the tags created by the current logged-in User.

In the Detail View of any record the cloud for the specified entity will be shown, i.e. the function will get the values for userid, module, and objectid to display the tag corresponding to the specified entity.

Just pass the necessary values for the method and display the cloud wherever you like.
How to have global Tag Clouds as well as user specific Tag Clouds

TBS
Troubleshooting
How to view 'vtigercrm.log' file WITHOUT having Apache root

TBS
How to handle dissappearing views in leads, contacts, accounts, and potential

I did some searching through the code and it is a simple fix to make them work from now on:

Go to modules/CustomView/Save.php

On line 39 there is a line that erroneously says the following:

$allKeys = array_keys($HTTP_POST_VARS);

It should say,

$allKeys = array_keys($_REQUEST);

Ref: http://forums.vtiger.com/viewtopic.php?p=44795#44795
How to resolve very slow performance

Sometimes the problem is that not enough memory is assigned to MySQL. vtigerCRM uses InnoDB, not MyISAM. By default very little memory is assigned to that type of database table. Try running some maintenance tools on your db.
How to resolve error "Module name is missing"

One solution is to edit index.php (the root one) to comment out the following lines

/*
if(!$is_module)
{
die("Module name is missing. Please check the module name.");
}
*/

How to resolve "Runtime Error #7 - out of memory"

On some machines we got this Runtime Error #7 - out of memory if we pushed the Preferences button in the Outlook plugin.

This can be fixed by applying the Microsoft ActiveX Control Pad. You can download it at http://msdn2.microsoft.com/en-us/library/ms968493.aspx
Trouble Tickets
How to Change Format of Trouble Ticket Basic Info

Play with the values in the vtiger_field table; change the solution field from ADV to BAS, and play with the sequence value.

1. If your installation is the info_type is already BAS for the solution field (and for all fields with tablename='vtiger_troubletickets').
2. The block on which the solution field is has its created view value set to no, so it doesn't appear when you create.
3. Change the field vtiger_block.create_view to 0 for blockid 29.

How to move 'Trouble Tickets' to the Account Information Tab

You can set it to single pane view.
How to customize Trouble ticket email sending

Edit modules/HelpDesk/Save.php which contains the code to send email notifications.
How to modify the trouble ticket email templates

Depending on what you want to customise, you will need to alter some of the following files:
File Purpose Around line (v5.0.4)
modules/HelpDesk/language/en_us.lang.php Contains the text used in the emails 174
modules/HelpDesk/Save.php Allows you to alter the subject when creating a new ticket or clicking the "Edit" button 91
modules/HelpDesk/DetailViewAjax.php Allows you to alter the subject when clicking the "Edit" link in a section 54
include/utils/CommonUtils.php Compiles the mail body (function getTicketDetails, but also getTicketComments) & sends the email 2834
How to send a copy of the email to the person who opened the trouble ticket

Edit modules/HelpDesk/Save.php which contains the code to send email notifications. Given that the person who has opened the ticket is the current user, add the following code. Around line 150 you will find:

//send mail to the assigned to user and the parent to whom this ticket is assigned
require_once('modules/Emails/mail.php');
$user_emailid = getUserEmailId('id',$focus->column_fields['assigned_user_id']);
if($user_emailid != '')
{
$mail_status = send_mail( 'HelpDesk', $user_emailid, $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $email_body );
$mail_status_str = $user_emailid."=".$mail_status."&&&";
}

Right after the require_once add:

global $current_user;
$user_emailid = getUserEmailId('id',$current_user->id);
if($user_emailid != '')
{
$mail_status = send_mail( 'HelpDesk', $user_emailid, $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $email_body );
$mail_status_str = $user_emailid."=".$mail_status."&&&";
}

Rest of code continues here.
How to turn off notification mails of new tickets

Edit file modules/helpdesk/save.php and comment out as follows:

//added condition to check the emailoptout(this is for contacts and vtiger_accounts.)
if($emailoptout == 0)
{
//send mail to parent
//The below commented out part is what sets the opt out for sending customers notifications that their tickets have been created/modified.
//Uncomment the following lines in order allow customer to be sent a notification
// if($_REQUEST['parent_id'] != '' && $_REQUEST['parent_type'] != '')
// {
// $parentmodule = $_REQUEST['parent_type'];
// $parentid = $_REQUEST['parent_id'];
//
// $parent_email = getParentMailId($parentmodule,$parentid);
// $mail_status = send_mail('HelpDesk',$parent_email,$HELPDESK_SUPPORT_NAME,$HELPDESK_SUPPORT_EMAIL_ID,$subject,$email_body);
// $mail_status_str .= $parent_email."=".$mail_status."&&&";
// }
}

How to resolve problem of duplicate email going to the person who posted the trouble ticket

What you are looking for is in the vtiger_crmentity.smcreatorid field. So you will have to run an sql select to get this value if it isn't accessible in the Save.php script. Something like:

$rs=$adb->query("select smcreatorid from vtiger_crmentity where crmid=$ticketid");
$row=$adb->fetch_array($rs);
$user_emailid = getUserEmailId('id',$row['smcreatorid']);

and follow on from there. (This is only meant to be a guideline.)
Usability
How to disable the Alt-D hotkey in vtiger

In include/language/en_us.lang.php (or whatever language specific file you use) look for the string:

'LBL_DELETE_BUTTON_KEY' => 'D',

and change the D to something else or leave empty.
User Related
How to remove "Delete" from custom views

Edit modules/CustomView/Delete.php and comment out the line

$deletesql = 'delete from vtiger_customview where cvid =".$cvid;

(Note - this cannot but correct/complete. It results in an undefined variable $deletesql being used in the very next line.)
How to set the user's home page

Edit the file config.inc.php, find the line

$default_module = 'Home';

and change 'Home' to the module of your choice, e.g. 'Contacts'.
How to restrict users from adding new URL/Websites to this module

TBS
WebForms
How to add/edit a button within the forms

TBS
How to resolve problem "Webforms shows blank page"

Edit file contactserialize.php and add the following line before the first statement:

ini_set('ínclude_path', 'here-your-full-path-to-vtiger');

(Note: vtigerCRM version 5 does not contain a file names contactserialize.php.)
How to customize vtiger Web Forms

See: VTiger Webforms Install Guide

Courtesy: greggster
How to call custom fields in a webform

1. Create a custom field, say "Loan Purpose", in the Leads module. In my forms, I'll call this "purpose".
2. Using phpmyadmin, browse to the table vtiger_leadscf.
3. Look at the custom field name for the field in question; mine was called "cf_453". This is the field name to be used in webforms.php.
4. The name "cf_453" only needs to be used in webforms.php. For the other files, call it something friendly; I used "loanpurpose".
5. Assign like this:

index.php: Add the field name "loanpurpose" to the line starting with: function create_lead_from_webform

(This function is not in index.php. Someone should verify and correct this entry!)

In my implementation, used a dropdown list in the form like this:

Loan Purpose:



send_data.php: Add 'loanpurpose'=>"$loanpurpose"

webforms.php: Add in both places:

in if($_REQUEST['create'] == 'lead') function:

$loanpurpose = $_POST['loanpurpose'];

and in

$params = array(
$focus->column_fields['cf_453'] = $loanpurpose; <-- this is where the new form value gets mapped to the custom field ID.