Not all emails showing in account emails tab
If an email is sent to several contacts from the same account then the email shows correctly under each contact but only one email (sent to one of the contacts) shows under the emails tab of the account.
After some investigation I found that the account emails query generated by getEntries in modules/Vtiger/models/RelationListView.php correctly returns several times the email send to multiple contacts (with several distinct parent_id for the distinct contacts the email was sent to).
However after executing the sql query, getEntries goes on creating $relatedRecordList indexing it on $crmid (identifying the email) and therefore only includes the email once instead of the several times as per the query.
Also the function getRelatedEntriesCount in the same file generate a query that counts the emails based on 'distinct' crmid and therefore returns only one count for an email sent to multiple contacts from the same account.
This leads to Vtiger users being confused about the emails tab of the accounts as it seems that some contacts of the account were not sent the email.
How could this case be dealt with without too much changes to the code?
Thanks
Frederic