From 96818164713c58068c6aac1655b54a22dde94a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Mai=C3=9Fer?= Date: Fri, 13 Oct 2023 20:43:41 +0200 Subject: [PATCH] small fix to get field ids. --- rule/ftpsyncfiles/rule_class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rule/ftpsyncfiles/rule_class.php b/rule/ftpsyncfiles/rule_class.php index 8ecc40e8..1ddef319 100644 --- a/rule/ftpsyncfiles/rule_class.php +++ b/rule/ftpsyncfiles/rule_class.php @@ -126,15 +126,20 @@ public function trigger(\core\event\base $event) { $data = new stdClass(); $data->eids = []; - $fieldid = datalynxfield_entryauthor::_USERID; $filename = $file->get_filename(); $entryid = -1; $data->eids[$entryid] = $entryid; // TODO: If filename is not userid get userid here. + $fieldid = datalynxfield_entryauthor::_USERID; $data->{"field_{$fieldid}_{$entryid}"} = $this->authorid; + + $fields = $this->dl->get_fields(); + + $field = reset($this->dl->get_fields_by_type('file')); + $fieldid = $field->field->id; $data->{"field_{$fieldid}_{$entryid}_filemanager"} = $this->draftitemid; - $data->{"field_{$fieldid}_{$entryid}_content"} = 1; + // $data->{"field_{$fieldid}_{$entryid}_content"} = 1; $dlentries = new datalynx_entries($this->dl); // Set teammember from filename. $data->{"field_{$this->teammemberfieldid}_{$entryid}"} = $this->get_userid_from_filename($filename);