From 506809d4e540de5b20918925b40b1a05f578de47 Mon Sep 17 00:00:00 2001 From: jsatoh Date: Fri, 13 Apr 2012 06:41:28 +0000 Subject: [PATCH] 2012-04-13 Junichi Satoh * godmode/alerts/configure_alert_compound.php: Added special days feature. * pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql, extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Added column 'special_day' to 'talert_compound'. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5965 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++++++++ .../extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql | 6 ++++++ .../extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql | 6 ++++++ .../pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql | 6 ++++++ .../godmode/alerts/configure_alert_compound.php | 9 ++++++++- pandora_console/pandoradb.oracle.sql | 3 ++- pandora_console/pandoradb.postgreSQL.sql | 3 ++- pandora_console/pandoradb.sql | 1 + 8 files changed, 42 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 45eedce16c..d704d6edc4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-04-13 Junichi Satoh + + * godmode/alerts/configure_alert_compound.php: Added special days + feature. + + * pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, + extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql, + extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Added column + 'special_day' to 'talert_compound'. + 2012-04-12 Vanessa Gil * extensions/tree.php diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql index d8f9b5c662..e76d710427 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql @@ -197,3 +197,9 @@ ALTER TABLE `treport_content_item` ADD COLUMN `operation` TEXT DEFAULT ''; -- Table `tmensajes` -- ----------------------------------------------------- ALTER TABLE `tmensajes` MODIFY COLUMN `mensaje` TEXT NOT NULL DEFAULT ''; + +-- ----------------------------------------------------- +-- Table `talert_compound` +-- ----------------------------------------------------- + +ALTER TABLE `talert_compound` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql index ffc9092efd..ed02961e32 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql @@ -193,3 +193,9 @@ ALTER TABLE treport_content_item ADD (operation CLOB default ''); -- Table `tmensajes` -- ----------------------------------------------------- ALTER TABLE tmensajes MODIFY mensaje VARCHAR2(255) NOT NULL DEFAULT ''; + +-- ----------------------------------------------------- +-- Table `talert_compound` +-- ----------------------------------------------------- + +alter table talert_compound add (special_day NUMBER(5,0) default 0); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql index 4662e10683..ce155ce5f8 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql @@ -185,3 +185,9 @@ ALTER TABLE "treport_content_item" ADD COLUMN "operation" text default ''; -- Table `tmensajes` -- ----------------------------------------------------- ALTER TABLE "tmensajes" ALTER COLUMN "mensaje" TYPE TEXT; + +-- ----------------------------------------------------- +-- Table `talert_compound` +-- ----------------------------------------------------- + +ALTER TABLE "talert_compound" ADD COLUMN "special_day" SMALLINT default 0; diff --git a/pandora_console/godmode/alerts/configure_alert_compound.php b/pandora_console/godmode/alerts/configure_alert_compound.php index d05e3a7b03..a924e1b213 100644 --- a/pandora_console/godmode/alerts/configure_alert_compound.php +++ b/pandora_console/godmode/alerts/configure_alert_compound.php @@ -131,6 +131,7 @@ function update_compound ($step) { $friday = (bool) get_parameter ('friday'); $saturday = (bool) get_parameter ('saturday'); $sunday = (bool) get_parameter ('sunday'); + $special_day = (bool) get_parameter ('special_day'); $time_from = (string) get_parameter ('time_from'); $time_from = date ("H:s:00", strtotime ($time_from)); $time_to = (string) get_parameter ('time_to'); @@ -151,6 +152,7 @@ function update_compound ($step) { 'friday' => $friday, 'saturday' => $saturday, 'sunday' => $sunday, + 'special_day' => $special_day, 'time_from' => $time_from, 'time_to' => $time_to, 'time_threshold' => $threshold, @@ -166,6 +168,7 @@ function update_compound ($step) { 'friday' => $friday, 'saturday' => $saturday, 'sunday' => $sunday, + 'special_day' => $special_day, 'time_from' => "#to_date('" . $time_from . "', 'hh24:mi:ss')", 'time_to' => "#to_date('" . $time_to . "', 'hh24:mi:ss')", 'time_threshold' => $threshold, @@ -226,6 +229,7 @@ $thursday = true; $friday = true; $saturday = true; $sunday = true; +$special_day = false; $default_action = 0; $field1 = ''; $field2 = ''; @@ -250,6 +254,7 @@ if ($id && ! $create_compound) { $friday = (bool) $compound['friday']; $saturday = (bool) $compound['saturday']; $sunday = (bool) $compound['sunday']; + $special_day = (bool) $template['special_day']; $max_alerts = $compound['max_alerts']; $min_alerts = $compound['min_alerts']; $threshold = $compound['time_threshold']; @@ -337,7 +342,6 @@ if ($step == 2) { $table->rowstyle['preview'] = 'display: none'; } $table->colspan = array (); - $table->colspan[0][1] = 3; $table->colspan[4][1] = 3; $table->colspan['actions'][1] = 3; $table->colspan['field1'][1] = 3; @@ -360,6 +364,9 @@ if ($step == 2) { $table->data[0][1] .= html_print_checkbox ('saturday', 1, $saturday, true); $table->data[0][1] .= __('Sun'); $table->data[0][1] .= html_print_checkbox ('sunday', 1, $sunday, true); + + $table->data[0][2] = __('Use special days list'); + $table->data[0][3] = html_print_checkbox ('special_day', 1, $special_day, true); $table->data[1][0] = __('Time from'); $table->data[1][1] = html_print_input_text ('time_from', $time_from, '', 7, 7, diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 401fba88d6..27eeed9ea1 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -405,7 +405,8 @@ CREATE TABLE talert_compound ( last_reference NUMBER(19, 0) default 0 NOT NULL, times_fired NUMBER(10, 0) default 0 NOT NULL, disabled NUMBER(5, 0) default 0, - priority NUMBER(5, 0) default 0 + priority NUMBER(5, 0) default 0, + special_day NUMBER(5, 0) default 0 ); CREATE SEQUENCE talert_compound_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index d58e1acc4d..f91419f730 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -332,7 +332,8 @@ CREATE TABLE "talert_compound" ( "last_reference" BIGINT NOT NULL default 0, "times_fired" INTEGER NOT NULL default 0, "disabled" SMALLINT default 0, - "priority" SMALLINT default 0 + "priority" SMALLINT default 0, + "special_day" SMALLINT default 0 ); CREATE TYPE type_talert_compound_elements_operation AS ENUM ('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 927dcb994f..2a4a1a260f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -361,6 +361,7 @@ CREATE TABLE IF NOT EXISTS `talert_compound` ( `times_fired` int(3) NOT NULL default '0', `disabled` tinyint(1) default '0', `priority` tinyint(4) default '0', + `special_day` tinyint(1) default 0, PRIMARY KEY (`id`), FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`) ON DELETE CASCADE ON UPDATE CASCADE