Rename database iid to id - refs #6715

1.9.x
Francis Gonzales 12 years ago
parent f06e82ca17
commit 3f1da5d08d
  1. 49
      plugin/ticket/database.php

@ -8,19 +8,19 @@ $objPlugin = new TicketPlugin();
$table = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int unsigned not null,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
ticket_id int UNSIGNED DEFAULT NULL,
user_id int UNSIGNED DEFAULT NULL,
assigned_date datetime DEFAULT NULL,
sys_insert_user_id int UNSIGNED DEFAULT NULL,
PRIMARY KEY PK_ticket_assigned_log (iid),
PRIMARY KEY PK_ticket_assigned_log (id),
KEY FK_ticket_assigned_log (ticket_id))";
Database::query($sql);
//Category
$table = Database::get_main_table(TABLE_TICKET_CATEGORY);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int unsigned not null,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
category_id char(3) NOT NULL,
project_id char(3) NOT NULL,
name varchar(100) NOT NULL,
@ -31,7 +31,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_insert_datetime datetime DEFAULT NULL,
sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (iid))";
PRIMARY KEY (id))";
Database::query($sql);
//Default Categories
@ -48,7 +48,7 @@ foreach ($categoRow as $category => $description) {
//Online evaluation requires a course
if ($i == 6) {
$attributes = array(
'iid' => $i,
'id' => $i,
'category_id' => $i,
'name' => $category,
'description' => $description,
@ -57,7 +57,7 @@ foreach ($categoRow as $category => $description) {
);
} else {
$attributes = array(
'iid' => $i,
'id' => $i,
'category_id' => $i,
'project_id' => 1,
'description' => $description,
@ -71,7 +71,7 @@ foreach ($categoRow as $category => $description) {
//END default categories
$table = Database::get_main_table(TABLE_TICKET_MESSAGE);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int UNSIGNED NOT NULL AUTO_INCREMENT,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
message_id int UNSIGNED NOT NULL,
ticket_id int UNSIGNED NOT NULL,
subject varchar(150) DEFAULT NULL,
@ -82,13 +82,13 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_insert_datetime datetime DEFAULT NULL,
sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (iid),
PRIMARY KEY (id),
KEY FK_tick_message (ticket_id) )";
Database::query($sql);
$table = Database::get_main_table(TABLE_TICKET_MESSAGE_ATTACHMENTS);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int UNSIGNED NOT NULL AUTO_INCREMENT,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
message_attch_id char(2) NOT NULL,
message_id char(2) NOT NULL,
ticket_id int UNSIGNED NOT NULL,
@ -99,14 +99,14 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_insert_datetime datetime DEFAULT NULL,
sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (iid),
PRIMARY KEY (id),
KEY ticket_message_id_fk (message_id))";
Database::query($sql);
//Priority
$table = Database::get_main_table(TABLE_TICKET_PRIORITY);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int UNSIGNED NOT NULL AUTO_INCREMENT,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
priority_id char(3) NOT NULL,
priority varchar(20) DEFAULT NULL,
priority_desc varchar(250) DEFAULT NULL,
@ -116,7 +116,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_insert_datetime datetime DEFAULT NULL,
sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (iid))";
PRIMARY KEY (id))";
Database::query($sql);
//Default Priorities
$defaultPriorities = array(
@ -127,7 +127,7 @@ $defaultPriorities = array(
$i = 1;
foreach ($defaultPriorities as $pId => $priority) {
$attributes = array(
'iid' => $i,
'id' => $i,
'priority_id' => $pId,
'priority' => $priority,
'priority_desc' => $priority
@ -139,7 +139,7 @@ foreach ($defaultPriorities as $pId => $priority) {
$table = Database::get_main_table(TABLE_TICKET_PROJECT);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int UNSIGNED NOT NULL AUTO_INCREMENT,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
project_id char(3) NOT NULL,
name varchar(50) DEFAULT NULL,
description varchar(250) DEFAULT NULL,
@ -149,11 +149,11 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
sys_insert_datetime datetime DEFAULT NULL,
sys_lastedit_user_id int UNSIGNED DEFAULT NULL,
sys_lastedit_datetime datetime DEFAULT NULL,
PRIMARY KEY (iid))";
PRIMARY KEY (id))";
Database::query($sql);
//Default Project Table Ticket
$attributes = array(
'iid' => 1,
'id' => 1,
'project_id' => 1,
'name' => 'Ticket System'
);
@ -163,11 +163,11 @@ Database::insert($table, $attributes);
//STATUS
$table = Database::get_main_table(TABLE_TICKET_STATUS);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
iid int UNSIGNED NOT NULL AUTO_INCREMENT,
id int UNSIGNED NOT NULL AUTO_INCREMENT,
status_id char(3) NOT NULL,
name varchar(100) NOT NULL,
description varchar(255) DEFAULT NULL,
PRIMARY KEY (iid))";
PRIMARY KEY (id))";
Database::query($sql);
//Default status
$defaultStatus = array(
@ -181,7 +181,7 @@ $defaultStatus = array(
$i = 1;
foreach ($defaultStatus as $abr => $status) {
$attributes = array(
'iid' => $i,
'id' => $i,
'status_id' => $abr,
'name' => $status
);
@ -219,9 +219,8 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
Database::query($sql);
//Menu main tabs
$objPlugin->addTab('Ticket', '/plugin/ticket/src/myticket.php');
//Extra Settings
$extraSettings = array(
'allow_student_add' => 'true'
);
$objPlugin->addExtraSettings($extraSettings);
$rsTab = $objPlugin->addTab('Ticket', '/plugin/ticket/src/myticket.php');
if ($rsTab) {
echo "<script>location.href = '" . $_SERVER['REQUEST_URI'] . "';</script>";
}
Loading…
Cancel
Save