If you use the mailscanner in vtigercrm 6 you probably recognized every mail attachment is stored multiple times in documents.
This isn't necessary.
To modify this, please apply the following modification
Search
var $STORAGE_FOLDER = 'storage/mailscanner/';
Insert after
private $_notesId = array();
Search
function __CreateTicket($mailscanner, $mailrecord) {
Insert after
$this->_notesId = array();
Search
// Create document record $document = new Documents(); $document->column_fields['notes_title'] = $filename; $document->column_fields['filename'] = $filename; $document->column_fields['filesize'] = mb_strlen($filecontent, '8bit'); $document->column_fields['filestatus'] = 1; $document->column_fields['filelocationtype'] = 'I'; $document->column_fields['folderid'] = 1; // Default Folder $document->column_fields['assigned_user_id'] = $userid; $document->save('Documents');
replace these lines with
if(!isset($this->_notesId[$filename])) { // Create document record $document = new Documents(); $document->column_fields['notes_title'] = $filename; $document->column_fields['filename'] = $filename; $document->column_fields['filesize'] = mb_strlen($filecontent, '8bit'); $document->column_fields['filestatus'] = 1; $document->column_fields['filelocationtype'] = 'I'; $document->column_fields['folderid'] = 1; // Default Folder $document->column_fields['assigned_user_id'] = $userid; $document->save('Documents'); $this->_notesId[$filename] = $document->id; } else { $document = CRMEntity::getInstance('Documents'); $document->retrieve_entity_info($this->_notesId, 'Documents'); $document->id = $this->_notesId[$filename]; }