Skip to content
Snippets Groups Projects
Commit 9bad2fbf authored by Peter Rotich's avatar Peter Rotich
Browse files

Add list.yaml

DynamicList initial data
parent 053a3231
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@ class Internationalization {
'department.yaml' => 'Dept::create',
'sla.yaml' => 'SLA::create',
'form.yaml' => 'DynamicForm::create',
'list.yaml' => 'DynamicList::create',
// Note that department, sla, and forms are required for
// help_topic
'help_topic.yaml' => 'Topic::create',
......
......@@ -240,6 +240,7 @@ class DynamicList extends VerySimpleModel implements CustomList {
function addItem($vars, &$errors) {
$item = DynamicListItem::create(array(
'status' => 1,
'list_id' => $this->getId(),
'sort' => $vars['sort'],
'value' => $vars['value'],
......@@ -696,17 +697,17 @@ class TicketStatusList extends CustomListHandler {
require_once(INCLUDE_DIR.'class.i18n.php');
$i18n = new Internationalization();
$tpl = $i18n->getTemplate('form.yaml');
$tpl = $i18n->getTemplate('list.yaml');
foreach ($tpl->getData() as $f) {
if ($f['type'] == 'S') {
$form = DynamicForm::create($f);
$form->save();
if ($f['type'] == 'ticket-status') {
$list = DynamicList::create($f);
$list->save();
break;
}
}
$o = DynamicForm::objects()->filter(array('type'=>'S'));
if (!$form || !$o)
if (!$list || !($o=DynamicForm::objects()->filter(
array('type'=>'L'.$list->getId()))))
return false;
// Create default statuses
......
......@@ -198,46 +198,3 @@
configuration:
rows: 4
cols: 40
- type: S # notrans
title: Ticket Status Properties
instructions: Properties that can be set on a ticket status.
deletable: false
fields:
- type: choices # notrans
name: state # notrans
label: State
required: true
sort: 1
edit_mask: 63
configuration:
choices:|
open: Open
closed: Closed
archived: Archived
deleted: Deleted
prompt: State of a ticket
- type: choices # notrans
name: flags # notrans
label: Flags
required: false
sort: 2
edit_mask: 63
configuration:
choices:|
onhold: Onhold (Disable SLA)
overdue: Mark as Overdue
answered: Mark as Answered
prompt: Status flags
multiselect: true
- type: memo # notrans
name: description
label: Description
required: false
sort: 3
edit_mask: 15
configuration:
rows: 2
cols: 40
html: false
length: 100
#
# Custom (dynamic) lists. This data is used as the initial,
# minimal data for dynamic list that ships with the system.
#
# Fields:
# id: Primary id (not recommended)
# name: Name of the list
# name_plural: Name in plural (optional)
# sort_mode: Sorting order (Alpha, -Alpha, SortCol)
# masks: Edit masks to indicate various statuses of the list
# (e.g if editable or deletable..etc)
# notes: Notes for the list
# items: List of items for the list
# id: Primary id
# value: Value (name) of the list item
# extra: Abbreviated version of the value
# status: If enabled (1 - enabled, 0 - disabled)
# sort: Sort order (optional)
# properties: Item-specific config based on Ticket Flags form fields
# (key): (value)
# properties: List properties form (see form.yaml for details)
#
---
# Ticket statuses
- type: ticket-status #notrans
name: Ticket Status
name_plural: Ticket Statuses
sort_mode: SortCol # notrans
masks: 13
notes: |
Ticket statuses
properties:
title: Ticket Status Properties
instructions: Properties that can be set on a ticket status.
deletable: false
fields:
- type: state # notrans
name: state # notrans
label: State
required: true
sort: 1
edit_mask: 63
configuration:
prompt: State of a ticket
- type: flags # notrans
name: flags # notrans
label: Flags
required: false
sort: 2
edit_mask: 63
configuration:
prompt: Ticket Flags
multiselect: true
- type: memo # notrans
name: description # notrans
label: Description
required: false
sort: 3
edit_mask: 15
configuration:
rows: 2
cols: 40
html: false
length: 100
configuration:
handler: TicketStatusList
# Ticket flags
- type: ticket-flag # notrans
name: Ticket Flag
name_plural: Ticket Flags
sort_mode: Alpha # notrans
masks: 15
notes: |
Flags that can be set on tickets
properties:
title: Flag Properties
instructions: Properties that can be set on a flag.
deletable: false
fields:
- type: state # notrans
name: states # notrans
label: Allowed States
required: true
sort: 1
edit_mask: 63
configuration:
prompt: Allowed Ticket States
multiselect: true
- type: memo # notrans
name: description # notrans
label: Description
required: false
sort: 2
edit_mask: 15
configuration:
rows: 2
cols: 40
html: false
length: 100
items: # Note that id doubles as a bit mask for the flag (must be preset)
- id: 1 # notrans
value: Answered
extra: answered
status: 3
sort: 1
configuration:
states:
open: Open
description:|
Marked as Answered
- id: 2 # notrans
value: Onhold
extra: onhold
status: 3
sort: 2
configuration:
states:
open: Open
description:|
Put on hold
- id: 4 # notrans
value: Overdue
extra: overdue
status: 3
sort: 3
configuration:
states:
open: Open
description:|
Marked overdue
9b9e2dc4551d448f081f180ca3829fa8
cbf8c933d6d2eaaa971042eb2efce247
/**
* @version v1.9.3
* @signature 9b9e2dc4551d448f081f180ca3829fa8
* @title Add custom ticket status support
*
*/
CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(60) NOT NULL DEFAULT '',
`state` varchar(16) NOT NULL DEFAULT 'open',
`mode` int(11) unsigned NOT NULL DEFAULT '0',
`flags` int(10) unsigned NOT NULL DEFAULT '0',
`sort` int(11) unsigned NOT NULL DEFAULT '0',
`notes` text NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) DEFAULT CHARSET=utf8;
UPDATE `%TABLE_PREFIX%config`
SET `value` = '9b9e2dc4551d448f081f180ca3829fa8'
WHERE `key` = 'schema_signature' AND `namespace` = 'core';
......@@ -153,10 +153,13 @@ CREATE TABLE `%TABLE_PREFIX%list` (
`name` varchar(255) NOT NULL,
`name_plural` varchar(255),
`sort_mode` enum('Alpha', '-Alpha', 'SortCol') NOT NULL DEFAULT 'Alpha',
`masks` int(11) unsigned NOT NULL DEFAULT 0,
`type` VARCHAR( 16 ) NULL DEFAULT NULL,
`notes` text,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
KEY `type` (`type`)
) DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `%TABLE_PREFIX%list_items`;
......
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