[Vtigercrm-developers] Creating a custom field that is a link to an another table row - vtiger 5.0.4

Hardev Bassan Hardev.Bassan at warwick.ac.uk
Thu Mar 26 04:44:10 PDT 2009


Steve,



I did manage to create a link in the accounts to a contact - See the step-by-step guide below. I had hoped the vtiger development community to be more forth coming with suggestions but it wasn't the case. I thank you for trying to help.



Regards





Adding Link to Primary Contacts in Accounts

Install the vtlib-2.1.

Create a file call vtlib.pc.php in the vtigercrm directory with content



<?php

// Just a bit of HTML formatting

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';



echo '<html><head><title>vtlib Module Script</title>';

echo '<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>';

echo '</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px;">';

echo '<a href="index.php"><img src="themes/softed/images/vtiger-crm.gif" alt="vtiger CRM" title="vtiger CRM" border=0></a><hr style="height: 1px">';



// Turn on debugging level

$Vtiger_Utils_Log = true;



include_once('vtlib/Vtiger/Menu.php');

include_once('vtlib/Vtiger/Module.php');



// Create module instance and save it first

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





// Add a new module block - I don't know how to attach to an existing module block

$block1 = new Vtiger_Block();

$block1->label = 'LBL_PC_INFORMATION';

$module->addBlock($block1);



$field4 = new Vtiger_Field();

$field4->name = 'LinkToPC';

$field4->label= 'Link To PC';

$field4->table = 'vtiger_account';

$field4->column = 'linktopc';

$field4->columntype = 'VARCHAR(100)';

$field4->uitype = 10;

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

$field4->helpinfo = 'Primary Contact';

$block1->addField($field4);

$field4->setRelatedModules(Array('Contacts'));



# Add the following to the Accounts language file

#'LinkToPC' => 'Link to Primary Contact',

#'Link To PC' => 'Link To Primary Contact',

#'LBL_PC_INFORMATION' => 'Extra Information',





echo '</body></html>';



?>

________________________________
From: vtigercrm-developers-bounces at lists.vtigercrm.com [vtigercrm-developers-bounces at lists.vtigercrm.com] On Behalf Of Stephen Mack [stephen at efronteras.com]
Sent: 05 March 2009 15:06
To: vtigercrm-developers at lists.vtigercrm.com
Subject: Re: [Vtigercrm-developers] Creating a custom field that is a link to an another table row - vtiger 5.0.4

It sounds like your businesses' use of the system is very different than most users.  That does not make it wrong just different.

I'm sure it can be done but you'll have to review the code to see how records are attached as in the potential module which has the same setup as you describe for the associated "account".

So the basics are there for what you want.  You'll need to do some custom coding.  I don't think the system is inefficient.  I think your use is different.

-- Stephen Mack
Gerente de Ventas y Marketing
Escuela Fronteras
www.eFronteras.com<http://www.eFronteras.com>
skype: eFronteras.Stephen


On Thu, Mar 5, 2009 at 11:39 AM, Hardev Bassan <Hardev.Bassan at warwick.ac.uk<mailto:Hardev.Bassan at warwick.ac.uk>> wrote:
The same contact can be the 'Primary Contact' for one Account and not for another Account.

This means that you will have to create 2 contact (one with label 'Primary Contact' and another without 'Primary Contacts' - also may require extra browsing action) - again not very elegant way of designing a database system.

Hardev
________________________________
From: vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com> [vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com>] On Behalf Of Stephen Mack [stephen at efronteras.com<mailto:stephen at efronteras.com>]
Sent: 05 March 2009 13:55

To: vtigercrm-developers at lists.vtigercrm.com<mailto:vtigercrm-developers at lists.vtigercrm.com>
Subject: Re: [Vtigercrm-developers] Creating a custom field that is a link to an another table row - vtiger 5.0.4

I created a custom picklist field in the contacts database to describe the contact, then you can list that field in the contacts view.

-- Stephen Mack
Gerente de Ventas y Marketing
Escuela Fronteras
www.eFronteras.com<http://www.eFronteras.com>
skype: eFronteras.Stephen


On Thu, Mar 5, 2009 at 10:05 AM, Hardev Bassan <Hardev.Bassan at warwick.ac.uk<mailto:Hardev.Bassan at warwick.ac.uk>> wrote:
Stephen,


Contact Section - can have 1 or more contacts.

I need a field that will only allow one name - as there is only Primary Contact per Account our for setup.

Regards
Hardev
________________________________
From: vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com> [vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com>] On Behalf Of Stephen Mack [stephen at efronteras.com<mailto:stephen at efronteras.com>]
Sent: 05 March 2009 12:08
To: vtigercrm-developers at lists.vtigercrm.com<mailto:vtigercrm-developers at lists.vtigercrm.com>
Subject: Re: [Vtigercrm-developers] Creating a custom field that is a link to an another table row - vtiger 5.0.4

Is there a reason you don't want to use the "contact section" on the more information tab?

-- Stephen Mack
Gerente de Ventas y Marketing
Escuela Fronteras
www.eFronteras.com<http://www.eFronteras.com>
skype: eFronteras.Stephen


On Thu, Mar 5, 2009 at 8:02 AM, Hardev Bassan <Hardev.Bassan at warwick.ac.uk<mailto:Hardev.Bassan at warwick.ac.uk>> wrote:
All,

I would like to create a custom field for the 'Accounts' form - see attached, that is a link to a 'Contact' instead of just a text string.

Is this easily possible (how?)  or a no goer.

The NOT very elegant way is to create a URL custom field and paste the  url in the field.


Regards
Hardev
_______________________________________________
Reach hundreds of potential candidates - http://jobs.vtiger.com


_______________________________________________
Reach hundreds of potential candidates - http://jobs.vtiger.com


_______________________________________________
Reach hundreds of potential candidates - http://jobs.vtiger.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20090326/96868eb8/attachment-0003.html 


More information about the vtigercrm-developers mailing list