From e19442cd43dee92ec36027b4a598dcbc5b8c23f3 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 18 Jan 2024 21:10:45 +0100 Subject: [PATCH] Address::syncToFibuMerge() checks for old_custnum and name before updateing --- application/Address/Address.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/Address/Address.php b/application/Address/Address.php index 076608425..a9c9d529c 100644 --- a/application/Address/Address.php +++ b/application/Address/Address.php @@ -74,7 +74,11 @@ class Address extends mfBaseModel { $old_custnum -= 900000; } - $fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum]); + $name_search = []; + if($this->company) $name_search[] = $this->company; + if($this->lastname) $name_search[] = $this->lastname; + + $fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum, "name" => $name_search]); if(!$fibumerge) { // create fibu merge $fibumerge = XinonFibuMergeModel::create([