MDL-62388 tool_dataprivacy: Default value if no sensitive data provided
authorDavid Monllao <davidm@moodle.com>
Thu, 10 May 2018 12:57:43 +0000 (14:57 +0200)
committerDavid Monllao <davidm@moodle.com>
Thu, 10 May 2018 12:57:43 +0000 (14:57 +0200)
admin/tool/dataprivacy/classes/api.php

index 09583b2..25165a3 100644 (file)
@@ -478,6 +478,10 @@ class api {
     public static function update_purpose(stdClass $record) {
         self::check_can_manage_data_registry();
 
+        if (!isset($record->sensitivedatareasons)) {
+            $record->sensitivedatareasons = '';
+        }
+
         $purpose = new purpose($record->id);
         $purpose->from_record($record);