Fixing special_course course field when migrating to 1.10

skala
Julio Montoya 12 years ago
parent 030b27b230
commit 952aa91538
  1. 2
      main/install/1.10.0/db_main.sql
  2. 4
      main/install/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql
  3. 1
      main/install/1.10.0/update-db-1.9.0-1.10.0.inc.php
  4. 8
      main/install/db_main.sql
  5. 17
      main/install/update-db-1.9.0-1.10.0.inc.php

@ -2717,7 +2717,7 @@ CREATE TABLE IF NOT EXISTS message_attachment (
INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','Special course', 'Yes', 1 , 1);
INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (13, 'special_course','Special course', 'Yes', 1 , 1);
--
-- Table structure for table block

@ -164,5 +164,7 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teac
ALTER TABLE track_e_course_access ADD COLUMN c_id INT NOT NULL DEFAULT 0;
UPDATE course_field SET field_type = 3 WHERE field_variable = 'special_course';
-- Do not move this
UPDATE settings_current SET selected_value = '1.10.0.21694' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.030b27b' WHERE variable = 'chamilo_database_version';

@ -87,7 +87,6 @@ $update = function($_configuration, $mainConnection, $dryRun, $output, $app) {
$temp_session_id = $row['session_id'];
$order = 1;
}
//echo $row['c_id'].'-'.$row['session_id'].'-'.$row['id']."\n";
$ins = "INSERT INTO $to (c_id, session_id, exercise_id, exercise_order)".
" VALUES ($cid, $temp_session_id, {$row['id']}, $order)";
$mainConnection->executeQuery($ins);

@ -2715,9 +2715,9 @@ CREATE TABLE IF NOT EXISTS message_attachment (
PRIMARY KEY (id)
);
INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','Special course', 'Yes', 1 , 1);
INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (3, 'special_course','Special course', 'Yes', 1 , 1);
INSERT INTO course_field_options (field_id, option_value, option_display_text, option_order) VALUES ('1', '1', 'Yes', '1');
INSERT INTO course_field_options (field_id, option_value, option_display_text, option_order) VALUES ('1', '0', 'No', '2');
--
-- Table structure for table block
@ -3087,4 +3087,4 @@ CREATE TABLE branch_transaction (
);
-- Do not move this
UPDATE settings_current SET selected_value = '1.10.0.21593' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.030b27b' WHERE variable = 'chamilo_database_version';

@ -179,13 +179,26 @@ if (defined('SYSTEM_INSTALLATION')) {
$temp_session_id = $row['session_id'];
$order = 1;
}
//echo $row['c_id'].'-'.$row['session_id'].'-'.$row['id']."\n";
$ins = "INSERT INTO $to (c_id, session_id, exercise_id, exercise_order)".
" VALUES ($cid, $temp_session_id, {$row['id']}, $order)";
$rins = iDatabase::query($ins);
//echo $ins."\n";
$order++;
}
$sql = "SELECT id FROM $dbNameForm.course_field WHERE field_variable = 'special_course'";
$result = Database::query($sql);
$fieldData = Database::fetch_array($result, 'ASSOC');
$id = $fieldData['id'];
$sql = "INSERT INTO $dbNameForm.course_field_options (field_id, option_value, option_display_text, option_order)
VALUES ('$id', '1', '".get_lang('Yes')."', '1')";
$result = Database::query($sql);
$sql = "INSERT INTO $dbNameForm.course_field_options (field_id, option_value, option_display_text, option_order)
VALUES ('$id', '0', '".get_lang('No')."', '2')";
Database::query($sql);
}
}
}

Loading…
Cancel
Save