[Vtigercrm-developers] FW: Relationship between Projects and Accounts

Mihai Oprea mihai.oprea at sphs.ro
Mon Jul 8 09:28:56 UTC 2013


Hello,

Can you please provide some instructions on how to delete a relation froma custom module. I know how to add relations from other modules but I don't know how to remove them if I don't need them, and I don't want to erase the whole module.

I tried to use the unset function like this:

$moduleInstance->unsetRelatedList($accountsModule, $relationLabel, Array('ADD','SELECT'));

I get the following output: "Unsetting relation with Accounts ... DONE" but nothing happens in my module.

Thank you!

----
Mihai Oprea
IT Specialist
mihai.oprea at sphs.ro<mailto:mihai.oprea at sphs.ro>

From: vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com> [mailto:vtigercrm-developers-bounces at lists.vtigercrm.com] On Behalf Of Juan Pablo Botero
Sent: 22 martie 2013 15:59
To: vtigercrm-developers at lists.vtigercrm.com<mailto:vtigercrm-developers at lists.vtigercrm.com>
Subject: Re: [Vtigercrm-developers] Relationship between Projects and Accounts

That works pretty cool.
Thanks for your help

2013/3/21 Juan Pablo Botero <juanpabloboterolopez at gmail.com<mailto:juanpabloboterolopez at gmail.com>>
Thanks Richard and Alan.

We think that is the way to add the relationship, gonna apply and tell the results.

2013/3/20 Alan Lord (News) <alanslists at gmail.com<mailto:alanslists at gmail.com>>

On 20/03/13 04:31, Juan Pablo Botero wrote:
Richards, thanks for answer.; i think that is the way.
But it seems to work with a new modules, the modules that already exist,
what file can i edit?

You just need to create your vtlib script in the same way as you do for a new module.

As an example here would be a vtlib script to add a new field to the Accounts module (the nice thing doing it this way is it means no cf_xxx fields and tables - and you can do anything the vtlib API supports):
<?php
// Turn on debugging level
$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
include_once('F1k_Extensions/libs.php');

// Get a handle to the accounts module
$module = Vtiger_Module::getInstance('Accounts');

// Get our custom block

$block_custom = Vtiger_Block::getInstance('Custom Information', $module);

// Add the field to hold IP Addresses

// Remove if already exiting
$field_ipadds = Vtiger_Field::getInstance('ipadds', $module);

if ($field_ipadds != false) {

        $field_ipadds->delete();

}

$field_ipadds = new Vtiger_Field();

$field_ipadds->name = 'ipadds';

$field_ipadds->label= 'IP Addresses';

$field_ipadds->column = 'ipadds';

$field_ipadds->columntype = 'TEXT';

$field_ipadds->uitype = 21;

$field_ipadds->typeofdata = 'V~O';

$block_custom->addField($field_ipadds);

?>

HTH

Al

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

_______________________________________________
http://www.vtiger.com/



--
Cordialmente:
Juan Pablo Botero
Administrador de Sistemas informáticos
Fedora Ambassador for Colombia
http://www.jpilldev.net



--
Cordialmente:
Juan Pablo Botero
Administrador de Sistemas informáticos
Fedora Ambassador for Colombia
http://www.jpilldev.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20130708/29441a24/attachment.html>


More information about the vtigercrm-developers mailing list