Fix for region_id when importing messages and the address exists in a different region
This commit is contained in:
parent
349ad32fc8
commit
36d03d1c12
@ -430,7 +430,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
Address::unguard();
|
Address::unguard();
|
||||||
$ao = Address::firstOrNew([
|
$ao = Address::firstOrNew([
|
||||||
'zone_id' => $msg->tzone->id,
|
'zone_id' => $msg->tzone->id,
|
||||||
'region_id' => 0,
|
//'region_id' => 0,
|
||||||
'host_id' => $msg->tn,
|
'host_id' => $msg->tn,
|
||||||
'node_id' => $msg->tf,
|
'node_id' => $msg->tf,
|
||||||
'point_id' => $msg->tp,
|
'point_id' => $msg->tp,
|
||||||
@ -438,6 +438,9 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
]);
|
]);
|
||||||
Address::reguard();
|
Address::reguard();
|
||||||
|
|
||||||
|
if (is_null($ao->region_id))
|
||||||
|
$ao->region_id = $ao->host_id;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error(sprintf('%s:! Error finding/creating TO address [%s] for message',self::LOGKEY,$msg->tboss),['error'=>$e->getMessage()]);
|
Log::error(sprintf('%s:! Error finding/creating TO address [%s] for message',self::LOGKEY,$msg->tboss),['error'=>$e->getMessage()]);
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
@ -466,7 +469,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
Address::unguard();
|
Address::unguard();
|
||||||
$ao = Address::firstOrNew([
|
$ao = Address::firstOrNew([
|
||||||
'zone_id' => $msg->fzone->id,
|
'zone_id' => $msg->fzone->id,
|
||||||
'region_id' => 0,
|
//'region_id' => 0,
|
||||||
'host_id' => $msg->fn,
|
'host_id' => $msg->fn,
|
||||||
'node_id' => $msg->ff,
|
'node_id' => $msg->ff,
|
||||||
'point_id' => $msg->fp,
|
'point_id' => $msg->fp,
|
||||||
@ -474,6 +477,9 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
]);
|
]);
|
||||||
Address::reguard();
|
Address::reguard();
|
||||||
|
|
||||||
|
if (is_null($ao->region_id))
|
||||||
|
$ao->region_id = $ao->host_id;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error(sprintf('%s:! Error finding/creating FROM address [%s] for message',self::LOGKEY,$msg->fboss),['error'=>$e->getMessage()]);
|
Log::error(sprintf('%s:! Error finding/creating FROM address [%s] for message',self::LOGKEY,$msg->fboss),['error'=>$e->getMessage()]);
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user