Skip to content

Support multiple emails and phone numbers per contact#80

Merged
erwanMarmelab merged 20 commits intomainfrom
multiple-contact-emails
Jan 14, 2025
Merged

Support multiple emails and phone numbers per contact#80
erwanMarmelab merged 20 commits intomainfrom
multiple-contact-emails

Conversation

@slax57
Copy link
Collaborator

@slax57 slax57 commented Jan 9, 2025

Problem

Atomic CRM does not allow to have more than one email per contact. But it is frequent that contacts have multiple emails (work email, personal email, older emails, ...)

Also, it currently only allows to store 2 phone numbers.

Solution

Support having multiple emails and phone numbers per contact.

Todo

  • update DB schema (migration)
  • update the Contact Edit and Show pages
  • update the contact import feature
  • update the contact avatar feature
  • update the full text search feature
  • update the inbound email feature
  • update data generator
  • update documentation
  • make right column larger in ContactEdit
  • add email type
  • concatenate the array into a string in the contacts_summary view, so that we can do ilike search on it
  • same for phone numbers

Tests

  • contact import
  • contact export
  • contact avatar : gravatar
  • contact avatar : favicon
  • contact show
  • contact edit
  • full text search in email
  • data generation
  • inbound email
  • migrating an existing database
  • test fts with fakerest

Additional Checks

Also, please make sure to read the contributing guidelines.

Screenshots

2025-01-13_16-39

@slax57 slax57 added the WIP label Jan 9, 2025
@slax57 slax57 added RFR and removed WIP labels Jan 13, 2025
@slax57 slax57 changed the title Support multiple emails per contact Support multiple emails and phone numbers per contact Jan 13, 2025
@slax57 slax57 added WIP and removed RFR labels Jan 13, 2025
@slax57 slax57 added RFR and removed WIP labels Jan 13, 2025
Comment on lines +55 to +67
<Box>
<EmailField source="email" />{' '}
<WithRecord
render={row =>
row.type !== 'Other' && (
<TextField
source="type"
color="textSecondary"
/>
)
}
/>
</Box>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use flexbox instead of a space? This ensure better compatibility with custom themes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +97 to +109
<Box>
<TextField source="number" />{' '}
<WithRecord
render={row =>
row.type !== 'Other' && (
<TextField
source="type"
color="textSecondary"
/>
)
}
/>
)}
</Box>
</Stack>
)}
</Box>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +170 to +174
choices={[
{ id: 'Work' },
{ id: 'Home' },
{ id: 'Other' },
]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extract the choices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

## Additional Checks

- [ ] The **documentation** is up to date
- [ ] Tested with **fakerest** provider (see [related documentation](../doc/data-providers.md))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link still open a "Not found" page

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Should be fixed

);
};

const personalInfoTypes = [{ id: 'Work' }, { id: 'Home' }, { id: 'Other' }];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, all our choices inputs accept an array of strings since 5.1.0 (marmelab/react-admin#10038)

@djhi djhi requested a review from erwanMarmelab January 14, 2025 13:00
@erwanMarmelab erwanMarmelab merged commit 7cd356e into main Jan 14, 2025
@erwanMarmelab erwanMarmelab deleted the multiple-contact-emails branch January 14, 2025 13:02
Dballzall pushed a commit to Dballzall/media_crm that referenced this pull request May 1, 2025
Support multiple emails and phone numbers per contact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants