From 627d91233c9693abb7638322fc28191a6bc8d4db Mon Sep 17 00:00:00 2001 From: Loic Benoit Date: Wed, 5 Sep 2018 16:30:14 -0400 Subject: [PATCH 1/4] Prevent duplication in search option indexes; fixes #176 1. Fixes errors : "Duplicate key # (field A/field B) in PluginGenericobjectFoo searchOptions!" 2. Fixes missing fields in dropdowns for objects created with GenericObjects. --- inc/object.class.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/inc/object.class.php b/inc/object.class.php index 8bdcfb8f..b8abb4db 100644 --- a/inc/object.class.php +++ b/inc/object.class.php @@ -760,6 +760,18 @@ function rawSearchOptions() { $index_exceptions = ['name' => 1, 'id' => 2, 'comment' => 16, 'date_mod' => 19, 'entities_id' => 80, 'is_recursive' => 86, 'notepad' => 90, 'date_creation' => 121]; + + // Don't use indexes blacklisted by other item types in plugin DataInjection. + $plugin = new Plugin(); + if ($plugin->isActivated("datainjection") + && class_exists('PluginDatainjectionCommonInjectionLib')) { + $blacklisted_indexes = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions( + get_called_class() //A class that extends PluginGenericobjectObject + ); + } else { + $blacklisted_indexes = []; + } + $index = 3; $options = []; @@ -771,6 +783,9 @@ function rawSearchOptions() { $table = getTableForItemType(get_called_class()); + // Prevent usage of reserved and blacklisted indexes + $taken_indexes = array_merge($index_exceptions, $blacklisted_indexes); + foreach (PluginGenericobjectSingletonObjectField::getInstance(get_called_class()) as $field => $values ) { @@ -787,14 +802,17 @@ function rawSearchOptions() { $currentindex = $index; if (isset($index_exceptions[$field])) { $currentindex = $index_exceptions[$field]; - } else if (in_array($currentindex, $index_exceptions)) { - //If this index is reserved, jump to next - $currentindex++; + } else { + //If this index is reserved, jump to next available one. + while (in_array($currentindex, $taken_indexes)) { + $currentindex++; + } } $option = [ 'id' => $currentindex, ]; + $taken_indexes[] = $option['id']; $item = new $this->objecttype->fields['itemtype']; From 749ae8dfebac56bd11b5794946fca831439183df Mon Sep 17 00:00:00 2001 From: nqb Date: Tue, 13 Feb 2018 10:47:42 +0100 Subject: [PATCH 2/4] Remove "Do not edit this file" --- objects/locale.tpl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/objects/locale.tpl b/objects/locale.tpl index b74683ef..9c4c3daf 100644 --- a/objects/locale.tpl +++ b/objects/locale.tpl @@ -25,8 +25,4 @@ @since 2009 ---------------------------------------------------------------------- */ -/** - * This file is automatically managed by genericobject plugin. Do not edit it ! - */ - $LANG['genericobject']['%%CLASSNAME%%'][0]="%%NAME%%"; From a07b5ad638abb019d07db8c49ff5f1fb8e1088ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 10 Sep 2018 10:20:49 +0200 Subject: [PATCH 3/4] Add Swedish locale --- locales/sv_SE.mo | Bin 0 -> 3031 bytes locales/sv_SE.po | 166 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 locales/sv_SE.mo create mode 100644 locales/sv_SE.po diff --git a/locales/sv_SE.mo b/locales/sv_SE.mo new file mode 100644 index 0000000000000000000000000000000000000000..183c49dcaed7a15ae34a9e3bacdf8804ba022beb GIT binary patch literal 3031 zcmZ{lOK)366vqczpoDiRkMcZ)QYXNTlTe}H5=0+Ko02|g+yV=P#=hh0iSM0pXU2BD zVgU=5NQebu15&yG_8>N}$bw3I0uUgv`KH$Fm^EcM@cO>fq1Ns0s2s zuk0!9-UfNS0f?XY5EqW;6OjGh1liwjM!W_-h3B6@{KVh5@H)3ZRE~Eq$niV^vd)XR zuwTc(N5D71J3tSzUhj^+e*|*;Uw~}?9e4=*1?2U2!6|;f59H?sFawW+Pl8{8r@$Y< zI=Byu@Om2LI(Q#s`%gixgKt6B_XiNN#CO2tcocVBN?cp4AIJJMPF@QpF(%fB=i~#j zMjhBUK3L=XaPr!$7q11^V$3L=c(Cq-6RC>_*Bc)X;Y8Z6J2=N24uYR!6y>9dx? zu&X?!s-=xeX{f@CI2vD)%$<_ykkl3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000..1bffab04 --- /dev/null +++ b/locales/sv_SE.po @@ -0,0 +1,166 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Johan Hörnqvist , 2018 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-06-22 13:21+0000\n" +"PO-Revision-Date: 2018-09-06 22:04+0000\n" +"Last-Translator: Johan Hörnqvist \n" +"Language-Team: Swedish (Sweden) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/sv_SE/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: sv_SE\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: front/type.php:38 front/object.php:33 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Typ av tillgång" + +#: front/type.form.php:73 front/familylist.php:33 front/familylist.php:41 +#: index.php:58 inc/object_item.class.php:109 inc/profile.class.php:39 +#: inc/type.class.php:289 inc/type.class.php:415 setup.php:193 +msgid "Objects management" +msgstr "Hantera tillgångar" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Attribut raderat" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Attribut tillagt" + +#: front/commondropdown.php:11 front/commontreedropdown.form.php:36 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Den begärda rullmenyn saknas" + +#: front/familylist.php:37 index.php:68 +msgid "Empty family" +msgstr "Tom familj" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Allmänt" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Tillgångar" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Inga typer har skapats ännu)" + +#: inc/field.class.php:64 +msgid "Fields associated with the object" +msgstr "Attribut kopplade till tillgången" + +#: inc/field.class.php:70 +msgid "Label" +msgstr "Etikett" + +#: inc/field.class.php:71 +msgid "Name in DB" +msgstr "Namn i DB" + +#: inc/field.class.php:126 +msgid "Add new field" +msgstr "Lägg till nytt attribut" + +#: inc/field.class.php:317 +msgid "Read-only field" +msgstr "Skrivskyddat attribut" + +#: inc/type.class.php:153 +msgid "Type name is missing" +msgstr "Typnamnet saknas" + +#: inc/type.class.php:159 +msgid "Type name must be longer" +msgstr "Typnamnet måste vara längre" + +#: inc/type.class.php:165 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Typnamnen 'attribut', 'objekt' och 'typ' är reserverade av systemet. Var vänlig välj ett annat namn." + +#: inc/type.class.php:172 +msgid "Type must start with a letter" +msgstr "Typnamnet måste börja med en bokstav" + +#: inc/type.class.php:179 +msgid "A type already exists with the same name" +msgstr "Typnamnet existerar redan" + +#: inc/type.class.php:376 inc/type.class.php:505 inc/typefamily.class.php:36 +msgid "Family of type of objects" +msgstr "Tillhör typfamilj" + +#: inc/type.class.php:466 +msgid "Internal identifier" +msgstr "Internt namn" + +#: inc/type.class.php:520 +msgid "Behaviour" +msgstr "Beteende" + +#: inc/type.class.php:539 +msgid "Network connections" +msgstr "Nätverksanslutningar" + +#: inc/type.class.php:543 +msgid "injection file plugin" +msgstr "Injection file plug-in" + +#: inc/type.class.php:545 +msgid "geninventorynumber plugin" +msgstr "Geninventorynumber plug-in" + +#: inc/type.class.php:546 +msgid "order plugin" +msgstr "Order plug-in" + +#: inc/type.class.php:547 +msgid "item's uninstallation plugin" +msgstr "Item's uninstallation plug-in" + +#: inc/type.class.php:548 +msgid "simcard plugin" +msgstr "Simcard plug-in" + +#: inc/type.class.php:700 +msgid "Regenerate files" +msgstr "Skapa filer på nytt" + +#: inc/type.class.php:713 +msgid "Link to other objects" +msgstr "Länka till andra tillgångar" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2017 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Kunde inte läsa in klass %1$s-" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2019 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Du har troligtvis skräpdata i databasen för denna plug-in och saknade filer i %1$s" + +#: inc/object.class.php:471 +msgid "Object preview" +msgstr "Förhandsgranska tillgång" + +#: inc/object.class.php:751 +msgid "You must configure rights to enable the preview" +msgstr "Du måste konfigurera rättigheter för att aktivera förhandsgranskning" From 819564c5195ff8b0ab7b9cf6400217f092f0265b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Mon, 10 Sep 2018 10:22:56 +0200 Subject: [PATCH 4/4] Add 2.6.2 version definition --- genericobject.xml | 4 ++++ setup.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/genericobject.xml b/genericobject.xml index 49326ddd..fbeaa1b0 100644 --- a/genericobject.xml +++ b/genericobject.xml @@ -24,6 +24,10 @@ Walid Nouh + + 2.6.2 + 9.3 + 2.6.1 9.3 diff --git a/setup.php b/setup.php index 82cdb3ab..0263e53a 100644 --- a/setup.php +++ b/setup.php @@ -35,7 +35,7 @@ ---------------------------------------------------------------------- */ -define ('PLUGIN_GENERICOBJECT_VERSION', '2.6.1'); +define ('PLUGIN_GENERICOBJECT_VERSION', '2.6.2'); // Minimal GLPI version, inclusive define("PLUGIN_GENERICOBJECT_MIN_GLPI", "9.3");