Bonsoir à tous,
Dans le cadre d'un projet client, je souhe réaliser la gestion des
cartes SIM dans GLPI.
Mes propositions se trouvent sur la page du wiki suivante :
https://forge.indepnet.net/projects/glpi/wiki/GlpiSimcards
Ci-joint au mail un patch contenant une première version concernant
cette fonctionnalité et traitant :
- l'ajout d'un objet Simcard (et ses attributs), avec gestion des
gabarits, transferts, etc.
- la connexion directe à un ordinateur
- l'ajout d'un droit pour la gestion des cartes SIM
Parmi les points qui me semblent à discuter je dirais :
- est-ce que les cartes SIM doivent apparaître dans le menu Inventaire
(actuellement j'ai pris le parti que oui) ?
- les cartes SIM pouvant être connectées à des ordinateurs mais aussi
des périphériques (par exemple clefs 3G) et des téléphones : ne
serait-il pas plus intéressant d'avoir une seule table de gestion des
connexions (actuellement on a juste glpi_computers_items, et il faudrait
rajouter glpi_phones_items et glpi_peripherals_items) ?
- j'ai listé mais pas implémenté les 2 points suivants :
- état interne de la carte SIM : actuellement j'ai mis un states_id
classique (pour la gestion de parc), qui est très différent de l'état de
la carte (par exemple savoir qu'elle est bloquée). Cela à mon avis n'a
d'intérêt que lors d'une remontée automatique depuis un outil d'inventaire
- pays associé à la carte : cela voudrait dire avoir une table dans
GLPI listant tous les pays (et les codes associés, cf l'exemple de
remontée FusionInventory, dans un téléphone Android le pays est
représenté par son code, pour la France fr)
En attendant vos remarques,
Walid.
diff --git config/define.php config/define.php
index 8c25bb6..85bd7a7 100644
--- config/define.php
+++ config/define.php
@@ -43,7 +43,7 @@ $CFG_GLPI['languages'] = //| NAME in native lang |LANG FILE |extjs| tinymce
'et_EE' => array('Eesti', 'ee_ET.php','en', 'et','estonian'), // et_EE
'en_GB' => array('English', 'en_GB.php','en', 'en','english'),
'es_AR' => array('Español (Argentina)', 'es_AR.php','es', 'es','spanish'),
- 'es_CO' => array('Español (Colombia)', 'es_CO.php','es', 'es','spanish'),
+ 'es_CO' => array('Español (Colombia)', 'es_CO.php','es', 'es','spanish'),
'es_ES' => array('Español (España)', 'es_ES.php','es', 'es','spanish'),
'es_MX' => array('Español (Mexico)', 'es_MX.php','es', 'es','spanish'),
'es_VE' => array('Español (Venezuela)', 'es_VE.php','es', 'es','spanish'),
@@ -170,46 +170,52 @@ $CFG_GLPI_PLUGINS = array();
$CFG_GLPI["unicity_types"] = array('Budget', 'Computer', 'Contact', 'Contract',
'Infocom', 'Monitor', 'NetworkEquipment',
'Peripheral', 'Phone', 'Printer', 'Software',
- 'SoftwareLicense', 'Supplier','User');
+ 'SoftwareLicense', 'Supplier','User', 'Simcard');
$CFG_GLPI["state_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer');
+ 'Peripheral', 'Phone', 'Printer', 'Simcard');
$CFG_GLPI["document_types"] = array('Budget', 'CartridgeItem', 'Change', 'Computer',
'ConsumableItem', 'Contact', 'Contract',
'Document', 'Entity', 'KnowbaseItem', 'Monitor',
'NetworkEquipment', 'Peripheral', 'Phone',
'Printer', 'Problem', 'Reminder', 'Software',
- 'SoftwareLicense', 'Supplier', 'Ticket','User');
+ 'SoftwareLicense', 'Supplier', 'Ticket','User',
+ 'Simcard');
$CFG_GLPI["consumables_types"] = array('Group', 'User');
$CFG_GLPI["contract_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
'Peripheral', 'Phone', 'Printer', 'Software',
- 'SoftwareLicense');
+ 'SoftwareLicense', 'Simcard');
$CFG_GLPI["infocom_types"] = array('Cartridge', 'CartridgeItem', 'Computer',
'Consumable', 'ConsumableItem', 'Monitor',
'NetworkEquipment', 'Peripheral', 'Phone',
- 'Printer', 'Software', 'SoftwareLicense');
+ 'Printer', 'Software', 'SoftwareLicense',
+ 'Simcard');
$CFG_GLPI["reservation_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
'Peripheral', 'Phone', 'Printer', 'Software');
$CFG_GLPI["linkuser_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer', 'Software');
+ 'Peripheral', 'Phone', 'Printer', 'Software',
+ 'Simcard');
$CFG_GLPI["linkgroup_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer', 'Software');
+ 'Peripheral', 'Phone', 'Printer', 'Software',
+ 'Simcard');
$CFG_GLPI["linkuser_tech_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer', 'Software');
+ 'Peripheral', 'Phone', 'Printer', 'Software',
+ 'Simcard');
$CFG_GLPI["linkgroup_tech_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
'Peripheral', 'Phone', 'Printer', 'Software');
$CFG_GLPI["ticket_types"] = array('Computer', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer', 'Software');
+ 'Peripheral', 'Phone', 'Printer', 'Software',
+ 'Simcard');
$CFG_GLPI["link_types"] = array('Budget', 'CartridgeItem', 'Computer',
'ConsumableItem', 'Contact', 'Contract', 'Monitor',
@@ -261,6 +267,13 @@ $CFG_GLPI["globalsearch_types"] = array('Computer', 'Contact', 'Docume
'NetworkEquipment', 'Peripheral', 'Phone',
'Printer', 'Software', 'Supplier', 'Ticket');
+$CFG_GLPI["transfer_types"] = array('CartridgeItem', 'Computer', 'ConsumableItem',
+ 'Contact', 'Contract', 'Document', 'Group',
+ 'Link', 'Monitor', 'NetworkEquipment',
+ 'Peripheral', 'Phone', 'Printer', 'Problem',
+ 'Software', 'SoftwareLicense', 'Supplier', 'Ticket',
+ 'Simcard');
+
// New config options which can be missing during migration
$CFG_GLPI["number_format"] = 0;
$CFG_GLPI["decimal_number"] = 2;
diff --git files/_graphs/remove.txt files/_graphs/remove.txt
deleted file mode 100755
index 9773214..0000000
--- files/_graphs/remove.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Vous pouvez effacer ce fichier sans dommages.
-
-You can safely remove this file.
diff --git front/phoneoperator.form.php front/phoneoperator.form.php
new file mode 100644
index 0000000..172dd84
--- /dev/null
+++ front/phoneoperator.form.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file: Walid nouh
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+
+define('GLPI_ROOT', '..');
+include (GLPI_ROOT . "/inc/includes.php");
+
+$dropdown = new PhoneOperator();
+include (GLPI_ROOT . "/front/dropdown.common.form.php");
+?>
\ No newline at end of file
diff --git front/phoneoperator.php front/phoneoperator.php
new file mode 100644
index 0000000..fc8adb3
--- /dev/null
+++ front/phoneoperator.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file:
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+
+define('GLPI_ROOT', '..');
+include (GLPI_ROOT . "/inc/includes.php");
+
+$dropdown = new PhoneOperator();
+include (GLPI_ROOT . "/front/dropdown.common.php");
+?>
\ No newline at end of file
diff --git front/simcard.form.php front/simcard.form.php
new file mode 100644
index 0000000..1a0654c
--- /dev/null
+++ front/simcard.form.php
@@ -0,0 +1,110 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file:
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+define('GLPI_ROOT', '..');
+include (GLPI_ROOT . "/inc/includes.php");
+
+Session::checkRight("simcard", "r");
+
+if (!isset($_GET["id"])) {
+ $_GET["id"] = "";
+}
+
+if (!isset($_GET["sort"])) {
+ $_GET["sort"] = "";
+}
+
+if (!isset($_GET["order"])) {
+ $_GET["order"] = "";
+}
+
+if (!isset($_GET["withtemplate"])) {
+ $_GET["withtemplate"] = "";
+}
+
+$simcard = new Simcard();
+//Add a new computer
+if (isset($_POST["add"])) {
+ $simcard->check(-1, 'w', $_POST);
+ if ($newID = $simcard->add($_POST)) {
+ Event::log($newID, "simcards", 4, "inventory",
+ sprintf(__('%1$s adds the item %2%s'), $_SESSION["glpiname"], $_POST["name"]));
+ }
+ Html::back();
+
+// delete a computer
+} else if (isset($_POST["delete"])) {
+ $simcard->check($_POST['id'], 'd');
+ $ok = $simcard->delete($_POST);
+ if ($ok) {
+ Event::log($_POST["id"], "computers", 4, "inventory",
+ //TRANS: %s is the user login
+ sprintf(__('%s deletes the item'), $_SESSION["glpiname"]));
+ }
+ $simcard->redirectToList();
+
+} else if (isset($_POST["restore"])) {
+ $simcard->check($_POST['id'], 'd');
+ if ($simcard->restore($_POST)) {
+ Event::log($_POST["id"],"computers", 4, "inventory",
+ //TRANS: %s is the user login
+ sprintf(__('%s restores the item'), $_SESSION["glpiname"]));
+ }
+ $simcard->redirectToList();
+
+} else if (isset($_REQUEST["purge"])) {
+ $simcard->check($_REQUEST['id'], 'd');
+ if ($simcard->delete($_REQUEST,1)) {
+ Event::log($_REQUEST["id"], "computers", 4, "inventory",
+ //TRANS: %s is the user login
+ sprintf(__('%s purges the item'), $_SESSION["glpiname"]));
+ }
+ $simcard->redirectToList();
+
+//update a computer
+} else if (isset($_POST["update"])) {
+ $simcard->check($_POST['id'], 'w');
+ $simcard->update($_POST);
+ Event::log($_POST["id"], "simcards", 4, "inventory",
+ //TRANS: %s is the user login
+ sprintf(__('%s updates the item'), $_SESSION["glpiname"]));
+ Html::back();
+
+} else {//print computer information
+ Html::header(Simcard::GetTypeName(2), $_SERVER['PHP_SELF'], "inventory", "simcard");
+ //show computer form to add
+ $simcard->showForm($_GET["id"], array('withtemplate' => $_GET["withtemplate"]));
+ Html::footer();
+}
+?>
\ No newline at end of file
diff --git front/simcard.php front/simcard.php
new file mode 100644
index 0000000..75088f4
--- /dev/null
+++ front/simcard.php
@@ -0,0 +1,45 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file:
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+define('GLPI_ROOT', '..');
+include (GLPI_ROOT . "/inc/includes.php");
+
+Session::checkRight("simcard", "r");
+
+Html::header(Simcard::GetTypeName(2), $_SERVER['PHP_SELF'], "inventory", "simcard");
+
+Search::show('Simcard');
+
+Html::footer();
+?>
\ No newline at end of file
diff --git front/simcardsize.form.php front/simcardsize.form.php
new file mode 100644
index 0000000..4dba2cc
--- /dev/null
+++ front/simcardsize.form.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file: Walid nouh
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+
+define('GLPI_ROOT', '..');
+include (GLPI_ROOT . "/inc/includes.php");
+
+$dropdown = new SimcardSize();
+include (GLPI_ROOT . "/front/dropdown.common.form.php");
+?>
\ No newline at end of file
diff --git front/simcardsize.php front/simcardsize.php
new file mode 100644
index 0000000..1243e97
--- /dev/null
+++ front/simcardsize.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file:
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+
+define('GLPI_ROOT', '..');
+include (GLPI_ROOT . "/inc/includes.php");
+
+$dropdown = new SimcardSize();
+include (GLPI_ROOT . "/front/dropdown.common.php");
+?>
\ No newline at end of file
diff --git inc/computer_item.class.php inc/computer_item.class.php
index 9b4b041..0958c71 100644
--- inc/computer_item.class.php
+++ inc/computer_item.class.php
@@ -141,6 +141,12 @@ class Computer_Item extends CommonDBRelation{
$ocstab = 'import_peripheral';
break;
+ case 'Simcard' :
+ // shoul really never occurs as OCS doesn't sync phone
+ $item = new Simcard();
+ $ocstab = '';
+ break;
+
default :
return false;
}
@@ -365,7 +371,7 @@ class Computer_Item extends CommonDBRelation{
$ID = $comp->fields['id'];
$canedit = $comp->can($ID,'w');
- $items = array('Monitor', 'Peripheral', 'Phone', 'Printer');
+ $items = array('Monitor', 'Peripheral', 'Phone', 'Printer', 'Simcard');
$datas = array();
foreach ($items as $itemtype) {
$item = new $itemtype();
@@ -465,6 +471,11 @@ class Computer_Item extends CommonDBRelation{
case 'Phone' :
_e('No connected phone');
break;
+
+ case 'Simcard' :
+ _e('No connected simcard');
+ break;
+
}
echo "<br>";
}
@@ -507,12 +518,13 @@ class Computer_Item extends CommonDBRelation{
static function showForItem(CommonDBTM $item, $withtemplate='') {
// Prints a direct connection to a computer
global $DB;
-
+
$comp = new Computer();
$target = $comp->getFormURL();
$ID = $item->getField('id');
+
if (!$item->can($ID,"r")) {
return false;
}
@@ -693,6 +705,7 @@ class Computer_Item extends CommonDBRelation{
case 'Printer' :
case 'Peripheral' :
case 'Monitor' :
+ case 'Simcard' :
if (Session::haveRight('computer', 'r')) {
if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(_n('Connection','Connections',2),
@@ -706,8 +719,9 @@ class Computer_Item extends CommonDBRelation{
if (Session::haveRight('phone', 'r')
|| Session::haveRight('printer', 'r')
|| Session::haveRight('peripheral', 'r')
- || Session::haveRight('monitor', 'r')) {
- if ($_SESSION['glpishow_count_on_tabs']) {
+ || Session::haveRight('monitor', 'r')
+ || Session::haveRight('simcard', 'r')) {
+ if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(_n('Connection','Connections',2),
self::countForComputer($item));
}
@@ -727,6 +741,7 @@ class Computer_Item extends CommonDBRelation{
case 'Printer' :
case 'Peripheral' :
case 'Monitor' :
+ case 'Simcard' :
self::showForItem($item);
return true;
diff --git inc/dropdown.class.php inc/dropdown.class.php
index ed6319f..8ce7873 100644
--- inc/dropdown.class.php
+++ inc/dropdown.class.php
@@ -691,6 +691,10 @@ class Dropdown {
'FQDN' => _n('Internet domain', 'Internet domains', 2),
'WifiNetwork' => _n('Wifi network', 'Wifi networks', 2)),
+ __('Simcard')
+ => array('SimcardSize' => _n('Simcard size', 'Simcard sizes', 2),
+ 'PhoneOperator' => _n('Operator', 'Operators', 2)),
+
__('Software')
=> array('SoftwareCategory' => _n('Software category',
'Software categories', 2)),
@@ -1509,12 +1513,7 @@ class Dropdown {
if (Session::haveRight('transfer','r')
&& Session::isMultiEntitiesMode()
- && in_array($itemtype, array('CartridgeItem', 'Computer', 'ConsumableItem',
- 'Contact', 'Contract', 'Document', 'Group',
- 'Link', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer', 'Problem',
- 'Software', 'SoftwareLicense', 'Supplier', 'Ticket'))
- && $isadmin) {
+ && in_array($itemtype, $CFG_GLPI["transfer_types"]) && $isadmin) {
echo "<option value='add_transfer_list'>".__('Add to transfer list')."</option>";
}
diff --git inc/html.class.php inc/html.class.php
index 0bd4c61..b75a4a2 100644
--- inc/html.class.php
+++ inc/html.class.php
@@ -1074,7 +1074,21 @@ class Html {
$showstate = true;
}
-
+ if (Session::haveRight("simcard","r")) {
+ $menu['inventory']['content']['simcard']['title'] = _n('Simcard', 'Simcard', 2);
+ $menu['inventory']['content']['simcard']['shortcut'] = '';
+ $menu['inventory']['content']['simcard']['page'] = '/front/simcard.php';
+ $menu['inventory']['content']['simcard']['links']['search'] = '/front/simcard.php';
+
+ if (Session::haveRight("simcard","w")) {
+ $menu['inventory']['content']['simcard']['links']['add']
+ = '/front/setup.templates.php?'.'itemtype=Simcard&add=1';
+ $menu['inventory']['content']['simcard']['links']['template']
+ = '/front/setup.templates.php?'.'itemtype=Simcard&add=0';
+ }
+ $showstate = true;
+ }
+
if ($showstate) {
$menu['inventory']['content']['state']['title'] = _n('Status', 'Status', 2);
$menu['inventory']['content']['state']['shortcut'] = '';
diff --git inc/phoneoperator.class.php inc/phoneoperator.class.php
new file mode 100644
index 0000000..8bb5720
--- /dev/null
+++ inc/phoneoperator.class.php
@@ -0,0 +1,47 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file: Walid Nouh
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+if (!defined('GLPI_ROOT')) {
+ die("Sorry. You can't access directly to this file");
+}
+
+/// Class Vlan
+class PhoneOperator extends CommonDropdown {
+
+ static function getTypeName($nb=0) {
+ // Acronymous, no plural
+ return _n('Operator', 'Operators', $nb);
+ }
+}
+?>
\ No newline at end of file
diff --git inc/profile.class.php inc/profile.class.php
index d23f8c3..f3a9dc8 100644
--- inc/profile.class.php
+++ inc/profile.class.php
@@ -666,7 +666,10 @@ class Profile extends CommonDBTM {
echo "<td>".__('Internet')."</td><td>";
self::dropdownNoneReadWrite("internet", $this->fields["internet"], 1, 1, 1);
echo "</td>\n";
- echo "<td colspan='4'> </td></tr>";
+ echo "<td>".__('Simcard')."</td><td>";
+ self::dropdownNoneReadWrite("simcard", $this->fields["simcard"], 1, 1, 1);
+ echo "</td>\n";
+ echo "<td colspan='2'> </td></tr>";
// Gestion / Management
echo "<tr class='tab_bg_1'><th colspan='6'>".__('Management')."</th></tr>";
diff --git inc/relation.constant.php inc/relation.constant.php
index 6e2eef1..069c976 100644
--- inc/relation.constant.php
+++ inc/relation.constant.php
@@ -244,7 +244,8 @@ $RELATION = array("glpi_authldaps"
'_glpi_tickettemplatepredefinedfields' => 'entities_id',
'glpi_tickets' => 'entities_id',
'_glpi_ticketvalidations' => 'entities_id',
- 'glpi_users' => 'entities_id'),
+ 'glpi_users' => 'entities_id',
+ 'glpi_simcards' => 'entities_id'),
"glpi_filesystems"
=> array('glpi_computerdisks' => 'filesystems_id'),
@@ -267,7 +268,8 @@ $RELATION = array("glpi_authldaps"
'glpi_printers' => array('groups_id_tech', 'groups_id'),
'glpi_softwares' => array('groups_id_tech', 'groups_id'),
'glpi_cartridgeitems' => 'groups_id_tech',
- 'glpi_consumableitems' => 'groups_id_tech'),
+ 'glpi_consumableitems' => 'groups_id_tech',
+ 'glpi_simcards' => array('groups_id_tech', 'groups_id')),
"glpi_holidays"
=> array('glpi_calendars_holidays' => 'holidays_id',),
@@ -305,7 +307,8 @@ $RELATION = array("glpi_authldaps"
'glpi_peripherals' => 'locations_id',
'glpi_phones' => 'locations_id',
'glpi_softwares' => 'locations_id',
- 'glpi_users' => 'locations_id'),
+ 'glpi_users' => 'locations_id',
+ 'glpi_simcards' => 'locations_id'),
"glpi_manufacturers"
=> array('glpi_cartridgeitems' => 'manufacturers_id',
@@ -494,7 +497,8 @@ $RELATION = array("glpi_authldaps"
'glpi_phones' => 'states_id',
'glpi_printers' => 'states_id',
'glpi_softwareversions' => 'states_id',
- 'glpi_states' => 'states_id'),
+ 'glpi_states' => 'states_id',
+ 'glpi_simcards' => 'states_id'),
"glpi_suppliers"
=> array('glpi_changes' => 'suppliers_id_assign',
@@ -589,11 +593,16 @@ $RELATION = array("glpi_authldaps"
'users_id_lastupdater'),
'glpi_tickets_users' => 'users_id',
'glpi_tickettasks' => array('users_id', 'users_id_tech'),
- 'glpi_useremails' => 'users_id'),
+ 'glpi_useremails' => 'users_id',
+ 'glpi_simcards' => array('users_id_tech', 'users_id')),
"glpi_usertitles"
=> array('glpi_users' => 'usertitles_id'),
+ "glpi_simcards"
+ => array('glpi_simcardsizes' => 'simcardsizes_id',
+ 'glpi_phoneoperators' => 'phoneoperators_id'),
+
"glpi_vlans"
=> array('glpi_networkports_vlans' => 'vlans_id'),
diff --git inc/simcard.class.php inc/simcard.class.php
new file mode 100644
index 0000000..e56ef2d
--- /dev/null
+++ inc/simcard.class.php
@@ -0,0 +1,309 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file: Walid Nouh
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+if (!defined('GLPI_ROOT')) {
+ die("Sorry. You can't access directly to this file");
+}
+
+/// Class Simcard
+class Simcard extends CommonDBTM {
+
+ // From CommonDBTM
+ public $dohistory = true;
+
+ /**
+ * Name of the type
+ *
+ * @param $nb integer number of item in the type (default 0)
+ **/
+ static function getTypeName($nb=0) {
+ return _n('Simcard', 'Simcards', $nb);
+ }
+
+ function canCreate() {
+ return Session::haveRight('simcard', 'w');
+ }
+
+ function canView() {
+ return Session::haveRight('simcard', 'r');
+ }
+
+ function defineTabs($options=array()) {
+
+ $ong = array();
+ $this->addStandardTab('Computer_Item', $ong, $options);
+ $this->addStandardTab('Infocom', $ong, $options);
+ $this->addStandardTab('Contract_Item', $ong, $options);
+ $this->addStandardTab('Document', $ong, $options);
+ $this->addStandardTab('Ticket', $ong, $options);
+ $this->addStandardTab('Item_Problem', $ong, $options);
+ $this->addStandardTab('Note', $ong, $options);
+ $this->addStandardTab('Log', $ong, $options);
+ return $ong;
+ }
+
+ /**
+ * Print the simcard form
+ *
+ * @param $ID integer ID of the item
+ * @param $options array
+ * - target for the Form
+ * - withtemplate template or basic simcard
+ *
+ *@return Nothing (display)
+ **/
+ function showForm($ID, $options=array()) {
+ global $CFG_GLPI, $DB;
+
+ if ($ID > 0) {
+ $this->check($ID,'r');
+ } else {
+ // Create item
+ $this->check(-1,'w');
+ }
+
+ $this->showTabs($options);
+ $this->showFormHeader($options);
+
+ echo "<tr class='tab_bg_1'>";
+ //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
+ echo "<td>".sprintf(__('%1$s%2$s'),__('Name'),
+ (isset($options['withtemplate']) && $options['withtemplate']?"*":"")).
+ "</td>";
+ echo "<td>";
+ $objectName = autoName($this->fields["name"], "name",
+ (isset($options['withtemplate']) && $options['withtemplate']==2),
+ $this->getType(), $this->fields["entities_id"]);
+ Html::autocompletionTextField($this, 'name', array('value' => $objectName));
+ echo "</td>";
+ echo "<td>".__('Status')."</td>";
+ echo "<td>";
+ Dropdown::show('State', array('value' => $this->fields["states_id"]));
+ echo "</td></tr>\n";
+
+ echo "<tr class='tab_bg_1'>";
+ echo "<td>".__('Location')."</td>";
+ echo "<td>";
+ Dropdown::show('Location', array('value' => $this->fields["locations_id"],
+ 'entity' => $this->fields["entities_id"]));
+ echo "</td>";
+ echo "<td>".__('Size')."</td>";
+ echo "<td>";
+ Dropdown::show('SimcardSize', array('value' => $this->fields["simcardsizes_id"]));
+ echo "</td></tr>\n";
+
+ echo "<tr class='tab_bg_1'>";
+ echo "<td>".__('Technician in charge of the hardware')."</td>";
+ echo "<td>";
+ User::dropdown(array('name' => 'users_id_tech',
+ 'value' => $this->fields["users_id_tech"],
+ 'right' => 'interface',
+ 'entity' => $this->fields["entities_id"]));
+ echo "</td>";
+ echo "<td>".__('Operator')."</td>";
+ echo "<td>";
+ Dropdown::show('PhoneOperator', array('value' => $this->fields["phoneoperators_id"]));
+ echo "</td></tr>\n";
+
+ echo "<tr class='tab_bg_1'>";
+ echo "<td>".__('Group in charge of the hardware')."</td>";
+ echo "<td>";
+ Dropdown::show('Group', array('name' => 'groups_id_tech',
+ 'value' => $this->fields['groups_id_tech'],
+ 'entity' => $this->fields['entities_id'],
+ 'condition' => '`is_assign`'));
+
+ echo "</td>";
+ echo "<td>".__('Phone Number')."</td>";
+ echo "<td >";
+ Html::autocompletionTextField($this,'phonenumber');
+ echo "</td></tr>\n";
+
+ echo "<tr class='tab_bg_1'>";
+ echo "<td>".__('IMSI')."</td>";
+ echo "<td >";
+ Html::autocompletionTextField($this,'imsi');
+ echo "</td>\n";
+ echo "<td>".sprintf(__('%1$s%2$s'), __('Inventory number'),
+ (isset($options['withtemplate']) && $options['withtemplate']?"*":"")).
+ "</td>";
+ echo "<td>";
+ $objectName = autoName($this->fields["otherserial"], "otherserial",
+ (isset($options['withtemplate']) && $options['withtemplate']==2),
+ $this->getType(), $this->fields["entities_id"]);
+ Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
+ echo "</td>";
+ echo "</td></tr>\n";
+
+ echo "<tr class='tab_bg_1'>";
+ echo "<td>".__('User')."</td>";
+ echo "<td>";
+ User::dropdown(array('value' => $this->fields["users_id"],
+ 'entity' => $this->fields["entities_id"],
+ 'right' => 'all'));
+ echo "</td>";
+ echo "<td>".__('Group')."</td>";
+ echo "<td>";
+ Dropdown::show('Group', array('value' => $this->fields["groups_id"],
+ 'entity' => $this->fields["entities_id"],
+ 'condition' => '`is_itemgroup`'));
+
+ echo "</td>";
+
+ echo "<tr class='tab_bg_1'>";
+ echo "<td>".__('PIN code')."</td>";
+ echo "<td >";
+ Html::autocompletionTextField($this,'pin');
+ echo "</td>\n";
+ echo "<td>".__('PUK code')."</td>";
+ echo "<td >";
+ Html::autocompletionTextField($this,'puk');
+ echo "</td></tr>\n";
+
+ echo "</td>";
+ echo "<td rowspan='9'>".__('Comments')."</td>";
+ echo "<td rowspan='9' class='middle'>";
+ echo "<textarea cols='45' rows='15' name='comment' >".$this->fields["comment"]."</textarea>";
+ echo "</td></tr>\n";
+
+ $this->showFormButtons($options);
+ $this->addDivForTabs();
+
+ return true;
+ }
+
+ function getSearchOptions() {
+ global $CFG_GLPI;
+
+ $tab = array();
+ $tab['common'] = __('Characteristics');
+
+ $tab[1]['table'] = $this->getTable();
+ $tab[1]['field'] = 'name';
+ $tab[1]['name'] = __('Name');
+ $tab[1]['datatype'] = 'itemlink';
+ $tab[1]['itemlink_type'] = $this->getType();
+ $tab[1]['massiveaction'] = false; // implicit key==1
+
+ $tab[2]['table'] = $this->getTable();
+ $tab[2]['field'] = 'id';
+ $tab[2]['name'] = __('ID');
+ $tab[2]['massiveaction'] = false; // implicit field is id
+
+ $tab[5]['table'] = $this->getTable();
+ $tab[5]['field'] = 'serial';
+ $tab[5]['name'] = __('IMSI');
+ $tab[5]['datatype'] = 'string';
+
+ $tab[6]['table'] = $this->getTable();
+ $tab[6]['field'] = 'otherserial';
+ $tab[6]['name'] = __('Inventory number');
+ $tab[6]['datatype'] = 'string';
+
+ $tab[16]['table'] = $this->getTable();
+ $tab[16]['field'] = 'comment';
+ $tab[16]['name'] = __('Comments');
+ $tab[16]['datatype'] = 'text';
+
+ $tab += Location::getSearchOptionsToAdd();
+
+ $tab[19]['table'] = $this->getTable();
+ $tab[19]['field'] = 'date_mod';
+ $tab[19]['name'] = __('Last update');
+ $tab[19]['datatype'] = 'datetime';
+ $tab[19]['massiveaction'] = false;
+
+ $tab[24]['table'] = 'glpi_users';
+ $tab[24]['field'] = 'name';
+ $tab[24]['linkfield'] = 'users_id_tech';
+ $tab[24]['name'] = __('Technician in charge of the hardware');
+
+ $tab[25]['table'] = 'glpi_simcardsizes';
+ $tab[25]['field'] = 'name';
+ $tab[25]['name'] = __('Simcard size');
+
+ $tab[26]['table'] = 'glpi_phoneoperators';
+ $tab[26]['field'] = 'name';
+ $tab[26]['name'] = __('Operator');
+
+ $tab[27]['table'] = $this->getTable();
+ $tab[27]['field'] = 'phonenumber';
+ $tab[27]['name'] = __('Phone Number');
+
+ $tab[28]['table'] = $this->getTable();
+ $tab[28]['field'] = 'pin';
+ $tab[28]['name'] = __('Pin code');
+
+ $tab[29]['table'] = $this->getTable();
+ $tab[29]['field'] = 'puc';
+ $tab[29]['name'] = __('Puk code');
+
+ $tab[31]['table'] = 'glpi_states';
+ $tab[31]['field'] = 'completename';
+ $tab[31]['name'] = __('Status');
+
+ $tab[33]['table'] = 'glpi_locationss';
+ $tab[33]['field'] = 'name';
+ $tab[33]['name'] = __('Location');
+
+ $tab[49]['table'] = 'glpi_groups';
+ $tab[49]['field'] = 'completename';
+ $tab[49]['linkfield'] = 'groups_id_tech';
+ $tab[49]['name'] = __('Group in charge of the hardware');
+ $tab[49]['condition'] = '`is_assign`';
+
+ $tab[70]['table'] = 'glpi_users';
+ $tab[70]['field'] = 'name';
+ $tab[70]['name'] = __('User');
+
+ $tab[71]['table'] = 'glpi_groups';
+ $tab[71]['field'] = 'completename';
+ $tab[71]['name'] = __('Group');
+ $tab[71]['condition'] = '`is_itemgroup`';
+
+ $tab[80]['table'] = 'glpi_entities';
+ $tab[80]['field'] = 'completename';
+ $tab[80]['name'] = __('Entity');
+
+ $tab[90]['table'] = $this->getTable();
+ $tab[90]['field'] = 'notepad';
+ $tab[90]['name'] = __('Notes');
+ $tab[90]['massiveaction'] = false;
+
+ return $tab;
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git inc/simcardsize.class.php inc/simcardsize.class.php
new file mode 100644
index 0000000..b5f8965
--- /dev/null
+++ inc/simcardsize.class.php
@@ -0,0 +1,48 @@
+<?php
+/*
+ * @version $Id$
+ -------------------------------------------------------------------------
+ GLPI - Gestionnaire Libre de Parc Informatique
+ Copyright (C) 2003-2012 by the INDEPNET Development Team.
+
+ http://indepnet.net/ http://glpi-project.org
+ -------------------------------------------------------------------------
+
+ LICENSE
+
+ This file is part of GLPI.
+
+ GLPI is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GLPI is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
+ --------------------------------------------------------------------------
+ */
+
+// ----------------------------------------------------------------------
+// Original Author of file: Walid Nouh
+// Purpose of file:
+// ----------------------------------------------------------------------
+
+if (!defined('GLPI_ROOT')) {
+ die("Sorry. You can't access directly to this file");
+}
+
+/// Class Vlan
+class Simcardsize extends CommonDropdown {
+
+
+ static function getTypeName($nb=0) {
+ // Acronymous, no plural
+ return _n('Simcard size', 'Simcard sizes', $nb);
+ }
+}
+?>
\ No newline at end of file
diff --git inc/transfer.class.php inc/transfer.class.php
index 67233c3..77973cc 100644
--- inc/transfer.class.php
+++ inc/transfer.class.php
@@ -206,7 +206,7 @@ class Transfer extends CommonDBTM {
// Inventory Items : MONITOR....
$INVENTORY_TYPES = array('CartridgeItem', 'ConsumableItem', 'Monitor', 'NetworkEquipment',
- 'Peripheral', 'Phone', 'Printer', 'SoftwareLicense', );
+ 'Peripheral', 'Phone', 'Printer', 'SoftwareLicense', 'Simcard');
foreach ($INVENTORY_TYPES as $itemtype) {
$this->inittype = $itemtype;
@@ -293,13 +293,7 @@ class Transfer extends CommonDBTM {
function simulateTransfer($items) {
global $DB, $CFG_GLPI;
- // Init types :
- $types = array('CartridgeItem', 'Computer', 'ConsumableItem', 'Contact', 'Contract',
- 'Document', 'Link', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone',
- 'Printer', 'Problem', 'Software', 'SoftwareLicense', 'SoftwareVersion',
- 'Supplier', 'Ticket');
-
- foreach ($types as $t) {
+ foreach ($CFG_GLPI["transfer_types"] as $t) {
if (!isset($this->needtobe_transfer[$t])) {
$this->needtobe_transfer[$t] = array();
}
@@ -985,7 +979,7 @@ class Transfer extends CommonDBTM {
// Network connection ? keep connected / keep_disconnected / delete
if (in_array($itemtype, array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral',
- 'Phone', 'Printer'))) {
+ 'Phone', 'Printer', 'Simcard'))) {
$this->transferNetworkLink($itemtype, $ID, $newID, $ocs_computer);
}
diff --git install/mysql/glpi-0.84-empty.sql install/mysql/glpi-0.84-empty.sql
index fbb6278..5a1d3ba 100644
--- install/mysql/glpi-0.84-empty.sql
+++ install/mysql/glpi-0.84-empty.sql
@@ -3777,7 +3777,15 @@ CREATE TABLE `glpi_phonemodels` (
KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+### Dump table glpi_phoneoperators
+CREATE TABLE IF NOT EXISTS `glpi_phoneoperators` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `comment` text COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
### Dump table glpi_phonepowersupplies
DROP TABLE IF EXISTS `glpi_phonepowersupplies`;
@@ -4718,6 +4726,56 @@ INSERT INTO `glpi_rules` VALUES ('3','0','RuleMailCollector','3','Root','','OR',
INSERT INTO `glpi_rules` VALUES ('4','0','RuleMailCollector','1','Auto-Reply X-Auto-Response-Suppress','Exclude Auto-Reply emails using X-Auto-Response-Suppress header','AND','1',NULL,'2011-01-18 11:40:42','1');
INSERT INTO `glpi_rules` VALUES ('5','0','RuleMailCollector','2','Auto-Reply Auto-Submitted','Exclude Auto-Reply emails using Auto-Submitted header','AND','1',NULL,'2011-01-18 11:40:42','1');
+### Dump table glpi_simcards
+
+CREATE TABLE IF NOT EXISTS `glpi_simcards` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `phonenumber` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `serial` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `pin` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `puk` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `otherserial` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `states_id` int(11) NOT NULL DEFAULT '0',
+ `locations_id` int(11) NOT NULL DEFAULT '0',
+ `users_id` int(11) NOT NULL DEFAULT '0',
+ `users_id_tech` int(11) NOT NULL DEFAULT '0',
+ `groups_id` int(11) NOT NULL DEFAULT '0',
+ `groups_id_tech` int(11) NOT NULL DEFAULT '0',
+ `phoneoperators_id` int(11) NOT NULL DEFAULT '0',
+ `simcardsizes_id` int(11) NOT NULL DEFAULT '0',
+ `comment` text COLLATE utf8_unicode_ci,
+ `date_mod` datetime DEFAULT NULL,
+ `is_template` tinyint(1) NOT NULL DEFAULT '0',
+ `template_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `entities_id` int(11) NOT NULL DEFAULT '0',
+ `is_global` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`),
+ KEY `states_id` (`states_id`),
+ KEY `simcardsizes_id` (`states_id`),
+ KEY `pin` (`pin`),
+ KEY `puk` (`puk`),
+ KEY `imsi` (`serial`),
+ KEY `users_id` (`users_id`),
+ KEY `users_id_tech` (`users_id_tech`),
+ KEY `groups_id` (`groups_id`),
+ KEY `groups_id_tech` (`groups_id_tech`),
+ KEY `is_template` (`is_template`),
+ KEY `entities_id` (`entities_id`),
+ KEY `is_global` (`is_global`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+### Dump table glpi_simcardsizes
+
+CREATE TABLE IF NOT EXISTS `glpi_simcardsizes` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `comment` text COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
+
### Dump table glpi_slalevelactions
DROP TABLE IF EXISTS `glpi_slalevelactions`;
diff --git install/update_083_084.php install/update_083_084.php
index c666ae8..8a51eb5 100644
--- install/update_083_084.php
+++ install/update_083_084.php
@@ -1097,6 +1097,99 @@ function update083to084() {
}
regenerateTreeCompleteName("glpi_entities");
+ $migration->displayMessage(sprintf(__('Add simcard tables')));
+ if (!TableExists('glpi_simcards')) {
+ $query = "CREATE TABLE IF NOT EXISTS `glpi_simcards` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `entities_id` int(11) NOT NULL DEFAULT '0',
+ `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `phonenumber` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `serial` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `pin` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `puk` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `otherserial` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `states_id` int(11) NOT NULL DEFAULT '0',
+ `locations_id` int(11) NOT NULL DEFAULT '0',
+ `users_id` int(11) NOT NULL DEFAULT '0',
+ `users_id_tech` int(11) NOT NULL DEFAULT '0',
+ `groups_id` int(11) NOT NULL DEFAULT '0',
+ `groups_id_tech` int(11) NOT NULL DEFAULT '0',
+ `phoneoperators_id` int(11) NOT NULL DEFAULT '0',
+ `simcardsizes_id` int(11) NOT NULL DEFAULT '0',
+ `comment` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL,
+ `date_mod` datetime DEFAULT NULL,
+ `is_template` tinyint(1) NOT NULL DEFAULT '0',
+ `template_name` varchar(255) COLLATE utf8_unicode_ci NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`),
+ KEY `entities_id` (`entities_id`),
+ KEY `states_id` (`states_id`),
+ KEY `simcardsizes_id` (`states_id`),
+ KEY `pin` (`pin`),
+ KEY `puk` (`puk`),
+ KEY `serial` (`serial`),
+ KEY `users_id` (`users_id`),
+ KEY `users_id_tech` (`users_id_tech`),
+ KEY `groups_id` (`groups_id`),
+ KEY `groups_id_tech` (`groups_id_tech`),
+ KEY `is_template` (`is_template`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;";
+ $DB->queryOrDie($query, "0.84 add table glpi_simcards");
+ }
+
+ if (!TableExists("glpi_phoneoperators")) {
+ $query = "CREATE TABLE IF NOT EXISTS `glpi_phoneoperators` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `comment` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;";
+ $DB->queryOrDie($query, "0.84 add table glpi_phoneoperators");
+ }
+
+ if (!TableExists("glpi_simcardstates")) {
+ $query = "CREATE TABLE IF NOT EXISTS `glpi_simcardstates` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `comment` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
+ $DB->queryOrDie($query, "0.84 add table glpi_simcardstates");
+ }
+
+ if (!TableExists("glpi_simcardstates")) {
+ $query = "CREATE TABLE IF NOT EXISTS `glpi_simcardstates` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `comment` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
+ $DB->queryOrDie($query, "0.84 add table glpi_simcardstates");
+ }
+
+ if (!TableExists("glpi_simcardsizes")) {
+ $query = "CREATE TABLE IF NOT EXISTS `glpi_simcardsizes` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `comment` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `name` (`name`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
+ $DB->queryOrDie($query, "0.84 add table glpi_simcardstates");
+
+ $query = "INSERT INTO `glpi_simcardsizes` (`id`, `name`, `comment`) VALUES
+ (1, 'Full-SIM', ''),
+ (2, 'Micro-SIM', ''),
+ (3, 'Mini-SIM', '');";
+ }
+
+ if (!FieldExists("glpi_profiles", "simcard")) {
+ $migration->addField("glpi_profiles", 'simcard', "char");
+ }
+
// ************ Keep it at the end **************
//TRANS: %s is the table or item to migrate
$migration->displayMessage(sprintf(__('Data migration - %s'), 'glpi_displaypreferences'));
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev