From 36d03d1c12be494296b40239a578db1d0734d846 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 6 Jul 2023 13:55:54 +1000 Subject: [PATCH] Fix for region_id when importing messages and the address exists in a different region --- app/Classes/FTN/Packet.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index fc9173d..838b27a 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -430,7 +430,7 @@ class Packet extends FTNBase implements \Iterator, \Countable Address::unguard(); $ao = Address::firstOrNew([ 'zone_id' => $msg->tzone->id, - 'region_id' => 0, + //'region_id' => 0, 'host_id' => $msg->tn, 'node_id' => $msg->tf, 'point_id' => $msg->tp, @@ -438,6 +438,9 @@ class Packet extends FTNBase implements \Iterator, \Countable ]); Address::reguard(); + if (is_null($ao->region_id)) + $ao->region_id = $ao->host_id; + } catch (\Exception $e) { Log::error(sprintf('%s:! Error finding/creating TO address [%s] for message',self::LOGKEY,$msg->tboss),['error'=>$e->getMessage()]); $this->errors->push($msg); @@ -466,7 +469,7 @@ class Packet extends FTNBase implements \Iterator, \Countable Address::unguard(); $ao = Address::firstOrNew([ 'zone_id' => $msg->fzone->id, - 'region_id' => 0, + //'region_id' => 0, 'host_id' => $msg->fn, 'node_id' => $msg->ff, 'point_id' => $msg->fp, @@ -474,6 +477,9 @@ class Packet extends FTNBase implements \Iterator, \Countable ]); Address::reguard(); + if (is_null($ao->region_id)) + $ao->region_id = $ao->host_id; + } catch (\Exception $e) { Log::error(sprintf('%s:! Error finding/creating FROM address [%s] for message',self::LOGKEY,$msg->fboss),['error'=>$e->getMessage()]); $this->errors->push($msg);