[Vtigercrm-developers] Dynamically update "$tab_name" & "$tab_name_index"?

Alan Lord alanslists at gmail.com
Wed Sep 23 12:09:10 GMT 2015


I'm thinking about ways to add a field to any entity module which 
displays a value from the libertus_geotools geocoder database...

For example if the Administrator clicked a button to add this field the 
vtlib code would be something like this:

> $field = new Vtiger_Field();

> $field->name = 'lsisgeocoded';

> $field->column = 'lat';
 > $field->table = 'libertus_geotools';
> $field->label = 'Geocoded';

> $field->columntype = 'VARCHAR(3)';

> $field->uitype = 56;

> $field->typeofdata = 'C~O';
> $field->displaytype = 2;

> $block->addField($field);

Basically a simple read-only checkbox.

But of course, I need to inform the query generator that it now needs to 
add a LEFT JOIN ON libertus_geotools.crmid to be able to retrieve the 
data from the "lat" column.

As far as I can tell this is only done in the module's class file using 
the two vars mentioned in the subject.

Is there another way I could achieve this? I want the Administrator to 
be able to add or remove this field on any of their modules as they 
wish. I want them to be able to use this value to be able to find 
records that are either geocoded, or not, using any of their existing, 
or newly created filters.

I _know_ I could do this by adding a new field and column to the module 
itself and then keep the value updated using an Event Handler or 
something but I was just wondering if I could this a bit more efficiently?

TIA

Al




More information about the vtigercrm-developers mailing list