更新到 5.2 正式版后第一次 SVN 提交。

[email protected]


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@587 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-16 02:05:03 +00:00
parent a13db451e7
commit e79b344aa7
51 changed files with 25480 additions and 0 deletions
@@ -0,0 +1,110 @@
<?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');
//Redirecting Header for single page layout
require_once('user_privileges/default_module_view.php');
global $singlepane_view;
$currentmodule = vtlib_purify($_REQUEST['module']);
$RECORD = vtlib_purify($_REQUEST['record']);
$category = getParentTab();
if($singlepane_view == 'true' && $_REQUEST['action'] == 'CallRelatedList') {
header("Location:index.php?action=DetailView&module=$currentmodule&record=$RECORD&parenttab=$category");
} else {
$focus = CRMEntity::getInstance($currentmodule);
if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
$focus->retrieve_entity_info($RECORD,$currentmodule);
$focus->id = $RECORD;
$focus->name=$focus->column_fields['firstname'].' '.$focus->column_fields['lastname'];
$log->debug("id is ".$focus->id);
$log->debug("name is ".$focus->name);
}
global $adb;
$sql = $adb->pquery('select accountid from vtiger_contactdetails where contactid=?', array($focus->id));
$accountid = $adb->query_result($sql,0,'accountid');
if($accountid == 0) $accountid='';
global $mod_strings;
global $app_strings;
global $theme;
global $currentModule;
global $current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
$smarty->assign("accountid",$accountid);
if(isset($_request['isduplicate']) && $_request['isduplicate'] == 'true') {
$focus->id = "";
}
if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
$smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode']));
}
$parent_email = getEmailParentsList('Contacts',$_REQUEST['record'], $focus);
$smarty->assign("HIDDEN_PARENTS_LIST",$parent_email);
if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
$userid = $current_user->id;
$sql = "select fieldname from vtiger_field where uitype = '13' and tabid = 4 and vtiger_field.presence in (0,2)";
$result = $adb->pquery($sql, array());
$num_fieldnames = $adb->num_rows($result);
for($i = 0; $i < $num_fieldnames; $i++) {
$fieldname = $adb->query_result($result,$i,"fieldname");
$permit= getFieldVisibilityPermission("Contacts",$userid,$fieldname);
}
}
$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
$smarty->assign("CONTACT_PERMISSION",CheckFieldPermission('contact_id','Calendar'));
$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
$smarty->assign("CATEGORY",$category);
$smarty->assign("ID",$focus->id);
$smarty->assign("NAME",$focus->name);
$smarty->assign("EMAIL",$focus->column_fields['email']);
$smarty->assign("YAHOO",$focus->column_fields['yahooid']);
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if ($mod_seq_field != null) {
$mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
} else {
$mod_seq_id = $focus->id;
}
$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
// END
$related_array = getRelatedLists($currentModule,$focus);
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("RELATEDLISTS", $related_array);
$smarty->assign("MODULE",$currentmodule);
$smarty->assign("SINGLE_MOD",$app_strings['Contact']);
$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");
}
?>
@@ -0,0 +1,250 @@
/*********************************************************************************
** 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.
********************************************************************************/
document.write("<script type='text/javascript' src='include/js/Mail.js'></"+"script>");
document.write("<script type='text/javascript' src='include/js/Merge.js'></"+"script>");
function copyAddressRight(form) {
if(typeof(form.otherstreet) != 'undefined' && typeof(form.mailingstreet) != 'undefined')
form.otherstreet.value = form.mailingstreet.value;
if(typeof(form.othercity) != 'undefined' && typeof(form.mailingcity) != 'undefined')
form.othercity.value = form.mailingcity.value;
if(typeof(form.otherstate) != 'undefined' && typeof(form.mailingstate) != 'undefined')
form.otherstate.value = form.mailingstate.value;
if(typeof(form.otherzip) != 'undefined' && typeof(form.mailingzip) != 'undefined')
form.otherzip.value = form.mailingzip.value;
if(typeof(form.othercountry) != 'undefined' && typeof(form.mailingcountry) != 'undefined')
form.othercountry.value = form.mailingcountry.value;
if(typeof(form.otherpobox) != 'undefined' && typeof(form.mailingpobox) != 'undefined')
form.otherpobox.value = form.mailingpobox.value;
return true;
}
function copyAddressLeft(form) {
if(typeof(form.otherstreet) != 'undefined' && typeof(form.mailingstreet) != 'undefined')
form.mailingstreet.value = form.otherstreet.value;
if(typeof(form.othercity) != 'undefined' && typeof(form.mailingcity) != 'undefined')
form.mailingcity.value = form.othercity.value;
if(typeof(form.otherstate) != 'undefined' && typeof(form.mailingstate) != 'undefined')
form.mailingstate.value = form.otherstate.value;
if(typeof(form.otherzip) != 'undefined' && typeof(form.mailingzip) != 'undefined')
form.mailingzip.value = form.otherzip.value;
if(typeof(form.othercountry) != 'undefined' && typeof(form.mailingcountry) != 'undefined')
form.mailingcountry.value = form.othercountry.value;
if(typeof(form.otherpobox) != 'undefined' && typeof(form.mailingpobox) != 'undefined')
form.mailingpobox.value = form.otherpobox.value;
return true;
}
function toggleDisplay(id){
if(this.document.getElementById( id).style.display=='none'){
this.document.getElementById( id).style.display='inline'
this.document.getElementById(id+"link").style.display='none';
}else{
this.document.getElementById( id).style.display='none'
this.document.getElementById(id+"link").style.display='none';
}
}
function set_return(product_id, product_name) {
if(document.getElementById('from_link').value != '') {
window.opener.document.QcEditView.parent_name.value = product_name;
window.opener.document.QcEditView.parent_id.value = product_id;
} else {
window.opener.document.EditView.parent_name.value = product_name;
window.opener.document.EditView.parent_id.value = product_id;
}
}
function add_data_to_relatedlist_incal(id,name)
{
var idval = window.opener.document.EditView.contactidlist.value;
var nameval = window.opener.document.EditView.contactlist.value;
if(idval != '')
{
if(idval.indexOf(id) != -1)
{
window.opener.document.EditView.contactidlist.value = idval;
window.opener.document.EditView.contactlist.value = nameval;
}
else
{
window.opener.document.EditView.contactidlist.value = idval+';'+id;
if(name != '')
{
// this has been modified to provide delete option for Contacts in Calendar
//this function is defined in script.js ------- Jeri
window.opener.addOption(id,name);
}
}
}
else
{
window.opener.document.EditView.contactidlist.value = id;
if(name != '')
{
window.opener.addOption(id,name);
}
//end
}
}
function set_return_specific(product_id, product_name) {
//Used for DetailView, Removed 'EditView' formname hardcoding
var fldName = getOpenerObj("contact_name");
var fldId = getOpenerObj("contact_id");
fldName.value = product_name;
fldId.value = product_id;
}
//only for Todo
function set_return_toDospecific(product_id, product_name) {
var fldName = getOpenerObj("task_contact_name");
var fldId = getOpenerObj("task_contact_id");
fldName.value = product_name;
fldId.value = product_id;
}
function submitform(id){
document.massdelete.entityid.value=id;
document.massdelete.submit();
}
function searchMapLocation(addressType)
{
var mapParameter = '';
if (addressType == 'Main')
{
if(fieldname.indexOf('mailingstreet') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingstreet')]))
mapParameter = document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingstreet')]).innerHTML+' ';
}
if(fieldname.indexOf('mailingpobox') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingpobox')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingpobox')]).innerHTML+' ';
}
if(fieldname.indexOf('mailingcity') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingcity')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingcity')]).innerHTML+' ';
}
if(fieldname.indexOf('mailingstate') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingstate')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingstate')]).innerHTML+' ';
}
if(fieldname.indexOf('mailingcountry') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingcountry')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingcountry')]).innerHTML+' ';
}
if(fieldname.indexOf('mailingzip') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingzip')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('mailingzip')]).innerHTML;
}
}
else if (addressType == 'Other')
{
if(fieldname.indexOf('otherstreet') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherstreet')]))
mapParameter = document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherstreet')]).innerHTML+' ';
}
if(fieldname.indexOf('otherpobox') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherpobox')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherpobox')]).innerHTML+' ';
}
if(fieldname.indexOf('othercity') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('othercity')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('othercity')]).innerHTML+' ';
}
if(fieldname.indexOf('otherstate') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherstate')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherstate')]).innerHTML+' ';
}
if(fieldname.indexOf('othercountry') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('othercountry')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('othercountry')]).innerHTML+' ';
}
if(fieldname.indexOf('otherzip') > -1)
{
if(document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherzip')]))
mapParameter = mapParameter + document.getElementById("dtlview_"+fieldlabel[fieldname.indexOf('otherzip')]).innerHTML;
}
}
mapParameter = removeHTMLFormatting(mapParameter);
window.open('http://maps.google.com/maps?q='+mapParameter,'goolemap','height=450,width=700,resizable=no,titlebar,location,top=200,left=250');
}
function set_return_contact_address(contact_id,contact_name, mailingstreet, otherstreet, mailingcity, othercity, mailingstate, otherstate, mailingcode, othercode, mailingcountry, othercountry,mailingpobox,otherpobox,formName) {
if (formName == null || formName == '') formName = 'EditView';
else {
// In case formName is specified but does not exists then revert to EditView form
if(window.opener.document.forms[formName] == null) formName = 'EditView';
}
var form = window.opener.document.forms[formName];
form.contact_name.value = contact_name;
form.contact_id.value = contact_id;
if(typeof(form.bill_street) != 'undefined')
if(confirm(alert_arr.OVERWRITE_EXISTING_CONTACT1+contact_name+alert_arr.OVERWRITE_EXISTING_CONTACT2))
{
//made changes to avoid js error -- ref : hidding fields causes js error(ticket#4017)
if(typeof(form.bill_street) != 'undefined')
form.bill_street.value = mailingstreet;
if(typeof(form.ship_street) != 'undefined')
form.ship_street.value = otherstreet;
if(typeof(form.bill_city) != 'undefined')
form.bill_city.value = mailingcity;
if(typeof(form.ship_city) != 'undefined')
form.ship_city.value = othercity;
if(typeof(form.bill_state) != 'undefined')
form.bill_state.value = mailingstate;
if(typeof(form.ship_state) != 'undefined')
form.ship_state.value = otherstate;
if(typeof(form.bill_code) != 'undefined')
form.bill_code.value = mailingcode;
if(typeof(form.ship_code) != 'undefined')
form.ship_code.value = othercode;
if(typeof(form.bill_country) != 'undefined')
form.bill_country.value = mailingcountry;
if(typeof(form.ship_country) != 'undefined')
form.ship_country.value = othercountry;
if(typeof(form.bill_pobox) != 'undefined')
form.bill_pobox.value = mailingpobox;
if(typeof(form.ship_pobox) != 'undefined')
form.ship_pobox.value = otherpobox;
//end
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
<?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/Ajax/CommonAjax.php');
?>
@@ -0,0 +1,12 @@
<?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/CustomAction.php');
?>
@@ -0,0 +1,14 @@
<?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');
?>
@@ -0,0 +1,52 @@
<?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.
*
********************************************************************************/
function DelImage($id)
{
global $adb;
$query= "select vtiger_seattachmentsrel.attachmentsid from vtiger_seattachmentsrel inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_seattachmentsrel.attachmentsid where vtiger_crmentity.setype='Contacts Image' and vtiger_seattachmentsrel.crmid=?";
$result = $adb->pquery($query, array($id));
$attachmentsid = $adb->query_result($result,$i,"attachmentsid");
$rel_delquery='delete from vtiger_seattachmentsrel where crmid=? and attachmentsid=?';
$adb->pquery($rel_delquery, array($id, $attachmentsid));
$crm_delquery="delete from vtiger_crmentity where crmid=?";
$adb->pquery($crm_delquery, array($attachmentsid));
$base_query="update vtiger_contactdetails set imagename='' where contactid=?";
$adb->pquery($base_query, array($id));
}
function DelAttachment($id)
{
global $adb;
$selresult = $adb->pquery("select name,path from vtiger_attachments where attachmentsid=?", array($id));
unlink($adb->query_result($selresult,0,'path').$id."_".$adb->query_result($selresult,0,'name'));
$query="delete from vtiger_seattachmentsrel where attachmentsid=?";
$adb->pquery($query, array($id));
$query="delete from vtiger_attachments where attachmentsid=?";
$adb->pquery($query, array($id));
}
$id = $_REQUEST["recordid"];
if(isset($_REQUEST["attachmodule"]) && $_REQUEST["attachmodule"]=='Emails')
{
DelAttachment($id);
}
else
{
DelImage($id);
}
echo 'SUCCESS';
?>
@@ -0,0 +1,39 @@
<?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/Contacts/Delete.php,v 1.9 2005/04/18 10:37:49 samk Exp $
* Description: TODO: To be written.
********************************************************************************/
global $currentModule;
$focus = CRMEntity::getInstance($currentModule);
global $mod_strings;
require_once('include/logging.php');
$log = LoggerManager::getLogger('contact_delete');
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if(!isset($_REQUEST['record']))
die($mod_strings['ERR_DELETE_RECORD']);
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
$parenttab = getParentTab();
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action'])."&parenttab=$parenttab&activity_mode=".vtlib_purify($_REQUEST['activity_mode'])."&record=".vtlib_purify($_REQUEST['return_id'])."&relmodule=".vtlib_purify($_REQUEST['module']).$url);
?>
@@ -0,0 +1,190 @@
<?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/Contacts/DetailView.php,v 1.38 2005/04/25 05:04:46 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/CustomFieldUtil.php');
require_once('include/utils/utils.php');
require_once('user_privileges/default_module_view.php');
global $log;
global $mod_strings;
global $app_strings;
global $currentModule, $singlepane_view;
$focus = CRMEntity::getInstance($currentModule);
if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
//Display the error message
if($_SESSION['image_type_error'] != '')
{
echo '<font color="red">'.$_SESSION['image_type_error'].'</font>';
session_unregister('image_type_error');
}
$focus->id=$_REQUEST['record'];
$focus->retrieve_entity_info($_REQUEST['record'],'Contacts');
$log->info("Entity info successfully retrieved for Contact DetailView.");
$focus->firstname=$focus->column_fields['firstname'];
$focus->lastname=$focus->column_fields['lastname'];
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
global $theme, $current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$log->info("Contact detail view");
$smarty = new vtigerCRM_Smarty;
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
if(useInternalMailer() == 1)
$smarty->assign("INT_MAILER","true");
$contact_name = $focus->lastname;
if (getFieldVisibilityPermission($currentModule, $current_user->id,'firstname') == '0') {
$contact_name .= ' '.$focus->firstname;
}
$smarty->assign("NAME",$contact_name);
$log->info("Detail Block Informations successfully retrieved.");
$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
$smarty->assign("CUSTOMFIELD", $cust_fld);
$smarty->assign("SINGLE_MOD", 'Contact');
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if ($mod_seq_field != null) {
$mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
} else {
$mod_seq_id = $focus->id;
}
$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
// END
$smarty->assign("ID", $_REQUEST['record']);
if(isPermitted("Contacts","EditView",$_REQUEST['record']) == 'yes')
$smarty->assign("EDIT_DUPLICATE","permitted");
if(isPermitted("Contacts","Delete",$_REQUEST['record']) == 'yes')
$smarty->assign("DELETE","permitted");
if(isPermitted("Emails","EditView",'') == 'yes')
{
//Added to pass the parents list as hidden for Emails -- 09-11-2005
$parent_email = getEmailParentsList('Contacts',$_REQUEST['record'], $focus);
$smarty->assign("HIDDEN_PARENTS_LIST",$parent_email);
$smarty->assign("SENDMAILBUTTON","permitted");
$smarty->assign("EMAIL1",$focus->column_fields['email']);
$smarty->assign("EMAIL2",$focus->column_fields['yahooid']);
}
if(isPermitted("Contacts","Merge",'') == 'yes')
{
global $current_user;
require("user_privileges/user_privileges_".$current_user->id.".php");
require_once('include/utils/UserInfoUtil.php');
$wordTemplateResult = fetchWordTemplateList("Contacts");
$tempCount = $adb->num_rows($wordTemplateResult);
$tempVal = $adb->fetch_array($wordTemplateResult);
for($templateCount=0;$templateCount<$tempCount;$templateCount++)
{
$optionString[$tempVal["templateid"]]=$tempVal["filename"];
$tempVal = $adb->fetch_array($wordTemplateResult);
}
if($is_admin)
$smarty->assign("MERGEBUTTON","permitted");
elseif($tempCount >0)
$smarty->assign("MERGEBUTTON","permitted");
$smarty->assign("TEMPLATECOUNT",$tempCount);
$smarty->assign("WORDTEMPLATEOPTIONS",$app_strings['LBL_SELECT_TEMPLATE_TO_MAIL_MERGE']);
$smarty->assign("TOPTIONS",$optionString);
}
//Security check for related list
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$tabid = getTabid("Contacts");
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
$smarty->assign("MODULE",$currentModule);
$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record']));
$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule));
$smarty->assign("USE_ASTERISK", get_use_asterisk($current_user->id));
$sql = $adb->pquery('select accountid from vtiger_contactdetails where contactid=?', array($focus->id));
$accountid = $adb->query_result($sql,0,'accountid');
if($accountid == 0) $accountid='';
$smarty->assign("accountid",$accountid);
if($singlepane_view == 'true')
{
$related_array = getRelatedLists($currentModule,$focus);
$smarty->assign("RELATEDLISTS", $related_array);
require_once('include/ListView/RelatedListViewSession.php');
if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']),
vtlib_purify($_REQUEST['selected_header']));
}
$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
$smarty->assign("SELECTEDHEADERS", $open_related_modules);
}
$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
$smarty->assign("CONTACT_PERMISSION",CheckFieldPermission('contact_id','Calendar'));
$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
$smarty->assign("SinglePane_View", $singlepane_view);
if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){
$recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id);
}
// Record Change Notification
$focus->markAsViewed($current_user->id);
// END
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE'=>$currentModule, 'RECORD'=>$focus->id, 'ACTION'=>vtlib_purify($_REQUEST['action']));
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('DETAILVIEWBASIC','DETAILVIEW','DETAILVIEWWIDGET'), $customlink_params));
$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
$smarty->display("DetailView.tpl");
?>
@@ -0,0 +1,107 @@
<?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('ContactsAjax');
global $currentModule;
$modObj = CRMEntity::getInstance($currentModule);
$ajaxaction = $_REQUEST["ajxaction"];
if($ajaxaction == "DETAILVIEW")
{
$crmid = $_REQUEST["recordid"];
$tablename = $_REQUEST["tableName"];
$fieldname = $_REQUEST["fldName"];
$fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
if($crmid != "")
{
$modObj->retrieve_entity_info($crmid,"Contacts");
$modObj->column_fields[$fieldname] = $fieldvalue;
$modObj->id = $crmid;
$modObj->mode = "edit";
$modObj->save("Contacts");
$email_res = $adb->pquery("select email from vtiger_contactdetails where contactid=?", array($modObj->id));
$email = $adb->query_result($email_res,0,'email');
$check_available = $adb->pquery("select * from vtiger_portalinfo where id=?", array($modObj->id));
$update = '';
if($fieldname =='email')
{
$active = $adb->query_result($check_available,0,'isactive');
$update = false;
if($active != '' && $active == 1)
{
$sql = "update vtiger_portalinfo set user_name=?,isactive=? where id=?";
$adb->pquery($sql, array($fieldvalue, $active, $crmid));
$email = $fieldvalue;
$result = $adb->pquery("select user_password from vtiger_portalinfo where id=?", array($modObj->id));
$password = $adb->query_result($result,0,'user_password');
$update = true;
}
}
if($fieldname == "portal")
{
if($email != '')
{
$confirm = $adb->query_result($check_available,0,'isactive');
if($confirm == '' && $fieldvalue == 1)
{
$password = makeRandomPassword();
$sql = "insert into vtiger_portalinfo (id,user_name,user_password,type,isactive) values(?,?,?,?,?)";
$params = array($modObj->id, $email, $password, 'C', 1);
$adb->pquery($sql, $params);
$insert = true;
}
elseif($confirm == 0 && $fieldvalue == 1)
{
$sql = "update vtiger_portalinfo set user_name=?, isactive=1 where id=?";
$params = array($email, $modObj->id);
$adb->pquery($sql, $params);
$result = $adb->pquery("select user_password from vtiger_portalinfo where id=?", array($modObj->id));
$password = $adb->query_result($result,0,'user_password');
$update = true;
}
elseif($confirm == 1 && $fieldvalue == 0)
{
$sql = "update vtiger_portalinfo set isactive=0 where id=?";
$adb->pquery($sql, array($modObj->id));
}
}
}
require_once("modules/Emails/mail.php");
global $current_user;
$data_array = Array();
$data_array['first_name'] = $modObj->column_fields['firstname'];
$data_array['last_name'] = $modObj->column_fields['lastname'];
$data_array['email'] = $email;
$data_array['portal_url'] = "<a href=".$PORTAL_URL."/login.php>".$mod_strings['Please Login Here']."</a>";
$contents = getmail_contents_portalUser($data_array,$password);
if($modObj->id != "")
{
echo ":#:SUCCESS";
}else
{
echo ":#:FAILURE";
}
}else
{
echo ":#:FAILURE";
}
} elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE"){
require_once 'include/ListView/RelatedListViewContents.php';
}
?>
@@ -0,0 +1,239 @@
<?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/Contacts/EditView.php,v 1.21 2005/03/24 16:18:38 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/CustomFieldUtil.php');
require_once('include/utils/utils.php');
global $log,$mod_strings,$app_strings,$theme,$currentModule,$current_user;
//added for contact image
$encode_val=vtlib_purify($_REQUEST['encode_val']);
$decode_val=base64_decode($encode_val);
$saveimage=isset($_REQUEST['saveimage'])?vtlib_purify($_REQUEST['saveimage']):"false";
$errormessage=isset($_REQUEST['error_msg'])?vtlib_purify($_REQUEST['error_msg']):"false";
$image_error=isset($_REQUEST['image_error'])?vtlib_purify($_REQUEST['image_error']):"false";
//end
$focus = CRMEntity::getInstance($currentModule);
$smarty = new vtigerCRM_Smarty;
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '')
{
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'],"Contacts");
$log->info("Entity info successfully retrieved for EditView.");
$focus->firstname=$focus->column_fields['firstname'];
$focus->lastname=$focus->column_fields['lastname'];
}
if($image_error=="true")
{
$explode_decode_val=explode("&",$decode_val);
for($i=1;$i<count($explode_decode_val);$i++)
{
$test=$explode_decode_val[$i];
$values=explode("=",$test);
$field_name_val=$values[0];
$field_value=$values[1];
$focus->column_fields[$field_name_val]=$field_value;
}
}
if(isset($_REQUEST['account_id']) && $_REQUEST['account_id']!='' && $_REQUEST['record']=='')
{
require_once('modules/Accounts/Accounts.php');
$focus->column_fields['account_id'] = $_REQUEST['account_id'];
$acct_focus = new Accounts();
$acct_focus->retrieve_entity_info($_REQUEST['account_id'],"Accounts");
$focus->column_fields['fax']=$acct_focus->column_fields['fax'];
$focus->column_fields['otherphone']=$acct_focus->column_fields['phone'];
$focus->column_fields['mailingcity']=$acct_focus->column_fields['bill_city'];
$focus->column_fields['othercity']=$acct_focus->column_fields['ship_city'];
$focus->column_fields['mailingstreet']=$acct_focus->column_fields['bill_street'];
$focus->column_fields['otherstreet']=$acct_focus->column_fields['ship_street'];
$focus->column_fields['mailingstate']=$acct_focus->column_fields['bill_state'];
$focus->column_fields['otherstate']=$acct_focus->column_fields['ship_state'];
$focus->column_fields['mailingzip']=$acct_focus->column_fields['bill_code'];
$focus->column_fields['otherzip']=$acct_focus->column_fields['ship_code'];
$focus->column_fields['mailingcountry']=$acct_focus->column_fields['bill_country'];
$focus->column_fields['othercountry']=$acct_focus->column_fields['ship_country'];
$focus->column_fields['mailingpobox']=$acct_focus->column_fields['bill_pobox'];
$focus->column_fields['otherpobox']=$acct_focus->column_fields['ship_pobox'];
$log->debug("Accountid Id from the request is ".$_REQUEST['account_id']);
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
{
$focus->id = "";
$focus->mode = "";
}
if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
setObjectValuesFromRequest($focus);
}
$disp_view = getView($focus->mode);
if($disp_view == 'edit_view')
$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
else
{
$smarty->assign("BASBLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS'));
$smarty->assign("ADVBLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'ADV'));
}
$smarty->assign("OP_MODE",$disp_view);
//needed when creating a new contact with a default vtiger_account value passed in
if (isset($_REQUEST['account_name']) && is_null($focus->account_name)) {
$focus->account_name = $_REQUEST['account_name'];
}
if (isset($_REQUEST['account_id']) && is_null($focus->account_id)) {
$focus->account_id = $_REQUEST['account_id'];
}
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$log->info("Contact detail view");
$smarty->assign("MOD", $mod_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("APP", $app_strings);
$contact_name = $focus->lastname;
if (getFieldVisibilityPermission($currentModule, $current_user->id,'firstname') == '0') {
$contact_name .= ' '.$focus->firstname;
}
$smarty->assign("NAME",$contact_name);
if(isset($cust_fld))
{
$smarty->assign("CUSTOMFIELD", $cust_fld);
}
$smarty->assign("ID", $focus->id);
$smarty->assign("MODULE",$currentModule);
$smarty->assign("SINGLE_MOD",'Contact');
if($focus->mode == 'edit')
{
$smarty->assign("UPDATEINFO",updateInfo($focus->id));
$smarty->assign("MODE", $focus->mode);
}
if(isset($_REQUEST['activity_mode']) && $_REQUEST['activity_mode'] !='')
$smarty->assign("ACTIVITYMODE",vtlib_purify($_REQUEST['activity_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['campaignid']))
$smarty->assign("campaignid",vtlib_purify($_REQUEST['campaignid']));
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']));
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']);
$tabid = getTabid("Contacts");
$validationData = getDBValidationData($focus->tab_name,$tabid);
$data = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
if($errormessage==2)
{
$msg =$mod_strings['LBL_MAXIMUM_LIMIT_ERROR'];
$errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>";
}
else if($errormessage==3)
{
$msg = $mod_strings['LBL_UPLOAD_ERROR'];
$errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>";
}
else if($errormessage=="image")
{
$msg = $mod_strings['LBL_IMAGE_ERROR'];
$errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>";
}
else if($errormessage =="invalid")
{
$msg = $mod_strings['LBL_INVALID_IMAGE'];
$errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>";
}
else
{
$errormessage="";
}
if($errormessage!="")
{
$smarty->assign("ERROR_MESSAGE",$errormessage);
}
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate']));
global $adb;
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if($focus->mode != 'edit' && $mod_seq_field != null) {
$autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE');
$mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1",array($currentModule));
$mod_seq_prefix = $adb->query_result($mod_seq_string,0,'prefix');
$mod_seq_no = $adb->query_result($mod_seq_string,0,'cur_id');
if($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix.$mod_seq_no))
echo '<br><font color="#FF0000"><b>'. getTranslatedString('LBL_DUPLICATE'). ' '. getTranslatedString($mod_seq_field['label'])
.' - '. getTranslatedString('LBL_CLICK') .' <a href="index.php?module=Settings&action=CustomModEntityNo&parenttab=Settings&selmodule='.$currentModule.'">'.getTranslatedString('LBL_HERE').'</a> '
. getTranslatedString('LBL_TO_CONFIGURE'). ' '. getTranslatedString($mod_seq_field['label']) .'</b></font>';
else
$smarty->assign("MOD_SEQ_ID",$autostr);
} else {
$smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
}
// END
if($focus->mode == 'edit')
$smarty->display("salesEditView.tpl");
else
$smarty->display('CreateView.tpl');
?>
@@ -0,0 +1,13 @@
<?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/ExportRecords.php');
?>
@@ -0,0 +1,106 @@
<?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');
require_once('database/DatabaseConnection.php');
global $mod_strings, $app_strings, $app_list_strings;
global $current_language, $currentModule, $current_userid, $theme;
require_once('themes/'.$theme.'/layout_utils.php');
$req_module = vtlib_purify($_REQUEST['module']);
$focus = CRMEntity::getInstance($req_module);
$return_module=vtlib_purify($_REQUEST['module']);
$delete_idstring=vtlib_purify($_REQUEST['idlist']);
$parenttab = getParenttab();
$smarty = new vtigerCRM_Smarty;
$ids_list = array();
$errormsg = '';
if(isset($_REQUEST['del_rec']))
{
$url = getBasic_Advance_SearchURL();
$delete_id_array=explode(",",$delete_idstring,-1);
foreach ($delete_id_array as $id)
{
if(isPermitted($req_module,'Delete',$id) == 'yes') {
$sql="update vtiger_crmentity set deleted=1 where crmid=?";
$result = $adb->pquery($sql, array($id));
DeleteEntity($req_module,$return_module,$focus,$id,"");
}
else {
$ids_list[] = $id;
}
}
if(count($ids_list) > 0) {
$ret = getEntityName($req_module,$ids_list);
if(count($ret) > 0)
{
$errormsg = implode(',',$ret);
}
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>
<table border='0' cellpadding='5' cellspacing='0' width='98%'>
<tbody><tr>
<td rowspan='2' width='11%'><img src='". vtiger_imageurl('denied.gif', $theme) ."' ></td>
<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'>
<span class='genHeaderSmall'>$app_strings[LBL_DUP_PERMISSION] $req_module $errormsg</span></td>
</tr>
<tr>
<td class='small' align='right' nowrap='nowrap'>
<a href='javascript:window.location.reload();'>$app_strings[LBL_GO_BACK]</a><br>
</td>
</tr>
</tbody></table>
</div>";
echo "</td></tr></table>";
exit;
}
}
include("include/saveMergeCriteria.php");
$ret_arr=getDuplicateRecordsArr($req_module);
$fld_values=$ret_arr[0];
$total_num_group=count($fld_values);
$fld_name=$ret_arr[1];
$ui_type=$ret_arr[2];
$smarty->assign("NAVIGATION",$ret_arr["navigation"]);//Added for page navigation
$smarty->assign("MODULE",$req_module);
$smarty->assign("NUM_GROUP",$total_num_group);
$smarty->assign("FIELD_NAMES",$fld_name);
$smarty->assign("CATEGORY",$parenttab);
$smarty->assign("ALL_VALUES",$fld_values);
if(isPermitted($req_module,'Delete','') == 'yes')
$button_del = $app_strings['LBL_MASS_DELETE'];
$smarty->assign("DELETE",$button_del);
$smarty->assign("MOD", return_module_language($current_language,$req_module));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("APP", $app_strings);
$smarty->assign("CMOD", $mod_strings);
$smarty->assign("MODE",'view');
if(isset($_REQUEST['button_view']))
{
$smarty->assign("VIEW",'true');
}
if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
$smarty->display("FindDuplicateAjax.tpl");
else
$smarty->display('FindDuplicateDisplay.tpl');
?>
@@ -0,0 +1,45 @@
<?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$
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
include('modules/Import/index.php');
?>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
<?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';
?>
@@ -0,0 +1,45 @@
<?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.
************************************************************************************/
global $mod_strings,$app_strings,$theme,$currentModule,$current_user;
require_once('Smarty_setup.php');
require_once('include/utils/utils.php');
$focus = CRMEntity::getInstance($currentModule);
$focus->mode = '';
$mode = 'mass_edit';
$disp_view = getView($focus->mode);
$smarty = new vtigerCRM_Smarty;
$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
$smarty->assign("IDS",$_REQUEST['idstring']);
$smarty->assign("MASS_EDIT","1");
$smarty->assign("MODULE",$currentModule);
$smarty->assign("APP",$app_strings);
$smarty->assign("CATEGORY",getParentTab());
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
// Field Validation Information
$tabid = getTabid($currentModule);
$validationData = getDBValidationData($focus->tab_name,$tabid);
$validationArray = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME",$validationArray['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$validationArray['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$validationArray['fieldlabel']);
$smarty->display('MassEditForm.tpl');
?>
@@ -0,0 +1,67 @@
<?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.
*********************************************************************************/
global $currentModule;
$focus = CRMEntity::getInstance($currentModule);
$idlist= vtlib_purify($_REQUEST['massedit_recordids']);
$viewid = vtlib_purify($_REQUEST['viewname']);
$return_module = vtlib_purify($_REQUEST['massedit_module']);
$return_action = 'index';
global $rstart;
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if(isset($_REQUEST['start']) && $_REQUEST['start']!=''){
$rstart = "&start=".vtlib_purify($_REQUEST['start']);
}
if(isset($idlist)) {
$recordids = explode(';', $idlist);
for($index = 0; $index < count($recordids); ++$index) {
$recordid = $recordids[$index];
if($recordid == '') continue;
if(isPermitted($currentModule,'EditView',$recordid) == 'yes') {
// Save each module record with update value.
$focus->retrieve_entity_info($recordid, $currentModule);
$focus->mode = 'edit';
$focus->id = $recordid;
foreach($focus->column_fields as $fieldname => $val)
{
if(isset($_REQUEST[$fieldname."_mass_edit_check"]))
{
if($fieldname == 'assigned_user_id'){
if($_REQUEST['assigntype'] == 'U') {
$value = $_REQUEST['assigned_user_id'];
} elseif($_REQUEST['assigntype'] == 'T') {
$value = $_REQUEST['assigned_group_id'];
}
} else {
if(is_array($_REQUEST[$fieldname]))
$value = $_REQUEST[$fieldname];
else
$value = trim($_REQUEST[$fieldname]);
}
$focus->column_fields[$fieldname] = $value;
}
else{
$focus->column_fields[$fieldname] = decode_html($focus->column_fields[$fieldname]);
}
}
$focus->save($currentModule);
}
}
}
$parenttab = getParentTab();
header("Location: index.php?module=$return_module&action=$return_action&parenttab=$parenttab$rstart");
?>
+282
View File
@@ -0,0 +1,282 @@
<?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.
*
********************************************************************************/
?>
<html>
<body>
<script>
if (document.layers)
{
document.write("This feature requires IE 5.5 or higher for Windows on Microsoft Windows 2000, Windows NT4 SP6, Windows XP.");
document.write("<br><br>Click <a href='#' onclick='window.history.back();'>here</a> to return to the previous page");
}
else if (document.layers || (!document.all && document.getElementById))
{
document.write("This feature requires IE 5.5 or higher for Windows on Microsoft Windows 2000, Windows NT4 SP6, Windows XP.");
document.write("<br><br>Click <a href='#' onclick='window.history.back();'>here</a> to return to the previous page");
}
else if(document.all)
{
document.write("<br><br>Click <a href='#' onclick='window.history.back();'>here</a> to return to the previous page");
document.write("<OBJECT Name='vtigerCRM' codebase='modules/Settings/vtigerCRM.CAB#version=1,5,0,0' id='objMMPage' classid='clsid:0FC436C2-2E62-46EF-A3FB-E68E94705126' width=0 height=0></object>");
}
</script>
<?php
require_once('include/database/PearDatabase.php');
require_once('config.php');
global $default_charset;
// Fix For: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/2107
$randomfilename = "vt_" . str_replace(array("."," "), "", microtime());
$templateid = $_REQUEST['mergefile'];
if($templateid == "")
{
die("Select Mail Merge Template");
}
//get the particular file from db and store it in the local hard disk.
//store the path to the location where the file is stored and pass it as parameter to the method
$sql = "select filename,data,filesize from vtiger_wordtemplates where templateid=?";
$result = $adb->pquery($sql, array($templateid));
$temparray = $adb->fetch_array($result);
$fileContent = $temparray['data'];
$filename=html_entity_decode($temparray['filename'], ENT_QUOTES, $default_charset);
// Fix For: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/2107
$filename= $randomfilename . "_word.doc";
$filesize=$temparray['filesize'];
$wordtemplatedownloadpath =$root_directory ."/test/wordtemplatedownload/";
$handle = fopen($wordtemplatedownloadpath .$filename,"wb");
fwrite($handle,base64_decode($fileContent),$filesize);
fclose($handle);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<for mass merge>>>>>>>>>>>>>>>>>>>>>>>>
$mass_merge = $_REQUEST['allselectedboxes'];
$single_record = $_REQUEST['record'];
if($mass_merge != "")
{
$mass_merge = explode(";",$mass_merge);
$temp_mass_merge = $mass_merge;
if(array_pop($temp_mass_merge)=="")
array_pop($mass_merge);
//$mass_merge = implode(",",$mass_merge);
}else if($single_record != "")
{
$mass_merge = $single_record;
}else
{
die("Record Id is not found, cannot merge the document");
}
//<<<<<<<<<<<<<<<<header for csv and select columns for query>>>>>>>>>>>>>>>>>>>>>>>>
global $current_user;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0 || $module == "Users" || $module == "Emails")
{
$query1="select vtiger_tab.name,vtiger_field.tablename,vtiger_field.columnname,vtiger_field.fieldlabel from vtiger_field inner join vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid where vtiger_field.tabid in (4,6) and vtiger_field.block <> 75 order by vtiger_field.tablename and vtiger_field.presence in (0,2)";
$params1 = array();
}
else
{
$profileList = getCurrentUserProfileList();
$query1="select vtiger_tab.name,vtiger_field.tablename,vtiger_field.columnname,vtiger_field.fieldlabel from vtiger_field inner join vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid INNER JOIN vtiger_profile2field ON vtiger_profile2field.fieldid=vtiger_field.fieldid INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid in (4,6) and vtiger_field.block <> 75 AND vtiger_profile2field.visible=0 AND vtiger_def_org_field.visible=0 AND vtiger_profile2field.profileid IN (". generateQuestionMarks($profileList) .") and vtiger_field.presence in (0,2) GROUP BY vtiger_field.fieldid order by vtiger_field.tablename";
$params1 = array($profileList);
//Postgres 8 fixes
if( $adb->dbType == "pgsql")
$query1 = fixPostgresQuery( $query1, $log, 0);
}
$result = $adb->pquery($query1, $params1);
$y=$adb->num_rows($result);
for ($x=0; $x<$y; $x++)
{
$tablename = $adb->query_result($result,$x,"tablename");
$columnname = $adb->query_result($result,$x,"columnname");
$modulename = $adb->query_result($result,$x,"name");
if($tablename == "crmentity")
{
if($modulename == "Accounts")
{
$tablename = "crmentityAccounts";
}
}
$querycolumns[$x] = $tablename.".".$columnname;
if($columnname == "smownerid")
{
if($modulename == "Accounts")
{
$querycolumns[$x]="case when (usersAccounts.user_name not like '') then concat(usersAccounts.last_name,' ',usersAccounts.first_name) else groupsAccounts.groupname end as username";
}
if($modulename == "Contacts")
{
$querycolumns[$x]="case when (vtiger_users.user_name not like '') then concat(vtiger_users.last_name,' ',vtiger_users.first_name) else vtiger_groups.groupname end as usercname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
}
}
if($columnname == "parentid")
{
$querycolumns[$x] = "accountAccounts.accountname";
}
if($columnname == "accountid")
{
$querycolumns[$x] = "accountContacts.accountname";
}
if($columnname == "reportsto")
{
$querycolumns[$x] = "contactdetailsContacts.lastname";
}
if($modulename == "Accounts")
{
$field_label[$x] = "ACCOUNT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
}
if($modulename == "Contacts")
{
$field_label[$x] = "CONTACT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
if($columnname == "smownerid")
{
$field_label[$x] = $field_label[$x].",USER_FIRSTNAME,USER_LASTNAME,USER_USERNAME,USER_YAHOOID,USER_TITLE,USER_OFFICEPHONE,USER_DEPARTMENT,USER_MOBILE,USER_OTHERPHONE,USER_FAX,USER_EMAIL,USER_HOMEPHONE,USER_OTHEREMAIL,USER_PRIMARYADDRESS,USER_CITY,USER_STATE,USER_POSTALCODE,USER_COUNTRY";
}
}
}
$csvheader = implode(",",$field_label);
//echo $csvheader;
//<<<<<<<<<<<<<<<<End>>>>>>>>>>>>>>>>>>>>>>>>
if(count($querycolumns) > 0)
{
$selectcolumns = implode($querycolumns,",");
$query = "select $selectcolumns from vtiger_contactdetails
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid
inner join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
inner join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
inner join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
inner join vtiger_customerdetails on vtiger_contactdetails.contactid = vtiger_customerdetails.customerid
left join vtiger_contactdetails as contactdetailsContacts on contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
left join vtiger_account as accountContacts on accountContacts.accountid = vtiger_contactdetails.accountid
left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
left join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid
left join vtiger_crmentity as crmentityAccounts on crmentityAccounts.crmid=vtiger_account.accountid
left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
left join vtiger_account as accountAccounts on accountAccounts.accountid = vtiger_account.parentid
left join vtiger_users as usersAccounts on usersAccounts.id = crmentityAccounts.smownerid
LEFT JOIN vtiger_groups as groupsAccounts
ON groupsAccounts.groupid = vtiger_crmentity.smownerid
where vtiger_crmentity.deleted=0 and (crmentityAccounts.deleted is NULL or crmentityAccounts.deleted <> 1) and vtiger_contactdetails.contactid in(". generateQuestionMarks($mass_merge) .")";
$result = $adb->pquery($query, array($mass_merge));
$avail_pick_arr = getAccessPickListValues('Contacts');
while($columnValues = $adb->fetch_array($result))
{
$y=$adb->num_fields($result);
for($x=0; $x<$y; $x++)
{
$value = $columnValues[$x];
foreach($columnValues as $key=>$val)
{
if($val == $value && $value != '')
{
if(array_key_exists($key,$avail_pick_arr))
{
if(!in_array($val,$avail_pick_arr[$key]))
{
$value = "Not Accessible";
}
}
}
}
//<<<<<<<<<<<<<<< For blank Fields >>>>>>>>>>>>>>>>>>>>>>>>>>>>
if(trim($value) == "--None--" || trim($value) == "--none--")
{
$value = "";
}
//<<<<<<<<<<<<<<< End >>>>>>>>>>>>>>>>>>>>>>>>>>>>
$actual_values[$x] = $value;
$actual_values[$x] = str_replace('"'," ",$actual_values[$x]);
//if value contains any line feed or carriage return replace the value with ".value."
if (preg_match ("/(\r?\n)/", $actual_values[$x]))
{
$actual_values[$x] = '"'.$actual_values[$x].'"';
}
$actual_values[$x] = decode_html(str_replace(","," ",$actual_values[$x]));
}
$mergevalue[] = implode($actual_values,",");
}
$csvdata = implode($mergevalue,"###");
}else
{
die("No fields to do Merge");
}
// Fix for: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/2107
$datafilename = $randomfilename . "_data.csv";
$handle = fopen($wordtemplatedownloadpath.$datafilename,"wb");
fwrite($handle,$csvheader."\r\n");
fwrite($handle,str_replace("###","\r\n",$csvdata));
fclose($handle);
?>
<script>
if (window.ActiveXObject){
try
{
ovtigerVM = eval("new ActiveXObject('vtigerCRM.ActiveX');");
if(ovtigerVM)
{
var filename = "<?php echo $filename?>";
if(filename != "")
{
if(objMMPage.bDLTempDoc("<?php echo $site_URL?>/test/wordtemplatedownload/<?php echo $filename?>","MMTemplate.doc"))
{
try
{
if(objMMPage.Init())
{
objMMPage.vLTemplateDoc();
objMMPage.bBulkHDSrc("<?php echo $site_URL;?>/test/wordtemplatedownload/<?php echo $datafilename ?>");
objMMPage.vBulkOpenDoc();
objMMPage.UnInit()
window.history.back();
}
}catch(errorObject)
{
document.write("Error while processing mail merge operation");
}
}else
{
document.write("Cannot get template document");
}
}
}
}
catch(e) {
document.write("Requires to download ActiveX Control from vtigerCRM. Please, ensure that you have administration privilage");
}
}
</script>
</body>
</html>
@@ -0,0 +1,23 @@
<?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/Contacts/Popup.php,v 1.15 2005/04/19 15:33:44 rank Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Popup.php');
?>
@@ -0,0 +1,133 @@
<?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('database/DatabaseConnection.php');
require_once('modules/Users/Users.php');
require_once('include/utils/utils.php');
$module = vtlib_purify($_REQUEST['module']);
$focus = CRMEntity::getInstance($module);
global $mod_strings, $app_strings, $app_list_strings;
global $current_language, $currentModule, $theme;
global $adb;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$mode = vtlib_purify($_REQUEST['mergemode']);
if($mode == 'mergesave') {
$return_module=vtlib_purify($_REQUEST['return_module']);
$action=vtlib_purify($_REQUEST['action']);
$return_action=vtlib_purify($_REQUEST['return_action']);
$parenttab=vtlib_purify($_REQUEST['parent']);
$merge_id=vtlib_purify($_REQUEST['record']);
$recordids=vtlib_purify($_REQUEST['pass_rec']);
$result = $adb->pquery("SELECT count(*) AS count FROM vtiger_crmentity WHERE crmid=? and deleted=0", array($merge_id));
$count = $adb->query_result($result,0,'count');
if($count > 0)
{
// First, save the primary record
$focus->mode="edit";
setObjectValuesFromRequest($focus);
$focus->save($module);
$rec_values=$focus->column_fields;
// Remove the id of primary record from the list of records to be deleted.
$del_value=explode(",",$recordids,-1);
$offset = array_search($merge_id,$del_value);
unset($del_value[$offset]);
// Transfer the related lists of the records to be deleted, to the primary record's related list
if(method_exists($focus, 'transferRelatedRecords')){
$focus->transferRelatedRecords($module,$del_value,$merge_id);
} else {
transferRelatedRecords($module,$del_value,$merge_id);
}
// Delete the records by id specified in the list
foreach($del_value as $value)
{
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$value,"");
}
}
?>
<script>
window.self.close();window.opener.location.href=window.opener.location.href;
</script>
<?php
} elseif ($mode == 'mergefields') {
$idstring=vtlib_purify($_REQUEST['passurl']);
$parent_tab=getParentTab();
$exploded_id=explode(",",$idstring,-1);
$record_count = count($exploded_id);
$smarty = new vtigerCRM_Smarty;
$smarty->assign("EDIT_DUPLICATE","");
if($record_count == 2) {
if(isPermitted($currentModule,"EditView",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"EditView",$exploded_id[1]) == 'yes'
&& isPermitted($currentModule,"Delete",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"Delete",$exploded_id[1]) == 'yes')
$smarty->assign("EDIT_DUPLICATE","permitted");
}
else {
if(isPermitted($currentModule,"EditView",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"EditView",$exploded_id[1]) == 'yes' && isPermitted($currentModule,"EditView",$exploded_id[2]) == 'yes'
&& isPermitted($currentModule,"Delete",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"Delete",$exploded_id[1]) == 'yes' && isPermitted($currentModule,"Delete",$exploded_id[2]) == 'yes')
$smarty->assign("EDIT_DUPLICATE","permitted");
}
$all_values_array=getRecordValues($exploded_id,$module);
$all_values=$all_values_array[0];
$js_arr_val=$all_values_array[1];
$fld_array=$all_values_array[2];
$js_arr=implode(",",$js_arr_val);
$imported_records = Array();
$sql="select bean_id from vtiger_users_last_import where bean_type=? and deleted=0";
$result = $adb->pquery($sql, array($module));
$num_rows=$adb->num_rows($result);
$count=0;
for($i=0; $i<$num_rows;$i++)
{
foreach($exploded_id as $value)
if($value == $adb->query_result($result,$i,"bean_id"))
$count++;
array_push($imported_records,$adb->query_result($result,$i,"bean_id"));
}
if ($record_count == $count)
$no_existing=1;
else
$no_existing=0;
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("RECORD_COUNT",$record_count);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULENAME", $module);
$smarty->assign("PARENT_TAB", $parent_tab);
$smarty->assign("JS_ARRAY", $js_arr);
$smarty->assign("ID_ARRAY", $exploded_id);
$smarty->assign("IDSTRING",$idstring);
$smarty->assign("ALLVALUES", $all_values);
$smarty->assign("FIELD_ARRAY", $fld_array);
$smarty->assign("IMPORTED_RECORDS", $imported_records);
$smarty->assign("NO_EXISTING", $no_existing);
$smarty->display("MergeFields.tpl");
}
?>
@@ -0,0 +1,12 @@
<?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/quickcreate.php');
?>
+227
View File
@@ -0,0 +1,227 @@
<?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/Contacts/Save.php,v 1.9 2005/03/15 09:58:21 shaw Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Contacts/Contacts.php');
require_once('include/logging.php');
require_once('include/database/PearDatabase.php');
require_once("modules/Emails/mail.php");
$local_log =& LoggerManager::getLogger('index');
global $log,$adb;
$focus = new Contacts();
//added to fix 4600
$search=vtlib_purify($_REQUEST['search_url']);
setObjectValuesFromRequest($focus);
if($_REQUEST['salutation'] == '--None--') $_REQUEST['salutation'] = '';
if (!isset($_REQUEST['email_opt_out'])) $focus->email_opt_out = 'off';
if (!isset($_REQUEST['do_not_call'])) $focus->do_not_call = 'off';
//Checking If image is given or not
//$image_upload_array=SaveImage($_FILES,'contact',$focus->id,$focus->mode);
$image_name_val=$image_upload_array['imagename'];
$image_error="false";
$errormessage=$image_upload_array['errormessage'];
$saveimage=$image_upload_array['saveimage'];
//code added for returning back to the current view after edit from list view
if($_REQUEST['return_viewname'] == '') $return_viewname='0';
if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']);
if($image_error=="true") //If there is any error in the file upload then moving all the data to EditView.
{
//re diverting the page and reassigning the same values as image error occurs
if($_REQUEST['activity_mode'] != '')$activity_mode=vtlib_purify($_REQUEST['activity_mode']);
if($_REQUEST['return_module'] != '')$return_module=vtlib_purify($_REQUEST['return_module']);
if($_REQUEST['return_action'] != '')$return_action=vtlib_purify($_REQUEST['return_action']);
if($_REQUEST['return_id'] != '')$return_id=vtlib_purify($_REQUEST['return_id']);
$log->debug("There is an error during the upload of contact image.");
$field_values_passed.="";
foreach($focus->column_fields as $fieldname => $val)
{
if(isset($_REQUEST[$fieldname]))
{
$log->debug("Assigning the previous values given for the contact to respective vtiger_fields ");
$field_values_passed.="&";
$value = $_REQUEST[$fieldname];
$focus->column_fields[$fieldname] = $value;
$field_values_passed.=$fieldname."=".$value;
}
}
$values_pass=$field_values_passed;
$encode_field_values=base64_encode($values_pass);
$error_module = "Contacts";
$error_action = "EditView";
$return_action .= '&activity_mode='.vtlib_purify($_request['activity_mode']);
if($mode=="edit") {
$return_id=vtlib_purify($_REQUEST['record']);
}
header("location: index.php?action=$error_action&module=$error_module&record=$return_id&return_id=$return_id&return_action=$return_action&return_module=$return_module&activity_mode=$activity_mode&return_viewname=$return_viewname".$search."&saveimage=$saveimage&error_msg=$errormessage&image_error=$image_error&encode_val=$encode_field_values");
}
if($saveimage=="true")
{
$focus->column_fields['imagename']=$image_name_val;
$log->debug("Assign the Image name to the vtiger_field name ");
}
//if image added then we have to set that $_FILES['name'] in imagename field then only the image will be displayed
if($_FILES['imagename']['name'] != '')
{
if(isset($_REQUEST['imagename_hidden'])) {
$focus->column_fields['imagename'] = vtlib_purify($_REQUEST['imagename_hidden']);
} else {
$focus->column_fields['imagename'] = $_FILES['imagename']['name'];
}
}
elseif($focus->id != '')
{
$result = $adb->pquery("select imagename from vtiger_contactdetails where contactid = ?", array($focus->id));
$focus->column_fields['imagename'] = $adb->query_result($result,0,'imagename');
}
if($_REQUEST['assigntype'] == 'U') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif($_REQUEST['assigntype'] == 'T') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}
//Saving the contact
if($image_error=="false")
{
$focus->save("Contacts");
$return_id = $focus->id;
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']);
else $return_module = "Contacts";
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['activity_mode']) && $_REQUEST['activity_mode'] != '') $activitymode = vtlib_purify($_REQUEST['activity_mode']);
$local_log->debug("Saved record with id of ".$return_id);
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == "Campaigns")
{
if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "")
{
$campContStatusResult = $adb->pquery("select campaignrelstatusid from vtiger_campaigncontrel where campaignid=? AND contactid=?",array($_REQUEST['return_id'], $focus->id));
$contactStatus = $adb->query_result($campContStatusResult,0,'campaignrelstatusid');
$sql = "delete from vtiger_campaigncontrel where contactid = ?";
$adb->pquery($sql, array($focus->id));
if(isset($contactStatus) && $contactStatus!=''){
$sql = "insert into vtiger_campaigncontrel values (?,?,?)";
$adb->pquery($sql, array($_REQUEST['return_id'], $focus->id,$contactStatus));
}
else
{
$sql = "insert into vtiger_campaigncontrel values (?,?,1)";
$adb->pquery($sql, array($_REQUEST['return_id'], $focus->id));
}
}
}
//BEGIN -- Code for Create Customer Portal Users password and Send Mail
if($_REQUEST['portal'] == '' && $_REQUEST['mode'] == 'edit')
{
$sql = "update vtiger_portalinfo set user_name=?,isactive=0 where id=?";
$adb->pquery($sql, array($_REQUEST['email'], $_REQUEST['record']));
}
elseif($_REQUEST['portal'] != '' && $_REQUEST['email'] != '')// && $_REQUEST['mode'] != 'edit')
{
$id = $_REQUEST['record'];
$username = $_REQUEST['email'];
if($_REQUEST['mode'] != 'edit')
$insert = 'true';
$sql = "select id,user_name,user_password,isactive from vtiger_portalinfo";
$result = $adb->pquery($sql, array());
for($i=0;$i<$adb->num_rows($result);$i++)
{
if($id == $adb->query_result($result,$i,'id'))
{
$dbusername = $adb->query_result($result,$i,'user_name');
$isactive = $adb->query_result($result,$i,'isactive');
if($username == $dbusername && $isactive == 1)
$flag = 'true';
else
{
$sql = "update vtiger_portalinfo set user_name=?, isactive=1 where id=?";
$adb->pquery($sql, array($username, $id));
$update = 'true';
$flag = 'true';
$password = $adb->query_result($result,$i,'user_password');
}
}
}
if($flag != 'true')
$insert = 'true';
else
$insert = 'false';
if($insert == 'true')
{
$password = makeRandomPassword();
$sql = "insert into vtiger_portalinfo values(?,?,?,?,?,?,?,?)";
$params = array($focus->id, $username, $password, 'C', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1);
$adb->pquery($sql, $params);
}
//changes made to send mail to portal user when we use ajax edit
$data_array = Array();
$data_array['first_name'] = $_REQUEST['firstname'];
$data_array['last_name'] = $_REQUEST['lastname'];
$data_array['email'] = $_REQUEST['email'];
$data_array['portal_url'] = '<a href="'.$PORTAL_URL.'" style="font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bolder;text-decoration:none;color: #4242FD;">'.$mod_strings['Please Login Here'].'</a>';
$value = getmail_contents_portalUser($data_array,$password,"LoginDetails");
$contents=$value["body"]; $subject=$value["subject"];
$log->info("Customer Portal Information Updated in database and details are going to send => '".$_REQUEST['email']."'");
if($insert == 'true' || $update == 'true')
{
$mail_status = send_mail('Support',$_REQUEST['email'],$current_user->user_name,'',$subject,$contents);
}
$log->info("After return from the SendMailToCustomer function. Now control will go to the header.");
}
//END -- Code for Create Customer Portal Users password and Send Mail
$log->info("This Page is redirected to : ".$return_module." / ".$return_action."& return id =".$return_id);
//code added for returning back to the current view after edit from list view
if($_REQUEST['return_viewname'] == '') $return_viewname='0';
if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']);
$parenttab = getParentTab();
header("Location: index.php?action=$return_action&module=$return_module&parenttab=$parenttab&record=$return_id&activity_mode=$activitymode&viewname=$return_viewname&start=".vtlib_purify($_REQUEST['pagenumber']));
}
?>
@@ -0,0 +1,13 @@
<?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/Vtiger/Settings.php');
?>
@@ -0,0 +1,12 @@
<?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/Ajax/TagCloud.php')
?>
@@ -0,0 +1,11 @@
<?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
Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Some files were not shown because too many files have changed in this diff Show More