From cc4685a6ac398867af86047216760532bfe62745 Mon Sep 17 00:00:00 2001 From: amma35 Date: Thu, 17 Nov 2016 09:31:41 +0100 Subject: [PATCH] Change version 9.1.1 update xml --- addressing.xml | 2 +- inc/reserveip.class.php | 66 ++++++++++++++++++++--------------------- setup.php | 6 ++-- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/addressing.xml b/addressing.xml index 09ad56d..c663731 100644 --- a/addressing.xml +++ b/addressing.xml @@ -27,7 +27,7 @@ 2.4.0 - 9.1 + 9.1.1 2.3.0 diff --git a/inc/reserveip.class.php b/inc/reserveip.class.php index 8f08c5d..cbc9f32 100644 --- a/inc/reserveip.class.php +++ b/inc/reserveip.class.php @@ -34,8 +34,8 @@ class PluginAddressingReserveip extends CommonDBTM { const COMPUTER = 'Computer'; - const NETWORK = 'NetworkEquipment'; - const PRINTER = 'Printer'; + const NETWORK = 'NetworkEquipment'; + const PRINTER = 'Printer'; static $rightname = 'plugin_addressing'; @@ -64,20 +64,20 @@ function reserveip($input = array()) // Find computer $item = new $input['type'](); - $id = 0; + $id = 0; if (!$item->getFromDBByQuery("WHERE `name`='" . $input["name"] . "' AND `entities_id`=" . $input['entities_id'] . " LIMIT 1")) { // Add computer - $id = $item->add(array("name" => $input["name"], - "entities_id" => $input['entities_id'], - 'states_id' => $input["states_id"], - "comment" => $input['comment'])); + $id = $item->add(array("name" => $input["name"], + "entities_id" => $input['entities_id'], + 'states_id' => $input["states_id"], + "comment" => $input['comment'])); } else { $id = $item->getID(); //update item - $item->update(array("id" => $id, - "entities_id" => $input['entities_id'], - 'states_id' => $input["states_id"], - "comment" => $input['comment'])); + $item->update(array("id" => $id, + "entities_id" => $input['entities_id'], + 'states_id' => $input["states_id"], + "comment" => $input['comment'])); } // Add a new port @@ -85,37 +85,37 @@ function reserveip($input = array()) switch ($input['type']) { case 'NetworkEquipment' : $newinput = array( - "itemtype" => $input['type'], - "items_id" => $id, - "entities_id" => $_SESSION["glpiactive_entity"], - "name" => self::getPortName($input["ip"]), - "instantiation_type" => "NetworkPortAggregate", - "_create_children" => 1, + "itemtype" => $input['type'], + "items_id" => $id, + "entities_id" => $_SESSION["glpiactive_entity"], + "name" => self::getPortName($input["ip"]), + "instantiation_type" => "NetworkPortAggregate", + "_create_children" => 1, "NetworkName__ipaddresses" => array("-100" => $input["ip"]), - "mac" => $input["mac"], + "mac" => $input["mac"], ); break; case 'Computer': case 'Printer': $newinput = array( - "itemtype" => $input['type'], - "items_id" => $id, - "entities_id" => $_SESSION["glpiactive_entity"], - "name" => self::getPortName($input["ip"]), - "instantiation_type" => "NetworkPortEthernet", - "_create_children" => 1, + "itemtype" => $input['type'], + "items_id" => $id, + "entities_id" => $_SESSION["glpiactive_entity"], + "name" => self::getPortName($input["ip"]), + "instantiation_type" => "NetworkPortEthernet", + "_create_children" => 1, "NetworkName__ipaddresses" => array("-100" => $input["ip"]), - "mac" => $input["mac"], + "mac" => $input["mac"], ); break; } - $np = new NetworkPort(); + $np = new NetworkPort(); $newID = $np->add($newinput); Event::log($newID, "networkport", 5, "inventory", //TRANS: %s is the user login - sprintf(__('%s adds an item'), $_SESSION["glpiname"])); + sprintf(__('%s adds an item'), $_SESSION["glpiname"])); } } @@ -127,17 +127,17 @@ function reserveip($input = array()) */ function checkMandatoryFields($input) { - $msg = array(); + $msg = array(); $checkKo = false; $mandatory_fields = array('name' => __("Object's name", 'addressing'), - 'ip' => _n("IP address", "IP addresses", 1)); + 'ip' => _n("IP address", "IP addresses", 1)); foreach ($input as $key => $value) { if (isset($mandatory_fields[$key])) { if ((isset($value) && empty($value)) || !isset($value)) { $msg[$key] = $mandatory_fields[$key]; - $checkKo = true; + $checkKo = true; } } } @@ -201,8 +201,8 @@ function showForm($ip, $id_addressing, $randmodal) " . __("Type") . " "; Dropdown::showFromArray('type', array(PluginAddressingReserveip::COMPUTER => Computer::getTypeName(), - PluginAddressingReserveip::NETWORK => NetworkEquipment::getTypeName(), - PluginAddressingReserveip::PRINTER => Printer::getTypeName()), array('on_change' => "nameIsThere(\"" . $CFG_GLPI['root_doc'] . "\");")); + PluginAddressingReserveip::NETWORK => NetworkEquipment::getTypeName(), + PluginAddressingReserveip::PRINTER => Printer::getTypeName()), array('on_change' => "nameIsThere(\"" . $CFG_GLPI['root_doc'] . "\");")); echo ""; echo ""; echo " @@ -239,7 +239,7 @@ function showForm($ip, $id_addressing, $randmodal) echo " + . "onclick=\"" . Html::jsGetElementbyID("reserveip" . $randmodal) . ".dialog('close');window.location.reload();return true;\"/> "; diff --git a/setup.php b/setup.php index 96bd105..1c4ce38 100644 --- a/setup.php +++ b/setup.php @@ -72,15 +72,15 @@ function plugin_version_addressing() { 'author' => 'Gilles Portheault, Xavier Caillaud, Remi Collet, Nelly Mahu-Lasson', 'license' => 'GPLv2+', 'homepage' => 'https://github.com/pluginsGLPI/addressing', - 'minGlpiVersion' => '0.85');// For compatibility / no install in version < 0.85 + 'minGlpiVersion' => '9.1.1');// For compatibility / no install in version < 9.1.1 } // Optional : check prerequisites before install : may print errors or add to message after redirect function plugin_addressing_check_prerequisites() { - if (version_compare(GLPI_VERSION,'0.85.3','lt') || version_compare(GLPI_VERSION,'9.2','ge')) { - _e('This plugin requires GLPI >= 0.85.3', 'addressing'); + if (version_compare(GLPI_VERSION, '9.1.1', 'lt') || version_compare(GLPI_VERSION, '9.2', 'ge')) { + echo "This plugin requires GLPI = 9.1.1"; return false; } return true;