Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forms lost approver + Permission issue forms display after GLPI and forms update #997

Closed
flo1994 opened this issue May 15, 2018 · 39 comments · Fixed by #1059
Closed

Forms lost approver + Permission issue forms display after GLPI and forms update #997

flo1994 opened this issue May 15, 2018 · 39 comments · Fixed by #1059
Assignees
Labels

Comments

@flo1994
Copy link

flo1994 commented May 15, 2018

previous GLPI version: 9.1.2
previous forms Version: 2.5.2
GLPI version updated to version 9.2.3
Forms updated to 2.6.3

All forms created in the past have lost the form approver.

formulargenehmiger

In addition, these forms can no longer be displayed with the "Super Admin" profile. This profile no longer has permissions for this.

In addition, there is the problem that within a ticket, the direct link to the form no longer works.
forms link

@btry
Copy link
Collaborator

btry commented May 15, 2018

Hi

these forms can no longer be displayed with the "Super Admin" profile

There is already an issue about this, and a patch is pending. (#996)

About your upgrade issue, please try to upgrade from 2.5.2 to the next release, and repeat until you reach the version 2.6.3 OR you observe the loss of information. This means you need to check after each upgrade if the approver is still there, and from which version it is lost.

@btry btry added this to the 2.6.4 milestone May 15, 2018
@btry btry added the bug label May 15, 2018
@btry btry self-assigned this May 15, 2018
@btry
Copy link
Collaborator

btry commented May 22, 2018

Hi

Any feedback ?

@Armin83
Copy link
Contributor

Armin83 commented Jun 14, 2018

So again :)
Go back to 9.1.2 / 2.5.2 (mariadb) - all fine
Upgrade to 9.2.3
Install 2.6.0
Upgrade 2.6.0
& activate --> Missing validator in the history.

migration_to_2.6.0.log

2018-06-14 21:37:59 [2@glpidev]
0 Sekunden for "create database schema" @ 2018-06-14 21:37:59 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.5" @ 2018-06-14 21:38:01 [2@glpidev]
2 Sekunden for "Upgrade glpi_plugin_formcreator_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_categories" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_profiles" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_validators" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_headers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_issues" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions_conditions" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_sections" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targets" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges_actors" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets_actors" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_titles" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.6" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "Configure existing entities" @ 2018-06-14 21:38:01 [2@glpidev]
0 Sekunden for "create request type" @ r

sql-errors.log

2018-06-14 21:38:01 [2@glpidev]
*** MySQL query error:
SQL:

SELECT COUNT(*) AS `cpt` FROM (SELECT DISTINCT
                  NULL                           AS `id`,
                  CONCAT('f_',`fanswer`.`id`)    AS `display_id`,
                  `fanswer`.`id`                 AS `original_id`,
                  'PluginFormcreatorForm_Answer' AS `sub_itemtype`,
                  `f`.`name`                     AS `name`,
                  `fanswer`.`status`             AS `status`,
                  `fanswer`.`request_date`       AS `date_creation`,
                  `fanswer`.`request_date`       AS `date_mod`,
                  `fanswer`.`entities_id`        AS `entities_id`,
                  `fanswer`.`is_recursive`       AS `is_recursive`,
                  `fanswer`.`requester_id`       AS `requester_id`,
                  `fanswer`.`users_id_validator` AS `validator_id`,
                  `fanswer`.`comment`            AS `comment`
               FROM `glpi_plugin_formcreator_forms_answers` AS `fanswer`
               LEFT JOIN `glpi_plugin_formcreator_forms` AS `f`
                  ON`f`.`id` = `fanswer`.`plugin_formcreator_forms_id`
               LEFT JOIN `glpi_items_tickets` AS `itic`
                  ON `itic`.`items_id` = `fanswer`.`id`
                  AND `itic`.`itemtype` = 'PluginFormcreatorForm_Answer'
               WHERE `fanswer`.`is_deleted` = '0'
               GROUP BY `original_id`
               HAVING COUNT(`itic`.`tickets_id`) != 1

               UNION

               SELECT DISTINCT
                  NULL                          AS `id`,
                  CONCAT('t_',`tic`.`id`)       AS `display_id`,
                  `tic`.`id`                    AS `original_id`,
                  'Ticket'                      AS `sub_itemtype`,
                  `tic`.`name`                  AS `name`,
                  `tic`.`status`                AS `status`,
                  `tic`.`date`                  AS `date_creation`,
                  `tic`.`date_mod`              AS `date_mod`,
                  `tic`.`entities_id`           AS `entities_id`,
                  0                             AS `is_recursive`,
                  `tic`.`users_id_recipient`    AS `requester_id`,
                  0                             AS `validator_id`,
                  `tic`.`content`               AS `comment`
               FROM `glpi_tickets` AS `tic`
               LEFT JOIN `glpi_items_tickets` AS `itic`
                  ON `itic`.`tickets_id` = `tic`.`id`
                  AND `itic`.`itemtype` = 'PluginFormcreatorForm_Answer'
               WHERE `tic`.`is_deleted` = 0
               GROUP BY `original_id`
               HAVING COUNT(`itic`.`items_id`) <= 1) AS `issues`

Error: Unknown column 'fanswer.users_id_validator' in 'field list'
Backtrace :
plugins/formcreator/inc/issue.class.php:93
plugins/formcreator/install/update_0.0_2.5.php:388 PluginFormcreatorIssue::cronSyncIssues()
plugins/formcreator/install/update_0.0_2.5.php:20 plugin_formcreator_updateIssue_2_5()
plugins/formcreator/install/install.php:42 plugin_formcreator_update_2_5()
plugins/formcreator/hook.php:17 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:731 plugin_formcreator_install()
front/plugin.form.php:48 Plugin->install()

php-errors.log

Test
2018-06-14 21:38:01 [2@glpidev]
From Toolbox::deprecated() in /var/www/glpi/inc/toolbox.class.php line 486
TableExists() function is deprecated
2018-06-14 21:38:01 [2@glpidev]
Backtrace :
inc/toolbox.class.php:487 Toolbox::backtrace()
inc/db.function.php:549 Toolbox::deprecated()
plugins/formcreator/install/update_0.0_2.5.php:75 TableExists()
plugins/formcreator/install/update_0.0_2.5.php:14 plugin_formcreator_updateCategory_2_5()
plugins/formcreator/install/install.php:42 plugin_formcreator_update_2_5()
plugins/formcreator/hook.php:17 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:731 plugin_formcreator_install()
front/plugin.form.php:48 Plugin->install()
2018-06-14 21:38:01 [2@glpidev]
From Toolbox::deprecated() in /var/www/glpi/inc/toolbox.class.php line 486 (0.002", 1.88Mio)
FieldExists() function is deprecated
2018-06-14 21:38:01 [2@glpidev]
Backtrace :
inc/toolbox.class.php:487 Toolbox::backtrace()
inc/db.function.php:568 Toolbox::deprecated()
plugins/formcreator/install/update_0.0_2.5.php:102 FieldExists()
plugins/formcreator/install/update_0.0_2.5.php:14 plugin_formcreator_updateCategory_2_5()
plugins/formcreator/install/install.php:42 plugin_formcreator_update_2_5()
plugins/formcreator/hook.php:17 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:731 plugin_formcreator_install()
front/plugin.form.php:48 Plugin->install()
2018-06-14 21:38:01 [2@glpidev]
From Toolbox::deprecated() in /var/www/glpi/inc/toolbox.class.php line 486 (0.229", 2.16Mio)
FieldExists() function is deprecated
2018-06-14 21:38:01 [2@glpidev]
Backtrace :
inc/toolbox.class.php:487 Toolbox::backtrace()
inc/db.function.php:568 Toolbox::deprecated()
plugins/formcreator/install/update_0.0_2.5.php:732 FieldExists()
plugins/formcreator/install/update_0.0_2.5.php:23 plugin_formcreator_updateSection_2_5()
plugins/formcreator/install/install.php:42 plugin_formcreator_update_2_5()
plugins/formcreator/hook.php:17 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:731 plugin_formcreator_install()
front/plugin.form.php:48 Plugin->install()
2018-06-14 21:38:01 [2@glpidev]
From Toolbox::deprecated() in /var/www/glpi/inc/toolbox.class.php line 486 (0.005", 2.15Mio)
FieldExists() function is deprecated
2018-06-14 21:38:01 [2@glpidev]
Backtrace :
inc/toolbox.class.php:487 Toolbox::backtrace()
inc/db.function.php:568 Toolbox::deprecated()
plugins/formcreator/install/update_0.0_2.5.php:788 FieldExists()
plugins/formcreator/install/update_0.0_2.5.php:24 plugin_formcreator_updateTarget_2_5()
plugins/formcreator/install/install.php:42 plugin_formcreator_update_2_5()
plugins/formcreator/hook.php:17 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:731 plugin_formcreator_install()
front/plugin.form.php:48 Plugin->install()

@flo1994
Copy link
Author

flo1994 commented Jul 4, 2018

Armin83 is my work colleague. His statements are identical to mine.

@btry
Copy link
Collaborator

btry commented Jul 4, 2018

OK, so the issue is between 2.5.2 and 2.6.0.

@btry btry mentioned this issue Aug 6, 2018
2 tasks
@btry
Copy link
Collaborator

btry commented Aug 6, 2018

Hi

Can you test this patch and feedback ?

@btry btry removed this from the 2.6.4 milestone Aug 27, 2018
@btry
Copy link
Collaborator

btry commented Aug 27, 2018

Hi, any fedback with the pach ?

merge is postponed to 2.7.0

@Armin83
Copy link
Contributor

Armin83 commented Aug 28, 2018

Should this patch also work on upgrade from 2.6.3 to 2.6.4(+patch) ?
(No error but missing validator in the history.)

ps. sorry for late test. i was vacation.

root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log# cat migration_to_2.6.4.log
2018-08-28 19:33:55 [2@glpidev]
0 seconds for "create database schema" @ 2018-08-28 19:33:55 [2@glpidev]
0 seconds for "Upgrade to schema version 2.6" @ 2018-08-28 19:33:55 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-08-28 19:33:55 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_questions" @ 2018-08-28 19:33:55 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-08-28 19:34:11 [2@glpidev]
16 seconds for "Task completed." @ 2018-08-28 19:34:11 [2@glpidev]
0 seconds for "Task completed." @ 2018-08-28 19:34:11 [2@glpidev]
0 seconds for "Configure existing entities" @ 2018-08-28 19:34:11 [2@glpidev]
0 seconds for "create request type" @ root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#

`` 

@btry
Copy link
Collaborator

btry commented Aug 28, 2018

Hi

The patch changes the behavior if the upgrade process from a version less than 2.5.0 to 2.5.0.

As long as the patch is applicable wthout conflict and you test it by upgrading the plugin from a version < 2.5.0, it will work. However, I need feedback to know if it works correctly.

@btry
Copy link
Collaborator

btry commented Aug 28, 2018

I'm also thinking about an issue where the plugin did not install a version information correctly. This may cause a bad starting point version for the upgrade process. Then I think I should continue investigation. Please show me the result of the following query, when you run it on a database before migration

select * from glpi_configs where context='formcreator';

@Armin83
Copy link
Contributor

Armin83 commented Aug 31, 2018

Upgrade Error 2.4.0 - 2.5.0

  *** MySQL query error:
  SQL: SELECT COUNT(*) AS `cpt` FROM (SELECT DISTINCT
                  NULL                           AS `id`,
                  CONCAT(\'f_\',`fanswer`.`id`)    AS `display_id`,
                  `fanswer`.`id`                 AS `original_id`,
                  \'PluginFormcreatorForm_Answer\' AS `sub_itemtype`,
                  `f`.`name`                     AS `name`,
                  `fanswer`.`status`             AS `status`,
                  `fanswer`.`request_date`       AS `date_creation`,
                  `fanswer`.`request_date`       AS `date_mod`,
                  `fanswer`.`entities_id`        AS `entities_id`,
                  `fanswer`.`is_recursive`       AS `is_recursive`,
                  `fanswer`.`requester_id`       AS `requester_id`,
                  `fanswer`.`validator_id`       AS `validator_id`,
                  `fanswer`.`comment`            AS `comment`
               FROM `glpi_plugin_formcreator_forms_answers` AS `fanswer`
               LEFT JOIN `glpi_plugin_formcreator_forms` AS `f`
                  ON`f`.`id` = `fanswer`.`plugin_formcreator_forms_id`
               LEFT JOIN `glpi_items_tickets` AS `itic`
                  ON `itic`.`items_id` = `fanswer`.`id`
                  AND `itic`.`itemtype` = \'PluginFormcreatorForm_Answer\'
               WHERE `fanswer`.`is_deleted` = \'0\'
               GROUP BY `original_id`
               HAVING COUNT(`itic`.`tickets_id`) != 1

               UNION

               SELECT DISTINCT
                  NULL                          AS `id`,
                  CONCAT(\'t_\',`tic`.`id`)       AS `display_id`,
                  `tic`.`id`                    AS `original_id`,
                  \'Ticket\'                      AS `sub_itemtype`,
                  `tic`.`name`                  AS `name`,
                  `tic`.`status`                AS `status`,
                  `tic`.`date`                  AS `date_creation`,
                  `tic`.`date_mod`              AS `date_mod`,
                  `tic`.`entities_id`           AS `entities_id`,
                  0                             AS `is_recursive`,
                  `tic`.`users_id_recipient`    AS `requester_id`,
                  0                             AS `validator_id`,
                  `tic`.`content`               AS `comment`
               FROM `glpi_tickets` AS `tic`
               LEFT JOIN `glpi_items_tickets` AS `itic`
                  ON `itic`.`tickets_id` = `tic`.`id`
                  AND `itic`.`itemtype` = \'PluginFormcreatorForm_Answer\'
               WHERE `tic`.`is_deleted` = 0
               GROUP BY `original_id`
               HAVING COUNT(`itic`.`items_id`) <= 1) AS `issues`
  Error: Unknown column 'fanswer.is_deleted' in 'where clause'
  Backtrace :
  plugins/formcreator/inc/issue.class.php:89
  plugins/formcreator/install/update_0.0_2.5.php:388 PluginFormcreatorIssue::cronSyncIssues()
  plugins/formcreator/install/update_0.0_2.5.php:20  plugin_formcreator_updateIssue()
  plugins/formcreator/install/install.php:41         plugin_formcreator_update_2_5()
  plugins/formcreator/hook.php:17                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:664                           plugin_formcreator_install()
  front/plugin.form.php:49                           Plugin->install()

@Armin83
Copy link
Contributor

Armin83 commented Aug 31, 2018

Before the update form 2.4.0 to 2.5.0 (empty set)
After the first upgrade 2.4.0 to 2.5.0:

+-----+-------------+----------------+-------+
| id  | context     | name           | value |
+-----+-------------+----------------+-------+
| 210 | formcreator | schema_version | 2.5   |
+-----+-------------+----------------+-------+
1 row in set (0.00 sec)

MariaDB [glpidb]>

@btry
Copy link
Collaborator

btry commented Aug 31, 2018

This value tells the upgrade code to upgrade from 2.5.0 to the next one but or seems the upgrade begins from a previous version anyway. I'll review and ask you for some other information. Have ready your database before upgrade to read some tables.

@Armin83
Copy link
Contributor

Armin83 commented Aug 31, 2018

with the patch i got this:

  *** MySQL query error:
  SQL: SELECT COUNT(*) AS `cpt` FROM (SELECT DISTINCT
               NULL                           AS `id`,
               CONCAT(\'f_\',`fanswer`.`id`)    AS `display_id`,
               `fanswer`.`id`                 AS `original_id`,
               \'PluginFormcreatorForm_Answer\' AS `sub_itemtype`,
               `f`.`name`                     AS `name`,
               `fanswer`.`status`             AS `status`,
               `fanswer`.`request_date`       AS `date_creation`,
               `fanswer`.`request_date`       AS `date_mod`,
               `fanswer`.`entities_id`        AS `entities_id`,
               `fanswer`.`is_recursive`       AS `is_recursive`,
               `fanswer`.`requester_id`       AS `requester_id`,
               `fanswer`.`users_id_validator` AS `validator_id`,
               `fanswer`.`comment`            AS `comment`
            FROM `glpi_plugin_formcreator_forms_answers` AS `fanswer`
            LEFT JOIN `glpi_plugin_formcreator_forms` AS `f`
               ON`f`.`id` = `fanswer`.`plugin_formcreator_forms_id`
            LEFT JOIN `glpi_items_tickets` AS `itic`
               ON `itic`.`items_id` = `fanswer`.`id`
               AND `itic`.`itemtype` = \'PluginFormcreatorForm_Answer\'
            WHERE `fanswer`.`is_deleted` = \'0\'
            GROUP BY `original_id`
            HAVING COUNT(`itic`.`tickets_id`) != 1
             UNION
             SELECT DISTINCT
               NULL                          AS `id`,
               CONCAT(\'t_\',`tic`.`id`)       AS `display_id`,
               `tic`.`id`                    AS `original_id`,
               \'Ticket\'                      AS `sub_itemtype`,
               `tic`.`name`                  AS `name`,
               `tic`.`status`                AS `status`,
               `tic`.`date`                  AS `date_creation`,
               `tic`.`date_mod`              AS `date_mod`,
               `tic`.`entities_id`           AS `entities_id`,
               0                             AS `is_recursive`,
               `tic`.`users_id_recipient`    AS `requester_id`,
               0                             AS `validator_id`,
               `tic`.`content`               AS `comment`
            FROM `glpi_tickets` AS `tic`
            LEFT JOIN `glpi_items_tickets` AS `itic`
               ON `itic`.`tickets_id` = `tic`.`id`
               AND `itic`.`itemtype` = \'PluginFormcreatorForm_Answer\'
            WHERE `tic`.`is_deleted` = 0
            GROUP BY `original_id`
            HAVING COUNT(`itic`.`items_id`) <= 1) AS `issues`
  Error: Unknown column 'fanswer.users_id_validator' in 'field list'
  Backtrace :
  plugins/formcreator/install/update_0.0_2.5.php:433
  plugins/formcreator/install/update_0.0_2.5.php:20  plugin_formcreator_updateIssue()
  plugins/formcreator/install/install.php:41         plugin_formcreator_update_2_5()
  plugins/formcreator/hook.php:17                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:664                           plugin_formcreator_install()
  front/plugin.form.php:49                           Plugin->install()

@Armin83
Copy link
Contributor

Armin83 commented Aug 31, 2018

i take a snapshot - i can go back to glpi 9.1.2 database and version and can do the 2.5.0 update or higher each time you want.

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

Hi @Armin83

I updated the patch. It seems the upgrade code for migration to 2.5.0 was incomplete. Please test this version of the patch and feedback.

@Armin83
Copy link
Contributor

Armin83 commented Sep 9, 2018

I got back to my backup 9.1.2 and 2.4.0 files from 2.5.0 and your patch.
Debug mode - upgrade this is n log - no log from debug

root@glpidev:/var/www/glpi/plugins/formcreator/install# cat ../../../files/_log/migration_to_2.5.0.log
2018-09-09 15:27:45 [2@glpidev]
0 seconds for "create database schema" @ 2018-09-09 15:27:45 [2@glpidev]
0 seconds for "Upgrade to schema version 2.5" @ 2018-09-09 15:27:46 [2@glpidev]
1 second for "Upgrade glpi_plugin_formcreator_answers" @ 2018-09-09 15:27:46 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_answers" @ root@glpidev:/var/www/glpi/plugins/formcreator/install#
root@glpidev:/var/www/glpi/plugins/formcreator/install#

bug in browser this
Upgrade glpi_plugin_formcreator_categories (1 second)

Fatal error: Uncaught Error: Call to undefined method DB::tableExists() in /var/www/glpi/plugins/formcreator/install/update_0.0_2.5.php:105 Stack trace: #0 /var/www/glpi/plugins/formcreator/install/update_0.0_2.5.php(44): plugin_formcreator_updateCategory_2_5(Object(Migration)) #1 /var/www/glpi/plugins/formcreator/install/install.php(41): plugin_formcreator_update_2_5(Object(Migration)) #2 /var/www/glpi/plugins/formcreator/hook.php(17): PluginFormcreatorInstall->upgrade(Object(Migration)) #3 /var/www/glpi/inc/plugin.class.php(664): plugin_formcreator_install() #4 /var/www/glpi/front/plugin.form.php(49): Plugin->install('6') #5 {main} thrown in /var/www/glpi/plugins/formcreator/install/update_0.0_2.5.php on line 105

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

While I fix the error, please have a look into the structure of the table glpi_plugin_formcreator_forms_answers. It should contain the column users_id_validator (I notice 1 second elapsed while upgrading the table, i guess the job you need is done).

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

After review of the backtrace you just shared, it seems the error occurs before the code of the patch ran. I'm suspecting you forgot to upgrade glpi to 9.2.x before upgrading the plugin. Can you confirm glpi is upgraded first ?

@Armin83
Copy link
Contributor

Armin83 commented Sep 9, 2018

Yes because on first test i don't get a migration 2.5 log. Ibelieved my test source is wrong. i go back to 9.1.2 and checked if the plugin is 2.4.0. (it was) so i decided do only upgrade to 2.5.0 to see if it works. Test running

@Armin83
Copy link
Contributor

Armin83 commented Sep 9, 2018

  1. Drop glpi database
  2. restore glpi database (glpi 9.1.2 fromcreator 2.4x)
  3. files glpi 9.3, files formcreator 2.6.4 + patch (wget https://raw.githubusercontent.com/pluginsGLPI/formcreator/e87e89675bb84c8fbbafc998ad89cf2a35bc3214/install/update_0.0_2.5.php)
  4. open browser - run glpi update from 9.1.2 to 9.3 (debug mode on)
  5. go to plugins upgrade formcreator (no error in the browser interface)
  6. I don't have a migration log for 2.5 only for 2.6.4
  7. yes i have this column (don't now if i had before ;) but he value musst is wrong. they all have 0 and in the browser i don't see the validator

MariaDB [glpidb]> select count(*) from glpi_plugin_formcreator_forms_answers where users_id_validator = 0;
+----------+
| count(*) |
+----------+
|      185 |
+----------+
1 row in set (0.00 sec)

MariaDB [glpidb]> select count(*) from glpi_plugin_formcreator_forms_answers where users_id_validator = 1;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

MariaDB [glpidb]>
MariaDB [glpidb]> select * from glpi_plugin_formcreator_forms_answers;
+-----+---------------------+-------------+--------------+-----------------------------+--------------+--------------------+---------------------+---------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| id  | name                | entities_id | is_recursive | plugin_formcreator_forms_id | requester_id | users_id_validator | groups_id_validator | request_date        | status   | comment                                                                                                                                                                                                                                                                                                                                                                           | is_deleted |
+-----+---------------------+-------------+--------------+-----------------------------+--------------+--------------------+---------------------+---------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
|  15 | Hardware / Software |           0 |            0 |                          16 |          176 |                  0 
root@glpidev:/var/www/glpi/files/_log# cat migration_to_2.6.4.log
2018-09-09 18:17:50 [2@glpidev]
0 Sekunden for "create database schema" @ 2018-09-09 18:17:50 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.5" @ 2018-09-09 18:17:51 [2@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_categories" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_profiles" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_validators" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_headers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_issues" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions_conditions" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_sections" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targets" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges_actors" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets_actors" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_titles" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_sections" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targets" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.6" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-09 18:17:51 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-09-09 18:17:52 [2@glpidev]
1 Sekunde for "Bearbeitung abgeschlossen" @ 2018-09-09 18:17:52 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-09 18:17:52 [2@glpidev]
0 Sekunden for "Configure existing entities" @ 2018-09-09 18:17:52 [2@glpidev]
0 Sekunden for "create request type" @ root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#
[2018-09-09 18:15:41] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: dbversion
  Backtrace :
  inc/config.php:257
  inc/includes.php:53                                include_once()
  front/central.php:33                               include()
  {"user":"2@glpidev","mem_usage":"0.014\", 2.06Mio)"}
[2018-09-09 18:15:41] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: dbversion
  Backtrace :
  inc/config.php:257
  inc/includes.php:53                                include_once()
  index.php:57                                       include()
  {"user":"@glpidev","mem_usage":"0.003\", 1.66Mio)"}
[2018-09-09 18:15:44] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.002\", 1.09Mio)"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.002\", 1.09Mio)"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.003\", 1.39Mio)"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.003\", 1.39Mio)"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.002\", 1.39Mio)"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:25] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.003\", 1.40Mio)"}
[2018-09-09 18:17:32] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:32] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.002\", 1.39Mio)"}
[2018-09-09 18:17:50] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:50] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.003\", 1.10Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.346\", 5.86Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.001\", 5.87Mio)"}
[2018-09-09 18:17:51] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: title
  Backtrace :
  plugins/formcreator/inc/targetticket.class.php:930
  inc/commondbtm.class.php:1196                      PluginFormcreatorTargetTicket->prepareInputForUpdate()
  plugins/formcreator/install/update_2.5_2.6.php:138 CommonDBTM->update()
  plugins/formcreator/install/install.php:84         plugin_formcreator_update_2_6()
  plugins/formcreator/hook.php:48                    PluginFormcreatorInstall->upgrade()
  inc/plugin.class.php:701                           plugin_formcreator_install()
  front/plugin.form.php:47                           Plugin->install()
  {"user":"2@glpidev","mem_usage":"0.002\", 5.87Mio)"}
[2018-09-09 18:17:52] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_db Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev"}
[2018-09-09 18:17:52] glpiphplog.DEBUG: Config::getCache() in /var/www/glpi/inc/config.class.php line 2931
CACHE cache_trans Zend\Cache\Storage\Adapter\Apcu  {"user":"2@glpidev","mem_usage":"0.003\", 1.09Mio)"}

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

I suggest you stay in the same upgrade as you initially described because I sometimes fix old upgrade steps when an issue like your's is reported. 2.6.3 is fine to have the best upgrade code. To find the fix it is important to strictly test with the same conditions as your initial problem.

You may do things easier by upgrading GLPI files and db, then upgrade the files of the plugin and get a snapshot of the db. This snapshot is good to test several times to upgrade of the plugin while improving the patch.

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

After review of the backtrace you just shared, it seems the error occurs before the code of the patch ran. I'm suspecting you forgot to upgrade glpi to 9.2.x before upgrading the plugin. Can you confirm glpi is upgraded first ?

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

[2018-09-09 18:15:41] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
  *** PHP Notice(8): Undefined index: dbversion
  Backtrace :
  inc/config.php:257
  inc/includes.php:53                                include_once()
  front/central.php:33                               include()
  {"user":"2@glpidev","mem_usage":"0.014\", 2.06Mio)"}

This error makes me think you have an inconsistency in GLPI. dbversion is a configuration value for glpi, not the plugin. It should match the version of GLPI, without the 3rd and last number.

I added a fix for the warnings impacting target tickets.

@Armin83
Copy link
Contributor

Armin83 commented Sep 9, 2018

Ok i replaced the 2 files from #1059
after my first test i change the file install/update_2.5_2.6.php from:
$targetTicket['title'] = $targetTicke['name'];
to:
$targetTicket['title'] = $targetTicket['name'];


2018-09-09 21:32:38 [2@glpidev]
0 Sekunden for "create database schema" @ 2018-09-09 21:32:38 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.5" @ 2018-09-09 21:32:39 [2@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_categories" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_profiles" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_validators" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_headers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_issues" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions_conditions" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_sections" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targets" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges_actors" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets_actors" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_titles" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_sections" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targets" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.6" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-09 21:32:39 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-09-09 21:32:40 [2@glpidev]
1 Sekunde for "Bearbeitung abgeschlossen" @ 2018-09-09 21:32:40 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-09 21:32:40 [2@glpidev]
0 Sekunden for "Configure existing entities" @ 2018-09-09 21:32:40 [2@glpidev]
0 Sekunden for "create request type" @
2018-09-09 21:32:39 [2@glpidev]
  *** MySQL query error:
  SQL: SELECT COUNT(*) AS `cpt` FROM (SELECT DISTINCT
               NULL                           AS `id`,
               CONCAT('f_',`fanswer`.`id`)    AS `display_id`,
               `fanswer`.`id`                 AS `original_id`,
               'PluginFormcreatorForm_Answer' AS `sub_itemtype`,
               `f`.`name`                     AS `name`,
               `fanswer`.`status`             AS `status`,
               `fanswer`.`request_date`       AS `date_creation`,
               `fanswer`.`request_date`       AS `date_mod`,
               `fanswer`.`entities_id`        AS `entities_id`,
               `fanswer`.`is_recursive`       AS `is_recursive`,
               `fanswer`.`requester_id`       AS `requester_id`,
               `fanswer`.`users_id_validator` AS `validator_id`,
               `fanswer`.`comment`            AS `comment`
            FROM `glpi_plugin_formcreator_forms_answers` AS `fanswer`
            LEFT JOIN `glpi_plugin_formcreator_forms` AS `f`
               ON`f`.`id` = `fanswer`.`plugin_formcreator_forms_id`
            LEFT JOIN `glpi_items_tickets` AS `itic`
               ON `itic`.`items_id` = `fanswer`.`id`
               AND `itic`.`itemtype` = 'PluginFormcreatorForm_Answer'
            WHERE `fanswer`.`is_deleted` = '0'
            GROUP BY `original_id`
            HAVING COUNT(`itic`.`tickets_id`) != 1

            UNION

            SELECT DISTINCT
               NULL                          AS `id`,
               CONCAT('t_',`tic`.`id`)       AS `display_id`,
               `tic`.`id`                    AS `original_id`,
               'Ticket'                      AS `sub_itemtype`,
               `tic`.`name`                  AS `name`,
               `tic`.`status`                AS `status`,
               `tic`.`date`                  AS `date_creation`,
               `tic`.`date_mod`              AS `date_mod`,
               `tic`.`entities_id`           AS `entities_id`,
               0                             AS `is_recursive`,
               `tic`.`users_id_recipient`    AS `requester_id`,
               0                             AS `validator_id`,
               `tic`.`content`               AS `comment`
            FROM `glpi_tickets` AS `tic`
            LEFT JOIN `glpi_items_tickets` AS `itic`
               ON `itic`.`tickets_id` = `tic`.`id`
               AND `itic`.`itemtype` = 'PluginFormcreatorForm_Answer'
            WHERE `tic`.`is_deleted` = 0
            GROUP BY `original_id`
            HAVING COUNT(`itic`.`items_id`) <= 1) AS `issues`
  Error: Unknown column 'fanswer.users_id_validator' in 'field list'
  Backtrace :
  plugins/formcreator/install/update_0.0_2.5.php:467
  plugins/formcreator/install/update_0.0_2.5.php:50  plugin_formcreator_updateIssue_2_5()
  plugins/formcreator/install/install.php:47         plugin_formcreator_update_2_5()

@Armin83
Copy link
Contributor

Armin83 commented Sep 9, 2018

I don't have users_id_validator before the update only after the update. I hope this was clear

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

after my first test i change the file install/update_2.5_2.6.php from:
$targetTicket['title'] = $targetTicke['name'];
to:
$targetTicket['title'] = $targetTicket['name'];

Indeed, I left a typo. This is fixed.

I don't have users_id_validator before the update only after the update. I hope this was clear
This is normal: the column validator_id may contain a user id or a group id. The purpose is to distinguish these two types of integers in separate columns. This change was done in 2.5.0. It seems the upgrade code was missing in 2.5.0 and added later.

The patch adds the migration code in the good place, but I don't see why the column is missing when syncing the issues table. The sequence of upgrade steps looks ok to me :/

  • create new columns in forms_answers
  • sync issues list with the new column names.

@btry
Copy link
Collaborator

btry commented Sep 9, 2018

I think I found the right way now. Less problems than I believed, but a caveat in the upgrade of forms_answers.

The patch should be applicable to 2.6.4 as it changes old upgrade code only.

@Armin83
Copy link
Contributor

Armin83 commented Sep 10, 2018

target 2.6.3 i got no error but super admin can't open.
i got this in the browser

You don't have permission to perform this action.

but i believe there was a bug in a version so drop / restore again direct to 2.6.4 with patch. i got also no error and can see the forms. but in both cases the Form approver is missing

root@glpidev:/var/www/glpi/files/_log# cat migration_to_2.6.3
2018-09-10 20:42:37 [2@glpidev]
0 seconds for "create database schema" @ 2018-09-10 20:42:37 [2@glpidev]
0 seconds for "Upgrade to schema version 2.5" @ 2018-09-10 20:42:38 [2@glpidev]
1 second for "Upgrade glpi_plugin_formcreator_answers" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_answers" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_categories" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_profiles" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_validators" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_forms" @ 2018-09-10 20:42:38 [2@glpidev]
0 seconds for "Drop glpi_plugin_formcreator_headers" @ 2018-09-10 20:42:39 [2@glpidev]
1 second for "Upgrade glpi_plugin_formcreator_issues" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_questions_conditions" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_questions_conditions" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_sections" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_targets" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_targetchanges" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_targetchanges_actors" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_targettickets_actors" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_targettickets" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Drop glpi_plugin_formcreator_titles" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_questions_conditions" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_questions" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_sections" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_targets" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_targettickets" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Task completed." @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade to schema version 2.6" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_targettickets" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Change of the database layout - glpi_plugin_formcreator_answers" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Task completed." @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Task completed." @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "Configure existing entities" @ 2018-09-10 20:42:39 [2@glpidev]
0 seconds for "create request type" @ root@glpidev:/var/www/glpi/files/_log#

root@glpidev:/var/www/glpi/files/_log# cat migration_to_2.6.4.log
2018-09-10 20:59:46 [2@glpidev]
0 Sekunden for "create database schema" @ 2018-09-10 20:59:46 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.5" @ 2018-09-10 20:59:47 [2@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_answers" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_categories" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_profiles" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_validators" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_headers" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_issues" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions_conditions" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-09-10 20:59:47 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-10 20:59:48 [2@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_sections" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targets" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges_actors" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets_actors" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_titles" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_sections" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targets" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade to schema version 2.6" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "Configure existing entities" @ 2018-09-10 20:59:48 [2@glpidev]
0 Sekunden for "create request type" @ root@glpidev:/var/www/glpi/files/_log#
MariaDB [glpidb]> select count(*) from glpi_plugin_formcreator_forms_answers where users_id_validator <> 0;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

MariaDB [glpidb]> select count(*) from glpi_plugin_formcreator_forms_answers where users_id_validator = 0;
+----------+
| count(*) |
+----------+
|      185 |
+----------+
1 row in set (0.00 sec)

@btry
Copy link
Collaborator

btry commented Sep 11, 2018

Hi
So now we can focus on the missing validator Id.

Let's see if you experience an issue while populating the new columns user_id_validator and group_is_validator.

Please do the following steps

After the upgrade you will have the new columns, but the old column validator_id will not be deleted. Let's compare the values of these columns.

The value in validator_id must be found either in user_id_validator or group_id_validator. The code which moves the value from a column to an other is in install/update_2.5_2.6.php lines 72 to 82.

   $formTable = 'glpi_plugin_formcreator_forms';
   $query = "UPDATE `$table`
             INNER JOIN `$formTable` ON (`$table`.`plugin_formcreator_forms_id` = `$formTable`.`id`)
             SET `users_id_validator` = 'validator_id'
             WHERE `$formTable`.`validation_required` = '1'";
   $DB->query($query) or plugin_formcreator_upgrade_error($migration);
   $query = "UPDATE `$table`
             INNER JOIN `$formTable` ON (`$table`.`plugin_formcreator_forms_id` = `$formTable`.`id`)
             SET `groups_id_validator` = 'validator_id'
             WHERE `$formTable`.`validation_required` = '2'";
   $DB->query($query) or plugin_formcreator_upgrade_error($migration);

You may use this queriy to check the values

select validator_id, user_id_validator, group_id_validator
from glpi_plugin_formcreator_forms_answers as fa
inner join glpi_plugin_formcreator_forms as f on (f.id = fa.plugin_formcreator_forms_id)
where f.validation_required > 0

@Armin83
Copy link
Contributor

Armin83 commented Sep 11, 2018

First. Typo :)

    -> from glpi_plugin_formcreator_forms_answers as fa
    -> inner join glpi_plugin_formcreator_forms as f on (f.id = fa.plugin_formcreator_forms_id)
    -> where f.validation_required > 0;
ERROR 1054 (42S22): Unknown column 'user_id_validator' in 'field list'
MariaDB [glpidb]> select validator_id, user_id_validator, group_id_validator from glpi_plugin_formcreator_forms_answers as fa inner join glpin (f.id = fa.plugin_formcreator_forms_id) where f.validation_required > 0;
ERROR 1054 (42S22): Unknown column 'user_id_validator' in 'field list'
MariaDB [glpidb]>

Next:


MariaDB [glpidb]> select validator_id, users_id_validator, group_id_validator from glpi_plugin_formcreator_forms_answers as fa inner join glpi_plugin_formcreator_forms as f on (f.id = fa.plugin_formcreator_forms_id) where f.validation_required > 0;
ERROR 1054 (42S22): Unknown column 'group_id_validator' in 'field list'
MariaDB [glpidb]> select validator_id, users_id_validator, groups_id_validator from glpi_plugin_formcreator_forms_answers as fa inner join glpi_plugin_formcreator_forms as f on (f.id = fa.plugin_formcreator_forms_id) where f.validation_required > 0;
+--------------+--------------------+---------------------+
| validator_id | users_id_validator | groups_id_validator |
+--------------+--------------------+---------------------+
|          158 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          249 |                  0 |                   0 |
|          249 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          249 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          249 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          249 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          204 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          204 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|            8 |                  0 |                   0 |
|            8 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          195 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           15 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|            0 |                  0 |                   0 |
|          195 |                  0 |                   0 |
|          195 |                  0 |                   0 |
|          195 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          195 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|            8 |                  0 |                   0 |
|            8 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          197 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          197 |                  0 |                   0 |
|          197 |                  0 |                   0 |
|          195 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          194 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          197 |                  0 |                   0 |
|          197 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          204 |                  0 |                   0 |
|          204 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|           42 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|          193 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|            0 |                  0 |                   0 |
|           67 |                  0 |                   0 |
|          158 |                  0 |                   0 |
|            0 |                  0 |                   0 |
|            0 |                  0 |                   0 |
|           75 |                  0 |                   0 |
|           75 |                  0 |                   0 |
+--------------+--------------------+---------------------+
185 rows in set (0.00 sec)

MariaDB [glpidb]>

@Armin83
Copy link
Contributor

Armin83 commented Sep 11, 2018

Nobody else matters? Everybody must have this bug
Right:
validator_id - don't know to escape it here
Wrong
'validator_id'

In the set statement from install/update_2.5_2.6.php lines 72 to 82.

@btry
Copy link
Collaborator

btry commented Sep 11, 2018

Yes, sorry for the typos; I'm switching to an orthogonal keyboard with a temporary skin to switch later to orthogonal bépo (this requires to type stronger, and train muscular memory). Have a look to typematrix 2030 keyboards if you're curious. For a few months i'll have fingers fater tha never ;).

Now we have the proof the following queries don't do their job

   $table = 'glpi_plugin_formcreator_forms_answers';
   $formTable = 'glpi_plugin_formcreator_forms';
   $query = "UPDATE `$table`
             INNER JOIN `$formTable` ON (`$table`.`plugin_formcreator_forms_id` = `$formTable`.`id`)
             SET `users_id_validator` = 'validator_id'
             WHERE `$formTable`.`validation_required` = '1'";
   $DB->query($query) or plugin_formcreator_upgrade_error($migration);
   $query = "UPDATE `$table`
             INNER JOIN `$formTable` ON (`$table`.`plugin_formcreator_forms_id` = `$formTable`.`id`)
             SET `groups_id_validator` = 'validator_id'
             WHERE `$formTable`.`validation_required` = '2'";
   $DB->query($query) or plugin_formcreator_upgrade_error($migration);

@btry
Copy link
Collaborator

btry commented Sep 11, 2018

can you try to run one of them ?

update glpi_plugin_formcreator_forms_answers 
inner  join glpi_plugin_formcreator_forms on glpi_plugin_formcreator_forms_answers.plugin_formcreator_forms_id = glpi_plugin_formcreator_forms.id
where glpi_plugin_formcreator_forms.validation_required=1

then see if some values moved to users_id_validator ?

select validator_id, users_id_validator, groups_id_validator from glpi_plugin_formcreator_forms_answers as fa inner join glpi_plugin_formcreator_forms as f on (f.id = fa.plugin_formcreator_forms_id) where f.validation_required > 0;

@Armin83
Copy link
Contributor

Armin83 commented Sep 11, 2018

Yes - this works. Sorry i did not write it. I understand the structure at this moment and wrote the update. it works. I can see them. (browser)
I tried the patched file by me and it works also. I did not want to do a pull request for 4 ` Characters so i wrote it only

@btry
Copy link
Collaborator

btry commented Sep 11, 2018

I cross posted with your comment #997 (comment)

Good point. The error is indeed here.

@btry
Copy link
Collaborator

btry commented Sep 11, 2018

The PR is updated. Waiting for your feedback. It is strange noone fond this issue earlier.

This shows necessity to continue the background task of writing unit tests.

@btry
Copy link
Collaborator

btry commented Sep 11, 2018

Cross post again...

Yes - this works. Sorry i did not write it. I understand the structure at this moment and wrote the update. it works. I can see them. (browser)
I tried the patched file by me and it works also. I did not want to do a pull request for 4 ` Characters so i wrote it only

Then I can submit for external review, then merge it. Thank you for your feedback and tries.

@Armin83
Copy link
Contributor

Armin83 commented Sep 13, 2018

Yes the patch works for do the upgrade from my old backup with old version. It looks good for me :)
Now we can solve the next bug ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants