From 731ba1c32c1eddba8e8b9891312df0607569ae1d Mon Sep 17 00:00:00 2001 From: Lainow Date: Tue, 10 Dec 2024 16:40:26 +0100 Subject: [PATCH 1/2] Fix ola disabling after esaclation --- front/ticket.form.php | 3 ++- inc/ticket.class.php | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index 214aed05..d08dbd9e 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -86,7 +86,8 @@ // Sanitize before merging with $_POST['comment'] which is already sanitized 'content' => Sanitizer::sanitize( '

' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '


' - ) . $_POST['comment'] + ) . $_POST['comment'], + '_do_not_compute_takeintoaccount' => true ]); } diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 6785dea7..4793bf87 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -213,7 +213,8 @@ public static function AssignFirstGroupOnSolve(CommonDBTM $item) '_no_reopen' => true, //prevent reopening ticket 'state' => Planning::INFO, 'content' => __("Solution provided, back to the group", "escalade") . " " . - $group->getName() + $group->getName(), + '_do_not_compute_takeintoaccount' => true ]); } } @@ -277,7 +278,8 @@ public static function AssignLastGroupOnRejectedSolution(CommonDBTM $item) 'is_private' => true, 'state' => Planning::INFO, 'content' => __("Solution rejected, return to the group", "escalade") . " " . - $group->getName() + $group->getName(), + '_do_not_compute_takeintoaccount' => true ]); } @@ -381,6 +383,7 @@ public static function addHistoryOnAddGroup(CommonDBTM $item) 'is_private' => true, 'state' => Planning::INFO, 'content' => Toolbox::addslashes_deep(sprintf(__("Escalation to the group %s.", "escalade"), $group->getName())), + '_do_not_compute_takeintoaccount' => true ]); } From 1707c87eacf49a5fea695931e8b6a7599d5f4808 Mon Sep 17 00:00:00 2001 From: Lainow Date: Wed, 11 Dec 2024 14:31:35 +0100 Subject: [PATCH 2/2] Add do not compute in config --- front/ticket.form.php | 2 +- hook.php | 15 ++++++++++++++- inc/config.class.php | 9 ++++++++- inc/ticket.class.php | 6 +++--- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index d08dbd9e..4fee8859 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -87,7 +87,7 @@ 'content' => Sanitizer::sanitize( '

' . sprintf(__('Escalation to the group %s.', 'escalade'), Sanitizer::unsanitize($group->getName())) . '


' ) . $_POST['comment'], - '_do_not_compute_takeintoaccount' => true + '_do_not_compute_takeintoaccount' => $_SESSION['plugins']['escalade']['config']['do_not_compute_takeintoaccount'] ]); } diff --git a/hook.php b/hook.php index e7090855..985a85d0 100644 --- a/hook.php +++ b/hook.php @@ -85,12 +85,13 @@ function plugin_escalade_install() `use_filter_assign_group` INT NOT NULL, `ticket_last_status` INT NOT NULL, `remove_requester` INT NOT NULL, + `do_not_compute_takeintoaccount` TINYINT NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; $DB->doQuery($query); $query = "INSERT INTO glpi_plugin_escalade_configs - VALUES (NULL, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, '" . Ticket::WAITING . "',0)"; + VALUES (NULL, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, '" . Ticket::WAITING . "', 0, 0)"; $DB->doQuery($query); } @@ -382,6 +383,18 @@ function plugin_escalade_install() $migration->migrationOneTable('glpi_plugin_escalade_configs'); } + //Update to 2.9.11 + // add new fields + if (!$DB->fieldExists('glpi_plugin_escalade_configs', 'do_not_compute_takeintoaccount')) { + $migration->addField( + 'glpi_plugin_escalade_configs', + 'do_not_compute_takeintoaccount', + 'bool', + ['value' => 0] + ); + $migration->migrationOneTable('glpi_plugin_escalade_configs'); + } + return true; } diff --git a/inc/config.class.php b/inc/config.class.php index 0b3192f6..cfb19303 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -351,7 +351,14 @@ function hide_technician_group(val) { 'rand' => $rand, ]); echo ""; - echo ""; + echo "