Dialog plus does not show multiple entrys via api
-
Hi Guys,
im trying to realize a ssh public key distribution system based on idoit. I do have some troubles concerning dialog plus fields though:
1. I created a custom dialog+ called "sshgroups" and filled it with values like DEV, TEST, QA and the likes
2. Created a custom category called "ssh" and put above "sshgroups" as a field inside
3. Used the Quick configuration wizard to put the custom category under Kontakte->Personen->ssh
4. Went into Kontakte->Personen and assigned some values in the sshgroups dialog plus to a random person e.g. "max mustermann" has values QA and DEV and TESTNow when i call cmdb.objects.read with params filter => {type => 53} i am able to loop through all the persons and get the objid of "max mustermann".
So when i now call cmdb.category.read with params objID => {id of max mustermann}, category => "C__CATG__CUSTOM_FIELD
S_SSH"i get the following datastructure for the dialog+ field:
'f_popup_c_1480604992331' => { 'identifier' => 'SSH_Groups', 'title_lang' => 'QA', 'const' => undef, 'title' => 'QA', 'id' => '21' },
In this structure only the first entry of the persons ssh group (QA) is shown. However i selected multiple groups QA and DEV and TEST.
Is there something i am missing about dialog plus fields? i can read all other kinds of fields with the method shown above, but with dialog+ i never get all the selected values in my data structure.EDIT: Forgot to mention. Im using JSON::RPC::Legacy::Client; with perl to query the api.
Thanks everybody for helping me out!
-
Hi beku,
Welcome to the i-doit forums!
I can confirm that you discovered a bug in the API add-on. While testing I found some more bugs for custom dialog+ fields and raised coresponding tickets in the developer's issue tracker. They will be resolved in one of the next releases. Thanks for the report!
Greetings,
Benjamin -
I also stumbled on the Issue myself with API 1.8.1
The API Shows the last element from the multiselect. The following steps reproduce the Error:-
Create Custom Category (Test)
-
Assign to an ObjectType (server)
-
Add Field Dialog+ (Multple Select)
-
Edit one Object From the Type and add multiple Values for TestField (TestData1, TestData2) ..
-
Call The Test-Category on the Object and The API delivers only the last Multivalue (TestData2).
I could get all the Multiselect values with the following Patch on
/src/classes/modules/cmdb/dao/category/global/isys_cmdb_dao_category_g_custom_fields.class.php 855,856c855,863 < $l_catentries[$i] < [$l_field_key] = $l_row['isys_catg_custom_fields_list__field_content']; --- > if (array_key_exists($l_field_key, $l_catentries[$i])) { > if (! is_array($l_catentries[$i][$l_field_key])) { > $l_catentries[$i][$l_field_key] = array($l_catentries[$i][$l_field_key]); > } > $l_catentries[$i][$l_field_key][] = $l_row['isys_catg_custom_fields_list__field_content']; > } else { > $l_catentries[$i][$l_field_key] = $l_row['isys_catg_custom_fields_list__field_content']; > } >
-
-
Nearly a year after i opened this issue , we updated to version 1.10.1 and the api plugin to 1.9 to see if we could finally use dialog+ fields. However now we stumbled upon a multitude of new bugs concerning dialog+ fields:
1. Undeletable Multivalue in GUI
Description:
Multiple Dialog+ selections will not be deleted in IDOIT gui.
How to reproduce:- We have the following Objecttype hierarchy in Quick configuration Wizard "Infrastruktur->Server".
- Added User Defined Category "Users"
- Under Users we have a Dialog+ field called SSH Groups (where we have Values like "QA", "Staging" etc.)
- Choose multiple SSH Groups->Save
- Try to delete all those SSH Groups->Save
- Values are not deleted
2. Output Bug Dialog+ via API
Description:
When calling cmdb.category.read on a custom category with dialog+ fields, the output of the json object is utterly bugged.How to reproduce:
- We have the following Objecttype hierarchy in Quick configuration Wizard "Infrastruktur->Server".
- Added User Defined Category "Users"
- Under Users we have a Dialog+ field called SSH Groups (where we have Values like "QA", "Staging" etc.)
- Call cmdb.category.read on it.
- Receive the following strange output:
shortened response:
{
"f_text_c_1455200871361": "agage",
"f_text_c_1455200573923": "test1",
"objID": "1378",
"f_text_c_1455200588403": "fsfs",
"id": "4257",
"f_text_c_1455200581454": "teshome",
"f_text_c_1455200835586": "ffa",
"f_popup_c_1480427993531": {
"identifier": "SSH_Groups"
}
},
{
"f_text_c_1455200871361": null,
"f_text_c_1455200573923": null,
"objID": "1378",
"f_text_c_1455200588403": null,
"id": "4257",
"f_text_c_1455200581454": null,
"f_text_c_1455200835586": null,
"f_popup_c_1480427993531": {
"identifier": "SSH_Groups",
"const": null,
"id": "12",
"title": "EDI",
"title_lang": "EDI"
}
}- As you can see the output contains two "datasets" and one has only empty fields except correct dialog+ info. The other has all fields filled correctly but no dialog+ info. This surely is not how its supposed to be…
3. When configuring Events to execute a Script. The "from" field in the changes section is wrong.
- Configure Events to execute an external script when saving datasets.
- in the script decode base64 and parse the json data
- look at changes->from field its always undef.
-
- Its no possible in 1.10 to have two different Dialog+ Fields with the same value. This was possible in 1.9 versions though.
To reproduce create 2 custom dialog+ fields. For example use "SSH User Groups" und "SSH Server Groups".
In "Dialog-Admin" -> "Custom Dialog+" try to enter the same value (e.g. QA) into both. This results in the following error:Error!
General error: Following values could not be saved because it would lead to duplicate entries: QA- Its possible to enter a numeric "0" into a dialog+ field via api but not via the administration ui.