[Vtigercrm-commits] [vtiger-commits] r11126 - /vtigercrm/branches/5.0.3/modules/Webmails/Save.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue May 29 08:23:17 EDT 2007


Author: richie
Date: Tue May 29 06:23:13 2007
New Revision: 11126

Log:
* Fixed the issue with webmail attachment  ie., when we qualify a mail the attachments will be moved but link is not proper to download. we have fixed that issue

Modified:
    vtigercrm/branches/5.0.3/modules/Webmails/Save.php

Modified: vtigercrm/branches/5.0.3/modules/Webmails/Save.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/Save.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/Save.php Tue May 29 06:23:13 2007
@@ -86,7 +86,8 @@
 	    	$attachments=$email->downloadInlineAttachments();
 
 	    $upload_filepath = decideFilePath();
-	    for($i=0,$num_files=count($attachments);$i<$num_files;$i++) {
+	    for($i=0,$num_files=count($attachments);$i<$num_files;$i++)
+	    {
 		$current_id = $adb->getUniqueID("vtiger_crmentity");
 		$date_var = $adb->formatDate(date('YmdHis'));	
 
@@ -100,14 +101,16 @@
 
                 $sql = "insert into vtiger_attachments values(";
                 $sql .= $current_id.",'".$filename."','Uploaded ".$filename." from webmail','".$filetype."','".$upload_filepath."')";
-		echo $query;
                 $result = $adb->query($sql);
 
                 $sql1 = "insert into vtiger_seattachmentsrel values('";
                 $sql1 .= $cid."','".$current_id."')";
                 $result = $adb->query($sql1);
 
-		$fp = fopen($upload_filepath.'/'.$filename, "w") or die("Can't open file");
+		//we have to add attachmentsid_ as prefix for the filename
+		$move_filename = $upload_filepath.'/'.$current_id.'_'.$filename;
+
+		$fp = fopen($move_filename, "w") or die("Can't open file");
 		fputs($fp, base64_decode($attachments[$i]["filedata"]));
 		fclose($fp);
 	    }





More information about the vtigercrm-commits mailing list