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

Send Review sendreview at gmail.com
Fri Jun 20 18:54:06 GMT 2014


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.

<?php
> include_once('vtlib/Vtiger/Module.php');
> $module = new Vtiger_Module();
> $module->name = 'Users';
> $module->id = 29;
> $module->save();
> // Initialize all the tables required
> $module->initTables();
> // 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->table = $module->basetable;
> $field1->column = 'rail1';
> $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);
> ?>
>

By forcing

$module->name = 'Users';
> $module->id = 29;


the modification will occur on the vtiger_users table, which is what I am
trying to do.

Questions:
- is this the proper way to extend a module like users?
- the modification is not extracted via the module manager. So that means I
cannot distribute this user table change.

What should be the right approach?

Thanks, Joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140620/0b5e0543/attachment.html>


More information about the vtigercrm-developers mailing list