diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json index 22ce4cb87a..922fc95a2b 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json @@ -189,6 +189,11 @@ "website": "website", "emailAddress": "emailAddress", "phone": "phoneOffice", + "billingAddressStreet": "addressStreet", + "billingAddressCity": "addressCity", + "billingAddressState": "addressState", + "billingAddressPostalCode": "addressPostalCode", + "billingAddressCountry": "addressCountry", "assignedUser": "assignedUser", "teams": "teams" }, diff --git a/application/Espo/Modules/Crm/Services/Lead.php b/application/Espo/Modules/Crm/Services/Lead.php index c71b9c2b74..6499f3dfe6 100644 --- a/application/Espo/Modules/Crm/Services/Lead.php +++ b/application/Espo/Modules/Crm/Services/Lead.php @@ -17,24 +17,26 @@ class Lead extends \Espo\Services\Record $entityManager = $this->getEntityManager(); - if (!empty($recordsData['Account'])) { + + if (!empty($recordsData->Account)) { + $account = $entityManager->getEntity('Account'); - $account->set($recordsData['Account']); + $account->set(get_object_vars($recordsData->Account)); $entityManager->saveEntity($account); $lead->set('createdAccountId', $account->id); } - if (!empty($recordsData['Opportunity'])) { + if (!empty($recordsData->Opportunity)) { $opportunity = $entityManager->getEntity('Opportunity'); - $opportunity->set($recordsData['Opportunity']); + $opportunity->set(get_object_vars($recordsData->Opportunity)); if (isset($account)) { $opportunity->set('accountId', $account->id); } $entityManager->saveEntity($opportunity); $lead->set('createdOpportunityId', $opportunity->id); } - if (!empty($recordsData['Contact'])) { + if (!empty($recordsData->Contact)) { $contact = $entityManager->getEntity('Contact'); - $contact->set($recordsData['Contact']); + $contact->set(get_object_vars($recordsData->Contact)); if (isset($account)) { $contact->set('accountId', $account->id); } @@ -42,10 +44,7 @@ class Lead extends \Espo\Services\Record if (isset($opportunity)) { $entityManager->getRepository('Contact')->relate($contact, 'opportunities', $opportunity); } - $lead->set('createdContactId', $contact->id); - - - + $lead->set('createdContactId', $contact->id); } $lead->set('status', 'Converted'); diff --git a/application/Espo/Resources/i18n/en_US/Global.json b/application/Espo/Resources/i18n/en_US/Global.json index 2f7cdc835d..05f8deef67 100644 --- a/application/Espo/Resources/i18n/en_US/Global.json +++ b/application/Espo/Resources/i18n/en_US/Global.json @@ -30,7 +30,12 @@ "Admin": "Admin", "About": "About", "Log Out": "Log Out", - "Preferences": "Preferences" + "Preferences": "Preferences", + "State": "State", + "Street": "Street", + "Country": "Country", + "City": "City", + "PostalCode": "Postal Code" }, "boolFilters": { "onlyMy": "Only My", @@ -49,7 +54,13 @@ "dateFrom": "Date From", "dateTo": "Date To", "autorefreshInterval": "Auto-refresh Interval", - "displayRecords": "Display Records" + "displayRecords": "Display Records", + "billingAddressCity": "City", + "billingAddressCountry": "Country", + "billingAddressPostalCode": "Postal Code", + "addressCity": "City", + "addressCountry": "Country", + "addressPostalCode": "Postal Code" }, "dashlets": { "Stream": "Stream"