Skip to content

Commit

Permalink
fix(MailManager) set email attachment type in related document
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Mar 16, 2023
1 parent 5700975 commit faa063e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/MailManager/src/controllers/UploadController.php
Expand Up @@ -41,13 +41,21 @@ public function createDocument() {
$attachid = $this->saveAttachment();

if ($attachid !== false) {
$filetype = '';
$finfo = new finfo(FILEINFO_MIME);
$attfpath = getAttachmentPathFromID($attachid);
if ($attfpath!='') {
$filetype = explode(';', $finfo->buffer(file_get_contents($attfpath)));
$filetype = $filetype[0];
}
// Create document record
$document->column_fields['notes_title'] = $this->getName();
$document->column_fields['filename'] = $this->getName();
$document->column_fields['filestatus'] = 1;
$document->column_fields['filelocationtype'] = 'I';
$document->column_fields['folderid'] = $this->getAttachmentsFolder();
$document->column_fields['filesize'] = $this->getSize();
$document->column_fields['filetype'] = $filetype;
$document->column_fields['assigned_user_id'] = $current_user->id;
if (!empty($_REQUEST['parent_id'])) {
$document->parentid = vtlib_purify($_REQUEST['parent_id']);
Expand Down

0 comments on commit faa063e

Please sign in to comment.