Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
b11c5f58
Commit
b11c5f58
authored
Jul 16, 2024
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_crm: do not list twice a same user when ingesting an email
parent
78f80ad2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Base_getEntityListFromFromHeader.py
...portal_skins/erp5_crm/Base_getEntityListFromFromHeader.py
+4
-4
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
...m/TestTemplateItem/portal_components/test.erp5.testCRM.py
+6
-3
No files found.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Base_getEntityListFromFromHeader.py
View file @
b11c5f58
...
...
@@ -2,12 +2,12 @@ getResultValue = context.portal_catalog.getResultValue
from
Products.ERP5Type.Utils
import
Email_parseAddressHeader
result
=
[]
for
_
,
recipient
in
Email_parseAddressHeader
(
text
):
result
=
set
()
for
_
,
recipient
in
set
(
Email_parseAddressHeader
(
text
)
):
if
recipient
:
email
=
getResultValue
(
url_string
=
{
'query'
:
recipient
,
'key'
:
'ExactMatch'
},
portal_type
=
'Email'
,
parent_portal_type
=
'Person'
)
if
email
is
None
:
email
=
getResultValue
(
url_string
=
{
'query'
:
recipient
,
'key'
:
'ExactMatch'
},
portal_type
=
'Email'
,
parent_portal_type
=
'Organisation'
)
if
email
is
not
None
:
result
.
a
ppen
d
(
email
.
getParentValue
())
return
result
result
.
a
d
d
(
email
.
getParentValue
())
return
list
(
result
)
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
View file @
b11c5f58
...
...
@@ -735,6 +735,8 @@ class TestCRMMailIngestion(BaseTestCRM):
(
'me@erp5.org'
,
[
'person_module/me'
]),
(
'me@erp5.org, he@erp5.org'
,
[
'person_module/me'
,
'person_module/he'
]),
(
'Sender <sender@customer.com>'
,
[
'person_module/sender'
]),
# title is also an email, it should return the person once, not twice
(
'sender@customer.com <sender@customer.com>'
,
[
'person_module/sender'
]),
# tricks to confuse the e-mail parser:
# a comma in the name
(
'"Sender," <sender@customer.com>, he@erp5.org'
,
[
'person_module/sender'
,
...
...
@@ -750,9 +752,10 @@ class TestCRMMailIngestion(BaseTestCRM):
for
header
,
expected_paths
in
expected_values
:
paths
=
[
entity
.
getRelativeUrl
()
for
entity
in
portal
.
Base_getEntityListFromFromHeader
(
header
)]
self
.
assertEqual
(
paths
,
expected_paths
,
'%r should return %r, but returned %r'
%
(
header
,
expected_paths
,
paths
))
self
.
assertEqual
(
sorted
(
paths
),
sorted
(
expected_paths
),
'%r should return %r, but returned %r'
%
(
header
,
expected_paths
,
paths
)
)
def
test_document_creation
(
self
):
# CRM email ingestion creates a Mail Message in event_module
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment