diff --git a/include/class.i18n.php b/include/class.i18n.php index 17709bee89b112527e2158910641d18608c64555..ab692eb6292cd2a4181249920eadc04006054eeb 100644 --- a/include/class.i18n.php +++ b/include/class.i18n.php @@ -64,6 +64,7 @@ class Internationalization { 'ticket_status.yaml' => 'TicketStatus::__create', // Role 'role.yaml' => 'Role::__create', + 'event.yaml' => 'Event::__create', 'file.yaml' => 'AttachmentFile::__create', 'sequence.yaml' => 'Sequence::__create', 'queue_column.yaml' => 'QueueColumn::__create', diff --git a/include/class.thread.php b/include/class.thread.php index 0807834b39590c969aacd266fb4e0c51c33c0fb2..a2dbb5065998ef38a4c74c0e53d0ecddea1c1165 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -2095,6 +2095,21 @@ class Event extends VerySimpleModel { function getDescription() { return $this->description; } + + static function create($vars=false, &$errors=array()) { + $event = new static($vars); + return $event; + } + + static function __create($vars, &$errors=array()) { + $event = self::create($vars); + $event->save(); + return $event; + } + + function save($refetch=false) { + return parent::save($refetch); + } } class ThreadEvents extends InstrumentedList { diff --git a/include/i18n/en_US/event.yaml b/include/i18n/en_US/event.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7c9c8ed5bb93d531a50a21f6b84f6a4caf0f07ee --- /dev/null +++ b/include/i18n/en_US/event.yaml @@ -0,0 +1,61 @@ +# +# event.yaml +# +# Events initially inserted into the system. +# +--- +- id: 1 + name: created + description: + +- id: 2 + name: closed + description: + +- id: 3 + name: reopened + description: + +- id: 4 + name: assigned + description: + +- id: 5 + name: released + description: + +- id: 6 + name: transferred + description: + +- id: 7 + name: referred + description: + +- id: 8 + name: overdue + description: + +- id: 9 + name: edited + description: + +- id: 10 + name: viewed + description: + +- id: 11 + name: error + description: + +- id: 12 + name: collab + description: + +- id: 13 + name: resent + description: + +- id: 14 + name: deleted + description: diff --git a/include/upgrader/streams/core.sig b/include/upgrader/streams/core.sig index cd7008c3cb852cd0758773f740849bb01329bdb3..00b20916567f6418d4c640ae0895c26b3499d242 100644 --- a/include/upgrader/streams/core.sig +++ b/include/upgrader/streams/core.sig @@ -1 +1 @@ -226da4e7298917160c7499cb63370f83 +00c949a623b82848baaf3480b51307e3 diff --git a/include/upgrader/streams/core/26fd79dc-226da4e7.cleanup.sql b/include/upgrader/streams/core/26fd79dc-00c949a6.cleanup.sql similarity index 100% rename from include/upgrader/streams/core/26fd79dc-226da4e7.cleanup.sql rename to include/upgrader/streams/core/26fd79dc-00c949a6.cleanup.sql diff --git a/include/upgrader/streams/core/26fd79dc-226da4e7.patch.sql b/include/upgrader/streams/core/26fd79dc-00c949a6.patch.sql similarity index 91% rename from include/upgrader/streams/core/26fd79dc-226da4e7.patch.sql rename to include/upgrader/streams/core/26fd79dc-00c949a6.patch.sql index b5d19699c2306c5d6bd2218cfa1bb036c4b31d73..774e248b961eee5cf30ee8459e3ca76496e27059 100644 --- a/include/upgrader/streams/core/26fd79dc-226da4e7.patch.sql +++ b/include/upgrader/streams/core/26fd79dc-00c949a6.patch.sql @@ -1,5 +1,5 @@ /** -* @signature 226da4e7298917160c7499cb63370f83 +* @signature 00c949a623b82848baaf3480b51307e3 * @version v1.11.0 * @title Database Optimization * @@ -41,5 +41,5 @@ ALTER TABLE `%TABLE_PREFIX%thread_event` -- Finished with patch UPDATE `%TABLE_PREFIX%config` - SET `value` = '226da4e7298917160c7499cb63370f83', `updated` = NOW() + SET `value` = '00c949a623b82848baaf3480b51307e3', `updated` = NOW() WHERE `key` = 'schema_signature' AND `namespace` = 'core'; diff --git a/include/upgrader/streams/core/26fd79dc-226da4e7.task.php b/include/upgrader/streams/core/26fd79dc-00c949a6.task.php similarity index 100% rename from include/upgrader/streams/core/26fd79dc-226da4e7.task.php rename to include/upgrader/streams/core/26fd79dc-00c949a6.task.php diff --git a/setup/inc/streams/core/install-mysql.sql b/setup/inc/streams/core/install-mysql.sql index bb13f3944ca3e2fd87aea3f2ef98b05716178fe2..d023e83ca506ac49e41578256a0a7ead0cb41766 100644 --- a/setup/inc/streams/core/install-mysql.sql +++ b/setup/inc/streams/core/install-mysql.sql @@ -717,18 +717,18 @@ CREATE TABLE `%TABLE_PREFIX%event` ( `name` varchar(60) NOT NULL, `description` varchar(60) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`), + UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `%TABLE_PREFIX%thread_event`; CREATE TABLE `%TABLE_PREFIX%thread_event` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `thread_id` int(11) unsigned NOT NULL default '0', + `event_id` int(11) unsigned DEFAULT NULL, `staff_id` int(11) unsigned NOT NULL, `team_id` int(11) unsigned NOT NULL, `dept_id` int(11) unsigned NOT NULL, `topic_id` int(11) unsigned NOT NULL, - `state` enum('created','closed','reopened','assigned','released','transferred', 'referred', 'overdue','edited','viewed','error','collab','resent', 'deleted') NOT NULL, `data` varchar(1024) DEFAULT NULL COMMENT 'Encoded differences', `username` varchar(128) NOT NULL default 'SYSTEM', `uid` int(11) unsigned DEFAULT NULL, @@ -736,8 +736,8 @@ CREATE TABLE `%TABLE_PREFIX%thread_event` ( `annulled` tinyint(1) unsigned NOT NULL default '0', `timestamp` datetime NOT NULL, PRIMARY KEY (`id`), - KEY `ticket_state` (`thread_id`, `state`, `timestamp`), - KEY `ticket_stats` (`timestamp`, `state`) + KEY `ticket_state` (`thread_id`, `event_id`, `timestamp`), + KEY `ticket_stats` (`timestamp`, `event_id`) ) DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `%TABLE_PREFIX%thread_referral`;