Skip to content

Commit

Permalink
Merge pull request mautic#7898 from kuzmany/fix-sugar-crm-owner-update
Browse files Browse the repository at this point in the history
SugarCRM Fix owner update
  • Loading branch information
dennisameling authored Mar 19, 2020
2 parents 9e106f6 + 0cb2088 commit 5f9e93d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plugins/MauticCrmBundle/Api/SugarcrmApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public function getEmailBySugarUserId($query = null)
}

$data = ['filter' => 'all'];
$fields = ['id', 'email1'];
$fields = ['id', 'email1', 'email'];

$parameters = [
'filter' => [['$and' => $filter]],
Expand All @@ -525,10 +525,12 @@ public function getEmailBySugarUserId($query = null)
if (isset($record['email'][0]['email_address']) && $record['email'][0]['email_address'] != '') {
$emails = $record['email'];
$found_email = $record['email'][0]['email_address'];
foreach ($record['name_value_list'] as $email) {
if ($email['email_address'] != '' && $email['primary_address'] == 1) {
$found_email = $email;
break;
if (isset($record['name_value_list'])) {
foreach ($record['name_value_list'] as $email) {
if ($email['email_address'] != '' && $email['primary_address'] == 1) {
$found_email = $email;
break;
}
}
}
if ($type == 'BYID') {
Expand Down

0 comments on commit 5f9e93d

Please sign in to comment.