Organizations: The contact displayed in emails of the Organizations History subpanel does not belong to the organization #4688

Open
opened 2026-02-20 16:22:04 -05:00 by deekerman · 0 comments
Owner

Originally created by @SinergiaCRM on GitHub (Jan 19, 2022).

Issue

An organization's History subpanel displays emails sent to people related to the organization.

In those emails that come from a campaign, in the contact column, only one of the contacts that has received the email is shown and there are times when this contact does not belong to the organization. This is because there are people who have received the marketing email that is not from the organization and depends on the list of contacts that the query returns

Expected Behavior

Always show a contact belonging to the organization in the contact column

Actual Behavior

En algunos emails se muestra un contacto que no pertenece a la organización

Possible Fix

A possible solution would be to modify the query that returns the contacts.:

Adding in modules/Emails/Email.php, in the function fill_in_additional_detail_fields () the next code:

After

$query = "SELECT contacts.first_name, contacts.last_name, contacts.phone_work, contacts.id, contacts.assigned_user_id contact_name_owner, 'Contacts' contact_name_mod FROM contacts, emails_beans ";

add:

if (!empty($this->status) && $_REQUEST['module'] == "Accounts" && $_REQUEST['action'] == "DetailView") {
    $query .= ", accounts_contacts " ;
}

and before:

$result = $this->db->query($query, true, " Error filling in additional detail fields: ");

add:

if (!empty($this->status) && $_REQUEST['module'] == "Accounts" && $_REQUEST['action'] == "DetailView") {
    $query .= " AND contacts.id = accounts_contacts.contact_id AND account_id = '" . $_REQUEST['record'] . "' ";
    $query .= " ORDER BY contacts.id ASC";
}

Although in the code we see that there are several calls to that function and perhaps it would be advisable to pass a parameter to the function to identify the context and add the code only when it is displaying an email in the History subpanel of an organization.

Steps to Reproduce

  1. Create an organization and a contact from your contacts subpanel.
  2. Create other contacts who do not belong to the organization.
  3. Create a LPO and introduce tje contacts. Add the contact that belongs to the organization in the middle, that is, neither the first nor the last in the LPO
  4. Sending a Marketing email to the LPO
  5. Check in the Detail view of the organization that the contact shown in the email that appears in the history sub-panel does not belong to the organization

Context

The information displayed in the subpanel is wrong

Your Environment

SuiteCRM Version used: Version 7.11.15
Browser name and version: Chrome Versión 97.0.4692.71 (Build oficial) (64 bits)
Environment name and version: MySQL, PHP 7
Operating System and version: Ubuntu 18.04

Originally created by @SinergiaCRM on GitHub (Jan 19, 2022). #### Issue An organization's History subpanel displays emails sent to people related to the organization. In those emails that come from a campaign, in the contact column, only one of the contacts that has received the email is shown and there are times when this contact does not belong to the organization. This is because there are people who have received the marketing email that is not from the organization and depends on the list of contacts that the query returns #### Expected Behavior Always show a contact belonging to the organization in the contact column #### Actual Behavior En algunos emails se muestra un contacto que no pertenece a la organización #### Possible Fix A possible solution would be to modify the query that returns the contacts.: Adding in `modules/Emails/Email.php`, in the function `fill_in_additional_detail_fields ()` the next code: After ``` $query = "SELECT contacts.first_name, contacts.last_name, contacts.phone_work, contacts.id, contacts.assigned_user_id contact_name_owner, 'Contacts' contact_name_mod FROM contacts, emails_beans "; ``` add: ``` if (!empty($this->status) && $_REQUEST['module'] == "Accounts" && $_REQUEST['action'] == "DetailView") { $query .= ", accounts_contacts " ; } ``` and before: ``` $result = $this->db->query($query, true, " Error filling in additional detail fields: "); ``` add: ``` if (!empty($this->status) && $_REQUEST['module'] == "Accounts" && $_REQUEST['action'] == "DetailView") { $query .= " AND contacts.id = accounts_contacts.contact_id AND account_id = '" . $_REQUEST['record'] . "' "; $query .= " ORDER BY contacts.id ASC"; } ``` Although in the code we see that there are several calls to that function and perhaps it would be advisable to pass a parameter to the function to identify the context and add the code only when it is displaying an email in the History subpanel of an organization. #### Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug include code to reproduce, if relevant --> 1. Create an organization and a contact from your contacts subpanel. 2. Create other contacts who do not belong to the organization. 3. Create a LPO and introduce tje contacts. Add the contact that belongs to the organization in the middle, that is, neither the first nor the last in the LPO 4. Sending a Marketing email to the LPO 5. Check in the Detail view of the organization that the contact shown in the email that appears in the history sub-panel does not belong to the organization #### Context The information displayed in the subpanel is wrong #### Your Environment SuiteCRM Version used: Version 7.11.15 Browser name and version: Chrome Versión 97.0.4692.71 (Build oficial) (64 bits) Environment name and version: MySQL, PHP 7 Operating System and version: Ubuntu 18.04
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#4688
No description provided.