[Vtigercrm-commits] [vtiger-commits] r6439 - /vtigercrm/trunk/modules/Notes/Save.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu May 25 16:12:52 EDT 2006


Author: saraj
Date: Thu May 25 14:12:47 2006
New Revision: 6439

Log:
Attachment is duplicated now while duplicating notes. Fixes #938 and #580.

Modified:
    vtigercrm/trunk/modules/Notes/Save.php

Modified: vtigercrm/trunk/modules/Notes/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Notes/Save.php (original)
+++ vtigercrm/trunk/modules/Notes/Save.php Thu May 25 14:12:47 2006
@@ -40,6 +40,25 @@
 
 if (!isset($_REQUEST['date_due_flag'])) $focus->date_due_flag = 'off';
 
+//Added for retrieve the old existing attachments when duplicated without new attachment
+if($_FILES['filename']['name'] == '' && $_REQUEST['mode'] != 'edit' && $_REQUEST['old_id'] != '')
+{
+        $sql = "select attachments.attachmentsid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid=attachments.attachmentsid where seattachmentsrel.crmid= ".$_REQUEST['old_id'];
+        $result = $adb->query($sql);
+        if($adb->num_rows($result) != 0)
+                $attachmentid = $adb->query_result($result,0,'attachmentsid');
+	        if($attachmentid != '')
+	        {
+	                $attachquery = "select * from attachments where attachmentsid = ".$attachmentid;
+	                $result = $adb->query($attachquery);
+	                $filename = $adb->query_result($result,0,'name');
+	                $filetype = $adb->query_result($result,0,'type');
+	                $_FILES['filename']['name'] = $filename;
+	                $_FILES['filename']['type'] = $filetype;
+	        }
+}
+																						
+
 $focus->save("Notes");
 
 $return_id = $focus->id;





More information about the vtigercrm-commits mailing list