Open leecheromerevilit opened 3 years ago
Hi
There is no setting for now to customize this quantity.
If someone wants to develop a feature, this should be a new tab in personal settings with a HTML input (ordropdown ?) to choose the limit.
In the version 2.11 or later you can customize by editing a default value in some methods. It will apply for everyone as an hardcoded value.
https://github.com/pluginsGLPI/formcreator/blob/develop/inc/form.class.php#L1076
Hi
In the function getMyLastAnswersAsValidator on formanswer.class.php, is there any way I can use similar MySQL query "ORDER BY FIELD" to hardcode the desired sorting order using formanswer status?
This code works on DB from the SQL generated on DEBUG mode.
ORDER BY FIELD(glpi_plugin_formcreator_formanswers
.status
, "101", "103", "102", "100")
Regards,
Hi
As far as I know, the query builder in GLPI does not support this syntax. You can use a QueryExpression object (provided by GLPI Core)
Something like the following should work. Replace the ORDER key in the array with this (I did not tested it:
'ORDER' => new QueryExpression("FIELD ($formAnswerTable.status, '101', '103', '102', 100')"),
You may read the unit tests of GLPI 9.5 to see if there is an example for this specific syntax, and read glpi/inc/dbmysqliterator.class.php method handleOrderClause() .
Hi
Thanks for a detailed response. I will surely provide my feedback after I get it to work.
Is your feature request related to a problem? Please describe. Currently the order of last 5 forms are DESC, is it possible to customize this by value?
Describe the solution you'd like In mysql, we can specify the order using Order By Field, is this possible in the plugin?