From 279a4124f1b307c7f669e329a8c9e369497cc32b Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 3 Dec 2020 15:51:08 +0100 Subject: [PATCH 1/2] Database changes --- pandora_console/extras/mr/44.sql | 15 +++++++++++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 10 ++++++++++ pandora_console/pandoradb.sql | 10 ++++++++++ 3 files changed, 35 insertions(+) create mode 100644 pandora_console/extras/mr/44.sql diff --git a/pandora_console/extras/mr/44.sql b/pandora_console/extras/mr/44.sql new file mode 100644 index 0000000000..a1dc6dc1b7 --- /dev/null +++ b/pandora_console/extras/mr/44.sql @@ -0,0 +1,15 @@ +START TRANSACTION; + +ALTER TABLE `talert_templates` +ADD COLUMN `field16` TEXT NOT NULL AFTER `field15` +,ADD COLUMN `field17` TEXT NOT NULL AFTER `field16` +,ADD COLUMN `field18` TEXT NOT NULL AFTER `field17` +,ADD COLUMN `field19` TEXT NOT NULL AFTER `field18` +,ADD COLUMN `field20` TEXT NOT NULL AFTER `field19` +,ADD COLUMN `field16_recovery` TEXT NOT NULL AFTER `field15_recovery` +,ADD COLUMN `field17_recovery` TEXT NOT NULL AFTER `field16_recovery` +,ADD COLUMN `field18_recovery` TEXT NOT NULL AFTER `field17_recovery` +,ADD COLUMN `field19_recovery` TEXT NOT NULL AFTER `field18_recovery` +,ADD COLUMN `field20_recovery` TEXT NOT NULL AFTER `field19_recovery`; + +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 6248cdaaf0..0ae60a3bda 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1246,11 +1246,21 @@ ALTER TABLE talert_templates ADD COLUMN `field12` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field13` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field14` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field15` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field16` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field17` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field18` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field19` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field20` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field16_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field17_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE talert_templates ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0; -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index d45f7a964c..04950fc0c8 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -468,6 +468,11 @@ CREATE TABLE IF NOT EXISTS `talert_templates` ( `field13` text NOT NULL, `field14` text NOT NULL, `field15` text NOT NULL, + `field16` text NOT NULL, + `field17` text NOT NULL, + `field18` text NOT NULL, + `field19` text NOT NULL, + `field20` text NOT NULL, `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always', 'not_normal'), `value` varchar(255) default '', `matches_value` tinyint(1) default 0, @@ -501,6 +506,11 @@ CREATE TABLE IF NOT EXISTS `talert_templates` ( `field13_recovery` text NOT NULL, `field14_recovery` text NOT NULL, `field15_recovery` text NOT NULL, + `field16_recovery` text NOT NULL, + `field17_recovery` text NOT NULL, + `field18_recovery` text NOT NULL, + `field19_recovery` text NOT NULL, + `field20_recovery` text NOT NULL, `priority` tinyint(4) default '0', `id_group` mediumint(8) unsigned NULL default 0, `special_day` tinyint(1) default 0, From 3fd983fb7223a0c6dce6b897f485059694aa7031 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 3 Dec 2020 15:51:40 +0100 Subject: [PATCH 2/2] Fix --- pandora_console/godmode/alerts/alert_templates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index 38b601e6b7..6041a74507 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -148,7 +148,7 @@ if ($update_template) { $recovery_notify = (bool) get_parameter('recovery_notify'); $fields_recovery = []; - for ($i = 1; $i <= 10; $i++) { + for ($i = 1; $i <= $config['max_macro_fields']; $i++) { $values['field'.$i] = (string) get_parameter('field'.$i); $values['field'.$i.'_recovery'] = ($recovery_notify) ? (string) get_parameter('field'.$i.'_recovery') : ''; }