Skip to content
Snippets Groups Projects
Commit e9301b57 authored by Jared Hancock's avatar Jared Hancock
Browse files

list: Retire %config[namespace=list.x, key=configuration]

parent 85379391
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -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.%';
......@@ -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'
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment