Skip to content

Commit

Permalink
Merge pull request #10 from bakaphp/hotfix-empty-address
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken authored Dec 1, 2021
2 parents 3fbcb69 + 5626b52 commit faa5b28
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Leads/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ public function update(Dealer $dealer, User $user) : self
}

if (!empty($this->addresses)) {
$data['ContactInformation']['Addresses'] = $this->addresses;
foreach ($this->addresses as $key => $address) {
if (empty(trim($address['State']))) {
unset($this->addresses[$key]);
}
}

if (!empty($this->addresses)) {
$data['ContactInformation']['Addresses'] = $this->addresses;
}
}

if (!empty($this->phones) && isset($data['ContactInformation']['Phones'])) {
Expand Down

0 comments on commit faa5b28

Please sign in to comment.