formcreator icon indicating copy to clipboard operation
formcreator copied to clipboard

Problem when previewing and displaying the form.

Open eleducq opened this issue 4 years ago • 23 comments

When previewing or displaying the user to fill in the form, only these fields appear. image

I have 8 different questions in my form, and I just tried to create a new blank one and I have the same problem. image

eleducq avatar Feb 09 '22 13:02 eleducq

Hi

Do you have errors in glpi/files/_log/php-errors.log or sql-errors.log (same folder) ?

Also, you can directly export the form into its JSON representation to let me try to reproduce.

btry avatar Feb 09 '22 13:02 btry

Here are the errors, which appear in the log file in question. image

And here is the json export of my form. export_formcreator_20220209_1638.zip

eleducq avatar Feb 09 '22 16:02 eleducq

Please, next time, copy / paste log with text. It is much more readable.

btry avatar Feb 09 '22 16:02 btry

Oh, yes sorry, I totally understand.

Here is the more readable version : `[2022-02-09 15:12:08] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to undefined method PluginFormcreatorForm::getFromDBByQuestion() in /var/www$ Backtrace : ...rmcreator/inc/field/dropdownfield.class.php:481 GlpiPlugin\Formcreator\Field\DropdownField->buildParams() ...ins/formcreator/inc/abstractfield.class.php:102 GlpiPlugin\Formcreator\Field\DropdownField->getRenderedHtml() plugins/formcreator/inc/question.class.php:300 PluginFormcreatorAbstractField->show() .../twig/twig/src/Extension/CoreExtension.php:1597 PluginFormcreatorQuestion->getRenderedHtml() ...f396b6e8ad8590e2032ef1b7dd8c618dceb54d8.php:200 twig_get_attribute() vendor/twig/twig/src/Template.php:394 __TwigTemplate_72dd827079aa661d49e0937e89753989fad0384f1dcac784876dccd0c0abd56c->doDisplay() vendor/twig/twig/src/Template.php:367 Twig\Template->displayWithErrorHandling() vendor/twig/twig/src/TemplateWrapper.php:47 Twig\Template->display() src/Application/View/TemplateRenderer.php:177 Twig\TemplateWrapper->display() plugins/formcreator/inc/form.class.php:1036 Glpi\Application\View\TemplateRenderer->display() plugins/formcreator/front/formdisplay.php:75 PluginFormcreatorForm->displayUserForm()

[2022-02-09 15:12:08] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to undefined method PluginFormcreatorForm::getFromDBByQuestion() in /var/www$ Backtrace : ...rmcreator/inc/field/dropdownfield.class.php:481 GlpiPlugin\Formcreator\Field\DropdownField->buildParams() ...ins/formcreator/inc/abstractfield.class.php:102 GlpiPlugin\Formcreator\Field\DropdownField->getRenderedHtml() plugins/formcreator/inc/question.class.php:300 PluginFormcreatorAbstractField->show() .../twig/twig/src/Extension/CoreExtension.php:1597 PluginFormcreatorQuestion->getRenderedHtml() ...f396b6e8ad8590e2032ef1b7dd8c618dceb54d8.php:200 twig_get_attribute() vendor/twig/twig/src/Template.php:394 __TwigTemplate_72dd827079aa661d49e0937e89753989fad0384f1dcac784876dccd0c0abd56c->doDisplay() vendor/twig/twig/src/Template.php:367 Twig\Template->displayWithErrorHandling() vendor/twig/twig/src/TemplateWrapper.php:47 Twig\Template->display() src/Application/View/TemplateRenderer.php:177 Twig\TemplateWrapper->display() plugins/formcreator/inc/form.class.php:1036 Glpi\Application\View\TemplateRenderer->display() plugins/formcreator/front/formdisplay.php:75 PluginFormcreatorForm->displayUserForm()

[2022-02-09 16:38:19] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to undefined method PluginFormcreatorForm::getFromDBByQuestion() in /var/www$ Backtrace : ...rmcreator/inc/field/dropdownfield.class.php:481 GlpiPlugin\Formcreator\Field\DropdownField->buildParams() ...ins/formcreator/inc/abstractfield.class.php:102 GlpiPlugin\Formcreator\Field\DropdownField->getRenderedHtml() plugins/formcreator/inc/question.class.php:300 PluginFormcreatorAbstractField->show() .../twig/twig/src/Extension/CoreExtension.php:1597 PluginFormcreatorQuestion->getRenderedHtml() ...f396b6e8ad8590e2032ef1b7dd8c618dceb54d8.php:200 twig_get_attribute() vendor/twig/twig/src/Template.php:394 __TwigTemplate_72dd827079aa661d49e0937e89753989fad0384f1dcac784876dccd0c0abd56c->doDisplay() vendor/twig/twig/src/Template.php:367 Twig\Template->displayWithErrorHandling() vendor/twig/twig/src/TemplateWrapper.php:47 Twig\Template->display() src/Application/View/TemplateRenderer.php:177 Twig\TemplateWrapper->display() plugins/formcreator/inc/form.class.php:1036 Glpi\Application\View\TemplateRenderer->display() plugins/formcreator/inc/form.class.php:548 PluginFormcreatorForm->displayUserForm() src/CommonGLPI.php:687 PluginFormcreatorForm::displayTabContentForItem() ajax/common.tabs.php:107 CommonGLPI::displayStandardTab() `

eleducq avatar Feb 09 '22 16:02 eleducq

It indicates an error line 218 in the file: dropdownfield.class.php

eleducq avatar Feb 09 '22 16:02 eleducq

I'll give you a quick patch, just a minute

btry avatar Feb 09 '22 16:02 btry

No worries, don't worry, I'm in no hurry ^^

eleducq avatar Feb 09 '22 16:02 eleducq

I'm a bit angry to see this error not happening for so long. Great thanks for testing the plugin

Below a link to a commit which adds the lost method. Append .diff to the URL to get the raw patch file. Use the patch tool to apply it to the plugin as usual.

https://github.com/pluginsGLPI/formcreator/commit/0aa8a1fe8f41c50b2da179882c5c972940d16864

btry avatar Feb 09 '22 16:02 btry

Ok, it's normal ^^ I'll come back to you tomorrow morning to confirm or not the fix for this, and thanks to you ^^

eleducq avatar Feb 09 '22 16:02 eleducq

Hi, I may have made a mistake when applying the bug, but it doesn't seem to correct my problem. It seems that I can't display my forms anymore.

eleducq avatar Feb 10 '22 07:02 eleducq

Hi

I may have made a mistake when applying the bug

I think you applied a fix, instead of a bug :)

If you applied the fix by hands this is the wrong and error prone way. You must use git or the patch tool to do it properly.

btry avatar Feb 10 '22 09:02 btry

Indeed it can come from there, what patching tools do you use?

eleducq avatar Feb 10 '22 09:02 eleducq

I use patch : https://man7.org/linux/man-pages/man1/patch.1.html

btry avatar Feb 10 '22 12:02 btry

Hello, I come back to you with a little delay, I applied your patch but it does not solve my problem and even prevents the display of forms on the administration side.

eleducq avatar Feb 18 '22 08:02 eleducq

Hi

formcreator_2.13.0-dev.zip

Remove your copy of the plugin and add this one instead. Let me know if this solve your problem.

btry avatar Feb 18 '22 09:02 btry

When installing the plugin with the command : php bin/console glpi:plugin:install formcreator -u glpi -f -p force-upgrade It ends with this error : Uncaught Exception Error: Callto undefined method DBConnection::getDefaultPrimaryKeySignOption() in /var/www/html/glpi/plugins/formcreator/install/upgrade_to_2.13.php at line 226

eleducq avatar Feb 18 '22 10:02 eleducq

I guess your copy of GLPI is not up to date. This method has been added approximatively 1 month ago.

btry avatar Feb 18 '22 10:02 btry

What do you mean by my GLPI is not up to date? I have the last version released on the repo of the GLPI project.

eleducq avatar Feb 18 '22 10:02 eleducq

You're probably using GLPI 10.0-beta. You need to upgrade to GLPI 10.0-rc1 or the latest revision of the master branch

btry avatar Feb 18 '22 10:02 btry

After migration to GLPI 10.0.0-rc1, and reinstallation of the formcreator that you have provided it still does not seem to correct my problem.

eleducq avatar Feb 18 '22 12:02 eleducq

I tried the export you shared here: https://github.com/pluginsGLPI/formcreator/issues/2582#issuecomment-1033940072

and the form looks complete. I see the last question of type file.

Check again your logs to see if you have some error.

btry avatar Feb 18 '22 13:02 btry

For you this method of correction works? I must be doing it wrong in this case...

eleducq avatar Feb 18 '22 15:02 eleducq

I suspected that you did not applied the patch properly. That's why I sent you a build. It contains the patch already as the problem was obvious (and someone else reported it 1 or 2 days ago).

As you still report the form is incomplete, then I need you to find php / sql errors to get a clue of where thigs go wrong.

You may also check the developer tools of the browser, and see when you reproduce the problem if you have bad HTTP response codes (>= 300)

btry avatar Feb 18 '22 15:02 btry