pluginsGLPI / formcreator

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

User cannot see own tickets in simplified interface #3411

Closed fabriceverkor closed 1 year ago

fabriceverkor commented 1 year ago

Describe the bug Some tickets generated through Forms cannot be seen by requesters in their requested assistances of Self-service interface.

I can list them by SQL request below : SELECT from glpi_tickets where not exists (select from glpi_plugin_formcreator_issues where items_id=glpi_tickets.ID) AND is_deleted=0 AND solvedate IS NULL

They are to categories : 1- tickets generated by forms with several targets (2 ou 3 ticket targets). Most of them 2- tickets generated by form with a single target.

As explained in issue #3319, I used the command below : php bin/console plugins:formcreator:syncissues -> Step 1/2... OK. -> Step 2/2... OK. Done. It solved the problem for the tickets of second category above but not for the tickets of first category.

To Reproduce I could not reproduce the problem by using the concerned forms.

Expected behavior Users should see their assistance requests in self-service interface, meaning that a record corresponding to created tickets by forms should exist in glpi_plugin_formcreator_issues.

GLPI / Plugins (please complete the following information):

Desktop (please complete the following information):

Additional context

We upgraded to 10.0.10 on Monday 30th October. But in SQL request above, I can see tickets without corresponding record in glpi_plugin_formcreator_issues which created before , and with forms which several ticket targets.

Thanks for your help

btry commented 1 year ago

Hi

I think that your SQL query is wrong. If you use items_id, you must specify a criteria for itemtype. The query should be

SELECT from glpi_tickets where not exists (select from glpi_plugin_formcreator_issues where itemtype='Ticket' AND items_id=glpi_tickets.ID) AND is_deleted=0 AND solvedate IS NULL.

2nd point : if the form generated several tickets then the table glpi_plugin_formcreator_issues does not have any row for the tickets. Instead it has a row for the form answer.

You may find the tickets with query like

SELECT from glpi_tickets where not exists (select from glpi_plugin_formcreator_issues where itemtype='PluginFormcreatorFormAnswer' AND items_id=42) AND is_deleted=0 AND solvedate IS NULL.

42 should be replaced with a formanswer id. You may find it by finding the rows in glpi_items_tickets where tickets_id is the id of the ticket you don't find and itemtype is PluginFormcreatorFormAnswer.

fabriceverkor commented 1 year ago

Sorry for the mistake. So I guess the only problematic tickets (5 tickets) were those created with a form which has a single target and were fixed by the 'php bin/console plugins:formcreator:syncissues' command. The problem is much less significant then. But any idea why it happened ? Should I cronify a regular syncissues ?

btry commented 1 year ago

The sync issue command has to be used when there is a problem like yours.

Search instead if there are SQL or php errors at the datetime of creation of the missing tickets.

It is possible that a unreleased fix will address your problem. You may be interested to test the branch release/2.13.8 .

If you're not able to build the plugin, I may share a build. Just ask.

fabriceverkor commented 1 year ago

I found the following error in logs : [2023-10-30 11:58:10] glpiphplog.CRITICAL: *** Uncaught Exception Error: Undefined class constant 'ANONYMIZE_USE_GENERIC_USER' in /var/www/glpi/marketplace/formcreator/inc/issue.class.php at line 507 Backtrace : src/CommonDBTM.php:3789 PluginFormcreatorIssue->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() marketplace/formcreator/front/issue.php:68 Search::show()

The time correspond to opening date of a ticket having the pb. According to a post in GLPI forum, We had to update to 10.0.10, what I did the evening. It solved the problem above but problematic tickets remained unfixed.

So finaly, the good procedure is :

btry commented 1 year ago

Hi

An enhancement in Formcreator has been done to better support anonymization features of GLPI. This broke compatibility with older releases of GLPI 10.0.x. If I remember well, the minimum version of GLPI is 10.0.7. As you're using 10.0.10, this error should not occur anymore. To investigate deeper, you should find the version of Formcreator and GLPI at that date. I guess you had GLPI 10.0.6 or lower, with Formcreator 2.13.6 or later.

link: https://github.com/pluginsGLPI/formcreator/issues/3376