pluginsGLPI / formcreator

GLPI Plugin Formcreator (DOWNLOAD : https://github.com/pluginsGLPI/formcreator/releases)
http://www.teclib-edition.com
GNU General Public License v3.0
172 stars 125 forks source link

Show empty / object / Entity - Not working #1679

Closed netruner closed 4 years ago

netruner commented 4 years ago

Describe the bug The object - / object / Entity - does not show empty.

To Reproduce Steps to reproduce the behavior: 1 - Create question 2 - Select "Object GLPI" in type. 3 - Select "Administration - entity" on "Object GLPI". in Default values auto set default value to first in entity 4 - Select "Show empty" to YES 5 - ADD question. 6 - on preview is set first value in entity

Observer that does not come empty.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Zrzut ekranu 2020-02-12 23 49 55 Zrzut ekranu 2020-02-12 23 49 24

Version

GLPI 9.4.5 plugin version 2.9.1

Server

Operating system: Linux glpi 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 PHP 5.6.40-0+deb8u1 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apc, apcu, bcmath, bz2, calendar, ctype, curl, date, dba, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mhash, mysql, mysqli, openssl, pcre, pdo_mysql, posix, readline, session, shmop, snmp, soap, sockets, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, zip, zlib) Setup: max_execution_time="30" memory_limit="128M" post_max_size="50M" safe_mode="" session.save_handler="files" upload_max_filesize="51M" Software: Apache/2.4.25 (Debian) (Apache/2.4.25 (Debian) Server at helpdesk.usdk.pl Port 443) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15 Server Software: Debian 9.6 Server Version: 10.1.37-MariaDB-0+deb9u1 Server SQL Mode: Parameters: glpi@10.0.50.112/glpi Host info: 10.0.50.112 via TCP/IP mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed iconv extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed xml extension is installed ldap extension is installed imap extension is installed Zend OPcache extension is installed APCu extension is installed exif extension is installed xmlrpc extension is not present CAS extension is not present Database version seems correct (10.1.37) - Perfect! /var/www/glpi/files/_log : OK /var/www/glpi/config : OK /var/www/glpi/files : OK /var/www/glpi/files/_dumps : OK /var/www/glpi/files/_sessions : OK /var/www/glpi/files/_cron : OK /var/www/glpi/files/_graphs : OK /var/www/glpi/files/_lock : OK /var/www/glpi/files/_plugins : OK /var/www/glpi/files/_tmp : OK /var/www/glpi/files/_cache : OK /var/www/glpi/files/_rss : OK /var/www/glpi/files/_uploads : OK /var/www/glpi/files/_pictures : OK Web access to files directory is protected : OK

htmLawed version 1.2.4 in (/var/www/glpi/lib/htmlawed) phpmailer/phpmailer version 6.0.7 in (/var/www/glpi/vendor/phpmailer/phpmailer/src) simplepie/simplepie version 1.5.2 in (/var/www/glpi/vendor/simplepie/simplepie/library) tecnickcom/tcpdf version 6.2.26 in (/var/www/glpi/vendor/tecnickcom/tcpdf) michelf/php-markdown in (/var/www/glpi/vendor/michelf/php-markdown/Michelf) true/punycode in (/var/www/glpi/vendor/true/punycode/src) iamcal/lib_autolink in (/var/www/glpi/vendor/iamcal/lib_autolink) sabre/vobject in (/var/www/glpi/vendor/sabre/vobject/lib) zendframework/zend-cache in (/var/www/glpi/vendor/zendframework/zend-cache/src) zendframework/zend-i18n in (/var/www/glpi/vendor/zendframework/zend-i18n/src) zendframework/zend-serializer in (/var/www/glpi/vendor/zendframework/zend-serializer/src) monolog/monolog in (/var/www/glpi/vendor/monolog/monolog/src/Monolog) sebastian/diff in (/var/www/glpi/vendor/sebastian/diff/src) elvanto/litemoji in (/var/www/glpi/vendor/elvanto/litemoji/src) symfony/console in (/var/www/glpi/vendor/symfony/console) leafo/scssphp in (/var/www/glpi/vendor/leafo/scssphp/src) paragonie/random_compat in (/var/www/glpi/vendor/paragonie/random_compat/lib)

Plugins list

datainjection Name: Data injection Version: 2.7.1 State: Enabled fields Name: Dodatkowe pola Version: 1.10.2 State: Enabled formcreator Name: Form Creator Version: 2.9.1 State: Enabled fusioninventory Name: FusionInventory Version: 9.4+2.4 State: Enabled mod Name: GLPI Modifications Version: 1.3.0 State: Enabled moreticket Name: More ticket Version: 1.5.0 State: Enabled mydashboard Name: My Dashboard Version: 1.7.1 State: Not activated ocsinventoryng Name: OCS Inventory NG Version: 1.6.0 State: Enabled printercounters Name: Printer counters Version: 1.6.0 State: Not activated dashboard Name: Pulpit Version: 0.9.6 State: Enabled telegrambot Name: TelegramBot Version: 2.0.0 State: Enabled genericobject Name: Zarządzanie obiektami Version: 2.7.0 State: Enabled order Name: Zarządzanie zamówieniami Version: 2.4.0 State: Not activated

btry commented 4 years ago

Hi

Please check if the issue still occurs with the branch support/2.9.0. Us e a testing environment.

With this branch, I don't reproduce.

EDIT: I noticed that you set USDK as a default value. Please, ensure that the empty value appears when you open the list. The empty value us an entry with dashes "----"

netruner commented 4 years ago

I tried several versions, even the beta version

glpi-form

btry commented 4 years ago

Please try this patch and feedback: https://github.com/pluginsGLPI/formcreator/pull/1680

netruner commented 4 years ago

no change

Zrzut ekranu 2020-02-13 11 10 10

glpi-form-v_dev

btry commented 4 years ago

This is because you're expecting that the show empty value has an effect on the default value dropdown.

The default value dropdown is not a preview of the field in the form.

To see the show empty value setting in action you need to open the preview tab of the form. Don't forget to refresh the page with F5 because the preview tab is not automatically updated when you edit a qustion. It is refreshed when you add or delete a question.

netruner commented 4 years ago

In preview after refresh glpi-form-v_dev-in-prev

From user side glpi-form-v_dev-in-user

btry commented 4 years ago

I think I found the problem.

The empty value is displayed with dashes, and its value is zero (0). the lowest ID of items in DB is 1. However entity is an exception. It uses 0 as lowest ID, for the root entity.

The plugin delegates the display of the dropdown to GLPI, and I cannot force an other value for an empty item easily.

I'll try to handle this by manually define an empty entry with -1 as value.

btry commented 4 years ago

Hi

I updated the previous PR with a solution to properly handle an empty value for entities dropdown. Can you try it and feedback ?

btry commented 4 years ago

Hi

Do you have a feedback for updated fix #1680 ?

btry commented 4 years ago

Hi

The fix was validated working by an other user. I close this issue.