ericferon / glpi-archisw

GLPI plugin for application inventory
GNU General Public License v2.0
8 stars 5 forks source link

How to create additional dropdowns for Groups and Users #63

Closed karokarov closed 1 year ago

karokarov commented 1 year ago

Hello, we're planning to use your excellent plugin to maintain busines impact of the applications. image

For Owning Department and Business Owner fields we can use Groups and Users objects. The form displays dropdowns correctly but cannot save values. After save the field is still empty.

The configuration of the Owning department image

Please advice how to fix save function.

GLPI 10.0.6 Plugin v3.0.5

Thanks in advance.

ericferon commented 1 year ago

Hi, Sorry for the delay in my answer : I'm very busy for the moment. First remark : your field should be named plugin_archisw_icbc_owning_departments_id. This should be controlled by a rule created in my other plugin "Statecheck", and the controlled fields should be lined in red. I notice that I missed to mention this rule in the wiki, for own dropdown lists. In fact you need to create a dedicated class, linked to your custom field : PluginArchiswIcbcOwningDepartment (see section 12 in the wiki). This linked class must be defined "As a view on table" : glpi_groups, and with field "Is hierarchical dropdown" set to "Yes". K.r,

karokarov commented 12 months ago

Hi! After several attempts of configuring the dropdown according to the new instructions I unfortunately still have no success. My configuration looks like following: 1. Class: PluginArchiswIcbcOwningDepartment image For this class there is a view object automatically created in database image

2. The field: plugin_archisw_icbc_owning_departments_id Maybe join parameters should be filled, but I have no such experience so far, so your advice is much appreciated. image

3. The apps structure shows “Business owner department” field, but with no content or dropdown image

4. Php-errors.log sql-error.log files have some errors, but when I did clean experiment there were no new records in there. Just for the completeness put a screen with some older php-errors. image

GLPI ver is 10.0.6 Archisw ver is 3.0.10

ericferon commented 11 months ago

Hi, In the field definition, the "DB Field Type" should be filled, with "INT UNSIGNED". And the name should be "plugin_archisw_icbcowningdepartments_id". K.r,

ericferon commented 11 months ago

Can you check, via the menu Setup->Dropdowns->Statecheck rules->Tables, that the 3 entries glpi_plugin_archisw_configswfieldgroups, glpi_plugin_archisw_configswlinks and glpi_plugin_archisw_configsws contain, in their field "Frontname", an entry starting with "configsw" (and not only "config") ? This should fix the fact that, in your configuration screens, the fields are not controlled (that is, red-bordered). K.r,

karokarov commented 11 months ago

Hello, finally I managed to make it works in my home fresh environment. The reason of not working was incorrect field naming. Originally you recommended to name it plugin_archisw_icbc_owning_departments_id (see above comment from Jun 13). In my home environment I made brand new field plugin_archisw_icbcowningdepartments_id and it works like a charm. I made an experiment and renamed it to plugin_archisw_icbc_owning_departments_id - the field is always empty. Would be good to update wiki to avoid using extra underscores in field name.

Setup->Dropdowns->Statecheck rules->Tables in my case has no any 'archisw_configsw' tables. On Prod there are only: glpi_plugin_archisw_swcomponents, glpi_plugin_dataflows_dataflows At home I have 3 tables for BP and 3 tables for Dataflows . That is strange, because Prod and Home environments both have same plugins enabled - Apps structures, Dataflows and Business Processes.

Unfortunately I have completely loss my Test environment due to multiple reinstallation of the plugin (uninstall funstion is not actually do the uninstall, enabling the plugin works, but setup->Apps structure configuration gives "Table 'glpi.glpi_plugin_archisw_configsws' doesn't exist" error). Will do the refresh from prod and try to reproduce the successful configuration.

karokarov commented 11 months ago

I have completely loss my Test environment due to multiple reinstallation of the plugin (uninstall funstion is not actually do the uninstall, enabling the plugin works, but setup->Apps structure configuration gives "Table 'glpi.glpi_plugin_archisw_configsws' doesn't exist" error). Will do the refresh from prod and try to reproduce the successful configuration.

Seems I found the root cause of the issue. The plugin was installed into plugin folder (not using marketplace). And the owner was incorrectly set to root. php-errors.log contained the following record: image

After changing owner to the correct account, the field is displayed correctly.

karokarov commented 11 months ago

Can you check, via the menu Setup->Dropdowns->Statecheck rules->Tables, that the 3 entries glpi_plugin_archisw_configswfieldgroups, glpi_plugin_archisw_configswlinks and glpi_plugin_archisw_configsws contain, in their field "Frontname", an entry starting with "configsw" (and not only "config") ? This should fix the fact that, in your configuration screens, the fields are not controlled (that is, red-bordered). K.r,

The issue with permissions also affected this dropdowns. After plugin reinstallation three tables have been created. But "Frontname" for all three start with config - no 'sw' suffix.

Btw, can you give a hint, how to run installation scripts for already working plugin without complete cleanup (or maybe some hint on how to do backup/recovery on db level)? We have >70 apps structures in our prod environment already and it would be major disaster to lose all these configurations?

ericferon commented 11 months ago

The best way not to loose your work is to use install the plugin via the marketplace, and to update it when the marketplace suggest it. K.r,

ericferon commented 11 months ago

The issue with permissions also affected this dropdowns. After plugin reinstallation three tables have been created. But "Frontname" for all three start with config - no 'sw' suffix.

You should then change these 3 entries, in order to start with "configsw". K.r,