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);