[Vtigercrm-developers] extends Contacts class - new relations

Angelo Paglialonga info at angelopaglialonga.com
Fri Jun 18 19:39:05 GMT 2021


Hi Omri, 
you could follow two paths: the ugly one, in which you modify /modules/contacts/contacts.php adding your get_vulnorg_list there.

The more polite one in which you use a js file to make an ajax call to get your records to the file containing get_vulnorg_list.

I hope one of those solutions  suits your case.

Angelo
_______________

Angelo Paglialonga
Consulente per soluzioni CRM ad alto ROI.

Telefono: 3386077866
Skype: angelo.paglialonga
Web: https://www.angelopaglialonga.com



> Il giorno 17 giu 2021, alle ore 20:56, omri yona <omri.yona at gmail.com> ha scritto:
> 
> Alan First thank you for your answer
> But I think I didn't explain my self good, my problem is that I build a relation that similar to get_related_list using
> using $contactsModule->setRelatedList($VulnOrgModule, "VulnOrg", "","get_vulnorg_list");
> 
> I can't use the basic get_related_list function because I saved the relation in different table because it doesn't want vtiger_crmentityrel table   to be too big
> and this relation has a lot of relations (similar to emails).
> 
> Thank you again for your help
> 
> 
> n Thu, Jun 17, 2021, 13:22 Alan Lord (News) [via vtiger CRM] <no-reply at nabble.com <mailto:no-reply at nabble.com>> wrote:
> I presume you have created a UIType 10 field in your custom module for a 
> Contact reference? 
> 
> e.g.: 
> $module = Vtiger_Module::getInstance('vulOrg'); 
> $block = Vtiger_Block::getInstance('vulOrg Information', $module); 
> 
> $field = Vtiger_Field::getInstance('contact_id', $module); 
> if ($field != false) { 
>      $field->unsetRelatedModules(array('Contacts')); 
>      $field->delete(); 
> } 
> $field = new Vtiger_Field(); 
> $field->name = 'contact_id'; 
> $field->label = 'Contact'; 
> $field->column = $field->name; 
> $field->columntype = 'INT(11)'; 
> $field->uitype = 10; 
> $field->typeofdata = 'V~O'; 
> $field->summaryfield = 1; 
> $field->masseditable = 0; 
> $block->addField($field); 
> $field->setRelatedModules(array('Contacts')); 
> 
> Then you _should_ be able to use the standard method to create the 
> relatedList in the Contact module. e.g.: 
> 
> $contacts = Vtiger_Module::getInstance('Contacts'); 
> 
> $field = Vtiger_Field::getInstance('contact_id', $module); 
> $contacts->unsetRelatedList($module, 'vulOrg', 'get_dependents_list'); 
> $contacts->setRelatedList($module, 'vulOrg', array('ADD'), 
> 'get_dependents_list', $field->id); 
> 
> Something like that should do it. 
> 
> This was from memory so might need tweaking. 
> 
> Al 
> 
> On 17/06/2021 11:05, omri yona wrote:
> 
> > Hello all, 
> > 
> > I try to do something without changing the vtiger core. Maybe you have 
> > any idea. 
> > My case: 
> > I have a custom module (module name: vulOrg)  with  a relations to the 
> > contacts module so now in the Contacts module I have a new tab to my 
> > custom module. 
> > To support this tab I need to change the contacts core file 
> > (modules/Contacts/Contacts.php) 
> > 1. set new function get_vulorg (like get_emails...) to find my relations 
> > record (can't use the     basic get_related_list or get_dependents_list 
> > function) 
> > 2. add flow in unlinkRelationship function 
> > 
> > I manage to do what I want by changing the core file, but I don't like 
> > core changes. 
> > 
> > I would love to get any ideas on how to do it without changing the core. 
> > 
> > Thank you for your help, 
> > Omri 
> > 
> > 
> > 
> > _______________________________________________ 
> > http://www.vtiger.com/ <http://www.vtiger.com/>
> >
> _______________________________________________ 
> http://www.vtiger.com/ <http://www.vtiger.com/> 
> 
> http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-extends-Contacts-class-new-relations-tp24300p24301.html <http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-extends-Contacts-class-new-relations-tp24300p24301.html>
> To unsubscribe from vtiger CRM, click here <http://vtiger-crm.2324883.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=b21yaS55b25hQGdtYWlsLmNvbXwyfC0xODc1MjMxMzE5>.
> NAML <http://vtiger-crm.2324883.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>_______________________________________________
> http://www.vtiger.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20210618/fcd01b6b/attachment.html>


More information about the vtigercrm-developers mailing list