[Vtigercrm-developers] Error getting Potentials related to a Contact

Vincenzo Bruno v.bruno at vinsoft.it
Fri Dec 23 15:00:41 GMT 2022


Hi folks,

There is "strange relationship" between Contacts and Potetials. It's 
actually a dual relationship that is treated as a special case 
throughout the code.

Potentials has a field for the related Contact: vtiger_potential.contact_id

But also there is a dedicated relation table: vtiger_contpotentialrel

So, we have 2 ways to connect a Contact to Potentials:

 1. In the Edit form, selecting one Contact. In this case the contact id
    is saved as field in vtiger_potential table, and shown in the
    relation list with a trick
 2. In the relation list view, selecting as many Contacts you want (data
    saved in vtiger_contpotentialrel)

How to reproduce the bug:

 1. Create a Potential (P) connecting a Contact (C1) in the Edit form. Save
 2. Add a second Contact (C2) in the related list
 3. Add a comment to P
 4. Open C1 and toggle Roll up on - you don't see P's comment
 5. Open C2 and toggle Roll up on - you see P's comment
 6. Bonus track: unlink C1 from P's related contacts list. Link it
    again. You will see P's comment in C1 Roll up.

The error is in the |public function getRelatedModuleRecordIds| in 
|modules/Vtiger/models/Module.php|

I'm providing a patch for it.

It's funny I checked VT 7.1.0 and the bug was reversed: you see comment 
at point 4. and not at 5 (looking ad diff between the two versions of 
file is clear why)


I opened a Issue and pushed a commit + merge request

https://code.vtiger.com/vtiger/vtigercrm/issues/1749

Have a nice day

Vincenzo

-- 

Vincenzo Bruno (cell. 328-7252923)
Coopyleft (www.vinsoft.it/coopyleft)
Digital Polis (www.digitalpolis.it)
Hacklab Cosenza (www.hlcs.it)
     
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20221223/c547bba7/attachment.html>


More information about the vtigercrm-developers mailing list