From d64297176c32b8bebd0438025f4308596942aa7b Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 14:29:41 +1000 Subject: [PATCH 1/8] Update setup.php --- setup.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.php b/setup.php index bcf85597..31b14c1b 100644 --- a/setup.php +++ b/setup.php @@ -160,6 +160,8 @@ function plugin_post_init_genericobject() { $itemtype = $objecttype['itemtype']; if (class_exists($itemtype)) { $itemtype::registerType(); + if (class_exists('PluginPositionsPosition') && !empty($objecttype['use_plugin_positions'])) + PluginPositionsPosition::registerType($itemtype); } } From 94c66ef80bbfb1ed389530691363aa986b325b18 Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 14:35:35 +1000 Subject: [PATCH 2/8] Update object.class.php --- inc/object.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/object.class.php b/inc/object.class.php index ee1d96d4..2b85946f 100644 --- a/inc/object.class.php +++ b/inc/object.class.php @@ -425,6 +425,10 @@ function getLinkedItemTypesAsArray() { return $this->objecttype->getLinkedItemTypesAsArray(); } + function canUsePluginPositions() { + return ($this->objecttype->canUsePluginPositions()); + } + function title() { } From 774b3dfc466ec87a97117f05952a90b3834a0f3d Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 14:40:54 +1000 Subject: [PATCH 3/8] Update type.class.php --- inc/type.class.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/inc/type.class.php b/inc/type.class.php index 5fb3f811..a0526a42 100644 --- a/inc/type.class.php +++ b/inc/type.class.php @@ -504,6 +504,7 @@ function showBehaviorForm($ID, $options=array()) { "use_plugin_order" => __("order plugin", "genericobject"), "use_plugin_uninstall" => __("item's uninstallation plugin", "genericobject"), "use_plugin_simcard" => __("simcard plugin", "genericobject"), + "use_plugin_positions" => __("cartography plugin", "genericobject"), ); $plugin = new Plugin(); $odd=0; @@ -612,7 +613,7 @@ function showBehaviorForm($ID, $options=array()) { echo "\n"; } break; - case 'use_plugin_geninventorynumber' : + case 'use_plugin_geninventorynumber' : if ($plugin->isActivated('geninventorynumber')) { Html::showCheckbox(array('name' => $right, 'checked' => $this->fields[$right])); @@ -621,6 +622,16 @@ function showBehaviorForm($ID, $options=array()) { echo "\n"; } break; + case 'use_plugin_positions' : + if ($plugin->isActivated('positions')) { + Html::showCheckbox(array('name' => $right,. + 'checked' => $this->fields[$right])); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + } echo ""; if ($odd == 1) { @@ -1799,6 +1810,13 @@ function canUsePluginGeninventoryNumber() { return $this->fields['use_plugin_geninventorynumber']; } + function canUsePluginPositions() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("positions") || !$plugin->isActivated("positions")) { + return false; + } + return $this->fields['use_plugin_positions']; + } function isTransferable() { return Session::isMultiEntitiesMode(); From deeb6fa9002af592d0793e716782d09ea1921c5d Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 14:47:48 +1000 Subject: [PATCH 4/8] Update type.class.php --- inc/type.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/type.class.php b/inc/type.class.php index a0526a42..ee97f15b 100644 --- a/inc/type.class.php +++ b/inc/type.class.php @@ -1882,6 +1882,7 @@ static function install(Migration $migration) { `use_plugin_order` tinyint(1) NOT NULL default '0', `use_plugin_uninstall` tinyint(1) NOT NULL default '0', `use_plugin_geninventorynumber` tinyint(1) NOT NULL default '0', + `use_plugin_positions` tinyint(1) NOT NULL default '0', `use_menu_entry` tinyint(1) NOT NULL default '0', `use_projects` tinyint(1) NOT NULL default '0', `linked_itemtypes` text NULL, From e1bd8338eb6e2d8801788f09f3d2cb7b2ac63d32 Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 15:07:14 +1000 Subject: [PATCH 5/8] Update hook.php --- hook.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hook.php b/hook.php index 12f0e150..f85209b8 100644 --- a/hook.php +++ b/hook.php @@ -96,7 +96,7 @@ function plugin_genericobject_install() { include_once(GLPI_ROOT."/plugins/genericobject/inc/object.class.php"); include_once(GLPI_ROOT."/plugins/genericobject/inc/type.class.php"); - $migration = new Migration('2.4.0'); + $migration = new Migration('0.85-1.0'); foreach ( array( @@ -192,4 +192,4 @@ function plugin_genericobject_MassiveActions($type) { } else { return array(); } -} \ No newline at end of file +} From be61735e201a3ac879306767e95e35128442dbd9 Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 15:09:32 +1000 Subject: [PATCH 6/8] Update type.class.php --- inc/type.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/type.class.php b/inc/type.class.php index ee97f15b..49af4f45 100644 --- a/inc/type.class.php +++ b/inc/type.class.php @@ -1905,6 +1905,7 @@ static function install(Migration $migration) { $migration->addField($table, "linked_itemtypes", "text"); $migration->addField($table, "plugin_genericobject_typefamilies_id", "integer"); $migration->addField($table, "use_plugin_simcard", "bool"); + $migration->addField($table, "use_plugin_positions", "bool"); $migration->migrationOneTable($table); // Migrate notepad data From e338d366aa8449641934eb5905cbb6c57f2472d9 Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Tue, 26 Jan 2016 15:11:11 +1000 Subject: [PATCH 7/8] Update hook.php From 4858e24869e17084f9ad017ece592fbc35bba0bf Mon Sep 17 00:00:00 2001 From: Boris Korzun Date: Thu, 1 Dec 2016 21:52:45 +1000 Subject: [PATCH 8/8] Update hook.php Revert commit --- hook.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hook.php b/hook.php index f85209b8..074092f8 100644 --- a/hook.php +++ b/hook.php @@ -96,7 +96,7 @@ function plugin_genericobject_install() { include_once(GLPI_ROOT."/plugins/genericobject/inc/object.class.php"); include_once(GLPI_ROOT."/plugins/genericobject/inc/type.class.php"); - $migration = new Migration('0.85-1.0'); + $migration = new Migration('2.4.0'); foreach ( array( @@ -134,6 +134,7 @@ function plugin_genericobject_install() { return true; } + function plugin_genericobject_uninstall() { global $DB;