You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2020-11-26 17:00:50

falco2001
Member
Registered: 2016-02-11
Posts: 251

[SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Hello,
I read the doc https://glpi-plugins.readthedocs.io/en/ … index.html but I do not know where to put the file xxx.constant.php and the file xxx.fr_Fr.php because apparently the doc does not correspond to what is indicated in recent exchanges.
Unable to have custom fields? How to do ?
If I work in the fields.constant.php file it works but it's not ideal!
How to do ? Does generic object work in glpi 9.5.2, . Nothing in log
Thank you

Last edited by falco2001 (2020-12-03 13:59:08)

Offline

#2 2020-11-26 17:44:20

Jean-Christophe
Moderator
Registered: 2007-08-22
Posts: 734

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Hi,

When you created your custom object, a new folder was created on your server.
[GLPI Root Folder]/files/_plugins/genericobject/locales/[YourObject]/[yourobject].fr_FR.php is the locale file.

An existing folder may receive your custom field:
[GLPI Root Folder]/files/_plugins/genericobject/fields/[yourobject].constant.php contains your additionnal fields.

Be careful, your .constant.php file needs to be not closed by a ?>
There is a small error in the documentation, in the exemple file...

Have fun !

Offline

#3 2020-11-26 19:03:23

falco2001
Member
Registered: 2016-02-11
Posts: 251

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Hello and thank you
I had to create the biomedical folder in the local myself.
Moreover I don't have a?> At the end of the two files.
I copied the two files from the doc!
I don't see the fields added in "Adding a new field"

Note that has nothing to do with it! :
I also tried to add an entry (sortie_inventaires_exercices) in the field.constant.php file I can see it in "adding a field" that seems to work but it is not the normal operation! Moreover I do not understand why when adding the glpi_plugin_genericobject_glpis_sorties_inventaires_exercices` table is empty!

Offline

#4 2020-11-27 11:36:41

falco2001
Member
Registered: 2016-02-11
Posts: 251

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Hello,
in fact I had not seen the _plugin and I was working on plugin and not _plugin!
Sorry that actually works.
thank you so much

Offline

#5 2020-11-27 15:03:50

Jean-Christophe
Moderator
Registered: 2007-08-22
Posts: 734

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

falco2001 wrote:

Hello,
in fact I had not seen the _plugin and I was working on plugin and not _plugin!
Sorry that actually works.
thank you so much

Nice to hear that :-)

Maybe you should make sure your plugin folder is right.
If I were you, I would disable the plugin (NOT UNINSTALL), delete the /plugin/genericobject folder, reinstall it from the archive and reactivate the plugin in the setup. Just to be sure you do not build on something that will be erased next time you update the plugin.

Offline

#6 2020-12-01 17:05:59

falco2001
Member
Registered: 2016-02-11
Posts: 251

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Hello,
with this

inventaire.constant :
_________________________
<?php
global $GO_FIELDS, $LANG;

// Exercice
$GO_FIELDS['plugin_genericobject_exercice_id']['name']       = $LANG['genericobject']['PluginGenericobjectInventaire'][1];
$GO_FIELDS['plugin_genericobject_exercice_id']['field']      = 'exercice';
$GO_FIELDS['plugin_genericobject_exercice_id']['input_type'] = 'dropdown';

// Famille
$GO_FIELDS['plugin_genericobject_famille_id']['name']       = $LANG['genericobject']['PluginGenericobjectInventaire'][2];
$GO_FIELDS['plugin_genericobject_famille_id']['field']      = 'famille';
$GO_FIELDS['plugin_genericobject_famille_id']['input_type'] = 'text';

// Acquisition
$GO_FIELDS['plugin_genericobject_acquisition_id']['name']       = $LANG['genericobject']['PluginGenericobjectInventaire'][3];
$GO_FIELDS['plugin_genericobject_acquisition_id']['field']      = 'acquisition';
$GO_FIELDS['plugin_genericobject_acquisition_id']['input_type'] = 'date';


// Utile 
$GO_FIELDS['plugin_genericobject_utile_id']['name']       = $LANG['genericobject']['PluginGenericobjectInventaire'][4];
$GO_FIELDS['plugin_genericobject_utile_id']['field']      = 'utile';
$GO_FIELDS['plugin_genericobject_utile_id']['input_type'] = 'bool';

// Motif de sortie
$GO_FIELDS['plugin_genericobject_motifdesortie_id']['name']       = $LANG['genericobject']['PluginGenericobjectInventaire'][5];
$GO_FIELDS['plugin_genericobject_motifdesortie_id']['field']      = 'motifdesortie';
$GO_FIELDS['plugin_genericobject_motifdesortie_id']['input_type'] = 'multitext';

________________________________
et inventaire.fr_FR
$LANG['genericobject']['PluginGenericobjectInventaire'][1]="Exercice comptable";
$LANG['genericobject']['PluginGenericobjectInventaire'][2]="Famille";
$LANG['genericobject']['PluginGenericobjectInventaire'][3]="Date d'acquisition";
$LANG['genericobject']['PluginGenericobjectInventaire'][4]="Est-ce utile ?";
$LANG['genericobject']['PluginGenericobjectInventaire'][5]="Motif de sortie";

_________________________________

the inventory table contains all the data and the tables for exemple as utile and acquisitions are empty!

The structure of these are identical id, name, comment, date_mod, date_creation!
Is this a bug?
Normally we should have in the inventory table the id to the utile and acquisitions tables?

moreover the drop-down list no longer works, but it's a bug on github but it is not possible to add from list for exemple exercice_id. The botton add is not visible

Thank you

Last edited by falco2001 (2020-12-01 17:43:28)

Offline

#7 2020-12-03 13:59:40

falco2001
Member
Registered: 2016-02-11
Posts: 251

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Yes, you had to read the documentation!

The fields must be of the form xxxxxxx_s_id ..

I reset the code and the tables to zero! It's OK now !

Thanks to the developer for his very well done documentation ..

Offline

#8 2020-12-04 10:51:44

falco2001
Member
Registered: 2016-02-11
Posts: 251

Re: [SOLVED] GLPI 9.5.2 et generic object 2.9.1 : field not possible

Hello,
I would also like to make a 1 to N link. For example if I create a license object I would like to associate several computers with it. Did you find the solution?

Offline

Board footer

Powered by FluxBB