Skip to content

Commit

Permalink
Merge branch 'MDL-62209-master' of git://github.com/junpataleta/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed May 1, 2018
2 parents c9591cd + 38ffa48 commit cb3cd93
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions admin/tool/dataprivacy/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,19 @@ public static function create_data_request($foruser, $type, $comments = '') {
public static function get_data_requests($userid = 0) {
global $USER;
$results = [];
$sort = 'status ASC, timemodified ASC';
if ($userid) {
// Get the data requests for the user or data requests made by the user.
$select = "userid = :userid OR requestedby = :requestedby";
$params = [
'userid' => $userid,
'requestedby' => $userid
];
$results = data_request::get_records_select($select, $params, 'status DESC, timemodified DESC');
$results = data_request::get_records_select($select, $params, $sort);
} else {
// If the current user is one of the site's Data Protection Officers, then fetch all data requests.
if (self::is_site_dpo($USER->id)) {
$results = data_request::get_records(null, 'status DESC, timemodified DESC', '');
$results = data_request::get_records(null, $sort, '');
}
}

Expand Down

0 comments on commit cb3cd93

Please sign in to comment.