From b37f60053d7ffd7460bcf41f5d8d3957b3a608bb Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 6 Nov 2017 15:45:44 +0200 Subject: [PATCH] event invitation change --- .../Espo/Modules/Crm/Services/Meeting.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/application/Espo/Modules/Crm/Services/Meeting.php b/application/Espo/Modules/Crm/Services/Meeting.php index 2713042683..d06fbc0822 100644 --- a/application/Espo/Modules/Crm/Services/Meeting.php +++ b/application/Espo/Modules/Crm/Services/Meeting.php @@ -110,15 +110,18 @@ class Meeting extends \Espo\Services\Record return true; } - protected function getInvitationManager() + protected function getInvitationManager($useUserSmtp = true) { - $smtpParams = $this->getPreferences()->getSmtpParams(); - if ($smtpParams) { - if (array_key_exists('password', $smtpParams)) { - $smtpParams['password'] = $this->getCrypt()->decrypt($smtpParams['password']); + $smtpParams = null; + if ($useUserSmtp) { + $smtpParams = $this->getPreferences()->getSmtpParams(); + if ($smtpParams) { + if (array_key_exists('password', $smtpParams)) { + $smtpParams['password'] = $this->getCrypt()->decrypt($smtpParams['password']); + } + $smtpParams['fromAddress'] = $this->getUser()->get('emailAddress'); + $smtpParams['fromName'] = $this->getUser()->get('name'); } - $smtpParams['fromAddress'] = $this->getUser()->get('emailAddress'); - $smtpParams['fromName'] = $this->getUser()->get('name'); } return new Invitations( $this->getEntityManager(), @@ -132,9 +135,9 @@ class Meeting extends \Espo\Services\Record ); } - public function sendInvitations(Entity $entity) + public function sendInvitations(Entity $entity, $useUserSmtp = true) { - $invitationManager = $this->getInvitationManager(); + $invitationManager = $this->getInvitationManager($useUserSmtp); $emailHash = array();