Skip to content
Snippets Groups Projects
Commit 5be0de0d authored by Jared Hancock's avatar Jared Hancock Committed by Peter Rotich
Browse files

queue: Fix upgrade crash

- %queue_sorts needs to exist before queues are inserted
- old queue id numbers need to be moved up to make room for initial queues
parent a7e1fbcb
No related branches found
No related tags found
No related merge requests found
# Columns are not necessary and a default list is used if no columns are
# specified.
#
# Fields:
# Fields:
# id:
# flags: (unused)
# name: Display name of the column
......@@ -108,7 +108,7 @@
- id: 11
name: "Department"
primary: "dept"
primary: "dept_id"
truncate: "wrap"
annotations: "[]"
conditions: "[]"
......@@ -121,7 +121,7 @@
annotations: "[]"
conditions: "[]"
- id: 12
- id: 13
name: "Last Response"
primary: "thread__lastresponse"
filter: "date:human"
......
<?php
class QueueSortCreator extends MigrationTask {
var $description = "Load customziable sorting for ticket queues";
var $description = "Load customziable ticket queues";
function run($time) {
$i18n = new Internationalization('en_US');
$columns = $i18n->getTemplate('queue_column.yaml')->getData();
foreach ($columns as $C) {
QueueColumn::__create($C);
}
// Make room for the new queues starting at ID 1
$id = new SqlField('id');
CustomQueue::objects()->update(['id' => $id->plus(30)]);
$queues = $i18n->getTemplate('queue.yaml')->getData();
foreach ($queues as $C) {
CustomQueue::__create($C);
}
$columns = $i18n->getTemplate('queue_sort.yaml')->getData();
foreach ($columns as $C) {
QueueSort::__create($C);
......@@ -20,6 +32,10 @@ class QueueSortCreator extends MigrationTask {
$q->flags |= CustomQueue::FLAG_INHERIT_SORTING;
$q->save();
}
// Set default queue to 'open'
global $cfg;
$cfg->set('default_ticket_queue', 1);
}
}
return 'QueueSortCreator';
<?php
class QueueCreator extends MigrationTask {
var $description = "Load customziable ticket queues";
function run($time) {
$i18n = new Internationalization('en_US');
$columns = $i18n->getTemplate('queue_column.yaml')->getData();
foreach ($columns as $C) {
QueueColumn::__create($C);
}
$queues = $i18n->getTemplate('queue.yaml')->getData();
foreach ($queues as $C) {
CustomQueue::__create($C);
}
// Set default queue to 'open'
global $cfg;
$cfg->set('default_ticket_queue', 1);
}
}
return 'QueueCreator';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment