From 3cb23a9f878a0a1c403206af4a3152c8a85d8b01 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sat, 23 Apr 2011 00:33:01 +0200 Subject: [PATCH] Adding the locked and attendance_sheet_log db changes --- main/inc/lib/add_course.lib.inc.php | 20 +++++++++++++++++--- main/install/db_main.sql | 3 ++- main/install/migrate-db-1.8.7-1.8.8-pre.sql | 7 ++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php index 65268ab3ec..4afd334f75 100755 --- a/main/inc/lib/add_course.lib.inc.php +++ b/main/inc/lib/add_course.lib.inc.php @@ -360,6 +360,7 @@ function update_Db_course($course_db_name) { $TBL_ATTENDANCE_SHEET = $course_db_name . 'attendance_sheet'; $TBL_ATTENDANCE_CALENDAR = $course_db_name . 'attendance_calendar'; $TBL_ATTENDANCE_RESULT = $course_db_name . 'attendance_result'; + $TBL_ATTENDANCE_SHEET_LOG = $course_db_name . 'attendance_sheet_log'; // Thematic $TBL_THEMATIC = $course_db_name . 'thematic'; @@ -1740,7 +1741,8 @@ function update_Db_course($course_db_name) { attendance_qualify_title varchar(255) NULL, attendance_qualify_max int NOT NULL default 0, attendance_weight float(6,2) NOT NULL default '0.0', - session_id int NOT NULL default 0 + session_id int NOT NULL default 0, + locked int NOT NULL default 0 )" . $charset_clause; $result = Database::query($sql); @@ -1795,10 +1797,22 @@ function update_Db_course($course_db_name) { $sql = "ALTER TABLE `".$TBL_ATTENDANCE_RESULT."` ADD INDEX (user_id)"; Database::query($sql); + + // attendance sheet log table + $sql = "CREATE TABLE `".$TBL_ATTENDANCE_SHEET_LOG."` ( + id int NOT NULL auto_increment, + attendance_id int NOT NULL DEFAULT 0, + lastedit_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + lastedit_type varchar(200) NOT NULL, + lastedit_user_id int NOT NULL DEFAULT 0, + calendar_date_value datetime NULL, + PRIMARY KEY (id) + )" . $charset_clause; + $result = Database::query($sql) or die(Database::error()); + // Thematic table - $sql = " - CREATE TABLE `".$TBL_THEMATIC."` ( + $sql = "CREATE TABLE `".$TBL_THEMATIC."` ( id int NOT NULL auto_increment PRIMARY KEY, title varchar(255) NOT NULL, content text NULL, diff --git a/main/install/db_main.sql b/main/install/db_main.sql index a94fd1a3e2..410cde8032 100755 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -822,7 +822,7 @@ VALUES ('hide_courses_in_sessions',NULL,'radio', 'Platform','false','HideCoursesInSessionsTitle', 'HideCoursesInSessionsComment','platform',NULL, 1), ('enable_quiz_scenario', NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1), ('enable_nanogong',NULL,'radio','Tools','false','EnableNanogongTitle','EnableNanogongComment',NULL,NULL, 0), -('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.14358','DokeosDatabaseVersion','', NULL, NULL, 0); +('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.14518','DokeosDatabaseVersion','', NULL, NULL, 0); UNLOCK TABLES; /*!40000 ALTER TABLE settings_current ENABLE KEYS */; @@ -1254,6 +1254,7 @@ CREATE TABLE gradebook_evaluation ( max float unsigned NOT NULL, visible tinyint NOT NULL, type varchar(40) NOT NULL default 'evaluation', + locked int NOT NULL DEFAULT 0, PRIMARY KEY (id) ); DROP TABLE IF EXISTS gradebook_link; diff --git a/main/install/migrate-db-1.8.7-1.8.8-pre.sql b/main/install/migrate-db-1.8.7-1.8.8-pre.sql index a9b358822b..c6a3b5ebe6 100755 --- a/main/install/migrate-db-1.8.7-1.8.8-pre.sql +++ b/main/install/migrate-db-1.8.7-1.8.8-pre.sql @@ -189,7 +189,9 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value, INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_nanogong', 'true', 'Yes'); INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_nanogong', 'false', 'No'); -UPDATE settings_current SET selected_value = '1.8.8.14358' WHERE variable = 'chamilo_database_version'; +ALTER TABLE gradebook_evaluation ADD COLUMN locked int NOT NULL DEFAULT 0; + +UPDATE settings_current SET selected_value = '1.8.8.14518' WHERE variable = 'chamilo_database_version'; -- xxSTATSxx ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0; @@ -225,3 +227,6 @@ INSERT INTO course_setting(variable,value,category) VALUES ('pdf_export_watermar ALTER TABLE quiz ADD COLUMN propagate_neg INT NOT NULL DEFAULT 0; ALTER TABLE quiz_answer MODIFY COLUMN hotspot_type ENUM('square','circle','poly','delineation','oar'); +ALTER TABLE attendance ADD COLUMN locked int NOT NULL default 0; +CREATE TABLE attendance_sheet_log (id INT NOT NULL AUTO_INCREMENT, attendance_id INT NOT NULL DEFAULT 0, lastedit_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', lastedit_type VARCHAR(200) NOT NULL, lastedit_user_id INT NOT NULL DEFAULT 0, calendar_date_value DATETIME NULL, PRIMARY KEY (id)); +