/** * function to upload and save the notes documents * @param string $name * @param string $tempname * @param string $type * @param $size * @param $sqrecord * @see class/core/CRMFilesAndAttachments.class.php * @see class/fields/fieltype/FieldType21.class.php */ public function upload_and_save_notes_files($name, $tempname, $type, $size, $sqrecord) { $field_value = \FieldType21::upload_file($tempname, $name); $do_files_and_attachment = new \CRMFilesAndAttachments(); $do_files_and_attachment->addNew(); $do_files_and_attachment->file_name = $field_value["name"]; $do_files_and_attachment->file_mime = $type; $do_files_and_attachment->file_size = $size; $do_files_and_attachment->file_extension = $field_value["extension"]; $do_files_and_attachment->idmodule = 8; $do_files_and_attachment->id_referrer = $sqrecord; $do_files_and_attachment->iduser = 0; $do_files_and_attachment->file_description = $name; $do_files_and_attachment->date_modified = date("Y-m-d H:i:s"); $do_files_and_attachment->add(); $do_files_and_attachment->free(); }