[Vtigercrm-developers] Relationship between Projects and Accounts

Alan Lord (News) alanslists at gmail.com
Wed Mar 20 07:26:50 UTC 2013


On 20/03/13 04:31, Juan Pablo Botero wrote:
> Richards, thanks for answer.; i think that is the way.
> But it seems to work with a new modules, the modules that already exist,
> what file can i edit?

You just need to create your vtlib script in the same way as you do for 
a new module.

As an example here would be a vtlib script to add a new field to the 
Accounts module (the nice thing doing it this way is it means no cf_xxx 
fields and tables - and you can do anything the vtlib API supports):


> <?php
> // Turn on debugging level
> $Vtiger_Utils_Log = true;
> include_once('vtlib/Vtiger/Menu.php');
> include_once('vtlib/Vtiger/Module.php');
> include_once('F1k_Extensions/libs.php');
>
> // Get a handle to the accounts module
> $module = Vtiger_Module::getInstance('Accounts');
>
> // Get our custom block
>
> $block_custom = Vtiger_Block::getInstance('Custom Information', $module);
>
> // Add the field to hold IP Addresses
>
> // Remove if already exiting
> $field_ipadds = Vtiger_Field::getInstance('ipadds', $module);
>
> if ($field_ipadds != false) {
>
> 	$field_ipadds->delete();
>
> }
>
> $field_ipadds = new Vtiger_Field();
>
> $field_ipadds->name = 'ipadds';
>
> $field_ipadds->label= 'IP Addresses';
>
> $field_ipadds->column = 'ipadds';
>
> $field_ipadds->columntype = 'TEXT';
>
> $field_ipadds->uitype = 21;
>
> $field_ipadds->typeofdata = 'V~O';
>
> $block_custom->addField($field_ipadds);
>
> ?>

HTH

Al

-- 
Libertus Solutions
http://www.libertus.co.uk



More information about the vtigercrm-developers mailing list