Skip to content

Commit

Permalink
fix(formaswer): remove is_deleted column
Browse files Browse the repository at this point in the history
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 <tbugier@teclib.com>
  • Loading branch information
btry committed Feb 5, 2019
1 parent a91cc11 commit 8f4111f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions inc/formanswer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
1 change: 0 additions & 1 deletion install/mysql/plugin_formcreator_empty.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down
2 changes: 2 additions & 0 deletions install/upgrade_to_2.7.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8f4111f

Please sign in to comment.