Permalink
Browse files

MDL-25659 fixed overriding of fields variable and improved coding sty…

…le in similar places

credit goes to Bill Johnson
  • Loading branch information...
skodak committed Dec 13, 2010
1 parent 8d9db9e commit 12c3ba99e77f3105515306e8b86fd9773e0940e5
Showing with 7 additions and 7 deletions.
  1. +7 −7 enrol/database/lib.php
View
@@ -319,9 +319,9 @@ public function sync_enrolments() {
// sync enrolments
$ignorehidden = $this->get_config('ignorehiddencourses');
- $fields = array($userfield);
+ $sqlfields = array($userfield);
if ($rolefield) {
- $fields[] = $rolefield;
+ $sqlfields[] = $rolefield;
}
foreach ($existing as $course) {
if ($ignorehidden and !$course->visible) {
@@ -356,7 +356,7 @@ public function sync_enrolments() {
// get list of users that need to be enrolled and their roles
$requested_roles = array();
- $sql = $this->db_get_sql($table, array($coursefield=>$course->mapping), $fields);
+ $sql = $this->db_get_sql($table, array($coursefield=>$course->mapping), $sqlfields);
if ($rs = $extdb->Execute($sql)) {
if (!$rs->EOF) {
if ($localuserfield === 'username') {
@@ -488,14 +488,14 @@ public function sync_courses() {
$idnumber = strtolower($this->get_config('newcourseidnumber'));
$category = strtolower($this->get_config('newcoursecategory'));
- $fields = array($fullname, $shortname);
+ $sqlfields = array($fullname, $shortname);
if ($category) {
- $fields[] = $category;
+ $sqlfields[] = $category;
}
if ($idnumber) {
- $fields[] = $idnumber;
+ $sqlfields[] = $idnumber;
}
- $sql = $this->db_get_sql($table, array(), $fields);
+ $sql = $this->db_get_sql($table, array(), $sqlfields);
$createcourses = array();
if ($rs = $extdb->Execute($sql)) {
if (!$rs->EOF) {

0 comments on commit 12c3ba9

Please sign in to comment.