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

2.7.0 beta migration #1250

Closed
Armin83 opened this issue Dec 19, 2018 · 24 comments
Closed

2.7.0 beta migration #1250

Armin83 opened this issue Dec 19, 2018 · 24 comments
Assignees
Labels
Milestone

Comments

@Armin83
Copy link
Contributor

Armin83 commented Dec 19, 2018

root@glpidev:/var/www/glpi/files/_log# cat sql-errors.log
[2018-12-19 23:38:35] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/inc/dbmysql.class.php line 177
*** MySQL query error:
SQL: UPDATE glpi_displaypreferences SET itemtype = 'PluginFormcreatorFormAnswer' WHERE itemtype = 'PluginFormcreatorForm_Answer'
Error: Duplicate entry '0-PluginFormcreatorFormAnswer-2' for key 'unicity'
Backtrace :
inc/dbmysql.class.php:1029
plugins/formcreator/install/upgrade_to_2.7.php:45 DBmysql->update()
plugins/formcreator/install/install.php:135 PluginFormcreatorUpgradeTo2_7->upgrade()
plugins/formcreator/install/install.php:103 PluginFormcreatorInstall->upgradeOneStep()
plugins/formcreator/hook.php:50 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:707 plugin_formcreator_install()
front/plugin.form.php:47 Plugin->install()
{"user":"6@glpidev"}

root@glpidev:/var/www/glpi/files/_log# cat migration_to_2.7.0-beta.1.log
2018-12-19 23:36:50 [6@glpidev]
0 Sekunden for "Upgrade to schema version 2.5" @ 2018-12-19 23:38:09 [6@glpidev]
1 Minuten 19 Sekunden for "Upgrade glpi_plugin_formcreator_answers" @ 2018-12-19 23:38:09 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-12-19 23:38:09 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_categories" @ 2018-12-19 23:38:10 [6@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-12-19 23:38:11 [6@glpidev]
1 Sekunde for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-12-19 23:38:11 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_profiles" @ 2018-12-19 23:38:11 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_validators" @ 2018-12-19 23:38:11 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms" @ 2018-12-19 23:38:11 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms" @ 2018-12-19 23:38:11 [6@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_headers" @ 2018-12-19 23:38:12 [6@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_issues" @ 2018-12-19 23:38:17 [6@glpidev]
5 Sekunden for "Upgrade glpi_plugin_formcreator_questions_conditions" @ 2018-12-19 23:38:17 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-12-19 23:38:22 [6@glpidev]
5 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-12-19 23:38:23 [6@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_sections" @ 2018-12-19 23:38:23 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targets" @ 2018-12-19 23:38:23 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges" @ 2018-12-19 23:38:23 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targetchanges_actors" @ 2018-12-19 23:38:23 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_targettickets_actors" @ 2018-12-19 23:38:24 [6@glpidev]
1 Sekunde for "Upgrade glpi_plugin_formcreator_targettickets" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Drop glpi_plugin_formcreator_titles" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions_conditions" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_sections" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targets" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Done" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Upgrade to schema version 2.6" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_questions" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Upgrade glpi_plugin_formcreator_forms_answers" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-12-19 23:38:24 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-12-19 23:38:25 [6@glpidev]
1 Sekunde for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms_answers" @ 2018-12-19 23:38:25 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-12-19 23:38:25 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:25 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:25 [6@glpidev]
0 Sekunden for "Done" @ 2018-12-19 23:38:34 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:34 [6@glpidev]
0 Sekunden for "Done" @ 2018-12-19 23:38:35 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:35 [6@glpidev]
0 Sekunden for "Done" @ 2018-12-19 23:38:50 [6@glpidev]
15 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-12-19 23:38:50 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_answers" @ 2018-12-19 23:38:50 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targetchanges" @ 2018-12-19 23:38:51 [6@glpidev]
1 Sekunde for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_questions" @ 2018-12-19 23:38:51 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_targettickets" @ 2018-12-19 23:38:51 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_forms" @ 2018-12-19 23:38:52 [6@glpidev]
1 Sekunde for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_sections" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "Änderung des Datenbank-Layouts - glpi_plugin_formcreator_issues" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "Done" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "Bearbeitung abgeschlossen" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "create database schema" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "Configure existing entities" @ 2018-12-19 23:38:52 [6@glpidev]
0 Sekunden for "create request type" @ root@glpidev:/var/www/glpi/files/_log#
root@glpidev:/var/www/glpi/files/_log#

@btry
Copy link
Collaborator

btry commented Dec 21, 2018

Hi

How many times did you tried to run the upgrade process ?

Also did you used Formcreator older than 2.5.x on this instance of GLPI ?

If you have a backup of your DB before any attempt to upgrade to 2.7.0, please search in this snapshot, table glpi_displaypreferences. Do you have some rows where itemtype='PluginFormcreatorFormAnswer'

@btry btry added the bug label Dec 21, 2018
@btry btry added this to the 2.7.0 milestone Dec 21, 2018
@Armin83
Copy link
Contributor Author

Armin83 commented Dec 21, 2018

No this installation should be 2.6.3 but we had upgrade trouble in past see issue 9 9 7.

MariaDB [glpidb]> select * from glpi_displaypreferences where itemtype='PluginFormcreatorFormAnswer';
+-----+-----------------------------+-----+------+----------+
| id | itemtype | num | rank | users_id |
+-----+-----------------------------+-----+------+----------+
| 743 | PluginFormcreatorFormanswer | 2 | 2 | 0 |
| 744 | PluginFormcreatorFormanswer | 3 | 3 | 0 |
| 745 | PluginFormcreatorFormanswer | 4 | 4 | 0 |
| 746 | PluginFormcreatorFormanswer | 5 | 5 | 0 |
| 747 | PluginFormcreatorFormanswer | 6 | 6 | 0 |
+-----+-----------------------------+-----+------+----------+
5 rows in set (0.00 sec)

MariaDB [glpidb]> select * from glpi_displaypreferences where itemtype='PluginFormcreatorForm_Answer';
+------+------------------------------+-----+------+----------+
| id | itemtype | num | rank | users_id |
+------+------------------------------+-----+------+----------+
| 841 | PluginFormcreatorForm_Answer | 2 | 2 | 0 |
| 842 | PluginFormcreatorForm_Answer | 3 | 3 | 0 |
| 843 | PluginFormcreatorForm_Answer | 4 | 4 | 0 |
| 844 | PluginFormcreatorForm_Answer | 5 | 5 | 0 |
| 845 | PluginFormcreatorForm_Answer | 6 | 6 | 0 |
| 1002 | PluginFormcreatorForm_Answer | 86 | 7 | 0 |
| 1003 | PluginFormcreatorForm_Answer | 60 | 8 | 0 |
| 1004 | PluginFormcreatorForm_Answer | 140 | 9 | 0 |
| 1005 | PluginFormcreatorForm_Answer | 119 | 10 | 0 |
| 1092 | PluginFormcreatorForm_Answer | 2 | 2 | 6 |
| 1093 | PluginFormcreatorForm_Answer | 3 | 3 | 6 |
| 1094 | PluginFormcreatorForm_Answer | 4 | 4 | 6 |
| 1095 | PluginFormcreatorForm_Answer | 5 | 5 | 6 |
| 1096 | PluginFormcreatorForm_Answer | 6 | 6 | 6 |
| 1097 | PluginFormcreatorForm_Answer | 60 | 8 | 6 |
| 1098 | PluginFormcreatorForm_Answer | 86 | 7 | 6 |
| 1099 | PluginFormcreatorForm_Answer | 119 | 10 | 6 |
| 1100 | PluginFormcreatorForm_Answer | 140 | 9 | 6 |
+------+------------------------------+-----+------+----------+
18 rows in set (0.00 sec)

@Armin83
Copy link
Contributor Author

Armin83 commented Dec 21, 2018

btw message from browser

Done (8 seconds)

Done (8 seconds)

Change of the database layout - glpi_plugin_formcreator_answers (8 seconds)

Table 'glpidb.glpi_plugin_formcreator_questionregexes' doesn't exist

Please, check migration log

@Armin83
Copy link
Contributor Author

Armin83 commented Dec 21, 2018

root@glpidev:/var/www/glpi/files/_log# cat migration_to_2.7.0-beta.1.log
2018-12-21 22:01:50 [2@glpidev]
0 seconds for "Task completed." @ 2018-12-21 22:01:50 [2@glpidev]
0 seconds for "Done" @ 2018-12-21 22:01:50 [2@glpidev]
0 seconds for "Task completed." @ 2018-12-21 22:01:50 [2@glpidev]
0 seconds for "Done" @ 2018-12-21 22:01:50 [2@glpidev]
Table 'glpidb.glpi_plugin_formcreator_questionregexes' doesn't exist
Backtrace :
plugins/formcreator/install/upgrade_to_2.7.php:129 plugin_formcreator_upgrade_error()
plugins/formcreator/install/install.php:135 PluginFormcreatorUpgradeTo2_7->upgrade()
plugins/formcreator/install/install.php:103 PluginFormcreatorInstall->upgradeOneStep()
plugins/formcreator/hook.php:50 PluginFormcreatorInstall->upgrade()
inc/plugin.class.php:707 plugin_formcreator_install()
front/plugin.form.php:47 Plugin->install()
@ root@glpidev:/var/www/glpi/files/_log#

@btry
Copy link
Collaborator

btry commented Dec 21, 2018

Hi

In the past the itemtype PluginFormcreatorFormAnswer was renamed into PluginFormceatorForm_Answer. An issue was found in the choice of the parent class of this itemtype. The fix required for semantic reasons that the itemtype is renamed back to PluginFormcreatorFormAnswer.

I think that the upgrdade code in the first rename was incomplete and did not update the display preferences. But in the version 2.7.0 the display preferences are updated and conflict with old data which should not exists.

I'll prepare a patch soon for this issue. If you have skills, the patch should delete the old display prefs before updating the new ones. If you don't have skills, please be patient I'll prepare a patch for you.

For your 2nd post, I already provided a fix. But no feedback from requester. You may try the branch develop

@Armin83
Copy link
Contributor Author

Armin83 commented Dec 21, 2018

So i go back to the past. Upgraded 9.3.0 to 9.3.3 and foms from <2.6.4 (or < 2.5.0) to 2.7.0 beta
no errors during migration in the browser and i can use forms but i can't see the old forms and i can't search for them + errors in php and sql but i can use the plugin.
(i can't search for my on NEW created forms too. I see them only on the right panel (requester))

@btry
Copy link
Collaborator

btry commented Dec 22, 2018

Hi

Show the php / sql errors in the logs to identify the issues. and tell exactly which was the "start" version of Formcreator used for this uptgrade attempt. Also, if you used the latest revision of the plugin for the upgrade (after the tag 2.7.0-beta.1) please let me know.

@btry btry self-assigned this Dec 22, 2018
@Armin83
Copy link
Contributor Author

Armin83 commented Dec 24, 2018

glpi 9.1.2
forms 2.5.0
plugin deactivate
glpi 9.3.3
innodb migration
MariaDB [glpidb]> delete from glpi_displaypreferences where itemtype='PluginFormcreatorFormAnswer';
Query OK, 5 rows affected (0.01 sec)
developer branch
i got no error during migration but i cant see any forms

root@glpidev:/var/www/glpi/files/_log# cat sql-errors.log
[2018-12-24 12:16:42] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/inc/dbmysql.class.php line 177
*** MySQL query error:
SQL: SELECT fa.id, f.name, fa.status, fa.request_date
FROM glpi_plugin_formcreator_forms f
INNER JOIN glpi_plugin_formcreator_forms_validators fv ON fv.plugin_formcreator_forms_id=f.id
INNER JOIN glpi_plugin_formcreator_formanswers fa ON f.id = fa.plugin_formcreator_forms_id
WHERE (f.validation_required = 1 AND fv.items_id = '6' AND fv.itemtype = 'User' AND fa.users_id_validator = '6'
OR f.validation_required = 2 AND fv.items_id IN ('1', '5', '14') AND fv.itemtype = 'Group' AND fa.groups_id_validator IN ('1', '5', '14')
)
AND f.is_deleted = 0
ORDER BY fa.status ASC, fa.request_date DESC
LIMIT 0, 5
Error: Unknown column 'fa.users_id_validator' in 'where clause'
Backtrace :
plugins/formcreator/inc/form.class.php:871
plugins/formcreator/inc/form.class.php:600 PluginFormcreatorForm->showMyLastForms()
plugins/formcreator/front/formlist.php:62 PluginFormcreatorForm->showList()
{"user":"6@glpidev"}
root@glpidev:/var/www/glpi/files/_log# cat php-errors.log
[2018-12-24 12:16:42] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
*** PHP Notice(8): Trying to get property 'num_rows' of non-object
Backtrace :
inc/dbmysql.class.php:284
plugins/formcreator/inc/form.class.php:872 DBmysql->numrows()
plugins/formcreator/inc/form.class.php:600 PluginFormcreatorForm->showMyLastForms()
plugins/formcreator/front/formlist.php:62 PluginFormcreatorForm->showList()
{"user":"6@glpidev","mem_usage":"0.000", 2.50Mio)"}
root@glpidev:/var/www/glpi/files/_log#

@btry
Copy link
Collaborator

btry commented Dec 26, 2018

Hi

I checked your old issue #997 : it sould not be related to this one.

I also checked the problem with the columns users_id_validator this problem should not occur. The column name is correct. Please show the create table of glpi_plugin_formcreator_formanswers (v2.7.0) or glpi_pluginformcreator_form_answers (< v2.7.0).

Finally, before the migration you can delete the old data in display prefs found with select * from glpi_displaypreferences where itemtype='PluginFormcreatorFormAnswer';

Waiting for feedback.

@Armin83
Copy link
Contributor Author

Armin83 commented Dec 27, 2018

Nothing change. 2.5.0 and 2.7.0 same table structure

MariaDB [glpidb]> show create table glpi_pluginformcreator_form_answers;
ERROR 1146 (42S02): Table 'glpidb.glpi_pluginformcreator_form_answers' doesn't exist
MariaDB [glpidb]> show create table glpi_plugin_formcreator_formanswers;
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| glpi_plugin_formcreator_formanswers | CREATE TABLE glpi_plugin_formcreator_formanswers (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
entities_id int(11) NOT NULL DEFAULT '0',
is_recursive tinyint(1) NOT NULL DEFAULT '0',
plugin_formcreator_forms_id int(11) NOT NULL,
requester_id int(11) DEFAULT NULL,
validator_id int(11) DEFAULT NULL,
request_date datetime NOT NULL,
status enum('waiting','refused','accepted') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'waiting',
comment text COLLATE utf8_unicode_ci,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [glpidb]>

@Armin83
Copy link
Contributor Author

Armin83 commented Dec 27, 2018

MariaDB [glpidb]> show create table glpi_pluginformcreator_form_answers;
ERROR 1146 (42S02): Table 'glpidb.glpi_pluginformcreator_form_answers' doesn't exist
MariaDB [glpidb]> select * from glpi_configs where context='formcreator';
+-----+-------------+----------------+-------+
| id | context | name | value |
+-----+-------------+----------------+-------+
| 210 | formcreator | schema_version | 2.5 |
+-----+-------------+----------------+-------+
1 row in set (0.00 sec)

@Armin83
Copy link
Contributor Author

Armin83 commented Dec 27, 2018

2.5.0
Upgrade to 2.6.3

MariaDB [glpidb]> select * from glpi_configs where context='formcreator';
+-----+-------------+----------------+-------+
| id | context | name | value |
+-----+-------------+----------------+-------+
| 210 | formcreator | schema_version | 2.6 |
+-----+-------------+----------------+-------+
1 row in set (0.00 sec)

MariaDB [glpidb]> show create table glpi_pluginformcreator_form_answers;
ERROR 1146 (42S02): Table 'glpidb.glpi_pluginformcreator_form_answers' doesn't exist
MariaDB [glpidb]> show create table glpi_plugin_formcreator_formanswers;
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| glpi_plugin_formcreator_formanswers | CREATE TABLE glpi_plugin_formcreator_formanswers (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
entities_id int(11) NOT NULL DEFAULT '0',
is_recursive tinyint(1) NOT NULL DEFAULT '0',
plugin_formcreator_forms_id int(11) NOT NULL,
requester_id int(11) DEFAULT NULL,
validator_id int(11) DEFAULT NULL,
request_date datetime NOT NULL,
status enum('waiting','refused','accepted') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'waiting',
comment text COLLATE utf8_unicode_ci,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

i can see my forms

upgrade 2.7.... beta from developer branch
i can't see my forms same behavior

@btry
Copy link
Collaborator

btry commented Dec 31, 2018

Hi

In the source code of version 2.5.0 I see :
https://github.com/pluginsGLPI/formcreator/blob/2.5.0/install/mysql/plugin_formcreator_empty.sql#L60

Notice that the name of the table is glpi_plugin_formcreator_forms_answers and you searched for glpi_plugin_formcreator_form_answers (form without the final S).

If in the version 2.5.0 you have a table named glpi_plugin_formcreator_formanswers this may be due to an migration problem in an older version, or because you overwrote your old database on migrated copy.

In 2.6.0, the same table
https://github.com/pluginsGLPI/formcreator/blob/2.6.0/install/mysql/plugin_formcreator_empty.sql#L60

v2.5.0

CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_forms_answers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  `entities_id` int(11) NOT NULL DEFAULT '0',
  `is_recursive` tinyint(1) NOT NULL DEFAULT '0',
  `plugin_formcreator_forms_id` int(11) NOT NULL,
  `requester_id` int(11) DEFAULT NULL,
  `validator_id` int(11) DEFAULT NULL,
  `request_date` datetime NOT NULL,
  `status` enum('waiting','refused','accepted') NOT NULL DEFAULT 'waiting',
  `comment` text,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  INDEX `plugin_formcreator_forms_id` (`plugin_formcreator_forms_id`),
  INDEX `entities_id_is_recursive` (`entities_id`, `is_recursive`),
  INDEX `requester_id` (`requester_id`),
  INDEX `validator_id` (`validator_id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

v2.6.0

CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_forms_answers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  `entities_id` int(11) NOT NULL DEFAULT '0',
  `is_recursive` tinyint(1) NOT NULL DEFAULT '0',
  `plugin_formcreator_forms_id` int(11) NOT NULL,
  `requester_id` int(11) DEFAULT NULL,
  `users_id_validator` int(11) DEFAULT NULL,
  `groups_id_validator` int(11) DEFAULT NULL,
  `request_date` datetime NOT NULL,
  `status` enum('waiting','refused','accepted') NOT NULL DEFAULT 'waiting',
  `comment` text,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  INDEX `plugin_formcreator_forms_id` (`plugin_formcreator_forms_id`),
  INDEX `entities_id_is_recursive` (`entities_id`, `is_recursive`),
  INDEX `requester_id` (`requester_id`),
  INDEX `users_id_validator` (`users_id_validator`),
  INDEX `groups_id_validator` (`groups_id_validator`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Notice the table has the same name, but the column validator_id was replaced by 2 other columns users_id_validator, and groups_id_validator.

Visibility of forms

i can't see my forms same behavior

Please share a screenshot. I need to identify where the bug happens.

@btry
Copy link
Collaborator

btry commented Dec 31, 2018

@Armin83 please try the fix I did in #1254. this might fix your empty list issue. Still waitiing for your screenshot to ensure I'm searching in the right place.

@Sicoval31
Copy link

Bonjour,
La MAJ depuis la V2.6.5 remonte l'erreur suivante
La table 'glpi_test.glpi_plugin_formcreator_questionregexes' n'existe pas.

Pourriez vous me fournir le code de creation de la table ?
Merci

GLPI 9.3.2 innoDB

@btry
Copy link
Collaborator

btry commented Jan 4, 2019

Hi @Sicoval31

Please try the develop branch. The upgrade issues found in the beta should be fixed.

@Sicoval31
Copy link

Merci, c'est OK avec la version develop :)

@btry
Copy link
Collaborator

btry commented Jan 7, 2019

Hi @Armin83 i merged the fix #1254 which might contribute to solve your issue. With the current state of he develop branch, do you still reproduce your issue ?

@Armin83
Copy link
Contributor Author

Armin83 commented Jan 7, 2019

i hope i can test it on 09-01-2019

@Armin83
Copy link
Contributor Author

Armin83 commented Jan 9, 2019

2019-01-09 20_32_02-window

Austritt is missing in the first screen
2019_01_09_20_32_404444444444444_window

@Armin83
Copy link
Contributor Author

Armin83 commented Jan 9, 2019

the patch don't work for me.

@Armin83
Copy link
Contributor Author

Armin83 commented Jan 9, 2019

root@glpidev:/var/www/glpi/files/_log# cat sql-errors.log
[2019-01-09 20:37:36] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/inc/dbmysql.class.php line 177
*** MySQL query error:
SQL: SELECT fa.id, f.name, fa.status, fa.request_date
FROM glpi_plugin_formcreator_forms f
INNER JOIN glpi_plugin_formcreator_forms_validators fv ON fv.plugin_formcreator_forms_id=f.id
INNER JOIN glpi_plugin_formcreator_formanswers fa ON f.id = fa.plugin_formcreator_forms_id
WHERE (f.validation_required = 1 AND fv.items_id = '6' AND fv.itemtype = 'User' AND fa.users_id_validator = '6'
OR f.validation_required = 2 AND fv.items_id IN ('1', '5', '14') AND fv.itemtype = 'Group' AND fa.groups_id_validator IN ('1', '5', '14')
)
AND f.is_deleted = 0
ORDER BY fa.status ASC, fa.request_date DESC
LIMIT 0, 5
Error: Unknown column 'fa.users_id_validator' in 'where clause'
Backtrace :
plugins/formcreator/inc/form.class.php:871
plugins/formcreator/inc/form.class.php:600 PluginFormcreatorForm->showMyLastForms()
plugins/formcreator/front/formlist.php:62 PluginFormcreatorForm->showList()
{"user":"6@glpidev"}
root@glpidev:/var/www/glpi/files/_log# cat php-errors.log
[2019-01-09 20:37:36] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /var/www/glpi/inc/toolbox.class.php line 657
*** PHP Notice(8): Trying to get property 'num_rows' of non-object
Backtrace :
inc/dbmysql.class.php:284
plugins/formcreator/inc/form.class.php:872 DBmysql->numrows()
plugins/formcreator/inc/form.class.php:600 PluginFormcreatorForm->showMyLastForms()
plugins/formcreator/front/formlist.php:62 PluginFormcreatorForm->showList()
{"user":"6@glpidev","mem_usage":"0.000", 7.06Mio)"}
root@glpidev:/var/www/glpi/files/_log#

@Armin83
Copy link
Contributor Author

Armin83 commented Jan 9, 2019

ok. i read again and test again.

Back to my snapshot 9.3.3 - 2.5.0 i saw the wrong table. i dropped glpi_plugin_formcreator_formanswers in 2.5.0 and installed latest develop branch from to today. know i see my forms and all is fine. we can close the case thanks

@btry
Copy link
Collaborator

btry commented Jan 9, 2019

Great, thank you for your feedback.

@btry btry closed this as completed Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants