MDL-62397 tool_dataprivacy: Check for inactive status properly
authorAndrew Nicols <andrew@nicols.co.uk>
Fri, 11 May 2018 03:20:19 +0000 (11:20 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Fri, 11 May 2018 03:20:19 +0000 (11:20 +0800)
admin/tool/dataprivacy/classes/task/process_data_request_task.php

index 6148f01..bacf29a 100644 (file)
@@ -68,8 +68,9 @@ class process_data_request_task extends adhoc_task {
         $request = $requestpersistent->to_record();
 
         // Check if this request still needs to be processed. e.g. The user might have cancelled it before this task has run.
-        if ($request->status != api::DATAREQUEST_STATUS_APPROVED) {
-            mtrace("Request {$request->id} hasn\'t been approved yet or it has already been processed. Skipping...");
+        $status = $requestpersistent->get('status');
+        if (!api::is_active($status)) {
+            mtrace("Request {$requestid} with status {$status} doesn't need to be processed. Skipping...");
             return;
         }