[Vtigercrm-commits] [vtiger-commits] r6160 - in /vtigercrm/trunk/modules/Emails: EditView.php Email.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu May 18 12:40:51 EDT 2006


Author: don
Date: Thu May 18 10:40:46 2006
New Revision: 6160

Log:
send mail has been added

Modified:
    vtigercrm/trunk/modules/Emails/EditView.php
    vtigercrm/trunk/modules/Emails/Email.php

Modified: vtigercrm/trunk/modules/Emails/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/EditView.php (original)
+++ vtigercrm/trunk/modules/Emails/EditView.php Thu May 18 10:40:46 2006
@@ -73,9 +73,11 @@
     $log->info("Entity info successfully retrieved for EditView.");
 	$focus->name=$focus->column_fields['name'];		
 }
-if(isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '')
-{
-        $focus->column_fields['parent_id'] = $_REQUEST['parent_id'];
+elseif(isset($_REQUEST['sendmail']) && $_REQUEST['sendmail'] !='')
+{
+	$mailids = get_to_emailids($_REQUEST['pmodule']);
+	$smarty->assign('TO_MAIL',$mailids['mailds']);
+	$smarty->assign('IDLISTS',$mailids['idlists']);	
 	$focus->mode = '';
 }
 
@@ -94,7 +96,7 @@
 //Display the FCKEditor or not? -- configure $FCKEDITOR_DISPLAY in config.php 
 $smarty->assign("FCKEDITOR_DISPLAY",$FCKEDITOR_DISPLAY);
 
-
+/*
 if($_REQUEST['reply'])
 {
 	$tmp_theme = $theme;
@@ -103,7 +105,7 @@
 	//WEBMAIL FUNCTIONS
 	define('SM_PATH','modules/squirrelmail-1.4.4/');
 	//get the webmail id and get the subject of the mail given the mail id
-	/* SquirrelMail required files. */
+	// SquirrelMail required files. 
 	require_once(SM_PATH . 'functions/strings.php');
 	require_once(SM_PATH . 'functions/imap_general.php');
 	require_once(SM_PATH . 'functions/imap_messages.php');
@@ -148,7 +150,7 @@
 		}
 	}
 	$theme = $tmp_theme;
-}
+}*/
 //get Email Information
 
 //needed when creating a new email with default values passed in
@@ -240,20 +242,8 @@
 	$smarty->assign("CHANGE_PARENT_BUTTON", $change_parent_button);
 }
 
-if($focus->parent_type == "Account") 
-	$smarty->assign("DEFAULT_SEARCH", "&query=true&account_id=$focus->parent_id&account_name=".urlencode($focus->parent_name));
-
-
 $email_tables = Array('emails','crmentity','activity'); 
 $tabid = getTabid("Emails");
-$validationData = getDBValidationData($email_tables,$tabid);
-$data = split_validationdataArray($validationData);
-
-$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
-$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
-$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
-$category = getParentTab();
-$smarty->assign("CATEGORY",$category);
 
 $check_button = Button_Check($module);
 $smarty->assign("CHECK", $check_button);

Modified: vtigercrm/trunk/modules/Emails/Email.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Email.php (original)
+++ vtigercrm/trunk/modules/Emails/Email.php Thu May 18 10:40:46 2006
@@ -262,4 +262,53 @@
 
 
 }
+/** Function to get the emailids for the given ids form the request parameters 
+ *  It returns an array which contains the mailids and the parentidlists
+*/
+
+function get_to_emailids($module)
+{
+	global $adb;
+	$query = 'select columnname,fieldid from field where fieldid in('.ereg_replace(':',',',$_REQUEST["field_lists"]).')';
+    $result = $adb->query($query);
+	$columns = Array();
+	$idlists = '';
+	$mailids = '';
+	while($row = $adb->fetch_array($result))
+    {
+		$columns[]=$row['columnname'];
+		$fieldid[]=$row['fieldid'];
+	}
+	$columnlists = implode(',',$columns);
+	$crmids = ereg_replace(':',',',$_REQUEST["idlist"]);
+	switch($module)
+	{
+		case 'Leads':
+			$query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from leaddetails inner join crmentity on crmentity.crmid=leaddetails.leadid left join leadscf on leadscf.leadid = leaddetails.leadid where crmentity.deleted=0 and crmentity.crmid in ('.$crmids.')';
+			break;
+		case 'Contacts':
+			$query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from contactdetails inner join crmentity on crmentity.crmid=contactdetails.contactid left join contactscf on contactscf.contactid = contactdetails.contactid where crmentity.deleted=0 and crmentity.crmid in ('.$crmids.')';
+			break;
+		case 'Accounts':
+			$query = 'select crmid,accountname as entityname,'.$columnlists.' from account inner join crmentity on crmentity.crmid=account.accountid left join accountscf on accountscf.accountid = account.accountid where crmentity.deleted=0 and crmentity.crmid in ('.$crmids.')';
+			break;
+	}	
+	$result = $adb->query($query);
+	while($row = $adb->fetch_array($result))
+	{
+		$name = $row['entityname'];
+		for($i=0;$i<count($columns);$i++)
+		{
+			if($row[$columns[$i]] != NULL && $row[$columns[$i]] !='')
+			{
+				$idlists .= $row['crmid'].'@'.$fieldid[$i].'|'; 
+				$mailids .= $name.'<'.$row[$columns[$i]].'>,';	
+			}
+		}
+	}
+
+	$return_data = Array('idlists'=>$idlists,'mailds'=>$mailids);
+	return $return_data;
+		
+}
 ?>





More information about the vtigercrm-commits mailing list