From 9cce682da96d5a3abfc9645564becf54902fee11 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Tue, 16 Nov 2010 08:20:29 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E7=89=88=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@618 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../trunk/modules/Leads/CallRelatedList.php | 113 ++++ .../trunk/modules/Leads/ConvertLead.php | 272 ++++++++ .../trunk/modules/Leads/CustomAction.php | 12 + oss/vtiger/trunk/modules/Leads/CustomView.php | 14 + oss/vtiger/trunk/modules/Leads/Delete.php | 39 ++ oss/vtiger/trunk/modules/Leads/DetailView.php | 186 ++++++ .../trunk/modules/Leads/DetailViewAjax.php | 47 ++ oss/vtiger/trunk/modules/Leads/EditView.php | 141 ++++ .../trunk/modules/Leads/ExportRecords.php | 13 + .../modules/Leads/FindDuplicateRecords.php | 107 +++ oss/vtiger/trunk/modules/Leads/Import.php | 14 + .../modules/Leads/LeadConvertToEntities.php | 613 ++++++++++++++++++ oss/vtiger/trunk/modules/Leads/Leads.js | 152 +++++ oss/vtiger/trunk/modules/Leads/Leads.php | 590 +++++++++++++++++ oss/vtiger/trunk/modules/Leads/LeadsAjax.php | 14 + oss/vtiger/trunk/modules/Leads/ListView.php | 342 ++++++++++ .../trunk/modules/Leads/ListViewPagging.php | 11 + .../trunk/modules/Leads/ListViewTop.php | 172 +++++ oss/vtiger/trunk/modules/Leads/MassEdit.php | 45 ++ .../trunk/modules/Leads/MassEditSave.php | 67 ++ oss/vtiger/trunk/modules/Leads/Merge.php | 234 +++++++ oss/vtiger/trunk/modules/Leads/Popup.php | 20 + .../trunk/modules/Leads/ProcessDuplicates.php | 134 ++++ .../trunk/modules/Leads/QuickCreate.php | 12 + oss/vtiger/trunk/modules/Leads/Save.php | 183 ++++++ oss/vtiger/trunk/modules/Leads/Settings.php | 76 +++ oss/vtiger/trunk/modules/Leads/TagCloud.php | 12 + .../trunk/modules/Leads/UnifiedSearch.php | 11 + oss/vtiger/trunk/modules/Leads/index.php | 21 + .../modules/Leads/language/en_us.lang.php | 244 +++++++ .../modules/Leads/language/zh_cn.lang.php | 249 +++++++ .../trunk/modules/Leads/updateRelations.php | 52 ++ 32 files changed, 4212 insertions(+) create mode 100644 oss/vtiger/trunk/modules/Leads/CallRelatedList.php create mode 100644 oss/vtiger/trunk/modules/Leads/ConvertLead.php create mode 100644 oss/vtiger/trunk/modules/Leads/CustomAction.php create mode 100644 oss/vtiger/trunk/modules/Leads/CustomView.php create mode 100644 oss/vtiger/trunk/modules/Leads/Delete.php create mode 100644 oss/vtiger/trunk/modules/Leads/DetailView.php create mode 100644 oss/vtiger/trunk/modules/Leads/DetailViewAjax.php create mode 100644 oss/vtiger/trunk/modules/Leads/EditView.php create mode 100644 oss/vtiger/trunk/modules/Leads/ExportRecords.php create mode 100644 oss/vtiger/trunk/modules/Leads/FindDuplicateRecords.php create mode 100644 oss/vtiger/trunk/modules/Leads/Import.php create mode 100644 oss/vtiger/trunk/modules/Leads/LeadConvertToEntities.php create mode 100644 oss/vtiger/trunk/modules/Leads/Leads.js create mode 100644 oss/vtiger/trunk/modules/Leads/Leads.php create mode 100644 oss/vtiger/trunk/modules/Leads/LeadsAjax.php create mode 100644 oss/vtiger/trunk/modules/Leads/ListView.php create mode 100644 oss/vtiger/trunk/modules/Leads/ListViewPagging.php create mode 100644 oss/vtiger/trunk/modules/Leads/ListViewTop.php create mode 100644 oss/vtiger/trunk/modules/Leads/MassEdit.php create mode 100644 oss/vtiger/trunk/modules/Leads/MassEditSave.php create mode 100644 oss/vtiger/trunk/modules/Leads/Merge.php create mode 100644 oss/vtiger/trunk/modules/Leads/Popup.php create mode 100644 oss/vtiger/trunk/modules/Leads/ProcessDuplicates.php create mode 100644 oss/vtiger/trunk/modules/Leads/QuickCreate.php create mode 100644 oss/vtiger/trunk/modules/Leads/Save.php create mode 100644 oss/vtiger/trunk/modules/Leads/Settings.php create mode 100644 oss/vtiger/trunk/modules/Leads/TagCloud.php create mode 100644 oss/vtiger/trunk/modules/Leads/UnifiedSearch.php create mode 100644 oss/vtiger/trunk/modules/Leads/index.php create mode 100644 oss/vtiger/trunk/modules/Leads/language/en_us.lang.php create mode 100644 oss/vtiger/trunk/modules/Leads/language/zh_cn.lang.php create mode 100644 oss/vtiger/trunk/modules/Leads/updateRelations.php diff --git a/oss/vtiger/trunk/modules/Leads/CallRelatedList.php b/oss/vtiger/trunk/modules/Leads/CallRelatedList.php new file mode 100644 index 00000000..c8b01574 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/CallRelatedList.php @@ -0,0 +1,113 @@ +retrieve_entity_info($RECORD,$currentmodule); + $focus->id = $RECORD; + $focus->firstname=$focus->column_fields['firstname']; + $focus->lastname=$focus->column_fields['lastname']; + $log->debug("id is ".$focus->id); + $log->debug("name is ".$focus->name); + } + + 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; + + + if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $focus->id = ""; + } + if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') { + $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode'])); + } + + if(!$_SESSION['rlvs'][$module]) + { + unset($_SESSION['rlvs']); + } + + if(isset($_REQUEST['record']) && $_REQUEST['record']!='') + { + $userid = $current_user->id; + $sql = "select fieldname from vtiger_field where uitype = '13' and tabid = 7 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("Leads",$userid,$fieldname); + } + } + + $smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar')); + $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events')); + $smarty->assign("CATEGORY",$category); + $parent_email = getEmailParentsList('Leads',$focus->id, $focus); + $smarty->assign("HIDDEN_PARENTS_LIST",$parent_email); + + // 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",$focus->id); + $smarty->assign("NAME",$focus->lastname.' '.$focus->firstname); + $smarty->assign("EMAIL",$focus->column_fields['email']); + $smarty->assign("YAHOO",$focus->column_fields['yahooid']); + $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'])) { + $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("SINGLE_MOD",$app_strings['Lead']); + $smarty->assign("MODULE", $currentmodule); + $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"); +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/ConvertLead.php b/oss/vtiger/trunk/modules/Leads/ConvertLead.php new file mode 100644 index 00000000..a3071f76 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/ConvertLead.php @@ -0,0 +1,272 @@ +debug(" the id is ".$id); +} +$category = getParentTab(); +//Retreive lead details from database +$sql = "SELECT firstname, lastname, company, smownerid from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid where vtiger_leaddetails.leadid =?"; +$result = $adb->pquery($sql, array($id)); +$row = $adb->fetch_array($result); + +//if company field is not present +if(getFieldVisibilityPermission('Leads',$current_user->id,'company') == '1'){ + $row["company"] = ''; +} + +$firstname = $row["firstname"]; +$lastname = $row["lastname"]; +$company = $row["company"]; +$potentialname = $row["company"] ."-"; +$userid = $row["smownerid"]; + +//Retreiving the current user id +$modified_user_id = $current_user->id; +$log->info("Convert Lead view"); + +$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']); + +$roleid=$current_user->roleid; +$subrole = getRoleSubordinates($roleid); +if(count($subrole)> 0) +{ + $roleids = $subrole; + array_push($roleids, $roleid); +} +else +{ + $roleids = $roleid; +} +if($sortid != '') { + $sales_stage_query="select sales_stage from vtiger_sales_stage"; + $params = array(); +} +elseif($is_admin) +{ + $sales_stage_query="select sales_stage from vtiger_sales_stage inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_sales_stage.picklist_valueid where roleid != 'H1' order by sortid"; + $params = array(); +}else +{ + if (count($roleids) > 0) { + $sales_stage_query="select sales_stage from vtiger_sales_stage inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_sales_stage.picklist_valueid where roleid in (". generateQuestionMarks($roleids) .") and picklistid in (select picklistid from vtiger_sales_stage) order by sortid"; + $params = array($roleids); + } else { + $sales_stage_query="select sales_stage from vtiger_sales_stage inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_sales_stage.picklist_valueid where picklistid in (select picklistid from vtiger_sales_stage) order by sortid"; + $params = array(); + } +} +$sales_stage_result = $adb->pquery($sales_stage_query, $params); +$noofsalesRows = $adb->num_rows($sales_stage_result); +$sales_stage_fld = ''; +$sales_stage_list[] = array(); +for($j = 0; $j < $noofsalesRows; $j++) +{ + + $sales_stageValue=$adb->query_result($sales_stage_result,$j,strtolower(sales_stage)); + if(in_array($sales_stageValue,$sales_stage_list)) continue; + $sales_stage_list[] = $sales_stageValue; + if($value == $sales_stageValue) + { + $chk_val = "selected"; + } + else + { + $chk_val = ''; + } + + $sales_stage_fld.= ''; +} +function isActive($field,$mod){ + global $adb,$theme; + $tabid = getTabid($mod); + $query = 'select * from vtiger_field where fieldname = ? and tabid = ? and presence in (0,2)'; + $res = $adb->pquery($query,array($field,$tabid)); + $rows = $adb->num_rows($res); + if($rows > 0){ + return true; + }else + return false; +} +$userselected = ''; +$groupselected = ''; +$userdisplay = 'none'; +$groupdisplay = 'none'; +$private = ''; +if($userid != ''){ + global $adb; + $query = "SELECT * from vtiger_users WHERE id = ?"; + $res = $adb->pquery($query,array($userid)); + $rows = $adb->num_rows($res); + if($rows > 0){ + $userselected = 'checked'; + $userdisplay= 'block'; + }else{ + $groupselected = 'checked'; + $groupdisplay= 'block'; + } +} + +if($current_user->id != 1){ + require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); + $Acc_tabid= getTabid('Accounts'); + $con_tabid = getTabid('Contacts'); + if($defaultOrgSharingPermission[$Acc_tabid] === 0 || $defaultOrgSharingPermission[$Acc_tabid] == 3){ + $private = 'private'; + }elseif($defaultOrgSharingPermission[$con_tabid] === 0 || $defaultOrgSharingPermission[$con_tabid] == 3){ + $private = 'private'; + } +} + +$convertlead = '
+ + + + + + +
+ + + + + +
'.$mod_strings['LBL_CONVERT_LEAD'].' '.$firstname.' '.$lastname.'
+ + + + + +
+ + + + + + + + '; + + if(vtlib_isModuleActive('Accounts') && (isPermitted('Accounts','EditView')== 'yes')){ + $convertlead .= ' + + + '; + } +if(vtlib_isModuleActive('Potentials') && (isPermitted('Potentials','EditView')== 'yes')){ +// An array which as module => fields mapping, to check for field permissions +$fields_list = array( 'Potentials'=> array('potentialname', 'closingdate', 'amount', 'sales_stage')); +$fields_permission = array(); +foreach($fields_list as $mod=>$fields){ + foreach($fields as $key=>$field) { + if(getFieldVisibilityPermission($mod, $current_user->id, $field)=='0' && (isActive($field,$mod) == true)){ + $fields_permission[$field] = '0'; + $potTabid = getTabid('Potentials'); + global $adb; + $query = 'select typeofdata from vtiger_field where fieldname = ? and tabid = ?'; + $res = $adb->pquery($query,array($field,$potTabid)); + $type = $adb->query_result($res,0,'typeofdata'); + if(strpos($type,'M')){ + $mandatory[$field] = '*'; + } + } + else + $fields_permission[$field] = '1'; + } +} + +$convertlead .=' + + + + + + '; + +} +$convertlead .='
'.$mod_strings['LBL_CONVERT_LEAD_INFORMATION'].'
'.$app_strings['LBL_ASSIGNED_TO'].' +  '.$app_strings['LBL_USER'].' +  '.$app_strings['LBL_GROUP'].' + + + + + + +
'.$mod_strings['LBL_ACCOUNT_NAME'].'
'.$mod_strings['LBL_DO_NOT_CREATE_NEW_POTENTIAL'].'
+
+ '; + if($fields_permission['potentialname']=='0') { + + $convertlead .= ' + + + '; + } + if($fields_permission['closingdate']=='0') { + $convertlead .= ' + + + '; + } + if($fields_permission['amount']=='0') { + $convertlead .= ' + + + '; + } + if($fields_permission['sales_stage']=='0') { + $convertlead .=' + + + '; + } + $convertlead .='
'.$mandatory['potentialname'].''.$mod_strings['LBL_POTENTIAL_NAME'].' + + +
'.$mandatory['closingdate'].''.$mod_strings['LBL_POTENTIAL_CLOSE_DATE'].' + + + + ('.$current_user->date_format.') + +
'.$mandatory['amount'].''.$mod_strings['LBL_POTENTIAL_AMOUNT'].' + + '.$potential_amount.'
'.$mandatory['sales_stage'].''.$mod_strings['LBL_POTENTIAL_SALES_STAGE'].' + +
+
+
+
+ + + + +
+    + +
+
'; +echo $convertlead; + +?> diff --git a/oss/vtiger/trunk/modules/Leads/CustomAction.php b/oss/vtiger/trunk/modules/Leads/CustomAction.php new file mode 100644 index 00000000..f72082d0 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/CustomAction.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/CustomView.php b/oss/vtiger/trunk/modules/Leads/CustomView.php new file mode 100644 index 00000000..93231ed6 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/CustomView.php @@ -0,0 +1,14 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/Delete.php b/oss/vtiger/trunk/modules/Leads/Delete.php new file mode 100644 index 00000000..2f7b16bf --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/Delete.php @@ -0,0 +1,39 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/DetailView.php b/oss/vtiger/trunk/modules/Leads/DetailView.php new file mode 100644 index 00000000..b2bc849c --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/DetailView.php @@ -0,0 +1,186 @@ +id = $_REQUEST['record']; + + $focus->retrieve_entity_info($_REQUEST['record'],"Leads"); + $focus->id = $_REQUEST['record']; + $log->debug("id is ".$focus->id); + $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("Lead 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("ID", $focus->id); + +// 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("SINGLE_MOD", 'Lead'); + +$lead_name = $focus->lastname; +if (getFieldVisibilityPermission($currentModule, $current_user->id,'firstname') == '0') { + $lead_name .= ' '.$focus->firstname; +} +$smarty->assign("NAME",$lead_name ); + +$smarty->assign("UPDATEINFO",updateInfo($focus->id)); +$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields)); +$smarty->assign("CUSTOMFIELD", $cust_fld); + +if(useInternalMailer() == 1) + $smarty->assign("INT_MAILER","true"); + + +$val = isPermitted("Leads","EditView",$_REQUEST['record']); + +if(isPermitted("Leads","EditView",$_REQUEST['record']) == 'yes') + $smarty->assign("EDIT_DUPLICATE","permitted"); + +if(isPermitted("Leads","EditView",$_REQUEST['record']) == 'yes' && isPermitted("Leads","ConvertLead") =='yes' && (isPermitted("Accounts","EditView") =='yes' || isPermitted("Contacts","EditView") == 'yes') && (vtlib_isModuleActive('Contacts') || vtlib_isModuleActive('Accounts'))) +{ + $smarty->assign("CONVERTLEAD","permitted"); +} + +$category = getParentTab(); +$smarty->assign("CATEGORY",$category); + + +if(isPermitted("Leads","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('Leads',$_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("Leads","Merge",'') == 'yes') +{ + global $current_user; + require("user_privileges/user_privileges_".$current_user->id.".php"); + + $wordTemplateResult = fetchWordTemplateList("Leads"); + $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); +} + +$tabid = getTabid("Leads"); +$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']); + +$check_button = Button_Check($module); +$smarty->assign("CHECK", $check_button); + +$smarty->assign("MODULE", $currentModule); +$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record'])); +$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar')); +$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events')); + +$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule)); +$smarty->assign("USE_ASTERISK", get_use_asterisk($current_user->id)); + +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['selected_tab_id'])) { + RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['selected_tab_id']), vtlib_purify($_REQUEST['selected_header'])); + } + $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession(); + $smarty->assign("SELECTEDHEADERS", $open_related_modules); +} +$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"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/DetailViewAjax.php b/oss/vtiger/trunk/modules/Leads/DetailViewAjax.php new file mode 100644 index 00000000..fd3c44f9 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/DetailViewAjax.php @@ -0,0 +1,47 @@ +retrieve_entity_info($crmid,"Leads"); + $modObj->column_fields[$fieldname] = $fieldvalue; + $modObj->id = $crmid; + $modObj->mode = "edit"; + $modObj->save("Leads"); + if($modObj->id != "") + { + echo ":#:SUCCESS"; + }else + { + echo ":#:FAILURE"; + } + }else + { + echo ":#:FAILURE"; + } +} elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE"){ + require_once 'include/ListView/RelatedListViewContents.php'; +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/EditView.php b/oss/vtiger/trunk/modules/Leads/EditView.php new file mode 100644 index 00000000..11a1886c --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/EditView.php @@ -0,0 +1,141 @@ +assign("SEARCH", $searchurl); +//4600 ends + +if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) { + $focus->id = $_REQUEST['record']; + $focus->mode = 'edit'; + $focus->retrieve_entity_info($_REQUEST['record'],"Leads"); + $focus->firstname=$focus->column_fields['firstname']; + $focus->lastname=$focus->column_fields['lastname']; +} +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); + + +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; +//retreiving the combo values array + +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); + +$category = getParentTab(); +$smarty->assign("CATEGORY",$category); + +$lead_name = $focus->lastname; +if (getFieldVisibilityPermission($currentModule, $current_user->id,'firstname') == '0') { + $lead_name .= ' '.$focus->firstname; +} +$smarty->assign("NAME",$lead_name); + +if(isset($cust_fld)) +{ + $smarty->assign("CUSTOMFIELD", $cust_fld); +} +if($focus->mode == 'edit') +{ + $smarty->assign("UPDATEINFO",updateInfo($focus->id)); + $smarty->assign("MODE", $focus->mode); +} + +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'])); +else +$smarty->assign("RETURN_MODULE","Leads"); +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()); +$smarty->assign("ID", $focus->id); +$smarty->assign("MODULE",$currentModule); +$smarty->assign("SINGLE_MOD",'Lead'); + +//create the html select code here and assign it +$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); +$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT'])); + + + $tabid = getTabid("Leads"); + $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']); + +$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 || $adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix.$mod_seq_no)) + echo '
'. getTranslatedString('LBL_DUPLICATE'). ' '. getTranslatedString($mod_seq_field['label']) + .' - '. getTranslatedString('LBL_CLICK') .' '.getTranslatedString('LBL_HERE').' ' + . getTranslatedString('LBL_TO_CONFIGURE'). ' '. getTranslatedString($mod_seq_field['label']) .''; + 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"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/ExportRecords.php b/oss/vtiger/trunk/modules/Leads/ExportRecords.php new file mode 100644 index 00000000..dcbf10eb --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/ExportRecords.php @@ -0,0 +1,13 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/FindDuplicateRecords.php b/oss/vtiger/trunk/modules/Leads/FindDuplicateRecords.php new file mode 100644 index 00000000..02efee01 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/FindDuplicateRecords.php @@ -0,0 +1,107 @@ +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 "
"; + echo "
+ + + + + + + + + +
+ $app_strings[LBL_DUP_PERMISSION] $req_module $errormsg
+ $app_strings[LBL_GO_BACK]
+
+
"; + echo "
"; + 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'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/Import.php b/oss/vtiger/trunk/modules/Leads/Import.php new file mode 100644 index 00000000..ae570f61 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/Import.php @@ -0,0 +1,14 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/LeadConvertToEntities.php b/oss/vtiger/trunk/modules/Leads/LeadConvertToEntities.php new file mode 100644 index 00000000..e083bd77 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/LeadConvertToEntities.php @@ -0,0 +1,613 @@ +id.'.php'); +if($assigned_to == "U") + $log->debug("id = $id \n assigned_user_id = $assigned_user_id \n createpotential = $createpotential \n close date = $close_date \n current user id = $current_user_id \n accountname = $accountname \n module = $module"); +else + $log->debug("id = $id \n assigned_user_id = $assigned_group_id \n createpotential = $createpotential \n close date = $close_date \n current user id = $current_user_id \n accountname = $accountname \n module = $module"); + +$rate_symbol=getCurrencySymbolandCRate($user_info['currency_id']); +$rate = $rate_symbol['rate']; +if($potential_amount != '') + $potential_amount = convertToDollar($potential_amount,$rate); + +//Retrieve info from all the vtiger_tables related to leads +$focus = new Leads(); +$focus->retrieve_entity_info($id,"Leads"); + +//get all the lead related columns +$row = $focus->column_fields; + +$date_entered = $adb->formatDate(date('Y-m-d H:i:s'), true); +$date_modified = $adb->formatDate(date('Y-m-d H:i:s'), true); + +/** Function for getting the custom values from leads and saving to vtiger_account/contact/potential custom vtiger_fields. + * @param string $type - Field Type (eg: text, list) + * @param integer $type_id - Field Type ID +*/ +function getInsertValues($type,$type_id) +{ + global $id,$adb,$log; + $log->debug("Entering getInsertValues(".$type.",".$type_id.") method ..."); + $sql_convert_lead="select * from vtiger_convertleadmapping "; + $convert_result = $adb->pquery($sql_convert_lead, array()); + $noofrows = $adb->num_rows($convert_result); + + $value_cf_array = Array(); + for($i=0;$i<$noofrows;$i++) + { + $flag="false"; + $log->info("In vtiger_convertleadmapping function"); + $lead_id=$adb->query_result($convert_result,$i,"leadfid"); + //Getting the relatd customfields for Accounts/Contact/potential from vtiger_convertleadmapping vtiger_table + $account_id_val=$adb->query_result($convert_result,$i,"accountfid"); + $contact_id_val=$adb->query_result($convert_result,$i,"contactfid"); + $potential_id_val=$adb->query_result($convert_result,$i,"potentialfid"); + + $sql_leads_column="select vtiger_field.uitype,vtiger_field.fieldid,vtiger_field.columnname from vtiger_field,vtiger_tab where vtiger_field.tabid=vtiger_tab.tabid and generatedtype=2 and vtiger_tab.name='Leads' and fieldid=? and vtiger_field.presence in (0,2)"; //getting the columnname for the customfield of the lead + $log->debug("Lead's custom vtiger_field coumn name is ".$sql_leads_column); + + $lead_column_result = $adb->pquery($sql_leads_column, array($lead_id)); + $leads_no_rows = $adb->num_rows($lead_column_result); + if($leads_no_rows>0) + { + $lead_column_name=$adb->query_result($lead_column_result,0,"columnname"); + $lead_uitype=$adb->query_result($lead_column_result,0,"uitype"); + $sql_leads_val="select $lead_column_name from vtiger_leadscf where leadid=?"; //custom vtiger_field value for lead + $lead_val_result = $adb->pquery($sql_leads_val,array($id)); + $lead_value=$adb->query_result($lead_val_result,0,$lead_column_name); + $log->debug("Lead's custom vtiger_field value is ".$lead_value); + } + //Query for getting the column name for Accounts/Contacts/Potentials if custom vtiger_field for lead is mappped + $sql_type="select vtiger_field.fieldid,vtiger_field.uitype,vtiger_field.columnname from vtiger_field,vtiger_tab where vtiger_field.tabid=vtiger_tab.tabid and generatedtype=2 and vtiger_field.presence in (0,2) and vtiger_tab.name="; + $params = array(); + if($type=="Accounts") + { + if($account_id_val!="" && $account_id_val!=0) + { + $flag="true"; + $log->info("Getting the Accounts custom vtiger_field column name "); + $sql_type.="'Accounts' and fieldid=?"; + array_push($params, $account_id_val); + } + } + else if($type == "Contacts") + { + if($contact_id_val!="" && $contact_id_val!=0) + { + $flag="true"; + $log->info("Getting the Contacts custom vtiger_field column name "); + $sql_type.="'Contacts' and fieldid=?"; + array_push($params, $contact_id_val); + } + } + else if($type == "Potentials") + { + if($potential_id_val!="" && $potential_id_val!=0) + { + $flag="true"; + $log->info("Getting the Potentials custom vtiger_field column name "); + $sql_type.="'Potentials' and fieldid=?"; + array_push($params, $potential_id_val); + } + } + if($flag=="true") + { + $type_result=$adb->pquery($sql_type, $params); + //To construct the cf array + $colname = $adb->query_result($type_result,0,"columnname"); + $type_insert_column[] = $colname; + $type_uitype =$adb->query_result($type_result,0,"uitype") ; + + //To construct the cf array + $ins_val = $adb->query_result($lead_val_result,0,$lead_column_name); + + //This array is used to store the tablename as the key and the value for that table in the custom field of the uitype only for 15 and 33(Multiselect cf)... + if($lead_uitype == 33 || $lead_uitype == 15) { + $lead_val_arr[$colname] = $lead_column_name; + $value_cf_array[$colname]=$ins_val; + } + + $insert_value[] = $ins_val; + } + } + if(count($value_cf_array) > 0) + { + if(count($type_insert_column) > 0) + { + foreach($value_cf_array as $key => $value) + { + $tableName = $key; + $tableVal = $value; + if($tableVal != '') + { + $tab_val = explode ("|##|",$value); + if(count($tab_val)>0) + { + for($k=0;$knum_rows($adb->query($sql)); + $count=0; + for($n=0;$n < $numRow;$n++) + { + $exist_val = $adb->query_result($adb->query($sql),$n,$tableName); + if(trim($exist_val) == trim($val)) + { + $count++; + } + } + if($count == 0) + { + $cfId=$adb->getUniqueID("vtiger_$tableName"); + $unique_picklist_value = getUniquePicklistID(); + + $qry="insert into vtiger_$tableName values(?,?,?,?)"; + $adb->pquery($qry, array($cfId,trim($val),1,$unique_picklist_value)); + //added to fix ticket#4492 + $picklistId_qry = "select picklistid from vtiger_picklist where name=?"; + $picklistId_res = $adb->pquery($picklistId_qry,array($tableName)); + $picklist_Id = $adb->query_result($picklistId_res,0,'picklistid'); + //While adding a new value into the picklist table, the roleid's which has permission for the lead cf will only given permission for contacts,potentials and account module while converting. -- refer ticket #4885 --- + $role_qry = "select roleid from vtiger_role2picklist where picklistvalueid in (select picklist_valueid from vtiger_".$lead_val_arr[$tableName]." where ".$lead_val_arr[$tableName]."='".trim($val)."')"; + $numOFRole=$adb->num_rows($adb->query($role_qry)); + for($l=0;$l<$numOFRole;$l++) + { + $role_id = $adb->query_result($adb->query($role_qry),$l,'roleid'); + $sort_qry = "select max(sortid)+1 as sortid from vtiger_role2picklist where picklistid=? and roleid=?"; + $sort_qry_res = $adb->pquery($sort_qry,array($picklist_Id,$role_id)); + $sort_id = $adb->query_result($sort_qry_res,0,'sortid'); + $role_picklist = "insert into vtiger_role2picklist values (?,?,?,?)"; + $adb->pquery($role_picklist,array($role_id,$unique_picklist_value,$picklist_Id,$sort_id)); + } + //end + } + } + } + + } + } + } + } + $log->debug("columns to be inserted are ".$type_insert_column); + $log->debug("columns to be inserted are ".$insert_value); + $values = array ('columns'=>$type_insert_column,'values'=>$insert_value); + $log->debug("Exiting getInsertValues method ..."); + return $values; +} +//function Ends + +/** Function used to get the lead related Notes and Attachments with other entities Account, Contact and Potential + * @param integer $id - leadid + * @param integer $accountid - related entity id (accountid) + */ +function getRelatedNotesAttachments($id,$related_id) +{ + global $adb,$log,$id; + $log->debug("Entering getRelatedNotesAttachments(".$id.",".$related_id.") method ..."); + + $sql_lead_notes ="select * from vtiger_senotesrel where crmid=?"; + $lead_notes_result = $adb->pquery($sql_lead_notes, array($id)); + $noofrows = $adb->num_rows($lead_notes_result); + + for($i=0; $i<$noofrows;$i++ ) + { + + $lead_related_note_id=$adb->query_result($lead_notes_result,$i,"notesid"); + $log->debug("Lead related note id ".$lead_related_note_id); + + $sql_insert_notes="insert into vtiger_senotesrel(crmid,notesid) values (?,?)"; + $adb->pquery($sql_insert_notes, array($related_id, $lead_related_note_id)); + } + + $sql_lead_attachment="select * from vtiger_seattachmentsrel where crmid=?"; + $lead_attachment_result = $adb->pquery($sql_lead_attachment, array($id)); + $noofrows = $adb->num_rows($lead_attachment_result); + + for($i=0;$i<$noofrows;$i++) + { + $lead_related_attachment_id=$adb->query_result($lead_attachment_result,$i,"attachmentsid"); + $log->debug("Lead related attachment id ".$lead_related_attachment_id); + + $sql_insert_attachment="insert into vtiger_seattachmentsrel(crmid,attachmentsid) values (?,?)"; + $adb->pquery($sql_insert_attachment, array($related_id, $lead_related_attachment_id)); + } + $log->debug("Exiting getRelatedNotesAttachments method ..."); + +} + +/** Function used to get the lead related activities with other entities Account and Contact + * @param integer $accountid - related entity id + * @param integer $contact_id - related entity id + */ +function getRelatedActivities($accountid,$contact_id) +{ + global $adb,$log,$id; + $log->debug("Entering getRelatedActivities(".$accountid.",".$contact_id.") method ..."); + $sql_lead_activity="select * from vtiger_seactivityrel where crmid=?"; + $lead_activity_result = $adb->pquery($sql_lead_activity, array($id)); + $noofrows = $adb->num_rows($lead_activity_result); + for($i=0;$i<$noofrows;$i++) + { + $lead_related_activity_id=$adb->query_result($lead_activity_result,$i,"activityid"); + $log->debug("Lead related vtiger_activity id ".$lead_related_activity_id); + + $sql_type_email="select setype from vtiger_crmentity where crmid=?"; + $type_email_result = $adb->pquery($sql_type_email, array($lead_related_activity_id)); + $type=$adb->query_result($type_email_result,0,"setype"); + $log->debug("type of vtiger_activity id ".$type); + + $sql_delete_lead_activity="delete from vtiger_seactivityrel where crmid=?"; + $adb->pquery($sql_delete_lead_activity, array($id)); + + if($type != "Emails") + { + $sql_insert_account_activity="insert into vtiger_seactivityrel(crmid,activityid) values (?,?)"; + $adb->pquery($sql_insert_account_activity, array($accountid, $lead_related_activity_id)); + + $sql_insert_contact_activity="insert into vtiger_cntactivityrel(contactid,activityid) values (?,?)"; + $adb->pquery($sql_insert_contact_activity, array($contact_id, $lead_related_activity_id)); + } + else + { + $sql_insert_contact_activity="insert into vtiger_seactivityrel(crmid,activityid) values (?,?)"; + $adb->pquery($sql_insert_contact_activity, array($contact_id, $lead_related_activity_id)); + } + } + $log->debug("Exiting getRelatedActivities method ..."); + +} + +/** Function used to save the lead related products with other entities Account, Contact and Potential + * $leadid - leadid + * $relatedid - related entity id (accountid/contactid/potentialid) + * $setype - related module(Accounts/Contacts/Potentials) + */ +function saveLeadRelatedProducts($leadid, $relatedid, $setype) +{ + global $adb, $log; + $log->debug("Entering into function saveLeadRelatedProducts($leadid, $relatedid)"); + + $product_result = $adb->pquery("select * from vtiger_seproductsrel where crmid=?", array($leadid)); + $noofproducts = $adb->num_rows($product_result); + for($i = 0; $i < $noofproducts; $i++) + { + $productid = $adb->query_result($product_result,$i,'productid'); + $adb->pquery("insert into vtiger_seproductsrel values(?,?,?)", array($relatedid, $productid, $setype)); + } + + $log->debug("Exit from function saveLeadRelatedProducts."); +} + +/** Function used to save the lead related Campaigns with Contact + * $leadid - leadid + * $relatedid - related entity id (contactid) + */ +function saveLeadRelatedCampaigns($leadid, $relatedid) +{ + global $adb, $log; + $log->debug("Entering into function saveLeadRelatedCampaigns($leadid, $relatedid)"); + + $campaign_result = $adb->pquery("select * from vtiger_campaignleadrel where leadid=?", array($leadid)); + $noofcampaigns = $adb->num_rows($campaign_result); + for($i = 0; $i < $noofcampaigns; $i++) + { + $campaignid = $adb->query_result($campaign_result,$i,'campaignid'); + + $adb->pquery("insert into vtiger_campaigncontrel (campaignid, contactid, campaignrelstatusid) values(?,?,1)", array($campaignid, $relatedid)); + } + $log->debug("Exit from function saveLeadRelatedCampaigns."); +} +function saveLeadConvertedAccounts($leadid,$relatedid){ + global $adb, $log; + $log->debug("Entering into function saveLeadConvertedAccounts($leadid, $relatedid)"); + $campaign_result = $adb->pquery("select * from vtiger_campaignleadrel where leadid=?", array($leadid)); + $noofcampaigns = $adb->num_rows($campaign_result); + for($i = 0; $i < $noofcampaigns; $i++) + { + $campaignid = $adb->query_result($campaign_result,$i,'campaignid'); + $adb->pquery("INSERT INTO vtiger_campaignaccountrel (campaignid, accountid, campaignrelstatusid) values(?,?,1)",array($campaignid,$relatedid)); + + } + $log->debug("Exit from function saveLeadConvertedAccounts."); +} +$crmid =''; +if(vtlib_isModuleActive('Accounts') && isPermitted("Accounts","EditView") =='yes'){ + /*Code integrated to avoid duplicate Account creation during ConvertLead Operation START-- by Bharathi*/ + $acc_query = "select vtiger_account.accountid from vtiger_account left join vtiger_crmentity on vtiger_account.accountid = vtiger_crmentity.crmid where vtiger_crmentity.deleted=0 and vtiger_account.accountname = ?"; + $acc_res = $adb->pquery($acc_query, array($accountname)); + $acc_rows = $adb->num_rows($acc_res); + if($acc_rows != 0){ + $crmid = $adb->query_result($acc_res,0,"accountid"); + //Retrieve the lead related products and relate them with this new account + getRelatedNotesAttachments($id,$crmid); + saveLeadRelatedProducts($id, $crmid, "Accounts"); + saveLeadRelations($id, $crmid, "Accounts"); + $accountid=$crmid; + saveLeadConvertedAccounts($id,$accountid); + + } else if($accountname==''){ + $crmid=''; + } else + { + $crmid = $adb->getUniqueID("vtiger_crmentity"); + + //Saving Account - starts + + $sql_crmentity = "insert into vtiger_crmentity(crmid,smcreatorid,smownerid,setype,presence,createdtime,modifiedtime,deleted,description) values(?,?,?,?,?,?,?,?,?)"; + $sql_params = array($crmid, $current_user_id, $assigned_user_id, 'Accounts', 1, $date_entered, $date_modified, 0, $row['description']); + $adb->pquery($sql_crmentity, $sql_params); + + //Module Sequence Numbering + require_once('modules/Accounts/Accounts.php'); + $acc_no_focus = new Accounts(); + $account_no = $acc_no_focus->setModuleSeqNumber("increment",'Accounts'); + // END + + /* Modified by Minnie to fix the convertlead issue -- START*/ + if(isset($row["annualrevenue"]) && !empty($row["annualrevenue"])) $annualrevenue = $row["annualrevenue"]; + else $annualrevenue = 'null'; + + if(isset($row["noofemployees"]) && !empty($row["noofemployees"])) $employees = $row["noofemployees"]; + else $employees = 'null'; + + $sql_insert_account = "INSERT INTO vtiger_account (account_no,accountid,accountname,industry,annualrevenue,phone,fax,rating,email1,website,employees) VALUES (?,?,?,?,?,?,?,?,?,?,?)"; + /* Modified by Minnie -- END*/ + $account_params = array($account_no,$crmid, $accountname, $row["industry"], $annualrevenue, $row["phone"], $row["fax"], $row["rating"], $row["email"], $row["website"], $employees); + $adb->pquery($sql_insert_account, $account_params); + + /*if($assigned_to !="U"){ + $sql_crmentity = "insert into vtiger_accountgrouprelation(accountid,groupname) values(?,?)"; + $sql_params = array($crmid,$assigned_group_name); + $adb->pquery($sql_crmentity, $sql_params); + }*/ + + $sql_insert_accountbillads = "INSERT INTO vtiger_accountbillads (accountaddressid,bill_city,bill_code,bill_country,bill_state,bill_street,bill_pobox) VALUES (?,?,?,?,?,?,?)"; + $billads_params = array($crmid, $row["city"], $row["code"], $row["country"], $row["state"], $row["lane"], $row["pobox"]); + $adb->pquery($sql_insert_accountbillads, $billads_params); + + $sql_insert_accountshipads = "INSERT INTO vtiger_accountshipads (accountaddressid,ship_city,ship_code,ship_country,ship_pobox,ship_state,ship_street) VALUES (?,?,?,?,?,?,?)"; + $shipads_params = array($crmid, $row["city"], $row["code"], $row["country"], $row["pobox"], $row["state"], $row["lane"]); + $adb->pquery($sql_insert_accountshipads, $shipads_params); + + //Getting the custom vtiger_field values from leads and inserting into Accounts if the vtiger_field is mapped - Jaguar + $col_val= getInsertValues("Accounts",$crmid); + $insert_columns = $col_val['columns']; + $insert_columns[] = "accountid"; + $insert_values = $col_val['values']; + $insert_values[] = $crmid; + $insert_val_str = generateQuestionMarks($insert_values); + $sql_insert_accountcustomfield = "INSERT INTO vtiger_accountscf (". implode(",",$insert_columns) .") VALUES (".$insert_val_str.")"; + $adb->pquery($sql_insert_accountcustomfield, $insert_values); + //Saving Account - ends + + getRelatedNotesAttachments($id,$crmid); + //Retrieve the lead related products and relate them with this new account + saveLeadRelatedProducts($id, $crmid, "Accounts"); + saveLeadRelations($id, $crmid, "Accounts"); + $accountid = $crmid; + //Retrieve the lead related Campaigns and relate them with this new Account + saveLeadConvertedAccounts($id, $accountid); + } +} +//Up to this, Account related data save finshed + +if(vtlib_isModuleActive('Contacts') && isPermitted("Contacts","EditView") =='yes'){ + $date_entered = $adb->formatDate(date('Y-m-d H:i:s'), true); + $date_modified = $adb->formatDate(date('Y-m-d H:i:s'), true); + + //Saving Contact - starts + $crmcontactid = $adb->getUniqueID("vtiger_crmentity"); + + $sql_crmentity1 = "insert into vtiger_crmentity(crmid,smcreatorid,smownerid,setype,presence,deleted,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?,?,?)"; + $sql_params = array($crmcontactid, $current_user_id, $assigned_user_id, 'Contacts', 0, 0, $row['description'], $date_entered, $date_modified); + $adb->pquery($sql_crmentity1, $sql_params); + + $contact_id = $crmcontactid; + $log->debug("contact id is ".$contact_id); + + // Module Sequence Numbering + require_once('modules/Contacts/Contacts.php'); + $cont_no_focus = new Contacts(); + $contact_no = $cont_no_focus->setModuleSeqNumber("increment",'Contacts'); + // END + + $sql_insert_contact = "INSERT INTO vtiger_contactdetails (contact_no,contactid,accountid,salutation,firstname,lastname,email,phone,mobile,title,fax,yahooid) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; + $contact_params = array($contact_no, $contact_id, $crmid, $row["salutationtype"], $row["firstname"], $row["lastname"], $row["email"], $row["phone"], $row["mobile"], $row["designation"], $row["fax"], $row['yahooid']); + $adb->pquery($sql_insert_contact, $contact_params); + + /*if($assigned_to !="U"){ + $sql_crmentity = "insert into vtiger_contactgrouprelation(contactid,groupname) values(?,?)"; + $sql_params = array($contact_id,$assigned_group_name); + $adb->pquery($sql_crmentity, $sql_params); + }*/ + $sql_insert_contactsubdetails = "INSERT INTO vtiger_contactsubdetails (contactsubscriptionid,homephone,otherphone,leadsource) VALUES (?,?,?,?)"; + $c_subd_params = array($contact_id, '', '', $row['leadsource']); + $adb->pquery($sql_insert_contactsubdetails, $c_subd_params); + + $sql_insert_contactaddress = "INSERT INTO vtiger_contactaddress (contactaddressid,mailingcity,mailingstreet,mailingstate,mailingcountry,mailingpobox,mailingzip) VALUES (?,?,?,?,?,?,?)"; + $c_addr_params = array($contact_id, $row["city"], $row["lane"], $row['state'], $row["country"], $row["pobox"], $row['code']); + $adb->pquery($sql_insert_contactaddress, $c_addr_params); + + $sql_insert_customerdetails = "INSERT INTO vtiger_customerdetails (customerid) VALUES (?)"; + $adb->pquery($sql_insert_customerdetails, array($contact_id)); + + //Getting the customfield values from leads and inserting into the respected ContactCustomfield to which it is mapped - Jaguar + $col_val= getInsertValues("Contacts",$contact_id); + $insert_columns = $col_val['columns']; + $insert_columns[] = "contactid"; + $insert_values = $col_val['values']; + $insert_values[] = $contact_id; + $insert_val_str = generateQuestionMarks($insert_values); + $sql_insert_contactcustomfield = "INSERT INTO vtiger_contactscf (". implode(",",$insert_columns) .") VALUES (".$insert_val_str.")"; + $adb->pquery($sql_insert_contactcustomfield, $insert_values); + //Saving Contact - ends + + getRelatedActivities($crmid,$contact_id); //To convert relates Activites and Email -Jaguar + getRelatedNotesAttachments($id,$contact_id); + + //Retrieve the lead related products and relate them with this new contact + saveLeadRelatedProducts($id, $contact_id, "Contacts"); + saveLeadRelations($id, $contact_id, "Contacts"); + + //Retrieve the lead related Campaigns and relate them with this new contact --Minnie + saveLeadRelatedCampaigns($id, $contact_id); +} + +//Up to this, Contact related data save finshed + +//Saving Potential - starts +if((! isset($createpotential) || ! $createpotential == "on") && (!empty($potential_name)) && isPermitted("Potentials","EditView") =='yes' && ($crmid != '' || $crmcontactid != '') && vtlib_isModuleActive('Potentials')) +{ + $log->info("createpotential is not set"); + + $date_entered = $adb->formatDate(date('Y-m-d H:i:s'), true); + $date_modified = $adb->formatDate(date('Y-m-d H:i:s'), true); + + $oppid = $adb->getUniqueID("vtiger_crmentity"); + + $sql_crmentity = "insert into vtiger_crmentity(crmid,smcreatorid,smownerid,setype,presence,deleted,createdtime,modifiedtime,description) values(?,?,?,?,?,?,?,?,?)"; + $sql_params = array($oppid, $current_user_id, $assigned_user_id, 'Potentials', 0, 0, $date_entered, $date_modified, $row['description']); + $adb->pquery($sql_crmentity, $sql_params); + + // Module Sequence Numbering + require_once('modules/Potentials/Potentials.php'); + $pot_no_focus = new Potentials(); + $potential_no = $pot_no_focus->setModuleSeqNumber("increment",'Potentials'); + // END + + if(!isset($potential_amount) || $potential_amount == null) + { + $potential_amount=0; + } + + if($crmid!=''){ + $related_to = $crmid; + } else { + $related_to = $crmcontactid; + } + + $sql_insert_opp = "INSERT INTO vtiger_potential (potential_no,potentialid,related_to,potentialname,leadsource,closingdate,sales_stage,amount) VALUES (?,?,?,?,?,?,?,?)"; + $opp_params = array($potential_no, $oppid, $related_to, $potential_name, $row['leadsource'], $close_date, $potential_sales_stage, $potential_amount); + $adb->pquery($sql_insert_opp, $opp_params); + + //Getting the customfield values from leads and inserting into the respected PotentialCustomfield to which it is mapped - Jaguar + $col_val= getInsertValues("Potentials",$oppid); + $insert_columns = $col_val['columns']; + $insert_columns[] = "potentialid"; + $insert_values = $col_val['values']; + $insert_values[] = $oppid; + $insert_val_str = generateQuestionMarks($insert_values); + $sql_insert_potentialcustomfield = "INSERT INTO vtiger_potentialscf (". implode(",",$insert_columns) .") VALUES (".$insert_val_str.")"; + $adb->pquery($sql_insert_potentialcustomfield, $insert_values); + + if($crmid != '' && $contact_id != ''){ + $sql_insert2contpotentialrel ="insert into vtiger_contpotentialrel values(?,?)"; + $adb->pquery($sql_insert2contpotentialrel, array($contact_id, $oppid)); + } + //Retrieve the lead related products and relate them with this new potential + saveLeadRelatedProducts($id, $oppid, "Potentials"); + saveLeadRelations($id, $oppid, "Potentials"); +} +//Saving Potential - ends +//Up to this, Potential related data save finshed + + +//Deleting from the vtiger_tracker +$sql_delete_tracker= "DELETE from vtiger_tracker where item_id=?"; +$adb->pquery($sql_delete_tracker, array($id)); +$category = getParentTab(); +//Updating the deleted status +if($crmid != '' || $crmcontactid != ''){ + $sql_update_converted = "UPDATE vtiger_leaddetails SET converted = 1 where leadid=?"; + $adb->pquery($sql_update_converted, array($id)); + //updating the campaign-lead relation --Minnie + $sql_update_campleadrel = "delete from vtiger_campaignleadrel where leadid=?"; + $adb->pquery($sql_update_campleadrel, array($id)); +} +if($crmid!=''){ + header("Location: index.php?action=DetailView&module=Accounts&record=$crmid&parenttab=$category"); +} elseif($crmcontactid != '') { + header("Location: index.php?action=DetailView&module=Contacts&record=$crmcontactid&parenttab=$category"); +}else{ + echo ""; + echo "
"; + echo "
+ + + + + + + + + +
$currentModule $app_strings[CANNOT_CONVERT]
+ $app_strings[LBL_GO_BACK]
+
"; + echo "
"; +} + +/** Function used to save the lead related services with other entities Account, Contact and Potential + * $leadid - leadid + * $relatedid - related entity id (accountid/contactid/potentialid) + * $setype - related module(Accounts/Contacts/Potentials) + */ +function saveLeadRelations($leadid, $relatedid, $setype) +{ + global $adb, $log; + $log->debug("Entering into function saveLeadRelatedProducts($leadid, $relatedid)"); + + $result = $adb->pquery("select * from vtiger_crmentityrel where crmid=?", array($leadid)); + $noofproducts = $adb->num_rows($result); + for($i = 0; $i < $noofproducts; $i++) + { + $recordid = $adb->query_result($result,$i,'relcrmid'); + $recordmodule = $adb->query_result($result,$i,'relmodule'); + $adb->pquery("insert into vtiger_crmentityrel values(?,?,?,?)", array($relatedid, $setype, $recordid, $recordmodule)); + } + $result = $adb->pquery("select * from vtiger_crmentityrel where relcrmid=?", array($leadid)); + $noofproducts = $adb->num_rows($result); + for($i = 0; $i < $noofproducts; $i++) + { + $recordid = $adb->query_result($result,$i,'crmid'); + $recordmodule = $adb->query_result($result,$i,'module'); + $adb->pquery("insert into vtiger_crmentityrel values(?,?,?,?)", array($relatedid, $setype, $recordid, $recordmodule)); + } + + $log->debug("Exit from function saveLeadRelatedProducts."); +} + +?> diff --git a/oss/vtiger/trunk/modules/Leads/Leads.js b/oss/vtiger/trunk/modules/Leads/Leads.js new file mode 100644 index 00000000..a2ef6330 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/Leads.js @@ -0,0 +1,152 @@ +/********************************************************************************* +** 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(" +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); + //array_pop($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"); +} + +//<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>> + +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 tablename,columnname,fieldlabel from vtiger_field where tabid=7 and vtiger_field.presence in (0,2) order by tablename"; + $params1 = array(); +} +else +{ + $profileList = getCurrentUserProfileList(); + $query1="select vtiger_field.tablename,vtiger_field.columnname,vtiger_field.fieldlabel from vtiger_field 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 (7) 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"); + $querycolumns[$x] = $tablename.".".$columnname; + if($columnname == "smownerid") + { + $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 username,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"; + } + $field_label[$x] = "LEAD_".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); +//<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>> + +if(count($querycolumns) > 0) +{ + $selectcolumns = implode($querycolumns,","); + +$query = "select ".$selectcolumns." from vtiger_leaddetails + inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid + inner join vtiger_leadsubdetails on vtiger_leadsubdetails.leadsubscriptionid=vtiger_leaddetails.leadid + inner join vtiger_leadaddress on vtiger_leadaddress.leadaddressid=vtiger_leadsubdetails.leadsubscriptionid + inner join vtiger_leadscf on vtiger_leaddetails.leadid = vtiger_leadscf.leadid + left join vtiger_campaignleadrel on vtiger_leaddetails.leadid = vtiger_campaignleadrel.leadid + left join vtiger_campaignrelstatus on vtiger_campaignrelstatus.campaignrelstatusid = vtiger_campaignleadrel.campaignrelstatusid + LEFT JOIN vtiger_groups + ON vtiger_groups.groupid = vtiger_crmentity.smownerid + left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid + where vtiger_crmentity.deleted=0 and vtiger_leaddetails.leadid in (". generateQuestionMarks($mass_merge) .")"; + +$result = $adb->pquery($query, array($mass_merge)); +$avail_pick_arr = getAccessPickListValues('Leads'); +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 vtiger_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); + +?> + + + + diff --git a/oss/vtiger/trunk/modules/Leads/Popup.php b/oss/vtiger/trunk/modules/Leads/Popup.php new file mode 100644 index 00000000..88877b45 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/Popup.php @@ -0,0 +1,20 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/ProcessDuplicates.php b/oss/vtiger/trunk/modules/Leads/ProcessDuplicates.php new file mode 100644 index 00000000..bb5047fa --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/ProcessDuplicates.php @@ -0,0 +1,134 @@ +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,""); + } + } + + ?> + +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"); +} + +?> diff --git a/oss/vtiger/trunk/modules/Leads/QuickCreate.php b/oss/vtiger/trunk/modules/Leads/QuickCreate.php new file mode 100644 index 00000000..8d5998b8 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/QuickCreate.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/Save.php b/oss/vtiger/trunk/modules/Leads/Save.php new file mode 100644 index 00000000..24f142a5 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/Save.php @@ -0,0 +1,183 @@ +id); +$rate_symbol = getCurrencySymbolandCRate($currencyid); +$rate = $rate_symbol['rate']; +$curr_symbol=$rate_symbol['symbol']; +//added to fix 4600 +$search=vtlib_purify($_REQUEST['search_url']); + +if(isset($_REQUEST['record'])) +{ + $focus->id = $_REQUEST['record']; +} +if(isset($_REQUEST['mode'])) +{ + $focus->mode = $_REQUEST['mode']; +} + +//$focus->retrieve($_REQUEST['record']); + +foreach($focus->column_fields as $fieldname => $val) +{ + if(isset($_REQUEST[$fieldname])) { + if(is_array($_REQUEST[$fieldname])) + $value = $_REQUEST[$fieldname]; + else + $value = trim($_REQUEST[$fieldname]); + $log->info("the value is ".$value); + $focus->column_fields[$fieldname] = $value; + } +} +if(isset($_REQUEST['annualrevenue'])) { + $value = convertToDollar($_REQUEST['annualrevenue'],$rate); + $focus->column_fields['annualrevenue'] = $value; +} + +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']; +} + +$focus->save("Leads"); + +$return_id = $focus->id; + $log->info("the return id is ".$return_id); +$parenttab = getParentTab(); +if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']); +else $return_module = "Leads"; +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']); + +$local_log->debug("Saved record with id of ".$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']); + +if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == "Campaigns") +{ + if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") + { + $campLeadStatusResult = $adb->pquery("select campaignrelstatusid from vtiger_campaignleadrel where campaignid=? AND leadid=?",array($_REQUEST['return_id'], $focus->id)); + $leadStatus = $adb->query_result($campLeadStatusResult,0,'campaignrelstatusid'); + $sql = "delete from vtiger_campaignleadrel where leadid = ?"; + $adb->pquery($sql, array($focus->id)); + if(isset($leadStatus) && $leadStatus !=''){ + $sql = "insert into vtiger_campaignleadrel values (?,?,?)"; + $adb->pquery($sql, array($_REQUEST['return_id'], $focus->id,$leadStatus)); + } + else{ + $sql = "insert into vtiger_campaignleadrel values (?,?,1)"; + $adb->pquery($sql, array($_REQUEST['return_id'], $focus->id)); + } + } +} +header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&parenttab=$parenttab&viewname=$return_viewname&start=".vtlib_purify($_REQUEST['pagenumber']).$search); +/** Function to save the Lead custom fields info into database + * @param integer $entity_id - leadid +*/ +function save_customfields($entity_id) +{ + $log->debug("Entering save_customfields(".$entity_id.") method ..."); + $log->debug("save custom vtiger_field invoked ".$entity_id); + global $adb; + $dbquery="select * from customfields where module='Leads'"; + $result = $adb->pquery($dbquery, array()); + $custquery = "select * from leadcf where leadid=?"; + $cust_result = $adb->pquery($custquery, array($entity_id)); + if($adb->num_rows($result) != 0) + { + + $columns=''; + $params = array(); + $update=''; + $noofrows = $adb->num_rows($result); + for($i=0; $i<$noofrows; $i++) + { + $fldName=$adb->query_result($result,$i,"fieldlabel"); + $colName=$adb->query_result($result,$i,"column_name"); + if(isset($_REQUEST[$colName])) + { + $fldvalue=$_REQUEST[$colName]; + $log->info("the columnName is ".$fldvalue); + if(get_magic_quotes_gpc() == 1) + { + $fldvalue = stripslashes($fldvalue); + } + } + else + { + $fldvalue = ''; + } + if(isset($_REQUEST['record']) && $_REQUEST['record'] != '' && $adb->num_rows($cust_result) !=0) + { + //Update Block + if($i == 0) + { + $update = $colName.'=?'; + } + else + { + $update .= ', '.$colName.'=?'; + } + array_push($params, $fldvalue); + } + else + { + //Insert Block + if($i == 0) + { + $columns='leadid, '.$colName; + array_push($params, $entity_id); + } + else + { + $columns .= ', '.$colName; + } + array_push($params, $fldvalue); + } + + + } + if(isset($_REQUEST['record']) && $_REQUEST['record'] != '' && $adb->num_rows($cust_result) !=0) + { + //Update Block + $query = 'update leadcf SET '.$update.' where leadid=?'; + array_push($params, $entity_id); + $adb->pquery($query, $params); + } + else + { + //Insert Block + $query = 'insert into leadcf ('.$columns.') values('. generateQuestionMarks($params) .')'; + $adb->pquery($query, $params); + } + + } + $log->debug("Exiting save_customfields method ..."); +} +?> diff --git a/oss/vtiger/trunk/modules/Leads/Settings.php b/oss/vtiger/trunk/modules/Leads/Settings.php new file mode 100644 index 00000000..1fb34223 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/Settings.php @@ -0,0 +1,76 @@ +pquery("select * from vtiger_settings_field where name = ? and active=0",array('LBL_FIELDFORMULAS')); + if($adb->num_rows($sql_result) > 0) { + $menu_array['FieldFormulas']['location'] = $adb->query_result($sql_result, 0, 'linkto').'&formodule='.$module; + $menu_array['FieldFormulas']['image_src'] = $adb->query_result($sql_result, 0, 'iconpath'); + $menu_array['FieldFormulas']['desc'] = getTranslatedString($adb->query_result($sql_result, 0, 'description'), 'FieldFormulas'); + $menu_array['FieldFormulas']['label'] = getTranslatedString($adb->query_result($sql_result, 0, 'name'), 'FieldFormulas'); + } +} + +if(vtlib_isModuleActive('Tooltip')){ + $sql_result = $adb->pquery("select * from vtiger_settings_field where name = ? and active=0",array('LBL_TOOLTIP_MANAGEMENT')); + if($adb->num_rows($sql_result) > 0) { + $menu_array['Tooltip']['location'] = $adb->query_result($sql_result, 0, 'linkto').'&formodule='.$module; + $menu_array['Tooltip']['image_src'] = vtiger_imageurl($adb->query_result($sql_result, 0, 'iconpath'), $theme); + $menu_array['Tooltip']['desc'] = getTranslatedString($adb->query_result($sql_result, 0, 'description'),'Tooltip'); + $menu_array['Tooltip']['label'] = getTranslatedString($adb->query_result($sql_result, 0, 'name'),'Tooltip'); + } +} + +$menu_array['LeadsMapping']['location'] = 'index.php?module=Settings&action=CustomFieldList&parenttab=Settings&formodule='.$module; +$menu_array['LeadsMapping']['image_src'] = vtiger_imageurl('custom.gif', $theme); +$menu_array['LeadsMapping']['desc'] = getTranslatedString('LEADS_CUSTOM_FIELD_MAPPING_DESCRIPTION'); +$menu_array['LeadsMapping']['label'] = getTranslatedString('LEADS_CUSTOM_FIELD_MAPPING'); + + +$sql_result = $adb->pquery("SELECT * FROM vtiger_settings_field WHERE name = ? AND active=0",array('LBL_WORKFLOW_LIST')); +if($adb->num_rows($sql_result) > 0) { + $menu_array['Workflow']['location'] = $adb->query_result($sql_result, 0, 'linkto').'&list_module='.$module; + $menu_array['Workflow']['image_src'] = vtiger_imageurl($adb->query_result($sql_result, 0, 'iconpath'), $theme); + $menu_array['Workflow']['desc'] = getTranslatedString($adb->query_result($sql_result, 0, 'description'),'com_vtiger_workflow'); + $menu_array['Workflow']['label'] = getTranslatedString($adb->query_result($sql_result, 0, 'name'),'com_vtiger_workflow'); +} + +//add blanks for 3-column layout +$count = count($menu_array)%3; +if($count>0) { + for($i=0;$i<3-$count;$i++) { + $menu_array[] = array(); + } +} + +$smarty->assign("MOD",$mod_strings); +$smarty->assign("APP",$app_strings); +$smarty->assign("IMAGE_PATH", "themes/$theme/images/"); +$smarty->assign('MODULE',$module); +$smarty->assign('MODULE_LBL',getTranslatedString($module, $module)); +$smarty->assign('MENU_ARRAY', $menu_array); + +$smarty->display(vtlib_getModuleTemplate('Vtiger','Settings.tpl')); + +?> diff --git a/oss/vtiger/trunk/modules/Leads/TagCloud.php b/oss/vtiger/trunk/modules/Leads/TagCloud.php new file mode 100644 index 00000000..859b11ff --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/TagCloud.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/UnifiedSearch.php b/oss/vtiger/trunk/modules/Leads/UnifiedSearch.php new file mode 100644 index 00000000..9a37320c --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/UnifiedSearch.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Leads/index.php b/oss/vtiger/trunk/modules/Leads/index.php new file mode 100644 index 00000000..acccb64c --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/index.php @@ -0,0 +1,21 @@ + diff --git a/oss/vtiger/trunk/modules/Leads/language/en_us.lang.php b/oss/vtiger/trunk/modules/Leads/language/en_us.lang.php new file mode 100644 index 00000000..8dcdec4e --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/language/en_us.lang.php @@ -0,0 +1,244 @@ +'Leads', +'LBL_DIRECT_REPORTS_FORM_NAME'=>'Direct Reports', +'LBL_MODULE_TITLE'=>'Leads: Home', +'LBL_SEARCH_FORM_TITLE'=>'Lead Search', +'LBL_LIST_FORM_TITLE'=>'Lead List', +'LBL_NEW_FORM_TITLE'=>'New Lead', +'LBL_LEAD_OPP_FORM_TITLE'=>'Contact-Opportunity:', +'LBL_LEAD'=>'Lead:', +'LBL_ADDRESS_INFORMATION'=>'Address Information', +'LBL_CUSTOM_INFORMATION'=>'Custom Information', + +'LBL_LIST_NAME'=>'Name', +'LBL_LIST_LAST_NAME'=>'Last Name', +'LBL_LIST_COMPANY'=>'Company', +'LBL_LIST_WEBSITE'=>'Website', +'LBL_LIST_LEAD_NAME'=>'Lead Name', +'LBL_LIST_EMAIL'=>'Email', +'LBL_LIST_PHONE'=>'Phone', +'LBL_LIST_LEAD_ROLE'=>'Role', + +'LBL_NAME'=>'Name:', +'LBL_LEAD_NAME'=>'Lead Name:', +'LBL_LEAD_INFORMATION'=>'Lead Information', +'LBL_FIRST_NAME'=>'First Name:', +'LBL_PHONE'=>'Phone:', +'LBL_COMPANY'=>'Company:', +'LBL_DESIGNATION'=>'Designation:', +'LBL_PHONE'=>'Phone:', +'LBL_LAST_NAME'=>'Last Name:', +'LBL_MOBILE'=>'Mobile:', +'LBL_EMAIL'=>'Email:', +'LBL_LEAD_SOURCE'=>'Lead Source:', +'LBL_LEAD_STATUS'=>'Lead Status:', +'LBL_WEBSITE'=>'Website:', +'LBL_FAX'=>'Fax:', +'LBL_INDUSTRY'=>'Industry:', +'LBL_ANNUAL_REVENUE'=>'Annual Revenue:', +'LBL_RATING'=>'Rating:', +'LBL_LICENSE_KEY'=>'License Key:', +'LBL_NO_OF_EMPLOYEES'=>'No. of Employees:', +'LBL_YAHOO_ID'=>'Yahoo! ID:', + +'LBL_ADDRESS_STREET'=>'Street:', +'LBL_ADDRESS_POSTAL_CODE'=>'Postal Code:', +'LBL_ADDRESS_CITY'=>'City:', +'LBL_ADDRESS_COUNTRY'=>'Country:', +'LBL_ADDRESS_STATE'=>'State:', +'LBL_ADDRESS'=>'Address:', +'LBL_DESCRIPTION_INFORMATION'=>'Description Information', +'LBL_DESCRIPTION'=>'Description:', + +'LBL_CONVERT_LEAD'=>'Convert Lead:', +'LBL_CONVERT_LEAD_INFORMATION'=>'Convert Lead Information', +'LBL_ACCOUNT_NAME'=>'Account Name', +'LBL_POTENTIAL_NAME'=>'Potential Name', +'LBL_POTENTIAL_CLOSE_DATE'=>'Potential Close Date', +'LBL_POTENTIAL_AMOUNT'=>'Potential Amount', +'LBL_POTENTIAL_SALES_STAGE'=>'Potential Sales Stage', + + +'NTC_DELETE_CONFIRMATION'=>'Are you sure you want to delete this record?', +'NTC_REMOVE_CONFIRMATION'=>'Are you sure you want to remove this contact from this case?', +'NTC_REMOVE_DIRECT_REPORT_CONFIRMATION'=>'Are you sure you want to remove this record as a direct vtiger_report?', +'NTC_REMOVE_OPP_CONFIRMATION'=>'Are you sure you want to remove this contact from this opportunity?', +'ERR_DELETE_RECORD'=>"en_us A record number must be specified to delete the contact.", +'NTC_COPY_PRIMARY_ADDRESS'=>'Copy primary address to alternate address', +'NTC_COPY_ALTERNATE_ADDRESS'=>'Copy alternate address to primary address', + +// Added vtiger_fields in fetchfile.php, import.php -- crm4-Beta +'LBL_COLON'=>' : ', +'LBL_IMPORT_LEADS'=>'Import Leads', +'LBL_LEADS_FILE_LIST'=>'Leads File List', +'LBL_INSTRUCTIONS'=>'Instructions', +'LBL_KINDLY_PROVIDE_AN_XLS_FILE'=>'Kindly provide an .xls file alone as input', +'LBL_PROVIDE_ATLEAST_ONE_FILE'=>'Please provide at least one file as input', + +'LBL_NONE'=>'None', +'LBL_ASSIGNED_TO'=>'Assigned To:', +'LBL_SELECT_LEAD'=>'Select Lead', +'LBL_GENERAL_INFORMATION'=>'General Information', +'LBL_DO_NOT_CREATE_NEW_POTENTIAL'=>'Do not create a New Potential upon Conversion', + +//for v4 release added +'LBL_NEW_POTENTIAL'=>'New Potential', +'LBL_POTENTIAL_TITLE'=>'Potentials', + +'LBL_NEW_TASK'=>'New Task', +'LBL_TASK_TITLE'=>'Tasks', +'LBL_NEW_CALL'=>'New Call', +'LBL_CALL_TITLE'=>'Calls', +'LBL_NEW_MEETING'=>'New Meeting', +'LBL_MEETING_TITLE'=>'Meetings', +'LBL_NEW_EMAIL'=>'New Email', +'LBL_EMAIL_TITLE'=>'Emails', +'LBL_NEW_NOTE'=>'New Document', +'LBL_NOTE_TITLE'=>'Documents', +'LBL_NEW_ATTACHMENT'=>'New Attachment', +'LBL_ATTACHMENT_TITLE'=>'Attachments', + + +//Added vtiger_fields after RC1 - Release +'LBL_ALL'=>'All', +'LBL_CONTACTED'=>'Contacted', +'LBL_LOST'=>'Lost', +'LBL_HOT'=>'Hot', +'LBL_COLD'=>'Cold', + +// Added for 4GA +'LBL_TOOL_FORM_TITLE'=>'Lead Tools', + +'LBL_SELECT_TEMPLATE_TO_MAIL_MERGE'=>'Select template to Mail Merge:', + +//Added for 4GA +'Salutation'=>'Salutation', +'First Name'=>'First Name', +'Phone'=>'Phone', +'Last Name'=>'Last Name', +'Mobile'=>'Mobile', +'Company'=>'Company', +'Fax'=>'Fax', +'Email'=>'Email', +'Lead Source'=>'Lead Source', +'Website'=>'Website', +'Annual Revenue'=>'Annual Revenue', +'Lead Status'=>'Lead Status', +'Industry'=>'Industry', +'Rating'=>'Rating', +'No Of Employees'=>'No Of Employees', +'Assigned To'=>'Assigned To', +'Yahoo Id'=>'Yahoo Id', +'Created Time'=>'Created Time', +'Modified Time'=>'Modified Time', +'Street'=>'Street', +'Postal Code'=>'Postal Code', +'City'=>'City', +'Country'=>'Country', +'State'=>'State', +'Description'=>'Description', +'Po Box'=>'PO Box', +'Campaign Source'=>'Campaign Source', +//Added for CustomView 4.2 Release +'Name'=>'Name', +'LBL_NEW_LEADS'=>'My New Leads', + +//Added for Existing Picklist Entries + +'--None--'=>'--None--', +'Mr.'=>'Mr.', +'Ms.'=>'Ms.', +'Mrs.'=>'Mrs.', +'Dr.'=>'Dr.', +'Prof.'=>'Prof.', + +'Acquired'=>'Acquired', +'Active'=>'Active', +'Market Failed'=>'Market Failed', +'Project Cancelled'=>'Project Cancelled', +'Shutdown'=>'Shutdown', + +'Apparel'=>'Apparel', +'Banking'=>'Banking', +'Biotechnology'=>'Biotechnology', +'Chemicals'=>'Chemicals', +'Communications'=>'Communications', +'Construction'=>'Construction', +'Consulting'=>'Consulting', +'Education'=>'Education', +'Electronics'=>'Electronics', +'Energy'=>'Energy', +'Engineering'=>'Engineering', +'Entertainment'=>'Entertainment', +'Environmental'=>'Environmental', +'Finance'=>'Finance', +'Food & Beverage'=>'Food & Beverage', +'Government'=>'Government', +'Healthcare'=>'Healthcare', +'Hospitality'=>'Hospitality', +'Insurance'=>'Insurance', +'Machinery'=>'Machinery', +'Manufacturing'=>'Manufacturing', +'Media'=>'Media', +'Not For Profit'=>'Not For Profit', +'Recreation'=>'Recreation', +'Retail'=>'Retail', +'Shipping'=>'Shipping', +'Technology'=>'Technology', +'Telecommunications'=>'Telecommunications', +'Transportation'=>'Transportation', +'Utilities'=>'Utilities', +'Other'=>'Other', + +'Cold Call'=>'Cold Call', +'Existing Customer'=>'Existing Customer', +'Self Generated'=>'Self Generated', +'Employee'=>'Employee', +'Partner'=>'Partner', +'Public Relations'=>'Public Relations', +'Direct Mail'=>'Direct Mail', +'Conference'=>'Conference', +'Trade Show'=>'Trade Show', +'Web Site'=>'Web Site', +'Word of mouth'=>'Word of mouth', + +'Attempted to Contact'=>'Attempted to Contact', +'Cold'=>'Cold', +'Contact in Future'=>'Contact in Future', +'Contacted'=>'Contacted', +'Hot'=>'Hot', +'Junk Lead'=>'Junk Lead', +'Lost Lead'=>'Lost Lead', +'Not Contacted'=>'Not Contacted', +'Pre Qualified'=>'Pre Qualified', +'Qualified'=>'Qualified', +'Warm'=>'Warm', + +// Added/Updated for vtiger CRM 5.0.4 + +'Designation'=>'Title', + +// Added after 5.0.4 GA + +//Module Sequence Numbering +'Lead No'=>'Lead No', +// END + +); + +?> diff --git a/oss/vtiger/trunk/modules/Leads/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Leads/language/zh_cn.lang.php new file mode 100644 index 00000000..e1639a08 --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/language/zh_cn.lang.php @@ -0,0 +1,249 @@ + '准客户', +'LBL_DIRECT_REPORTS_FORM_NAME' => '直接输出', +'LBL_MODULE_TITLE' => '准客户: 首页', +'LBL_SEARCH_FORM_TITLE' => '搜寻准客户', +'LBL_LIST_FORM_TITLE' => '准客户列表', +'LBL_NEW_FORM_TITLE' => '新增准客户', +'LBL_LEAD_OPP_FORM_TITLE' => '联络人-机会:', +'LBL_LEAD' => '准客户:', +'LBL_ADDRESS_INFORMATION' => '地址信息', +'LBL_CUSTOM_INFORMATION' => '自订信息', + +'LBL_LIST_NAME' => '姓名', +'LBL_LIST_LAST_NAME' => '姓氏', +'LBL_LIST_COMPANY' => '公司', +'LBL_LIST_WEBSITE' => '网站', +'LBL_LIST_LEAD_NAME' => '准客户名称', +'LBL_LIST_EMAIL' => '电子邮件', +'LBL_LIST_PHONE' => '电话', +'LBL_LIST_LEAD_ROLE' => '职位', + +'LBL_NAME' => '姓氏:', +'LBL_LEAD_NAME' => '准客户名称:', +'LBL_LEAD_INFORMATION' => '准客户信息', +'LBL_FIRST_NAME' => '姓名:', +'LBL_PHONE' => '电话:', +'LBL_COMPANY' => '公司:', +'LBL_DESIGNATION'=>'称号:', +'LBL_PHONE'=>'电话:', +'LBL_LAST_NAME'=>'姓氏:', +'LBL_MOBILE' => '手机:', +'LBL_EMAIL' => '电子邮件:', +'LBL_LEAD_SOURCE' => '准客户来源:', +'LBL_LEAD_STATUS' => '准客户状态:', +'LBL_WEBSITE' => '网站:', +'LBL_FAX' => '传真:', +'LBL_INDUSTRY' => '企业:', +'LBL_ANNUAL_REVENUE' => '年营业额:', +'LBL_RATING' => '评价:', +'LBL_LICENSE_KEY' => '许可证 Key:', +'LBL_NO_OF_EMPLOYEES' => '员工数:', +'LBL_YAHOO_ID' => 'Yahoo账号:', + +'LBL_ADDRESS_STREET' => '街道巷号:', +'LBL_ADDRESS_POSTAL_CODE' => '邮政编码:', +'LBL_ADDRESS_CITY' => '乡镇市区:', +'LBL_ADDRESS_COUNTRY' => '国家:', +'LBL_ADDRESS_STATE' => '县市:', +'LBL_ADDRESS' => '地址:', +'LBL_DESCRIPTION_INFORMATION' => '描述信息', +'LBL_DESCRIPTION' => '描述:', + +'LBL_CONVERT_LEAD' => '转换准客户:', +'LBL_CONVERT_LEAD_INFORMATION' => '转换准客户信息', +'LBL_ACCOUNT_NAME' => '客户名称', +'LBL_POTENTIAL_NAME' => '潜在案件名称', +'LBL_POTENTIAL_CLOSE_DATE' => '潜在案件结束日期', +'LBL_POTENTIAL_AMOUNT' => '潜在机会金额', +'LBL_POTENTIAL_SALES_STAGE' => '潜在机会销售策略', + + + 'NTC_DELETE_CONFIRMATION' => '您确定要删除这笔记录?', +'NTC_REMOVE_CONFIRMATION' => '您确定要从此案件中删除这位联络人?', +'NTC_REMOVE_DIRECT_REPORT_CONFIRMATION' => '您确里要在直接输出时移除这笔记录?', +'NTC_REMOVE_OPP_CONFIRMATION' => '您确定要从这笔潜在案件中移除这笔联络人记录?', +'ERR_DELETE_RECORD' => '删除这笔联络人记录必须指定记录编号.', +'NTC_COPY_PRIMARY_ADDRESS' => '复制主要地址到替代地址', +'NTC_COPY_ALTERNATE_ADDRESS' => '复制替代地址到主要地址', + +// Added vtiger_fields in fetchfile.php, import.php -- crm4-Beta +'LBL_COLON' => ' : ', +'LBL_IMPORT_LEADS' => '导入准客户', +'LBL_LEADS_FILE_LIST' => '准客户档案列表', +'LBL_INSTRUCTIONS' => '讲解', +'LBL_KINDLY_PROVIDE_AN_XLS_FILE' => '友善的提供输入 .xls 档案', +'LBL_PROVIDE_ATLEAST_ONE_FILE' => '请至少提供一个档案以利于导入作业', + +'LBL_NONE' => '无', +'LBL_ASSIGNED_TO' => '负责人:', +'LBL_SELECT_LEAD' => '选择准客户', +'LBL_GENERAL_INFORMATION' => '一般信息', +'LBL_DO_NOT_CREATE_NEW_POTENTIAL' => '在转换时不要改变潜在案件', + +//for v4 release added +'LBL_NEW_POTENTIAL' => '新增潜在案件', +'LBL_POTENTIAL_TITLE' => '潜在案件', + + 'LBL_NEW_TASK' => '新增任务', +'LBL_TASK_TITLE' => '任务', +'LBL_NEW_CALL' => '新增电话记录', +'LBL_CALL_TITLE' => '电话记录', +'LBL_NEW_MEETING' => '新增会议', +'LBL_MEETING_TITLE' => '会议', +'LBL_NEW_EMAIL' => '新增电子邮件', +'LBL_EMAIL_TITLE' => '电子邮件', +'LBL_NEW_NOTE' => '新增备忘录', +'LBL_NOTE_TITLE' => '备忘录', +'LBL_NEW_ATTACHMENT' => '新增附件', +'LBL_ATTACHMENT_TITLE' => '附件', + + +//Added vtiger_fields after RC1 - Release +'LBL_ALL' => '全部', +'LBL_CONTACTED' => '已联络', +'LBL_LOST' => '失去', +'LBL_HOT' => '热门', +'LBL_COLD' => '冷淡', + +// Added for 4GA +'LBL_TOOL_FORM_TITLE' => '准客户工具', + +'LBL_SELECT_TEMPLATE_TO_MAIL_MERGE' => '选择要合并的邮件样版:', + +//Added for 4GA +'Salutation' => '问候', +'First Name' => '姓名', +'Phone' => '电话', +'Last Name' => '姓氏', +'Mobile' => '手机', +'Company' => '公司', +'Fax' => '传真', +'Email' => '电子邮件', +'Lead Source' => '准客户来源', +'Website' => '网站', +'Annual Revenue' => '年营业额', +'Lead Status' => '准客户状态', +'Industry' => '企业', +'Rating' => '评价', +'No Of Employees' => '员工数', +'Assigned To' => '负责人', +'Yahoo Id' => 'Yahoo账号', +'Created Time' => '建立时间', +'Modified Time' => '修改时间', +'Street' => '街道巷号', +'Postal Code' => '邮政编码', +'City' => '乡镇市区', +'Country' => '国家', +'State' => '县市', +'Description' => '描述', +'Po Box' => '邮政信箱', +'Campaign Source' => '活动来源', +//Added for CustomView 4.2 Release +'Name' => '名称', +'LBL_NEW_LEADS' => '我的新准客户', + +//Added for Existing Picklist Entries + +'--None--' => '-- 无 --', +'Mr.' => '先生', +'Ms.' => '小姐', +'Mrs.' => '太太', +'Dr.' => '博士', +'Prof.' => '专家', + +'Acquired' => '取得', +'Active' => '启用', +'Market Failed' => '市场失利', +'Project Cancelled' => '项目取消', +'Shutdown' => '关闭', + +'Apparel' => '存在', +'Banking' => '银行', +'Biotechnology' => '生物科技', +'Chemicals' => '化学', +'Communications' => '交通', +'Construction' => '建筑', +'Consulting' => '顾问', +'Education' => '教育', +'Electronics' => '电子', +'Energy' => '能源', +'Engineering' => '工程', +'Entertainment' => '娱乐', +'Environmental' => '环境', +'Finance' => '财务', +'Food & Beverage' => '饮食', +'Government' => '政府', +'Healthcare' => '健康照护', +'Hospitality' => '医院', +'Insurance' => '保险', +'Machinery' => '机械', +'Manufacturing' => '工厂', +'Media' => '媒体', +'Not For Profit' => '非营利', +'Recreation' => '娱乐中心', +'Retail' => '零售', +'Shipping' => '运输', +'Technology' => '科技', +'Telecommunications' => '通讯', +'Transportation' => '传输', +'Utilities' => '工具', +'Other' => '其它', + +'Cold Call' => '陌生拜访', +'Existing Customer' => '既有客户', +'Self Generated' => '自动产生', +'Employee' => '员工', +'Partner' => '伙伴', +'Public Relations' => '公开关系', +'Direct Mail' => '直接发信', +'Conference' => '研讨会', +'Trade Show' => '贸易展览', +'Web Site' => '网站', +'Word of mouth' => '口耳相传', + +'Attempted to Contact' => '尝试联系', +'Cold' => '陌生', +'Contact in Future' => '即将联系', +'Contacted' => '已联系', +'Hot' => '热络', +'Junk Lead' => '没有潜在价值', +'Lost Lead' => '失去准客户', +'Not Contacted' => '尚未联系', +'Pre Qualified' => '已事前确认', +'Qualified' => '已确认', +'Warm' => '一般', +// Added/Updated for vtiger CRM 5.0.4 + +'Designation'=>'Title', + +// Added after 5.0.4 GA + +//Module Sequence Numbering +'Lead No'=>'Lead No', +// END +); + +?> diff --git a/oss/vtiger/trunk/modules/Leads/updateRelations.php b/oss/vtiger/trunk/modules/Leads/updateRelations.php new file mode 100644 index 00000000..ab86af1f --- /dev/null +++ b/oss/vtiger/trunk/modules/Leads/updateRelations.php @@ -0,0 +1,52 @@ +pquery("insert into vtiger_seproductsrel values (?,?,?)", array($forCRMRecord,$id,$currentModule)); + elseif($dest_mod == 'Campaigns') + $adb->pquery("insert into vtiger_campaignleadrel values(?,?,1)", array($id,$forCRMRecord)); + elseif($dest_mod == 'Documents') + $adb->pquery("insert into vtiger_senotesrel values (?,?)", array($forCRMRecord,$id)); + else { + $focus->save_related_module($currentModule, $forCRMRecord, $dest_mod, $id); + } + } +} + +header("Location: index.php?action=$action&module=$currentModule&record=".$forCRMRecord."&parenttab=".$parenttab); + +?>