From 8f4111f4c9dedcf68262cb916b6a7c4aad141059 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Mon, 21 Jan 2019 17:09:06 +0100 Subject: [PATCH] fix(formaswer): remove is_deleted column this will drop the trash bin for this itemtype. It causes UI problems in the tab Form Answer of a form and users are not able to purge deleted items Signed-off-by: Thierry Bugier --- inc/formanswer.class.php | 11 +++++++++++ install/mysql/plugin_formcreator_empty.sql | 1 - install/upgrade_to_2.7.php | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/formanswer.class.php b/inc/formanswer.class.php index da5b5a509..e6ba82283 100644 --- a/inc/formanswer.class.php +++ b/inc/formanswer.class.php @@ -114,6 +114,17 @@ public function canViewItem() { return false; } + public static function canPurge() { + return true; + } + + public function canPurgeItem() { + $form = new PluginFormcreatorForm(); + $formFk = PluginFormcreatorForm::getForeignKeyField(); + $form->getFromDB($this->fields[$formFk]); + return $form->canPurgeItem(); + } + /** * Returns the type name with consideration of plural * diff --git a/install/mysql/plugin_formcreator_empty.sql b/install/mysql/plugin_formcreator_empty.sql index 3fe1daae7..192ec0c79 100644 --- a/install/mysql/plugin_formcreator_empty.sql +++ b/install/mysql/plugin_formcreator_empty.sql @@ -69,7 +69,6 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_formanswers` ( `request_date` datetime NOT NULL, `status` enum('waiting','refused','accepted') NOT NULL DEFAULT 'waiting', `comment` text, - `is_deleted` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), INDEX `plugin_formcreator_forms_id` (`plugin_formcreator_forms_id`), INDEX `entities_id_is_recursive` (`entities_id`, `is_recursive`), diff --git a/install/upgrade_to_2.7.php b/install/upgrade_to_2.7.php index d8d3a9dc2..3970e3e2e 100644 --- a/install/upgrade_to_2.7.php +++ b/install/upgrade_to_2.7.php @@ -105,6 +105,8 @@ public function upgrade(Migration $migration) { } $table = 'glpi_plugin_formcreator_formanswers'; $migration->renameTable('glpi_plugin_formcreator_forms_answers', $table); + $migration->migrationOneTable($table); + $migration->dropField($table, 'is_deleted'); $table = 'glpi_plugin_formcreator_answers'; $migration->changeField( $table,