diff --git a/include/upgrader/streams/core.sig b/include/upgrader/streams/core.sig index 209fca107da75265e35d6cd2f12d71d5e89213a5..3cbda6fa0ad2b31ab58b8b2c3201f386774c454a 100644 --- a/include/upgrader/streams/core.sig +++ b/include/upgrader/streams/core.sig @@ -1 +1 @@ -5cd0a25a54fd27ed95f00d62edda4c6d +a22c2b4ff54ce5aa61e94124a73e6eac diff --git a/include/upgrader/streams/core/5cd0a25a-00000000.cleanup.sql b/include/upgrader/streams/core/5cd0a25a-00000000.cleanup.sql deleted file mode 100644 index 3b391fc4d5cab0d4c779c4d380ae769e2d67ce3d..0000000000000000000000000000000000000000 --- a/include/upgrader/streams/core/5cd0a25a-00000000.cleanup.sql +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @signature 0e47d678f50874fa0d33e1e3759f657e - * @version v1.9.6 - * @title Make fields disable-able per help topic - */ - -ALTER TABLE `%TABLE_PREFIX%help_topic` - DROP `form_id` int(10) unsigned NOT NULL default '0'; diff --git a/include/upgrader/streams/core/5cd0a25a-00000000.patch.sql b/include/upgrader/streams/core/5cd0a25a-00000000.patch.sql deleted file mode 100644 index 58e4fdfc2fd7e139cb432937efbd0fe4f318249c..0000000000000000000000000000000000000000 --- a/include/upgrader/streams/core/5cd0a25a-00000000.patch.sql +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @signature 0e47d678f50874fa0d33e1e3759f657e - * @version v1.9.6 - * @title Make fields disable-able per help topic - */ - -ALTER TABLE `%TABLE_PREFIX%form` - ADD `pid` int(10) unsigned DEFAULT NULL AFTER `id`, - ADD `name` varchar(64) NOT NULL DEFAULT '' AFTER `instructions`; - -ALTER TABLE `%TABLE_PREFIX%form_entry` - ADD `extra` text AFTER `sort`; - -CREATE TABLE `%TABLE_PREFIX%help_topic_form` ( - `id` int(11) unsigned NOT NULL auto_increment, - `topic_id` int(11) unsigned NOT NULL default 0, - `form_id` int(10) unsigned NOT NULL default 0, - `sort` int(10) unsigned NOT NULL default 1, - `extra` text, - PRIMARY KEY (`topic_id`, `form_id`) -) DEFAULT CHARSET=utf8; - -insert into `%TABLE_PREFIX%help_topic_form` - (`topic_id`, `form_id`, `sort`) - select A1.topic_id, case - when A2.form_id = 4294967295 then A3.form_id - when A1.form_id = 4294967295 then A2.form_id - else A1.form_id end as form_id, 1 as `sort` - from `%TABLE_PREFIX%help_topic` A1 - left join `%TABLE_PREFIX%help_topic` A2 on (A2.topic_pid = A1.topic_id) - left join `%TABLE_PREFIX%help_topic` A3 on (A3.topic_pid = A2.topic_id) - having `form_id` > 0 - union - select A2.topic_id, id as `form_id`, 2 as `sort` - from `%TABLE_PREFIX%form` A1 - join `%TABLE_PREFIX%help_topic` A2 - where A1.`type` = 'T'; - -ALTER TABLE `%TABLE_PREFIX%help_topic` - DROP `form_id` int(10) unsigned NOT NULL default '0'; - --- Finished with patch -UPDATE `%TABLE_PREFIX%config` - SET `value` = '0e47d678f50874fa0d33e1e3759f657e' - WHERE `key` = 'schema_signature' AND `namespace` = 'core'; diff --git a/include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql b/include/upgrader/streams/core/5cd0a25a-a22c2b4f.cleanup.sql similarity index 55% rename from include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql rename to include/upgrader/streams/core/5cd0a25a-a22c2b4f.cleanup.sql index 82a025fa7cee849a8a2d39e719e4cff8eb86ff4a..dd4a3f887dee2d7a24c557287cf94052c4fd2640 100644 --- a/include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql +++ b/include/upgrader/streams/core/5cd0a25a-a22c2b4f.cleanup.sql @@ -1,3 +1,12 @@ +/** + * @signature 0e47d678f50874fa0d33e1e3759f657e + * @version v1.9.6 + * @title Make fields disable-able per help topic + */ + +ALTER TABLE `%TABLE_PREFIX%help_topic` + DROP `form_id` int(10) unsigned NOT NULL default '0'; + ALTER TABLE `%TABLE_PREFIX%filter` DROP `reject_ticket`, DROP `use_replyto_email`, diff --git a/include/upgrader/streams/core/b26f29a6-00000000.patch.sql b/include/upgrader/streams/core/5cd0a25a-a22c2b4f.patch.sql similarity index 58% rename from include/upgrader/streams/core/b26f29a6-00000000.patch.sql rename to include/upgrader/streams/core/5cd0a25a-a22c2b4f.patch.sql index aab8ff1992d836b95ea717a5e073d3c5a3b2418b..509c83519cff637457c87a20df6b68c1db00de6a 100644 --- a/include/upgrader/streams/core/b26f29a6-00000000.patch.sql +++ b/include/upgrader/streams/core/5cd0a25a-a22c2b4f.patch.sql @@ -1,7 +1,12 @@ /** - * @version v1.9.5 - * @signature 00000000000000000000000000000000 - * @title Add flexible filter actions + * @signature a22c2b4ff54ce5aa61e94124a73e6eac + * @version v1.9.6 + * @title Make fields disable-able per help topic + * + * This patch adds the ability to associate more than one extra form with a + * help topic, allows specifying the sort order of each form, including the + * main ticket details forms, and also allows disabling any of the fields on + * any of the associated forms, including the issue details field. * * This patch migrates the columnar layout of the %filter table into a new * %filter_action table. The cleanup portion of the script will drop the old @@ -86,7 +91,48 @@ INSERT INTO `%TABLE_PREFIX%filter_action` FROM `%TABLE_PREFIX%filter` WHERE `status_id` != 0; --- Set new schema signature +ALTER TABLE `%TABLE_PREFIX%form` + ADD `pid` int(10) unsigned DEFAULT NULL AFTER `id`, + ADD `name` varchar(64) NOT NULL DEFAULT '' AFTER `instructions`; + +ALTER TABLE `%TABLE_PREFIX%form_entry` + ADD `extra` text AFTER `sort`; + +CREATE TABLE `%TABLE_PREFIX%help_topic_form` ( + `id` int(11) unsigned NOT NULL auto_increment, + `topic_id` int(11) unsigned NOT NULL default 0, + `form_id` int(10) unsigned NOT NULL default 0, + `sort` int(10) unsigned NOT NULL default 1, + `extra` text, + PRIMARY KEY (`topic_id`, `form_id`) +) DEFAULT CHARSET=utf8; + +-- Handle A4 / A3 / A2 / A1 help topics. For these, consider the forms +-- associated with each, which should sort above the ticket details form, as +-- the graphical interface rendered it suchly. Then, consider cascaded +-- forms, where the parent form was specified on a child. +insert into `%TABLE_PREFIX%help_topic_form` + (`topic_id`, `form_id`, `sort`) + select A1.topic_id, case + when A3.form_id = 4294967295 then A4.form_id + when A2.form_id = 4294967295 then A3.form_id + when A1.form_id = 4294967295 then A2.form_id + else COALESCE(A4.form_id, A3.form_id, A2.form_id, A1.form_id) end as form_id, 1 as `sort` + from `%TABLE_PREFIX%help_topic` A1 + left join `%TABLE_PREFIX%help_topic` A2 on (A2.topic_id = A1.topic_pid) + left join `%TABLE_PREFIX%help_topic` A3 on (A3.topic_id = A2.topic_pid) + left join `%TABLE_PREFIX%help_topic` A4 on (A4.topic_id = A3.topic_pid) + having `form_id` > 0 + union + select A2.topic_id, id as `form_id`, 2 as `sort` + from `%TABLE_PREFIX%form` A1 + join `%TABLE_PREFIX%help_topic` A2 + where A1.`type` = 'T'; + +ALTER TABLE `%TABLE_PREFIX%help_topic` + DROP `form_id` int(10) unsigned NOT NULL default '0'; + +-- Finished with patch UPDATE `%TABLE_PREFIX%config` - SET `value` = '00000000000000000000000000000000' + SET `value` = 'a22c2b4ff54ce5aa61e94124a73e6eac' WHERE `key` = 'schema_signature' AND `namespace` = 'core'; diff --git a/include/upgrader/streams/core/5cd0a25a-a22c2b4f.task.php b/include/upgrader/streams/core/5cd0a25a-a22c2b4f.task.php new file mode 100644 index 0000000000000000000000000000000000000000..0379bd4becece7cb4cf4688acfc891b1c08098ca --- /dev/null +++ b/include/upgrader/streams/core/5cd0a25a-a22c2b4f.task.php @@ -0,0 +1,14 @@ +<?php + +class InstructionPorter extends MigrationTask { + var $description = "Converting custom form instructions to HTML"; + + function run($max_time) { + foreach (DynamicForm::objects() as $F) { + $F->instructions = Format::htmlchars($F->get('instructions')); + $F->save(); + } + } +} + +return 'InstructionsPorter';