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

Send Review sendreview at gmail.com
Sat Jun 21 14:49:27 GMT 2014


Hello,

Thanks for the kind reply. However, this example shows how to create a new
field for a new new block in a new module.

What I am looking for, is to create a new field in existing user module so
that I have new parameter in the "My preference" user option. In other
words, I am not creating a new module and forces the new block and field to
the existing user module:

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


I wonder if this is good practice.

Secondly, since I am not creating a new module instance, it will not appear
in the module manager. So that means it will not be exportable. I wonder
what should be the approach.

I looked pretty much around the web for example of module extension (not
how to create a new module) but could not find any literature.

Thanks, Joel



Message: 1
Date: Sat, 21 Jun 2014 09:53:04 +0530
From: lajeesh k <lajeeshk at gmail.com>
To: vtigercrm-developers <vtigercrm-developers at lists.vtigercrm.com>
Subject: Re: [Vtigercrm-developers] Creating a module extension for
        ver 5.4
Message-ID:
        <CAA1bLmpB4uTuZ0nJtvJ2NVdfXcvooGSJvRkPJexnhtMJTrqwkg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Follow the following sample for creating new field,


<?php
$Vtiger_Utils_Log = true;
require_once('vtlib/Vtiger/Module.php');
require_once('vtlib/Vtiger/Block.php');
require_once('vtlib/Vtiger/Field.php');

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

if($module)
{
    $block    =
Vtiger_Block::getInstance('LBL_PROJECT_INFORMATION',$module);

    if($block)
    {
        $field = Vtiger_Field::getInstance('hours',$module);
        if(!$field)
        {
            $field = new Vtiger_Field();
            $field->name = 'hours';
            $field->table = 'vtiger_project';
            $field->label = 'Hours';
            $field->column = 'hours';
            $field->columntype = 'VARCHAR(40)';
            $field->uitype = 7;
            $field->displaytype = 2;
            $field->typeofdata = 'V~O';
            $block->addField($field);
        }
    }
    else
    {
        echo "No block";
    }
}
else
{
    echo "No module";
}



?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140621/760977da/attachment.html>


More information about the vtigercrm-developers mailing list