Removing and re-adding currency support in courses

This commit is contained in:
moodler
2005-07-22 17:19:52 +00:00
parent f45d33ee84
commit f2e34253c3
5 changed files with 20 additions and 1 deletions

View File

@ -597,6 +597,7 @@
fwrite ($bf,full_tag("LANG",3,false,$course->lang)); fwrite ($bf,full_tag("LANG",3,false,$course->lang));
fwrite ($bf,full_tag("THEME",3,false,$course->theme)); fwrite ($bf,full_tag("THEME",3,false,$course->theme));
fwrite ($bf,full_tag("COST",3,false,$course->cost)); fwrite ($bf,full_tag("COST",3,false,$course->cost));
fwrite ($bf,full_tag("CURRENCY",3,false,$course->currency));
fwrite ($bf,full_tag("MARKER",3,false,$course->marker)); fwrite ($bf,full_tag("MARKER",3,false,$course->marker));
fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible)); fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible));
fwrite ($bf,full_tag("HIDDENSECTIONS",3,false,$course->hiddensections)); fwrite ($bf,full_tag("HIDDENSECTIONS",3,false,$course->hiddensections));

View File

@ -520,6 +520,7 @@
$course->lang = addslashes($course_header->course_lang); $course->lang = addslashes($course_header->course_lang);
$course->theme = addslashes($course_header->course_theme); $course->theme = addslashes($course_header->course_theme);
$course->cost = addslashes($course_header->course_cost); $course->cost = addslashes($course_header->course_cost);
$course->currency = addslashes($course_header->course_currency);
$course->marker = addslashes($course_header->course_marker); $course->marker = addslashes($course_header->course_marker);
$course->visible = addslashes($course_header->course_visible); $course->visible = addslashes($course_header->course_visible);
$course->hiddensections = addslashes($course_header->course_hiddensections); $course->hiddensections = addslashes($course_header->course_hiddensections);
@ -3291,6 +3292,9 @@
case "COST": case "COST":
$this->info->course_cost = $this->getContents(); $this->info->course_cost = $this->getContents();
break; break;
case "CURRENCY":
$this->info->course_currency = $this->getContents();
break;
case "MARKER": case "MARKER":
$this->info->course_marker = $this->getContents(); $this->info->course_marker = $this->getContents();
break; break;

View File

@ -1485,6 +1485,13 @@ function main_upgrade($oldversion=0) {
} }
} }
if ($oldversion < 2005072200) { // fix the mistakenly-added currency stuff from enrol/authorize
execute_sql("DROP TABLE {$CFG->prefix}currencies", false); // drop silently
execute_sql("ALTER TABLE {$CFG->prefix}course DROP currency", false);
$defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;
table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost');
}
return $result; return $result;
} }

View File

@ -1205,6 +1205,13 @@ function main_upgrade($oldversion=0) {
} }
} }
if ($oldversion < 2005072200) { // fix the mistakenly-added currency stuff from enrol/authorize
execute_sql("DROP TABLE {$CFG->prefix}currencies", false); // drop silently
execute_sql("ALTER TABLE {$CFG->prefix}course DROP currency", false);
$defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;
table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost');
}
return $result; return $result;
} }

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine // This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php) // whether upgrades should be performed (see lib/db/*.php)
$version = 2005072100; // YYYYMMDD = date $version = 2005072200; // YYYYMMDD = date
// XY = increments within a single day // XY = increments within a single day
$release = '1.6 development'; // Human-friendly version name $release = '1.6 development'; // Human-friendly version name