Skip to content
Snippets Groups Projects
Commit 890c766a authored by Uma's avatar Uma
Browse files

Merge branch 'Quotes_send_pdf' into '7.4.0'

Fixes #1525 Quotes failing to email attached pdf documents

See merge request !754
parents 0344bd5c ac83d9fd
No related branches found
No related tags found
No related merge requests found
......@@ -182,7 +182,7 @@ class Emails_Record_Model extends Vtiger_Record_Model {
//Adding attachments to mail
if(is_array($attachments)) {
foreach($attachments as $attachment) {
$fileNameWithPath = $rootDirectory.$attachment['path'].$attachment['fileid']."_".$attachment['storedname'];
$fileNameWithPath = $rootDirectory.$attachment['filenamewithpath'];
if(is_file($fileNameWithPath)) {
$mailer->AddAttachment($fileNameWithPath, $attachment['attachment']);
}
......@@ -277,12 +277,24 @@ class Emails_Record_Model extends Vtiger_Record_Model {
$attachmentsList = array();
if($numOfRows) {
for($i=0; $i<$numOfRows; $i++) {
$attachmentsList[$i]['fileid'] = $db->query_result($attachmentRes, $i, 'attachmentsid');
$attachmentsList[$i]['attachment'] = decode_html($db->query_result($attachmentRes, $i, 'name'));
$attachmentsList[$i]['storedname'] = decode_html($db->query_result($attachmentRes, $i, 'storedname'));
$path = $db->query_result($attachmentRes, $i, 'path');
$attachmentId = $db->query_result($attachmentRes, $i, 'attachmentsid');
$rawFileName = $db->query_result($attachmentRes, $i, 'name');
$storedName = $db->query_result($attachmentRes, $i, 'storedname');
$path = $db->query_result($attachmentRes, $i, 'path');
if($storedName) {
$filename = $storedName;
} else {
$filename = $rawFileName;
}
$attachmentsList[$i]['attachment'] = decode_html($rawFileName);
$attachmentsList[$i]['fileid'] = $attachmentId;
$attachmentsList[$i]['storedname'] = decode_html($storedName);
$attachmentsList[$i]['path'] = $path;
$attachmentsList[$i]['size'] = filesize($path.$attachmentsList[$i]['fileid'].'_'.$attachmentsList[$i]['storedname']);
$saved_filename = $attachmentId."_".$filename;
$filenamewithpath = $path.$saved_filename;
$filesize = filesize($filenamewithpath);
$attachmentsList[$i]['filenamewithpath'] = $filenamewithpath;
$attachmentsList[$i]['size'] = $filesize;
$attachmentsList[$i]['type'] = $db->query_result($attachmentRes, $i, 'type');
$attachmentsList[$i]['cid'] = $db->query_result($attachmentRes, $i, 'cid');
}
......
No preview for this file type
......@@ -412,14 +412,27 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
$attachmentsList = array();
if($numOfRows) {
for($i=0; $i<$numOfRows; $i++) {
$attachmentsList[$i]['fileid'] = $db->query_result($attachmentRes, $i, 'attachmentsid');
$attachmentsList[$i]['attachment'] = decode_html($db->query_result($attachmentRes, $i, 'name'));
$path = $db->query_result($attachmentRes, $i, 'path');
$attachmentId = $db->query_result($attachmentRes, $i, 'attachmentsid');
$rawFileName = $db->query_result($attachmentRes, $i, 'name');
$storedName = $db->query_result($attachmentRes, $i, 'storedname');
$path = $db->query_result($attachmentRes, $i, 'path');
if($storedName) {
$filename = $storedName;
} else {
$filename = $rawFileName;
}
$attachmentsList[$i]['attachment'] = decode_html($rawFileName);
$attachmentsList[$i]['fileid'] = $attachmentId;
$attachmentsList[$i]['storedname'] = decode_html($storedName);
$attachmentsList[$i]['path'] = $path;
$attachmentsList[$i]['size'] = filesize($path.$attachmentsList[$i]['fileid'].'_'.$attachmentsList[$i]['attachment']);
$saved_filename = $attachmentId."_".$filename;
$filenamewithpath = $path.$saved_filename;
$filesize = filesize($filenamewithpath);
$attachmentsList[$i]['filenamewithpath'] = $filenamewithpath;
$attachmentsList[$i]['size'] = $filesize;
$attachmentsList[$i]['type'] = $db->query_result($attachmentRes, $i, 'type');
$attachmentsList[$i]['cid'] = $db->query_result($attachmentRes, $i, 'cid');
}
}
}
return $attachmentsList;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment