@@ -38,6 +38,7 @@ class PluginFormcreatorUpgradeTo2_13 {
38
38
public function upgrade (Migration $ migration ) {
39
39
$ this ->migration = $ migration ;
40
40
$ this ->migrateEntityConfig ();
41
+ $ this ->addDefaultFormListMode ();
41
42
$ this ->fixRootEntityConfig ();
42
43
$ this ->migrateFkToUnsignedInt ();
43
44
$ this ->addFormAnswerTitle ();
@@ -46,7 +47,7 @@ public function upgrade(Migration $migration) {
46
47
$ this ->addTargetValidationSetting ();
47
48
$ this ->addFormVisibility ();
48
49
$ this ->addDashboardVisibility ();
49
- $ this ->addRequestSourceSeting ();
50
+ $ this ->addRequestSourceSetting ();
50
51
}
51
52
52
53
public function addFormAnswerTitle () {
@@ -159,12 +160,13 @@ protected function migrateEntityConfig() {
159
160
*
160
161
* @return void
161
162
*/
162
- private function fixRootEntityConfig () {
163
+ private function fixRootEntityConfig (): void {
163
164
global $ DB ;
164
165
165
166
$ table = 'glpi_plugin_formcreator_entityconfigs ' ;
166
167
$ DB ->update ($ table , [
167
168
'replace_helpdesk ' => new QueryExpression ("IF(`replace_helpdesk` = -2, 0, `replace_helpdesk`) " ),
169
+ 'default_form_list_mode ' => new QueryExpression ("IF(`default_form_list_mode` = -2, 0, `default_form_list_mode`) " ),
168
170
'sort_order ' => new QueryExpression ("IF(`sort_order` = -2, 0, `sort_order`) " ),
169
171
'is_kb_separated ' => new QueryExpression ("IF(`is_kb_separated` = -2, 0, `is_kb_separated`) " ),
170
172
'is_search_visible ' => new QueryExpression ("IF(`is_search_visible` = -2, 1, `is_search_visible`) " ),
@@ -276,7 +278,7 @@ protected function migrateFkToUnsignedInt() {
276
278
$ this ->migration ->changeField ($ table , 'id ' , 'id ' , 'int ' . DBConnection::getDefaultPrimaryKeySignOption () . ' not null auto_increment ' );
277
279
}
278
280
279
- public function addRequestSourceSeting (): void {
281
+ public function addRequestSourceSetting (): void {
280
282
global $ DB ;
281
283
282
284
$ table = 'glpi_plugin_formcreator_targettickets ' ;
@@ -289,4 +291,13 @@ public function addRequestSourceSeting(): void {
289
291
$ DB ->queryOrDie ("UPDATE ` $ table` SET `source_rule` = '1', `source_question` = ' $ formcreatorSourceId' " );
290
292
}
291
293
}
294
+
295
+ public function addDefaultFormListMode () {
296
+ $ table = 'glpi_plugin_formcreator_entityconfigs ' ;
297
+
298
+ $ this ->migration ->addField ($ table , 'default_form_list_mode ' , 'int not null default -2 ' , ['after ' => 'replace_helpdesk ' ]);
299
+ $ this ->migration ->migrationOneTable ($ table );
300
+
301
+ $ this ->migration ->addPostQuery ("UPDATE `glpi_plugin_formcreator_entityconfigs` SET `default_form_list_mode`=0 WHERE `id`=0 " );
302
+ }
292
303
}
0 commit comments