From 8fa8af462d117bc6ab43e1805cdc8c1ef7603889 Mon Sep 17 00:00:00 2001 From: David Bogner Date: Tue, 18 Jun 2024 21:55:48 +0200 Subject: [PATCH] Fix restore of comment field in rules --- backup/moodle2/restore_datalynx_stepslib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backup/moodle2/restore_datalynx_stepslib.php b/backup/moodle2/restore_datalynx_stepslib.php index fa7b53b5..8fd13962 100644 --- a/backup/moodle2/restore_datalynx_stepslib.php +++ b/backup/moodle2/restore_datalynx_stepslib.php @@ -343,6 +343,16 @@ protected function process_datalynx_rule($data) { if ($data->param5 && $data->type == 'eventnotification') { $data->param5 = $this->get_mappingid('datalynx_field', $data->param5); } + + // Update the text comment reference to be sent with the notification. + $param7 = json_decode($data->param7); + if (!empty($param7) && $data->type == 'eventnotification') { + $newparam = []; + foreach ($param7 as $paramid) { + $newparam[] = $this->get_mappingid('datalynx_field', $paramid); + } + $data->param7 = json_encode($newparam); + } // Insert the datalynx_rules record. $newitemid = $DB->insert_record('datalynx_rules', $data);