diff --git a/include/class.list.php b/include/class.list.php index e873f4ee9a37d683422cd5e32cb3de19baaba3f5..a182ef3ce7ed46ef1dc2d6f4087016ef62cfc222 100644 --- a/include/class.list.php +++ b/include/class.list.php @@ -148,12 +148,6 @@ class DynamicList extends VerySimpleModel implements CustomList { var $_items; var $_form; - var $_config; - - function __construct() { - call_user_func_array(array('parent', '__construct'), func_get_args()); - $this->_config = new Config('list.'.$this->getId()); - } function getId() { return $this->get('id'); @@ -318,7 +312,7 @@ class DynamicList extends VerySimpleModel implements CustomList { } function getConfiguration() { - return JsonDataParser::parse($this->_config->get('configuration')); + return JsonDataParser::parse($this->configuration); } function getTranslateTag($subtag) { @@ -402,6 +396,10 @@ class DynamicList extends VerySimpleModel implements CustomList { } static function create($ht=false, &$errors=array()) { + if (isset($ht['configuration'])) { + $ht['configuration'] = JsonDataEncoder::encode($ht['configuration']); + } + $inst = parent::create($ht); $inst->set('created', new SqlFunction('NOW')); @@ -412,12 +410,6 @@ class DynamicList extends VerySimpleModel implements CustomList { $form->save(); } - if (isset($ht['configuration'])) { - $inst->save(); - $c = new Config('list.'.$inst->getId()); - $c->set('configuration', JsonDataEncoder::encode($ht['configuration'])); - } - if (isset($ht['items'])) { $inst->save(); foreach ($ht['items'] as $i) { diff --git a/include/upgrader/streams/core/9143a511-00000000.cleanup.sql b/include/upgrader/streams/core/9143a511-00000000.cleanup.sql index 0243fc683894c330a314fff410932d7ded0675c5..c04fdad7a2cd7845fa6d493de507a69da5ef14a4 100644 --- a/include/upgrader/streams/core/9143a511-00000000.cleanup.sql +++ b/include/upgrader/streams/core/9143a511-00000000.cleanup.sql @@ -58,3 +58,6 @@ ALTER TABLE `%TABLE_PREFIX%sla` DELETE FROM `%TABLE_PREFIX%config` WHERE `key`='transient' AND `namespace` LIKE 'sla.%'; + +DELETE FROM `%TABLE_PREFIX%config` +WHERE `key`='configuration' AND `namespace` LIKE 'list.%'; diff --git a/include/upgrader/streams/core/9143a511-00000000.patch.sql b/include/upgrader/streams/core/9143a511-00000000.patch.sql index 3d65ae0eb7bd00199967ca5ca1bdc20ae6618569..faeec3ab5a63da39b9c91bcf1d16f6f4641551e1 100644 --- a/include/upgrader/streams/core/9143a511-00000000.patch.sql +++ b/include/upgrader/streams/core/9143a511-00000000.patch.sql @@ -79,6 +79,15 @@ UPDATE `%TABLE_PREFIX%sla` A1 ALTER TABLE `%TABLE_PREFIX%ticket` ADD `source_extra` varchar(40) NULL default NULL AFTER `source`; +-- Retire %config[namespace=list.x, key=configuration] +ALTER TABLE `%TABLE_PREFIX%list` + ADD `configuration` text NOT NULL DEFAULT '' AFTER `type`; + +UPDATE `%TABLE_PREFIX%list` A1 + JOIN (SELECT `value` FROM `%TABLE_PREFIX%config`) `config` + ON (`config`.`namespace` = CONCAT('list.', A1.`id`) AND `config`.`key` = 'configuration') + SET A1.`configuration` = `config`.`value`; + -- Finished with patch UPDATE `%TABLE_PREFIX%config` SET `value` = '00000000000000000000000000000000' diff --git a/setup/inc/streams/core/install-mysql.sql b/setup/inc/streams/core/install-mysql.sql index c347e23416c1d84f94db252141163b2a40356160..873da492077dee0aa9ac826c7f9e6be4fa122558 100644 --- a/setup/inc/streams/core/install-mysql.sql +++ b/setup/inc/streams/core/install-mysql.sql @@ -173,6 +173,7 @@ CREATE TABLE `%TABLE_PREFIX%list` ( `sort_mode` enum('Alpha', '-Alpha', 'SortCol') NOT NULL DEFAULT 'Alpha', `masks` int(11) unsigned NOT NULL DEFAULT 0, `type` VARCHAR( 16 ) NULL DEFAULT NULL, + `configuration` text NOT NULL DEFAULT '', `notes` text, `created` datetime NOT NULL, `updated` datetime NOT NULL,