From 891a323efca95ec156bde51aef4c68b7ba404cba Mon Sep 17 00:00:00 2001 From: David Bogner Date: Wed, 28 Aug 2024 15:20:11 +0200 Subject: [PATCH] Restore new teammemberprofilefield filter correctly --- 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 8fd13962..c0b04078 100644 --- a/backup/moodle2/restore_datalynx_stepslib.php +++ b/backup/moodle2/restore_datalynx_stepslib.php @@ -219,6 +219,16 @@ protected function process_datalynx_filter($data) { foreach ($customsearch as $searchfield => $options) { if (is_numeric($searchfield) && $searchfield > 0) { $searchfields[$this->get_mappingid('datalynx_field', $searchfield)] = $options; + } else if (str_contains($searchfield, 'entryteammemberprofilefield_')) { + // Check for filter of entryteammemberprofilefield. + // It has pattern entryteammemberprofilefield_fieldid_profielfieldname. + // Example: entryteammemberprofilefield_1026_department + preg_match('/entryteammemberprofilefield_(\d+)_(.+)/', $searchfield, $matches); + if (is_numeric($matches[1])) { + $newfieldid = $this->get_mappingid('datalynx_field', $matches[1]); + $newname = "entryteammemberprofilefield_{$newfieldid}_{$matches[2]}"; + $searchfields[$newname] = $options; + } } else { $searchfields[$searchfield] = $options; }