]> git.mjollnir.org Git - moodle.git/commitdiff
install / accesslib: Fix install problem
authortjhunt <tjhunt>
Tue, 18 Nov 2008 09:28:05 +0000 (09:28 +0000)
committertjhunt <tjhunt>
Tue, 18 Nov 2008 09:28:05 +0000 (09:28 +0000)
lib/accesslib.php

index f6a70d06188fcf3ea531196c2d42e69ea630335e..400ffd54a28d3a988537707b1c6b13dac3643979 100755 (executable)
@@ -2541,6 +2541,9 @@ function create_role($name, $shortname, $description, $legacy='') {
 
     //find free sortorder number
     $role->sortorder = $DB->get_field('role', 'MAX(sortorder) + 1', array());
+    if (empty($role->sortorder)) {
+        $role->sortorder = 1;
+    }
     $id = $DB->insert_record('role', $role);
 
     if (!$id) {
@@ -4138,12 +4141,12 @@ function allow_override($sroleid, $troleid) {
  * @param int troleid - target roleid
  * @return int - id or false
  */
-function allow_assign($sroleid, $troleid) {
+function allow_assign($fromroleid, $targetroleid) {
     global $DB;
 
     $record = new object;
-    $record->roleid      = $sroleid;
-    $record->allowassign = $troleid;
+    $record->roleid      = $fromroleid;
+    $record->allowassign = $targetroleid;
     return $DB->insert_record('role_allow_assign', $record);
 }