formcreator icon indicating copy to clipboard operation
formcreator copied to clipboard

Error creating a ticket using the last valid category

Open verdanatech-marcio opened this issue 6 months ago • 8 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Create a form with more than one question of the Dropdown List > ITIL Categories type.
  2. In the ticket target, use the last valid answer as the category.

Sometimes it categorizes correctly, but in many cases it is using the first category. Expected behavior Categorization with the answer of the last question of the Dropdown List type > ITIL Categories Screenshots If applicable, add screenshots to help explain your problem.

GLPI / Plugins (please complete the following information):

  • GLPI version
  • list of all plugins with their version (available in GLPI > Setup > General > tab System > bottom of the page)
Instruções de instalação e configuração
GLPI 10.0.18 ( => /home/marcio-local/public_html/verdanadesk)
Installation mode: GIT
Current language:pt_BR

Server
 
Operating system: Linux PEVTCMTVM001 6.1.0-33-arm64 #​1 SMP Debian 6.1.133-1 (2025-04-10) aarch64
PHP 8.2.28 fpm-fcgi (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bcmath, bz2, calendar, cgi-fcgi,
ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imap, intl, json, ldap, libxml,
mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_sqlite, posix, random, readline, redis, session, shmop, soap, sockets,
sodium, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="60" memory_limit="1024M" post_max_size="20M" safe_mode="" session.save_handler="files"
upload_max_filesize="16M"
disable_functions="pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,"

Software: Apache () Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15 Server Software: Debian 12 Server Version: 10.11.11-MariaDB-0+deb12u1 Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION Parameters: verdanadesk_marciolocal@localhost/verdanadesk_marciolocal Host info: Localhost via UNIX socket

PHP version (8.2.28) is supported. Sessions configuration is OK. Allocated memory is sufficient. mysqli extension is installed. Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter. curl extension is installed. gd extension is installed. intl extension is installed. zlib extension is installed. The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present. Database engine version (10.11.11) is supported. No files from previous GLPI version detected. The log file has been created successfully. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_cache has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_cron has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_dumps has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_graphs has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_lock has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_pictures has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_plugins has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_rss has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_sessions has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_tmp has been validated. Write access to /home/marcio-local/public_html/verdanadesk/../../files/_uploads has been validated.

Web server root directory configuration seems safe. Sessions configuration is secured. OS and PHP are relying on 64 bits integers. exif extension is installed. ldap extension is installed. openssl extension is installed. Following extensions are installed: bz2, Phar, zip. Zend OPcache extension is installed. Following extensions are installed: ctype, iconv, mbstring, sodium. Write access to /home/marcio-local/public_html/verdanadesk/marketplace has been validated. Timezones seems loaded in database.

GLPI constants
 
GLPI_ROOT: "/home/marcio-local/public_html/verdanadesk"
GLPI_CONFIG_DIR: "/home/marcio-local/public_html/verdanadesk/../../config"
GLPI_VAR_DIR: "/home/marcio-local/public_html/verdanadesk/../../files"
GLPI_MARKETPLACE_DIR: "/home/marcio-local/public_html/verdanadesk/marketplace"
GLPI_USE_CSRF_CHECK: "1"
GLPI_CSRF_EXPIRES: "7200"
GLPI_CSRF_MAX_TOKENS: "100"
GLPI_USE_IDOR_CHECK: "1"
GLPI_IDOR_EXPIRES: "7200"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["#^http://[^@:]+(:80)?(/.)?$#","#^https://[^@:]+(:443)?(/.)?$#","#^feed://[^@:]+(/.)?$#"]
GLPI_DISALLOWED_UPLOADS_PATTERN: "/\.(php\d|phar)$/i"
GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org"
GLPI_INSTALL_MODE: "GIT"
GLPI_NETWORK_MAIL: "[email protected]"
GLPI_NETWORK_SERVICES: "https://services.glpi-network.com"
GLPI_MARKETPLACE_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_TEXT_MAXSIZE: "4000"
GLPI_DOC_DIR: "/home/marcio-local/public_html/verdanadesk/../../files"
GLPI_CACHE_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_cache"
GLPI_CRON_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_cron"
GLPI_DUMP_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_dumps"
GLPI_GRAPH_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_graphs"
GLPI_LOCAL_I18N_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_locales"
GLPI_LOCK_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_lock"
GLPI_LOG_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_log"
GLPI_PICTURE_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_pictures"
GLPI_PLUGIN_DOC_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_plugins"
GLPI_RSS_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_rss"
GLPI_SESSION_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_sessions"
GLPI_TMP_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_tmp"
GLPI_UPLOAD_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_uploads"
GLPI_INVENTORY_DIR: "/home/marcio-local/public_html/verdanadesk/../../files/_inventories"
GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
GLPI_I18N_DIR: "/home/marcio-local/public_html/verdanadesk/locales"
GLPI_VERSION: "10.0.18"
GLPI_SCHEMA_VERSION: "10.0.18@d64066799f068b16ee973b377bdd13f984fe062a"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.4.0"
GLPI_YEAR: "2025"

Libraries
 
htmlawed/htmlawed version 1.2.14 in (/home/marcio-local/public_html/verdanadesk/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.8.0 in (/home/marcio-local/public_html/verdanadesk/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/home/marcio-local/public_html/verdanadesk/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.4.4 in (/home/marcio-local/public_html/verdanadesk/plugins/pdf/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/home/marcio-local/public_html/verdanadesk/vendor/michelf/php-markdown/Michelf)
true/punycode in (/home/marcio-local/public_html/verdanadesk/vendor/true/punycode/src)
iamcal/lib_autolink in (/home/marcio-local/public_html/verdanadesk/vendor/iamcal/lib_autolink)
sabre/dav in (/home/marcio-local/public_html/verdanadesk/vendor/sabre/dav/lib/DAV)
sabre/http in (/home/marcio-local/public_html/verdanadesk/vendor/sabre/http/lib)
sabre/uri in (/home/marcio-local/public_html/verdanadesk/vendor/sabre/uri/lib)
sabre/vobject in (/home/marcio-local/public_html/verdanadesk/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/home/marcio-local/public_html/verdanadesk/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/home/marcio-local/public_html/verdanadesk/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/home/marcio-local/public_html/verdanadesk/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/home/marcio-local/public_html/verdanadesk/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/home/marcio-local/public_html/verdanadesk/vendor/donatj/phpuseragentparser/src/UserAgent)
elvanto/litemoji in (/home/marcio-local/public_html/verdanadesk/vendor/elvanto/litemoji/src)
symfony/console in (/home/marcio-local/public_html/verdanadesk/vendor/symfony/console)
scssphp/scssphp in (/home/marcio-local/public_html/verdanadesk/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/home/marcio-local/public_html/verdanadesk/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/home/marcio-local/public_html/verdanadesk/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/home/marcio-local/public_html/verdanadesk/vendor/rlanvin/php-rrule/src)
ramsey/uuid in (/home/marcio-local/public_html/verdanadesk/vendor/ramsey/uuid/src)
psr/log in (/home/marcio-local/public_html/verdanadesk/vendor/psr/log/Psr/Log)
psr/simple-cache in (/home/marcio-local/public_html/verdanadesk/vendor/psr/simple-cache/src)
psr/cache in (/home/marcio-local/public_html/verdanadesk/vendor/psr/cache/src)
league/csv in (/home/marcio-local/public_html/verdanadesk/vendor/league/csv/src)
mexitek/phpcolors in (/home/marcio-local/public_html/verdanadesk/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/home/marcio-local/public_html/verdanadesk/plugins/calendarhub/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/home/marcio-local/public_html/verdanadesk/plugins/calendarhub/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/home/marcio-local/public_html/verdanadesk/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/home/marcio-local/public_html/verdanadesk/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/home/marcio-local/public_html/verdanadesk/vendor/paragonie/sodium_compat/src)
symfony/cache in (/home/marcio-local/public_html/verdanadesk/vendor/symfony/cache)
html2text/html2text in (/home/marcio-local/public_html/verdanadesk/vendor/html2text/html2text/src)
symfony/css-selector in (/home/marcio-local/public_html/verdanadesk/vendor/symfony/css-selector)
symfony/dom-crawler in (/home/marcio-local/public_html/verdanadesk/vendor/symfony/dom-crawler)
twig/twig in (/home/marcio-local/public_html/verdanadesk/vendor/twig/twig/src)
twig/string-extra in (/home/marcio-local/public_html/verdanadesk/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 not found
symfony/polyfill-php81 not found
symfony/polyfill-php82 in (/home/marcio-local/public_html/verdanadesk/vendor/symfony/polyfill-php82)
league/oauth2-client in (/home/marcio-local/public_html/verdanadesk/vendor/league/oauth2-client/src/Provider)
league/oauth2-google in (/home/marcio-local/public_html/verdanadesk/vendor/league/oauth2-google/src/Provider)
thenetworg/oauth2-azure in (/home/marcio-local/public_html/verdanadesk/vendor/thenetworg/oauth2-azure/src/Provider)
phpCas version 1.6.0 in (/usr/share/php/CAS/source)

Plugins list
 
remoteaccess         Name: Acesso Remoto                  Version: 2.0.0      State: Enabled
Install Method: Manual news Name: Alertas Version: 1.12.4 State: To update
Install Method: Manual applicationinterface Name: Application Interface Version: 1.2.0 State: Enabled
Install Method: Manual behaviors Name: Behaviours Version: 2.7.6.1 State: Enabled
Install Method: Manual archibp Name: Business Processes Version: 2.0.12 State: Not installed
Install Method: Manual calendarhub Name: Calendar Hub Version: 1.1.0 State: Enabled
Install Method: Manual fields Name: Campos adicionais Version: 1.21.18 State: Enabled
Install Method: Manual archimap Name: Diagrams Version: 3.3.7 State: Not installed
Install Method: Manual escalade Name: Escalonamento Version: 2.9.13 State: Not installed
Install Method: Manual formcreator Name: Form Creator Version: 2.13.10 State: Enabled
Install Method: Manual gantt Name: gantt Version: 1.1.0 State: Enabled
Install Method: Manual tag Name: Gerenciamento de Etiquetas Version: 2.12.3 State: To update
Install Method: Manual genericobject Name: Gerenciamento de objetos Version: 2.14.14 State: To update
Install Method: Manual glpiinventory Name: GLPI Inventory Version: 1.5.3 State: To update
Install Method: Manual datainjection Name: Importação de dados Version: 2.14.1 State: To update
Install Method: Manual pdf Name: Imprimir em PDF Version: 3.0.0 State: Enabled
Install Method: Manual kcs Name: KCS Version: 1.1.0 State: Enabled
Install Method: Manual seals Name: Lacres Version: 2.0.0 State: Not installed
Install Method: Manual singlesignon Name: Logon Único Version: 1.4.0 State: Enabled
Install Method: Manual mailanalyzer Name: Mail Analyzer Version: 3.2.2 State: To update
Install Method: Manual mreporting Name: Mais Relatórios Version: 1.8.7 State: Enabled
Install Method: Manual speedmeter Name: Medidor de Velocidades Version: 1.0.0 State: Enabled
Install Method: Manual messengerintegrator Name: Messenger Integrator Version: 2.10.0 State: Enabled
Install Method: Manual metabase Name: Metabase Version: 1.3.3 State: Enabled
Install Method: Manual moreactions Name: More Actions Version: 3.3.2 State: Enabled
Install Method: Manual oauthimap Name: Oauth IMAP Version: 1.4.3 State: Enabled
Install Method: Manual onebridge Name: One Bridge Version: 1.0.0 State: Enabled
Install Method: Manual pdfbuilder Name: PDFBuilder Version: 1.0.0 State: Enabled
Install Method: Manual utilsdashboards Name: Powerdash - Verdanatech Version: 2.3.0 State: To update
Install Method: Manual projectup Name: Project Up Version: 2.1.0 State: Enabled
Install Method: Manual sapreset Name: SAP Reset Version: 1.1.0 State: Enabled
Install Method: Manual vauth Name: Serviços de Autenticação Version: 3.1.3 State: Enabled
Install Method: Manual vservices Name: Serviços Gerenciados Version: 2.3.1 State: Enabled
Install Method: Manual skins Name: Skins Version: 3.5.0 State: Enabled
Install Method: Manual softwarehomologated Name: Software Homologados Version: 2.0.0 State: Not installed
Install Method: Manual tasklists Name: Tasks list Version: 2.0.4 State: Not installed
Install Method: Manual transferticketentity Name: TransferTicketEntity Version: 1.1.3 State: Enabled
Install Method: Manual vclone Name: vclone Version: 2.0.0 State: Not installed
Install Method: Manual vera Name: Vera Version: 1.8.1 State: To update
Install Method: Manual chat Name: Verdana Chat Version: 12.6.0 State: Enabled
Install Method: Manual vgmud Name: Verdanatech GMUD Version: 2.0.0 State: Enabled
Install Method: Manual vreports Name: vreports Version: 6.2.1 State: Enabled
Install Method: Manual vterm Name: Vterms Version: 1.0.0 State: Enabled
Install Method: Manual

Desktop (please complete the following information):
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

verdanatech-marcio avatar Jul 02 '25 17:07 verdanatech-marcio

Any answer ?

verdanatech-marcio avatar Jul 31 '25 12:07 verdanatech-marcio

Hi,

Could you describe a category tree structure and a minimal form which allows me to reproduce ? You may create a minimal form to export and share here, and describe a tree structure of a few categories (3 may be sufficient).

If your form and categories are in several entities, this might be important to successfully reproduce.

btry avatar Jul 31 '25 13:07 btry

Hello, I hope you have a good day!

Attached is an example of the form we are currently using. On this form, there are 4 drop-down list questions (Assistance - ITIL Categories).

Image

For the form's target, on the properties tab, under the "ITIL Category" option, I have selected the "last valid category" option.

Image

After submitting the form, the correct (last) category is not linked to the ticket.

export_formcreator_20250826_1406.json

Image

Verdanatech-Hitalo avatar Aug 26 '25 17:08 Verdanatech-Hitalo

Hi, after reviewing the code, here is a resume of its behavior:

  • find the questions of type dropdown, ordered by row and column (in your case, only row) descending

  • for each question found

    • skip if the question is not a itilcategory dropdown
    • skip if the answer is empty (in other words 0, null, empty string)
    • skip if the question is not visible
    • store the category ID of the question

then I think that for some reason the 3 last questions are skipped. The code is here: https://github.com/pluginsGLPI/formcreator/blob/develop/inc/abstractitiltarget.class.php#L288

Could you check the questions in the table glpi_plugin_formcreator_questions and the answers for one of your attempts in glpi_plugin_formcreator_answers ?

Do you have conditions to make some questions visible ? I guess that there are none, as they are rendered in the generated ticket.

btry avatar Sep 01 '25 07:09 btry

We've already reviewed the questions. The forms have over 200 questions, and we always use the last valid answer to categorize the tickets. In 99% of cases, it classifies correctly. However, some tickets are categorized with the first answer, which corresponds to level 1 categories that cannot be used in tickets. And the form answer still shows the wrong category.

verdanatech-marcio avatar Sep 25 '25 17:09 verdanatech-marcio

Hi

Do you have a testing environment where you coud do some tests ? Identify a case where the plugin fails. Try to fill again the form with the same user, located in the same entity as the failed case, and using the exact same answers. I would like to know if the failure is reproductible each time or if it occurs randomly.

After reproducting the problem, please check the files php-e"rrors.log and sql-errors.log. If there are errors related to your attempts, please share then.

btry avatar Sep 26 '25 07:09 btry

Hi, this happens in the production environment. It happens once every 100 calls, so it's very difficult to pinpoint the exact moment.

verdanatech-marcio avatar Dec 01 '25 19:12 verdanatech-marcio

Hi

As we are stuck to the real cases where the problem occurred, could you find the datetime of a badly generated ticket and isolate the logs in php-errors and sql-errors matching it ? I hope you still have the logs for these tickets.

btry avatar Dec 01 '25 19:12 btry