Error getting Potentials related to a Contact
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:
- In the Edit form, selecting one Contact
- In the relation list view, selecting as many Contacts you want
How to reproduce the bug:
- Create a Potential (P) connecting a Contact (C1) in the Edit form. Save
- Add a second Contact (C2) in the related list
- Add a comment to P
- Open C1 and toggle Roll up on - you don't see P's comment
- Open C2 and toggle Roll up on - you see P's comment
- 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)