From 38ffa48cf5e960943624bcd7bbaa994d5842caef Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Thu, 26 Apr 2018 12:17:24 +0800 Subject: [PATCH] MDL-62209 tool_dataprivacy: Sort requests by ascending status Sort requests by ascending status and request date so that the DPO can go through the list in a FIFO fashion --- admin/tool/dataprivacy/classes/api.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/tool/dataprivacy/classes/api.php b/admin/tool/dataprivacy/classes/api.php index 9ec5f45888f..09583b28c59 100644 --- a/admin/tool/dataprivacy/classes/api.php +++ b/admin/tool/dataprivacy/classes/api.php @@ -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, ''); } }