Fix bug in sysContacts email collection (#15325)

Also, include trace in log when an error occurs
This commit is contained in:
Tony Murray 2023-09-15 08:05:55 -05:00 committed by GitHub
parent 4b98bd7607
commit ba67d886c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -156,7 +156,7 @@ class AlertUtil
$contacts = [];
foreach ($results as $result) {
$device = DeviceCache::get($result);
$device = DeviceCache::get($result['device_id']);
$email = $device->getAttrib('override_sysContact_bool')
? $device->getAttrib('override_sysContact_string')
: $device->sysContact;

View File

@ -511,7 +511,7 @@ class RunAlerts
$tmp = $instance->deliverAlert($obj, $item['opts'] ?? []);
$this->alertLog($tmp, $obj, $obj['transport']);
} catch (AlertTransportDeliveryException $e) {
Eventlog::log($e->getMessage(), $obj['device_id'], 'alert', Severity::Error);
Eventlog::log($e->getTraceAsString() . PHP_EOL . $e->getMessage(), $obj['device_id'], 'alert', Severity::Error);
$this->alertLog($e->getMessage(), $obj, $obj['transport']);
} catch (\Exception $e) {
$this->alertLog($e, $obj, $obj['transport']);