Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master_MDL-47076' of git://github.com/totara/moodle
  • Loading branch information
marinaglancy committed Sep 9, 2014
2 parents ba41742 + 927ea48 commit de62e57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backup/moodle2/restore_stepslib.php
Expand Up @@ -2195,7 +2195,13 @@ public function process_badge($data) {

$data = (object)$data;
$data->usercreated = $this->get_mappingid('user', $data->usercreated);
if (empty($data->usercreated)) {
$data->usercreated = $this->task->get_userid();
}
$data->usermodified = $this->get_mappingid('user', $data->usermodified);
if (empty($data->usermodified)) {
$data->usermodified = $this->task->get_userid();
}

// We'll restore the badge image.
$restorefiles = true;
Expand Down Expand Up @@ -2292,6 +2298,12 @@ public function process_manual_award($data) {
'issuerrole' => $role,
'datemet' => $this->apply_date_offset($data->datemet)
);

// Skip the manual award if recipient or issuer can not be mapped to.
if (empty($award['recipientid']) || empty($award['issuerid'])) {
return;
}

$DB->insert_record('badge_manual_award', $award);
}
}
Expand Down

0 comments on commit de62e57

Please sign in to comment.