[Vtigercrm-commits] [vtiger-commits] r6838 - /vtigercrm/trunk/soap/vtigerolservice.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed May 31 07:19:42 EDT 2006
Author: saraj
Date: Wed May 31 05:19:39 2006
New Revision: 6838
Log:
* modified attachment function
Modified:
vtigercrm/trunk/soap/vtigerolservice.php
Modified: vtigercrm/trunk/soap/vtigerolservice.php
==============================================================================
--- vtigercrm/trunk/soap/vtigerolservice.php (original)
+++ vtigercrm/trunk/soap/vtigerolservice.php Wed May 31 05:19:39 2006
@@ -365,6 +365,8 @@
{
global $adb;
require_once('modules/Users/User.php');
+ require_once('include/utils/utils.php');
+
$date_var = date('YmdHis');
$seed_user = new User();
@@ -372,6 +374,12 @@
$crmid = $adb->getUniqueID("crmentity");
+ $upload_file_path = decideFilePath();
+
+ $handle = fopen($upload_file_path.$filename,"wb");
+ fwrite($handle,base64_decode($filedata),$filesize);
+ fclose($handle);
+
$sql1 = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime)
values(".$crmid.",".$user_id.",".$user_id.",'Emails Attachment',' ',".$adb->formatString("crmentity","createdtime",$date_var).",".$adb->formatString("crmentity","modifiedtime",$date_var).")";
@@ -380,26 +388,21 @@
if($entityresult != false)
{
- $sql2="insert into attachments(attachmentsid, name, description, type, attachmentsize, attachmentcontents)
- values(".$crmid.",'".$filename."',' ','".$filetype."','".$filesize."','".$adb->getEmptyBlob()."')";
-
- $result=$adb->query($sql2);
-
- if($result != false)
+ $sql2="insert into attachments(attachmentsid, name, description, type, path)
+ values(".$crmid.",'".$filename."',' ','".$filetype."','".$upload_file_path."')";
+
+ $result=$adb->query($sql2);
+
+ $sql3='insert into seattachmentsrel values('.$emailid.','.$crmid.')';
+ $adb->query($sql3);
+
+ return $crmid;
+ }
+ else
{
- $result = $adb->updateBlob('attachments','attachmentcontents',"attachmentsid='".$crmid."' and name='".$filename."'",addslashes($filedata));
- }
-
- $sql3='insert into seattachmentsrel values('.$emailid.','.$crmid.')';
- $adb->query($sql3);
-
- return $crmid;
- }
- else
- {
//$server->setError("Invalid username and/or password");
return "";
- }
+ }
}
function GetContacts($username)
More information about the vtigercrm-commits
mailing list