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

Vic Cekvenich vic.cvc at gmx.com
Sun Aug 17 18:56:22 GMT 2014



-------- Original Message --------
Subject: Re: [Vtigercrm-developers] Creating a module extension for ver 5.4
Date: Sat, 21 Jun 2014 17:29:25 +0100
From: Alan Lord (News) <alanslists at gmail.com>
Reply-To: vtigercrm-developers at lists.vtigercrm.com
To: public-vtigercrm-developers-bEj6vJcGsH8cQDxxcAYjIUEOCMrvLtNR at plane.gmane.org



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

_______________________________________________
http://www.vtiger.com/



More information about the vtigercrm-developers mailing list