Fix for region_id when importing messages and the address exists in a different region

This commit is contained in:
Deon George 2023-07-06 13:55:54 +10:00
parent 349ad32fc8
commit 36d03d1c12

View File

@ -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);