feature: Copy all email alerts to default contact (#8178)

* feature: Copy all email alerts to default contact

* change in SQL and add check as requested

* Rename 233.sql to 234.sql

* tab removing
This commit is contained in:
FTBZ
2018-02-05 09:25:24 +01:00
committed by Neil Lathwood
parent dc2883f59d
commit eb72a5394e
3 changed files with 10 additions and 0 deletions

View File

@@ -281,6 +281,10 @@ $general_conf = array(
'descr' => 'Send alerts to default contact only',
'type' => 'checkbox',
),
array('name' => 'alert.default_copy',
'descr' => 'Copy all email alerts to default contact',
'type' => 'checkbox',
),
array('name' => 'alert.default_mail',
'descr' => 'Default contact',
'type' => 'text',

View File

@@ -317,6 +317,11 @@ function GetContacts($results)
}
}
# Copy all email alerts to default contact if configured.
if (!isset($tmp_contacts[$config['alert']['default_mail']]) && ($config['alert']['default_copy'])) {
$tmp_contacts[$config['alert']['default_mail']] = '';
}
# Send email to default contact if no other contact found
if ((count($tmp_contacts) == 0) && ($config['alert']['default_if_none']) && (!empty($config['alert']['default_mail']))) {
$tmp_contacts[$config['alert']['default_mail']] = '';

1
sql-schema/234.sql Normal file
View File

@@ -0,0 +1 @@
INSERT INTO `config` (`config_name`,`config_value`,`config_default`,`config_descr`,`config_group`,`config_group_order`,`config_sub_group`,`config_sub_group_order`,`config_hidden`,`config_disabled`) VALUES ('alert.default_copy','true','true','Copy all email alerts to default contact','alerting',0,'general',0,'0','0');