Skip to content

Commit

Permalink
Do not set customer last name when it was manually removed - closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Dec 21, 2023
1 parent 4e72e2e commit 54e5aa2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,14 @@ public function setData($data, $replace_data = true, $save = false)
$result = true;
} else {
// Update empty fields.

// Do not set last name if first name is already set (and vise versa).
if (!empty($this->first_name) && !empty($data['last_name'])) {
unset($data['last_name']);
}
if (!empty($this->last_name) && !empty($data['first_name'])) {
unset($data['first_name']);
}
foreach ($data as $key => $value) {
if (in_array($key, $this->fillable) && empty($this->$key)) {
$this->$key = $value;
Expand Down

0 comments on commit 54e5aa2

Please sign in to comment.