Merge branch 'MDL-62209-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Andrew Nicols 2018-05-01 11:42:44 +08:00
commit cb3cd93b39

View File

@ -220,6 +220,7 @@ class api {
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";
@ -227,11 +228,11 @@ class api {
'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, '');
}
}