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:
Attention to Business Community: We have a separate section exclusively for Business Community: vtiger CRM - How To's |
[edit] 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
[edit] 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;
}
[edit] 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.
[edit] 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".
[edit] 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, ...)
[edit] How to customize Trouble ticket email sending
Edit modules/HelpDesk/Save.php which contains the code to send email notifications.
[edit] How to modify the trouble ticket email templates
Trouble ticket email text templates are in file modules/HelpDesk/Save.php from line 122 to line 149.
[edit] 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.
[edit] 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.
[edit] 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
[edit] 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 .= "<a href='".$PORTAL_URL."/index.php?action=index&module=Tickets&ticketid=".$focus->id."&fun=detail'>Ticket Details</a>";
(Note: The above solution is no longer correct in current vtigerCRM.)
[edit] 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.
[edit] 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.)
[edit] 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."&&&";
// }
}
[edit] 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.
[edit] How to do E-mail notifications translation
Email notifications code are located in include/utils/CommonUtils.php, method sendNotificationToOwner.
[edit] How to Create New Notifications
- Add 2 new strings to modules/Users/language/en_us.lang.php for the notification settings entry
'LBL_NEWNOTIFICATION_TITLE'=>'New Notification', 'LBL_NEWNOTIFICATION_DESC'=>'New Notification Short Description',
- Add the translation of these labels to other language files
- 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
[edit] How to bulk email outside of vTiger and update records
http://forums.vtiger.com/viewtopic.php?p=44666#44666
[edit] 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.
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!
[edit] 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:
[edit] How to import Notes
TBS
[edit] 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
[edit] 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
[edit] 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.
[edit] How to add or remove Modules from tabs
For v4.2.x:
- Login as an admin user.
- Go to "My Account" (top right of any page).
- Click "Customize Tabs".
- 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.
[edit] How to remove dashboard tab
TBS
[edit] How to remove modules from the dashboard tab
Edit the table vtiger_parenttabrel.
[edit] How to remove menu items from quick access
http://forums.vtiger.com/viewtopic.php?t=13315&highlight=
[edit] How to disable Help and About Us
See "How to remove the secondary tabs under the main tabs"
[edit] 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.
[edit] 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:
<?php //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.
[edit] 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.
[edit] How to remove a theme
http://forums.vtiger.com/viewtopic.php?p=44922#44922
[edit] 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.)
[edit] 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.
[edit] 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);
[edit] 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.
[edit] How to show "read only" on the screen for a custom field
Consult
- Smarty/templates/DisplayFields.tpl
- include/utils/EditViewUtils.php, function getOutputHtml
[edit] 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 <name> (<name> 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
[edit] How to make Translatable Picklists
The correct change is:
<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label|escape:'quotes'}');" onmouseout="fnhide('crmspanid');"> <span id="dtlview_{$label}">{if $MOD.$keyval}{$MOD.$keyval}{else}{$keyval}{/if}</span>
I changed {$MOD.$keyval} for {if $MOD.$keyval}{$MOD.$keyval}{else}{$keyval}{/if}
Make the same change in DisplayFields.tpl
[edit] 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.
[edit] 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;
}
[edit] 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.
[edit] How to change titles in the chart of Pipeline By Sales Stage
TBS
[edit] How to configure a filter
TBS
[edit] 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'.
[edit] How to change a field length
http://forums.vtiger.com/viewtopic.php?p=43900#43900
[edit] How to change a field label
http://forums.vtiger.com/viewtopic.php?p=43152#43152
[edit] 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.
[edit] 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
[edit] How to customize vtiger Web Forms
See: VTiger Webforms Install Guide
Courtesy: greggster
[edit] 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.
[edit] 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
[edit] How to remove 2 page in invoice
see: How to change the PDF layout
[edit] 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
[edit] How to create a new module or tab in vtiger 5
[edit] 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.
[edit] 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)
[edit] 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.
[edit] How to restrict users from adding new URL/Websites to this module
TBS
[edit] 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.
[edit] 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
[edit] 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:
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="<?php echo $upload_maxsize; ?>">
If it looks like
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
instead, change it to look like above.
[edit] How to change ticket detail in Customer portal
Change modules/HelpDesk/Save.php line 127 to this:
$bodydetails .= "<a href='".$PORTAL_URL."/index.php?action=index&module=Tickets&ticketid=".$focus->id."&fun=detail'>Ticket Details</a>";
[edit] How to handle servers on different timezones
- Open 'index.php'
- Find the code
global $entityDel; global $display;
- Add below it the line
putenv("TZ=US/Eastern");
[edit] 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.
[edit] 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
[edit] How to view 'vtigercrm.log' file WITHOUT having Apache root
TBS
[edit] 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.
[edit] 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)
[edit] 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".
[edit] 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.
[edit] How to change or enable the settings in FCKeditor
http://forums.vtiger.com/viewtopic.php?t=12286&highlight=
[edit] How to set username and password as default
Refer to 5createTables.inc.php, where default values have been handled as "admin".
[edit] 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 be "admin".
NOTE: If you are using vtiger 5.0.4, set the crypt_type field of vtiger_users to blank along with above change.
[edit] How to hide or remove system details from the user
http://forums.vtiger.com/viewtopic.php?p=43441#43441
You remove the display in
- Smarty/templates/SetMenu.tpl
- Smarty/templates/Settings.tpl
[edit] 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:
- 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 <enter> 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.)
[edit] How to call custom fields in a webform
- Create a custom field, say "Loan Purpose", in the Leads module. In my forms, I'll call this "purpose".
- Using phpmyadmin, browse to the table vtiger_leadscf.
- 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.
- The name "cf_453" only needs to be used in webforms.php. For the other files, call it something friendly; I used "loanpurpose".
- 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:
<tr><th>Loan Purpose:</th> <td><select name="loanpurpose"> <option value="Purchase">Purchase</option> <option value="Refi - Rate,Term">Refi - Rate,Term</option> <option value="Refi - Cash-out">Refi - Cash-out</option> <option value="Second">Second</option> <option value="Other">Other</option> </select></td> </tr>
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.
[edit] How to create a query to extract the products from a quote using the quote number
Look in the vtiger_inventoryproductrel table.
[edit] 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).)
[edit] 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';
[edit] 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
[edit] How to view/modify the Edit and Delete links
Code is located in include/utils/ListViewUtils.php Search for LNK_EDIT.
[edit] How to create another sort column in the Contact Tab
http://forums.vtiger.com/viewtopic.php?p=43166#43166
[edit] 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');
[edit] 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.
[edit] How to add/edit a button within the forms
TBS
[edit] 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';
[edit] 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:
- Open a command prompt
- Use the cd command to move to your vtiger root directory (this is the one where the confi.inc.php file is located)
- 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
[edit] How to use .diff patch on Windows
TBS
[edit] How to add New Field On Events
TBS
[edit] 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
[edit] How to reset default (admin) login
If you can get access to the database, try changing the user_password field to teKvqLqm1UZPg and log in using the password 0.
[edit] How to add a new Activity Type or Event Type
See the AddActivityType page.
[edit] 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.
- If your installation is the info_type is already BAS for the solution field (and for all fields with tablename='vtiger_troubletickets').
- The block on which the solution field is has its created view value set to no, so it doesn't appear when you create.
- Change the field vtiger_block.create_view to 0 for blockid 29.
[edit] 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.
[edit] How to have global Tag Clouds as well as user specific Tag Clouds
TBS
[edit] 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.
[edit] 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 </script>:
var soundfile="Notify.wav" //path to sound file, or pass in filename directly into playsound()
function playsound(soundfile){
document.getElementById("soundeffect").innerHTML= "<embed src='"+soundfile+"' hidden=true autostart=true loop=false>";
}
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.
[edit] 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.
- the mailer script
- the format of the mailing list itself
- 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 <<!EOF
Dear $NAME,
<body content here>
!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 <<!EOF 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
[edit] How to move 'Trouble Tickets' to the Account Information Tab
You can set it to single pane view.
[edit] How to find the browser tab image
Located in include/images/vtigercrm_icon.ico
[edit] 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.
[edit] 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.
[edit] 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.
[edit] 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 ''}
<tr>
<td class="cellLabel" align="right" valign="top"><b>{$LABEL.location}</b></td>
<td class="cellInfo" colspan=3 align="left" >{$ACTIVITYDATA.location}</td>
</tr>
{if}
[edit] 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
[edit] 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.
[edit] 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 = '';
[edit] 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 </td> tag:
{elseif $fldname eq emailoptout AND $MODE neq edit}
<td width="30%" align=left class="dvtCellInfo">
<input name="{$fldname}" type="checkbox" tabindex="{$vt_tab}" checked>
</td>
Now, when creating a new contact/account, the checkbox will be selected by default. It's not the optimal solution, but it worked.
[edit] 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/
