更新到 5.2 正式版后第一次 SVN 提交。
yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@599 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('include/utils/utils.php');
|
||||
|
||||
$currentmodule = vtlib_purify($_REQUEST['module']);
|
||||
$focus = CRMEntity::getInstance($currentmodule);
|
||||
$RECORD = vtlib_purify($_REQUEST['record']);
|
||||
if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
|
||||
$focus->retrieve_entity_info($RECORD,$currentmodule);
|
||||
$focus->id = $RECORD;
|
||||
$focus->name=$focus->column_fields['subject'];
|
||||
$log->debug("id is ".$focus->id);
|
||||
$log->debug("name is ".$focus->name);
|
||||
}
|
||||
|
||||
global $mod_strings;
|
||||
global $app_strings;
|
||||
global $currentModule;
|
||||
global $theme;
|
||||
$theme_path="themes/".$theme."/";
|
||||
$image_path=$theme_path."images/";
|
||||
|
||||
$smarty = new vtigerCRM_Smarty;
|
||||
|
||||
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
|
||||
$related_array=getRelatedLists($currentModule,$focus);
|
||||
$category = getParentTab();
|
||||
$smarty->assign("CATEGORY",$category);
|
||||
if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
|
||||
$smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode']));
|
||||
}
|
||||
$smarty->assign("id",$focus->id);
|
||||
$smarty->assign("RELATEDLISTS", $related_array);
|
||||
|
||||
require_once('include/ListView/RelatedListViewSession.php');
|
||||
if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
|
||||
$relationId = vtlib_purify($_REQUEST['relation_id']);
|
||||
RelatedListViewSession::addRelatedModuleToSession($relationId,
|
||||
vtlib_purify($_REQUEST['selected_header']));
|
||||
}
|
||||
$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
|
||||
$smarty->assign("SELECTEDHEADERS", $open_related_modules);
|
||||
|
||||
$smarty->assign("ID",$RECORD );
|
||||
$smarty->assign("MODULE",$currentmodule);
|
||||
$smarty->assign("SINGLE_MOD",$app_strings['Email']);
|
||||
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
|
||||
$smarty->assign("MOD",$mod_strings);
|
||||
$smarty->assign("APP",$app_strings);
|
||||
$smarty->assign("THEME", $theme);
|
||||
$smarty->assign("IMAGE_PATH", $image_path);
|
||||
|
||||
$check_button = Button_Check($module);
|
||||
$smarty->assign("CHECK", $check_button);
|
||||
|
||||
$smarty->display("RelatedLists.tpl");
|
||||
?>
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/database/PearDatabase.php');
|
||||
$idlist = vtlib_purify($_POST['idlist']);
|
||||
$pmodule=vtlib_purify($_REQUEST['return_module']);
|
||||
$ids=explode(';',$idlist);
|
||||
|
||||
if ($pmodule=='Accounts')
|
||||
{
|
||||
$querystr="select fieldid,fieldlabel,columnname,tablename from vtiger_field where tabid=6 and uitype='13' and vtiger_field.presence in (0,2)";
|
||||
}
|
||||
elseif ($pmodule=='Contacts')
|
||||
{
|
||||
$querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=4 and uitype='13' and vtiger_field.presence in (0,2)";
|
||||
}
|
||||
elseif ($pmodule=='Leads')
|
||||
{
|
||||
$querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=7 and uitype='13' and vtiger_field.presence in (0,2)";
|
||||
}
|
||||
|
||||
$result=$adb->pquery($querystr, array());
|
||||
$numrows = $adb->num_rows($result);
|
||||
|
||||
?>
|
||||
<form name="choosemails" action="post" onsubmit="VtigerJS_DialogBox.block();">
|
||||
<input type="hidden" name="emailids" value="">
|
||||
<h4>The following emails are available for the selected record. Please choose the ones you would like to use.</h4>
|
||||
<div align="center">
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<?php
|
||||
for ($i=0;$i<$numrows;$i++)
|
||||
{
|
||||
$temp=$adb->query_result($result,$i,'columnname');
|
||||
$temp1=br2nl($myfocus->column_fields[$temp]);
|
||||
echo '<tr><td>'.$adb->query_result($result,$i,'fieldlabel').' </td><td> <input name="emails'.$i.'" type="checkbox" title="Raju"></td><td>'.$temp1.'</tr>';
|
||||
}
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
function passemail()
|
||||
{
|
||||
y=new Array();
|
||||
<?php
|
||||
foreach ($ids as $id_num => $id)
|
||||
{
|
||||
print "y.push(\"$id\" );";
|
||||
}
|
||||
$cnt=count($ids);
|
||||
print "idcount=$cnt;";
|
||||
?>
|
||||
<?php
|
||||
for ($x=0;$x<$numrows;$x++)
|
||||
{
|
||||
?>
|
||||
if (document.choosemails.emails<?php echo $x;?>.checked)
|
||||
{
|
||||
for (m=0;m<idcount;m++)
|
||||
{
|
||||
y[m]=y[m]+"@<?php echo $adb->query_result($result,$x,'fieldid');?>";
|
||||
}
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
stry = y.join("");
|
||||
document.choosemails.emailids.value=stry;
|
||||
document.choosemails.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
</table>
|
||||
<input type="button" name="OK" onClick="passemail()" value="OK">
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
$pmodule=vtlib_purify($_REQUEST['pmodule']);
|
||||
$entityid=vtlib_purify($_REQUEST['entityid']);
|
||||
|
||||
if ($pmodule=='Accounts')
|
||||
{
|
||||
$querystr="select fieldid,fieldlabel,columnname,tablename from vtiger_field where tabid=6 and uitype='13' and vtiger_field.presence in (0,2)";
|
||||
}
|
||||
elseif ($pmodule=='Contacts')
|
||||
{
|
||||
$querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=4 and uitype='13' and vtiger_field.presence in (0,2)";
|
||||
}
|
||||
elseif ($pmodule=='Leads')
|
||||
{
|
||||
$querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=7 and uitype='13' and vtiger_field.presence in (0,2)";
|
||||
}
|
||||
$result=$adb->pquery($querystr, array());
|
||||
$numrows = $adb->num_rows($result);
|
||||
|
||||
if ($pmodule=='Accounts')
|
||||
{
|
||||
require_once('modules/Accounts/Accounts.php');
|
||||
$myfocus = new Accounts();
|
||||
$myfocus->retrieve_entity_info($entityid,"Accounts");
|
||||
}
|
||||
elseif ($pmodule=='Contacts')
|
||||
{
|
||||
require_once('modules/Contacts/Contacts.php');
|
||||
$myfocus = new Contacts();
|
||||
$myfocus->retrieve_entity_info($entityid,"Contacts");
|
||||
}
|
||||
elseif ($pmodule=='Leads')
|
||||
{
|
||||
require_once('modules/Leads/Leads.php');
|
||||
$myfocus = new Leads();
|
||||
$myfocus->retrieve_entity_info($entityid,"Leads");
|
||||
}
|
||||
?>
|
||||
<script language="javascript">
|
||||
function passemail()
|
||||
{
|
||||
y=window.opener.document.EditView.parent_id.value+"<?php echo $entityid;?>";
|
||||
z=window.opener.document.EditView.parent_name.value;
|
||||
<?php
|
||||
for ($x=0;$x<$numrows;$x++)
|
||||
{
|
||||
$temp=$adb->query_result($result,$x,'columnname');
|
||||
$temp1=br2nl($myfocus->column_fields[$temp]);
|
||||
if ($pmodule=='Accounts')
|
||||
{
|
||||
$fullname=br2nl($myfocus->column_fields['accountname']);
|
||||
}
|
||||
elseif ($pmodule=='Contacts')
|
||||
{
|
||||
$fname=br2nl($myfocus->column_fields['firstname']);
|
||||
$lname=br2nl($myfocus->column_fields['lastname']);
|
||||
$fullname=$lname.' '.$fname;
|
||||
}
|
||||
elseif ($pmodule=='Leads')
|
||||
{
|
||||
$fname=br2nl($myfocus->column_fields['firstname']);
|
||||
$lname=br2nl($myfocus->column_fields['lastname']);
|
||||
$fullname=$lname.' '.$fname;
|
||||
}
|
||||
?>
|
||||
if (document.choosemails.emails<?php echo $x;?>.checked)
|
||||
{
|
||||
y=y+"@<?php echo $adb->query_result($result,$x,'fieldid');?>";
|
||||
z=z+"<?php echo $fullname.'<'.$temp1.'> ;';?>";
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
window.opener.document.EditView.parent_id.value=y+"|";
|
||||
window.opener.document.EditView.parent_name.value=z;
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<form name="choosemails" method="post" onsubmit="VtigerJS_DialogBox.block();">
|
||||
<h4>The following emails are available for the selected record. Please choose the ones you would like to use.</h4>
|
||||
<div align="center">
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<?php
|
||||
for ($i=0;$i<$numrows;$i++)
|
||||
{
|
||||
$temp=$adb->query_result($result,$i,'columnname');
|
||||
$temp1=br2nl($myfocus->column_fields[$temp]);
|
||||
echo '<tr><td>'.$adb->query_result($result,$i,'fieldlabel').' </td><td> <input name="emails'.$i.'" type="checkbox" title="Raju"></td><td>'.$temp1.'</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<input type="button" name="OK" onClick="passemail()" value="OK">
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
include('modules/CustomView/index.php');
|
||||
|
||||
?>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/Delete.php,v 1.6 2005/03/10 09:29:42 shaw Exp $
|
||||
* Description: TODO: To be written.
|
||||
********************************************************************************/
|
||||
|
||||
global $currentModule;
|
||||
$focus = CRMEntity::getInstance($currentModule);
|
||||
|
||||
require_once('include/logging.php');
|
||||
$log = LoggerManager::getLogger('email_delete');
|
||||
|
||||
if(!isset($_REQUEST['record']))
|
||||
die("A record number must be specified to delete the email.");
|
||||
|
||||
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
|
||||
|
||||
//code added for returning back to the current view after delete from list view
|
||||
if($_REQUEST['return_viewname'] == '') $return_viewname='0';
|
||||
if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']);
|
||||
|
||||
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action'])."&record=".vtlib_purify($_REQUEST['return_id'])."&viewname=".$return_viewname."&relmodule=".vtlib_purify($_REQUEST['module'])."&parenttab=".getParentTab());
|
||||
?>
|
||||
@@ -1,159 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/DetailView.php,v 1.22 2005/03/24 19:09:21 rank Exp $
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('data/Tracker.php');
|
||||
require_once('include/upload_file.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once("include/Zend/Json.php");
|
||||
|
||||
global $log;
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
global $currentModule;
|
||||
|
||||
$focus = CRMEntity::getInstance($currentModule);
|
||||
$json = new Zend_Json();
|
||||
|
||||
$smarty = new vtigerCRM_Smarty;
|
||||
if(isset($_REQUEST['record']))
|
||||
{
|
||||
global $adb,$default_charset;
|
||||
$focus->retrieve_entity_info($_REQUEST['record'],"Emails");
|
||||
$log->info("Entity info successfully retrieved for DetailView.");
|
||||
$focus->id = $_REQUEST['record'];
|
||||
$query = 'select email_flag,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid = ?';
|
||||
$result = $adb->pquery($query, array($focus->id));
|
||||
$smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email'));
|
||||
$to_email = $json->decode($adb->query_result($result,0,'to_email'));
|
||||
$cc_email = $json->decode($adb->query_result($result,0,'cc_email'));
|
||||
$smarty->assign('TO_MAIL',vt_suppressHTMLTags(@implode(',',$to_email)));
|
||||
$smarty->assign('CC_MAIL',vt_suppressHTMLTags(@implode(',',$cc_email)));
|
||||
$bcc_email = $json->decode($adb->query_result($result,0,'bcc_email'));
|
||||
$smarty->assign('BCC_MAIL',vt_suppressHTMLTags(@implode(',',$bcc_email)));
|
||||
$smarty->assign('EMAIL_FLAG',$adb->query_result($result,0,'email_flag'));
|
||||
if($focus->column_fields['name'] != '')
|
||||
$focus->name = $focus->column_fields['name'];
|
||||
else
|
||||
$focus->name = $focus->column_fields['subject'];
|
||||
}
|
||||
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
|
||||
{
|
||||
$focus->id = "";
|
||||
}
|
||||
|
||||
//needed when creating a new email with default values passed in
|
||||
if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name))
|
||||
{
|
||||
$focus->contact_name = $_REQUEST['contact_name'];
|
||||
}
|
||||
if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id))
|
||||
{
|
||||
$focus->contact_id = $_REQUEST['contact_id'];
|
||||
}
|
||||
if (isset($_REQUEST['opportunity_name']) && is_null($focus->parent_name))
|
||||
{
|
||||
$focus->parent_name = $_REQUEST['opportunity_name'];
|
||||
}
|
||||
if (isset($_REQUEST['opportunity_id']) && is_null($focus->parent_id))
|
||||
{
|
||||
$focus->parent_id = $_REQUEST['opportunity_id'];
|
||||
}
|
||||
if (isset($_REQUEST['account_name']) && is_null($focus->parent_name))
|
||||
{
|
||||
$focus->parent_name = $_REQUEST['account_name'];
|
||||
}
|
||||
if (isset($_REQUEST['account_id']) && is_null($focus->parent_id))
|
||||
{
|
||||
$focus->parent_id = $_REQUEST['account_id'];
|
||||
}
|
||||
if (isset($_REQUEST['parent_name']))
|
||||
{
|
||||
$focus->parent_name = $_REQUEST['parent_name'];
|
||||
}
|
||||
if (isset($_REQUEST['parent_id']))
|
||||
{
|
||||
$focus->parent_id = $_REQUEST['parent_id'];
|
||||
}
|
||||
if (isset($_REQUEST['parent_type']))
|
||||
{
|
||||
$focus->parent_type = $_REQUEST['parent_type'];
|
||||
}
|
||||
if (isset($_REQUEST['filename']) && is_null($focus->filename))
|
||||
{
|
||||
$focus->filename = $_REQUEST['filename'];
|
||||
}
|
||||
elseif (is_null($focus->parent_type))
|
||||
{
|
||||
$focus->parent_type = $app_list_strings['record_type_default_key'];
|
||||
}
|
||||
|
||||
global $theme;
|
||||
$theme_path="themes/".$theme."/";
|
||||
$image_path=$theme_path."images/";
|
||||
|
||||
$log->info("Email detail view");
|
||||
|
||||
$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');
|
||||
|
||||
$smarty->assign("MOD", $mod_strings);
|
||||
$smarty->assign("APP", $app_strings);
|
||||
|
||||
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
|
||||
if (isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
|
||||
if (isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
|
||||
if (isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
|
||||
$smarty->assign("THEME", $theme);
|
||||
$smarty->assign("IMAGE_PATH", $image_path);
|
||||
$category = getParentTab();
|
||||
$smarty->assign("CATEGORY",$category);
|
||||
|
||||
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
|
||||
else $smarty->assign("NAME", "");
|
||||
|
||||
$entries = getBlocks($currentModule,"detail_view",'',$focus->column_fields);
|
||||
$entries[$mod_strings['LBL_EMAIL_INFORMATION']]['5'][$mod_strings['Description']]['value'] = from_html($entries[$mod_strings['LBL_EMAIL_INFORMATION']]['5'][$mod_strings['Description']]['value']);
|
||||
//changed this to view description in all langauge - bharath
|
||||
$smarty->assign("BLOCKS",$entries[$mod_strings['LBL_EMAIL_INFORMATION']]);
|
||||
$smarty->assign("SINGLE_MOD", 'Email');
|
||||
|
||||
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
|
||||
|
||||
if(isPermitted("Emails","EditView",$_REQUEST['record']) == 'yes')
|
||||
$smarty->assign("EDIT_DUPLICATE","permitted");
|
||||
|
||||
if(isPermitted("Emails","Delete",$_REQUEST['record']) == 'yes')
|
||||
$smarty->assign("DELETE","permitted");
|
||||
$smarty->assign("ID",$focus->id);
|
||||
|
||||
$check_button = Button_Check($module);
|
||||
$smarty->assign("CHECK", $check_button);
|
||||
|
||||
//Constructing the Related Lists from here
|
||||
$smarty->assign("MODULE",$currentModule);
|
||||
$smarty->assign("SENDER",$email_id);
|
||||
if($_REQUEST['mode'] != 'ajax')
|
||||
$smarty->display("EmailDetailView.tpl");
|
||||
else
|
||||
$smarty->display("EmailDetails.tpl")
|
||||
?>
|
||||
@@ -1,356 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/EditView.php,v 1.25 2005/04/18 10:37:49 samk Exp $
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('data/Tracker.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once("include/Zend/Json.php");
|
||||
|
||||
global $log;
|
||||
global $app_strings;
|
||||
global $app_list_strings;
|
||||
global $mod_strings;
|
||||
global $current_user;
|
||||
global $currentModule;
|
||||
global $default_charset;
|
||||
|
||||
$focus = CRMEntity::getInstance($currentModule);
|
||||
$smarty = new vtigerCRM_Smarty();
|
||||
$json = new Zend_Json();
|
||||
|
||||
if($_REQUEST['upload_error'] == true)
|
||||
{
|
||||
echo '<br><b><font color="red"> The selected file has no data or a invalid file.</font></b><br>';
|
||||
}
|
||||
|
||||
//Email Error handling
|
||||
if($_REQUEST['mail_error'] != '')
|
||||
{
|
||||
require_once("modules/Emails/mail.php");
|
||||
echo parseEmailErrorString($_REQUEST['mail_error']);
|
||||
}
|
||||
//added to select the module in combobox of compose-popup
|
||||
if(isset($_REQUEST['par_module']) && $_REQUEST['par_module']!=''){
|
||||
$smarty->assign('select_module',vtlib_purify($_REQUEST['par_module']));
|
||||
}
|
||||
elseif(isset($_REQUEST['pmodule']) && $_REQUEST['pmodule']!='') {
|
||||
$smarty->assign('select_module',vtlib_purify($_REQUEST['pmodule']));
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['record']) && $_REQUEST['record'] !='')
|
||||
{
|
||||
$focus->id = $_REQUEST['record'];
|
||||
$focus->mode = 'edit';
|
||||
$focus->retrieve_entity_info($_REQUEST['record'],"Emails");
|
||||
$query = 'select idlists,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid =?';
|
||||
$result = $adb->pquery($query, array($focus->id));
|
||||
$from_email = $adb->query_result($result,0,'from_email');
|
||||
$smarty->assign('FROM_MAIL',$from_email);
|
||||
$to_email = implode(',',$json->decode($adb->query_result($result,0,'to_email')));
|
||||
$smarty->assign('TO_MAIL',$to_email);
|
||||
$cc_add = implode(',',$json->decode($adb->query_result($result,0,'cc_email')));
|
||||
$smarty->assign('CC_MAIL',$cc_add);
|
||||
$bcc_add = implode(',',$json->decode($adb->query_result($result,0,'bcc_email')));
|
||||
$smarty->assign('BCC_MAIL',$bcc_add);
|
||||
$idlist = $adb->query_result($result,0,'idlists');
|
||||
$smarty->assign('IDLISTS',$idlist);
|
||||
$log->info("Entity info successfully retrieved for EditView.");
|
||||
$focus->name=$focus->column_fields['name'];
|
||||
}
|
||||
elseif(isset($_REQUEST['sendmail']) && $_REQUEST['sendmail'] !='')
|
||||
{
|
||||
|
||||
$mailids = get_to_emailids($_REQUEST['pmodule']);
|
||||
if($mailids['mailds'] != '')
|
||||
$to_add = trim($mailids['mailds'],",").",";
|
||||
$smarty->assign('TO_MAIL',$to_add);
|
||||
$smarty->assign('IDLISTS',$mailids['idlists']);
|
||||
$focus->mode = '';
|
||||
}
|
||||
|
||||
// INTERNAL MAILER
|
||||
if($_REQUEST["internal_mailer"] == "true") {
|
||||
$smarty->assign('INT_MAILER',"true");
|
||||
$rec_type = $_REQUEST["type"];
|
||||
$rec_id = $_REQUEST["rec_id"];
|
||||
$fieldname = $_REQUEST["fieldname"];
|
||||
|
||||
//added for getting list-ids to compose email popup from list view(Accounts,Contacts,Leads)
|
||||
if(isset($_REQUEST['field_id']) && strlen($_REQUEST['field_id']) != 0) {
|
||||
if($_REQUEST['par_module'] == "Users")
|
||||
$id_list = $_REQUEST['rec_id'].'@'.'-1|';
|
||||
else
|
||||
$id_list = $_REQUEST['rec_id'].'@'.$_REQUEST['field_id'].'|';
|
||||
$smarty->assign("IDLISTS", $id_list);
|
||||
}
|
||||
if($rec_type == "record_id") {
|
||||
$type = $_REQUEST['par_module'];
|
||||
//check added for email link in user detail view
|
||||
$normal_tabs = Array('Users'=>'vtiger_users', 'Leads'=>'vtiger_leaddetails', 'Contacts'=>'vtiger_contactdetails', 'Accounts'=>'vtiger_account', 'Vendors'=>'vtiger_vendor');
|
||||
$cf_tabs = Array('Accounts'=>'vtiger_accountscf', 'Campaigns'=>'vtiger_campaignscf', 'Contacts'=>'vtiger_contactscf', 'Invoice'=>'vtiger_invoicecf', 'Leads'=>'vtiger_leadscf', 'Potentials'=>'vtiger_potentialscf', 'Products'=>'vtiger_productcf', 'PurchaseOrder'=>'vtiger_purchaseordercf', 'Quotes'=>'vtiger_quotescf', 'SalesOrder'=>'vtiger_salesordercf', 'HelpDesk'=>'vtiger_ticketcf', 'Vendors'=>'vtiger_vendorcf');
|
||||
if(substr($fieldname,0,2)=="cf")
|
||||
$tablename = $cf_tabs[$type];
|
||||
else
|
||||
$tablename = $normal_tabs[$type];
|
||||
if($type == "Users")
|
||||
$q = "select $fieldname from $tablename where id=?";
|
||||
elseif($type == "Leads")
|
||||
$q = "select $fieldname from $tablename where leadid=?";
|
||||
elseif ($type == "Contacts")
|
||||
$q = "select $fieldname from $tablename where contactid=?";
|
||||
elseif ($type == "Accounts")
|
||||
$q = "select $fieldname from $tablename where accountid=?";
|
||||
elseif ($type == "Vendors")
|
||||
$q = "select $fieldname from $tablename where vendorid=?";
|
||||
else {
|
||||
// vtlib customization: Support for email-type custom field for other modules.
|
||||
$module_focus = CRMEntity::getInstance($type);
|
||||
vtlib_setup_modulevars($type, $module_focus);
|
||||
if(!empty($module_focus->customFieldTable)) {
|
||||
$q = "select $fieldname from " . $module_focus->customFieldTable[0] . " where " . $module_focus->customFieldTable[1]. "= ?";
|
||||
}
|
||||
// END
|
||||
}
|
||||
$email1 = $adb->query_result($adb->pquery($q, array($rec_id)),0,$fieldname);
|
||||
} elseif ($rec_type == "email_addy") {
|
||||
$email1 = $_REQUEST["email_addy"];
|
||||
}
|
||||
|
||||
$smarty->assign('TO_MAIL',trim($email1,",").",");
|
||||
}
|
||||
|
||||
//handled for replying emails
|
||||
if($_REQUEST['reply'] == "true")
|
||||
{
|
||||
$fromadd = $_REQUEST['record'];
|
||||
$query = "select from_email,idlists,cc_email,bcc_email from vtiger_emaildetails where emailid =?";
|
||||
$result = $adb->pquery($query, array($fromadd));
|
||||
$from_mail = $adb->query_result($result,0,'from_email');
|
||||
$smarty->assign('TO_MAIL',trim($from_mail,",").',');
|
||||
$cc_add = implode(',',$json->decode($adb->query_result($result,0,'cc_email')));
|
||||
$smarty->assign('CC_MAIL',$cc_add);
|
||||
$bcc_add = implode(',',$json->decode($adb->query_result($result,0,'bcc_email')));
|
||||
$smarty->assign('BCC_MAIL',$bcc_add);
|
||||
$smarty->assign('IDLISTS',preg_replace('/###/',',',$adb->query_result($result,0,'idlists')));
|
||||
}
|
||||
|
||||
// Webmails
|
||||
if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != "") {
|
||||
$mailid = $_REQUEST["mailid"];
|
||||
$mailbox = $_REQUEST["mailbox"];
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once("modules/Webmails/Webmails.php");
|
||||
require_once("modules/Webmails/MailParse.php");
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
|
||||
$mailInfo = getMailServerInfo($current_user);
|
||||
$temprow = $adb->fetch_array($mailInfo);
|
||||
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mbox = $MailBox->mbox;
|
||||
|
||||
$webmail = new Webmails($mbox,$mailid);
|
||||
$array_tab = Array();
|
||||
$webmail->loadMail($array_tab);
|
||||
$hdr = @imap_headerinfo($mbox, $mailid);
|
||||
$smarty->assign('WEBMAIL',"true");
|
||||
$smarty->assign('mailid',$mailid);
|
||||
$smarty->assign('mailbox',$mailbox);
|
||||
$temp_id = $MailBox->boxinfo['mail_id'];
|
||||
$smarty->assign('from_add',$temp_id);
|
||||
$webmail->subject = utf8_decode(utf8_encode(imap_utf8($webmail->subject)));
|
||||
if($_REQUEST["reply"] == "all") {
|
||||
$smarty->assign('TO_MAIL',$webmail->from.",");
|
||||
//added to remove the emailid of webmail client from cc list....to fix the issue #3818
|
||||
$cc_address = '';
|
||||
|
||||
$use_to_header = htmlentities($webmail->to_header, ENT_QUOTES, $default_charset);
|
||||
$use_cc_address= htmlentities($hdr->ccaddress, ENT_QUOTES, $default_charset);
|
||||
|
||||
$cc_array = explode(',',$use_to_header.','.$use_cc_address);
|
||||
for($i=0;$i<count($cc_array);$i++) {
|
||||
if(trim($cc_array[$i]) != trim($temp_id)) {
|
||||
$cc_address .= $cc_array[$i];
|
||||
$cc_address = ($i != (count($cc_array)-1))?($cc_address.','):$cc_address;
|
||||
}
|
||||
}
|
||||
if(trim($cc_address) != '')
|
||||
$cc_address = trim($cc_address,",").",";
|
||||
$smarty->assign('CC_MAIL',$cc_address);
|
||||
// fix #3818 ends
|
||||
/*if(is_array($webmail->cc_list))
|
||||
{
|
||||
$smarty->assign('CC_MAIL',implode(",",$webmail->cc_list).",".implode(",",$webmail->to));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Commenting this to fix #3231
|
||||
// $smarty->assign('CC_MAIL',implode(",",$webmail->to));
|
||||
}*/
|
||||
if(preg_match("/RE:/i", $webmail->subject))
|
||||
$smarty->assign('SUBJECT',$webmail->subject);
|
||||
else
|
||||
$smarty->assign('SUBJECT',"RE: ".$webmail->subject);
|
||||
|
||||
} elseif($_REQUEST["reply"] == "single"){
|
||||
$smarty->assign('TO_MAIL',$webmail->reply_to[0].",");
|
||||
//$smarty->assign('BCC_MAIL',$webmail->to[0]);
|
||||
if(preg_match("/RE:/i", $webmail->subject))
|
||||
$smarty->assign('SUBJECT',$webmail->subject);
|
||||
else
|
||||
$smarty->assign('SUBJECT',"RE: ".$webmail->subject);
|
||||
|
||||
} elseif($_REQUEST["forward"] == "true" ) {
|
||||
//added for attachment handling
|
||||
$attachment_links = Array();
|
||||
for($i=0;$i<count($webmail->attname);$i++){
|
||||
$attachment_links[$i] = $webmail->anchor_arr[$i].decode_header($webmail->attname[$i])."</a></br>";
|
||||
}
|
||||
$smarty->assign('webmail_attachments',$attachment_links);
|
||||
if(preg_match("/FW:/i", $webmail->subject))
|
||||
$smarty->assign('SUBJECT',$webmail->subject);
|
||||
else
|
||||
$smarty->assign('SUBJECT',"FW: ".$webmail->subject);
|
||||
}
|
||||
$smarty->assign('DESCRIPTION',$webmail->replyBody());
|
||||
$focus->mode='';
|
||||
}
|
||||
|
||||
global $theme;
|
||||
$theme_path="themes/".$theme."/";
|
||||
$image_path=$theme_path."images/";
|
||||
|
||||
$disp_view = getView($focus->mode);
|
||||
$details = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields);
|
||||
//changed this below line to view description in all language - bharath
|
||||
$smarty->assign("BLOCKS",$details[$mod_strings['LBL_EMAIL_INFORMATION']]);
|
||||
$smarty->assign("MODULE",$currentModule);
|
||||
$smarty->assign("SINGLE_MOD",$app_strings['Email']);
|
||||
//id list of attachments while forwarding
|
||||
$smarty->assign("ATT_ID_LIST",$att_id_list);
|
||||
|
||||
//needed when creating a new email with default values passed in
|
||||
if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name))
|
||||
{
|
||||
$focus->contact_name = $_REQUEST['contact_name'];
|
||||
}
|
||||
if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id))
|
||||
{
|
||||
$focus->contact_id = $_REQUEST['contact_id'];
|
||||
}
|
||||
if (isset($_REQUEST['parent_name']) && is_null($focus->parent_name))
|
||||
{
|
||||
$focus->parent_name = $_REQUEST['parent_name'];
|
||||
}
|
||||
if (isset($_REQUEST['parent_id']) && is_null($focus->parent_id))
|
||||
{
|
||||
$focus->parent_id = $_REQUEST['parent_id'];
|
||||
}
|
||||
if (isset($_REQUEST['parent_type']))
|
||||
{
|
||||
$focus->parent_type = $_REQUEST['parent_type'];
|
||||
}
|
||||
if (isset($_REQUEST['filename']) && $_REQUEST['isDuplicate'] != 'true')
|
||||
{
|
||||
$focus->filename = $_REQUEST['filename'];
|
||||
}
|
||||
elseif (is_null($focus->parent_type))
|
||||
{
|
||||
$focus->parent_type = $app_list_strings['record_type_default_key'];
|
||||
}
|
||||
|
||||
$log->info("Email detail view");
|
||||
|
||||
$smarty->assign("MOD", $mod_strings);
|
||||
$smarty->assign("APP", $app_strings);
|
||||
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
|
||||
else $smarty->assign("NAME", "");
|
||||
|
||||
|
||||
if($focus->mode == 'edit')
|
||||
{
|
||||
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
|
||||
$smarty->assign("MODE", $focus->mode);
|
||||
}
|
||||
|
||||
// Unimplemented until jscalendar language vtiger_files are fixed
|
||||
|
||||
$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
|
||||
$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
|
||||
|
||||
if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
|
||||
else $smarty->assign("RETURN_MODULE",'Emails');
|
||||
if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
|
||||
else $smarty->assign("RETURN_ACTION",'index');
|
||||
if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
|
||||
if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname']));
|
||||
|
||||
$smarty->assign("THEME", $theme);
|
||||
$smarty->assign("IMAGE_PATH", $image_path);
|
||||
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
|
||||
$smarty->assign("ID", $focus->id);
|
||||
$smarty->assign("ENTITY_ID", vtlib_purify($_REQUEST["record"]));
|
||||
$smarty->assign("ENTITY_TYPE",vtlib_purify($_REQUEST["email_directing_module"]));
|
||||
$smarty->assign("OLD_ID", $old_id );
|
||||
//Display the RTE or not? -- configure $USE_RTE in config.php
|
||||
$USE_RTE = vt_hasRTE();
|
||||
$smarty->assign("USE_RTE",$USE_RTE);
|
||||
|
||||
if(empty($focus->filename))
|
||||
{
|
||||
$smarty->assign("FILENAME_TEXT", "");
|
||||
$smarty->assign("FILENAME", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
$smarty->assign("FILENAME_TEXT", "(".$focus->filename.")");
|
||||
$smarty->assign("FILENAME", $focus->filename);
|
||||
}
|
||||
if($ret_error == 1) {
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
$smarty->assign("RET_ERROR",$ret_error);
|
||||
if($ret_parentid != ''){
|
||||
$smarty->assign("IDLISTS",$ret_parentid);
|
||||
}
|
||||
if($ret_toadd != '')
|
||||
$smarty->assign("TO_MAIL",$ret_toadd);
|
||||
$ret_toadd = '';
|
||||
if($ret_subject != '')
|
||||
$smarty->assign("SUBJECT",$ret_subject);
|
||||
if($ret_ccaddress != '')
|
||||
$smarty->assign("CC_MAIL",$ret_ccaddress);
|
||||
if($ret_bccaddress != '')
|
||||
$smarty->assign("BCC_MAIL",$ret_bccaddress);
|
||||
if($ret_description != '')
|
||||
$smarty->assign("DESCRIPTION", $ret_description);
|
||||
$temp_obj = new MailBox($mailbox);
|
||||
$temp_id = $temp_obj->boxinfo['mail_id'];
|
||||
if($temp_id != '')
|
||||
$smarty->assign('from_add',$temp_id);
|
||||
}
|
||||
$check_button = Button_Check($module);
|
||||
$smarty->assign("CHECK", $check_button);
|
||||
|
||||
$smarty->display("ComposeEmail.tpl");
|
||||
|
||||
?>
|
||||
@@ -1,196 +0,0 @@
|
||||
/*********************************************************************************
|
||||
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
var gFolderid = 1;
|
||||
var gselectedrowid = 0;
|
||||
function gotoWebmail()
|
||||
{
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: "module=Webmails&action=WebmailsAjax&config_chk=true",
|
||||
onComplete: function(response) {
|
||||
if(response.responseText.indexOf('SUCCESS') > -1)
|
||||
window.location.href = "index.php?module=Webmails&action=index&parenttab=My Home Page";
|
||||
else
|
||||
$('mailconfchk').style.display = 'block';
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function getEmailContents(id)
|
||||
{
|
||||
$("status").style.display="inline";
|
||||
var rowid = 'row_'+id;
|
||||
getObj(rowid).className = 'emailSelected';
|
||||
if(gselectedrowid != 0 && gselectedrowid != id)
|
||||
{
|
||||
var prev_selected_rowid = 'row_'+gselectedrowid;
|
||||
getObj(prev_selected_rowid).className = 'prvPrfHoverOff';
|
||||
}
|
||||
gselectedrowid = id;
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: 'module=Emails&action=EmailsAjax&file=DetailView&mode=ajax&record='+id,
|
||||
onComplete: function(response) {
|
||||
$("status").style.display="none";
|
||||
$("EmailDetails").innerHTML = response.responseText;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getListViewEntries_js(module,url)
|
||||
{
|
||||
$("status").style.display="inline";
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: "module="+module+"&action="+module+"Ajax&file=ListView&ajax=true&"+url,
|
||||
onComplete: function(response) {
|
||||
$("status").style.display="none";
|
||||
$("email_con").innerHTML=response.responseText;
|
||||
execJS(document.getElementById('email_con'));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function massDelete()
|
||||
{
|
||||
var delete_selected_row = false;
|
||||
//added to fix the issue 4295
|
||||
var select_options = document.getElementsByName('selected_id');
|
||||
var x = select_options.length;
|
||||
|
||||
idstring = "";
|
||||
xx = 0;
|
||||
for(i = 0; i < x ; i++)
|
||||
{
|
||||
if(select_options[i].checked)
|
||||
{
|
||||
idstring = select_options[i].value +";"+idstring
|
||||
if(select_options[i].value == gselectedrowid)
|
||||
{
|
||||
gselectedrowid = 0;
|
||||
delete_selected_row = true;
|
||||
}
|
||||
xx++
|
||||
}
|
||||
}
|
||||
if (xx > 0)
|
||||
{
|
||||
document.massdelete.idlist.value=idstring;
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(alert_arr.SELECT);
|
||||
return false;
|
||||
}
|
||||
if(confirm(alert_arr.DELETE + xx + alert_arr.RECORDS))
|
||||
{
|
||||
getObj('search_text').value = '';
|
||||
show("status");
|
||||
if(!delete_selected_row)
|
||||
{
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: "module=Users&action=massdelete&folderid="+gFolderid+"&return_module=Emails&idlist="+idstring,
|
||||
onComplete: function(response) {
|
||||
$("status").style.display="none";
|
||||
$("email_con").innerHTML=response.responseText;
|
||||
execJS(document.getElementById('email_con'));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: "module=Users&action=massdelete&folderid="+gFolderid+"&return_module=Emails&idlist="+idstring,
|
||||
onComplete: function(response) {
|
||||
$("status").style.display="none";
|
||||
$("email_con").innerHTML=response.responseText;
|
||||
execJS($('email_con'));
|
||||
$('EmailDetails').innerHTML = '<table valign="top" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="forwardBg"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td colspan="2"> </td></tr></tbody></table></td></tr><tr><td style="padding-top: 10px;" bgcolor="#ffffff" height="300" valign="top"></td></tr></tbody></table>';
|
||||
$("subjectsetter").innerHTML='';
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteEmail(id)
|
||||
{
|
||||
if(confirm(alert_arr.SURE_TO_DELETE))
|
||||
{
|
||||
getObj('search_text').value = '';
|
||||
gselectedrowid = 0;
|
||||
$("status").style.display="inline";
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: "module=Users&action=massdelete&return_module=Emails&folderid="+gFolderid+"&idlist="+id,
|
||||
onComplete: function(response) {
|
||||
$("status").style.display="none";
|
||||
$("email_con").innerHTML=response.responseText;
|
||||
execJS($('email_con'));
|
||||
$('EmailDetails').innerHTML = '<table valign="top" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="forwardBg"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td colspan="2"> </td></tr></tbody></table></td></tr><tr><td style="padding-top: 10px;" bgcolor="#ffffff" height="300" valign="top"></td></tr></tbody></table>';
|
||||
$("subjectsetter").innerHTML='';
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function Searchfn()
|
||||
{
|
||||
gselectedrowid = 0;
|
||||
var osearch_field = document.getElementById('search_field');
|
||||
var search_field = osearch_field.options[osearch_field.options.selectedIndex].value;
|
||||
var search_text = document.getElementById('search_text').value;
|
||||
new Ajax.Request(
|
||||
'index.php',
|
||||
{queue: {position: 'end', scope: 'command'},
|
||||
method: 'post',
|
||||
postBody: "module=Emails&action=EmailsAjax&ajax=true&file=ListView&folderid="+gFolderid+"&search=true&search_field="+search_field+"&search_text="+search_text,
|
||||
onComplete: function(response) {
|
||||
$("email_con").innerHTML=response.responseText;
|
||||
$("status").style.display="none";
|
||||
$('EmailDetails').innerHTML = '<table valign="top" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="forwardBg"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td colspan="2"> </td></tr></tbody></table></td></tr><tr><td style="padding-top: 10px;" bgcolor="#ffffff" height="300" valign="top"></td></tr></tbody></table>';
|
||||
$("subjectsetter").innerHTML='';
|
||||
execJS($('email_con'));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,688 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/Emails.php,v 1.41 2005/04/28 08:11:21 rank Exp $
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
include_once('config.php');
|
||||
require_once('include/logging.php');
|
||||
require_once('include/database/PearDatabase.php');
|
||||
require_once('data/SugarBean.php');
|
||||
require_once('data/CRMEntity.php');
|
||||
require_once('modules/Contacts/Contacts.php');
|
||||
require_once('modules/Accounts/Accounts.php');
|
||||
require_once('modules/Potentials/Potentials.php');
|
||||
require_once('modules/Users/Users.php');
|
||||
|
||||
// Email is used to store customer information.
|
||||
class Emails extends CRMEntity {
|
||||
var $log;
|
||||
var $db;
|
||||
var $table_name = "vtiger_activity";
|
||||
var $table_index= 'activityid';
|
||||
// Stored vtiger_fields
|
||||
// added to check email save from plugin or not
|
||||
var $plugin_save = false;
|
||||
|
||||
var $rel_users_table = "vtiger_salesmanactivityrel";
|
||||
var $rel_contacts_table = "vtiger_cntactivityrel";
|
||||
var $rel_serel_table = "vtiger_seactivityrel";
|
||||
|
||||
|
||||
|
||||
var $tab_name = Array('vtiger_crmentity','vtiger_activity','vtiger_emaildetails');
|
||||
var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_activity'=>'activityid',
|
||||
'vtiger_seactivityrel'=>'activityid','vtiger_cntactivityrel'=>'activityid','vtiger_email_track'=>'mailid','vtiger_emaildetails'=>'emailid');
|
||||
|
||||
// This is the list of vtiger_fields that are in the lists.
|
||||
var $list_fields = Array(
|
||||
'Subject'=>Array('activity'=>'subject'),
|
||||
'Related to'=>Array('seactivityrel'=>'parent_id'),
|
||||
'Date Sent'=>Array('activity'=>'date_start'),
|
||||
'Assigned To'=>Array('crmentity','smownerid'),
|
||||
'Access Count'=>Array('email_track','access_count')
|
||||
);
|
||||
|
||||
var $list_fields_name = Array(
|
||||
'Subject'=>'subject',
|
||||
'Related to'=>'parent_id',
|
||||
'Date Sent'=>'date_start',
|
||||
'Assigned To'=>'assigned_user_id',
|
||||
'Access Count'=>'access_count'
|
||||
);
|
||||
|
||||
var $list_link_field= 'subject';
|
||||
|
||||
var $column_fields = Array();
|
||||
|
||||
var $sortby_fields = Array('subject','date_start','saved_toid');
|
||||
|
||||
//Added these variables which are used as default order by and sortorder in ListView
|
||||
var $default_order_by = 'date_start';
|
||||
var $default_sort_order = 'ASC';
|
||||
|
||||
// Used when enabling/disabling the mandatory fields for the module.
|
||||
// Refers to vtiger_field.fieldname values.
|
||||
var $mandatory_fields = Array('subject','assigned_user_id');
|
||||
|
||||
/** This function will set the columnfields for Email module
|
||||
*/
|
||||
|
||||
function Emails() {
|
||||
$this->log = LoggerManager::getLogger('email');
|
||||
$this->log->debug("Entering Emails() method ...");
|
||||
$this->log = LoggerManager::getLogger('email');
|
||||
$this->db = PearDatabase::getInstance();
|
||||
$this->column_fields = getColumnFields('Emails');
|
||||
$this->log->debug("Exiting Email method ...");
|
||||
}
|
||||
|
||||
|
||||
function save_module($module)
|
||||
{
|
||||
global $adb;
|
||||
//Inserting into seactivityrel
|
||||
|
||||
//modified by Richie as raju's implementation broke the feature for addition of webmail to vtiger_crmentity.need to be more careful in future while integrating code
|
||||
if($_REQUEST['module']=="Emails" && $_REQUEST['smodule']!='webmails' && (!$this->plugin_save))
|
||||
{
|
||||
if($_REQUEST['currentid']!='')
|
||||
{
|
||||
$actid=$_REQUEST['currentid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$actid=$_REQUEST['record'];
|
||||
}
|
||||
$parentid=$_REQUEST['parent_id'];
|
||||
if($_REQUEST['module'] != 'Emails' && $_REQUEST['module'] != 'Webmails')
|
||||
{
|
||||
if(!$parentid) {
|
||||
$parentid = $adb->getUniqueID('vtiger_seactivityrel');
|
||||
}
|
||||
$mysql='insert into vtiger_seactivityrel values(?,?)';
|
||||
$adb->pquery($mysql, array($parentid, $actid));
|
||||
}
|
||||
else
|
||||
{
|
||||
$myids=explode("|",$parentid); //2@71|
|
||||
for ($i=0;$i<(count($myids)-1);$i++)
|
||||
{
|
||||
$realid=explode("@",$myids[$i]);
|
||||
$mycrmid=$realid[0];
|
||||
//added to handle the relationship of emails with vtiger_users
|
||||
if($realid[1] == -1)
|
||||
{
|
||||
$del_q = 'delete from vtiger_salesmanactivityrel where smid=? and activityid=?';
|
||||
$adb->pquery($del_q,array($mycrmid, $actid));
|
||||
$mysql='insert into vtiger_salesmanactivityrel values(?,?)';
|
||||
}
|
||||
else
|
||||
{
|
||||
$del_q = 'delete from vtiger_seactivityrel where crmid=? and activityid=?';
|
||||
$adb->pquery($del_q,array($mycrmid, $actid));
|
||||
$mysql='insert into vtiger_seactivityrel values(?,?)';
|
||||
}
|
||||
$params = array($mycrmid, $actid);
|
||||
$adb->pquery($mysql, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '')
|
||||
{
|
||||
//$this->insertIntoEntityTable('vtiger_seactivityrel', $module);
|
||||
$sql = 'insert into vtiger_seactivityrel values(?,?)';
|
||||
$params = array($this->column_fields['parent_id'],$_REQUEST['currentid']);
|
||||
$adb->pquery($sql,$params);
|
||||
}
|
||||
elseif($this->column_fields['parent_id']=='' && $insertion_mode=="edit")
|
||||
{
|
||||
$this->deleteRelation('vtiger_seactivityrel');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Insert into cntactivity rel
|
||||
|
||||
if(isset($this->column_fields['contact_id']) && $this->column_fields['contact_id'] != '')
|
||||
{
|
||||
$this->insertIntoEntityTable('vtiger_cntactivityrel', $module);
|
||||
}
|
||||
elseif($this->column_fields['contact_id'] =='' && $insertion_mode=="edit")
|
||||
{
|
||||
$this->deleteRelation('vtiger_cntactivityrel');
|
||||
}
|
||||
|
||||
//Inserting into attachment
|
||||
|
||||
$this->insertIntoAttachment($this->id,$module);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function insertIntoAttachment($id,$module)
|
||||
{
|
||||
global $log, $adb;
|
||||
$log->debug("Entering into insertIntoAttachment($id,$module) method.");
|
||||
|
||||
$file_saved = false;
|
||||
|
||||
//Added to send generated Invoice PDF with mail
|
||||
$pdfAttached = $_REQUEST['pdf_attachment'];
|
||||
//created Invoice pdf is attached with the mail
|
||||
if(isset($_REQUEST['pdf_attachment']) && $_REQUEST['pdf_attachment'] !='')
|
||||
{
|
||||
$file_saved = pdfAttach($this,$module,$pdfAttached,$id);
|
||||
}
|
||||
|
||||
//This is to added to store the existing attachment id of the contact where we should delete this when we give new image
|
||||
foreach($_FILES as $fileindex => $files)
|
||||
{
|
||||
if($files['name'] != '' && $files['size'] > 0)
|
||||
{
|
||||
$files['original_name'] = vtlib_purify($_REQUEST[$fileindex.'_hidden']);
|
||||
$file_saved = $this->uploadAndSaveFile($id,$module,$files);
|
||||
}
|
||||
}
|
||||
if($module == 'Emails' && isset($_REQUEST['att_id_list']) && $_REQUEST['att_id_list'] != '')
|
||||
{
|
||||
$att_lists = explode(";",$_REQUEST['att_id_list'],-1);
|
||||
$id_cnt = count($att_lists);
|
||||
if($id_cnt != 0)
|
||||
{
|
||||
for($i=0;$i<$id_cnt;$i++)
|
||||
{
|
||||
$sql_rel='insert into vtiger_seattachmentsrel values(?,?)';
|
||||
$adb->pquery($sql_rel, array($id, $att_lists[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if($_REQUEST['att_module'] == 'Webmails')
|
||||
{
|
||||
require_once("modules/Webmails/Webmails.php");
|
||||
require_once("modules/Webmails/MailParse.php");
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
//$mailInfo = getMailServerInfo($current_user);
|
||||
//$temprow = $adb->fetch_array($mailInfo);
|
||||
|
||||
$MailBox = new MailBox($_REQUEST["mailbox"]);
|
||||
$mbox = $MailBox->mbox;
|
||||
$webmail = new Webmails($mbox,$_REQUEST['mailid']);
|
||||
$array_tab = Array();
|
||||
$webmail->loadMail($array_tab);
|
||||
if(isset($webmail->att_details)){
|
||||
foreach($webmail->att_details as $fileindex => $files)
|
||||
{
|
||||
if($files['name'] != '' && $files['size'] > 0)
|
||||
{
|
||||
//print_r($files);
|
||||
$file_saved = $this->saveForwardAttachments($id,$module,$files);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$log->debug("Exiting from insertIntoAttachment($id,$module) method.");
|
||||
}
|
||||
|
||||
function saveForwardAttachments($id,$module,$file_details)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering into saveForwardAttachments($id,$module,$file_details) method.");
|
||||
global $adb, $current_user;
|
||||
global $upload_badext;
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
$mailbox=$_REQUEST["mailbox"];
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mail = $MailBox->mbox;
|
||||
$binFile = sanitizeUploadFileName($file_details['name'], $upload_badext);
|
||||
$filename = ltrim(basename(" ".$binFile)); //allowed filename like UTF-8 characters
|
||||
$filetype= $file_details['type'];
|
||||
$filesize = $file_details['size'];
|
||||
$filepart = $file_details['part'];
|
||||
$transfer = $file_details['transfer'];
|
||||
$file = imap_fetchbody($mail,$_REQUEST['mailid'],$filepart);
|
||||
if ($transfer == 'BASE64')
|
||||
$file = imap_base64($file);
|
||||
elseif($transfer == 'QUOTED-PRINTABLE')
|
||||
$file = imap_qprint($file);
|
||||
$current_id = $adb->getUniqueID("vtiger_crmentity");
|
||||
$date_var = date('Y-m-d H:i:s');
|
||||
//to get the owner id
|
||||
$ownerid = $this->column_fields['assigned_user_id'];
|
||||
if(!isset($ownerid) || $ownerid=='')
|
||||
$ownerid = $current_user->id;
|
||||
$upload_file_path = decideFilePath();
|
||||
file_put_contents ($upload_file_path.$current_id."_".$filename,$file);
|
||||
|
||||
$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)";
|
||||
$params1 = array($current_id, $current_user->id, $ownerid, $module." Attachment", $this->column_fields['description'], $adb->formatDate($date_var, true), $adb->formatDate($date_var, true));
|
||||
$adb->pquery($sql1, $params1);
|
||||
|
||||
$sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?,?,?,?,?)";
|
||||
$params2 = array($current_id, $filename, $this->column_fields['description'], $filetype, $upload_file_path);
|
||||
$result=$adb->pquery($sql2, $params2);
|
||||
|
||||
if($_REQUEST['mode'] == 'edit')
|
||||
{
|
||||
if($id != '' && $_REQUEST['fileid'] != '')
|
||||
{
|
||||
$delquery = 'delete from vtiger_seattachmentsrel where crmid = ? and attachmentsid = ?';
|
||||
$adb->pquery($delquery, array($id, $_REQUEST['fileid']));
|
||||
}
|
||||
}
|
||||
$sql3='insert into vtiger_seattachmentsrel values(?,?)';
|
||||
$adb->pquery($sql3, array($id, $current_id));
|
||||
return true;
|
||||
$log->debug("exiting from saveforwardattachment function.");
|
||||
}
|
||||
/** Returns a list of the associated contacts
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function get_contacts($id, $cur_tab_id, $rel_tab_id, $actions=false) {
|
||||
global $log, $singlepane_view,$currentModule,$current_user;
|
||||
$log->debug("Entering get_contacts(".$id.") method ...");
|
||||
$this_module = $currentModule;
|
||||
|
||||
$related_module = vtlib_getModuleNameById($rel_tab_id);
|
||||
require_once("modules/$related_module/$related_module.php");
|
||||
$other = new $related_module();
|
||||
vtlib_setup_modulevars($related_module, $other);
|
||||
$singular_modname = vtlib_toSingular($related_module);
|
||||
|
||||
$parenttab = getParentTab();
|
||||
|
||||
$returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
|
||||
|
||||
$button = '';
|
||||
|
||||
if($actions) {
|
||||
if(is_string($actions)) $actions = explode(',', strtoupper($actions));
|
||||
if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
|
||||
$button .= "<input title='".getTranslatedString('LBL_SELECT')." ". getTranslatedString($related_module). "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id&parenttab=$parenttab','test','width=640,height=602,resizable=0,scrollbars=0');\" value='". getTranslatedString('LBL_SELECT'). " " . getTranslatedString($related_module) ."'> ";
|
||||
}
|
||||
if(in_array('BULKMAIL', $actions) && isPermitted($related_module,1, '') == 'yes') {
|
||||
$button .= "<input title='".getTranslatedString('LBL_BULK_MAILS')."' class='crmbutton small create'" .
|
||||
" onclick='this.form.action.value=\"sendmail\";this.form.module.value=\"$this_module\"' type='submit' name='button'" .
|
||||
" value='". getTranslatedString('LBL_BULK_MAILS')."'>";
|
||||
}
|
||||
}
|
||||
|
||||
$query = 'select vtiger_contactdetails.accountid, vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_contactdetails.department, vtiger_contactdetails.title, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_contactdetails.emailoptout, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_contactdetails inner join vtiger_cntactivityrel on vtiger_cntactivityrel.contactid=vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid where vtiger_cntactivityrel.activityid='.$adb->quote($id).' and vtiger_crmentity.deleted=0';
|
||||
|
||||
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
|
||||
|
||||
if($return_value == null) $return_value = Array();
|
||||
$return_value['CUSTOM_BUTTON'] = $button;
|
||||
|
||||
$log->debug("Exiting get_contacts method ...");
|
||||
return $return_value;
|
||||
}
|
||||
|
||||
/** Returns the column name that needs to be sorted
|
||||
* Portions created by vtigerCRM are Copyright (C) vtigerCRM.
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): Mike Crowe
|
||||
*/
|
||||
|
||||
function getSortOrder()
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering getSortOrder() method ...");
|
||||
if(isset($_REQUEST['sorder']))
|
||||
$sorder = $this->db->sql_escape_string($_REQUEST['sorder']);
|
||||
else
|
||||
$sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '')?($_SESSION['EMAILS_SORT_ORDER']):($this->default_sort_order));
|
||||
|
||||
$log->debug("Exiting getSortOrder method ...");
|
||||
return $sorder;
|
||||
}
|
||||
|
||||
/** Returns the order in which the records need to be sorted
|
||||
* Portions created by vtigerCRM are Copyright (C) vtigerCRM.
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): Mike Crowe
|
||||
*/
|
||||
|
||||
function getOrderBy()
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering getOrderBy() method ...");
|
||||
|
||||
$use_default_order_by = '';
|
||||
if(PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
|
||||
$use_default_order_by = $this->default_order_by;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['order_by']))
|
||||
$order_by = $this->db->sql_escape_string($_REQUEST['order_by']);
|
||||
else
|
||||
$order_by = (($_SESSION['EMAILS_ORDER_BY'] != '')?($_SESSION['EMAILS_ORDER_BY']):($use_default_order_by));
|
||||
|
||||
$log->debug("Exiting getOrderBy method ...");
|
||||
return $order_by;
|
||||
}
|
||||
// Mike Crowe Mod --------------------------------------------------------
|
||||
|
||||
/** Returns a list of the associated vtiger_users
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function get_users($id)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering get_users(".$id.") method ...");
|
||||
global $adb;
|
||||
global $mod_strings;
|
||||
global $app_strings;
|
||||
|
||||
$id = $_REQUEST['record'];
|
||||
|
||||
$button = '<input title="'.getTranslatedString('LBL_BULK_MAILS').'" accessykey="F" class="crmbutton small create"
|
||||
onclick="this.form.action.value=\"sendmail\";this.form.return_action.value=\"DetailView\";this.form.module.value=\"Emails\";this.form.return_module.value=\"Emails\";"
|
||||
name="button" value="'.getTranslatedString('LBL_BULK_MAILS').'" type="submit">
|
||||
<input title="'.getTranslatedString('LBL_BULK_MAILS').'" accesskey="" tabindex="2" class="crmbutton small edit"
|
||||
value="'.getTranslatedString('LBL_SELECT_USER_BUTTON_LABEL').'" name="Button" language="javascript"
|
||||
onclick=\"return window.open("index.php?module=Users&return_module=Emails&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=true&return_id='.$id.'&recordid='.$id.'","test","width=640,height=520,resizable=0,scrollbars=0");\"
|
||||
type="button">';
|
||||
|
||||
$query = 'SELECT vtiger_users.id, vtiger_users.first_name,vtiger_users.last_name, vtiger_users.user_name, vtiger_users.email1, vtiger_users.email2, vtiger_users.yahoo_id, vtiger_users.phone_home, vtiger_users.phone_work, vtiger_users.phone_mobile, vtiger_users.phone_other, vtiger_users.phone_fax from vtiger_users inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.smid=vtiger_users.id and vtiger_salesmanactivityrel.activityid=?';
|
||||
$result=$adb->pquery($query, array($id));
|
||||
|
||||
$noofrows = $adb->num_rows($result);
|
||||
$header [] = $app_strings['LBL_LIST_NAME'];
|
||||
|
||||
$header []= $app_strings['LBL_LIST_USER_NAME'];
|
||||
|
||||
$header []= $app_strings['LBL_EMAIL'];
|
||||
|
||||
$header []= $app_strings['LBL_PHONE'];
|
||||
while($row = $adb->fetch_array($result))
|
||||
{
|
||||
|
||||
global $current_user;
|
||||
|
||||
$entries = Array();
|
||||
|
||||
if(is_admin($current_user))
|
||||
{
|
||||
$entries[] = $row['last_name'].' '.$row['first_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$entries[] = $row['last_name'].' '.$row['first_name'];
|
||||
}
|
||||
|
||||
$entries[] = $row['user_name'];
|
||||
$entries[] = $row['email1'];
|
||||
if($email == '') $email = $row['email2'];
|
||||
if($email == '') $email = $row['yahoo_id'];
|
||||
|
||||
$entries[] = $row['phone_home'];
|
||||
if($phone == '') $phone = $row['phone_work'];
|
||||
if($phone == '') $phone = $row['phone_mobile'];
|
||||
if($phone == '') $phone = $row['phone_other'];
|
||||
if($phone == '') $phone = $row['phone_fax'];
|
||||
|
||||
//Adding Security Check for User
|
||||
|
||||
$entries_list[] = $entries;
|
||||
}
|
||||
|
||||
if($entries_list != '')
|
||||
$return_data = array("header"=>$header, "entries"=>$entries);
|
||||
|
||||
if($return_data == null) $return_data = Array();
|
||||
$return_data['CUSTOM_BUTTON'] = $button;
|
||||
|
||||
$log->debug("Exiting get_users method ...");
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of the Emails to be exported
|
||||
*/
|
||||
function create_export_query(&$order_by, &$where)
|
||||
{
|
||||
global $log;
|
||||
global $current_user;
|
||||
$log->debug("Entering create_export_query(".$order_by.",".$where.") method ...");
|
||||
|
||||
include("include/utils/ExportUtils.php");
|
||||
|
||||
//To get the Permitted fields query and the permitted fields list
|
||||
$sql = getPermittedFieldsQuery("Emails", "detail_view");
|
||||
$fields_list = getFieldsListFromQuery($sql);
|
||||
|
||||
$query = "SELECT $fields_list FROM vtiger_activity
|
||||
INNER JOIN vtiger_crmentity
|
||||
ON vtiger_crmentity.crmid=vtiger_activity.activityid
|
||||
LEFT JOIN vtiger_users
|
||||
ON vtiger_users.id = vtiger_crmentity.smownerid
|
||||
LEFT JOIN vtiger_seactivityrel
|
||||
ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
|
||||
LEFT JOIN vtiger_contactdetails
|
||||
ON vtiger_contactdetails.contactid = vtiger_seactivityrel.crmid
|
||||
LEFT JOIN vtiger_cntactivityrel
|
||||
ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid
|
||||
AND vtiger_cntactivityrel.contactid = vtiger_cntactivityrel.contactid
|
||||
LEFT JOIN vtiger_groups
|
||||
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
|
||||
LEFT JOIN vtiger_salesmanactivityrel
|
||||
ON vtiger_salesmanactivityrel.activityid = vtiger_activity.activityid
|
||||
LEFT JOIN vtiger_emaildetails
|
||||
ON vtiger_emaildetails.emailid = vtiger_activity.activityid
|
||||
LEFT JOIN vtiger_seattachmentsrel
|
||||
ON vtiger_activity.activityid=vtiger_seattachmentsrel.crmid
|
||||
LEFT JOIN vtiger_attachments
|
||||
ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid";
|
||||
$query .= getNonAdminAccessControlQuery('Emails',$current_user);
|
||||
$query .= "WHERE vtiger_activity.activitytype='Emails' AND vtiger_crmentity.deleted=0 ";
|
||||
|
||||
$log->debug("Exiting create_export_query method ...");
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to releate email and contacts -- Outlook Plugin
|
||||
*/
|
||||
function set_emails_contact_invitee_relationship($email_id, $contact_id)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering set_emails_contact_invitee_relationship(".$email_id.",". $contact_id.") method ...");
|
||||
$query = "insert into $this->rel_contacts_table (contactid,activityid) values(?,?)";
|
||||
$this->db->pquery($query, array($contact_id, $email_id), true,"Error setting email to contact relationship: "."<BR>$query");
|
||||
$log->debug("Exiting set_emails_contact_invitee_relationship method ...");
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to releate email and salesentity -- Outlook Plugin
|
||||
*/
|
||||
function set_emails_se_invitee_relationship($email_id, $contact_id)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering set_emails_se_invitee_relationship(".$email_id.",". $contact_id.") method ...");
|
||||
$query = "insert into $this->rel_serel_table (crmid,activityid) values(?,?)";
|
||||
$this->db->pquery($query, array($contact_id, $email_id), true,"Error setting email to contact relationship: "."<BR>$query");
|
||||
$log->debug("Exiting set_emails_se_invitee_relationship method ...");
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to releate email and Users -- Outlook Plugin
|
||||
*/
|
||||
function set_emails_user_invitee_relationship($email_id, $user_id)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering set_emails_user_invitee_relationship(".$email_id.",". $user_id.") method ...");
|
||||
$query = "insert into $this->rel_users_table (smid,activityid) values (?,?)";
|
||||
$this->db->pquery($query, array($user_id, $email_id), true,"Error setting email to user relationship: "."<BR>$query");
|
||||
$log->debug("Exiting set_emails_user_invitee_relationship method ...");
|
||||
}
|
||||
|
||||
// Function to unlink an entity with given Id from another entity
|
||||
function unlinkRelationship($id, $return_module, $return_id) {
|
||||
global $log;
|
||||
|
||||
$sql='DELETE FROM vtiger_seactivityrel WHERE activityid=?';
|
||||
$this->db->pquery($sql, array($id));
|
||||
|
||||
$sql = 'DELETE FROM vtiger_crmentityrel WHERE (crmid=? AND relmodule=? AND relcrmid=?) OR (relcrmid=? AND module=? AND crmid=?)';
|
||||
$params = array($id, $return_module, $return_id, $id, $return_module, $return_id);
|
||||
$this->db->pquery($sql, $params);
|
||||
}
|
||||
|
||||
public function getNonAdminAccessControlQuery($module, $user,$scope='') {
|
||||
return " and vtiger_crmentity$scope.smownerid=$user->id ";
|
||||
}
|
||||
}
|
||||
/** 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;
|
||||
if(isset($_REQUEST["field_lists"]) && $_REQUEST["field_lists"] != "")
|
||||
{
|
||||
$field_lists = $_REQUEST["field_lists"];
|
||||
if (is_string($field_lists)) $field_lists = explode(":", $field_lists);
|
||||
$query = 'select columnname,fieldid from vtiger_field where fieldid in ('. generateQuestionMarks($field_lists) .') and vtiger_field.presence in (0,2)';
|
||||
$result = $adb->pquery($query, array($field_lists));
|
||||
$columns = Array();
|
||||
$idlists = '';
|
||||
$mailids = '';
|
||||
while($row = $adb->fetch_array($result))
|
||||
{
|
||||
$columns[]=$row['columnname'];
|
||||
$fieldid[]=$row['fieldid'];
|
||||
}
|
||||
$columnlists = implode(',',$columns);
|
||||
$idstring = $_REQUEST["idlist"];
|
||||
$single_record = false;
|
||||
if(!strpos($idstring,':'))
|
||||
{
|
||||
$single_record = true;
|
||||
}
|
||||
$crmids = preg_replace('/:/',',',$idstring);
|
||||
$crmids = explode(",", $crmids);
|
||||
switch($module)
|
||||
{
|
||||
case 'Leads':
|
||||
$query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_crmentity.deleted=0 and ((ltrim(vtiger_leaddetails.email) != \'\') or (ltrim(vtiger_leaddetails.yahooid) != \'\')) and vtiger_crmentity.crmid in ('. generateQuestionMarks($crmids) .')';
|
||||
break;
|
||||
case 'Contacts':
|
||||
//email opt out funtionality works only when we do mass mailing.
|
||||
if(!$single_record)
|
||||
$concat_qry = '(((ltrim(vtiger_contactdetails.email) != \'\') or (ltrim(vtiger_contactdetails.yahooid) != \'\')) and (vtiger_contactdetails.emailoptout != 1)) and ';
|
||||
else
|
||||
$concat_qry = '((ltrim(vtiger_contactdetails.email) != \'\') or (ltrim(vtiger_contactdetails.yahooid) != \'\')) and ';
|
||||
$query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and '.$concat_qry.' vtiger_crmentity.crmid in ('. generateQuestionMarks($crmids) .')';
|
||||
break;
|
||||
case 'Accounts':
|
||||
//added to work out email opt out functionality.
|
||||
if(!$single_record)
|
||||
$concat_qry = '(((ltrim(vtiger_account.email1) != \'\') or (ltrim(vtiger_account.email2) != \'\')) and (vtiger_account.emailoptout != 1)) and ';
|
||||
else
|
||||
$concat_qry = '((ltrim(vtiger_account.email1) != \'\') or (ltrim(vtiger_account.email2) != \'\')) and ';
|
||||
|
||||
$query = 'select crmid,accountname as entityname,'.$columnlists.' from vtiger_account inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_crmentity.deleted=0 and '.$concat_qry.' vtiger_crmentity.crmid in ('. generateQuestionMarks($crmids) .')';
|
||||
break;
|
||||
}
|
||||
$result = $adb->pquery($query, array($crmids));
|
||||
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);
|
||||
}else
|
||||
{
|
||||
$return_data = Array('idlists'=>"",'mailds'=>"");
|
||||
}
|
||||
return $return_data;
|
||||
|
||||
}
|
||||
|
||||
//added for attach the generated pdf with email
|
||||
function pdfAttach($obj,$module,$file_name,$id)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering into pdfAttach() method.");
|
||||
|
||||
global $adb, $current_user;
|
||||
global $upload_badext;
|
||||
$date_var = date('Y-m-d H:i:s');
|
||||
|
||||
$ownerid = $obj->column_fields['assigned_user_id'];
|
||||
if(!isset($ownerid) || $ownerid=='')
|
||||
$ownerid = $current_user->id;
|
||||
|
||||
$current_id = $adb->getUniqueID("vtiger_crmentity");
|
||||
|
||||
$upload_file_path = decideFilePath();
|
||||
|
||||
//Copy the file from temporary directory into storage directory for upload
|
||||
$source_file_path = "storage/".$file_name;
|
||||
$status = copy($source_file_path, $upload_file_path.$current_id."_".$file_name);
|
||||
//Check wheather the copy process is completed successfully or not. if failed no need to put entry in attachment table
|
||||
if($status)
|
||||
{
|
||||
$query1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)";
|
||||
$params1 = array($current_id, $current_user->id, $ownerid, $module." Attachment", $obj->column_fields['description'], $adb->formatDate($date_var, true), $adb->formatDate($date_var, true));
|
||||
$adb->pquery($query1, $params1);
|
||||
|
||||
$query2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?,?,?,?,?)";
|
||||
$params2 = array($current_id, $file_name, $obj->column_fields['description'], 'pdf', $upload_file_path);
|
||||
$result=$adb->pquery($query2, $params2);
|
||||
|
||||
$query3='insert into vtiger_seattachmentsrel values(?,?)';
|
||||
$adb->pquery($query3, array($id, $current_id));
|
||||
|
||||
// Delete the file that was copied
|
||||
unlink($source_file_path);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->debug("pdf not attached");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//this function check email fields profile permission as well as field access permission
|
||||
function emails_checkFieldVisiblityPermission($fieldname) {
|
||||
global $current_user;
|
||||
$ret = getFieldVisibilityPermission('Emails',$current_user->id,$fieldname);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*********************************************************************************/
|
||||
|
||||
require_once('include/logging.php');
|
||||
require_once('include/database/PearDatabase.php');
|
||||
global $adb;
|
||||
|
||||
$local_log =& LoggerManager::getLogger('EmailsAjax');
|
||||
global $currentModule;
|
||||
$modObj = CRMEntity::getInstance($currentModule);
|
||||
|
||||
$ajaxaction = $_REQUEST["ajxaction"];
|
||||
if($ajaxaction == "DETAILVIEW")
|
||||
{
|
||||
$crmid = $_REQUEST["recordid"];
|
||||
$tablename = $_REQUEST["tableName"];
|
||||
$fieldname = $_REQUEST["fldName"];
|
||||
$fieldvalue = $_REQUEST["fieldValue"];
|
||||
if($crmid != "")
|
||||
{
|
||||
$modObj->retrieve_entity_info($crmid,"Emails");
|
||||
$modObj->column_fields[$fieldname] = $fieldvalue;
|
||||
$modObj->id = $crmid;
|
||||
$modObj->mode = "edit";
|
||||
$modObj->save("Emails");
|
||||
if($modObj->id != "")
|
||||
{
|
||||
echo ":#:SUCCESS";
|
||||
}else
|
||||
{
|
||||
echo ":#:FAILURE";
|
||||
}
|
||||
}else
|
||||
{
|
||||
echo ":#:FAILURE";
|
||||
}
|
||||
} elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE") {
|
||||
require_once 'include/ListView/RelatedListViewContents.php';
|
||||
}
|
||||
elseif($_REQUEST['ajaxmode'] == 'qcreate')
|
||||
{
|
||||
require_once('quickcreate.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once('include/Ajax/CommonAjax.php');
|
||||
}
|
||||
?>
|
||||
@@ -1,581 +0,0 @@
|
||||
function init(){
|
||||
function XHR(type,url,params){
|
||||
this.xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
|
||||
this.url = url;
|
||||
this.params = params;
|
||||
this.type = type;
|
||||
};
|
||||
XHR.prototype.load=function(async,callback){
|
||||
this.onload=callback;
|
||||
this.async=async;
|
||||
|
||||
if(this.type.toLowerCase()=="get"){
|
||||
this.url = this.url+"?"+this.params;
|
||||
}
|
||||
|
||||
this.xhr.open(this.type,this.url,this.async);
|
||||
try{
|
||||
if(async){
|
||||
var request = this;
|
||||
this.xhr.onreadystatechange=function(){
|
||||
request.readyStateChange();
|
||||
}
|
||||
}
|
||||
if(this.type.toLowerCase()=="post"){
|
||||
this.xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
|
||||
this.xhr.setRequestHeader("Content-length", this.params.length);
|
||||
}
|
||||
this.xhr.send(this.params);
|
||||
}catch(e){
|
||||
alert("error: "+e);
|
||||
}
|
||||
};
|
||||
XHR.prototype.readyStateChange=function(){
|
||||
var ready=this.xhr.readyState;
|
||||
if(ready==4){
|
||||
var httpStatus=null;
|
||||
httpStatus=this.xhr.status;
|
||||
if(httpStatus==200 || httpStatus==0){
|
||||
if(this.async){
|
||||
this.onload.call(this,this.xhr);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function VtigerWebservice(vtigerurl,username,accesskey){
|
||||
var vtigerURL=vtigerurl;
|
||||
var username=username;
|
||||
var accessKey=accesskey;
|
||||
var userId=null;
|
||||
var sessionId=null;
|
||||
|
||||
function getResult(response){
|
||||
return response.result;
|
||||
}
|
||||
|
||||
function getError(response){
|
||||
return response.error;
|
||||
}
|
||||
|
||||
function extendsession(){
|
||||
var req = new XHR("post",vtigerURL,"operation=extendsession");
|
||||
req.load(false);
|
||||
var res = JSON.parse(req.xhr.responseText);
|
||||
if(res.success){
|
||||
var result = getResult(res);
|
||||
this.userId=result.userId;
|
||||
this.sessionId=result.sessionName;
|
||||
}
|
||||
}
|
||||
|
||||
function create(object, objectType, callback){
|
||||
var objectJson = JSON.stringify(object);
|
||||
var req = new XHR("post",document.vtigerURL,("operation=create&elementType="+objectType+"&sessionName="+this.sessionId+
|
||||
"&element="+encodeURIComponent(objectJson)));
|
||||
req.load(true,callback);
|
||||
}
|
||||
|
||||
function query(query, callback){
|
||||
var req = new XHR("get",document.vtigerURL,"operation=query&query="+encodeURIComponent(query)+"&sessionName="+this.sessionId);
|
||||
req.load(true,callback);
|
||||
}
|
||||
return {extendSession:extendsession,query:query,getResult:getResult,userId:userId,create:create,getError:getError};
|
||||
};
|
||||
if (!this.JSON) {
|
||||
JSON = function () {
|
||||
function f(n) {
|
||||
return n < 10 ? "0" + n : n;
|
||||
}
|
||||
Date.prototype.toJSON = function () {
|
||||
return this.getUTCFullYear() + "-" +
|
||||
f(this.getUTCMonth() + 1) + "-" +
|
||||
f(this.getUTCDate()) + "T" +
|
||||
f(this.getUTCHours()) + ":" +
|
||||
f(this.getUTCMinutes()) + ":" +
|
||||
f(this.getUTCSeconds()) + "Z";
|
||||
};
|
||||
var m = {
|
||||
"\b": "\\b",
|
||||
"\t": "\\t",
|
||||
"\n": "\\n",
|
||||
"\f": "\\f",
|
||||
"\r": "\\r",
|
||||
"\"" : "\\\"",
|
||||
"\\": "\\\\"
|
||||
};
|
||||
function stringify(value, whitelist) {
|
||||
var a, // The array holding the partial texts.
|
||||
i, // The loop counter.
|
||||
k, // The member key.
|
||||
l, // Length.
|
||||
r = /["\\\x00-\x1f\x7f-\x9f]/g,
|
||||
v; // The member value.
|
||||
switch (typeof value) {
|
||||
case "string":
|
||||
return r.test(value) ?
|
||||
"\"" + value.replace(r, function (a) {
|
||||
var c = m[a];
|
||||
if (c) {
|
||||
return c;
|
||||
}
|
||||
c = a.charCodeAt();
|
||||
return "\\u00" + Math.floor(c / 16).toString(16) +
|
||||
(c % 16).toString(16);
|
||||
}) + "\"" :
|
||||
"\"" + value + "\"";
|
||||
case "number":
|
||||
return isFinite(value) ? String(value) : "null";
|
||||
case "boolean":
|
||||
case "null":
|
||||
return String(value);
|
||||
case "object":
|
||||
if (!value) {
|
||||
return "null";
|
||||
}
|
||||
if (typeof value.toJSON === "function") {
|
||||
return stringify(value.toJSON());
|
||||
}
|
||||
a = [];
|
||||
if (typeof value.length === "number" &&
|
||||
!(value.propertyIsEnumerable("length"))) {
|
||||
l = value.length;
|
||||
for (i = 0; i < l; i += 1) {
|
||||
a.push(stringify(value[i], whitelist) || "null");
|
||||
}
|
||||
return "[" + a.join(",") + "]";
|
||||
}
|
||||
if (whitelist) {
|
||||
l = whitelist.length;
|
||||
for (i = 0; i < l; i += 1) {
|
||||
k = whitelist[i];
|
||||
if (typeof k === "string") {
|
||||
v = stringify(value[k], whitelist);
|
||||
if (v) {
|
||||
a.push(stringify(k) + ":" + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (k in value) {
|
||||
if (typeof k === "string") {
|
||||
v = stringify(value[k], whitelist);
|
||||
if (v) {
|
||||
a.push(stringify(k) + ":" + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "{" + a.join(",") + "}";
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
stringify: stringify,
|
||||
parse: function (text, filter) {
|
||||
var j;
|
||||
function walk(k, v) {
|
||||
var i, n;
|
||||
if (v && typeof v === "object") {
|
||||
for (i in v) {
|
||||
if (Object.prototype.hasOwnProperty.apply(v, [i])) {
|
||||
n = walk(i, v[i]);
|
||||
if (n !== undefined) {
|
||||
v[i] = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return filter(k, v);
|
||||
}
|
||||
if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, "@").
|
||||
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, "]").
|
||||
replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) {
|
||||
j = eval("(" + text + ")");
|
||||
return typeof filter === "function" ? walk("", j) : j;
|
||||
}
|
||||
throw new SyntaxError("parseJSON");
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
|
||||
function trim(str) {
|
||||
var s = str.replace(/\s+$/, "");
|
||||
s = s.replace(/^\s+/, "");
|
||||
return s;
|
||||
}
|
||||
|
||||
function getGmailSubject() {
|
||||
var subject = top.document.title;
|
||||
var firstIndexOf = subject.indexOf("-");
|
||||
var lastIndexOf = subject.lastIndexOf("-");
|
||||
subject = subject.substring(firstIndexOf+1, lastIndexOf-1);
|
||||
return trim(subject);
|
||||
}
|
||||
|
||||
function getVtigerBaseURL(){
|
||||
var url = document.location.href.substring(0,document.location.href.lastIndexOf('/')+1);
|
||||
if(url.length > 0){
|
||||
if(url.charAt(url.length-1) !="/"){
|
||||
url += "/";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getVtigerURL(){
|
||||
if(document.vtigerBaseURL.length > 0){
|
||||
var url =document.vtigerBaseURL;
|
||||
url +="webservice.php";
|
||||
return url;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getGmailURL() {
|
||||
var locationhref = location.href;
|
||||
if(locationhref.indexOf("?")) {
|
||||
var lsplits = locationhref.split("?");
|
||||
locationhref = lsplits[0];
|
||||
} else if(locationhref.indexOf("#")) {
|
||||
var lsplits = locationhref.split("#");
|
||||
locationhref = lsplits[0];
|
||||
}
|
||||
return locationhref;
|
||||
}
|
||||
|
||||
var elementId = "__vtigerBookMarkletDiv__";
|
||||
var busyElementId = "__vtigerBookMarkletDivBusy__"
|
||||
function showBookMarkletUI(){
|
||||
var bookMarkletDiv = document.getElementById(elementId);
|
||||
if(bookMarkletDiv == null){
|
||||
bookMarkletDiv.style.display="block";
|
||||
}
|
||||
}
|
||||
|
||||
function hideBookMarkletUI(){
|
||||
var bookMarkletDiv = document.getElementById(elementId);
|
||||
if(bookMarkletDiv != null){
|
||||
bookMarkletDiv.style.display="none";
|
||||
}
|
||||
}
|
||||
|
||||
function destroyBookMarkletUI(){
|
||||
var closeElementId = '__vtigetGmailCloseElement';
|
||||
var parentLocation = location.href.split("location=");
|
||||
if(parentLocation.length>1){
|
||||
var closeElement = document.getElementById(closeElementId);
|
||||
if(closeElement==null){
|
||||
closeElement = document.createElement("iframe");
|
||||
closeElement.style.width="0px";
|
||||
closeElement.frameBorder="0px";
|
||||
closeElement.style.height="0px";
|
||||
closeElement.style.display="none";
|
||||
closeElement.id = closeElementId;
|
||||
closeElement.src = decodeURIComponent(parentLocation[1])+"#";
|
||||
document.body.appendChild(closeElement);
|
||||
}
|
||||
closeElement.onload=function(){
|
||||
eval('window.parent.parent.removeMe()');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showBusy(){
|
||||
var bookMarkletDiv = document.getElementById(elementId);
|
||||
var busyElem = document.getElementById(busyElementId);
|
||||
if(busyElem==null){
|
||||
busyElem = document.createElement('div');
|
||||
busyElem.id = busyElementId;
|
||||
busyElem.innerHTML="Working...";
|
||||
busyElem.style.position="absolute";
|
||||
busyElem.style.top="5px";
|
||||
busyElem.style.right="5px";
|
||||
busyElem.style.color="white";
|
||||
busyElem.style.backgroundColor="#D75235";
|
||||
busyElem.style.padding="2px";
|
||||
bookMarkletDiv.appendChild(busyElem);
|
||||
}else{
|
||||
busyElem.style.display="block";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function hideBusy(){
|
||||
var busyElem = document.getElementById(busyElementId);
|
||||
if(busyElem!=null){
|
||||
busyElem.style.display="none";
|
||||
}
|
||||
}
|
||||
|
||||
if(typeof document.vtigerURL =="undefined" || document.vtigerURL == null || document.vtigerURL == ""){
|
||||
document.vtigerBaseURL = getVtigerBaseURL();
|
||||
if(document.vtigerBaseURL ==null){
|
||||
alert("Please Provide a Valid URL");
|
||||
return;
|
||||
}
|
||||
document.vtigerURL = getVtigerURL();
|
||||
}
|
||||
var client = new VtigerWebservice(document.vtigerURL,null,null);
|
||||
|
||||
showBusy();
|
||||
client.extendSession();
|
||||
hideBusy();
|
||||
showBookMarkletUI();
|
||||
|
||||
function onReady(id,callback){
|
||||
var interval = window.setInterval(function(){
|
||||
var elem = document.getElementById(id);
|
||||
if(elem != null && typeof elem != "undefined"){
|
||||
callback();
|
||||
window.clearInterval(interval);
|
||||
}
|
||||
},10);
|
||||
}
|
||||
|
||||
function createBookMarkletUI(){
|
||||
|
||||
onReady("__saveVtigerEmail__",function(){
|
||||
document.getElementById("__saveVtigerEmail__").onclick=function(){
|
||||
createEmail();
|
||||
}
|
||||
});
|
||||
onReady("parentType",function(){
|
||||
document.getElementById("parentName").innerHTML = "No "+document.getElementById("parentType").value+" Selected.";
|
||||
document.getElementById("parentType").onchange=function(){
|
||||
document.getElementById("parentName").innerHTML = "No "+this.value+" Selected.";
|
||||
}
|
||||
});
|
||||
|
||||
function getQuery(searchValue){
|
||||
|
||||
var moduleName = document.getElementById("parentType").value;
|
||||
var moduleDetails = JSON.parse(moduleNameFields);
|
||||
var entityNameFields = moduleDetails[moduleName];
|
||||
var selectFields = '';
|
||||
var whereFields = '';
|
||||
each(entityNameFields,function(k,v){
|
||||
if(selectFields.length > 0){
|
||||
selectFields +=',';
|
||||
}
|
||||
selectFields += v;
|
||||
if(whereFields.length > 0){
|
||||
whereFields +=" or ";
|
||||
}
|
||||
whereFields += v+" like '%"+searchValue+"%'";
|
||||
});
|
||||
|
||||
var moduleEmailDetails = JSON.parse(moduleEmailFields);
|
||||
var entityEmailFields = moduleEmailDetails[moduleName];
|
||||
each(entityEmailFields, function(k,v){
|
||||
if(selectFields.length > 0) {
|
||||
selectFields +=',';
|
||||
}
|
||||
selectFields += v;
|
||||
});
|
||||
return "select "+selectFields+" from "+moduleName+" where "+whereFields+";";
|
||||
}
|
||||
|
||||
onReady("__searchVtigerAccount__",function(){
|
||||
document.getElementById("__searchVtigerAccount__").onclick=function(e){
|
||||
var elem = document.getElementById("__vtigerAccountSearchList___");
|
||||
elem.style.display="";
|
||||
|
||||
var accountName = document.getElementById("__searchaccount__").value;
|
||||
if(accountName.length < 1){
|
||||
alert("Please enter the search critiria");
|
||||
return;
|
||||
}
|
||||
showBusy();
|
||||
var q = getQuery(accountName);
|
||||
var moduleName = document.getElementById("parentType").value;
|
||||
var responseElem = document.getElementById("__vtigerAccountSearchResponse___");
|
||||
if(responseElem != null){
|
||||
responseElem.innerHTML = '';
|
||||
}
|
||||
client.query(q,function(response){
|
||||
var responseElem = document.getElementById("__vtigerAccountSearchResponse___");
|
||||
if(responseElem == null){
|
||||
var sibling = document.createElement("tr");
|
||||
var td = document.createElement("td");
|
||||
td.colSpan = "3";
|
||||
str = "<div id=\"__vtigerAccountSearchResponse___\" "+
|
||||
"style=\"width: 100%;overflow: auto;\"> </div>";
|
||||
td.innerHTML = str;
|
||||
sibling.appendChild(td);
|
||||
elem.parentNode.appendChild(sibling);
|
||||
}
|
||||
onReady("__vtigerAccountSearchResponse___",function(){
|
||||
displaySearchResult(moduleName,response,accountName);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getSiblingByTagName(elem,tagName){
|
||||
var sibling = elem.nextSibling;
|
||||
while(sibling.nodeName.toLowerCase()!=tagName.toLowerCase()){
|
||||
sibling = sibling.nextSibling;
|
||||
}
|
||||
return sibling;
|
||||
}
|
||||
|
||||
function each(object,callback){
|
||||
var name, i = 0, length = object.length;
|
||||
if ( length == undefined ) {
|
||||
for ( name in object )
|
||||
if ( callback.call( object[ name ], name, object[ name ] ) === false )
|
||||
break;
|
||||
} else
|
||||
for ( var value = object[0];
|
||||
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
|
||||
return object;
|
||||
}
|
||||
|
||||
function findObject(array,needle){
|
||||
var name, i = 0, length = array.length;
|
||||
var prospect = null;
|
||||
for (; i < length; ++i ){
|
||||
var object = array[i];
|
||||
for ( name in object ){
|
||||
if(object[name] === needle){
|
||||
prospect=object;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return prospect;
|
||||
}
|
||||
|
||||
function getEntityName(moduleName,row){
|
||||
var moduleDetails = JSON.parse(moduleNameFields);
|
||||
var entityNameFields = moduleDetails[moduleName];
|
||||
var entityName = '';
|
||||
each(entityNameFields,function(k,v){
|
||||
if(entityName.length>0){
|
||||
entityName += " ";
|
||||
}
|
||||
entityName +=row[v];
|
||||
});
|
||||
return entityName;
|
||||
}
|
||||
|
||||
function getEntityEmail(moduleName,row){
|
||||
var moduleDetails = JSON.parse(moduleEmailFields);
|
||||
var entityEmailFields = moduleDetails[moduleName];
|
||||
var entityEmail = '';
|
||||
each(entityEmailFields,function(k,v){
|
||||
if(entityEmail.length > 0){
|
||||
return;
|
||||
}
|
||||
entityEmail +=row[v];
|
||||
});
|
||||
return entityEmail;
|
||||
}
|
||||
|
||||
function displaySearchResult(moduleName,response,accountName){
|
||||
hideBusy();
|
||||
var queryResponse = JSON.parse(response.responseText);
|
||||
if(queryResponse.success == true){
|
||||
var queryResult = client.getResult(queryResponse);
|
||||
var str ="<ul class='searchResult'>";
|
||||
if(queryResult.length > 0){
|
||||
each(queryResult, function(i, row){
|
||||
var entityName = getEntityName(moduleName,row);
|
||||
str+="<li><a id=\""+row['id']+"\" class='small searchLinks'>"+
|
||||
entityName+"</a></li>";
|
||||
});
|
||||
}else{
|
||||
str +="<li>No Record Match \""+accountName+"\"</li>";
|
||||
}
|
||||
str += "</ul>";
|
||||
var elem = document.getElementById("__vtigerAccountSearchResponse___");
|
||||
elem.style.height="120px";
|
||||
elem.innerHTML = str;
|
||||
each(elem.getElementsByTagName("a"),function(i,v){
|
||||
v.onclick=function(){
|
||||
var elem = findObject(queryResult,this.id);
|
||||
var entityName = getEntityName(moduleName,elem);
|
||||
var entityEmail = getEntityEmail(moduleName, elem);
|
||||
if(entityEmail.length <=0) {
|
||||
alert("'"+entityName+"' has no email, please select another "+moduleName);
|
||||
}
|
||||
setDetails(elem.id,entityName, entityEmail);
|
||||
var wrap = document.getElementById("__vtigerAccountSearchList___");
|
||||
wrap.style.display="none";
|
||||
document.getElementById('__searchaccount__').value='';
|
||||
}
|
||||
});
|
||||
}else{
|
||||
var error = client.getError(queryResponse);
|
||||
alert("Vtiger returned Error: \nerrorCode: "+error.code+"\nerror Message: "+error.message);
|
||||
}
|
||||
}
|
||||
|
||||
function waitForObject(obj,callback){
|
||||
var interval = window.setInterval(function(){
|
||||
if(typeof obj != "undefined"){
|
||||
callback();
|
||||
window.clearInterval(interval);
|
||||
}
|
||||
},10);
|
||||
}
|
||||
|
||||
function setDetails(id, entityName, entityEmail){
|
||||
var elem = document.getElementById("parent_id");
|
||||
var elemName = document.getElementById("parentName");
|
||||
var elemEmail = document.getElementById("parentEmail");
|
||||
elem.value = id;
|
||||
elemName.innerHTML = entityName;
|
||||
elemEmail.value = entityEmail;
|
||||
}
|
||||
|
||||
function closeOnSuccess(response){
|
||||
var createResponse = JSON.parse(response.responseText);
|
||||
if(createResponse.success == true){
|
||||
alert("Email added to vtigerCRM.");
|
||||
}else{
|
||||
document.getElementById("__saveVtigerEmail__").disabled=false;
|
||||
var error = client.getError(createResponse);
|
||||
alert("Error while creating: \nerrorCode: "+error.code+"\nerror Message: "+error.message);
|
||||
}
|
||||
}
|
||||
|
||||
function getTodayDate(format){
|
||||
var date = new Date();
|
||||
return date.getDay()+"-"+date.getMonth()+"-"+date.getFullYear();
|
||||
}
|
||||
|
||||
function createEmail(){
|
||||
var parent_id = document.getElementById("parent_id").value;
|
||||
var type = document.getElementById("parentType").value;
|
||||
var userEmail = document.getElementById("userEmail").value;
|
||||
var entityEmail = document.getElementById("parentEmail").value;
|
||||
|
||||
if(parent_id.length < 1){
|
||||
alert("No "+type+" selected.");
|
||||
return ;
|
||||
}
|
||||
var subject = document.getElementById("subject").value;
|
||||
if(subject.length < 1){
|
||||
alert("Please provide a value for Subject");
|
||||
return;
|
||||
}
|
||||
|
||||
var description = document.getElementById("description").value;
|
||||
if(description.length < 1){
|
||||
alert("Please provide a value for Body of the email.");
|
||||
return;
|
||||
}
|
||||
document.getElementById("__saveVtigerEmail__").disabled=true;
|
||||
var email ={"description":description,"subject":subject,
|
||||
"assigned_user_id":client.userId,"date_start":getTodayDate(),"activitytype":"Emails",
|
||||
"parent_id": parent_id,'from_email': userEmail,'saved_toid':entityEmail,
|
||||
'email_flag':'SAVED'};
|
||||
client.create(email,"Emails",closeOnSuccess)
|
||||
}
|
||||
createBookMarkletUI();
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
javascript:(function(){var doc = top.document;
|
||||
var elementId="__vtigerBookMarkletDivWrap__";
|
||||
if(navigator.userAgent.toLowerCase().indexOf("msie") == -1){
|
||||
var bookMarkletDiv = doc.getElementById(elementId);
|
||||
if(bookMarkletDiv == null){
|
||||
bookMarkletDiv = doc.createElement("div");
|
||||
bookMarkletDiv.style.border = "2px solid #73ABFA";
|
||||
bookMarkletDiv.style.backgroundColor = "white";
|
||||
bookMarkletDiv.innerHTML = "";
|
||||
bookMarkletDiv.id = elementId;
|
||||
bookMarkletDiv.style.position="absolute";
|
||||
bookMarkletDiv.style.top="5px";
|
||||
bookMarkletDiv.style.right="35px";
|
||||
bookMarkletDiv.style.width="562px";
|
||||
bookMarkletDiv.style.height="450px";
|
||||
bookMarkletDiv.style.zIndex="100000";
|
||||
bookMarkletDiv.innerHTML=" ";
|
||||
bookMarkletDiv.style.overflow = 'hidden';
|
||||
bookMarkletDiv.style.fontSize = '11px';
|
||||
bookMarkletDiv.style.fontFamily = 'Arial, sans-serif';
|
||||
|
||||
var closeMe = doc.createElement("span");
|
||||
closeMe.style.position="absolute";
|
||||
closeMe.style.top="5px";
|
||||
closeMe.style.right="5px";
|
||||
closeMe.style.color="#0070BA";
|
||||
closeMe.style.textDecoration="underline";
|
||||
closeMe.style.width="100%";
|
||||
closeMe.style.textAlign="right";
|
||||
closeMe.style.cursor="pointer";
|
||||
closeMe.innerHTML = "<img src='"+ doc.vtigerURL + "themes/images/close.gif' title='Close Window' " +
|
||||
"alt='Close Window' border=0>";
|
||||
closeMe.onclick = function(){
|
||||
window.removeMe();
|
||||
}
|
||||
bookMarkletDiv.appendChild(closeMe);
|
||||
|
||||
var popUp = doc.createElement("iframe");
|
||||
popUp.id="__vtigerBookmarkletFrame__";
|
||||
popUp.name="__vtigerBookmarkletFrame__";
|
||||
popUp.style.border="0px";
|
||||
popUp.frameBorder="0px";
|
||||
popUp.marginHeight="0px";
|
||||
popUp.marginWidth="0px";
|
||||
popUp.style.width="100%";
|
||||
popUp.style.height="100%";
|
||||
popUp.src = getTargetURL();
|
||||
bookMarkletDiv.appendChild(popUp);
|
||||
doc.body.appendChild(bookMarkletDiv);
|
||||
}else{
|
||||
bookMarkletDiv.style.display="block";
|
||||
}
|
||||
}else{
|
||||
var vtigerGmailBookmarkletWindow = window.open(getTargetURL(),elementId,
|
||||
"scrollbars=1,top=40,left=40,resizable=1,height=450,width=562");
|
||||
}
|
||||
|
||||
function getTargetURL(){
|
||||
var threadid = top.location.hash.split("/");
|
||||
var mailId = threadid[threadid.length-1];
|
||||
var description = encodeURIComponent(getGmailURL()+"?fs=1&tf=1&source=atom&view=cv&search=all&shva=1&th="+mailId);
|
||||
return doc.vtigerURL+"index.php?module=Emails&action=SaveBookmarklet&subject="+
|
||||
encodeURIComponent(getGmailSubject())+"&description="+description+
|
||||
"&location="+encodeURIComponent(getGmailURL());
|
||||
}
|
||||
|
||||
function trim(str) {
|
||||
var s = str.replace(/\s+$/, "");
|
||||
s = s.replace(/^\s+/, "");
|
||||
return s;
|
||||
}
|
||||
|
||||
function getGmailSubject() {
|
||||
var subject = top.document.title;
|
||||
var firstIndexOf = subject.indexOf("-");
|
||||
var lastIndexOf = subject.lastIndexOf("-");
|
||||
subject = subject.substring(firstIndexOf+1, lastIndexOf-1);
|
||||
return trim(subject);
|
||||
}
|
||||
|
||||
function getGmailURL() {
|
||||
var locationhref = location.href;
|
||||
if(locationhref.indexOf("?")!==-1) {
|
||||
var lsplits = locationhref.split("?");
|
||||
locationhref = lsplits[0];
|
||||
} else if(locationhref.indexOf("#")!==-1) {
|
||||
var lsplits = locationhref.split("#");
|
||||
locationhref = lsplits[0];
|
||||
}
|
||||
return locationhref;
|
||||
}
|
||||
window.top.removeMe = function(){
|
||||
if(navigator.userAgent.toLowerCase().indexOf("msie") == -1){
|
||||
doc.body.removeChild(bookMarkletDiv);
|
||||
}else{
|
||||
vtigerGmailBookmarkletWindow.close();
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -1,202 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/ListView.php,v 1.12 2005/04/18 10:37:49 samk Exp $
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('Smarty_setup.php');
|
||||
require_once("data/Tracker.php");
|
||||
require_once('modules/Emails/Emails.php');
|
||||
require_once('include/logging.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('modules/CustomView/CustomView.php');
|
||||
global $current_user;
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
|
||||
global $list_max_entries_per_page, $adb;
|
||||
|
||||
$log = LoggerManager::getLogger('email_list');
|
||||
|
||||
global $currentModule;
|
||||
|
||||
global $image_path;
|
||||
global $theme;
|
||||
|
||||
$url_string = ''; // assigning http url string
|
||||
|
||||
$focus = new Emails();
|
||||
// Initialize sort by fields
|
||||
$focus->initSortbyField('Emails');
|
||||
// END
|
||||
$smarty = new vtigerCRM_Smarty;
|
||||
$other_text = Array();
|
||||
|
||||
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
|
||||
if($_REQUEST['order_by'] != '')
|
||||
$order_by = $adb->sql_escape_string($_REQUEST['order_by']);
|
||||
else
|
||||
$order_by = (($_SESSION['EMAILS_ORDER_BY'] != '')?($_SESSION['EMAILS_ORDER_BY']):($focus->default_order_by));
|
||||
|
||||
if($_REQUEST['sorder'] != '')
|
||||
$sorder = $adb->sql_escape_string($_REQUEST['sorder']);
|
||||
else
|
||||
$sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '')?($_SESSION['EMAILS_SORT_ORDER']):($focus->default_sort_order));
|
||||
|
||||
$_SESSION['EMAILS_ORDER_BY'] = $order_by;
|
||||
$_SESSION['EMAILS_SORT_ORDER'] = $sorder;
|
||||
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
|
||||
// focus_list is the means of passing data to a ListView.
|
||||
global $focus_list;
|
||||
|
||||
//<<<<cutomview>>>>>>>
|
||||
$oCustomView = new CustomView("Emails");
|
||||
$viewid = $oCustomView->getViewId($currentModule);
|
||||
$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
|
||||
$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
|
||||
|
||||
//<<<<<customview>>>>>
|
||||
|
||||
// Buttons and View options
|
||||
if(isPermitted('Emails','Delete','') == 'yes')
|
||||
{
|
||||
$other_text['del'] = $app_strings[LBL_MASS_DELETE];
|
||||
}
|
||||
|
||||
if($viewnamedesc['viewname'] == 'All')
|
||||
{
|
||||
$smarty->assign("ALL", 'All');
|
||||
}
|
||||
|
||||
global $email_title;
|
||||
$display_title = $mod_strings['LBL_LIST_FORM_TITLE'];
|
||||
if($email_title)$display_title = $email_title;
|
||||
|
||||
//to get the search vtiger_field if exists
|
||||
if(isset($_REQUEST['search']) && $_REQUEST['search'] != '' && $_REQUEST['search_text'] != '')
|
||||
{
|
||||
$url_string .= "&search=".vtlib_purify($_REQUEST['search'])."&search_field=".vtlib_purify($_REQUEST['search_field'])."&search_text=".vtlib_purify($_REQUEST['search_text']);
|
||||
if($_REQUEST['search_field'] != 'join')
|
||||
$where = $adb->sql_escape_string($_REQUEST['search_field'])." like '". formatForSqlLike($_REQUEST['search_text']) ."'";
|
||||
else
|
||||
$where = "(subject like '". formatForSqlLike($_REQUEST['search_text']) ."' OR vtiger_users.user_name like '". formatForSqlLike($_REQUEST['search_text']) ."')";
|
||||
}
|
||||
|
||||
|
||||
//Retreive the list from Database
|
||||
//<<<<<<<<<customview>>>>>>>>>
|
||||
if($viewid != "0")
|
||||
{
|
||||
$listquery = getListQuery("Emails");
|
||||
$list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Emails");
|
||||
}
|
||||
else
|
||||
{
|
||||
$list_query = getListQuery("Emails");
|
||||
}
|
||||
//<<<<<<<<customview>>>>>>>>>
|
||||
|
||||
if(isset($where) && $where != '')
|
||||
{
|
||||
$list_query .= " AND " .$where;
|
||||
}
|
||||
if($_REQUEST['folderid'] =='2')
|
||||
{
|
||||
$list_query .= " AND vtiger_seactivityrel.crmid in (select contactid from vtiger_contactdetails) AND vtiger_emaildetails.email_flag !='WEBMAIL'";
|
||||
}
|
||||
if($_REQUEST['folderid'] =='3')
|
||||
{
|
||||
$list_query .= " AND vtiger_seactivityrel.crmid in (select accountid from vtiger_account)";
|
||||
}
|
||||
if($_REQUEST['folderid'] =='4')
|
||||
{
|
||||
$list_query .= " AND vtiger_seactivityrel.crmid in (select leadid from vtiger_leaddetails)";
|
||||
}
|
||||
if($_REQUEST['folderid'] =='5')
|
||||
{
|
||||
$list_query .= " AND vtiger_salesmanactivityrel.smid in (select id from vtiger_users)";
|
||||
}
|
||||
if($_REQUEST['folderid'] =='6')
|
||||
{
|
||||
$list_query .= " AND vtiger_emaildetails.email_flag ='WEBMAIL'";
|
||||
}
|
||||
if(isset($order_by) && $order_by != '')
|
||||
{
|
||||
$tablename = getTableNameForField('Emails',$order_by);
|
||||
$tablename = (($tablename != '')?($tablename."."):'');
|
||||
$list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
|
||||
}
|
||||
|
||||
$list_result = $adb->query($list_query);
|
||||
|
||||
//Constructing the list view
|
||||
$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
|
||||
$smarty->assign("VIEWID", $viewid);
|
||||
$smarty->assign("MOD", $mod_strings);
|
||||
$smarty->assign("APP", $app_strings);
|
||||
$smarty->assign("THEME", $theme);
|
||||
$smarty->assign("IMAGE_PATH",$image_path);
|
||||
$smarty->assign("MODULE",$currentModule);
|
||||
$smarty->assign("SINGLE_MOD",'Email');
|
||||
$smarty->assign("BUTTONS",$other_text);
|
||||
$category = getParentTab();
|
||||
$smarty->assign("CATEGORY",$category);
|
||||
|
||||
//Retreiving the no of rows
|
||||
$noofrows = $adb->num_rows($list_result);
|
||||
|
||||
//Retreive the Navigation array
|
||||
$_REQUEST['allflag'] = 'All';
|
||||
$navigation_array = getNavigationValues(1, $noofrows, $noofrows);
|
||||
|
||||
//Retreive the List View Table Header
|
||||
if($viewid !='')
|
||||
$url_string .="&viewname=".$viewid;
|
||||
if(isset($_REQUEST['folderid']) && $_REQUEST['folderid'] != '')
|
||||
$url_string .= "&folderid=".vtlib_purify($_REQUEST['folderid']);
|
||||
$listview_header = getListViewHeader($focus,"Emails",$url_string,$sorder,$order_by,"",$oCustomView);
|
||||
$smarty->assign("LISTHEADER", $listview_header);
|
||||
|
||||
$listview_entries = getListViewEntries($focus,"Emails",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView);
|
||||
//--------------------------added to fix the ticket(4386)------------------------START
|
||||
foreach($listview_entries as $key=>$value)
|
||||
{
|
||||
$sql="select email_flag from vtiger_emaildetails where emailid=?";
|
||||
$result=$adb->pquery($sql, array($key));
|
||||
$email_flag=$adb->query_result($result,0,"email_flag");
|
||||
$emailid[$key] = $email_flag;
|
||||
}
|
||||
$smarty->assign("EMAILFALG",$emailid);
|
||||
//--------------------------added to fix the ticket(4386)------------------------END
|
||||
|
||||
$smarty->assign("LISTENTITY", $listview_entries);
|
||||
$smarty->assign("SELECT_SCRIPT", $view_script);
|
||||
|
||||
$smarty->assign("USERID", $current_user->id);
|
||||
|
||||
$check_button = Button_Check($module);
|
||||
$smarty->assign("CHECK", $check_button);
|
||||
$smarty->assign("theme", $theme);
|
||||
if($_REQUEST['ajax'] != '')
|
||||
$smarty->display("EmailContents.tpl");
|
||||
else
|
||||
$smarty->display("Emails.tpl");
|
||||
?>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
/*+*******************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*********************************************************************************/
|
||||
require_once 'include/ListView/ListViewPagging.php';
|
||||
?>
|
||||
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('data/Tracker.php');
|
||||
require_once('modules/Emails/Emails.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
require_once('modules/Webmails/Webmails.php');
|
||||
require_once("include/Zend/Json.php");
|
||||
|
||||
global $mod_strings;
|
||||
global $app_strings, $theme;
|
||||
|
||||
$focus = new Emails();
|
||||
$smarty = new vtigerCRM_Smarty();
|
||||
$json = new Zend_Json();
|
||||
$smarty->assign('MOD',$mod_strings);
|
||||
$smarty->assign('THEME',$theme);
|
||||
|
||||
if(isset($_REQUEST['record']) && $_REQUEST['record'] !='' && $_REQUEST['mailbox'] == '')
|
||||
{
|
||||
$focus->id = $_REQUEST['record'];
|
||||
$focus->mode = 'edit';
|
||||
$focus->retrieve_entity_info($_REQUEST['record'],"Emails");
|
||||
|
||||
$focus->name=$focus->column_fields['name'];
|
||||
if(isset($_REQUEST['print']) && $_REQUEST['print'] !='')
|
||||
{
|
||||
$query = 'select idlists,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid =?';
|
||||
$result = $adb->pquery($query, array($focus->id));
|
||||
$smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email'));
|
||||
$to_email = vt_suppressHTMLTags(implode(',',$json->decode($adb->query_result($result,0,'to_email'))));
|
||||
$smarty->assign('TO_MAIL',$to_email);
|
||||
$cc_add = vt_suppressHTMLTags(implode(',',$json->decode($adb->query_result($result,0,'cc_email'))));
|
||||
$smarty->assign('CC_MAIL',$cc_add);
|
||||
$bcc_add = vt_suppressHTMLTags(implode(',',$json->decode($adb->query_result($result,0,'bcc_email'))));
|
||||
$smarty->assign('BCC_MAIL',$bcc_add);
|
||||
$smarty->assign('SUBJECT',$focus->column_fields['subject']);
|
||||
$smarty->assign('DESCRIPTION',$focus->column_fields['description']);
|
||||
}
|
||||
$smarty->display('PrintEmail.tpl');
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['record']) && isset($_REQUEST['mailbox']) && $_REQUEST['print'])
|
||||
{
|
||||
if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "")
|
||||
{
|
||||
$mailbox=$_REQUEST["mailbox"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailbox="INBOX";
|
||||
}
|
||||
$mailid = $_REQUEST['record'];
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mail = $MailBox->mbox;
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$status=imap_setflag_full($MailBox->mbox,$mailid,"\\Seen");
|
||||
$attach_tab=array();
|
||||
$email->loadMail($attach_tab);
|
||||
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$email->charsets."\">\n";
|
||||
$subject = utf8_decode(utf8_encode(imap_utf8($email->subject)));
|
||||
$from = decode_header($email->from);
|
||||
$to = decode_header($email->to[0]);
|
||||
$cc = decode_header($email->cc_header);
|
||||
$date = decode_header($email->date);
|
||||
for($i=0;$i<count($email->attname);$i++){
|
||||
$attachment_links .= $email->anchor_arr[$i].decode_header($email->attname[$i])."</a></br> ";
|
||||
}
|
||||
$content['body'] = $email->body;
|
||||
$content['attachtab'] = $email->attachtab;
|
||||
|
||||
$smarty->assign('FROM_MAIL',$from);
|
||||
$smarty->assign('TO_MAIL',trim($to,",").",");
|
||||
$smarty->assign('SUBJECT',$subject);
|
||||
$smarty->assign('DESCRIPTION',$content['body']);
|
||||
$smarty->display('PrintEmail.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,254 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/Save.php,v 1.27 2005/04/29 08:54:38 rank Exp $
|
||||
* Description: Saves an Account record and then redirects the browser to the
|
||||
* defined return URL.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
require_once("include/Zend/Json.php");
|
||||
|
||||
//check for mail server configuration thro ajax
|
||||
if(isset($_REQUEST['server_check']) && $_REQUEST['server_check'] == 'true')
|
||||
{
|
||||
$sql="select * from vtiger_systems where server_type = ?";
|
||||
$records=$adb->num_rows($adb->pquery($sql, array('email')),0,"id");
|
||||
if($records != '')
|
||||
echo 'SUCCESS';
|
||||
else
|
||||
echo 'FAILURE';
|
||||
die;
|
||||
}
|
||||
|
||||
//Added on 09-11-2005 to avoid loading the webmail vtiger_files in Email process
|
||||
if($_REQUEST['smodule'] != '')
|
||||
{
|
||||
define('SM_PATH','modules/squirrelmail-1.4.4/');
|
||||
/* SquirrelMail required vtiger_files. */
|
||||
require_once(SM_PATH . 'functions/strings.php');
|
||||
require_once(SM_PATH . 'functions/imap_general.php');
|
||||
require_once(SM_PATH . 'functions/imap_messages.php');
|
||||
require_once(SM_PATH . 'functions/i18n.php');
|
||||
require_once(SM_PATH . 'functions/mime.php');
|
||||
require_once(SM_PATH .'include/load_prefs.php');
|
||||
//require_once(SM_PATH . 'class/mime/Message.class.php');
|
||||
require_once(SM_PATH . 'class/mime.class.php');
|
||||
sqgetGlobalVar('key', $key, SQ_COOKIE);
|
||||
sqgetGlobalVar('username', $username, SQ_SESSION);
|
||||
sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
|
||||
$mailbox = 'INBOX';
|
||||
}
|
||||
|
||||
require_once('modules/Emails/Emails.php');
|
||||
require_once('include/logging.php');
|
||||
require_once('include/database/PearDatabase.php');
|
||||
|
||||
$local_log =& LoggerManager::getLogger('index');
|
||||
|
||||
$focus = new Emails();
|
||||
|
||||
global $current_user,$mod_strings,$app_strings;
|
||||
if(isset($_REQUEST['description']) && $_REQUEST['description'] !='')
|
||||
$_REQUEST['description'] = fck_from_html($_REQUEST['description']);
|
||||
|
||||
$all_to_ids = $_REQUEST["hidden_toid"];
|
||||
$all_to_ids .= $_REQUEST["saved_toid"];
|
||||
$_REQUEST["saved_toid"] = $all_to_ids;
|
||||
//we always save the email with "save" status and when it is sent it is marked as SENT
|
||||
$_REQUEST['email_flag'] = 'SAVED';
|
||||
setObjectValuesFromRequest($focus);
|
||||
//Check if the file is exist or not.
|
||||
//$file_name = '';
|
||||
if(isset($_REQUEST['filename_hidden'])) {
|
||||
$file_name = $_REQUEST['filename_hidden'];
|
||||
} else {
|
||||
$file_name = $_FILES['filename']['name'];
|
||||
}
|
||||
$errorCode = $_FILES['filename']['error'];
|
||||
$errormessage = "";
|
||||
if($file_name != '' && $_FILES['filename']['size'] == 0)
|
||||
{
|
||||
if($errorCode == 4 || $errorCode == 0)
|
||||
{
|
||||
if($_FILES['filename']['size'] == 0)
|
||||
$errormessage = "<B><font color='red'>".$mod_strings['LBL_PLEASE_ATTACH']."</font></B> <br>";
|
||||
}
|
||||
else if($errorCode == 2)
|
||||
{
|
||||
$errormessage = "<B><font color='red'>".$mod_strings['LBL_EXCEED_MAX'].$upload_maxsize.$mod_strings['LBL_BYTES']." </font></B> <br>";
|
||||
}
|
||||
else if($errorCode == 6)
|
||||
{
|
||||
$errormessage = "<B>".$mod_strings['LBL_KINDLY_UPLOAD']."</B> <br>" ;
|
||||
}
|
||||
else if($errorCode == 3 )
|
||||
{
|
||||
if($_FILES['filename']['size'] == 0)
|
||||
$errormessage = "<b><font color='red'>".$mod_strings['LBL_PLEASE_ATTACH']."</font></b><br>";
|
||||
}
|
||||
else{}
|
||||
if($errormessage != ""){
|
||||
$ret_error = 1;
|
||||
$ret_parentid = $_REQUEST['parent_id'];
|
||||
$ret_toadd = $_REQUEST['parent_name'];
|
||||
$ret_subject = $_REQUEST['subject'];
|
||||
$ret_ccaddress = $_REQUEST['ccmail'];
|
||||
$ret_bccaddress = $_REQUEST['bccmail'];
|
||||
$ret_description = $_REQUEST['description'];
|
||||
echo $errormessage;
|
||||
include("EditView.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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']);
|
||||
imap_expunge($mbox);
|
||||
header("Location: index.php?module=Emails&action=index");
|
||||
exit();
|
||||
}
|
||||
|
||||
function checkIfContactExists($mailid)
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering checkIfContactExists(".$mailid.") method ...");
|
||||
global $adb;
|
||||
$sql = "select contactid from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and email= ?";
|
||||
$result = $adb->pquery($sql, array($mailid));
|
||||
$numRows = $adb->num_rows($result);
|
||||
if($numRows > 0)
|
||||
{
|
||||
$log->debug("Exiting checkIfContactExists method ...");
|
||||
return $adb->query_result($result,0,"contactid");
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->debug("Exiting checkIfContactExists method ...");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
//assign the focus values
|
||||
$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(getNewDisplayDate());//This will be converted to db date format in save
|
||||
$focus->save("Emails");
|
||||
$return_id = $focus->id;
|
||||
|
||||
require_once("modules/Emails/mail.php");
|
||||
if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'] && $_REQUEST['parent_id'] != '')
|
||||
{
|
||||
$user_mail_status = send_mail('Emails',$current_user->column_fields['email1'],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST['ccmail'],$_REQUEST['bccmail'],'all',$focus->id);
|
||||
|
||||
//if block added to fix the issue #3759
|
||||
if($user_mail_status != 1){
|
||||
$query = "select crmid,attachmentsid from vtiger_seattachmentsrel where crmid=?";
|
||||
$result = $adb->pquery($query, array($email_id));
|
||||
$numOfRows = $adb->num_rows($result);
|
||||
for($i=0; $i<$numOfRows; $i++)
|
||||
{
|
||||
$attachmentsid = $adb->query_result($result,0,"attachmentsid");
|
||||
if($attachmentsid > 0)
|
||||
{
|
||||
$query1="delete from vtiger_crmentity where crmid=?";
|
||||
$adb->pquery($query1, array($attachmentsid));
|
||||
}
|
||||
|
||||
$crmid=$adb->query_result($result,0,"crmid");
|
||||
$query2="delete from vtiger_crmentity where crmid=?";
|
||||
$adb->pquery($query2, array($crmid));
|
||||
}
|
||||
|
||||
$query = "delete from vtiger_emaildetails where emailid=?";
|
||||
$adb->pquery($query, array($focus->id));
|
||||
|
||||
$error_msg = "<font color=red><strong>".$mod_strings['LBL_CHECK_USER_MAILID']."</strong></font>";
|
||||
$ret_error = 1;
|
||||
$ret_parentid = $_REQUEST['parent_id'];
|
||||
$ret_toadd = $_REQUEST['parent_name'];
|
||||
$ret_subject = $_REQUEST['subject'];
|
||||
$ret_ccaddress = $_REQUEST['ccmail'];
|
||||
$ret_bccaddress = $_REQUEST['bccmail'];
|
||||
$ret_description = $_REQUEST['description'];
|
||||
echo $error_msg;
|
||||
include("EditView.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$focus->retrieve_entity_info($return_id,"Emails");
|
||||
|
||||
//this is to receive the data from the Select Users button
|
||||
if($_REQUEST['source_module'] == null)
|
||||
{
|
||||
$module = 'users';
|
||||
}
|
||||
//this will be the case if the Select Contact button is chosen
|
||||
else
|
||||
{
|
||||
$module = $_REQUEST['source_module'];
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
|
||||
$return_module = vtlib_purify($_REQUEST['return_module']);
|
||||
else
|
||||
$return_module = "Emails";
|
||||
|
||||
if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "")
|
||||
$return_action = vtlib_purify($_REQUEST['return_action']);
|
||||
else
|
||||
$return_action = "DetailView";
|
||||
|
||||
if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "")
|
||||
$return_id = vtlib_purify($_REQUEST['return_id']);
|
||||
|
||||
if(isset($_REQUEST['filename']) && $_REQUEST['filename'] != "")
|
||||
$filename = vtlib_purify($_REQUEST['filename']);
|
||||
|
||||
$local_log->debug("Saved record with id of ".$return_id);
|
||||
|
||||
if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'] && $_REQUEST['parent_id'] == ''){
|
||||
if($_REQUEST["parent_name"] != '' && isset($_REQUEST["parent_name"])) {
|
||||
include("modules/Emails/webmailsend.php");
|
||||
}
|
||||
|
||||
} elseif( isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'])
|
||||
include("modules/Emails/mailsend.php");
|
||||
|
||||
|
||||
|
||||
if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'mailbox')
|
||||
header("Location: index.php?module=$return_module&action=index");
|
||||
else {
|
||||
if($_REQUEST['return_viewname'] == '') $return_viewname='0';
|
||||
if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']);
|
||||
//Added for 4600
|
||||
$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
|
||||
echo $inputs;
|
||||
}
|
||||
?>
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/*+**********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
************************************************************************************/
|
||||
require_once 'include/Webservices/Utils.php';
|
||||
require_once("include/Zend/Json.php");
|
||||
require_once 'include/Webservices/WebserviceField.php';
|
||||
require_once 'include/Webservices/EntityMeta.php';
|
||||
require_once 'include/Webservices/VtigerWebserviceObject.php';
|
||||
require_once("include/Webservices/VtigerCRMObject.php");
|
||||
require_once("include/Webservices/VtigerCRMObjectMeta.php");
|
||||
require_once("include/Webservices/WebServiceError.php");
|
||||
require_once 'include/Webservices/ModuleTypes.php';
|
||||
require_once("include/Webservices/DescribeObject.php");
|
||||
|
||||
global $app_strings;
|
||||
|
||||
global $currentModule;
|
||||
global $theme;
|
||||
|
||||
require_once('Smarty_setup.php');
|
||||
|
||||
// focus_list is the means of passing data to a ListView.
|
||||
global $focus_list;
|
||||
|
||||
if (!isset($where)) $where = "";
|
||||
|
||||
$url_string = '';
|
||||
|
||||
$smarty = new vtigerCRM_Smarty;
|
||||
$smarty->assign("subject",$_REQUEST['subject']);
|
||||
$smarty->assign("description",$_REQUEST['description']);
|
||||
|
||||
Zend_Json::$useBuiltinEncoderDecoder = true;
|
||||
$json = new Zend_Json();
|
||||
|
||||
$elementType = $_REQUEST['module'];
|
||||
|
||||
global $log,$adb;
|
||||
$webserviceObject = VtigerWebserviceObject::fromName($adb,$elementType);
|
||||
$handlerPath = $webserviceObject->getHandlerPath();
|
||||
$handlerClass = $webserviceObject->getHandlerClass();
|
||||
|
||||
require_once $handlerPath;
|
||||
|
||||
$handler = new $handlerClass($webserviceObject,$current_user,$adb,$log);
|
||||
$meta = $handler->getMeta();
|
||||
$meta->retrieveMeta();
|
||||
|
||||
$types = vtws_listtypes($current_user);
|
||||
if(!in_array($elementType,$types['types'])){
|
||||
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to perform the operation is denied");
|
||||
}
|
||||
|
||||
$wsFieldDetails = $handler->getField('parent_id');
|
||||
|
||||
$moduleEntityNameDetails = array();
|
||||
$moduleEmailFieldDetails = array();
|
||||
foreach ($wsFieldDetails['type']['refersTo'] as $type) {
|
||||
$referenceModuleHandler = vtws_getModuleHandlerFromName($type, $current_user);
|
||||
$referenceModuleMeta = $referenceModuleHandler->getMeta();
|
||||
$nameFields = explode(',',$referenceModuleMeta->getNameFields());
|
||||
$moduleFields = $referenceModuleMeta->getModuleFields();
|
||||
$accessibleFields = array_keys($moduleFields);
|
||||
$accessibleNameFields = array_intersect($nameFields, $accessibleFields);
|
||||
$moduleEntityNameDetails[$type] = $accessibleNameFields;
|
||||
$moduleEmailFieldDetails[$type] = $referenceModuleMeta->getEmailFields();
|
||||
}
|
||||
|
||||
$smarty->assign("types",$wsFieldDetails['type']['refersTo']);
|
||||
$smarty->assign("entityNameFields",$json->encode($moduleEntityNameDetails));
|
||||
$smarty->assign("emailFields",$json->encode($moduleEmailFieldDetails));
|
||||
$smarty->assign("userEmail",$current_user->column_fields['email1']);
|
||||
|
||||
$smarty->display("modules/Bookmarklet/Bookmarklet.tpl");
|
||||
?>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*********************************************************************************/
|
||||
echo header('Pragma: public');
|
||||
echo header('Expires: 0');
|
||||
echo header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
echo header('Cache-Control: private', false);
|
||||
ini_set("include_path","../../");
|
||||
|
||||
require_once 'include/utils/utils.php';
|
||||
|
||||
include_once('../../config.inc.php');
|
||||
global $application_unique_key;
|
||||
if($_REQUEST['app_key'] != $application_unique_key) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $adb;
|
||||
|
||||
$crmid = $_REQUEST['record'];
|
||||
$mailid = $_REQUEST['mailid'];
|
||||
$adb->pquery("INSERT INTO vtiger_email_access(crmid, mailid, accessdate, accesstime) VALUES(?,?,?,?)", array($crmid, $mailid, date('Y-m-d'), date('H:i:s')));
|
||||
|
||||
$result = $adb->pquery("select count(*) as count from vtiger_email_access where crmid=? and mailid=?",array($crmid, $mailid));
|
||||
$count = $adb->query_result($result,0,'count');
|
||||
|
||||
$result = $adb->pquery("select * from vtiger_email_track where crmid=? and mailid=?", array($crmid, $mailid));
|
||||
if($adb->num_rows($result)>0){
|
||||
$adb->pquery("update vtiger_email_track set access_count=? where crmid=? and mailid=?", array($count, $crmid, $mailid));
|
||||
} else {
|
||||
$adb->pquery("insert into vtiger_email_track(crmid,mailid,access_count) values(?,?,?)", array($crmid, $mailid, 1));
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
/*+*******************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*********************************************************************************/
|
||||
require_once 'modules/Home/UnifiedSearch.php';
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
$msgno = $_REQUEST['msgno'];
|
||||
$download = $_REQUEST['download'];
|
||||
$file = $_REQUEST['file'];
|
||||
|
||||
$ServerName = "{localhost/imap:143/notls}INBOX"; // For a IMAP connection (PORT 143)
|
||||
$UserName = "user";
|
||||
$PassWord = "password";
|
||||
$mbox = imap_open($ServerName, $UserName,$PassWord) or die("Could not open Mailbox - try again later!");
|
||||
|
||||
if ($download == "1")
|
||||
{
|
||||
echo "attribute=";
|
||||
print_r($att);
|
||||
$strFileName = $att[$file]->parameters[0]->value;
|
||||
$strFileType = strrev(substr(strrev($strFileName),0,4));
|
||||
$fileContent = imap_fetchbody($mbox,$msgno,$file+2);
|
||||
}
|
||||
|
||||
/** Function to download the File
|
||||
* @param string $strFileType - File Type
|
||||
* @param string $strFileName - File Name
|
||||
* @param string $fileContents- File contents
|
||||
**/
|
||||
function downloadFile($strFileType,$strFileName,$fileContent)
|
||||
{
|
||||
$ContentType = "application/octet-stream";
|
||||
|
||||
if ($strFileType == ".asf")
|
||||
$ContentType = "video/x-ms-asf";
|
||||
if ($strFileType == ".avi")
|
||||
$ContentType = "video/avi";
|
||||
if ($strFileType == ".doc")
|
||||
$ContentType = "application/msword";
|
||||
if ($strFileType == ".zip")
|
||||
$ContentType = "application/zip";
|
||||
if ($strFileType == ".xls")
|
||||
$ContentType = "application/vnd.ms-excel";
|
||||
if ($strFileType == ".gif")
|
||||
$ContentType = "image/gif";
|
||||
if ($strFileType == ".jpg" || $strFileType == "jpeg")
|
||||
$ContentType = "image/jpeg";
|
||||
if ($strFileType == ".wav")
|
||||
$ContentType = "audio/wav";
|
||||
if ($strFileType == ".mp3")
|
||||
$ContentType = "audio/mpeg3";
|
||||
if ($strFileType == ".mpg" || $strFileType == "mpeg")
|
||||
$ContentType = "video/mpeg";
|
||||
if ($strFileType == ".rtf")
|
||||
$ContentType = "application/rtf";
|
||||
if ($strFileType == ".htm" || $strFileType == "html")
|
||||
$ContentType = "text/html";
|
||||
if ($strFileType == ".xml")
|
||||
$ContentType = "text/xml";
|
||||
if ($strFileType == ".xsl")
|
||||
$ContentType = "text/xsl";
|
||||
if ($strFileType == ".css")
|
||||
$ContentType = "text/css";
|
||||
if ($strFileType == ".php")
|
||||
$ContentType = "text/php";
|
||||
if ($strFileType == ".asp")
|
||||
$ContentType = "text/asp";
|
||||
if ($strFileType == ".pdf")
|
||||
$ContentType = "application/pdf";
|
||||
|
||||
header ("Content-Type: $ContentType");
|
||||
header("Cache-Control: private");
|
||||
header("Content-Description: PHP Generated Data");
|
||||
header ("Content-Disposition: attachment; filename=$strFileName");
|
||||
echo imap_base64($fileContent);
|
||||
#echo base64_decode($fileContent);
|
||||
}
|
||||
?>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/index.php,v 1.3 2005/03/17 20:01:10 samk Exp $
|
||||
* Description: TODO: To be written.
|
||||
********************************************************************************/
|
||||
|
||||
global $theme;
|
||||
$theme_path="themes/".$theme."/";
|
||||
$image_path=$theme_path."images/";
|
||||
|
||||
if(isset($_REQUEST['mailconnect']))
|
||||
{
|
||||
echo '<center><font color=red><b>'.$mod_strings['LBL_MAIL_CONNECT_ERROR_INFO'].'</b></color></center><br>';
|
||||
}
|
||||
|
||||
include ('modules/Emails/ListView.php');
|
||||
|
||||
?>
|
||||
@@ -1,183 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/language/en_us.lang.php,v 1.17 2005/03/28 06:31:38 rank Exp $
|
||||
* Description: Defines the English language pack for the Account module.
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = Array(
|
||||
// Mike Crowe Mod --------------------------------------------------------added for general search
|
||||
'LBL_GENERAL_INFORMATION'=>'General Information',
|
||||
|
||||
'LBL_MODULE_NAME'=>'Email',
|
||||
'LBL_MODULE_TITLE'=>'Email: Home',
|
||||
'LBL_SEARCH_FORM_TITLE'=>'Email Search',
|
||||
'LBL_LIST_FORM_TITLE'=>'Email List',
|
||||
'LBL_NEW_FORM_TITLE'=>'Track Email',
|
||||
|
||||
'LBL_LIST_SUBJECT'=>'Subject',
|
||||
'LBL_LIST_CONTACT'=>'Contact',
|
||||
'LBL_LIST_RELATED_TO'=>'Related to',
|
||||
'LBL_LIST_DATE'=>'Date Sent',
|
||||
'LBL_LIST_TIME'=>'Time Sent',
|
||||
|
||||
'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.",
|
||||
'LBL_DATE_SENT'=>'Date Sent:',
|
||||
'LBL_DATE_AND_TIME'=>'Date & Time Sent:',
|
||||
'LBL_DATE'=>'Date Sent:',
|
||||
'LBL_TIME'=>'Time Sent:',
|
||||
'LBL_SUBJECT'=>'Subject:',
|
||||
'LBL_BODY'=>'Body:',
|
||||
'LBL_CONTACT_NAME'=>' Contact Name: ',
|
||||
'LBL_EMAIL'=>'Email:',
|
||||
'LBL_DETAILVIEW_EMAIL'=>'E-Mail',
|
||||
'LBL_COLON'=>':',
|
||||
'LBL_CHK_MAIL'=>'Check Mail',
|
||||
'LBL_COMPOSE'=>'Compose',
|
||||
//Single change for 5.0.3
|
||||
'LBL_SETTINGS'=>'Incoming Mail Server Settings',
|
||||
'LBL_EMAIL_FOLDERS'=>'Email Folders',
|
||||
'LBL_INBOX'=>'Inbox',
|
||||
'LBL_SENT_MAILS'=>'Sent Mails',
|
||||
'LBL_TRASH'=>'Trash',
|
||||
'LBL_JUNK_MAILS'=>'Junk Mails',
|
||||
'LBL_TO_LEADS'=>'To Leads',
|
||||
'LBL_TO_CONTACTS'=>'To Contacts',
|
||||
'LBL_TO_ACCOUNTS'=>'To Accounts',
|
||||
'LBL_MY_MAILS'=>'My Mails',
|
||||
'LBL_QUAL_CONTACT'=>'Qualified Mails (As Contacts)',
|
||||
'LBL_MAILS'=>'Mails',
|
||||
'LBL_QUALIFY_BUTTON'=>'Qualify',
|
||||
'LBL_REPLY_BUTTON'=>'Reply',
|
||||
'LBL_FORWARD_BUTTON'=>'Forward',
|
||||
'LBL_DOWNLOAD_ATTCH_BUTTON'=>'Download Attachments',
|
||||
'LBL_FROM'=>'From :',
|
||||
'LBL_CC'=>'Cc :',
|
||||
'LBL_BCC'=>'Bcc :',
|
||||
|
||||
'NTC_REMOVE_INVITEE'=>'Are you sure you want to remove this recipient from the email?',
|
||||
'LBL_INVITEE'=>'Recipients',
|
||||
|
||||
// Added Fields
|
||||
// Contacts-SubPanelViewContactsAndUsers.php
|
||||
'LBL_BULK_MAILS'=>'Bulk Mails',
|
||||
'LBL_ATTACHMENT'=>'Attachment',
|
||||
'LBL_UPLOAD'=>'Upload',
|
||||
'LBL_FILE_NAME'=>'File Name',
|
||||
'LBL_SEND'=>'Send',
|
||||
|
||||
'LBL_EMAIL_TEMPLATES'=>'Email Templates',
|
||||
'LBL_TEMPLATE_NAME'=>'Template Name',
|
||||
'LBL_DESCRIPTION'=>'Description',
|
||||
'LBL_EMAIL_TEMPLATES_LIST'=>'Email Templates List',
|
||||
'LBL_EMAIL_INFORMATION'=>'Email Information',
|
||||
|
||||
|
||||
|
||||
|
||||
//for v4 release added
|
||||
'LBL_NEW_LEAD'=>'New Lead',
|
||||
'LBL_LEAD_TITLE'=>'Leads',
|
||||
|
||||
'LBL_NEW_PRODUCT'=>'New Product',
|
||||
'LBL_PRODUCT_TITLE'=>'Products',
|
||||
'LBL_NEW_CONTACT'=>'New Contact',
|
||||
'LBL_CONTACT_TITLE'=>'Contacts',
|
||||
'LBL_NEW_ACCOUNT'=>'New Account',
|
||||
'LBL_ACCOUNT_TITLE'=>'Accounts',
|
||||
|
||||
// Added vtiger_fields after vtiger4 - Beta
|
||||
'LBL_USER_TITLE'=>'Users',
|
||||
'LBL_NEW_USER'=>'New User',
|
||||
|
||||
// Added for 4 GA
|
||||
'LBL_TOOL_FORM_TITLE'=>'Email Tools',
|
||||
//Added for 4GA
|
||||
'Date & Time Sent'=>'Date & Time Sent',
|
||||
'Sales Enity Module'=>'Sales Enity Module',
|
||||
'Related To'=>'Related To',
|
||||
'Assigned To'=>'Assigned To',
|
||||
'Subject'=>'Subject',
|
||||
'Attachment'=>'Attachment',
|
||||
'Description'=>'Description',
|
||||
'Time Start'=>'Time Start',
|
||||
'Created Time'=>'Created Time',
|
||||
'Modified Time'=>'Modified Time',
|
||||
|
||||
'MESSAGE_CHECK_MAIL_SERVER_NAME'=>'Please Check the Mail Server Name...',
|
||||
'MESSAGE_CHECK_MAIL_ID'=>'Please Check the Email Id of "Assigned To" User...',
|
||||
'MESSAGE_MAIL_HAS_SENT_TO_USERS'=>'Mail has been sent to the following User(s) :',
|
||||
'MESSAGE_MAIL_HAS_SENT_TO_CONTACTS'=>'Mail has been sent to the following Contact(s) :',
|
||||
'MESSAGE_MAIL_ID_IS_INCORRECT'=>'Mail Id is incorrect. Please Check this Mail Id...',
|
||||
'MESSAGE_ADD_USER_OR_CONTACT'=>'Please Add any User(s) or Contact(s)...',
|
||||
'MESSAGE_MAIL_SENT_SUCCESSFULLY'=>' Mail(s) sent successfully!',
|
||||
|
||||
// Added for web mail post 4.0.1 release
|
||||
'LBL_FETCH_WEBMAIL'=>'Fetch Web Mail',
|
||||
//Added for 4.2 Release -- CustomView
|
||||
'LBL_ALL'=>'All',
|
||||
'MESSAGE_CONTACT_NOT_WANT_MAIL'=>'This Contact does not want to receive mails.',
|
||||
'LBL_WEBMAILS_TITLE'=>'WebMails',
|
||||
'LBL_EMAILS_TITLE'=>'Email',
|
||||
'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:',
|
||||
'LBL_IN_SUBJECT'=>'in Subject',
|
||||
'LBL_IN_SENDER'=>'in Sender',
|
||||
'LBL_IN_SUBJECT_OR_SENDER'=>'in Subject or Sender',
|
||||
'SELECT_EMAIL'=>'Select Email IDs',
|
||||
'Sender'=>'Sender',
|
||||
'LBL_CONFIGURE_MAIL_SETTINGS'=>'Your Incoming Mail Server is not configured',
|
||||
'LBL_MAILSELECT_INFO1'=>'The following Email ID types are associated to the selected',
|
||||
'LBL_MAILSELECT_INFO2'=>'Select the Email ID types to which,the email should be sent',
|
||||
'LBL_MULTIPLE'=>'Multiple',
|
||||
'LBL_COMPOSE_EMAIL'=>'Compose E-Mail',
|
||||
'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail Client',
|
||||
|
||||
//Added for 5.0.3
|
||||
'TITLE_VTIGERCRM_MAIL'=>'vtigerCRM Mail',
|
||||
'TITLE_COMPOSE_MAIL'=>'Compose Mail',
|
||||
|
||||
'MESSAGE_MAIL_COULD_NOT_BE_SEND'=>'Mail could not be sent to the assigned to user.',
|
||||
'MESSAGE_PLEASE_CHECK_ASSIGNED_USER_EMAILID'=>'Please check the assigned to user email id...',
|
||||
'MESSAGE_PLEASE_CHECK_THE_FROM_MAILID'=>'Please check the from email id',
|
||||
'MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID'=>'Mail could not be sent to this email id',
|
||||
'PLEASE_CHECK_THIS_EMAILID'=>'Please check this mail id...',
|
||||
'LBL_CC_EMAIL_ERROR'=>'Your cc mailid is not proper',
|
||||
'LBL_BCC_EMAIL_ERROR'=>'Your bcc mailid is not proper',
|
||||
'LBL_NO_RCPTS_EMAIL_ERROR'=>'No recepients specified',
|
||||
'LBL_CONF_MAILSERVER_ERROR'=>'Please configure your outgoing mailserver under Settings ---> Outgoing Server link',
|
||||
'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail Client',
|
||||
'LBL_MAILSELECT_INFO3'=>'You don\'t have permission to view email id(s) of the selected Record(s).',
|
||||
//Added for script alerts
|
||||
'FEATURE_AVAILABLE_INFO' => 'This feature is currently only available for Microsoft Internet Explorer 5.5+ users\n\nWait f
|
||||
or an update!',
|
||||
'DOWNLOAD_CONFIRAMATION' => 'Do you want to download the file ?',
|
||||
'LBL_PLEASE_ATTACH' => 'Please give a valid file to attach and try again!',
|
||||
'LBL_KINDLY_UPLOAD' => 'Please configure <font color="red">upload_tmp_dir</font> variable in php.ini file.',
|
||||
'LBL_EXCEED_MAX' => 'Sorry, the uploaded file exceeds the maximum filesize limit. Please try a file smaller than ',
|
||||
'LBL_BYTES' => ' bytes',
|
||||
'LBL_CHECK_USER_MAILID' => 'Please check the current user mailid.It should be a valid mailid to send Emails',
|
||||
|
||||
// Added/Updated for vtiger CRM 5.0.4
|
||||
'Activity Type'=>'Activity Type',
|
||||
'LBL_MAILSELECT_INFO'=>'has the following Email IDs associated.Please Select the Email IDs to which,the mail should be sent',
|
||||
'LBL_NO_RECORDS' => 'No Records Found',
|
||||
'LBL_PRINT_EMAIL'=> 'Print',
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* PHPMailer language file.
|
||||
* English Version
|
||||
*/
|
||||
$PHPMAILER_LANG = array();
|
||||
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
|
||||
'recipient email address.';
|
||||
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
|
||||
$PHPMAILER_LANG["execute"] = 'Could not execute: ';
|
||||
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
|
||||
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
|
||||
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
|
||||
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
|
||||
'recipients failed: ';
|
||||
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
|
||||
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host1111111111=======>.';
|
||||
$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
|
||||
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
|
||||
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
|
||||
?>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* PHPMailer language file.
|
||||
* English Version
|
||||
*/
|
||||
$PHPMAILER_LANG = array();
|
||||
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
|
||||
'recipient email address.';
|
||||
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
|
||||
$PHPMAILER_LANG["execute"] = 'Could not execute: ';
|
||||
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
|
||||
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
|
||||
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
|
||||
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
|
||||
'recipients failed: ';
|
||||
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
|
||||
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host1111111111=======>.';
|
||||
$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
|
||||
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
|
||||
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
|
||||
?>
|
||||
@@ -1,184 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
|
||||
* ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/language/en_us.lang.php,v 1.17 2005/03/28 06:31:38 rank Exp $
|
||||
* Description: Defines the English language pack for the Account module.
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = Array(
|
||||
// Mike Crowe Mod --------------------------------------------------------added for general search
|
||||
'LBL_GENERAL_INFORMATION' => '一般信息',
|
||||
|
||||
'LBL_MODULE_NAME' => '邮件',
|
||||
'LBL_MODULE_TITLE' => '邮件: 首页',
|
||||
'LBL_SEARCH_FORM_TITLE' => '搜寻邮件',
|
||||
'LBL_LIST_FORM_TITLE' => '邮件列表',
|
||||
'LBL_NEW_FORM_TITLE' => '追踪邮件',
|
||||
|
||||
'LBL_LIST_SUBJECT' => '标题',
|
||||
'LBL_LIST_CONTACT' => '联系人',
|
||||
'LBL_LIST_RELATED_TO' => '相关人事',
|
||||
'LBL_LIST_DATE' => '寄出日期',
|
||||
'LBL_LIST_TIME' => '寄出时间',
|
||||
|
||||
'ERR_DELETE_RECORD' => '必须有记录编号才能删除该笔账号.',
|
||||
'LBL_DATE_SENT' => '寄出日期:',
|
||||
'LBL_DATE_AND_TIME' => '寄出日期 & 时间:',
|
||||
'LBL_DATE' => '寄出日期:',
|
||||
'LBL_TIME' => '寄出时间:',
|
||||
'LBL_SUBJECT' => '标题:',
|
||||
'LBL_BODY' => '邮件内容:',
|
||||
'LBL_CONTACT_NAME' => '联系人名称: ',
|
||||
'LBL_EMAIL' => '邮件:',
|
||||
'LBL_DETAILVIEW_EMAIL'=>'邮件',
|
||||
'LBL_COLON'=>':',
|
||||
'LBL_CHK_MAIL'=>'检查邮件',
|
||||
'LBL_COMPOSE'=>'新邮件',
|
||||
//Single change for 5.0.3
|
||||
'LBL_SETTINGS'=>'邮件服务器设置',
|
||||
'LBL_EMAIL_FOLDERS'=>'邮件数据夹',
|
||||
'LBL_INBOX' => '收件夹',
|
||||
'LBL_SENT_MAILS'=>'邮件备份',
|
||||
'LBL_TRASH' => '垃圾桶',
|
||||
'LBL_JUNK_MAILS' => '广告邮件',
|
||||
'LBL_TO_LEADS' => '转为准客户',
|
||||
'LBL_TO_CONTACTS' => '转为联系人',
|
||||
'LBL_TO_ACCOUNTS' => '转为客户',
|
||||
'LBL_MY_MAILS' => '我的邮件',
|
||||
'LBL_QUAL_CONTACT' => '已转换邮件(转为联系人)',
|
||||
'LBL_MAILS' => '邮件',
|
||||
'LBL_QUALIFY_BUTTON' => '转换',
|
||||
'LBL_REPLY_BUTTON' => '回应',
|
||||
'LBL_FORWARD_BUTTON' => '转寄',
|
||||
'LBL_DOWNLOAD_ATTCH_BUTTON' => '下载附加档案',
|
||||
'LBL_FROM' => '寄件人:',
|
||||
'LBL_CC' => '副本:',
|
||||
'LBL_BCC' => '密件副本:',
|
||||
|
||||
'NTC_REMOVE_INVITEE' => '您确定要移除这封来信?',
|
||||
'LBL_INVITEE'=>'接收者',
|
||||
|
||||
// Added Fields
|
||||
// Contacts-SubPanelViewContactsAndUsers.php
|
||||
'LBL_BULK_MAILS' => '大量寄信',
|
||||
'LBL_ATTACHMENT' => '附件',
|
||||
'LBL_UPLOAD' => '上传',
|
||||
'LBL_FILE_NAME' => '文件名称',
|
||||
'LBL_SEND' => '寄出',
|
||||
|
||||
'LBL_EMAIL_TEMPLATES' => '邮件样版',
|
||||
'LBL_TEMPLATE_NAME' => '样版名称',
|
||||
'LBL_DESCRIPTION' => '描述',
|
||||
'LBL_EMAIL_TEMPLATES_LIST' => '邮件样版列表',
|
||||
'LBL_EMAIL_INFORMATION' => '邮件信息',
|
||||
|
||||
|
||||
|
||||
|
||||
//for v4 release added
|
||||
'LBL_NEW_LEAD' => '新增潜在客户',
|
||||
'LBL_LEAD_TITLE' => '潜在客户',
|
||||
|
||||
'LBL_NEW_PRODUCT' => '新增商品',
|
||||
'LBL_PRODUCT_TITLE' => '商品',
|
||||
'LBL_NEW_CONTACT' => '新增联系人',
|
||||
'LBL_CONTACT_TITLE' => '联系人',
|
||||
'LBL_NEW_ACCOUNT' => '新增公司',
|
||||
'LBL_ACCOUNT_TITLE' => '公司',
|
||||
|
||||
// Added vtiger_fields after vtiger4 - Beta
|
||||
'LBL_USER_TITLE' => '使用者',
|
||||
'LBL_NEW_USER' => '新增使用者',
|
||||
|
||||
// Added for 4 GA
|
||||
'LBL_TOOL_FORM_TITLE' => '邮件编辑器',
|
||||
//Added for 4GA
|
||||
'Date & Time Sent' => '寄出日期 & 时间',
|
||||
'Sales Enity Module' => '客服模块',
|
||||
|
||||
'Related To' => '相关人事',
|
||||
'Assigned To' => '负责人',
|
||||
'Subject' => '标题',
|
||||
'Attachment' => '附件',
|
||||
'Description' => '描述',
|
||||
'Time Start' => '开始时间',
|
||||
'Created Time' => '建立时间',
|
||||
'Modified Time' => '修改时间',
|
||||
|
||||
'MESSAGE_CHECK_MAIL_SERVER_NAME' => '请检查电子邮件服务器名称...',
|
||||
'MESSAGE_CHECK_MAIL_ID' => '请检查负责人的信箱编号...',
|
||||
'MESSAGE_MAIL_HAS_SENT_TO_USERS' => '邮件将会寄出给指定的使用者:',
|
||||
'MESSAGE_MAIL_HAS_SENT_TO_CONTACTS' => '邮件将会寄出给指定的联系人:',
|
||||
'MESSAGE_MAIL_ID_IS_INCORRECT' => '邮件格式不正确. 请检查这封邮件的Id...',
|
||||
'MESSAGE_ADD_USER_OR_CONTACT' => '请新增其它位使用者或联系人...',
|
||||
'MESSAGE_MAIL_SENT_SUCCESSFULLY' => ' 邮件已顺利寄出!',
|
||||
|
||||
// Added for web mail post 4.0.1 release
|
||||
'LBL_FETCH_WEBMAIL' => '取得网页邮件',
|
||||
//Added for 4.2 Release -- CustomView
|
||||
'LBL_ALL' => '全部',
|
||||
'MESSAGE_CONTACT_NOT_WANT_MAIL' => '这个联系人不想要收到电子邮件',
|
||||
'LBL_WEBMAILS_TITLE' => '网页邮件',
|
||||
'LBL_EMAILS_TITLE' => '电子邮件',
|
||||
'LBL_MAIL_CONNECT_ERROR_INFO' => '联机到邮件服务器时发生错误,检查我的账号=>邮件服务器列表=>邮件账号',
|
||||
'LBL_ALLMAILS' => '所有邮件',
|
||||
'LBL_TO_USERS' => '给使用者',
|
||||
'LBL_TO' => '收件人:',
|
||||
'LBL_IN_SUBJECT' => '主旨',
|
||||
'LBL_IN_SENDER' => '寄件人',
|
||||
'LBL_IN_SUBJECT_OR_SENDER' => '主旨或寄件人',
|
||||
'SELECT_EMAIL' => '选择邮件编号',
|
||||
'Sender' => '寄件人',
|
||||
'LBL_CONFIGURE_MAIL_SETTINGS' => '您的收件邮件服务器还没设定',
|
||||
'LBL_MAILSELECT_INFO' => '有下面相关邮件编号,请选择要寄送的邮件编号',
|
||||
'LBL_MAILSELECT_INFO1' => '下面的邮件编号与选择的项目有关',
|
||||
'LBL_MAILSELECT_INFO2' => '选择要寄送的邮件编号类型',
|
||||
'LBL_MULTIPLE' => '多选',
|
||||
'LBL_COMPOSE_EMAIL' => '发送邮件',
|
||||
'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail 客户',
|
||||
|
||||
//Added for 5.0.3
|
||||
'TITLE_VTIGERCRM_MAIL'=>'vtigerCRM 邮件',
|
||||
'TITLE_COMPOSE_MAIL'=>'组成邮件',
|
||||
|
||||
'MESSAGE_MAIL_COULD_NOT_BE_SEND'=>'邮件不能寄发到被分配的用户.',
|
||||
'MESSAGE_PLEASE_CHECK_ASSIGNED_USER_EMAILID'=>'请检查被分配的用户电子邮件id...',
|
||||
'MESSAGE_PLEASE_CHECK_THE_FROM_MAILID'=>'请检查电子邮件id',
|
||||
'MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID'=>'邮件不能寄发到这电子邮件id',
|
||||
'PLEASE_CHECK_THIS_EMAILID'=>'请检查这邮件id...',
|
||||
'LBL_CC_EMAIL_ERROR'=>'您的CC邮件ID不是适当的',
|
||||
'LBL_BCC_EMAIL_ERROR'=>'您的BCC邮件ID不是适当的',
|
||||
'LBL_NO_RCPTS_EMAIL_ERROR'=>'没有指定移植对象',
|
||||
'LBL_CONF_MAILSERVER_ERROR'=>'请设置您外部的邮件服务器 ---> 外出的服务器链接',
|
||||
'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail 客户',
|
||||
'LBL_MAILSELECT_INFO3'=>'您不能查看选择记录的邮件ID.',
|
||||
'LBL_NO_RECORDS' => '这个文件夹没有记录',
|
||||
//Added for script alerts
|
||||
'FEATURE_AVAILABLE_INFO' => '这个特点只支持Microsoft Internet Explorer 5.5+或更高!',
|
||||
'DOWNLOAD_CONFIRAMATION' => '您想要下载文件 ?',
|
||||
'LBL_PLEASE_ATTACH' => '请再尝试附上一个合法的文件',
|
||||
'LBL_KINDLY_UPLOAD' => '请配置 <font color="red">upload_tmp_dir</font> variable in php.ini file.',
|
||||
'LBL_EXCEED_MAX' => '抱歉, 上传的文件超出最大值极限。请尝试一个小文件 ',
|
||||
'LBL_BYTES' => ' 字节',
|
||||
'LBL_CHECK_USER_MAILID' => '请检查当前用户的电邮ID是否正确',
|
||||
|
||||
// Added/Updated for vtiger CRM 5.0.4
|
||||
'Activity Type'=>'任务类型',
|
||||
'LBL_MAILSELECT_INFO'=>'has the following Email IDs associated.Please Select the Email IDs to which,the mail should be sent',
|
||||
'LBL_NO_RECORDS' => 'No Records Found',
|
||||
'LBL_PRINT_EMAIL'=> 'Print',
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,535 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
require("modules/Emails/class.phpmailer.php");
|
||||
|
||||
/** Function used to send email
|
||||
* $module -- current module
|
||||
* $to_email -- to email address
|
||||
* $from_name -- currently loggedin user name
|
||||
* $from_email -- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
|
||||
* $subject -- subject of the email you want to send
|
||||
* $contents -- body of the email you want to send
|
||||
* $cc -- add email ids with comma seperated. - optional
|
||||
* $bcc -- add email ids with comma seperated. - optional.
|
||||
* $attachment -- whether we want to attach the currently selected file or all vtiger_files.[values = current,all] - optional
|
||||
* $emailid -- id of the email object which will be used to get the vtiger_attachments
|
||||
*/
|
||||
function send_mail($module,$to_email,$from_name,$from_email,$subject,$contents,$cc='',$bcc='',$attachment='',$emailid='',$logo='')
|
||||
{
|
||||
|
||||
global $adb, $log;
|
||||
global $root_directory;
|
||||
global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
|
||||
|
||||
$uploaddir = $root_directory ."/test/upload/";
|
||||
|
||||
$adb->println("To id => '".$to_email."'\nSubject ==>'".$subject."'\nContents ==> '".$contents."'");
|
||||
|
||||
//Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
|
||||
//$to_email = getUserEmailId('id',$assigned_user_id);
|
||||
|
||||
//if module is HelpDesk then from_email will come based on support email id
|
||||
if($from_email == '') {
|
||||
//if from email is not defined, then use the useremailid as the from address
|
||||
$from_email = getUserEmailId('user_name',$from_name);
|
||||
}
|
||||
|
||||
//if the newly defined from email field is set, then use this email address as the from address
|
||||
//and use the username as the reply-to address
|
||||
$query = "select * from vtiger_systems where server_type=?";
|
||||
$params = array('email');
|
||||
$result = $adb->pquery($query,$params);
|
||||
$from_email_field = $adb->query_result($result,0,'from_email_field');
|
||||
$replyToEmail = $from_email;
|
||||
if(isset($from_email_field) && $from_email_field!=''){
|
||||
//setting from _email to the defined email address in the outgoing server configuration
|
||||
$from_email = $from_email_field;
|
||||
}
|
||||
|
||||
if($module != "Calendar")
|
||||
$contents = addSignature($contents,$from_name);
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
setMailerProperties($mail,$subject,$contents,$from_email,$from_name,trim($to_email,","),$attachment,$emailid,$module,$logo);
|
||||
setCCAddress($mail,'cc',$cc);
|
||||
setCCAddress($mail,'bcc',$bcc);
|
||||
$mail->AddReplyTo($replyToEmail);
|
||||
|
||||
// vtmailscanner customization: If Support Reply to is defined use it.
|
||||
global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
|
||||
if($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
|
||||
$mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
|
||||
}
|
||||
// END
|
||||
|
||||
// Fix: Return immediately if Outgoing server not configured
|
||||
if(empty($mail->Host)) {
|
||||
return 0;
|
||||
}
|
||||
// END
|
||||
|
||||
$mail_status = MailSend($mail);
|
||||
|
||||
if($mail_status != 1)
|
||||
{
|
||||
$mail_error = getMailError($mail,$mail_status,$mailto);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mail_error = $mail_status;
|
||||
}
|
||||
|
||||
return $mail_error;
|
||||
}
|
||||
|
||||
/** Function to get the user Email id based on column name and column value
|
||||
* $name -- column name of the vtiger_users vtiger_table
|
||||
* $val -- column value
|
||||
*/
|
||||
function getUserEmailId($name,$val)
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside the function getUserEmailId. --- ".$name." = '".$val."'");
|
||||
if($val != '')
|
||||
{
|
||||
//$sql = "select email1, email2, yahoo_id from vtiger_users where ".$name." = '".$val."'";
|
||||
//done to resolve the PHP5 specific behaviour
|
||||
$sql = "SELECT email1, email2, yahoo_id from vtiger_users WHERE status='Active' AND ". $adb->sql_escape_string($name)." = ?";
|
||||
$res = $adb->pquery($sql, array($val));
|
||||
$email = $adb->query_result($res,0,'email1');
|
||||
if($email == '')
|
||||
{
|
||||
$email = $adb->query_result($res,0,'email2');
|
||||
if($email == '')
|
||||
{
|
||||
$email = $adb->query_result($res,0,'yahoo_id');
|
||||
}
|
||||
}
|
||||
$adb->println("Email id is selected => '".$email."'");
|
||||
return $email;
|
||||
}
|
||||
else
|
||||
{
|
||||
$adb->println("User id is empty. so return value is ''");
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/** Funtion to add the user's signature with the content passed
|
||||
* $contents -- where we want to add the signature
|
||||
* $fromname -- which user's signature will be added to the contents
|
||||
*/
|
||||
function addSignature($contents, $fromname)
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside the function addSignature");
|
||||
|
||||
$sign = nl2br($adb->query_result($adb->pquery("select signature from vtiger_users where user_name=?", array($fromname)),0,"signature"));
|
||||
if($sign != '')
|
||||
{
|
||||
$contents .= '<br><br>'.$sign;
|
||||
$adb->println("Signature is added with the body => '.".$sign."'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$adb->println("Signature is empty for the user => '".$fromname."'");
|
||||
}
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/** Function to set all the Mailer properties
|
||||
* $mail -- reference of the mail object
|
||||
* $subject -- subject of the email you want to send
|
||||
* $contents -- body of the email you want to send
|
||||
* $from_email -- from email id which will be displayed in the mail
|
||||
* $from_name -- from name which will be displayed in the mail
|
||||
* $to_email -- to email address -- This can be an email in a single string, a comma separated
|
||||
* list of emails or an array of email addresses
|
||||
* $attachment -- whether we want to attach the currently selected file or all vtiger_files.
|
||||
[values = current,all] - optional
|
||||
* $emailid -- id of the email object which will be used to get the vtiger_attachments - optional
|
||||
*/
|
||||
function setMailerProperties($mail,$subject,$contents,$from_email,$from_name,$to_email,$attachment='',$emailid='',$module='',$logo='')
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside the function setMailerProperties");
|
||||
if($module == "Support" || $logo ==1)
|
||||
$mail->AddEmbeddedImage('themes/images/logo_mail.jpg', 'logo', 'logo.jpg',"base64","image/jpg");
|
||||
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $contents;
|
||||
//$mail->Body = html_entity_decode(nl2br($contents)); //if we get html tags in mail then we will use this line
|
||||
$mail->AltBody = strip_tags(preg_replace(array("/<p>/i","/<br>/i","/<br \/>/i"),array("\n","\n","\n"),$contents));
|
||||
|
||||
$mail->IsSMTP(); //set mailer to use SMTP
|
||||
//$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server
|
||||
|
||||
setMailServerProperties($mail);
|
||||
|
||||
//Handle the from name and email for HelpDesk
|
||||
$mail->From = $from_email;
|
||||
$rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
|
||||
if($adb->num_rows($rs) > 0)
|
||||
$from_name = $adb->query_result($rs,0,"first_name")." ".$adb->query_result($rs,0,"last_name");
|
||||
|
||||
$mail->FromName = decode_html($from_name);
|
||||
|
||||
if($to_email != '')
|
||||
{
|
||||
if(is_array($to_email)) {
|
||||
for($j=0,$num=count($to_email);$j<$num;$j++) {
|
||||
$mail->addAddress($to_email[$j]);
|
||||
}
|
||||
} else {
|
||||
$_tmp = explode(",",$to_email);
|
||||
for($j=0,$num=count($_tmp);$j<$num;$j++) {
|
||||
$mail->addAddress($_tmp[$j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mail->AddReplyTo($from_email);
|
||||
$mail->WordWrap = 50;
|
||||
|
||||
//If we want to add the currently selected file only then we will use the following function
|
||||
if($attachment == 'current' && $emailid != '')
|
||||
{
|
||||
if (isset($_REQUEST['filename_hidden'])) {
|
||||
$file_name = $_REQUEST['filename_hidden'];
|
||||
} else {
|
||||
$file_name = $_FILES['filename']['name'];
|
||||
}
|
||||
addAttachment($mail,$file_name,$emailid);
|
||||
}
|
||||
|
||||
//This will add all the vtiger_files which are related to this record or email
|
||||
if($attachment == 'all' && $emailid != '')
|
||||
{
|
||||
addAllAttachments($mail,$emailid);
|
||||
}
|
||||
|
||||
$mail->IsHTML(true); // set email format to HTML
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Function to set the Mail Server Properties in the object passed
|
||||
* $mail -- reference of the mailobject
|
||||
*/
|
||||
function setMailServerProperties($mail)
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside the function setMailServerProperties");
|
||||
|
||||
$res = $adb->pquery("select * from vtiger_systems where server_type=?", array('email'));
|
||||
if(isset($_REQUEST['server']))
|
||||
$server = $_REQUEST['server'];
|
||||
else
|
||||
$server = $adb->query_result($res,0,'server');
|
||||
if(isset($_REQUEST['server_username']))
|
||||
$username = $_REQUEST['server_username'];
|
||||
else
|
||||
$username = $adb->query_result($res,0,'server_username');
|
||||
if(isset($_REQUEST['server_password']))
|
||||
$password = $_REQUEST['server_password'];
|
||||
else
|
||||
$password = $adb->query_result($res,0,'server_password');
|
||||
// Prasad: First time read smtp_auth from the request
|
||||
if(isset($_REQUEST['smtp_auth']))
|
||||
{
|
||||
$smtp_auth = $_REQUEST['smtp_auth'];
|
||||
if($smtp_auth == 'on')
|
||||
$smtp_auth = 'true';
|
||||
}
|
||||
else if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'Settings' && (!isset($_REQUEST['smtp_auth'])))
|
||||
{
|
||||
//added to avoid issue while editing the values in the outgoing mail server.
|
||||
$smtp_auth = 'false';
|
||||
}
|
||||
else
|
||||
$smtp_auth = $adb->query_result($res,0,'smtp_auth');
|
||||
|
||||
$adb->println("Mail server name,username & password => '".$server."','".$username."','".$password."'");
|
||||
if($smtp_auth == "true"){
|
||||
$mail->SMTPAuth = true; // turn on SMTP authentication
|
||||
}
|
||||
$mail->Host = $server; // specify main and backup server
|
||||
$mail->Username = $username ; // SMTP username
|
||||
$mail->Password = $password ; // SMTP password
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Function to add the file as attachment with the mail object
|
||||
* $mail -- reference of the mail object
|
||||
* $filename -- filename which is going to added with the mail
|
||||
* $record -- id of the record - optional
|
||||
*/
|
||||
function addAttachment($mail,$filename,$record)
|
||||
{
|
||||
global $adb, $root_directory;
|
||||
$adb->println("Inside the function addAttachment");
|
||||
$adb->println("The file name is => '".$filename."'");
|
||||
|
||||
//This is the file which has been selected in Email EditView
|
||||
if(is_file($filename) && $filename != '')
|
||||
{
|
||||
$mail->AddAttachment($root_directory."test/upload/".$filename);
|
||||
}
|
||||
}
|
||||
|
||||
/** Function to add all the vtiger_files as attachment with the mail object
|
||||
* $mail -- reference of the mail object
|
||||
* $record -- email id ie., record id which is used to get the all vtiger_attachments from database
|
||||
*/
|
||||
function addAllAttachments($mail,$record)
|
||||
{
|
||||
global $adb,$log, $root_directory;
|
||||
$adb->println("Inside the function addAllAttachments");
|
||||
|
||||
//Retrieve the vtiger_files from database where avoid the file which has been currently selected
|
||||
$sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid = vtiger_seattachmentsrel.attachmentsid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid where vtiger_crmentity.deleted=0 and vtiger_seattachmentsrel.crmid=?";
|
||||
$res = $adb->pquery($sql, array($record));
|
||||
$count = $adb->num_rows($res);
|
||||
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
$fileid = $adb->query_result($res,$i,'attachmentsid');
|
||||
$filename = decode_html($adb->query_result($res,$i,'name'));
|
||||
$filepath = $adb->query_result($res,$i,'path');
|
||||
$filewithpath = $root_directory.$filepath.$fileid."_".$filename;
|
||||
|
||||
//if the file is exist in test/upload directory then we will add directly
|
||||
//else get the contents of the file and write it as a file and then attach (this will occur when we unlink the file)
|
||||
if(is_file($filewithpath))
|
||||
{
|
||||
$mail->AddAttachment($filewithpath,$filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Function to set the CC or BCC addresses in the mail
|
||||
* $mail -- reference of the mail object
|
||||
* $cc_mod -- mode to set the address ie., cc or bcc
|
||||
* $cc_val -- addresss with comma seperated to set as CC or BCC in the mail
|
||||
*/
|
||||
function setCCAddress($mail,$cc_mod,$cc_val)
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside the functin setCCAddress");
|
||||
|
||||
if($cc_mod == 'cc')
|
||||
$method = 'AddCC';
|
||||
if($cc_mod == 'bcc')
|
||||
$method = 'AddBCC';
|
||||
if($cc_val != '')
|
||||
{
|
||||
$ccmail = explode(",",trim($cc_val,","));
|
||||
for($i=0;$i<count($ccmail);$i++)
|
||||
{
|
||||
$addr = $ccmail[$i];
|
||||
$cc_name = preg_replace('/([^@]+)@(.*)/', '$1', $addr); // First Part Of Email
|
||||
if(stripos($addr, '<')) {
|
||||
$name_addr_pair = explode("<",$ccmail[$i]);
|
||||
$cc_name = $name_addr_pair[0];
|
||||
$addr = trim($name_addr_pair[1],">");
|
||||
}
|
||||
if($ccmail[$i] != '')
|
||||
$mail->$method($addr,$cc_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Function to send the mail which will be called after set all the mail object values
|
||||
* $mail -- reference of the mail object
|
||||
*/
|
||||
function MailSend($mail)
|
||||
{
|
||||
global $log;
|
||||
$log->info("Inside of Send Mail function.");
|
||||
if(!$mail->Send())
|
||||
{
|
||||
$log->debug("Error in Mail Sending : Error log = '".$mail->ErrorInfo."'");
|
||||
return $mail->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->info("Mail has been sent from the vtigerCRM system : Status : '".$mail->ErrorInfo."'");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/** Function to get the Parent email id from HelpDesk to send the details about the ticket via email
|
||||
* $returnmodule -- Parent module value. Contact or Account for send email about the ticket details
|
||||
* $parentid -- id of the parent ie., contact or vtiger_account
|
||||
*/
|
||||
function getParentMailId($parentmodule,$parentid)
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside the function getParentMailId. \n parent module and id => ".$parentmodule."&".$parentid);
|
||||
|
||||
if($parentmodule == 'Contacts')
|
||||
{
|
||||
$tablename = 'vtiger_contactdetails';
|
||||
$idname = 'contactid';
|
||||
$first_email = 'email';
|
||||
$second_email = 'yahooid';
|
||||
}
|
||||
if($parentmodule == 'Accounts')
|
||||
{
|
||||
$tablename = 'vtiger_account';
|
||||
$idname = 'accountid';
|
||||
$first_email = 'email1';
|
||||
$second_email = 'email2';
|
||||
}
|
||||
if($parentid != '')
|
||||
{
|
||||
//$query = 'select * from '.$tablename.' where '.$idname.' = '.$parentid;
|
||||
$query = 'select * from '.$tablename.' where '. $idname.' = ?';
|
||||
$res = $adb->pquery($query, array($parentid));
|
||||
$mailid = $adb->query_result($res,0,$first_email);
|
||||
$mailid2 = $adb->query_result($res,0,$second_email);
|
||||
}
|
||||
if($mailid == '' && $mailid2 != '')
|
||||
$mailid = $mailid2;
|
||||
|
||||
return $mailid;
|
||||
}
|
||||
|
||||
/** Function to parse and get the mail error
|
||||
* $mail -- reference of the mail object
|
||||
* $mail_status -- status of the mail which is sent or not
|
||||
* $to -- the email address to whom we sent the mail and failes
|
||||
* return -- Mail error occured during the mail sending process
|
||||
*/
|
||||
function getMailError($mail,$mail_status,$to)
|
||||
{
|
||||
//Error types in class.phpmailer.php
|
||||
/*
|
||||
provide_address, mailer_not_supported, execute, instantiate, file_access, file_open, encoding, data_not_accepted, authenticate,
|
||||
connect_host, recipients_failed, from_failed
|
||||
*/
|
||||
|
||||
global $adb;
|
||||
$adb->println("Inside the function getMailError");
|
||||
|
||||
$msg = array_search($mail_status,$mail->language);
|
||||
$adb->println("Error message ==> ".$msg);
|
||||
|
||||
if($msg == 'connect_host')
|
||||
{
|
||||
$error_msg = $msg;
|
||||
}
|
||||
elseif(strstr($msg,'from_failed'))
|
||||
{
|
||||
$error_msg = $msg;
|
||||
}
|
||||
elseif(strstr($msg,'recipients_failed'))
|
||||
{
|
||||
$error_msg = $msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$adb->println("Mail error is not as connect_host or from_failed or recipients_failed");
|
||||
//$error_msg = $msg;
|
||||
}
|
||||
|
||||
$adb->println("return error => ".$error_msg);
|
||||
return $error_msg;
|
||||
}
|
||||
|
||||
/** Function to get the mail status string (string of sent mail status)
|
||||
* $mail_status_str -- concatenated string with all the error messages with &&& seperation
|
||||
* return - the error status as a encoded string
|
||||
*/
|
||||
function getMailErrorString($mail_status_str)
|
||||
{
|
||||
global $adb;
|
||||
$adb->println("Inside getMailErrorString function.\nMail status string ==> ".$mail_status_str);
|
||||
|
||||
$mail_status_str = trim($mail_status_str,"&&&");
|
||||
$mail_status_array = explode("&&&",$mail_status_str);
|
||||
$adb->println("All Mail status ==>\n".$mail_status_str."\n");
|
||||
|
||||
foreach($mail_status_array as $key => $val)
|
||||
{
|
||||
$list = explode("=",$val);
|
||||
$adb->println("Mail id & status ==> ".$list[0]." = ".$list[1]);
|
||||
if($list[1] == 0)
|
||||
{
|
||||
$mail_error_str .= $list[0]."=".$list[1]."&&&";
|
||||
}
|
||||
}
|
||||
$adb->println("Mail error string => '".$mail_error_str."'");
|
||||
if($mail_error_str != '')
|
||||
{
|
||||
$mail_error_str = 'mail_error='.base64_encode($mail_error_str);
|
||||
}
|
||||
return $mail_error_str;
|
||||
}
|
||||
|
||||
/** Function to parse the error string
|
||||
* $mail_error_str -- base64 encoded string which contains the mail sending errors as concatenated with &&&
|
||||
* return - Error message to display
|
||||
*/
|
||||
function parseEmailErrorString($mail_error_str)
|
||||
{
|
||||
//TODO -- we can modify this function for better email error handling in future
|
||||
global $adb, $mod_strings;
|
||||
$adb->println("Inside the parseEmailErrorString function.\n encoded mail error string ==> ".$mail_error_str);
|
||||
|
||||
$mail_error = base64_decode($mail_error_str);
|
||||
$adb->println("Original error string => ".$mail_error);
|
||||
$mail_status = explode("&&&",trim($mail_error,"&&&"));
|
||||
foreach($mail_status as $key => $val)
|
||||
{
|
||||
$status_str = explode("=",$val);
|
||||
$adb->println('Mail id => "'.$status_str[0].'".........status => "'.$status_str[1].'"');
|
||||
if($status_str[1] != 1 && $status_str[1] != '')
|
||||
{
|
||||
$adb->println("Error in mail sending");
|
||||
if($status_str[1] == 'connect_host')
|
||||
{
|
||||
$adb->println("if part - Mail sever is not configured");
|
||||
$errorstr .= '<br><b><font color=red>'.$mod_strings['MESSAGE_CHECK_MAIL_SERVER_NAME'].'</font></b>';
|
||||
break;
|
||||
}
|
||||
elseif($status_str[1] == '0')
|
||||
{
|
||||
$adb->println("first elseif part - status will be 0 which is the case of assigned to vtiger_users's email is empty.");
|
||||
$errorstr .= '<br><b><font color=red> '.$mod_strings['MESSAGE_MAIL_COULD_NOT_BE_SEND'].' '.$mod_strings['MESSAGE_PLEASE_CHECK_FROM_THE_MAILID'].'</font></b>';
|
||||
//Added to display the message about the CC && BCC mail sending status
|
||||
if($status_str[0] == 'cc_success')
|
||||
{
|
||||
$cc_msg = 'But the mail has been sent to CC & BCC addresses.';
|
||||
$errorstr .= '<br><b><font color=purple>'.$cc_msg.'</font></b>';
|
||||
}
|
||||
}
|
||||
elseif(strstr($status_str[1],'from_failed'))
|
||||
{
|
||||
$adb->println("second elseif part - from email id is failed.");
|
||||
$from = explode('from_failed',$status_str[1]);
|
||||
$errorstr .= "<br><b><font color=red>".$mod_strings['MESSAGE_PLEASE_CHECK_THE_FROM_MAILID']." '".$from[1]."'</font></b>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$adb->println("else part - mail send process failed due to the following reason.");
|
||||
$errorstr .= "<br><b><font color=red> ".$mod_strings['MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID']." '".$status_str[0]."'. ".$mod_strings['PLEASE_CHECK_THIS_EMAILID']."</font></b>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$adb->println("Return Error string => ".$errorstr);
|
||||
return $errorstr;
|
||||
}
|
||||
?>
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('include/database/PearDatabase.php');
|
||||
|
||||
|
||||
global $app_strings,$mod_strings,$current_user,$theme,$adb;
|
||||
$image_path = 'themes/'.$theme.'/images/';
|
||||
$idlist = vtlib_purify($_REQUEST['idlist']);
|
||||
$pmodule=vtlib_purify($_REQUEST['return_module']);
|
||||
$ids=explode(';',$idlist);
|
||||
$single_record = false;
|
||||
if(!strpos($idlist,':'))
|
||||
{
|
||||
$single_record = true;
|
||||
}
|
||||
$smarty = new vtigerCRM_Smarty;
|
||||
|
||||
$userid = $current_user->id;
|
||||
|
||||
$querystr = "select fieldid, fieldname, fieldlabel, columnname from vtiger_field where tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
|
||||
$res=$adb->pquery($querystr, array(getTabid($pmodule)));
|
||||
$numrows = $adb->num_rows($res);
|
||||
$returnvalue = Array();
|
||||
for($i = 0; $i < $numrows; $i++)
|
||||
{
|
||||
$value = Array();
|
||||
$fieldname = $adb->query_result($res,$i,"fieldname");
|
||||
$permit = getFieldVisibilityPermission($pmodule, $userid, $fieldname);
|
||||
if($permit == '0')
|
||||
{
|
||||
$temp=$adb->query_result($res,$i,'columnname');
|
||||
$columnlists [] = $temp;
|
||||
$fieldid=$adb->query_result($res,$i,'fieldid');
|
||||
$fieldlabel =$adb->query_result($res,$i,'fieldlabel');
|
||||
$value[] = getTranslatedString($fieldlabel);
|
||||
$returnvalue [$fieldid]= $value;
|
||||
}
|
||||
}
|
||||
|
||||
if($single_record && count($columnlists) > 0)
|
||||
{
|
||||
$count = 0;
|
||||
$val_cnt = 0;
|
||||
switch($pmodule)
|
||||
{
|
||||
case 'Accounts':
|
||||
$query = 'select accountname,'.implode(",",$columnlists).' from vtiger_account left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_account.accountid = ?';
|
||||
$result=$adb->pquery($query, array($idlist));
|
||||
foreach($columnlists as $columnname)
|
||||
{
|
||||
$acc_eval = $adb->query_result($result,0,$columnname);
|
||||
$field_value[$count++] = $acc_eval;
|
||||
if($acc_eval != "") $val_cnt++;
|
||||
|
||||
}
|
||||
$entity_name = $adb->query_result($result,0,'accountname');
|
||||
break;
|
||||
case 'Leads':
|
||||
$query = 'select concat(firstname," ",lastname) as leadname,'.implode(",",$columnlists).' from vtiger_leaddetails left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_leaddetails.leadid = ?';
|
||||
$result=$adb->pquery($query, array($idlist));
|
||||
foreach($columnlists as $columnname)
|
||||
{
|
||||
$lead_eval = $adb->query_result($result,0,$columnname);
|
||||
$field_value[$count++] = $lead_eval;
|
||||
if($lead_eval != "") $val_cnt++;
|
||||
}
|
||||
$entity_name = $adb->query_result($result,0,'leadname');
|
||||
break;
|
||||
case 'Contacts':
|
||||
$query = 'select concat(firstname," ",lastname) as contactname,'.implode(",",$columnlists).' from vtiger_contactdetails left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_contactdetails.contactid = ?';
|
||||
$result=$adb->pquery($query, array($idlist));
|
||||
foreach($columnlists as $columnname)
|
||||
{
|
||||
$con_eval = $adb->query_result($result,0,$columnname);
|
||||
$field_value[$count++] = $con_eval;
|
||||
if($con_eval != "") $val_cnt++;
|
||||
}
|
||||
$entity_name = $adb->query_result($result,0,'contactname');
|
||||
break;
|
||||
}
|
||||
}
|
||||
$smarty->assign('PERMIT',$permit);
|
||||
$smarty->assign('ENTITY_NAME',$entity_name);
|
||||
$smarty->assign('ONE_RECORD',$single_record);
|
||||
$smarty->assign('MAILDATA',$field_value);
|
||||
$smarty->assign('MAILINFO',$returnvalue);
|
||||
$smarty->assign("MOD", $mod_strings);
|
||||
$smarty->assign("IDLIST", $idlist);
|
||||
$smarty->assign("APP", $app_strings);
|
||||
$smarty->assign("FROM_MODULE", $pmodule);
|
||||
$smarty->assign("THEME", $theme);
|
||||
$smarty->assign("IMAGE_PATH",$image_path);
|
||||
if($single_record && count($columnlists) > 0 && $val_cnt > 0)
|
||||
$smarty->display("SelectEmail.tpl");
|
||||
else if(!$single_record && count($columnlists) > 0)
|
||||
$smarty->display("SelectEmail.tpl");
|
||||
else if($single_record && $val_cnt == 0)
|
||||
echo "No Mail Ids";
|
||||
else
|
||||
echo "Mail Ids not permitted";
|
||||
?>
|
||||
@@ -1,239 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once("include/utils/GetGroupUsers.php");
|
||||
require_once("include/utils/UserInfoUtil.php");
|
||||
|
||||
global $adb;
|
||||
global $current_user;
|
||||
|
||||
//set the return module and return action and set the return id based on return module and record
|
||||
$returnmodule = vtlib_purify($_REQUEST['return_module']);
|
||||
$returnaction = vtlib_purify($_REQUEST['return_action']);
|
||||
if((($returnmodule != 'Emails') || ($returnmodule == 'Emails' && $_REQUEST['record'] == '')) && $_REQUEST['return_id'] != '')
|
||||
{
|
||||
$returnid = vtlib_purify($_REQUEST['return_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$returnid = $focus->id;//$_REQUEST['record'];
|
||||
}
|
||||
|
||||
|
||||
$adb->println("\n\nMail Sending Process has been started.");
|
||||
//This function call is used to send mail to the assigned to user. In this mail CC and BCC addresses will be added.
|
||||
if($_REQUEST['assigntype' == 'T'] && $_REQUEST['assigned_group_id']!='')
|
||||
{
|
||||
$grp_obj = new GetGroupUsers();
|
||||
$grp_obj->getAllUsersInGroup($_REQUEST['assigned_group_id']);
|
||||
$users_list = constructList($grp_obj->group_users,'INTEGER');
|
||||
if (count($users_list) > 0) {
|
||||
$sql = "select first_name, last_name, email1, email2, yahoo_id from vtiger_users where id in (". generateQuestionMarks($users_list) .")";
|
||||
$params = array($users_list);
|
||||
} else {
|
||||
$sql = "select first_name, last_name, email1, email2, yahoo_id from vtiger_users";
|
||||
$params = array();
|
||||
}
|
||||
$res = $adb->pquery($sql, $params);
|
||||
$user_email = '';
|
||||
while ($user_info = $adb->fetch_array($res))
|
||||
{
|
||||
$email = $user_info['email1'];
|
||||
if($email == '' || $email == 'NULL')
|
||||
{
|
||||
$email = $user_info['email2'];
|
||||
if($email == '' || $email == 'NULL')
|
||||
{
|
||||
$email = $user_info['yahoo_id'];
|
||||
}
|
||||
}
|
||||
if($user_email=='')
|
||||
$user_email .= $user_info['first_name']." ".$user_info['last_name']."<".$email.">";
|
||||
else
|
||||
$user_email .= ",".$user_info['first_name']." ".$user_info['last_name']."<".$email.">";
|
||||
$email='';
|
||||
}
|
||||
$to_email = $user_email;
|
||||
}
|
||||
else
|
||||
{
|
||||
$to_email = getUserEmailId('id',$focus->column_fields["assigned_user_id"]);
|
||||
}
|
||||
$cc = $_REQUEST['ccmail'];
|
||||
$bcc = $_REQUEST['bccmail'];
|
||||
if($to_email == '' && $cc == '' && $bcc == '')
|
||||
{
|
||||
$adb->println("Mail Error : send_mail function not called because To email id of assigned to user, CC and BCC are empty");
|
||||
$mail_status_str = "'".$to_email."'=0&&&";
|
||||
$errorheader1 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query1 = "select email1 from vtiger_users where id =?";
|
||||
$res1 = $adb->pquery($query1, array($current_user->id));
|
||||
$val = $adb->query_result($res1,0,"email1");
|
||||
// $mail_status = send_mail('Emails',$to_email,$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$cc,$bcc,'all',$focus->id);
|
||||
|
||||
$query = 'update vtiger_emaildetails set email_flag ="SENT",from_email =? where emailid=?';
|
||||
$adb->pquery($query, array($val, $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
|
||||
{
|
||||
$errorheader1 = 1;
|
||||
$mail_status_str = $to_email."=".$mail_status."&&&";
|
||||
}
|
||||
elseif($mail_status == 1 && $to_email == '')//Mail send success only for CC and BCC but the 'to' email is empty
|
||||
{
|
||||
$adb->pquery($query, array($val, $focus->id));
|
||||
$errorheader1 = 1;
|
||||
$mail_status_str = "cc_success=0&&&";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mail_status_str = $to_email."=".$mail_status."&&&";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Added code from mysendmail.php which is contributed by Raju(rdhital)
|
||||
$parentid= $_REQUEST['parent_id'];
|
||||
$myids=explode("|",$parentid);
|
||||
$all_to_emailids = Array();
|
||||
$from_name = $current_user->user_name;
|
||||
$from_address = $current_user->column_fields['email1'];
|
||||
|
||||
for ($i=0;$i<(count($myids)-1);$i++)
|
||||
{
|
||||
$realid=explode("@",$myids[$i]);
|
||||
$nemail=count($realid);
|
||||
$mycrmid=$realid[0];
|
||||
if($realid[1] == -1)
|
||||
{
|
||||
//handle the mail send to vtiger_users
|
||||
$emailadd = $adb->query_result($adb->pquery("select email1 from vtiger_users where id=?", array($mycrmid)),0,'email1');
|
||||
$pmodule = 'Users';
|
||||
$description = getMergedDescription($_REQUEST['description'],$mycrmid,$pmodule);
|
||||
$mail_status = send_mail('Emails',$emailadd,$from_name,$from_address,$_REQUEST['subject'],$description,'','','all',$focus->id);
|
||||
$all_to_emailids []= $emailadd;
|
||||
$mail_status_str .= $emailadd."=".$mail_status."&&&";
|
||||
}
|
||||
else
|
||||
{
|
||||
//Send mail to vtiger_account or lead or contact based on their ids
|
||||
$pmodule=getSalesEntityType($mycrmid);
|
||||
for ($j=1;$j<$nemail;$j++)
|
||||
{
|
||||
$temp=$realid[$j];
|
||||
$myquery='Select columnname from vtiger_field where fieldid = ? and vtiger_field.presence in (0,2)';
|
||||
$fresult=$adb->pquery($myquery, array($temp));
|
||||
if ($pmodule=='Contacts')
|
||||
{
|
||||
require_once('modules/Contacts/Contacts.php');
|
||||
$myfocus = new Contacts();
|
||||
$myfocus->retrieve_entity_info($mycrmid,"Contacts");
|
||||
}
|
||||
elseif ($pmodule=='Accounts')
|
||||
{
|
||||
require_once('modules/Accounts/Accounts.php');
|
||||
$myfocus = new Accounts();
|
||||
$myfocus->retrieve_entity_info($mycrmid,"Accounts");
|
||||
}
|
||||
elseif ($pmodule=='Leads')
|
||||
{
|
||||
require_once('modules/Leads/Leads.php');
|
||||
$myfocus = new Leads();
|
||||
$myfocus->retrieve_entity_info($mycrmid,"Leads");
|
||||
}
|
||||
elseif ($pmodule=='Vendors')
|
||||
{
|
||||
require_once('modules/Vendors/Vendors.php');
|
||||
$myfocus = new Vendors();
|
||||
$myfocus->retrieve_entity_info($mycrmid,"Vendors");
|
||||
}
|
||||
else {
|
||||
// vtlib customization: Enabling mail send from other modules
|
||||
$myfocus = CRMEntity::getInstance($pmodule);
|
||||
$myfocus->retrieve_entity_info($mycrmid, $pmodule);
|
||||
// END
|
||||
}
|
||||
$fldname=$adb->query_result($fresult,0,"columnname");
|
||||
$emailadd=br2nl($myfocus->column_fields[$fldname]);
|
||||
|
||||
//This is to convert the html encoded string to original html entities so that in mail description contents will be displayed correctly
|
||||
//$focus->column_fields['description'] = from_html($focus->column_fields['description']);
|
||||
|
||||
if($emailadd != '')
|
||||
{
|
||||
$description = getMergedDescription($_REQUEST['description'],$mycrmid,$pmodule);
|
||||
//Email Open Tracking
|
||||
global $site_URL, $application_unique_key;
|
||||
$emailid = $focus->id;
|
||||
$track_URL = "$site_URL/modules/Emails/TrackAccess.php?record=$mycrmid&mailid=$emailid&app_key=$application_unique_key";
|
||||
$description = "<img src='$track_URL' alt='' width='1' height='1'>$description";
|
||||
// END
|
||||
|
||||
$pos = strpos($description, '$logo$');
|
||||
if ($pos !== false)
|
||||
{
|
||||
|
||||
$description =str_replace('$logo$','<img src="cid:logo" />',$description);
|
||||
$logo=1;
|
||||
}
|
||||
if(isPermitted($pmodule,'DetailView',$mycrmid) == 'yes')
|
||||
{
|
||||
$mail_status = send_mail('Emails',$emailadd,$from_name,$from_address,$_REQUEST['subject'],$description,'','','all',$focus->id,$logo);
|
||||
}
|
||||
|
||||
$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
|
||||
if($errorheader1 == 1 || $errorheader2 == 1)
|
||||
{
|
||||
$returnset = 'return_module='.$returnmodule.'&return_action='.$returnaction.'&return_id='.vtlib_purify($_REQUEST['return_id']);
|
||||
$returnmodule = 'Emails';
|
||||
$returnaction = 'EditView';
|
||||
//This condition is added to set the record(email) id when we click on send mail button after returning mail error
|
||||
if($_REQUEST['mode'] == 'edit')
|
||||
{
|
||||
$returnid = $_REQUEST['record'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$returnid = $_REQUEST['currentid'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
global $adb;
|
||||
$date_var = date('Ymd');
|
||||
$query = 'update vtiger_activity set date_start =? where activityid = ?';
|
||||
$adb->pquery($query, array($date_var, $returnid));
|
||||
}
|
||||
//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");
|
||||
if(isset($_REQUEST['popupaction']) && $_REQUEST['popupaction'] != '')
|
||||
{
|
||||
/*this will fix #1211*/
|
||||
$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
|
||||
//$inputs="<script>window.self.close();</script>";
|
||||
echo $inputs;
|
||||
}
|
||||
?>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/database/PearDatabase.php');
|
||||
global $adb, $currentModule;
|
||||
$idlist = vtlib_purify($_REQUEST['idlist']);
|
||||
$record = vtlib_purify($_REQUEST["parentid"]);
|
||||
|
||||
$storearray = array();
|
||||
if(!empty($_REQUEST['idlist'])) {
|
||||
// Split the string of ids
|
||||
$storearray = explode (";",trim($idlist,";"));
|
||||
} else if(!empty($_REQUEST['entityid'])){
|
||||
$storearray = array($_REQUEST['entityid']);
|
||||
}
|
||||
foreach($storearray as $id)
|
||||
{
|
||||
if($id != '')
|
||||
{
|
||||
$sql = "insert into vtiger_seactivityrel values (?,?)";
|
||||
$adb->pquery($sql, array($id, $record));
|
||||
}
|
||||
}
|
||||
if(isset($_REQUEST['user_id']) && $_REQUEST['user_id'] != '')
|
||||
{
|
||||
$record = $_REQUEST['record'];
|
||||
$sql = "insert into vtiger_salesmanactivityrel values (?,?)";
|
||||
$adb->pquery($sql, array($_REQUEST["user_id"], $record));
|
||||
}
|
||||
|
||||
header("Location: index.php?action=CallRelatedList&module=Emails&record=".vtlib_purify($record));
|
||||
|
||||
?>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once("modules/Emails/mail.php");
|
||||
if($_REQUEST['from_add'] == '')
|
||||
{
|
||||
$from_name = $current_user->user_name;
|
||||
$from_add = $current_user->column_fields['email1'];
|
||||
}
|
||||
else{
|
||||
$from_arr = explode('@',$_REQUEST['from_add']);
|
||||
$from_name = $from_arr[0];
|
||||
$from_add = $_REQUEST['from_add'];
|
||||
}
|
||||
$mail_status = send_mail('Emails',$_REQUEST["parent_name"],$from_name,$from_add,$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST["ccmail"],$_REQUEST["bccmail"],'all',$focus->id);
|
||||
|
||||
$query = "update vtiger_emaildetails set email_flag ='SENT' where emailid=?";
|
||||
$adb->pquery($query, array($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
|
||||
$errorheader1 = 1;
|
||||
$mail_status_str = $to_email."=".$mail_status."&&&";
|
||||
|
||||
} elseif($mail_status == 1 && $to_email == '') { //Mail send success only for CC and BCC but the 'to' email is empty
|
||||
$adb->pquery($query, array($focus->id));
|
||||
$errorheader1 = 1;
|
||||
$mail_status_str = "cc_success=0&&&";
|
||||
} else
|
||||
$mail_status_str = $to_email."=".$mail_status."&&&";
|
||||
|
||||
|
||||
|
||||
//Added to redirect the page to Emails/EditView if there is an error in mail sending
|
||||
if($errorheader1 == 1 || $errorheader2 == 1)
|
||||
{
|
||||
$returnset = 'return_module='.$returnmodule.'&return_action='.$returnaction.'&return_id='.vtlib_purify($_REQUEST['return_id']);
|
||||
$returnmodule = 'Emails';
|
||||
$returnaction = 'EditView';
|
||||
if($_REQUEST['mode'] == 'edit')
|
||||
$returnid = $_REQUEST['record'];
|
||||
else
|
||||
$returnid = $_REQUEST['currentid'];
|
||||
}
|
||||
|
||||
//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");
|
||||
|
||||
if(isset($_REQUEST['popupaction']) && $_REQUEST['popupaction'] != '')
|
||||
{
|
||||
$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
|
||||
echo $inputs;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user