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

Problem with condition on FormCreator #3424

Closed Olfa17 closed 12 months ago

Olfa17 commented 12 months ago

Hello,

I have a problem with FormCreator since last week. My SI department update the last version of GLPI (10.0.10) and last version of FormCreator (2.13.8) I have 5 questions on my form for an Issue and 5 for a request with conditions.

First question is:

If answer is "Issue", the second question is: Impact on Business Condition = Hidden unless if Issue on the first question

If answer is "Request", the second question is: processing time Condition = Hidden unless if Request on the first question

The Issue form works corretly, i didn't have problem with it, but the second question doesn't appear when the answer of the first question is "Request". I have 2 servers, one for Production, and second for Developpement. Both doesn't work with Request type "Request"

Do you have any idea where the problem might be coming from?

I created a new form and 3 questions, "Issue" works correctly, "Request" doesn't work

You can see on my screenshot the problem FormCreator - Issue FormCreator - Request

GLPI version 10.0.10 Plugin FormCreator 2.13.8

Windows 10 Chrome or Firefox

btry commented 12 months ago

Hi

I think your problem is related to this PR

You probably use french words to compare the "type of request" question. Use english (GB) words instead : Request and Incident, no matter the language used to design the form.

Unfortunately, I did not find a better solution to build the fix. The solution would be to change the role of the already existing language dropdown available in the form designer.

Olfa17 commented 12 months ago

Hi @btry

Thank you for your reply.

Yes i used french words which work correctly before 2.13.8. In the condition, i changed "Demande" by "Request", it works correctly now.

This bug is only on FormCreator, or for all of GLPI ? Because I have a lot of rules for my tickets, based on their title

Thank you

btry commented 12 months ago

This problem belongs to Formcreator only. I created internally a SQL query to identify easily where are the questions to fix. Here it is.

The query may return rows whenre show_value is empty. You can safely ignore those rows and focus on those who contain a value. It is possible to improve the query to show only rows with a non empty show_value different from Request and Incident

(
    select
        f1.id as form_id, f1.name as form_name, f1.name as item_name, c.*
    from
        glpi_plugin_formcreator_conditions c
        inner join glpi_plugin_formcreator_forms f1 on (c.items_id = f1.id)
    inner join glpi_plugin_formcreator_questions qt1 on (c.plugin_formcreator_questions_id = qt1.id)
    where
        c.itemtype = 'PluginFormcreatorForm'
        and qt1.fieldtype = "requesttype" 
)
union
(
    select
        f2.id as form_id, f2.name as form_name, glpi_plugin_formcreator_sections.name as item_name, c.*
    from
        glpi_plugin_formcreator_conditions c
        inner join glpi_plugin_formcreator_sections on c.items_id = glpi_plugin_formcreator_sections.id
        inner join glpi_plugin_formcreator_forms f2 on (glpi_plugin_formcreator_sections.plugin_formcreator_forms_id = f2.id)
    inner join glpi_plugin_formcreator_questions qt2 on (c.plugin_formcreator_questions_id = qt2.id)
    where
        c.itemtype = 'PluginFormcreatorSection'
        and qt2.fieldtype = "requesttype" 
)
union
(
    select
        f3.id as form_id, f3.name as form_name, glpi_plugin_formcreator_questions.name as item_name, c.*
    from
        glpi_plugin_formcreator_conditions c
        inner join glpi_plugin_formcreator_questions on glpi_plugin_formcreator_questions.id = c.items_id
        inner join glpi_plugin_formcreator_sections on glpi_plugin_formcreator_questions.plugin_formcreator_sections_id = glpi_plugin_formcreator_sections.id
        inner join glpi_plugin_formcreator_forms f3 on (glpi_plugin_formcreator_sections.plugin_formcreator_forms_id = f3.id)
    inner join glpi_plugin_formcreator_questions qt3 on (c.plugin_formcreator_questions_id = qt3.id)
    where
        c.itemtype = 'PluginFormcreatorQuestion'
        and qt3.fieldtype = "requesttype" 
)
union
(
    select
        f4.id as form_id, f4.name as form_name, tt1.name as item_name, c.*
    from
        glpi_plugin_formcreator_conditions c
        inner join glpi_plugin_formcreator_forms f4 on (c.items_id = f4.id)
        inner join glpi_plugin_formcreator_targettickets tt1 on (c.items_id = tt1.id)
    inner join glpi_plugin_formcreator_questions qt4 on (c.plugin_formcreator_questions_id = qt4.id)
    where
        c.itemtype = 'PluginFormcreatorTargetTicket'
        and qt4.fieldtype = "requesttype" 
)
union
(
    select
        f5.id as form_id, f5.name as form_name, tc1.name as item_name, c.*
    from
        glpi_plugin_formcreator_conditions c
        inner join glpi_plugin_formcreator_forms f5 on (c.items_id = f5.id)
        inner join glpi_plugin_formcreator_targetchanges tc1 on (c.items_id = tc1.id)
    inner join glpi_plugin_formcreator_questions qt5 on (c.plugin_formcreator_questions_id = qt5.id)
    where
        c.itemtype = 'PluginFormcreatorTargetChange'
        and qt5.fieldtype = "requesttype" 
)
union
(
    select
        f6.id as form_id, f6.name as form_name, tp1.name as item_name, c.*
    from
        glpi_plugin_formcreator_conditions c
        inner join glpi_plugin_formcreator_forms f6 on (c.items_id = f6.id)
        inner join glpi_plugin_formcreator_targetproblems tp1 on (c.items_id = tp1.id)
    inner join glpi_plugin_formcreator_questions qt6 on (c.plugin_formcreator_questions_id = qt6.id)
    where
        c.itemtype = 'PluginFormcreatorTargetProblem'
        and qt6.fieldtype = "requesttype" 
)
Olfa17 commented 12 months ago

Thank you, i copied your query

if i have another problem about that, i will use your query

Olfa17 commented 12 months ago

Solved by changed "Demande" by "Request" in condition on my form