Address::syncToFibuMerge() knows about > 900000 customer numbers now
This commit is contained in:
@@ -69,12 +69,17 @@ class Address extends mfBaseModel {
|
||||
$me->loadMe();
|
||||
|
||||
if($this->fibu_account_number) {
|
||||
$fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $this->customer_number]);
|
||||
$old_custnum = $this->customer_number;
|
||||
if($old_custnum > 900000) {
|
||||
$old_custnum -= 900000;
|
||||
}
|
||||
|
||||
$fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum]);
|
||||
if(!$fibumerge) {
|
||||
// create fibu merge
|
||||
$fibumerge = XinonFibuMergeModel::create([
|
||||
"source" => "t",
|
||||
"old_custnum" => $this->customer_number,
|
||||
"old_custnum" => $old_custnum,
|
||||
"new_custnum" => $this->fibu_account_number,
|
||||
"name" => ($this->company) ? $this->company : $this->lastname,
|
||||
"vorname" => ($this->company) ? "" : $this->firstname,
|
||||
@@ -87,7 +92,7 @@ class Address extends mfBaseModel {
|
||||
$fibumerge->save();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if($fibumerge->new_custnum != $this->fibu_account_number) {
|
||||
$fibumerge->new_custnum = $this->fibu_account_number;
|
||||
$fibumerge->save();
|
||||
|
||||
Reference in New Issue
Block a user