Skip to content

Commit 2003590

Browse files
committed
Merge branch 'release/2.6.1'
2 parents 6a0dd68 + 83050ac commit 2003590

18 files changed

+68
-35
lines changed

genericobject.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
<short>
99
<fr><![CDATA[Faites l'inventaire de nouveaux types d'objets]]></fr>
1010
<en><![CDATA[Do the inventory of new, non-native object types]]></en>
11+
<cs><![CDATA[Inventarizace nových, nenativních typů objektů]]></cs>
1112
</short>
1213
<long>
1314
<fr><![CDATA[Ce plugin vous permet de faire l'inventaire de nouveaux types d'objets génériques, sans avoir à programmer. Generic Objects vous permet de créer ces nouveaux types, les champs disponibles pour ces types. Il est intégré à GLPi dans ses fonctionnalités mère (Helpdesk, réservation, gabarits, etc.). Generic Objects est compatible avec le plugin File Injection permettant l'injection des données.]]></fr>
1415
<en><![CDATA[This plugin allows you to do the inventory of new item types without having to code, it allows you to create those new item types, it allows type creation, manages available fields. Has full integration with the software (Helpdesk, loans, templates, etc.) It has support and connectivity for and with the File Injection plugin]]></en>
16+
<cs><![CDATA[Tento zásuvný modul umožňuje inventarizovat nové typy položek, aniž by bylo třeba programovat. Umožňuje vytvářet tyto nové typy položek, typů a spravovat kolonky, které budou k dispozici. Je plně začleněný do software (Služba podpory, zápůjčky, šablony, atd.) Má podporu a propojení pro a se zásuvným modulem Vkládání dat ze souboru]]></cs>
1517
</long>
1618
</description>
1719
<homepage>https://github.com/pluginsGLPI/genericobject</homepage>
@@ -22,6 +24,10 @@
2224
<author>Walid Nouh</author>
2325
</authors>
2426
<versions>
27+
<version>
28+
<num>2.6.1</num>
29+
<compatibility>9.3</compatibility>
30+
</version>
2531
<version>
2632
<num>2.6.0</num>
2733
<compatibility>9.3</compatibility>
@@ -109,6 +115,7 @@
109115
</version>
110116
</versions>
111117
<langs>
118+
<lang>cs_CZ</lang>
112119
<lang>fr_FR</lang>
113120
<lang>en_GB</lang>
114121
<lang>es_AR</lang>
@@ -129,6 +136,13 @@
129136
<tag>helpdesk</tag>
130137
<tag>loans</tag>
131138
</en>
139+
<cs>
140+
<tag>inventář</tag>
141+
<tag>objekty</tag>
142+
<tag>obecné</tag>
143+
<tag>službapodpory</tag>
144+
<tag>zápůjčky</tag>
145+
</cs>
132146
</tags>
133147
<license>GPL v2+</license>
134148
</root>

inc/profile.class.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function getProfilesFromDB($id, $config = true) {
179179
global $DB;
180180
$prof_datas = [];
181181
foreach (getAllDatasFromTable(getTableForItemType(__CLASS__),
182-
"`profiles_id`='" . $id . "'") as $prof) {
182+
['profiles_id' => $id]) as $prof) {
183183
if ($prof['right'] != "" || $config) {
184184
$prof_datas[$prof['itemtype']] = $prof['right'];
185185
$prof_datas[$prof['itemtype'].'_open_ticket'] = $prof['open_ticket'];
@@ -381,8 +381,8 @@ static function install(Migration $migration) {
381381
if (preg_match("/PluginGenericobject(.*)/", $right['itemtype'], $results)) {
382382
$newrightname = 'plugin_genericobject_'.strtolower($results[1]).'s';
383383
if (!countElementsInTable('glpi_profilerights',
384-
"`profiles_id`='".$right['profiles_id']."'
385-
AND `name`='$newrightname'")) {
384+
['profiles_id' => $right['profiles_id'],
385+
'name' => $newrightname])) {
386386
switch ($right['right']) {
387387
case null:
388388
case '':
@@ -401,8 +401,8 @@ static function install(Migration $migration) {
401401
'rights' => $rightvalue]);
402402

403403
if (!countElementsInTable('glpi_profilerights',
404-
"`profiles_id`='".$right['profiles_id']."'
405-
AND `name`='plugin_genericobject_types'")) {
404+
['profiles_id' => $right['profiles_id'],
405+
'name' => 'plugin_genericobject_types'])) {
406406
$profileRight->add(['profiles_id' => $right['profiles_id'],
407407
'name' => 'plugin_genericobject_types',
408408
'rights' => 23]);
@@ -428,8 +428,7 @@ static function install(Migration $migration) {
428428
}
429429
//$migration->dropTable('glpi_plugin_genericobject_profiles');
430430
}
431-
if (!countElementsInTable('glpi_profilerights',
432-
"`name` LIKE '%genericobject%'")) {
431+
if (!countElementsInTable('glpi_profilerights', ['name' => ['LIKE', '%genericobject%']])) {
433432
self::createFirstAccess();
434433
}
435434
}

inc/type.class.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function prepareInputForAdd($input) {
175175
$input['name'] = self::filterInput($input['name']);
176176

177177
//Name must not be present in DB
178-
if (countElementsInTable(getTableForItemType(__CLASS__), "`name`='".$input['name']."'")) {
178+
if (countElementsInTable(getTableForItemType(__CLASS__), ['name' => $input['name']])) {
179179
Session::addMessageAfterRedirect(__("A type already exists with the same name", "genericobject"), ERROR, true);
180180
return [];
181181
} else {
@@ -940,7 +940,7 @@ public static function addTable($itemtype) {
940940
PRIMARY KEY ( `id` ),
941941
KEY `date_mod` (`date_mod`),
942942
KEY `date_creation` (`date_creation`)
943-
) ENGINE = MYISAM COMMENT = '$itemtype' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
943+
) ENGINE = InnoDB COMMENT = '$itemtype' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
944944
$DB->query($query);
945945

946946
$query = "INSERT INTO `glpi_displaypreferences` (`id`, `itemtype`, `num`, `rank`, `users_id`) " .
@@ -970,7 +970,7 @@ public static function addItemsTable($itemtype) {
970970
KEY `date_mod` (`date_mod`),
971971
KEY `date_creation` (`date_creation`),
972972
KEY `item` (`itemtype`,`items_id`)
973-
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
973+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
974974
$DB->query($query);
975975
}
976976

@@ -1249,7 +1249,7 @@ static function checkClassAndFilesForOneItemType($itemtype, $name, $overwrite =
12491249
if ($DB->tableExists($table) && ($overwrite || !class_exists($itemtype))) {
12501250
self::addNewObject($name, $itemtype, ['add_table' => false,
12511251
'create_default_profile' => false,
1252-
'add_injection_file' => false,
1252+
'add_injection_file' => $overwrite,
12531253
'add_language_file' => false,
12541254
'overwrite_locales' => $overwrite_locales ]);
12551255
}
@@ -1373,7 +1373,7 @@ public static function addDropdownTable($table, $options = []) {
13731373
KEY `date_mod` (`date_mod`),
13741374
KEY `date_creation` (`date_creation`),
13751375
KEY `name` (`name`)
1376-
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
1376+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
13771377
$DB->query($query);
13781378
}
13791379
if ($params['entities_id']) {
@@ -1596,7 +1596,7 @@ static function getClassByName($name) {
15961596

15971597
static function getFamilyNameByItemtype($itemtype) {
15981598
$types = getAllDatasFromTable("glpi_plugin_genericobject_types",
1599-
"`itemtype`='$itemtype' AND `is_active`='1'");
1599+
['itemtype' => $itemtype, 'is_active' => 1]);
16001600
if (empty($types)) {
16011601
return false;
16021602
} else {
@@ -1642,7 +1642,7 @@ static function getTypes($all = false) {
16421642
$table = getTableForItemType(__CLASS__);
16431643
if ($DB->tableExists($table)) {
16441644
$mytypes = [];
1645-
foreach (getAllDatasFromTable($table, (!$all?" is_active=" . self::ACTIVE:""), 'false', 'name') as $data) {
1645+
foreach (getAllDatasFromTable($table, (!$all ? ['is_active' => self::ACTIVE] : []), false, 'name') as $data) {
16461646
//If class is not present on the filesystem, do not list itemtype
16471647
$mytypes[$data['itemtype']] = $data;
16481648
}
@@ -1661,7 +1661,7 @@ static function getTypesByFamily($all = false) {
16611661
$table = getTableForItemType(__CLASS__);
16621662
if ($DB->tableExists($table)) {
16631663
$mytypes = [];
1664-
foreach (getAllDatasFromTable($table, (!$all?" is_active=" . self::ACTIVE:"")) as $data) {
1664+
foreach (getAllDatasFromTable($table, (!$all ? ['is_active' => self::ACTIVE] : [])) as $data) {
16651665
//If class is not present on the filesystem, do not list itemtype
16661666
if (file_exists(GENERICOBJECT_CLASS_PATH."/".$data['name'].".class.php")) {
16671667
$mytypes[$data['plugin_genericobject_typefamilies_id']][$data['itemtype']] = $data;
@@ -1981,7 +1981,7 @@ static function install(Migration $migration) {
19811981
`linked_itemtypes` text NULL,
19821982
`plugin_genericobject_typefamilies_id` INT( 11 ) NOT NULL DEFAULT 0,
19831983
PRIMARY KEY ( `id` )
1984-
) ENGINE = MYISAM COMMENT = 'Object types definition table' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
1984+
) ENGINE = InnoDB COMMENT = 'Object types definition table' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
19851985
$DB->query($query) or die($DB->error());
19861986
}
19871987

@@ -2050,8 +2050,7 @@ static function install(Migration $migration) {
20502050
14 => 10, 15 => 11];
20512051
foreach ($prefs as $num => $rank) {
20522052
if (!countElementsInTable("glpi_displaypreferences",
2053-
"`itemtype`='".__CLASS__."' AND `num`='$num'
2054-
AND `users_id`='0'")) {
2053+
['itemtype' => __CLASS__, 'num' => $num, 'users_id' => 0])) {
20552054
$preference = new DisplayPreference();
20562055
$tmp['itemtype'] = __CLASS__;
20572056
$tmp['num'] = $num;

inc/typefamily.class.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static function install(Migration $migration) {
5050
PRIMARY KEY (`id`),
5151
KEY `date_mod` (`date_mod`),
5252
KEY `date_creation` (`date_creation`)
53-
) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
53+
) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
5454
$DB->query($query) or die($DB->error());
5555
}
5656
}
@@ -87,8 +87,12 @@ static function getFamilies() {
8787

8888

8989
static function getItemtypesByFamily($families_id) {
90-
return getAllDatasFromTable('glpi_plugin_genericobject_types',
91-
"plugin_genericobject_typefamilies_id='$families_id'
92-
AND is_active='1'");
90+
return getAllDatasFromTable(
91+
'glpi_plugin_genericobject_types',
92+
[
93+
'plugin_genericobject_typefamilies_id' => $families_id,
94+
'is_active' => 1
95+
]
96+
);
9397
}
9498
}

locales/es_ES.mo

0 Bytes
Binary file not shown.

locales/es_ES.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgstr ""
1010
"Report-Msgid-Bugs-To: \n"
1111
"POT-Creation-Date: 2018-06-22 13:21+0000\n"
1212
"PO-Revision-Date: 2017-12-13 13:22+0000\n"
13-
"Last-Translator: Alexandre Delaunay <delaunay.alexandre@gmail.com>\n"
13+
"Last-Translator: alexandre delaunay <delaunay.alexandre@gmail.com>\n"
1414
"Language-Team: Spanish (Spain) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/es_ES/)\n"
1515
"MIME-Version: 1.0\n"
1616
"Content-Type: text/plain; charset=UTF-8\n"

locales/fr_FR.mo

-38 Bytes
Binary file not shown.

locales/fr_FR.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# This file is distributed under the same license as the PACKAGE package.
44
#
55
# Translators:
6-
# Alexandre Delaunay <delaunay.alexandre@gmail.com>, 2017
6+
# alexandre delaunay <delaunay.alexandre@gmail.com>, 2017
7+
# Cédric Anne, 2018
78
# Manu1400 <ehaguet@teclib.com>, 2016
89
# Johan Cwiklinski <jcwiklinski@teclib.com>, 2016-2017
910
# Le Rohellec Benoit <blerohellec@hotmail.com>, 2015
@@ -13,8 +14,8 @@ msgstr ""
1314
"Project-Id-Version: GLPI Plugin - Genericobject\n"
1415
"Report-Msgid-Bugs-To: \n"
1516
"POT-Creation-Date: 2018-06-22 13:21+0000\n"
16-
"PO-Revision-Date: 2017-12-13 13:24+0000\n"
17-
"Last-Translator: Alexandre Delaunay <delaunay.alexandre@gmail.com>\n"
17+
"PO-Revision-Date: 2018-07-23 08:33+0000\n"
18+
"Last-Translator: Cédric Anne\n"
1819
"Language-Team: French (France) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/fr_FR/)\n"
1920
"MIME-Version: 1.0\n"
2021
"Content-Type: text/plain; charset=UTF-8\n"
@@ -109,7 +110,7 @@ msgstr "Famille"
109110

110111
#: inc/type.class.php:466
111112
msgid "Internal identifier"
112-
msgstr "Indentifiant interne"
113+
msgstr "Identifiant interne"
113114

114115
#: inc/type.class.php:520
115116
msgid "Behaviour"

locales/pl_PL.mo

0 Bytes
Binary file not shown.

locales/pl_PL.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgstr ""
1010
"Report-Msgid-Bugs-To: \n"
1111
"POT-Creation-Date: 2018-06-22 13:21+0000\n"
1212
"PO-Revision-Date: 2017-12-13 13:22+0000\n"
13-
"Last-Translator: Alexandre Delaunay <delaunay.alexandre@gmail.com>\n"
13+
"Last-Translator: alexandre delaunay <delaunay.alexandre@gmail.com>\n"
1414
"Language-Team: Polish (Poland) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/pl_PL/)\n"
1515
"MIME-Version: 1.0\n"
1616
"Content-Type: text/plain; charset=UTF-8\n"

locales/pt_BR.mo

0 Bytes
Binary file not shown.

locales/pt_BR.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgstr ""
1111
"Report-Msgid-Bugs-To: \n"
1212
"POT-Creation-Date: 2018-06-22 13:21+0000\n"
1313
"PO-Revision-Date: 2017-12-13 13:22+0000\n"
14-
"Last-Translator: Alexandre Delaunay <delaunay.alexandre@gmail.com>\n"
14+
"Last-Translator: alexandre delaunay <delaunay.alexandre@gmail.com>\n"
1515
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/pt_BR/)\n"
1616
"MIME-Version: 1.0\n"
1717
"Content-Type: text/plain; charset=UTF-8\n"

locales/ro_RO.mo

0 Bytes
Binary file not shown.

locales/ro_RO.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgstr ""
1010
"Report-Msgid-Bugs-To: \n"
1111
"POT-Creation-Date: 2018-06-22 13:21+0000\n"
1212
"PO-Revision-Date: 2017-12-13 13:22+0000\n"
13-
"Last-Translator: Alexandre Delaunay <delaunay.alexandre@gmail.com>\n"
13+
"Last-Translator: alexandre delaunay <delaunay.alexandre@gmail.com>\n"
1414
"Language-Team: Romanian (Romania) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/ro_RO/)\n"
1515
"MIME-Version: 1.0\n"
1616
"Content-Type: text/plain; charset=UTF-8\n"

locales/ru_RU.mo

0 Bytes
Binary file not shown.

locales/ru_RU.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgstr ""
1111
"Report-Msgid-Bugs-To: \n"
1212
"POT-Creation-Date: 2018-06-22 13:21+0000\n"
1313
"PO-Revision-Date: 2017-12-13 13:22+0000\n"
14-
"Last-Translator: Alexandre Delaunay <delaunay.alexandre@gmail.com>\n"
14+
"Last-Translator: alexandre delaunay <delaunay.alexandre@gmail.com>\n"
1515
"Language-Team: Russian (Russia) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/ru_RU/)\n"
1616
"MIME-Version: 1.0\n"
1717
"Content-Type: text/plain; charset=UTF-8\n"

objects/objectinjection.class.tpl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,26 @@ class %%INJECTIONCLASS%% extends %%CLASSNAME%%
7070
return $lib->getInjectionResults();
7171
}
7272

73+
/**
74+
* Get search options formatted for injection mapping usage in datainjection plugin.
75+
*
76+
* @return array
77+
*/
7378
function getOptions($primary_type = '') {
74-
$parent = get_parent_class($this);
75-
$parentclass = new $parent();
76-
return $parentclass->getObjectSearchOptions(true);
79+
$plugin = new Plugin();
80+
if (!$plugin->isActivated('datainjection')) {
81+
return [];
82+
}
83+
84+
return PluginDatainjectionCommonInjectionLib::addToSearchOptions(
85+
Search::getOptions(get_parent_class($this)),
86+
[
87+
'ignore_fields' => PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(
88+
get_parent_class($this)
89+
),
90+
],
91+
$this
92+
);
7793
}
7894

7995
}

setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
----------------------------------------------------------------------
3636
*/
3737

38-
define ('PLUGIN_GENERICOBJECT_VERSION', '2.6.0');
38+
define ('PLUGIN_GENERICOBJECT_VERSION', '2.6.1');
3939

4040
// Minimal GLPI version, inclusive
4141
define("PLUGIN_GENERICOBJECT_MIN_GLPI", "9.3");

0 commit comments

Comments
 (0)