[Vtigercrm-commits] [vtiger-commits] r9584 - in /vtigercrm/branches/5.0.1: data/CRMEntity.php include/utils/DetailViewUtils.php include/utils/EditViewUtils.php modules/Contacts/Save.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sat Oct 7 08:13:53 EDT 2006
Author: richie
Date: Sat Oct 7 06:13:46 2006
New Revision: 9584
Log:
* Modified to fix the issue 2098 ie., when we add attachemnt it shows in the image area
Modified:
vtigercrm/branches/5.0.1/data/CRMEntity.php
vtigercrm/branches/5.0.1/include/utils/DetailViewUtils.php
vtigercrm/branches/5.0.1/include/utils/EditViewUtils.php
vtigercrm/branches/5.0.1/modules/Contacts/Save.php
Modified: vtigercrm/branches/5.0.1/data/CRMEntity.php
==============================================================================
--- vtigercrm/branches/5.0.1/data/CRMEntity.php (original)
+++ vtigercrm/branches/5.0.1/data/CRMEntity.php Sat Oct 7 06:13:46 2006
@@ -263,7 +263,11 @@
//This is to added to store the existing attachment id of the contact where we should delete this when we give new image
if($module == 'Contacts')
- $old_attachmentid = $adb->query_result($adb->query("select * from vtiger_seattachmentsrel where crmid=$id"),0,'attachmentsid');
+ {
+ //if a image attached already then remove that otherwise do not delete the attachment
+ $query = "select vtiger_attachments.attachmentsid from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid inner join vtiger_contactdetails on vtiger_contactdetails.imagename=vtiger_attachments.name where vtiger_seattachmentsrel.crmid=$id";
+ $old_attachmentid = $adb->query_result($adb->query($query),0,'attachmentsid');
+ }
foreach($_FILES as $fileindex => $files)
{
@@ -274,7 +278,7 @@
}
//This is to handle the delete image for contacts
- if($module == 'Contacts' && $file_saved)
+ if($module == 'Contacts' && $file_saved && $old_attachmentid != '')
{
$del_res1 = $adb->query("delete from vtiger_attachments where attachmentsid=$old_attachmentid");
$del_res2 = $adb->query("delete from vtiger_seattachmentsrel where attachmentsid=$old_attachmentid");
@@ -384,11 +388,13 @@
$sql3='insert into vtiger_seattachmentsrel values('.$id.','.$current_id.')';
$adb->query($sql3);
+ $log->debug("Exiting from uploadAndSaveFile($id,$module,$file_details) method. return true");
return true;
}
else
{
$log->debug("Skip the save attachment process.");
+ $log->debug("Exiting from uploadAndSaveFile($id,$module,$file_details) method. return false");
return false;
}
}
Modified: vtigercrm/branches/5.0.1/include/utils/DetailViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.1/include/utils/DetailViewUtils.php (original)
+++ vtigercrm/branches/5.0.1/include/utils/DetailViewUtils.php Sat Oct 7 06:13:46 2006
@@ -304,7 +304,8 @@
{
$imgpath = "test/contact/".$imagename;
$label_fld[] =$mod_strings[$fieldlabel];
- $label_fld["cntimage"] ='<div style="position:absolute;height=100px"><img class="thumbnail" src="'.$imgpath.'" width="60" height="60" border="0"></div> '.$mod_strings[$fieldlabel];
+ //This is used to show the contact image as a thumbnail near First Name field
+ //$label_fld["cntimage"] ='<div style="position:absolute;height=100px"><img class="thumbnail" src="'.$imgpath.'" width="60" height="60" border="0"></div> '.$mod_strings[$fieldlabel];
}
else
{
@@ -462,7 +463,7 @@
if($tabid==4)
{
//$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
- $sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid where vtiger_seattachmentsrel.crmid=".$col_fields['record_id'];
+ $sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid inner join vtiger_contactdetails on vtiger_contactdetails.imagename=vtiger_attachments.name where vtiger_seattachmentsrel.crmid=".$col_fields['record_id'];
$image_res = $adb->query($sql);
$image_id = $adb->query_result($image_res,0,'attachmentsid');
$image_path = $adb->query_result($image_res,0,'path');
Modified: vtigercrm/branches/5.0.1/include/utils/EditViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.1/include/utils/EditViewUtils.php (original)
+++ vtigercrm/branches/5.0.1/include/utils/EditViewUtils.php Sat Oct 7 06:13:46 2006
@@ -578,8 +578,8 @@
$query = 'select vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name from vtiger_products left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_products.productid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where productid='.$col_fields['record_id'];
}
else
- {
- $query = "select vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name from vtiger_contactdetails left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_contactdetails.contactid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where contactid=".$col_fields['record_id'];
+ {
+ $query = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid inner join vtiger_contactdetails on vtiger_contactdetails.imagename=vtiger_attachments.name where vtiger_seattachmentsrel.crmid=".$col_fields['record_id'];
}
$result_image = $adb->query($query);
for($image_iter=0;$image_iter < $adb->num_rows($result_image);$image_iter++)
Modified: vtigercrm/branches/5.0.1/modules/Contacts/Save.php
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Contacts/Save.php (original)
+++ vtigercrm/branches/5.0.1/modules/Contacts/Save.php Sat Oct 7 06:13:46 2006
@@ -115,6 +115,11 @@
$focus->column_fields['imagename']=$image_name_val;
$log->debug("Assign the Image name to the vtiger_field name ");
}
+
+//if image added then we have to set that $_FILES['name'] in imagename field then only the image will be displayed
+if($_FILES['imagename']['name'] != '')
+ $focus->column_fields['imagename'] = $_FILES['imagename']['name'];
+
//Saving the contact
if($image_error=="false")
{
More information about the vtigercrm-commits
mailing list