Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/dev/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
orocrmdeployer committed Jan 24, 2018
2 parents b4b03a1 + 3a43c81 commit a95ce86
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Oro/Bundle/SalesBundle/Entity/Opportunity.php
Expand Up @@ -893,7 +893,12 @@ public function getEmail()
return null;
}

return $contact->getEmail();
$contactFullName = $contact->__toString();
$contactEmail = $contact->getEmail();

return $contactFullName && $contactEmail
? "\"{$contactFullName}\" <{$contactEmail}>"
: $contactEmail;
}

public function __toString()
Expand Down
@@ -0,0 +1,65 @@
Oro\Bundle\ContactBundle\Entity\ContactEmail:
contact-email-1:
email: contactEmail1@example.com
primary: true
contact-email-2:
email: contactEmail2@example.com
primary: true

Oro\Bundle\ContactBundle\Entity\Contact:
contact-w-name-email:
firstName: 'test Contact'
lastName: 'with Email'
emails: ['@contact-email-1']
owner: '@admin'
organization: '@organization'
createdAt: <dateTimeBetween('now', 'now')>
contact-wo-name:
emails: ['@contact-email-2']
owner: '@admin'
organization: '@organization'
createdAt: <dateTimeBetween('now', 'now')>
contact-wo-email:
firstName: 'test Contact'
lastName: 'without Email'
owner: '@admin'
organization: '@organization'
createdAt: <dateTimeBetween('now', 'now')>

Oro\Bundle\AccountBundle\Entity\Account:
account-1:
name: 'test Account'
owner: '@admin'
organization: '@organization'

Oro\Bundle\SalesBundle\Entity\Customer:
customer-1:
account: '@account-1'

Oro\Bundle\SalesBundle\Entity\Opportunity:
opportunity-wo-contact:
name: 'opportunity wo contact'
customerAssociation: '@customer-1'
organization: '@organization'
owner: '@admin'

opportunity-w-contact:
name: 'opportunity w contact name and email'
customerAssociation: '@customer-1'
contact: '@contact-w-name-email'
organization: '@organization'
owner: '@admin'

opportunity-w-contact-no-name:
name: 'opportunity w contact no name'
customerAssociation: '@customer-1'
contact: '@contact-wo-name'
organization: '@organization'
owner: '@admin'

opportunity-w-contact-no-email:
name: 'opportunity w contact no email'
customerAssociation: '@customer-1'
contact: '@contact-wo-email'
organization: '@organization'
owner: '@admin'
@@ -0,0 +1,61 @@
@ticket-CRM-8723
@fixture-OroSalesBundle:opportunity_send_email_action.yml

Feature: Opportunity send email action
As administrator
I need to have ability to send email to contact assigned to opportunity
Customer email address title should be taken from contact
In case contact do not has `NamePrefix` && `FirstName` && `MiddleName` && `LastName` && `NameSuffix` title should be
created from opportunity record

Scenario: Checks opportunities grid
Given I login as administrator
And I go to Sales/ Opportunities
And I should see following grid:
| Opportunity name |
| opportunity w contact no email |
| opportunity w contact no name |
| opportunity w contact name and email |
| opportunity wo contact |

Scenario: Check opportunity contact that has only name, "Send Email" dialog should have empty field "To"
Given I click view opportunity w contact no email in grid
And I follow "More actions"
And press "Send email"
Then "Email Form" must contains values:
| From | "John Doe" <admin@example.com> |
When I press "Send"
Then I should see "Email Form" validation errors:
| ToField | This value contains not valid email address. |
| Subject | This value should not be blank. |
And I close ui dialog

Scenario: Check opportunity contact that has only email address, "Send Email" dialog should have field "To" containing opportunity title and contact email
And I click view opportunity w contact no name in grid
And I follow "More actions"
And press "Send email"
Then "Email Form" must contains values:
| From | "John Doe" <admin@example.com> |
| ToField | ["opportunity w contact no name" <contactEmail2@example.com> (Contact)] |
And I close ui dialog

Scenario: Check opportunity contact that has name and email, "Send Email" dialog should have field "To" containing contacts title and email
And I click view opportunity w contact name and email in grid
And I follow "More actions"
And press "Send email"
Then "Email Form" must contains values:
| From | "John Doe" <admin@example.com> |
| ToField | ["test Contact with Email" <contactEmail1@example.com> (Contact)] |
And I close ui dialog

Scenario: Check opportunity that do NOT has contact, "Send Email" dialog should have empty field "To"
Given I click view opportunity wo contact in grid
And I follow "More actions"
And press "Send email"
Then "Email Form" must contains values:
| From | "John Doe" <admin@example.com> |
When I press "Send"
Then I should see "Email Form" validation errors:
| ToField | This value contains not valid email address. |
| Subject | This value should not be blank. |
And I close ui dialog

0 comments on commit a95ce86

Please sign in to comment.