[Vtigercrm-developers] Creating a module extension for ver 5.4

Alan Lord (News) alanslists at gmail.com
Sat Jun 21 16:29:25 GMT 2014



On 20/06/14 19:54, Send Review wrote:
> Hello,
>
> I am trying to add parameters in the "my preferences", that could be
> used in order to activate/deactivate customizations.
>
>  From my understanding, this is best done with a module extension. So I
> created the bootstrap code to be run in order to modify the database.

You can extend existing modules or create an "extension" module. They 
are not the same thing.

 From what you describe you just need to Extend the Users module...

>     <?php
>     include_once('vtlib/Vtiger/Module.php');
>     $module = new Vtiger_Module();// Wrong! You are not creating a new module - you only need to get a 
handle on the Users module.

So instead *just* do

$module = Vtiger_Module::getInstance('Users');

>     // Add the basic module block
>     $block1 = new Vtiger_Block();
>     $block1->label = 'Personal Config';
>     $module->addBlock($block1);
>     /** Create required fields and add to the block */
>     $field1 = new Vtiger_Field();
>     $field1->name = 'rail1';
>     $field1->column = $field1->name; // Easier to keep these the same!
>     $field1->label = 'Activity rail1';
>     $field1->columntype = 'VARCHAR(255)';
>     $field1->uitype = 33;
>     $field1->typeofdata = 'V~M';
>     $field1->setPicklistValues( Array ('rail', 'Todo') );
>     $field1->defaultvalue ='rail';
>     $block1->addField($field1);

The rest looks fine.

HTH

Al



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



More information about the vtigercrm-developers mailing list