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