[Vtigercrm-commits] [vtiger-commits] r5933 - in /vtigercrm/trunk/modules/Emails: DetailView.php EditView.php Email.php ListView.php Save.php language/en_us.lang.php mailsend.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri May 12 12:13:06 EDT 2006
Author: don
Date: Fri May 12 10:12:58 2006
New Revision: 5933
Log:
issue im emails has been fixed
Modified:
vtigercrm/trunk/modules/Emails/DetailView.php
vtigercrm/trunk/modules/Emails/EditView.php
vtigercrm/trunk/modules/Emails/Email.php
vtigercrm/trunk/modules/Emails/ListView.php
vtigercrm/trunk/modules/Emails/Save.php
vtigercrm/trunk/modules/Emails/language/en_us.lang.php
vtigercrm/trunk/modules/Emails/mailsend.php
Modified: vtigercrm/trunk/modules/Emails/DetailView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/DetailView.php (original)
+++ vtigercrm/trunk/modules/Emails/DetailView.php Fri May 12 10:12:58 2006
@@ -34,11 +34,20 @@
$focus = new Email();
+$smarty = new vtigerCRM_Smarty;
if(isset($_REQUEST['record']))
{
+ global $adb;
$focus->retrieve_entity_info($_REQUEST['record'],"Emails");
- $log->info("Entity info successfully retrieved for DetailView.");
+ $log->info("Entity info successfully retrieved for DetailView.");
$focus->id = $_REQUEST['record'];
+ $query = 'select from_email,to_email,cc_email,bcc_email from emaildetails where emailid ='.$focus->id;
+ $result = $adb->query($query);
+ $smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email'));
+ $to_email = ereg_replace('###',',',$adb->query_result($result,0,'to_email'));
+ $smarty->assign('TO_MAIL',$to_email);
+ $smarty->assign('CC_MAIL',ereg_replace('###',',',$adb->query_result($result,0,'cc_email')));
+ $smarty->assign('BCC_MAIL',ereg_replace('###',',',$adb->query_result($result,0,'bcc_email')));
if($focus->column_fields['name'] != '')
$focus->name = $focus->column_fields['name'];
else
@@ -104,9 +113,7 @@
$submenu = array('LBL_EMAILS_TITLE'=>'index.php?module=Emails&action=index','LBL_WEBMAILS_TITLE'=>'index.php?module=squirrelmail-1.4.4&action=redirect');
$sec_arr = array('index.php?module=Emails&action=index'=>'Emails','index.php?module=squirrelmail-1.4.4&action=redirect'=>'Emails');
-echo '<br>';
-$smarty = new vtigerCRM_Smarty;
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
@@ -120,7 +127,7 @@
$smarty->assign("CATEGORY",$category);
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
-else $smarty->assign("NAME", "");
+ else $smarty->assign("NAME", "");
$entries = getBlocks("Emails","detail_view",'',$focus->column_fields);
if($_REQUEST['mode'] != 'ajax')
@@ -135,8 +142,6 @@
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$smarty->assign("JAVASCRIPT", get_set_focus_js().get_validate_record_js());
-
-$smarty->assign("ID", $_REQUEST['record']);
if(isPermitted("Emails","EditView",$_REQUEST['record']) == 'yes')
$smarty->assign("EDIT_DUPLICATE","permitted");
Modified: vtigercrm/trunk/modules/Emails/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/EditView.php (original)
+++ vtigercrm/trunk/modules/Emails/EditView.php Fri May 12 10:12:58 2006
@@ -34,65 +34,6 @@
global $mod_strings;
global $current_user;
-$submenu = array('LBL_EMAILS_TITLE'=>'index.php?module=Emails&action=index','LBL_WEBMAILS_TITLE'=>'index.php?module=squirrelmail-1.4.4&action=redirect');
-$sec_arr = array('index.php?module=Emails&action=index'=>'Emails','index.php?module=squirrelmail-1.4.4&action=redirect'=>'Emails');
-?>
-<!--table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td class="tabStart"> </td-->
-<?
- if(isset($_REQUEST['smodule']) && $_REQUEST['smodule'] != '')
- {
- $classname = "tabOff";
- }
- else
- {
- $classname = "tabOn";
- }
- $listView = "ListView.php";
- foreach($submenu as $label=>$filename)
- {
- $cur_mod = $sec_arr[$filename];
- $cur_tabid = getTabid($cur_mod);
-
- if(isPermitted($cur_mod,'','') == 'yes')
- {
-
- list($lbl,$sname,$title)=split("_",$label);
- if(stristr($label,"EMAILS"))
- {
-
- //echo '<td class="tabOn" nowrap><a href="index.php?module=Emails&action=index&smodule='.$sname.'" class="tabLink">'.$mod_strings[$label].'</a></td>';
-
- $listView = $filename;
- $classname = "tabOff";
- }
- elseif(stristr($label,$_REQUEST['smodule']))
- {
- //echo '<td class="tabOn" nowrap><a href="index.php?module=squirrelmail-1.4.4&action=redirect&smodule='.$sname.'" class="tabLink">'.$mod_strings[$label].'</a></td>';
- $listView = $filename;
- $classname = "tabOff";
- }
- else
- {
- //echo '<td class="'.$classname.'" nowrap><a href="index.php?module=squirrelmail-1.4.4&action=redirect&smodule='.$sname.'" class="tabLink">'.$mod_strings[$label].'</a></td>';
- }
- $classname = "tabOff";
- }
-
- }
-?>
- <!--td width="100%" class="tabEnd"> </td>
- </tr>
- </table></td>
- </tr>
- </table>
- <br-->
-<?
-
-
$focus = new Email();
$smarty = new vtigerCRM_Smarty();
@@ -114,7 +55,16 @@
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'],"Emails");
- $log->info("Entity info successfully retrieved for EditView.");
+ $query = 'select idlists,from_email,to_email,cc_email,bcc_email from emaildetails where emailid ='.$focus->id;
+ $result = $adb->query($query);
+ $smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email'));
+ $to_email = ereg_replace('###',',',$adb->query_result($result,0,'to_email'));
+ $smarty->assign('TO_MAIL',$to_email);
+ $smarty->assign('CC_MAIL',ereg_replace('###',',',$adb->query_result($result,0,'cc_email')));
+ $smarty->assign('BCC_MAIL',ereg_replace('###',',',$adb->query_result($result,0,'bcc_email')));
+ $smarty->assign('IDLISTS',ereg_replace('###',',',$adb->query_result($result,0,'idlists')));
+
+ $log->info("Entity info successfully retrieved for EditView.");
$focus->name=$focus->column_fields['name'];
}
if(isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '')
@@ -122,18 +72,8 @@
$focus->column_fields['parent_id'] = $_REQUEST['parent_id'];
$focus->mode = '';
}
-if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
-{
- $old_id = $_REQUEST['record'];
- if (! empty($focus->filename) )
- {
- $old_id = $focus->id;
- }
- $focus->id = "";
- $focus->mode = "";
-}
+
global $theme;
-
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
@@ -142,8 +82,6 @@
$details = getBlocks("Emails",$disp_view,$mode,$focus->column_fields);
$smarty->assign("BLOCKS",$details['Email Information']);
-//echo '<pre>';print_r($details['Email Information']);echo '</pre>';
-
$smarty->assign("MODULE",$currentModule);
$smarty->assign("SINGLE_MOD","Email");
@@ -237,7 +175,6 @@
$focus->parent_type = $app_list_strings['record_type_default_key'];
}
-
$log->info("Email detail view");
$smarty->assign("MOD", $mod_strings);
Modified: vtigercrm/trunk/modules/Emails/Email.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Email.php (original)
+++ vtigercrm/trunk/modules/Emails/Email.php Fri May 12 10:12:58 2006
@@ -45,10 +45,6 @@
var $date_start;
var $time_start;
var $module_id="emailid";
-
- var $rel_users_table = "salesmanactivityrel";
- var $rel_contacts_table = "cntactivityrel";
- var $rel_serel_table = "seactivityrel";
var $table_name = "activity";
var $tab_name = Array('crmentity','activity','seactivityrel','cntactivityrel');
Modified: vtigercrm/trunk/modules/Emails/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/ListView.php (original)
+++ vtigercrm/trunk/modules/Emails/ListView.php Fri May 12 10:12:58 2006
@@ -162,21 +162,21 @@
{
$list_query .= " AND " .$where;
}
-if($_REQUEST['folder'] =='Contacts')
+if($_REQUEST['folderid'] =='2')
{
$list_query .= "AND seactivityrel.crmid in (select contactid from contactdetails)";
}
-if($_REQUEST['folder'] =='Accounts')
+if($_REQUEST['folderid'] =='3')
{
$list_query .= "AND seactivityrel.crmid in (select accountid from account)";
}
-if($_REQUEST['folder'] =='Leads')
+if($_REQUEST['folderid'] =='4')
{
$list_query .= "AND seactivityrel.crmid in (select leadid from leaddetails)";
}
-if($_REQUEST['folder'] =='Users')
-{
- $list_query .= "AND seactivityrel.crmid in (select id from users)";
+if($_REQUEST['folderid'] =='5')
+{
+ $list_query .= "AND salesmanactivityrel.smid in (select id from users)";
}
if(isset($order_by) && $order_by != '')
{
Modified: vtigercrm/trunk/modules/Emails/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Save.php (original)
+++ vtigercrm/trunk/modules/Emails/Save.php Fri May 12 10:12:58 2006
@@ -48,15 +48,14 @@
$focus = new Email();
+global $current_user;
setObjectValuesFromRequest(&$focus);
-
//Check if the file is exist or not.
if($_FILES["filename"]["size"] == 0 && $_FILES["filename"]["name"] != '')
{
$file_upload_error = true;
$_FILES = '';
}
-
if((isset($_REQUEST['deletebox']) && $_REQUEST['deletebox'] != null) && $_REQUEST['addbox'] == null)
{
imap_delete($mbox,$_REQUEST['deletebox']);
@@ -149,12 +148,19 @@
$focus->filename = $_REQUEST['file_name'];
$focus->parent_id = $_REQUEST['parent_id'];
$focus->parent_type = $_REQUEST['parent_type'];
+$focus->column_fields["assigned_user_id"]=$current_user->id;
$focus->column_fields["activitytype"]="Emails";
+$focus->column_fields["date_start"]= date('Y-m-d');
$focus->save("Emails");
-
$return_id = $focus->id;
$email_id = $return_id;
-
+$query = 'select emailid from emaildetails where emailid ='.$email_id;
+$result = $adb->query($query);
+if($adb->num_rows($result) > 0)
+ $query = 'update emaildetails set idlists='.$_REQUEST["parent_id"].' where emailid = '.$email_id;
+else
+ $query = 'insert into emaildetails values ('.$email_id.',"","","","","","'.$_REQUEST["parent_id"].'","SAVED")';
+$adb->query($query);
$focus->retrieve_entity_info($return_id,"Emails");
//this is to receive the data from the Select Users button
Modified: vtigercrm/trunk/modules/Emails/language/en_us.lang.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/language/en_us.lang.php (original)
+++ vtigercrm/trunk/modules/Emails/language/en_us.lang.php Fri May 12 10:12:58 2006
@@ -64,7 +64,8 @@
'LBL_FORWARD_BUTTON'=>'Forward',
'LBL_DOWNLOAD_ATTCH_BUTTON'=>'Download Attachments',
'LBL_FROM'=>'From :',
-'LBL_CC'=>'CC :',
+'LBL_CC'=>'Cc :',
+'LBL_BCC'=>'Bcc :',
'NTC_REMOVE_INVITEE'=>'Are you sure you want to remove this recipient from the email?',
'LBL_INVITEE'=>'Recipients',
@@ -135,6 +136,7 @@
'LBL_MAIL_CONNECT_ERROR_INFO'=>'Error connecting mail server!<br> Check in My Accounts->List Mail Server -> List Mail Account',
'LBL_ALLMAILS'=>'All Mails',
'LBL_TO_USERS'=>'To Users',
+'LBL_TO'=>'To:',
);
?>
Modified: vtigercrm/trunk/modules/Emails/mailsend.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/mailsend.php (original)
+++ vtigercrm/trunk/modules/Emails/mailsend.php Fri May 12 10:12:58 2006
@@ -72,6 +72,8 @@
else
{
$mail_status = send_mail('Emails',$to_email,$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$cc,$bcc,'all',$focus->id);
+
+ $query = 'update emaildetails set cc_email="'.ereg_replace(',','###',$cc).'",bcc_email="'.ereg_replace(',','###',$bcc).'",assigned_user_email="'.$to_email.'",email_flag="SENT" where emailid='.$focus->id;
//set the errorheader1 to 1 if the mail has not been sent to the assigned to user
if($mail_status != 1)//when mail send fails
{
@@ -80,11 +82,13 @@
}
elseif($mail_status == 1 && $to_email == '')//Mail send success only for CC and BCC but the 'to' email is empty
{
+ $adb->query($query);
$errorheader1 = 1;
$mail_status_str = "cc_success=0&&&";
}
else
{
+ $adb->query($query);
$mail_status_str = $to_email."=".$mail_status."&&&";
}
}
@@ -93,50 +97,64 @@
//Added code from mysendmail.php which is contributed by Raju(rdhital)
$parentid= $_REQUEST['parent_id'];
$myids=explode("|",$parentid);
+$all_to_emailids = Array();
for ($i=0;$i<(count($myids)-1);$i++)
{
$realid=explode("@",$myids[$i]);
$nemail=count($realid);
$mycrmid=$realid[0];
- $pmodule=getSalesEntityType($mycrmid);
- for ($j=1;$j<$nemail;$j++)
+ if($realid[1] == -1)
{
- $temp=$realid[$j];
- //$myquery='Select columnname from field where fieldid='.$temp;
- $myquery='Select columnname from field where fieldid='.$adb->quote($temp);
- $fresult=$adb->query($myquery);
- if ($pmodule=='Contacts')
+ //handle the mail send to users
+ $emailadd = $adb->query_result($adb->query("select email1 from users where id=$mycrmid"),0,'email1');
+ $mail_status = send_mail('Emails',$emailadd,$current_user->user_name,'',$focus->column_fields['subject'],$focus->column_fields['description'],'','','all',$focus->id);
+ $all_to_emailids []= $emailadd;
+ $mail_status_str .= $emailadd."=".$mail_status."&&&";
+ }
+ else
+ {
+ //Send mail to account or lead or contact based on their ids
+ $pmodule=getSalesEntityType($mycrmid);
+ for ($j=1;$j<$nemail;$j++)
{
- require_once('modules/Contacts/Contact.php');
- $myfocus = new Contact();
- $myfocus->retrieve_entity_info($mycrmid,"Contacts");
- }
- elseif ($pmodule=='Accounts')
- {
- require_once('modules/Accounts/Account.php');
- $myfocus = new Account();
- $myfocus->retrieve_entity_info($mycrmid,"Accounts");
- }
- elseif ($pmodule=='Leads')
- {
- require_once('modules/Leads/Lead.php');
- $myfocus = new Lead();
- $myfocus->retrieve_entity_info($mycrmid,"Leads");
- }
- $fldname=$adb->query_result($fresult,0,"columnname");
- $emailadd=br2nl($myfocus->column_fields[$fldname]);
+ $temp=$realid[$j];
+ $myquery='Select columnname from field where fieldid='.$adb->quote($temp);
+ $fresult=$adb->query($myquery);
+ if ($pmodule=='Contacts')
+ {
+ require_once('modules/Contacts/Contact.php');
+ $myfocus = new Contact();
+ $myfocus->retrieve_entity_info($mycrmid,"Contacts");
+ }
+ elseif ($pmodule=='Accounts')
+ {
+ require_once('modules/Accounts/Account.php');
+ $myfocus = new Account();
+ $myfocus->retrieve_entity_info($mycrmid,"Accounts");
+ }
+ elseif ($pmodule=='Leads')
+ {
+ require_once('modules/Leads/Lead.php');
+ $myfocus = new Lead();
+ $myfocus->retrieve_entity_info($mycrmid,"Leads");
+ }
+ $fldname=$adb->query_result($fresult,0,"columnname");
+ $emailadd=br2nl($myfocus->column_fields[$fldname]);
- if($emailadd != '')
- {
- $mail_status = send_mail('Emails',$emailadd,$current_user->user_name,'',$focus->column_fields['subject'],$focus->column_fields['description'],'','','all',$focus->id);
- $mail_status_str .= $emailadd."=".$mail_status."&&&";
- //added to get remain the EditView page if an error occurs in mail sending
- if($mail_status != 1)
+ if($emailadd != '')
{
- $errorheader2 = 1;
+ $mail_status = send_mail('Emails',$emailadd,$current_user->user_name,'',$focus->column_fields['subject'],$focus->column_fields['description'],'','','all',$focus->id);
+
+ $all_to_emailids []= $emailadd;
+ $mail_status_str .= $emailadd."=".$mail_status."&&&";
+ //added to get remain the EditView page if an error occurs in mail sending
+ if($mail_status != 1)
+ {
+ $errorheader2 = 1;
+ }
}
- }
- }
+ }
+ }
}
//Added to redirect the page to Emails/EditView if there is an error in mail sending
@@ -155,7 +173,16 @@
$returnid = $_REQUEST['currentid'];
}
}
-
+else
+{
+ global $adb;
+ $date_var = date('Ymd');
+ $query = 'update activity set date_start ='.$date_var.' where activityid = '.$returnid;
+ $adb->query($query);
+ $toemails = implode('###',$all_to_emailids);
+ $query = 'update emaildetails set email_flag="SENT",to_email="'.$toemails.'" where emailid='.$focus->id;
+ $adb->query($query);
+}
//The following function call is used to parse and form a encoded error message and then pass to result page
$mail_error_str = getMailErrorString($mail_status_str);
$adb->println("Mail Sending Process has been finished.\n\n");
More information about the vtigercrm-commits
mailing list