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 2023-03-14 12:02:41

truongxl
Member
Registered: 2023-03-14
Posts: 2

Genericobject with new fields: can't create/save new item

Hello,

I try to create a new object with some personnal fields but I get error. Hope to have your helps.

1) <GLPI_ROOT>/files/_plugins/genericobject/fields/flat.constant.php

<?php
global $GO_FIELDS, $LANG;
// CODE 2022
$GO_FIELDS['plugin_genericobject_code2022s_id']['name']       = $LANG['genericobject']['PluginGenericobjectFlat'][1];
$GO_FIELDS['plugin_genericobject_code2022s_id']['field']      = 'code2022';
$GO_FIELDS['plugin_genericobject_code2022s_id']['input_type'] = 'text';

// CADASTRE NUMERO
$GO_FIELDS['plugin_genericobject_cadastrenums_id']['name']       = $LANG['genericobject']['PluginGenericobjectFlat'][2];
$GO_FIELDS['plugin_genericobject_cadastrenums_id']['field']      = 'cadastrenum';
$GO_FIELDS['plugin_genericobject_cadastrenums_id']['input_type'] = 'text';

// ANNEE CONSTRUCTION
$GO_FIELDS['plugin_genericobject_anneeconstructions_id']['name']       = $LANG['genericobject']['PluginGenericobjectFlat'][3];
$GO_FIELDS['plugin_genericobject_anneeconstructions_id']['field']      = 'anneeconstruction';
$GO_FIELDS['plugin_genericobject_anneeconstructions_id']['input_type'] = 'date';


2) <GLPI_ROOT>/files/_plugins/genericobject/locales/flat/flat.en_GB.php
<?php
// Fields
$LANG['genericobject']['PluginGenericobjectFlat'][0]="flat";
$LANG['genericobject']['PluginGenericobjectFlat'][1]="Code 2022";
$LANG['genericobject']['PluginGenericobjectFlat'][2]="Cadastre number";
$LANG['genericobject']['PluginGenericobjectFlat'][3]="Year of construction";


3) I can't create and save new item from ASSET/Flat

I see errors in this file <GLPI_ROOT>/files/_log/php-errors.log

[2023-03-14 08:35:37] glpiphplog.CRITICAL:   *** Uncaught Exception Error: Class 'UNKNOWN' not found in <GLPI_ROOT>/plugins/genericobject/inc/object.class.php at line 910
  Backtrace :
  src/CommonDBTM.php:3789                            PluginGenericobjectObject->rawSearchOptions()
  src/Search.php:7884                                CommonDBTM->searchOptions()
  src/Search.php:7679                                Search::getOptions()
  src/Search.php:2763                                Search::getCleanedOptions()
  src/Search.php:2570                                Search::displayCriteria()
  src/Search.php:171                                 Search::showGenericSearch()
  plugins/genericobject/front/object.php:38          Search::show()

4) The system is based on:
- GLPI 10.0.6
- plugin Genericobject 2.14.1
- Debian 11.2

Offline

#2 2023-03-15 10:35:13

truongxl
Member
Registered: 2023-03-14
Posts: 2

Re: Genericobject with new fields: can't create/save new item

Hello,

If I create a new itemtype without personal fields, I can add new object with the default fields normally.

Do I miss something when I configure personal fields?

Thank you for your helps.

Offline

Board footer

Powered by FluxBB