Skip to content

Commit

Permalink
adding fields display message in innerHtml (pluginsGLPI#284)
Browse files Browse the repository at this point in the history
* adding fields display message in innerHtml

* fix tests
  • Loading branch information
orthagh authored Feb 22, 2019
1 parent 91c0856 commit 9db449e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions inc/migration.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php

class PluginFieldsMigration {
class PluginFieldsMigration extends Migration {

function __construct($ver = "") {
parent::__construct($ver);
}

static function install(Migration $migration, $version) {
global $DB;
Expand All @@ -21,12 +25,14 @@ static function uninstall() {
}

function updateFromCustomfields($glpi_version = "0.80") {
global $DB;

//TODO : REWRITE customfield update
return true;
}

function displayMessage($msg) {
Session::addMessageAfterRedirect($msg);
}

function migrateCustomfieldTypes($old_type) {
$types = [
'sectionhead' => 'header',
Expand Down
4 changes: 2 additions & 2 deletions templates/container.class.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class %%CLASSNAME%% extends CommonDBTM
if ($type != 'header') {
$sql_type = PluginFieldsMigration::getSQLType($type);
$migration = new Migration(0);
$migration = new PluginFieldsMigration(0);
$migration->addField(self::getTable(), $fieldname, $sql_type);
$migration->migrationOneTable(self::getTable());
}
}

static function removeField($fieldname) {
$migration = new Migration(0);
$migration = new PluginFieldsMigration(0);
$migration->dropField(self::getTable(), $fieldname);
}
Expand Down

0 comments on commit 9db449e

Please sign in to comment.