[Vtigercrm-commits] [vtiger-commits] r6442 - in /vtigercrm/trunk: Smarty/templates/ data/ include/utils/ modules/Contacts/ modules/Emails/ modules/HelpDesk/ modules/Notes/ modules/Products/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu May 25 23:33:31 EDT 2006


Author: saraj
Date: Thu May 25 21:33:15 2006
New Revision: 6442

Log:
* Modified to handle the attachments

Modified:
    vtigercrm/trunk/Smarty/templates/DisplayFields.tpl
    vtigercrm/trunk/Smarty/templates/InventoryEditView.tpl
    vtigercrm/trunk/data/CRMEntity.php
    vtigercrm/trunk/include/utils/CommonUtils.php
    vtigercrm/trunk/include/utils/DetailViewUtils.php
    vtigercrm/trunk/include/utils/EditViewUtils.php
    vtigercrm/trunk/modules/Contacts/Contact.php
    vtigercrm/trunk/modules/Emails/Email.php
    vtigercrm/trunk/modules/HelpDesk/HelpDesk.php
    vtigercrm/trunk/modules/Notes/Note.php
    vtigercrm/trunk/modules/Products/DetailView.php
    vtigercrm/trunk/modules/Products/Product.php
    vtigercrm/trunk/modules/Products/Save.php

Modified: vtigercrm/trunk/Smarty/templates/DisplayFields.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/DisplayFields.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/DisplayFields.tpl Thu May 25 21:33:15 2006
@@ -412,20 +412,31 @@
 			</td>
 			<td colspan="3" width="30%" align=left class="dvtCellInfo">
 				{if $MODULE eq 'Products'}
-					<input name="imagelist" type="hidden" value="">
+					<input name="del_file_list" type="hidden" value="">
 					<div id="files_list" style="border: 1px solid grey; width: 500px; padding: 5px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; font-size: x-small">Files Maximum 6
 						<input id="my_file_element" type="file" name="file_1" >
+						{assign var=image_count value=0}
+						{if $maindata[3].0.name neq ''}
+						   {foreach name=image_loop key=num item=image_details from=$maindata[3]}
+							<div align="center">
+								<img src="{$image_details.path}{$image_details.name}" height="50">&nbsp;&nbsp;[{$image_details.name}]<input id="file_{$num}" value="Delete" type="button" onclick='this.parentNode.parentNode.removeChild(this.parentNode);delRowEmt("{$image_details.name}")'>
+							</div>
+					   	   {assign var=image_count value=$smarty.foreach.image_loop.iteration}
+					   	   {/foreach}
+						{/if}
 					</div>
+
 					<script>
 						{*<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->*}
 						var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 6 );
+						multi_selector.count = {$image_count}
 						{*<!-- Pass in the file element -->*}
 						multi_selector.addElement( document.getElementById( 'my_file_element' ) );
 					</script>
 				{else}
-					<input name="{$fldname}"  type="file" value="{$secondvalue}"/>
+					<input name="{$fldname}"  type="file" value="{$maindata[3].0.name}"/>
 					<input type="hidden" name="id" value=""/>
-					{$fldvalue}
+					{$maindata[3].0.name}
 				{/if}
 			</td>
 
@@ -539,4 +550,6 @@
 			if(temp == false)
 				alert("Please enter Valid TAX value");
 	{rdelim}	
+
+
 </script>

Modified: vtigercrm/trunk/Smarty/templates/InventoryEditView.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/InventoryEditView.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/InventoryEditView.tpl Thu May 25 21:33:15 2006
@@ -183,16 +183,13 @@
 	var count=0;
 	function delRowEmt(imagename)
 	{ldelim}
-	       ProductImages[count++]=imagename;
+		ProductImages[count++]=imagename;
+		multi_selector.current_element.disabled = false;
+		multi_selector.count--;
 	{rdelim}
 	function displaydeleted()
 	{ldelim}
-		var imagelists='';
-		for(var x = 0; x < ProductImages.length; x++)
-		{ldelim}
-			imagelists+=ProductImages[x]+'###';
-		{rdelim}
-		if(imagelists != '')
-			document.EditView.imagelist.value=imagelists
+		if(ProductImages.length > 0)
+			document.EditView.del_file_list.value=ProductImages.join('###');
 	{rdelim}
 </script>

Modified: vtigercrm/trunk/data/CRMEntity.php
==============================================================================
--- vtigercrm/trunk/data/CRMEntity.php (original)
+++ vtigercrm/trunk/data/CRMEntity.php Thu May 25 21:33:15 2006
@@ -38,6 +38,8 @@
    * All Rights Reserved.
    * Contributor(s): ______________________________________..
    */
+
+	
   function saveentity($module)
   {
 	global $current_user, $adb;//$adb added by raju for mass mailing
@@ -185,6 +187,10 @@
 		{
 			$this->insertTaxInformation($table_name, $module);
 		}
+		elseif($table_name == 'attachments')
+		{
+			$this->insertIntoAttachment($this->id,$module);
+		}
 		else
 		{
 			$this->insertIntoEntityTable($table_name, $module);			
@@ -192,13 +198,13 @@
 	}
 
 
-	if($module == 'Emails' || $module == 'Notes' || $module == 'HelpDesk')
+	/*if($module == 'Emails' || $module == 'Notes' || $module == 'HelpDesk')
 	{
 		if(isset($_FILES['filename']['name']) && $_FILES['filename']['name']!='')
 		{
 			$this->insertIntoAttachment($this->id,$module);
 		}
-	}
+	}*/
 
 	$this->db->completeTransaction();
         $this->db->println("TRANS saveentity ends");
@@ -248,23 +254,66 @@
 	}
 
 
-
+	/**
+	 *      This function is used to add the attachments. This will call the function uploadAndSaveFile which will upload the attachment into the server and save that attachment information in the database.
+	 *      @param int $id  - entity id to which the files to be uploaded
+	 *      @param string $module  - the current module name
+	*/
 	function insertIntoAttachment($id,$module)
 	{
+		global $log, $adb;
+		$log->debug("Entering into insertIntoAttachment($id,$module) method.");
+		
+		foreach($_FILES as $fileindex => $files)
+		{
+			if($files['name'] != '' && $files['size'] > 0)
+			{
+				$this->uploadAndSaveFile($id,$module,$files);
+			}
+		}
+
+		//Remove the deleted attachments from db - Products
+		if($module == 'Products' && $_REQUEST['del_file_list'] != '')
+		{
+			$del_file_list = explode("###",trim($_REQUEST['del_file_list'],"###"));
+			foreach($del_file_list as $del_file_name)
+			{
+				$attach_res = $adb->query("select attachments.attachmentsid from attachments inner join seattachmentsrel on attachments.attachmentsid=seattachmentsrel.attachmentsid where crmid=$id and name=\"$del_file_name\"");
+				$attachments_id = $adb->query_result($attach_res,0,'attachmentsid');
+				
+				$del_res1 = $adb->query("delete from attachments where attachmentsid=$attachments_id");
+				$del_res2 = $adb->query("delete from seattachmentsrel where attachmentsid=$attachments_id");
+			}
+		}
+
+		$log->debug("Exiting from insertIntoAttachment($id,$module) method.");
+	}
+
+	/**
+	 *      This function is used to upload the attachment in the server and save that attachment information in db.
+	 *      @param int $id  - entity id to which the file to be uploaded
+	 *      @param string $module  - the current module name
+	 *      @param array $file_details  - array which contains the file information(name, type, size, tmp_name and error)
+	 *      return void
+	*/
+	function uploadAndSaveFile($id,$module,$file_details)
+	{
+		global $log;
+		$log->debug("Entering into uploadAndSaveFile($id,$module,$file_details) method.");
+		
+		global $adb, $current_user;
+		global $upload_badext;
+
 		$date_var = date('YmdHis');
-		global $current_user;
-		global $adb;
-		global $root_directory;
-		global $upload_badext;
-
+
+		//to get the owner id
 		$ownerid = $this->column_fields['assigned_user_id'];
-
 		if(!isset($ownerid) || $ownerid=='')
 			$ownerid = $current_user->id;
 
-		$uploaddir = $root_directory ."/test/upload/";
+	
 		// Arbitrary File Upload Vulnerability fix - Philip
-		$binFile = $_FILES['filename']['name'];
+		$binFile = $file_details['name'];
 		$ext_pos = strrpos($binFile, ".");
 
 		$ext = substr($binFile, $ext_pos + 1);
@@ -276,21 +325,25 @@
 		// Vulnerability fix ends
 
 		$filename = basename($binFile);
-		$filetype= $_FILES['filename']['type'];
-		$filesize = $_FILES['filename']['size'];
-
+		$filetype= $file_details['type'];
+		$filesize = $file_details['size'];
+		$filetmp_name = $file_details['tmp_name'];
+		
 		//get the file path inwhich folder we want to upload the file
 		$upload_file_path = decideFilePath();
 
-		if($binFile != '')
-		{
-			if(move_uploaded_file($_FILES["filename"]["tmp_name"],$upload_file_path.$binFile))
-			{
-				if($filesize != 0)
-				{
-					$data = base64_encode(fread(fopen($upload_file_path.$binFile, "r"), $filesize));
-				}
-			}
+		//upload the file in server
+		$upload_status = move_uploaded_file($filetmp_name,$upload_file_path.$binFile);
+
+		$save_file = 'true';
+		//only images are allowed for these modules
+		if($module == 'Contacts' || $module == 'Products')
+		{
+			$save_file = validateImageFile(&$file_details);
+		}
+
+		if($save_file == 'true')
+		{
 			$current_id = $adb->getUniqueID("crmentity");
 
 			//This is only to update the attached filename in the notes table for the Notes module
@@ -303,10 +356,8 @@
 			$sql1 = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$adb->formatString("crmentity","createdtime",$date_var).",".$adb->formatString("crmentity","modifiedtime",$date_var).")";
 			$adb->query($sql1);
 
-			$sql2="insert into attachments(attachmentsid, name, description, type, path) values(".$current_id.",'".$filename."','".$this->column_fields[$descname]."','".$filetype."','".$upload_file_path."')";
+			$sql2="insert into attachments(attachmentsid, name, description, type, path) values(".$current_id.",'".$filename."','".$this->column_fields['description']."','".$filetype."','".$upload_file_path."')";
 			$result=$adb->query($sql2);
-
-			//TODO -- instead of put contents in db now we should store the file in harddisk
 
 			if($_REQUEST['mode'] == 'edit')
 			{
@@ -324,6 +375,13 @@
 			$sql3='insert into seattachmentsrel values('.$id.','.$current_id.')';
 			$adb->query($sql3);
 		}
+		else
+		{
+			$log->debug("Skip the save attachment process.");
+		}
+		$log->debug("Exiting from uploadAndSaveFile($id,$module,$file_details) method.");
+
+		return;
 	}
 
 
@@ -373,12 +431,10 @@
 		$current_id = $adb->getUniqueID("crmentity");
 		$_REQUEST['currentid']=$current_id;
 
-		{
-			$description_val = from_html($adb->formatString("crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
-			$sql = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values('".$current_id."','".$current_user->id."','".$ownerid."','".$module."',".$description_val.",".$adb->formatDate($date_var).",".$adb->formatDate($date_var).")";
-			$adb->query($sql);
-			$this->id = $current_id;
-		}
+		$description_val = from_html($adb->formatString("crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
+		$sql = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values('".$current_id."','".$current_user->id."','".$ownerid."','".$module."',".$description_val.",".$adb->formatDate($date_var).",".$adb->formatDate($date_var).")";
+		$adb->query($sql);
+		$this->id = $current_id;
 	}
 
 	//$sql = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module."','".$this->column_fields['description']."',".$adb->formatString("crmentity","createdtime",$date_var).",".$adb->formatString("crmentity","modifiedtime",$date_var).")";
@@ -1128,13 +1184,13 @@
 		
   }
 
-  function save($module_name) 
-  {
-	  global $log;
-        $log->debug("module name is ".$module_name);
-    //GS Save entity being called with the modulename as parameter
-      $this->saveentity($module_name);
-  }
+	function save($module_name) 
+	{
+		global $log;
+	        $log->debug("module name is ".$module_name);
+		//GS Save entity being called with the modulename as parameter
+		$this->saveentity($module_name);
+	}
   
 	function process_list_query($query, $row_offset, $limit= -1, $max_per_page = -1)
 	{

Modified: vtigercrm/trunk/include/utils/CommonUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/CommonUtils.php (original)
+++ vtigercrm/trunk/include/utils/CommonUtils.php Thu May 25 21:33:15 2006
@@ -2199,4 +2199,34 @@
 	return $storage_path;
 }
 
+/**
+ * 	This function is used to check whether the attached file is a image file or not
+ *	@param string $file_details  - files array which contains all the uploaded file details
+ * 	return string $save_image - true or false. if the image can be uploaded then true will return otherwise false.
+*/
+function validateImageFile($file_details)
+{
+	global $adb, $log;
+	$log->debug("Entering into validateImageFile($file_details) method.");
+	
+	$savefile = 'true';
+	$file_type_details = explode("/",$file_details['type']);
+	$filetype = $file_type_details['1'];
+
+	if (($filetype == "jpeg" ) || ($filetype == "png") || ($filetype == "jpg" ) || ($filetype == "pjpeg" ) || ($filetype == "x-png") || ($filetype == "gif") )
+	{
+		$saveimage = 'true';
+	}
+	else
+	{
+		$saveimage = 'false';
+		$_SESSION['image_type_error'] .= "<br> &nbsp;&nbsp;<b>$file_details[name]</b> is not uploaded. Allowed file types - jpeg, png, jpg, pjpeg, x-png or gif.";
+		$log->debug("Invalid Image type == $filetype");
+	}
+
+	$log->debug("Exiting from validateImageFile($file_details) method. return saveimage=$saveimage");
+	return $saveimage;
+}
+
+
 ?>

Modified: vtigercrm/trunk/include/utils/DetailViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/DetailViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/DetailViewUtils.php Thu May 25 21:33:15 2006
@@ -352,52 +352,49 @@
         }
 	elseif($uitype == 69)
 	{
+		$label_fld[] =$mod_strings[$fieldlabel];
+		if($tabid==14)
+		{
+			$images=array();
+			$query = 'select productname,attachments.path,attachments.name from products left join seattachmentsrel on seattachmentsrel.crmid=products.productid inner join attachments on attachments.attachmentsid=seattachmentsrel.attachmentsid where productid='.$col_fields['record_id'];
+			$result_image = $adb->query($query);
+			for($image_iter=0;$image_iter < $adb->num_rows($result_image);$image_iter++)	
+			{
+				$image_array[] = $adb->query_result($result_image,$image_iter,'name');	
+				$imagepath_array[] = $adb->query_result($result_image,$image_iter,'path');	
+			}
+			if(count($image_array)>1)
+			{
+				if(count($image_array) < 4)
+					$sides=count($image_array)*2;
+				else
+					$sides=8;
+
+				$image_lists = '<div id="Carousel" style="position:relative;vertical-align: middle;">
+					<img src="modules/Products/placeholder.gif" width="371" height="227" style="position:relative;">
+					</div><script>var Car_NoOfSides='.$sides.'; Car_Image_Sources=new Array(';
+
+				for($image_iter=0;$image_iter < count($image_array);$image_iter++)
+				{
+					$images[]='"'.$imagepath_array[$image_iter].$image_array[$image_iter].'","'.$imagepath_array[$image_iter].$image_array[$image_iter].'"';
+				}	
+				$image_lists .=implode(',',$images).');</script>';
+				$label_fld[] =$image_lists;
+			}elseif(count($image_array)==1)
+			{
+				$label_fld[] ='<img src="'.$imagepath_array[0].$image_array[0].'" border="0" width="450" height="300">';
+			}else
+			{
+				$label_fld[] ='';
+			}
 			
-		$label_fld[] =$mod_strings[$fieldlabel];
-		if($col_fields[$fieldname] != '')
-		{
-			if($tabid==14)
-			{
-				$images=array();
-				$image_array=explode("###",trim($col_fields[$fieldname],"###"));
-				$image_array = array_slice($image_array,0,count($image_array));
-
-				$imgpath = getModuleFileStoragePath('Products');
-				if(count($image_array)>1)
-				{
-					if(count($image_array) < 4)
-						$sides=count($image_array)*2;
-					else
-						$sides=8;
-						
-					$image_lists = '<div id="Carousel" style="position:relative;vertical-align: middle;">
-						<img src="modules/Products/placeholder.gif" width="371" height="227" style="position:relative;">
-						</div><script>var Car_NoOfSides='.$sides.'; Car_Image_Sources=new Array(';
-
-						foreach($image_array as $image)
-						{
-							$images[]='"'.$imgpath.$image.'","'.$imgpath.$image.'"';
-						}	
-						$image_lists .=implode(',',$images).');</script>';	
-
-					$label_fld[] =$image_lists;
-				}else
-				{
-					$imgpath .= $col_fields[$fieldname];
-					$label_fld[] ='<img src="'.$imgpath.'" border="0" width="450" height="300">';
-				}
-			}	
-			if($tabid==4)
-        		{
-				$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
-				$label_fld[] ='<img src="'.$imgpath.'" border="0">';
-			}
-		}
-		else
-		{
-			$label_fld[] ="";
-		}
-		
+		}	
+		if($tabid==4)
+		{
+			$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
+			$label_fld[] ='<img src="'.$imgpath.'" border="0">';
+		}
+
 	}
 	elseif($uitype == 62)
 	{

Modified: vtigercrm/trunk/include/utils/EditViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/EditViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/EditViewUtils.php Thu May 25 21:33:15 2006
@@ -472,17 +472,28 @@
 	elseif($uitype == 69)
 	{
 		$editview_label[]=$mod_strings[$fieldlabel];
-		$image_lists=explode("###",$value);
-		if(count($image_lists) > 1)
-		{
-			foreach($image_lists as $image)
-			{
-				$fieldvalue[] = $image;
-			}
-		}else
-		{
-			$fieldvalue[] = $value;
-		}
+		//This query is for Products only
+		if($module_name == 'Products')
+		{
+			$query = 'select attachments.path,attachments.name from products left join seattachmentsrel on seattachmentsrel.crmid=products.productid inner join attachments on attachments.attachmentsid=seattachmentsrel.attachmentsid where productid='.$col_fields['record_id'];
+		}
+		else
+		{
+			$query = "select attachments.path, attachments.name from contactdetails left join seattachmentsrel on seattachmentsrel.crmid=contactdetails.contactid inner join attachments on attachments.attachmentsid=seattachmentsrel.attachmentsid where contactdetails.imagename=attachments.name and contactid=".$col_fields['record_id'];
+		}
+		$result_image = $adb->query($query);
+		for($image_iter=0;$image_iter < $adb->num_rows($result_image);$image_iter++)	
+		{
+			$image_array[] = $adb->query_result($result_image,$image_iter,'name');	
+			$image_path_array[] = $adb->query_result($result_image,$image_iter,'path');	
+		}
+		if(is_array($image_array))
+			for($img_itr=0;$img_itr<count($image_array);$img_itr++)
+			{
+				$fieldvalue[] = array('name'=>$image_array[$img_itr],'path'=>$image_path_array[$img_itr]);
+			}
+		else
+			$fieldvalue[] = '';
 	}
 	elseif($uitype == 62)
 	{

Modified: vtigercrm/trunk/modules/Contacts/Contact.php
==============================================================================
--- vtigercrm/trunk/modules/Contacts/Contact.php (original)
+++ vtigercrm/trunk/modules/Contacts/Contact.php Thu May 25 21:33:15 2006
@@ -55,8 +55,8 @@
 	var $assigned_user_name;
 		
 	var $table_name = "contactdetails";
-	var $tab_name = Array('crmentity','contactdetails','contactaddress','contactsubdetails','contactscf','customerdetails');
-	var $tab_name_index = Array('crmentity'=>'crmid','contactdetails'=>'contactid','contactaddress'=>'contactaddressid','contactsubdetails'=>'contactsubscriptionid','contactscf'=>'contactid','customerdetails'=>'customerid');
+	var $tab_name = Array('crmentity','contactdetails','contactaddress','contactsubdetails','contactscf','customerdetails','attachments');
+	var $tab_name_index = Array('crmentity'=>'crmid','contactdetails'=>'contactid','contactaddress'=>'contactaddressid','contactsubdetails'=>'contactsubscriptionid','contactscf'=>'contactid','customerdetails'=>'customerid','attachments'=>'attachmentsid');
 
 
 

Modified: vtigercrm/trunk/modules/Emails/Email.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Email.php (original)
+++ vtigercrm/trunk/modules/Emails/Email.php Thu May 25 21:33:15 2006
@@ -47,7 +47,7 @@
   	var $module_id="emailid";
 
 	var $table_name = "activity";
-	var $tab_name = Array('crmentity','activity','seactivityrel','cntactivityrel');
+	var $tab_name = Array('crmentity','activity','seactivityrel','cntactivityrel','attachments');
         var $tab_name_index = Array('crmentity'=>'crmid','activity'=>'activityid','seactivityrel'=>'activityid','cntactivityrel'=>'activityid','attachments'=>'attachmentsid');
 
 	// This is the list of fields that are in the lists.

Modified: vtigercrm/trunk/modules/HelpDesk/HelpDesk.php
==============================================================================
--- vtigercrm/trunk/modules/HelpDesk/HelpDesk.php (original)
+++ vtigercrm/trunk/modules/HelpDesk/HelpDesk.php Thu May 25 21:33:15 2006
@@ -29,7 +29,7 @@
 	var $id;
 	var $mode;
 
-	var $tab_name = Array('crmentity','troubletickets','seticketsrel','ticketcf','ticketcomments');
+	var $tab_name = Array('crmentity','troubletickets','seticketsrel','ticketcf','ticketcomments','attachments');
 	var $tab_name_index = Array('crmentity'=>'crmid','troubletickets'=>'ticketid','seticketsrel'=>'ticketid','ticketcf'=>'ticketid','ticketcomments'=>'ticketid','attachments'=>'attachmentsid');
 	var $column_fields = Array();
 

Modified: vtigercrm/trunk/modules/Notes/Note.php
==============================================================================
--- vtigercrm/trunk/modules/Notes/Note.php (original)
+++ vtigercrm/trunk/modules/Notes/Note.php Thu May 25 21:33:15 2006
@@ -52,8 +52,8 @@
 	var $default_note_name_dom = array('Meeting notes', 'Reminder');
 
 	var $table_name = "notes";
-	var $tab_name = Array('crmentity','notes','senotesrel');
-        var $tab_name_index = Array('crmentity'=>'crmid','notes'=>'notesid','senotesrel'=>'notesid');
+	var $tab_name = Array('crmentity','notes','senotesrel','attachments');
+	var $tab_name_index = Array('crmentity'=>'crmid','notes'=>'notesid','senotesrel'=>'notesid','attachments'=>'attachmentsid');
 
   	var $module_id = "notesid";
 	var $object_name = "Note";

Modified: vtigercrm/trunk/modules/Products/DetailView.php
==============================================================================
--- vtigercrm/trunk/modules/Products/DetailView.php (original)
+++ vtigercrm/trunk/modules/Products/DetailView.php Thu May 25 21:33:15 2006
@@ -17,9 +17,16 @@
 $focus = new Product();
 
 if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
-  $focus->retrieve_entity_info($_REQUEST['record'],"Products");
-  $focus->id = $_REQUEST['record'];
-  $focus->name=$focus->column_fields['productname'];		
+	//Display the error message
+	if($_SESSION['image_type_error'] != '')
+	{
+		echo '<font color="red">'.$_SESSION['image_type_error'].'</font>';
+		session_unregister('image_type_error');
+	}
+
+	$focus->retrieve_entity_info($_REQUEST['record'],"Products");
+	$focus->id = $_REQUEST['record'];
+	$focus->name=$focus->column_fields['productname'];		
 }
 
 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {

Modified: vtigercrm/trunk/modules/Products/Product.php
==============================================================================
--- vtigercrm/trunk/modules/Products/Product.php (original)
+++ vtigercrm/trunk/modules/Products/Product.php Thu May 25 21:33:15 2006
@@ -42,8 +42,8 @@
         );
 
 
-	var $tab_name = Array('crmentity','products','productcf','seproductsrel','producttaxrel');
-	var $tab_name_index = Array('crmentity'=>'crmid','products'=>'productid','productcf'=>'productid','seproductsrel'=>'productid','producttaxrel'=>'productid');
+	var $tab_name = Array('crmentity','products','productcf','seproductsrel','producttaxrel','attachments');
+	var $tab_name_index = Array('crmentity'=>'crmid','products'=>'productid','productcf'=>'productid','seproductsrel'=>'productid','producttaxrel'=>'productid','attachments'=>'attachmentsid');
 	var $column_fields = Array();
 
 	var $sortby_fields = Array('productname','productcode','commissionrate');		  

Modified: vtigercrm/trunk/modules/Products/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Products/Save.php (original)
+++ vtigercrm/trunk/modules/Products/Save.php Thu May 25 21:33:15 2006
@@ -60,6 +60,10 @@
 $log->info("The Location to Save the Product Image is ".$uploaddir);
 $image_lists=array();
 $count=0;
+
+$saveimage = "true";
+$image_error = "false";
+/*
 foreach($_FILES as $files)
 {
 	$file_path_name = $files['name'];
@@ -146,8 +150,9 @@
 		$image_lists[]= getProductImageName($record_id,$del_image_array);
 		$saveimage="true";
 }
-
+*/
 //end of code to retain the pictures from db
+
  //code added for returning back to the current view after edit from list view
 if($_REQUEST['return_viewname'] == '') $return_viewname='0';
 if($_REQUEST['return_viewname'] != '')$return_viewname=$_REQUEST['return_viewname'];





More information about the vtigercrm-commits mailing list