From c0176f11abaa246fa1c900c750dd13da1d648b76 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 21 Aug 2010 15:09:57 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E5=90=8E?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20=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@537 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../modules/ModComments/CallRelatedList.php | 80 +++ .../trunk/modules/ModComments/CustomView.php | 12 + .../trunk/modules/ModComments/Delete.php | 31 ++ .../trunk/modules/ModComments/DetailView.php | 108 ++++ .../modules/ModComments/DetailViewAjax.php | 59 +++ .../trunk/modules/ModComments/EditView.php | 125 +++++ .../modules/ModComments/ExportRecords.php | 11 + .../ModComments/FindDuplicateRecords.php | 106 ++++ .../trunk/modules/ModComments/Import.php | 11 + .../trunk/modules/ModComments/ListView.php | 208 ++++++++ .../modules/ModComments/ListViewPagging.php | 11 + .../trunk/modules/ModComments/MassEdit.php | 57 ++ .../modules/ModComments/MassEditSave.php | 69 +++ .../trunk/modules/ModComments/ModComments.js | 10 + .../trunk/modules/ModComments/ModComments.php | 109 ++++ .../modules/ModComments/ModCommentsAjax.php | 11 + .../modules/ModComments/ModCommentsCommon.js | 64 +++ .../modules/ModComments/ModCommentsCore.php | 490 ++++++++++++++++++ .../ModComments/ModCommentsHandler.php | 23 + .../ModComments/ModCommentsWidgetHandler.php | 19 + .../trunk/modules/ModComments/Popup.php | 11 + .../modules/ModComments/ProcessDuplicates.php | 133 +++++ .../trunk/modules/ModComments/QuickCreate.php | 11 + oss/vtiger/trunk/modules/ModComments/Save.php | 53 ++ .../trunk/modules/ModComments/Settings.php | 63 +++ .../trunk/modules/ModComments/TagCloud.php | 11 + .../modules/ModComments/UnifiedSearch.php | 11 + .../trunk/modules/ModComments/index.php | 15 + .../ModComments/language/en_us.lang.php | 34 ++ .../ModComments/language/zh_cn.lang.php | 47 ++ .../modules/ModComments/models/Comments.php | 34 ++ .../trunk/modules/ModComments/schema.xml | 21 + .../modules/ModComments/updateRelations.php | 46 ++ .../widgets/DetailViewBlockComment.php | 114 ++++ .../modules/PBXManager/AsteriskUtils.php | 78 +-- .../trunk/modules/PBXManager/ListView.php | 49 +- .../trunk/modules/PBXManager/StartCall.php | 7 +- .../modules/PBXManager/TraceIncomingCall.php | 135 +++-- .../PBXManager/language/en_us.lang.php | 4 + .../PBXManager/language/zh_cn.lang.php | 4 + .../PBXManager/utils/AsteriskClass.php | 4 +- .../trunk/modules/PickList/PickListAction.php | 8 +- .../trunk/modules/PickList/PickListUtils.php | 2 +- .../modules/Potentials/CallRelatedList.php | 10 + .../trunk/modules/Potentials/Charts.php | 8 +- .../trunk/modules/Potentials/DetailView.php | 14 + .../modules/Potentials/DetailViewAjax.php | 5 +- .../trunk/modules/Potentials/ListView.php | 52 +- .../trunk/modules/Potentials/ListViewTop.php | 12 +- .../trunk/modules/Potentials/Potentials.php | 35 +- oss/vtiger/trunk/modules/Potentials/Save.php | 7 +- .../Potentials/language/en_us.lang.php | 1 + 52 files changed, 2468 insertions(+), 185 deletions(-) create mode 100644 oss/vtiger/trunk/modules/ModComments/CallRelatedList.php create mode 100644 oss/vtiger/trunk/modules/ModComments/CustomView.php create mode 100644 oss/vtiger/trunk/modules/ModComments/Delete.php create mode 100644 oss/vtiger/trunk/modules/ModComments/DetailView.php create mode 100644 oss/vtiger/trunk/modules/ModComments/DetailViewAjax.php create mode 100644 oss/vtiger/trunk/modules/ModComments/EditView.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ExportRecords.php create mode 100644 oss/vtiger/trunk/modules/ModComments/FindDuplicateRecords.php create mode 100644 oss/vtiger/trunk/modules/ModComments/Import.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ListView.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ListViewPagging.php create mode 100644 oss/vtiger/trunk/modules/ModComments/MassEdit.php create mode 100644 oss/vtiger/trunk/modules/ModComments/MassEditSave.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ModComments.js create mode 100644 oss/vtiger/trunk/modules/ModComments/ModComments.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ModCommentsAjax.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ModCommentsCommon.js create mode 100644 oss/vtiger/trunk/modules/ModComments/ModCommentsCore.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ModCommentsHandler.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ModCommentsWidgetHandler.php create mode 100644 oss/vtiger/trunk/modules/ModComments/Popup.php create mode 100644 oss/vtiger/trunk/modules/ModComments/ProcessDuplicates.php create mode 100644 oss/vtiger/trunk/modules/ModComments/QuickCreate.php create mode 100644 oss/vtiger/trunk/modules/ModComments/Save.php create mode 100644 oss/vtiger/trunk/modules/ModComments/Settings.php create mode 100644 oss/vtiger/trunk/modules/ModComments/TagCloud.php create mode 100644 oss/vtiger/trunk/modules/ModComments/UnifiedSearch.php create mode 100644 oss/vtiger/trunk/modules/ModComments/index.php create mode 100644 oss/vtiger/trunk/modules/ModComments/language/en_us.lang.php create mode 100644 oss/vtiger/trunk/modules/ModComments/language/zh_cn.lang.php create mode 100644 oss/vtiger/trunk/modules/ModComments/models/Comments.php create mode 100644 oss/vtiger/trunk/modules/ModComments/schema.xml create mode 100644 oss/vtiger/trunk/modules/ModComments/updateRelations.php create mode 100644 oss/vtiger/trunk/modules/ModComments/widgets/DetailViewBlockComment.php diff --git a/oss/vtiger/trunk/modules/ModComments/CallRelatedList.php b/oss/vtiger/trunk/modules/ModComments/CallRelatedList.php new file mode 100644 index 00000000..145b2d5d --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/CallRelatedList.php @@ -0,0 +1,80 @@ +retrieve_entity_info($record, $currentModule); + $focus->id = $record; + } + + $smarty = new vtigerCRM_Smarty; + + if($isduplicate == 'true') $focus->id = ''; + if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode'])); + if(!$_SESSION['rlvs'][$currentModule]) unset($_SESSION['rlvs']); + + // Identify this module as custom module. + $smarty->assign('CUSTOM_MODULE', true); + + $smarty->assign('APP', $app_strings); + $smarty->assign('MOD', $mod_strings); + $smarty->assign('MODULE', $currentModule); + // TODO: Update Single Module Instance name here. + $smarty->assign('SINGLE_MOD', getTranslatedString($currentModule)); + $smarty->assign('CATEGORY', $category); + $smarty->assign('IMAGE_PATH', "themes/$theme/images/"); + $smarty->assign('THEME', $theme); + $smarty->assign('ID', $focus->id); + $smarty->assign('MODE', $focus->mode); + $smarty->assign('CHECK', $tool_buttons); + + $smarty->assign('NAME', $focus->column_fields[$focus->def_detailview_recname]); + $smarty->assign('UPDATEINFO',updateInfo($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 + + $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->display('RelatedLists.tpl'); +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/CustomView.php b/oss/vtiger/trunk/modules/ModComments/CustomView.php new file mode 100644 index 00000000..aebb8b53 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/CustomView.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/Delete.php b/oss/vtiger/trunk/modules/ModComments/Delete.php new file mode 100644 index 00000000..703cba1b --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/Delete.php @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/DetailView.php b/oss/vtiger/trunk/modules/ModComments/DetailView.php new file mode 100644 index 00000000..408522b4 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/DetailView.php @@ -0,0 +1,108 @@ +id = $record; + $focus->retrieve_entity_info($record, $currentModule); +} +if($isduplicate == 'true') $focus->id = ''; + +// Identify this module as custom module. +$smarty->assign('CUSTOM_MODULE', false); + +$smarty->assign('APP', $app_strings); +$smarty->assign('MOD', $mod_strings); +$smarty->assign('MODULE', $currentModule); +// TODO: Update Single Module Instance name here. +$smarty->assign('SINGLE_MOD', 'SINGLE_'.$currentModule); +$smarty->assign('CATEGORY', $category); +$smarty->assign('IMAGE_PATH', "themes/$theme/images/"); +$smarty->assign('THEME', $theme); +$smarty->assign('ID', $focus->id); +$smarty->assign('MODE', $focus->mode); + +$recordName = array_values(getEntityName($currentModule, $focus->id)); +$recordName = $recordName[0]; +$smarty->assign('NAME', $recordName); +$smarty->assign('UPDATEINFO',updateInfo($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 + +$validationArray = split_validationdataArray(getDBValidationData($focus->tab_name, $tabid)); +$smarty->assign('VALIDATION_DATA_FIELDNAME',$validationArray['fieldname']); +$smarty->assign('VALIDATION_DATA_FIELDDATATYPE',$validationArray['datatype']); +$smarty->assign('VALIDATION_DATA_FIELDLABEL',$validationArray['fieldlabel']); + +$smarty->assign('EDIT_PERMISSION', isPermitted($currentModule, 'EditView', $record)); +$smarty->assign('CHECK', $tool_buttons); + +if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){ + $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id); + VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id); +} + +$smarty->assign('IS_REL_LIST', isPresentRelatedLists($currentModule)); +$smarty->assign('SinglePane_View', $singlepane_view); + +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('EDIT_DUPLICATE', 'notpermitted'); +$smarty->assign('DELETE', 'notpermitted'); + +$smarty->assign('BLOCKS', getBlocks($currentModule,'detail_view','',$focus->column_fields)); + +// Gather the custom link information to display +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)); +// END + +// Record Change Notification +$focus->markAsViewed($current_user->id); +// END + +$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', false)); + +$smarty->display('DetailView.tpl'); + +?> diff --git a/oss/vtiger/trunk/modules/ModComments/DetailViewAjax.php b/oss/vtiger/trunk/modules/ModComments/DetailViewAjax.php new file mode 100644 index 00000000..d744aeed --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/DetailViewAjax.php @@ -0,0 +1,59 @@ +column_fields['commentcontent'] = vtlib_purify($_REQUEST['comment']); + $modObj->column_fields['related_to'] = vtlib_purify($_REQUEST['parentid']); + $modObj->column_fields['assigned_user_id'] = $current_user->id; + $modObj->save($currentModule); + + if(empty($modObj->column_fields['smcreatorid'])) $modObj->column_fields['smcreatorid'] = $current_user->id; + if(empty($modObj->column_fields['modifiedtime'])) $modObj->column_fields['modifiedtime']= date('Y-m-d H:i:s'); + + $widgetInstance = $modObj->getWidget('DetailViewBlockCommentWidget'); + echo ':#:SUCCESS'. $widgetInstance->processItem($modObj->getAsCommentModel($modObj->column_fields)); + } else { + echo ':#:FAILURE'; + } +} + +else if($ajaxaction == 'DETAILVIEW') { + $crmid = $_REQUEST['recordid']; + $tablename = $_REQUEST['tableName']; + $fieldname = $_REQUEST['fldName']; + $fieldvalue = utf8RawUrlDecode($_REQUEST['fieldValue']); + if($crmid != '') + { + $modObj->retrieve_entity_info($crmid, $currentModule); + $modObj->column_fields[$fieldname] = $fieldvalue; + $modObj->id = $crmid; + $modObj->mode = 'edit'; + $modObj->save($currentModule); + 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/ModComments/EditView.php b/oss/vtiger/trunk/modules/ModComments/EditView.php new file mode 100644 index 00000000..a7b1c864 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/EditView.php @@ -0,0 +1,125 @@ +assign("MOD",$mod_strings); + $smarty->assign("APP",$app_strings); + $smarty->assign("THEME", "$theme"); + $smarty->assign("IMAGE_PATH", "themes/$theme/images/"); + + $smarty->display(vtlib_getModuleTemplate('Vtiger','OperationNotPermitted.tpl')); + exit; +} +// END + +$focus = CRMEntity::getInstance($currentModule); +$smarty = new vtigerCRM_Smarty(); + +$category = getParentTab($currentModule); +$record = $_REQUEST['record']; +$isduplicate = vtlib_purify($_REQUEST['isDuplicate']); + +//added to fix the issue4600 +$searchurl = getBasic_Advance_SearchURL(); +$smarty->assign("SEARCH", $searchurl); +//4600 ends + +if($record) { + $focus->id = $record; + $focus->mode = 'edit'; + $focus->retrieve_entity_info($record, $currentModule); +} +if($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, $focus->mode, $focus->column_fields)); +else + $smarty->assign('BASBLOCKS', getBlocks($currentModule, $disp_view, $focus->mode, $focus->column_fields, 'BAS')); + +$smarty->assign('OP_MODE',$disp_view); +$smarty->assign('APP', $app_strings); +$smarty->assign('MOD', $mod_strings); +$smarty->assign('MODULE', $currentModule); +// TODO: Update Single Module Instance name here. +$smarty->assign('SINGLE_MOD', getTranslatedString('SINGLE_'.$currentModule)); +$smarty->assign('CATEGORY', $category); +$smarty->assign("THEME", $theme); +$smarty->assign('IMAGE_PATH', "themes/$theme/images/"); +$smarty->assign('ID', $focus->id); +$smarty->assign('MODE', $focus->mode); + +$smarty->assign('CHECK', Button_Check($currentModule)); +$smarty->assign('DUPLICATE', $isduplicate); + +if($focus->mode == 'edit' || $isduplicate) { + $recordName = array_values(getEntityName($currentModule, $record)); + $recordName = $recordName[0]; + $smarty->assign('NAME', $recordName); + $smarty->assign('UPDATEINFO',updateInfo($record)); +} + +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'])); + +// 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']); + +// In case you have a date field +$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); + +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 '
'. 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 + +// Gather the help information associated with fields +$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule)); +// 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/ModComments/ExportRecords.php b/oss/vtiger/trunk/modules/ModComments/ExportRecords.php new file mode 100644 index 00000000..19858676 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ExportRecords.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/FindDuplicateRecords.php b/oss/vtiger/trunk/modules/ModComments/FindDuplicateRecords.php new file mode 100644 index 00000000..0e73f116 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/FindDuplicateRecords.php @@ -0,0 +1,106 @@ +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/ModComments/Import.php b/oss/vtiger/trunk/modules/ModComments/Import.php new file mode 100644 index 00000000..ef1e83e9 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/Import.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/ListView.php b/oss/vtiger/trunk/modules/ModComments/ListView.php new file mode 100644 index 00000000..f13762b1 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ListView.php @@ -0,0 +1,208 @@ +initSortbyField($currentModule); +$sorder = $focus->getSortOrder(); +$order_by = $focus->getOrderBy(); + +$_SESSION[$currentModule."_Order_By"] = $order_by; +$_SESSION[$currentModule."_Sort_Order"]=$sorder; + +$smarty = new vtigerCRM_Smarty(); + +// Identify this module as custom module. +$smarty->assign('CUSTOM_MODULE', false); + +$smarty->assign('MOD', $mod_strings); +$smarty->assign('APP', $app_strings); +$smarty->assign('MODULE', $currentModule); +$smarty->assign('SINGLE_MOD', getTranslatedString('SINGLE_'.$currentModule)); +$smarty->assign('CATEGORY', $category); +$smarty->assign('BUTTONS', $list_buttons); +$smarty->assign('CHECK', $tool_buttons); +$smarty->assign('THEME', $theme); +$smarty->assign('IMAGE_PATH', "themes/$theme/images/"); + +$smarty->assign('CHANGE_OWNER', getUserslist()); +$smarty->assign('CHANGE_GROUP_OWNER', getGroupslist()); + +// Custom View +$customView = new CustomView($currentModule); +$viewid = $customView->getViewId($currentModule); +$customview_html = $customView->getCustomViewCombo($viewid); +$viewinfo = $customView->getCustomViewByCvid($viewid); + +// Feature available from 5.1 +if(method_exists($customView, 'isPermittedChangeStatus')) { + // Approving or Denying status-public by the admin in CustomView + $statusdetails = $customView->isPermittedChangeStatus($viewinfo['status']); + + // To check if a user is able to edit/delete a CustomView + $edit_permit = $customView->isPermittedCustomView($viewid,'EditView',$currentModule); + $delete_permit = $customView->isPermittedCustomView($viewid,'Delete',$currentModule); + + $smarty->assign("CUSTOMVIEW_PERMISSION",$statusdetails); + $smarty->assign("CV_EDIT_PERMIT",$edit_permit); + $smarty->assign("CV_DELETE_PERMIT",$delete_permit); +} +// END + +$smarty->assign("VIEWID", $viewid); + +if($viewinfo['viewname'] == 'All') $smarty->assign('ALL', 'All'); + +if($viewid ==0) +{ + echo "
"; + echo "
+ + + + + + + + + +
$app_strings[LBL_PERMISSION]
+ $app_strings[LBL_GO_BACK]
+
+
"; + echo "
"; + exit; +} + +global $current_user; +$queryGenerator = new QueryGenerator($currentModule, $current_user); +if ($viewid != "0") { + $queryGenerator->initForCustomViewById($viewid); +} else { + $queryGenerator->initForDefaultCustomView(); +} + +// Enabling Module Search +$url_string = ''; +if($_REQUEST['query'] == 'true') { + $queryGenerator->addUserSearchConditions($_REQUEST); + $ustring = getSearchURL($_REQUEST); + $url_string .= "&query=true$ustring"; + $smarty->assign('SEARCH_URL', $url_string); +} + +$list_query = $queryGenerator->getQuery(); + +// Sorting +if(!empty($order_by)) { + $meta = $queryGenerator->getMeta($currentModule); + $moduleFields = $meta->getModuleFields(); + $found = false; + foreach ($moduleFields as $field) { + if($field->getColumnName() == $order_by) { + $found = true; + break; + } + } + if($found === false) { + $list_query .= " ORDER BY $order_by $sorder"; + } else { + $list_query .= " ORDER BY ".$field->getTableName().".$order_by $sorder"; + } +} + +//Postgres 8 fixes +if( $adb->dbType == "pgsql") + $list_query = fixPostgresQuery( $list_query, $log, 0); + +if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){ + $count_result = $adb->query( mkCountQuery( $list_query)); + $noofrows = $adb->query_result($count_result,0,"count"); +}else{ + $noofrows = null; +} + +$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true'); +$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode); + +$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows); + +$limit_start_rec = ($start-1) * $list_max_entries_per_page; + +if( $adb->dbType == "pgsql") + $list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array()); +else + $list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array()); + +$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows); +$smarty->assign('recordListRange',$recordListRangeMsg); + +$smarty->assign("CUSTOMVIEW_OPTION",$customview_html); + +// Navigation +$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, $currentModule, 'index', $viewid); +$smarty->assign("NAVIGATION", $navigationOutput); + +$controller = new ListViewController($adb, $current_user, $queryGenerator); +$listview_header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder, + $order_by,true); +$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result, + $navigation_array,true); +$listview_header_search = $controller->getBasicSearchFieldInfoList(); + +$smarty->assign('LISTHEADER', $listview_header); +$smarty->assign('LISTENTITY', $listview_entries); +$smarty->assign('SEARCHLISTHEADER',$listview_header_search); + +// Module Search +$alphabetical = AlphabeticalSearch($currentModule,'index',$focus->def_basicsearch_col,'true','basic','','','','',$viewid); +$fieldnames = $controller->getAdvancedSearchOptionString(); +$criteria = getcriteria_options(); +$smarty->assign("ALPHABETICAL", $alphabetical); +$smarty->assign("FIELDNAMES", $fieldnames); +$smarty->assign("CRITERIA", $criteria); + +$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule,"available_fields")); +$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule,"fileds_to_merge")); + +//Added to select Multiple records in multiple pages +$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs'])); +$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs'])); +$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";")); +$_SESSION[$currentModule.'_listquery'] = $list_query; + +// Gather the custom link information to display +include_once('vtlib/Vtiger/Link.php'); +$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category); +$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params)); +// END + +if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') + $smarty->display("ListViewEntries.tpl"); +else + $smarty->display('ListView.tpl'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/ListViewPagging.php b/oss/vtiger/trunk/modules/ModComments/ListViewPagging.php new file mode 100644 index 00000000..333f1768 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ListViewPagging.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/MassEdit.php b/oss/vtiger/trunk/modules/ModComments/MassEdit.php new file mode 100644 index 00000000..5ef69221 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/MassEdit.php @@ -0,0 +1,57 @@ +assign("MOD",$mod_strings); + $smarty->assign("APP",$app_strings); + $smarty->assign("THEME", "$theme"); + $smarty->assign("IMAGE_PATH", "themes/$theme/images/"); + + $smarty->display(vtlib_getModuleTemplate('Vtiger','OperationNotPermitted.tpl')); + exit; +} +// END + +require_once('include/utils/utils.php'); + +$focus = CRMEntity::getInstance($currentModule); +$focus->mode = ''; +$mode = 'mass_edit'; + +$disp_view = getView($focus->mode); +$idstring = $_REQUEST['idstring']; + +$smarty = new vtigerCRM_Smarty; +$smarty->assign('MODULE',$currentModule); +$smarty->assign('APP',$app_strings); +$smarty->assign('THEME', $theme); +$smarty->assign('IMAGE_PATH', "themes/$theme/images/"); +$smarty->assign('IDS',$idstring); +$smarty->assign('MASS_EDIT','1'); +$smarty->assign('BLOCKS',getBlocks($currentModule,$disp_view,$mode,$focus->column_fields)); +$smarty->assign("CATEGORY",getParentTab()); + +// 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'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/MassEditSave.php b/oss/vtiger/trunk/modules/ModComments/MassEditSave.php new file mode 100644 index 00000000..58e97379 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/MassEditSave.php @@ -0,0 +1,69 @@ +column_fields as $key=>$value) { + $focus->column_fields[$key] = ''; + } + // 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"); +?> diff --git a/oss/vtiger/trunk/modules/ModComments/ModComments.js b/oss/vtiger/trunk/modules/ModComments/ModComments.js new file mode 100644 index 00000000..073cdffd --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModComments.js @@ -0,0 +1,10 @@ +/*+********************************************************************************** + * 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. + ************************************************************************************/ + + diff --git a/oss/vtiger/trunk/modules/ModComments/ModComments.php b/oss/vtiger/trunk/modules/ModComments/ModComments.php new file mode 100644 index 00000000..9539551b --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModComments.php @@ -0,0 +1,109 @@ +pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename)); + } + } + + /** + * Get widget instance by name + */ + static function getWidget($name) { + if ($name == 'DetailViewBlockCommentWidget' && + isPermitted('ModComments', 'DetailView') == 'yes') { + require_once dirname(__FILE__) . '/widgets/DetailViewBlockComment.php'; + return (new ModComments_DetailViewBlockCommentWidget()); + } + return false; + } + + /** + * Add widget to other module. + * @param unknown_type $moduleNames + * @return unknown_type + */ + static function addWidgetTo($moduleNames, $widgetType='DETAILVIEWWIDGET', $widgetName='DetailViewBlockCommentWidget') { + if (empty($moduleNames)) return; + + include_once 'vtlib/Vtiger/Module.php'; + + if (is_string($moduleNames)) $moduleNames = array($moduleNames); + + $commentWidgetCount = 0; + foreach($moduleNames as $moduleName) { + $module = Vtiger_Module::getInstance($moduleName); + if($module) { + $module->addLink($widgetType, $widgetName, "block://ModComments:modules/ModComments/ModComments.php"); + ++$commentWidgetCount; + } + } + if ($commentWidgetCount) { + $modCommentsModule = Vtiger_Module::getInstance('ModComments'); + $modCommentsModule->addLink('HEADERSCRIPT', 'ModCommentsCommonHeaderScript', 'modules/ModComments/ModCommentsCommon.js'); + $modCommentsRelatedToField = Vtiger_Field::getInstance('related_to', $modCommentsModule); + $modCommentsRelatedToField->setRelatedModules($moduleNames); + } + } + + /** + * Remove widget from other modules. + * @param unknown_type $moduleNames + * @param unknown_type $widgetType + * @param unknown_type $widgetName + * @return unknown_type + */ + static function removeWidgetFrom($moduleNames, $widgetType='DETAILVIEWWIDGET', $widgetName='DetailViewBlockCommentWidget') { + if (empty($moduleNames)) return; + + include_once 'vtlib/Vtiger/Module.php'; + + if (is_string($moduleNames)) $moduleNames = array($moduleNames); + + $commentWidgetCount = 0; + foreach($moduleNames as $moduleName) { + $module = Vtiger_Module::getInstance($moduleName); + if($module) { + $module->deleteLink($widgetType, $widgetName, "block://ModComments:modules/ModComments/ModComments.php"); + ++$commentWidgetCount; + } + } + if ($commentWidgetCount) { + $modCommentsModule = Vtiger_Module::getInstance('ModComments'); + $modCommentsRelatedToField = Vtiger_Field::getInstance('related_to', $modCommentsModule); + $modCommentsRelatedToField->unsetRelatedModules($moduleNames); + } + } + + /** + * Wrap this instance as a model + */ + function getAsCommentModel() { + return new ModComments_CommentsModel($this->column_fields); + } + +} +?> diff --git a/oss/vtiger/trunk/modules/ModComments/ModCommentsAjax.php b/oss/vtiger/trunk/modules/ModComments/ModCommentsAjax.php new file mode 100644 index 00000000..efae0a94 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModCommentsAjax.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/ModCommentsCommon.js b/oss/vtiger/trunk/modules/ModComments/ModCommentsCommon.js new file mode 100644 index 00000000..de9e5371 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModCommentsCommon.js @@ -0,0 +1,64 @@ +/*+********************************************************************************** + * 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. + ************************************************************************************/ +if (typeof(ModCommentsCommon) == 'undefined') { + ModCommentsCommon = { + addComment : function(domkeyid, parentid) { + var textBoxField = $('txtbox_'+domkeyid); + var editareaDOM = $('editarea_'+domkeyid); + var contentWrapDOM = $('contentwrap_'+domkeyid); + if (textBoxField.value == '') { + return; + } + + var url = 'module=ModComments&action=ModCommentsAjax&file=DetailViewAjax&ajax=true&ajxaction=WIDGETADDCOMMENT&parentid='+encodeURIComponent(parentid); + url += '&comment=' + encodeURIComponent(textBoxField.value); + + VtigerJS_DialogBox.block(); + $("vtbusy_info").style.display="inline"; + + new Ajax.Request('index.php',{ + queue: {position: 'end', scope: 'command'}, + method: 'post', + postBody:url, + onComplete: function(response) { + $("vtbusy_info").style.display="none"; + VtigerJS_DialogBox.unblock(); + + var responseTextTrimmed = trim(response.responseText); + if (responseTextTrimmed.substring(0, 10) == ':#:SUCCESS') { + textBoxField.value = ''; + contentWrapDOM.innerHTML += responseTextTrimmed.substring(10); + hndCancel('dtlview_'+domkeyid,'editarea_'+domkeyid,domkeyid); + } else { + alert(alert_arr.OPERATION_DENIED); + } + }} + ); + }, + reloadContentWithFiltering : function(widget, parentid, criteria, targetdomid, indicator) { + if($(indicator)) $(indicator).style.display="inline"; + + var url = 'module=ModComments&action=ModCommentsAjax&file=ModCommentsWidgetHandler&ajax=true'; + url += '&widget=' + encodeURIComponent(widget) + '&parentid='+encodeURIComponent(parentid); + url += '&criteria='+ encodeURIComponent(criteria); + + new Ajax.Request('index.php',{ + queue: {position: 'end', scope: 'command'}, + method: 'post', + postBody:url, + onComplete: function(response) { + if($(indicator)) $(indicator).style.display="none"; + + if($(targetdomid)) $(targetdomid).innerHTML = response.responseText; + }} + ); + } + } +} + diff --git a/oss/vtiger/trunk/modules/ModComments/ModCommentsCore.php b/oss/vtiger/trunk/modules/ModComments/ModCommentsCore.php new file mode 100644 index 00000000..1cdce798 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModCommentsCore.php @@ -0,0 +1,490 @@ + 'crmid', + 'vtiger_modcomments' => 'modcommentsid', + 'vtiger_modcommentscf'=>'modcommentsid'); + + /** + * Mandatory for Listing (Related listview) + */ + var $list_fields = Array ( + /* Format: Field Label => Array(tablename, columnname) */ + // tablename should not have prefix 'vtiger_' + 'Comment' => Array('modcomments', 'commentcontent'), + 'Assigned To' => Array('crmentity','smownerid') + ); + var $list_fields_name = Array ( + /* Format: Field Label => fieldname */ + 'Comment' => 'commentcontent', + 'Assigned To' => 'assigned_user_id' + ); + + // Make the field link to detail view + var $list_link_field = 'commentcontent'; + + // For Popup listview and UI type support + var $search_fields = Array( + /* Format: Field Label => Array(tablename, columnname) */ + // tablename should not have prefix 'vtiger_' + 'Comment' => Array('modcomments', 'commentcontent') + ); + var $search_fields_name = Array ( + /* Format: Field Label => fieldname */ + 'Comment' => 'commentcontent' + ); + + // For Popup window record selection + var $popup_fields = Array ('commentcontent'); + + // Allow sorting on the following (field column names) + var $sortby_fields = Array ('commentcontent'); + + // Should contain field labels + //var $detailview_links = Array ('Comment'); + + // For Alphabetical search + var $def_basicsearch_col = 'commentcontent'; + + // Column value to use on detail view record text display + var $def_detailview_recname = 'commentcontent'; + + // Required Information for enabling Import feature + var $required_fields = Array ('assigned_user_id'=>1); + + // Callback function list during Importing + var $special_functions = Array('set_import_assigned_user'); + + var $default_order_by = 'commentcontent'; + var $default_sort_order='ASC'; + + // Used when enabling/disabling the mandatory fields for the module. + // Refers to vtiger_field.fieldname values. + var $mandatory_fields = Array('createdtime', 'modifiedtime', 'commentcontent'); + + function __construct() { + global $log, $currentModule; + $this->column_fields = getColumnFields($currentModule); + $this->db = PearDatabase::getInstance(); + $this->log = $log; + } + + function getSortOrder() { + global $currentModule; + + $sortorder = $this->default_sort_order; + if($_REQUEST['sorder']) $sortorder = $this->db->sql_escape_string($_REQUEST['sorder']); + else if($_SESSION[$currentModule.'_Sort_Order']) + $sortorder = $_SESSION[$currentModule.'_Sort_Order']; + + return $sortorder; + } + + function getOrderBy() { + global $currentModule; + + $use_default_order_by = ''; + if(PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) { + $use_default_order_by = $this->default_order_by; + } + + $orderby = $use_default_order_by; + if($_REQUEST['order_by']) $orderby = $this->db->sql_escape_string($_REQUEST['order_by']); + else if($_SESSION[$currentModule.'_Order_By']) + $orderby = $_SESSION[$currentModule.'_Order_By']; + return $orderby; + } + + function save_module($module) { + } + + /** + * Return query to use based on given modulename, fieldname + * Useful to handle specific case handling for Popup + */ + function getQueryByModuleField($module, $fieldname, $srcrecord) { + // $srcrecord could be empty + } + + /** + * Get list view query (send more WHERE clause condition if required) + */ + function getListQuery($module, $usewhere=false) { + $query = "SELECT vtiger_crmentity.*, $this->table_name.*"; + + // Keep track of tables joined to avoid duplicates + $joinedTables = array(); + + // Select Custom Field Table Columns if present + if(!empty($this->customFieldTable)) $query .= ", " . $this->customFieldTable[0] . ".* "; + + $query .= " FROM $this->table_name"; + + $query .= " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = $this->table_name.$this->table_index"; + + $joinedTables[] = $this->table_name; + $joinedTables[] = 'vtiger_crmentity'; + + // Consider custom table join as well. + if(!empty($this->customFieldTable)) { + $query .= " INNER JOIN ".$this->customFieldTable[0]." ON ".$this->customFieldTable[0].'.'.$this->customFieldTable[1] . + " = $this->table_name.$this->table_index"; + $joinedTables[] = $this->customFieldTable[0]; + } + $query .= " LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid"; + $query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid"; + + $joinedTables[] = 'vtiger_users'; + $joinedTables[] = 'vtiger_groups'; + + $linkedModulesQuery = $this->db->pquery("SELECT distinct fieldname, columnname, relmodule FROM vtiger_field" . + " INNER JOIN vtiger_fieldmodulerel ON vtiger_fieldmodulerel.fieldid = vtiger_field.fieldid" . + " WHERE uitype='10' AND vtiger_fieldmodulerel.module=?", array($module)); + $linkedFieldsCount = $this->db->num_rows($linkedModulesQuery); + + for($i=0; $i<$linkedFieldsCount; $i++) { + $related_module = $this->db->query_result($linkedModulesQuery, $i, 'relmodule'); + $fieldname = $this->db->query_result($linkedModulesQuery, $i, 'fieldname'); + $columnname = $this->db->query_result($linkedModulesQuery, $i, 'columnname'); + + $other = CRMEntity::getInstance($related_module); + vtlib_setup_modulevars($related_module, $other); + + if(!in_array($other->table_name, $joinedTables)) { + $query .= " LEFT JOIN $other->table_name ON $other->table_name.$other->table_index = $this->table_name.$columnname"; + $joinedTables[] = $other->table_name; + } + } + + $query .= " WHERE vtiger_crmentity.deleted = 0 "; + if($usewhere) { + $query .= $usewhere; + } + $query .= $this->getListViewSecurityParameter($module); + return $query; + } + + /** + * Apply security restriction (sharing privilege) query part for List view. + */ + function getListViewSecurityParameter($module) { + global $current_user; + require('user_privileges/user_privileges_'.$current_user->id.'.php'); + require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); + + $sec_query = ''; + $tabid = getTabid($module); + + if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 + && $defaultOrgSharingPermission[$tabid] == 3) { + + $sec_query .= " AND (vtiger_crmentity.smownerid in($current_user->id) OR vtiger_crmentity.smownerid IN + ( + SELECT vtiger_user2role.userid FROM vtiger_user2role + INNER JOIN vtiger_users ON vtiger_users.id=vtiger_user2role.userid + INNER JOIN vtiger_role ON vtiger_role.roleid=vtiger_user2role.roleid + WHERE vtiger_role.parentrole LIKE '".$current_user_parent_role_seq."::%' + ) + OR vtiger_crmentity.smownerid IN + ( + SELECT shareduserid FROM vtiger_tmp_read_user_sharing_per + WHERE userid=".$current_user->id." AND tabid=".$tabid." + ) + OR + ("; + + // Build the query based on the group association of current user. + if(sizeof($current_user_groups) > 0) { + $sec_query .= " vtiger_groups.groupid IN (". implode(",", $current_user_groups) .") OR "; + } + $sec_query .= " vtiger_groups.groupid IN + ( + SELECT vtiger_tmp_read_group_sharing_per.sharedgroupid + FROM vtiger_tmp_read_group_sharing_per + WHERE userid=".$current_user->id." and tabid=".$tabid." + )"; + $sec_query .= ") + )"; + } + return $sec_query; + } + + /** + * Create query to export the records. + */ + function create_export_query($where) + { + global $current_user; + $thismodule = $_REQUEST['module']; + + include("include/utils/ExportUtils.php"); + + //To get the Permitted fields query and the permitted fields list + $sql = getPermittedFieldsQuery($thismodule, "detail_view"); + + $fields_list = getFieldsListFromQuery($sql); + + $query = "SELECT $fields_list, vtiger_users.user_name AS user_name + FROM vtiger_crmentity INNER JOIN $this->table_name ON vtiger_crmentity.crmid=$this->table_name.$this->table_index"; + + if(!empty($this->customFieldTable)) { + $query .= " INNER JOIN ".$this->customFieldTable[0]." ON ".$this->customFieldTable[0].'.'.$this->customFieldTable[1] . + " = $this->table_name.$this->table_index"; + } + + $query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid"; + $query .= " LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id and vtiger_users.status='Active'"; + + $linkedModulesQuery = $this->db->pquery("SELECT distinct fieldname, columnname, relmodule FROM vtiger_field" . + " INNER JOIN vtiger_fieldmodulerel ON vtiger_fieldmodulerel.fieldid = vtiger_field.fieldid" . + " WHERE uitype='10' AND vtiger_fieldmodulerel.module=?", array($thismodule)); + $linkedFieldsCount = $this->db->num_rows($linkedModulesQuery); + + for($i=0; $i<$linkedFieldsCount; $i++) { + $related_module = $this->db->query_result($linkedModulesQuery, $i, 'relmodule'); + $fieldname = $this->db->query_result($linkedModulesQuery, $i, 'fieldname'); + $columnname = $this->db->query_result($linkedModulesQuery, $i, 'columnname'); + + $other = CRMEntity::getInstance($related_module); + vtlib_setup_modulevars($related_module, $other); + + $query .= " LEFT JOIN $other->table_name ON $other->table_name.$other->table_index = $this->table_name.$columnname"; + } + + $where_auto = " vtiger_crmentity.deleted=0"; + + if($where != '') $query .= " WHERE ($where) AND $where_auto"; + else $query .= " WHERE $where_auto"; + + require('user_privileges/user_privileges_'.$current_user->id.'.php'); + require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); + + // Security Check for Field Access + if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[7] == 3) + { + //Added security check to get the permitted records only + $query = $query." ".getListViewSecurityParameter($thismodule); + } + return $query; + } + + /** + * Initialize this instance for importing. + */ + function initImport($module) { + $this->db = PearDatabase::getInstance(); + $this->initImportableFields($module); + } + + /** + * Create list query to be shown at the last step of the import. + * Called From: modules/Import/UserLastImport.php + */ + function create_import_query($module) { + global $current_user; + $query = "SELECT vtiger_crmentity.crmid, case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name, $this->table_name.* FROM $this->table_name + INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = $this->table_name.$this->table_index + LEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=vtiger_crmentity.crmid + LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid + LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid + WHERE vtiger_users_last_import.assigned_user_id='$current_user->id' + AND vtiger_users_last_import.bean_type='$module' + AND vtiger_users_last_import.deleted=0"; + return $query; + } + + function generateReportsQuery($module){ + global $current_user; + $query = "from vtiger_modcomments inner join vtiger_modcommentscf as vtiger_modcommentscf + on vtiger_modcommentscf.modcommentsid=vtiger_modcomments.modcommentsid + inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_modcomments.modcommentsid + left join vtiger_groups as vtiger_groupsModComments on vtiger_groupsModComments.groupid = vtiger_crmentity.smownerid + left join vtiger_users as vtiger_usersModComments on vtiger_usersModComments.id = vtiger_crmentity.smownerid + left join vtiger_crmentity as vtiger_crmentityRelModComments on vtiger_crmentityRelModComments.crmid = vtiger_modcomments.related_to + and vtiger_crmentityRelModComments.deleted=0 + left join vtiger_leaddetails as vtiger_leaddetailsRelModComments on vtiger_leaddetailsRelModComments.leadid = vtiger_crmentityRelModComments.crmid + left join vtiger_contactdetails as vtiger_contactdetailsRelModComments on vtiger_contactdetailsRelModComments.contactid = vtiger_crmentityRelModComments.crmid + left join vtiger_account as vtiger_accountRelModComments on vtiger_accountRelModComments.accountid = vtiger_crmentityRelModComments.crmid"; + $projectModule = Vtiger_Module::getInstance('Project'); + if($projectModule !== false) { + $query .= " left join vtiger_projecttask as vtiger_projecttaskRelModComments on vtiger_projecttaskRelModComments.projecttaskid = vtiger_crmentityRelModComments.crmid + left join vtiger_project as vtiger_projectRelModComments on vtiger_projectRelModComments.projectid = vtiger_crmentityRelModComments.crmid"; + } + return $query; + } + /** + * Delete the last imported records. + */ + function undo_import($module, $user_id) { + global $adb; + $count = 0; + $query1 = "select bean_id from vtiger_users_last_import where assigned_user_id=? AND bean_type='$module' AND deleted=0"; + $result1 = $adb->pquery($query1, array($user_id)) or die("Error getting last import for undo: ".mysql_error()); + while ( $row1 = $adb->fetchByAssoc($result1)) + { + $query2 = "update vtiger_crmentity set deleted=1 where crmid=?"; + $result2 = $adb->pquery($query2, array($row1['bean_id'])) or die("Error undoing last import: ".mysql_error()); + $count++; + } + return $count; + } + + /** + * Transform the value while exporting (if required) + */ + function transform_export_value($key, $value) { + return parent::transform_export_value($key, $value); + } + + /** + * Function which will set the assigned user id for import record. + */ + function set_import_assigned_user() + { + global $current_user, $adb; + $record_user = $this->column_fields["assigned_user_id"]; + + if($record_user != $current_user->id){ + $sqlresult = $adb->pquery("select id from vtiger_users where id = ? union select groupid as id from vtiger_groups where groupid = ?", array($record_user, $record_user)); + if($this->db->num_rows($sqlresult)!= 1) { + $this->column_fields["assigned_user_id"] = $current_user->id; + } else { + $row = $adb->fetchByAssoc($sqlresult, -1, false); + if (isset($row['id']) && $row['id'] != -1) { + $this->column_fields["assigned_user_id"] = $row['id']; + } else { + $this->column_fields["assigned_user_id"] = $current_user->id; + } + } + } + } + + /** + * Function which will give the basic query to find duplicates + */ + function getDuplicatesQuery($module,$table_cols,$field_values,$ui_type_arr,$select_cols='') { + $select_clause = "SELECT ". $this->table_name .".".$this->table_index ." AS recordid, vtiger_users_last_import.deleted,".$table_cols; + + // Select Custom Field Table Columns if present + if(isset($this->customFieldTable)) $query .= ", " . $this->customFieldTable[0] . ".* "; + + $from_clause = " FROM $this->table_name"; + + $from_clause .= " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = $this->table_name.$this->table_index"; + + // Consider custom table join as well. + if(isset($this->customFieldTable)) { + $from_clause .= " INNER JOIN ".$this->customFieldTable[0]." ON ".$this->customFieldTable[0].'.'.$this->customFieldTable[1] . + " = $this->table_name.$this->table_index"; + } + $from_clause .= " LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid + LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid"; + + $where_clause = " WHERE vtiger_crmentity.deleted = 0"; + $where_clause .= $this->getListViewSecurityParameter($module); + + if (isset($select_cols) && trim($select_cols) != '') { + $sub_query = "SELECT $select_cols FROM $this->table_name AS t " . + " INNER JOIN vtiger_crmentity AS crm ON crm.crmid = t.".$this->table_index; + // Consider custom table join as well. + if(isset($this->customFieldTable)) { + $sub_query .= " LEFT JOIN ".$this->customFieldTable[0]." tcf ON tcf.".$this->customFieldTable[1]." = t.$this->table_index"; + } + $sub_query .= " WHERE crm.deleted=0 GROUP BY $select_cols HAVING COUNT(*)>1"; + } else { + $sub_query = "SELECT $table_cols $from_clause $where_clause GROUP BY $table_cols HAVING COUNT(*)>1"; + } + + + $query = $select_clause . $from_clause . + " LEFT JOIN vtiger_users_last_import ON vtiger_users_last_import.bean_id=" . $this->table_name .".".$this->table_index . + " INNER JOIN (" . $sub_query . ") AS temp ON ".get_on_clause($field_values,$ui_type_arr,$module) . + $where_clause . + " ORDER BY $table_cols,". $this->table_name .".".$this->table_index ." ASC"; + + return $query; + } + + /** + * Invoked when special actions are performed on the module. + * @param String Module name + * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall) + */ + function vtlib_handler($modulename, $event_type) { + if($event_type == 'module.postinstall') { + // TODO Handle post installation actions + } else if($event_type == 'module.disabled') { + // TODO Handle actions when this module is disabled. + } else if($event_type == 'module.enabled') { + // TODO Handle actions when this module is enabled. + } else if($event_type == 'module.preuninstall') { + // TODO Handle actions when this module is about to be deleted. + } else if($event_type == 'module.preupdate') { + // TODO Handle actions before this module is updated. + } else if($event_type == 'module.postupdate') { + // TODO Handle actions after this module is updated. + } + } + + /** + * Handle saving related module information. + * NOTE: This function has been added to CRMEntity (base class). + * You can override the behavior by re-defining it here. + */ + // function save_related_module($module, $crmid, $with_module, $with_crmid) { } + + /** + * Handle deleting related module information. + * NOTE: This function has been added to CRMEntity (base class). + * You can override the behavior by re-defining it here. + */ + //function delete_related_module($module, $crmid, $with_module, $with_crmid) { } + + /** + * Handle getting related list information. + * NOTE: This function has been added to CRMEntity (base class). + * You can override the behavior by re-defining it here. + */ + //function get_related_list($id, $cur_tab_id, $rel_tab_id, $actions=false) { } + + /** + * Handle getting dependents list information. + * NOTE: This function has been added to CRMEntity (base class). + * You can override the behavior by re-defining it here. + */ + //function get_dependents_list($id, $cur_tab_id, $rel_tab_id, $actions=false) { } +} +?> diff --git a/oss/vtiger/trunk/modules/ModComments/ModCommentsHandler.php b/oss/vtiger/trunk/modules/ModComments/ModCommentsHandler.php new file mode 100644 index 00000000..5a768746 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModCommentsHandler.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/ModCommentsWidgetHandler.php b/oss/vtiger/trunk/modules/ModComments/ModCommentsWidgetHandler.php new file mode 100644 index 00000000..0dedbe3f --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ModCommentsWidgetHandler.php @@ -0,0 +1,19 @@ +getWidget($widgetName); +$widgetInstance->setCriteria($criteria); + +echo $widgetInstance->process( array('ID' => vtlib_purify($_REQUEST['parentid'])) ); diff --git a/oss/vtiger/trunk/modules/ModComments/Popup.php b/oss/vtiger/trunk/modules/ModComments/Popup.php new file mode 100644 index 00000000..40aae3fa --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/Popup.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/ProcessDuplicates.php b/oss/vtiger/trunk/modules/ModComments/ProcessDuplicates.php new file mode 100644 index 00000000..5bd018e1 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/ProcessDuplicates.php @@ -0,0 +1,133 @@ +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/ModComments/QuickCreate.php b/oss/vtiger/trunk/modules/ModComments/QuickCreate.php new file mode 100644 index 00000000..2abf2f76 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/QuickCreate.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/Save.php b/oss/vtiger/trunk/modules/ModComments/Save.php new file mode 100644 index 00000000..b595d9e1 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/Save.php @@ -0,0 +1,53 @@ +mode = $mode; +if($record)$focus->id = $record; + +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($currentModule); +$return_id = $focus->id; + +$search = vtlib_purify($_REQUEST['search_url']); + +$parenttab = getParentTab(); +if($_REQUEST['return_module'] != '') { + $return_module = vtlib_purify($_REQUEST['return_module']); +} else { + $return_module = $currentModule; +} + +if($_REQUEST['return_action'] != '') { + $return_action = vtlib_purify($_REQUEST['return_action']); +} else { + $return_action = "DetailView"; +} + +if($_REQUEST['return_id'] != '') { + $return_id = vtlib_purify($_REQUEST['return_id']); +} + +header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&parenttab=$parenttab&start=".vtlib_purify($_REQUEST['pagenumber']).$search); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/Settings.php b/oss/vtiger/trunk/modules/ModComments/Settings.php new file mode 100644 index 00000000..146b04b1 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/Settings.php @@ -0,0 +1,63 @@ +assign("MOD",$mod_strings); +$smarty->assign("APP",$app_strings); +$smarty->assign("THEME", "$theme"); +$smarty->assign("IMAGE_PATH", "themes/$theme/images/"); + +// Operation to be restricted for non-admin users. +global $current_user; +if(!is_admin($current_user)) { + $smarty->display(vtlib_getModuleTemplate('Vtiger','OperationNotPermitted.tpl')); +} else { + $module = vtlib_purify($_REQUEST['formodule']); + + $menu_array = Array(); + + 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'); + } + } + + if(VTWorkflowUtils::checkModuleWorkflow($module)){ + $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('MODULE',$module); + $smarty->assign('MODULE_LBL',getTranslatedString($module)); + $smarty->assign('MENU_ARRAY', $menu_array); + + $smarty->display(vtlib_getModuleTemplate('Vtiger','Settings.tpl')); +} +?> diff --git a/oss/vtiger/trunk/modules/ModComments/TagCloud.php b/oss/vtiger/trunk/modules/ModComments/TagCloud.php new file mode 100644 index 00000000..8343cd5b --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/TagCloud.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/ModComments/UnifiedSearch.php b/oss/vtiger/trunk/modules/ModComments/UnifiedSearch.php new file mode 100644 index 00000000..9a37320c --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/UnifiedSearch.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/index.php b/oss/vtiger/trunk/modules/ModComments/index.php new file mode 100644 index 00000000..c12986b5 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/index.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/language/en_us.lang.php b/oss/vtiger/trunk/modules/ModComments/language/en_us.lang.php new file mode 100644 index 00000000..da4bf941 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/language/en_us.lang.php @@ -0,0 +1,34 @@ + 'Comments', +'SINGLE_ModComments' => 'Comment', + +'LBL_MODCOMMENTS_INFORMATION' => 'Comments Information', +'LBL_OTHER_INFORMATION' => 'Other Information', +'LBL_CUSTOM_INFORMATION' => 'Custom Information', + +'Assigned To' => 'Assigned To', +'Created Time' => 'Created Time', +'Modified Time' => 'Modified Time', +'Comment' => 'Comment', +'Comments' => 'Comments', +'Related To' => 'Related To', +'Creator' => 'Creator', + +'LBL_ADD_COMMENT' => 'Add Comment', +'LBL_AUTHOR' => 'Author', +'LBL_ON' => 'on', +'LBL_MINE' => 'Mine', +'LBL_LAST5'=> 'Last 5', + +); + +?> diff --git a/oss/vtiger/trunk/modules/ModComments/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/ModComments/language/zh_cn.lang.php new file mode 100644 index 00000000..08e2bf56 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/language/zh_cn.lang.php @@ -0,0 +1,47 @@ + '备注', +'SINGLE_ModComments' => '备注', + +'LBL_MODCOMMENTS_INFORMATION' => '备注信息', +'LBL_OTHER_INFORMATION' => '其他信息', +'LBL_CUSTOM_INFORMATION' => '客户信息', + +'Assigned To' => '指定给', +'Created Time' => '创建时间', +'Modified Time' => '修改时间', +'Comment' => '备注', +'Comments' => '备注', +'Related To' => '相关给', +'Creator' => '创建人', + +'LBL_ADD_COMMENT' => '添加备注', +'LBL_AUTHOR' => '作者', +'LBL_ON' => '添加于', +'LBL_MINE' => '我的添加的', +'LBL_LAST5'=> '最新 5 条', + +); + +?> diff --git a/oss/vtiger/trunk/modules/ModComments/models/Comments.php b/oss/vtiger/trunk/modules/ModComments/models/Comments.php new file mode 100644 index 00000000..e1e81505 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/models/Comments.php @@ -0,0 +1,34 @@ +data = $datarow; + } + + function author() { + $authorid = $this->data['smcreatorid']; + if(!isset(self::$ownerNamesCache[$authorid])) { + self::$ownerNamesCache[$authorid] = getOwnerName($authorid); + } + return self::$ownerNamesCache[$authorid]; + } + + function timestamp(){ + return getDisplayDate($this->data['modifiedtime']); + } + + function content() { + return decode_html($this->data['commentcontent']); + } +} \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/schema.xml b/oss/vtiger/trunk/modules/ModComments/schema.xml new file mode 100644 index 00000000..6d679b5d --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/schema.xml @@ -0,0 +1,21 @@ + + + + + vtiger_modcomments + +
+ + vtiger_modcommentscf + +
+
+
diff --git a/oss/vtiger/trunk/modules/ModComments/updateRelations.php b/oss/vtiger/trunk/modules/ModComments/updateRelations.php new file mode 100644 index 00000000..9ee5399f --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/updateRelations.php @@ -0,0 +1,46 @@ +delete_related_module($currentModule, $forCRMRecord, $destinationModule, $ids); + } +} else { + if(!empty($_REQUEST['idlist'])) { + // Split the string of ids + $ids = explode (";",trim($idlist,";")); + } else if(!empty($_REQUEST['entityid'])){ + $ids = $_REQUEST['entityid']; + } + if(!empty($ids)) { + $focus->save_related_module($currentModule, $forCRMRecord, $destinationModule, $ids); + } +} +header("Location: index.php?module=$currentModule&record=$forCRMRecord&action=$action&parenttab=$parenttab"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/ModComments/widgets/DetailViewBlockComment.php b/oss/vtiger/trunk/modules/ModComments/widgets/DetailViewBlockComment.php new file mode 100644 index 00000000..cb1bf028 --- /dev/null +++ b/oss/vtiger/trunk/modules/ModComments/widgets/DetailViewBlockComment.php @@ -0,0 +1,114 @@ +context) { + $value = $this->context[$key]; + if ($purify && !empty($value)) { + $value = vtlib_purify($value); + } + return $value; + } + return false; + } + + function title() { + return getTranslatedString('Comments Information', 'ModComments'); + } + + function name() { + return $this->_name; + } + + function uikey() { + return "ModCommentsDetailViewBlockCommentWidget"; + } + + function setCriteria($newCriteria) { + $this->criteria = $newCriteria; + } + + function getViewer() { + global $theme, $app_strings, $current_language; + + $smarty = new vtigerCRM_Smarty(); + $smarty->assign('APP', $app_strings); + $smarty->assign('MOD', return_module_language($current_language,'ModComments')); + $smarty->assign('THEME', $theme); + $smarty->assign('IMAGE_PATH', "themes/$theme/images/"); + + $smarty->assign('UIKEY', $this->uikey()); + $smarty->assign('WIDGET_TITLE', $this->title()); + $smarty->assign('WIDGET_NAME', $this->name()); + + return $smarty; + } + + protected function getModels($parentRecordId, $criteria) { + global $adb, $current_user; + + $moduleName = 'ModComments'; + if(vtlib_isModuleActive($moduleName)) { + $entityInstance = CRMEntity::getInstance($moduleName); + + $queryCriteria = ''; + switch($criteria) { + case 'All': $queryCriteria = ''; break; + case 'Last5': $queryCriteria = sprintf(" ORDER BY %s.%s DESC LIMIT 5", $entityInstance->table_name, $entityInstance->table_index); break; + case 'Mine': $queryCriteria = ' AND vtiger_crmentity.smownerid=' . $current_user->id; break; + } + + $query = $entityInstance->getListQuery($moduleName, sprintf(" AND %s.related_to=?", $entityInstance->table_name)); + $query .= $queryCriteria; + $result = $adb->pquery($query, array($parentRecordId)); + + $instances = array(); + if($adb->num_rows($result)) { + while($resultrow = $adb->fetch_array($result)) { + $instances[] = new ModComments_CommentsModel($resultrow); + } + } + } + return $instances; + } + + function processItem($model) { + $viewer = $this->getViewer(); + $viewer->assign('COMMENTMODEL', $model); + return $viewer->fetch(vtlib_getModuleTemplate("ModComments","widgets/DetailViewBlockCommentItem.tpl")); + } + + function process($context = false) { + $this->context = $context; + $sourceRecordId = $this->getFromContext('ID', true); + $usecriteria = ($this->criteria === false)? $this->defaultCriteria : $this->criteria; + + $viewer = $this->getViewer(); + $viewer->assign('ID', $sourceRecordId); + $viewer->assign('CRITERIA', $usecriteria); + + $viewer->assign('COMMENTS', $this->getModels($sourceRecordId, $usecriteria) ); + + return $viewer->fetch(vtlib_getModuleTemplate("ModComments","widgets/DetailViewBlockComment.tpl")); + } + +} \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/PBXManager/AsteriskUtils.php b/oss/vtiger/trunk/modules/PBXManager/AsteriskUtils.php index 1201b181..71425f83 100644 --- a/oss/vtiger/trunk/modules/PBXManager/AsteriskUtils.php +++ b/oss/vtiger/trunk/modules/PBXManager/AsteriskUtils.php @@ -7,40 +7,6 @@ * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. ********************************************************************************/ - /** - * this function checks if there are any outgoing calls for the asterisk server - * @param $adb - the peardatabase type object - * @return array in the format array(from, to, extension, password) if call exists - * false otherwise - */ -function checkOutgoingCalls($adb){ - $sql = "select * from vtiger_asteriskoutgoingcalls"; - $result = $adb->pquery($sql, array()); - - if($adb->num_rows($result)>0){ - $call = array(); - $userid = $adb->query_result($result,0,"userid"); - $call['from'] = $adb->query_result($result,0,"from_number"); - $call['to'] = $adb->query_result($result,0,"to_number"); - - $sql = "delete from vtiger_asteriskoutgoingcalls where userid=?"; - $result = $adb->pquery($sql, array($userid)); - - $sql = "select * from vtiger_users where id = ?"; - $result = $adb->pquery($sql, array($userid)); - if($adb->num_rows($result)>0){ - $call['extension'] = $adb->query_result($result,0,"asterisk_extension"); - $call['password'] = $adb->query_result($result,0,"asterisk_password"); - }else{ - return false; - } - return $call; - }else{ - return false; - } -} - - /** * this function returns the asterisk server information * @param $adb - the peardatabase type object @@ -154,7 +120,7 @@ function getChannel($asterisk){ */ function getUserFromExtension($extension, $adb){ $userid = false; - $sql = "select * from vtiger_asteriskextensions where asterisk_extension=?"; + $sql = "select userid from vtiger_asteriskextensions where asterisk_extension=?"; $result = $adb->pquery($sql, array($extension)); if($adb->num_rows($result) > 0){ $userid = $adb->query_result($result, 0, "userid"); @@ -173,8 +139,13 @@ function getUserFromExtension($extension, $adb){ * @return string $status - on success - string success * on failure - string failure */ -function asterisk_addToActivityHistory($callerName, $callerNumber, $callerType, $adb, $current_user){ - global $log; +function asterisk_addToActivityHistory($callerName, $callerNumber, $callerType, $adb, $userid, $relcrmid, $callerInfo=false){ + global $log, $current_user; + + // Reset date format for a while + $old_userdate_format = $current_user->date_format; + $current_user->date_format = 'yyyy-mm-dd'; + require_once 'modules/Calendar/Activity.php'; $focus = new Activity(); $focus->column_fields['subject'] = "Incoming call from $callerName ($callerNumber)"; @@ -184,30 +155,37 @@ function asterisk_addToActivityHistory($callerName, $callerNumber, $callerType, $focus->column_fields['time_start'] = date('H:i'); $focus->column_fields['time_end'] = date('H:i'); $focus->column_fields['eventstatus'] = "Held"; - $focus->column_fields['assigned_user_id'] = $current_user->id; + $focus->column_fields['assigned_user_id'] = $userid; $focus->save('Calendar'); $focus->setActivityReminder('off'); -// $callerInfo = getCallerInfo("$callerType:".$callerNumber); -// if($callerInfo == false){ - $callerInfo = getCallerInfo(getStrippedNumber($callerNumber)); - //} + // Restore dateformat + $current_user->date_format = $old_userdate_format; + + if(empty($relcrmid)) { + if(empty($callerInfo)) { + $callerInfo = getCallerInfo($callerNumber); + } + } else { + $callerInfo = array(); + $callerInfo['module'] = getSalesEntityType($relcrmid); + $callerInfo['id'] = $relcrmid; + } + if($callerInfo != false){ $tablename = array('Contacts'=>'vtiger_cntactivityrel', 'Accounts'=>'vtiger_seactivityrel', 'Leads'=>'vtiger_seactivityrel'); $sql = "insert into ".$tablename[$callerInfo['module']]." values (?,?)"; - $params = array($callerInfo[id], $focus->id); + $params = array($callerInfo['id'], $focus->id); $adb->pquery($sql, $params); - $status = "success"; - }else{ - $status = "failure"; } - return $status; + return $focus->id; } + /* Function to add an outgoing call to the History * Params Object $current_user - the current user * string $extension - the users extension number - * int $record - the activity will be attached to this record + * int $record - the activity will be attached to this record * object $adb - the peardatabase object */ function addOutgoingcallHistory($current_user,$extension, $record ,$adb){ @@ -226,7 +204,7 @@ function addOutgoingcallHistory($current_user,$extension, $record ,$adb){ $focus->setActivityReminder('off'); $setype = $adb->pquery("SELECT setype FROM vtiger_crmentity WHERE crmid = ?",array($record)); $rows = $adb->num_rows($setype); - + if($rows > 0){ $module = $adb->query_result($setype,0,'setype'); $tablename = array('Contacts'=>'vtiger_cntactivityrel', 'Accounts'=>'vtiger_seactivityrel', 'Leads'=>'vtiger_seactivityrel'); @@ -237,7 +215,7 @@ function addOutgoingcallHistory($current_user,$extension, $record ,$adb){ }else{ $status = "failure"; } - + return $status; } ?> diff --git a/oss/vtiger/trunk/modules/PBXManager/ListView.php b/oss/vtiger/trunk/modules/PBXManager/ListView.php index 8f88ce1f..9b5e84fe 100644 --- a/oss/vtiger/trunk/modules/PBXManager/ListView.php +++ b/oss/vtiger/trunk/modules/PBXManager/ListView.php @@ -21,6 +21,7 @@ $category = getParentTab(); $url_string = ''; $tool_buttons = array("index"=>"yes",); +$tool_buttons["moduleSettings"] = isModuleSettingPermitted($currentModule); $list_buttons = Array(); if(isPermitted($currentModule,'Delete','') == 'yes') $list_buttons['del'] = $app_strings[LBL_MASS_DELETE]; @@ -28,7 +29,7 @@ $focus = new $currentModule(); $sorder = $focus->getSortOrder(); $order_by = $focus->getOrderBy(); -$_SESSION[$currentModule."_Order_by"] = $order_by; +$_SESSION[$currentModule."_Order_By"] = $order_by; $_SESSION[$currentModule."_Sort_Order"]=$sorder; $smarty = new vtigerCRM_Smarty(); @@ -49,14 +50,6 @@ $smarty->assign('IMAGE_PATH', "themes/$theme/images/"); $smarty->assign('CHANGE_OWNER', getUserslist()); $smarty->assign('CHANGE_GROUP_OWNER', getGroupslist()); -// Enabling Module Search -$url_string = ''; -if($_REQUEST['query'] == 'true') { - list($where, $ustring) = split('#@@#', getWhereCondition($currentModule)); - $url_string .= "&query=true$ustring"; - $smarty->assign('SEARCH_URL', $url_string); -} - // Custom View $customView = new CustomView($currentModule); $viewid = $customView->getViewId($currentModule); @@ -82,17 +75,24 @@ $smarty->assign("VIEWID", $viewid); if($viewinfo['viewname'] == 'All') $smarty->assign('ALL', 'All'); -if($viewid != '0') { - $listquery = getListQuery($currentModule); - $list_query= $customView->getModifiedCvListQuery($viewid, $listquery, $currentModule); +global $current_user; +$queryGenerator = new QueryGenerator($currentModule, $current_user); +if ($viewid != "0") { + $queryGenerator->initForCustomViewById($viewid); } else { - $list_query= getListQuery($currentModule); + $queryGenerator->initForDefaultCustomView(); } -if($where != '') { - $list_query = "$list_query AND $where"; +// Enabling Module Search +$url_string = ''; +if($_REQUEST['query'] == 'true') { + $queryGenerator->addUserSearchConditions($_REQUEST); + $ustring = getSearchURL($_REQUEST); + $url_string .= "&query=true$ustring"; + $smarty->assign('SEARCH_URL', $url_string); } +$list_query = $queryGenerator->getQuery(); // Sorting if(!empty($order_by)) { if($order_by == 'smownerid') $list_query .= ' ORDER BY user_name '.$sorder; @@ -122,7 +122,7 @@ if( $adb->dbType == "pgsql") else $list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array()); -$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec); +$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows); $smarty->assign('recordListRange',$recordListRangeMsg); $smarty->assign("CUSTOMVIEW_OPTION",$customview_html); @@ -132,9 +132,12 @@ $start = $_SESSION['lvs'][$currentModule]['start']; $navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, $currentModule, 'index', $viewid); $smarty->assign("NAVIGATION", $navigationOutput); -$listview_header = getListViewHeader($focus,$currentModule,$url_string,$sorder,$order_by,'',$customView); -$listview_entries = getListViewEntries($focus,$currentModule,$list_result,$navigation_array,'','','EditView','Delete',$customView); -$listview_header_search = getSearchListHeaderValues($focus,$currentModule,$url_string,$sorder,$order_by,'',$customView); +$controller = new ListViewController($adb, $current_user, $queryGenerator); +$listview_header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder, + $order_by); +$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result, + $navigation_array); +$listview_header_search = $controller->getBasicSearchFieldInfoList(); // Convert field value to DetailView Link if(isset($focus->detailview_links) && count($focus->detailview_links)) { @@ -157,12 +160,18 @@ $smarty->assign('SEARCHLISTHEADER',$listview_header_search); // Module Search $alphabetical = AlphabeticalSearch($currentModule,'index',$focus->def_basicsearch_col,'true','basic','','','','',$viewid); -$fieldnames = getAdvSearchfields($currentModule); +$fieldnames = $controller->getAdvancedSearchOptionString(); $criteria = getcriteria_options(); $smarty->assign("ALPHABETICAL", $alphabetical); $smarty->assign("FIELDNAMES", $fieldnames); $smarty->assign("CRITERIA", $criteria); +// Gather the custom link information to display +include_once('vtlib/Vtiger/Link.php'); +$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category); +$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params)); +// END + if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') $smarty->display("ListViewEntries.tpl"); else diff --git a/oss/vtiger/trunk/modules/PBXManager/StartCall.php b/oss/vtiger/trunk/modules/PBXManager/StartCall.php index d61024b1..7f5ca899 100644 --- a/oss/vtiger/trunk/modules/PBXManager/StartCall.php +++ b/oss/vtiger/trunk/modules/PBXManager/StartCall.php @@ -46,8 +46,13 @@ function startCall(){ $asterisk->transfer($extension,$number); + $callerModule = getSalesEntityType($record); + $entityNames = getEntityName($callerModule, array($record)); + $callerName = $entityNames[$record]; + $callerInfo = array('id'=>$record, 'module'=>$callerModule, 'name'=>$callerName); + //adds to pbx manager - addToCallHistory($extension, $extension, $number, "outgoing", $adb); + addToCallHistory($extension, $extension, $number, "outgoing", $adb, $callerInfo); // add to the records activity history addOutgoingcallHistory($current_user ,$extension,$record ,$adb); diff --git a/oss/vtiger/trunk/modules/PBXManager/TraceIncomingCall.php b/oss/vtiger/trunk/modules/PBXManager/TraceIncomingCall.php index 4f95a164..c8fdbd18 100644 --- a/oss/vtiger/trunk/modules/PBXManager/TraceIncomingCall.php +++ b/oss/vtiger/trunk/modules/PBXManager/TraceIncomingCall.php @@ -10,77 +10,118 @@ echo TraceIncomingCall(); +/** + * This function traces an incoming call and adds it to the databse for vtiger to pickup, + * it also adds an entry to the activity history of the related Contact/Lead/Account + * only these three modules are supported for now + */ function TraceIncomingCall(){ - require_once 'include/utils/utils.php'; + + require_once('modules/PBXManager/AsteriskUtils.php'); global $adb, $current_user; - global $theme,$app_strings; - + global $theme,$app_strings,$log; + $theme_path="themes/".$theme."/"; $image_path=$theme_path."images/"; - $sql = "select * from vtiger_asteriskextensions where userid = ".$current_user->id; - $result = $adb->query($sql); - $asterisk_extension = $adb->query_result($result, 0, "asterisk_extension"); + $asterisk_extension = false; + if(isset($current_user->column_fields)) { + $asterisk_extension = $current_user->column_fields['asterisk_extension']; + } else { + $sql = "select asterisk_extension from vtiger_asteriskextensions where userid = ?"; + $result = $adb->pquery($sql, array($current_user->id)); + $asterisk_extension = $adb->query_result($result, 0, "asterisk_extension"); + } - $query = "select * from vtiger_asteriskincomingcalls where to_number = ".$asterisk_extension; - $result = $adb->query($query); + $query = "select * from vtiger_asteriskincomingcalls where to_number = ?"; + $result = $adb->pquery($query, array($asterisk_extension)); if($adb->num_rows($result)>0){ + $flag = $adb->query_result($result,0,"flag"); + $oldTime = $adb->query_result($result,0,"timer"); $callerNumber = $adb->query_result($result,0,"from_number"); $callerName = $adb->query_result($result,0,"from_name"); $callerType = $adb->query_result($result,0,"callertype"); - - if(!empty($callerType)){ - $caller = getCallerName("$callerType:".$callerNumber); + $refuid = $adb->query_result($result, 0, "refuid"); + + if(!empty($callerNumber)){ + $tracedCallerInfo = getTraceIncomingCallerInfo($callerNumber); + } + + $callerLinks = $tracedCallerInfo['callerLinks']; + $firstCallerInfo = false; + if(!empty($tracedCallerInfo['callerInfos'])) { + $firstCallerInfo = $tracedCallerInfo['callerInfos']; + } + + $newTime = time(); + if(($newTime-$oldTime)>=3 && $flag == 1){ + $adb->pquery("delete from vtiger_asteriskincomingcalls where to_number = ?", array($asterisk_extension)); }else{ - $caller = getCallerName($callerNumber); - } - - $adb->query("delete from vtiger_asteriskincomingcalls where to_number = ".$asterisk_extension); - - //prepare the div for incoming calls - $status = " + if($flag==0){ + $flag=1; + + // Trying to get the Related CRM ID for the Event (if already desired by popup click) + $relcrmid = false; + if(!empty($refuid)) { + $refuidres = $adb->pquery('SELECT relcrmid FROM vtiger_asteriskincomingevents WHERE uid=?',array($refuid)); + if($adb->num_rows($refuidres)) $relcrmid = $adb->query_result($refuidres, 0, 'relcrmid'); + } + $adb->pquery("update vtiger_asteriskincomingcalls set flag = ? where to_number = ?", array($flag, $asterisk_extension)); + $activityid = asterisk_addToActivityHistory($callerName, $callerNumber, $callerType, $adb, $current_user->id, $relcrmid, $firstCallerInfo); + + } + //prepare the div for incoming calls + $status = "
- +
Incoming Call".$app_strings['LBL_INCOMING_CALL']."
- -
Caller Information -
Number: $callerNumber -
Name: $callerName +
".$app_strings['LBL_CALLER_INFORMATION']." +
".$app_strings['LBL_CALLER_NUMBER']." $callerNumber +
".$app_strings['LBL_CALLER_NAME']." $callerName
Information from vtigerCRM -
$caller +
".$app_strings['LBL_INFORMATION_VTIGER']." +
$callerLinks
"; - - require_once 'modules/Calendar/Activity.php'; - $focus = new Activity(); - $focus->column_fields['subject'] = "Incoming call from $callerName ($callerNumber)"; - $focus->column_fields['activitytype'] = "Call"; - $focus->column_fields['date_start'] = date('Y-m-d'); - $focus->column_fields['due_date'] = date('Y-m-d'); - $focus->column_fields['time_start'] = date('H:i'); - $focus->column_fields['time_end'] = date('H:i'); - $focus->column_fields['eventstatus'] = "Held"; - $focus->column_fields['assigned_user_id'] = $current_user->id; - $focus->save('Calendar'); - - $callerInfo = getCallerInfo("$callerType:".$callerNumber); - if($callerInfo == false){ - $callerInfo = getCallerInfo(getStrippedNumber($callerNumber)); - } - if($callerInfo != false){ - $tablename = array('Contacts'=>'vtiger_cntactivityrel', 'Accounts'=>'vtiger_seactivityrel', 'Leads'=>'vtiger_seactivityrel'); - $sql = "insert into ".$tablename[$callerInfo['module']]." values (?,?)"; - $params = array($callerInfo[id], $focus->id); - $adb->pquery($sql, $params); } }else{ $status = "failure"; } - return $status; } +//functions for asterisk integration start +/** + * this function returns the caller name based on the phone number that is passed to it + * @param $from - the number which is calling + * returns caller information in name(type) format :: for e.g. Mary Smith (Contact) + * if no information is present in database, it returns :: Unknown Caller (Unknown) + */ +function getTraceIncomingCallerInfo($from) { + global $adb; + // Grab all possible caller informations (lookup for number as well stripped number) + $callerInfos = getCallerInfo($from); + $callerLinks = ''; + + if($callerInfos !== false){ + $callerName = decode_html($callerInfos['name']); + $module = $callerInfos['module']; + $callerModule = " [$module]"; + $callerID = $callerInfos['id']; + $callerLinks = $callerLinks."$callerName$callerModule
"; + }else{ + $callerLinks = $callerLinks."
+ ".getTranslatedString('LBL_CREATE_LEAD')."
+ ".getTranslatedString('LBL_CREATE_CONTACT')."
+ ".getTranslatedString('LBL_CREATE_ACCOUNT').""; + } + return array( + 'callerInfos' => $callerInfos, + 'callerLinks' => $callerLinks + ); +} + ?> diff --git a/oss/vtiger/trunk/modules/PBXManager/language/en_us.lang.php b/oss/vtiger/trunk/modules/PBXManager/language/en_us.lang.php index 1362b949..91cf4647 100644 --- a/oss/vtiger/trunk/modules/PBXManager/language/en_us.lang.php +++ b/oss/vtiger/trunk/modules/PBXManager/language/en_us.lang.php @@ -11,6 +11,10 @@ $mod_strings = Array( 'Asterisk' => 'Asterisk', 'LBL_ASTERISK_INFORMATION' => 'ASTERISK Information', + + 'Call From'=>'Call From', + 'Call To'=>'Call To', + 'Time Of Call'=>'Time Of Call', ); ?> diff --git a/oss/vtiger/trunk/modules/PBXManager/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/PBXManager/language/zh_cn.lang.php index 80cc00c0..b0931ef3 100644 --- a/oss/vtiger/trunk/modules/PBXManager/language/zh_cn.lang.php +++ b/oss/vtiger/trunk/modules/PBXManager/language/zh_cn.lang.php @@ -24,6 +24,10 @@ $mod_strings = Array( 'Asterisk' => 'Asterisk', 'LBL_ASTERISK_INFORMATION' => 'ASTERISK 信息', + + 'Call From'=>'来电', + 'Call To'=>'去电', + 'Time Of Call'=>'通话时间', ); ?> diff --git a/oss/vtiger/trunk/modules/PBXManager/utils/AsteriskClass.php b/oss/vtiger/trunk/modules/PBXManager/utils/AsteriskClass.php index 0ea14f2a..831f9391 100644 --- a/oss/vtiger/trunk/modules/PBXManager/utils/AsteriskClass.php +++ b/oss/vtiger/trunk/modules/PBXManager/utils/AsteriskClass.php @@ -99,7 +99,7 @@ class Asterisk { switch($typeCalled){ case "SIP": - $context = "local-extensions"; + $context = "default"; break; case "PSTN": $context = "from-inside";//"outbound-dialing"; @@ -120,7 +120,7 @@ class Asterisk { $arr = explode("/", $from); $request = "Action: Originate\r\n". "Channel: $from\r\n". - "Exten: $to\r\n". + "Exten: ".preg_replace('~[^0-9]~', "", $to)."\r\n". "Context: $context\r\n". "Priority: 1\r\n". "Callerid: $arr[1]\r\n". diff --git a/oss/vtiger/trunk/modules/PickList/PickListAction.php b/oss/vtiger/trunk/modules/PickList/PickListAction.php index 06dce632..9936fb5f 100644 --- a/oss/vtiger/trunk/modules/PickList/PickListAction.php +++ b/oss/vtiger/trunk/modules/PickList/PickListAction.php @@ -89,7 +89,11 @@ if($mode == 'add'){ } echo "SUCCESS"; }elseif($mode == 'delete'){ - $values = Zend_Json::decode($_REQUEST['values']); + + //fix for T6033 + $values = str_replace('\\','\\\\',$_REQUEST['values']); + $values = Zend_Json::decode($values); + $replaceVal = $_REQUEST['replaceVal']; if(!empty($replaceVal)){ $sql = "select * from vtiger_$tableName where $tableName=?"; @@ -136,4 +140,4 @@ if($mode == 'add'){ echo "SUCCESS"; } -?> \ No newline at end of file +?> diff --git a/oss/vtiger/trunk/modules/PickList/PickListUtils.php b/oss/vtiger/trunk/modules/PickList/PickListUtils.php index c2669748..bca665b9 100644 --- a/oss/vtiger/trunk/modules/PickList/PickListUtils.php +++ b/oss/vtiger/trunk/modules/PickList/PickListUtils.php @@ -62,7 +62,7 @@ function getPickListModules(){ // END $result = $adb->pquery($query, array()); while($row = $adb->fetch_array($result)){ - $modules[$row['tablabel']] = $row['tabname']; + $modules[$row['tablabel']] = $row['tabname']; } return $modules; } diff --git a/oss/vtiger/trunk/modules/Potentials/CallRelatedList.php b/oss/vtiger/trunk/modules/Potentials/CallRelatedList.php index 741aad54..a9a4b0fd 100644 --- a/oss/vtiger/trunk/modules/Potentials/CallRelatedList.php +++ b/oss/vtiger/trunk/modules/Potentials/CallRelatedList.php @@ -45,6 +45,16 @@ if($singlepane_view == 'true' && $_REQUEST['action'] == 'CallRelatedList' ) { if (isset($focus->name)) $smarty->assign("NAME", $focus->name); $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("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar')); $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events')); $smarty->assign("CATEGORY",$category); diff --git a/oss/vtiger/trunk/modules/Potentials/Charts.php b/oss/vtiger/trunk/modules/Potentials/Charts.php index 67194ede..7ad527e1 100644 --- a/oss/vtiger/trunk/modules/Potentials/Charts.php +++ b/oss/vtiger/trunk/modules/Potentials/Charts.php @@ -122,7 +122,7 @@ class jpgraph { } if (isset($record->column_fields['amount']) && in_array($record->column_fields['assigned_user_id'],$user_id)) { // Strip all non numbers from this string. - $amount = convertFromMasterCurrency(ereg_replace('[^0-9]', '', floor($record->column_fields['amount'])),$current_user->conv_rate); + $amount = convertFromMasterCurrency(preg_replace('/[^0-9]/', '', floor($record->column_fields['amount'])),$current_user->conv_rate); $sum[$month][$sales_stage][$record->column_fields['assigned_user_id']] = $sum[$month][$sales_stage][$record->column_fields['assigned_user_id']] + $amount; if (isset($count[$month][$sales_stage][$record->column_fields['assigned_user_id']])) { @@ -457,7 +457,7 @@ class jpgraph { } if (isset($record->column_fields['amount']) && in_array($record->column_fields['assigned_user_id'],$user_id)) { // Strip all non numbers from this string. - $amount = convertFromMasterCurrency(ereg_replace('[^0-9]', '', floor($record->column_fields['amount'])),$current_user->conv_rate); + $amount = convertFromMasterCurrency(preg_replace('/[^0-9]/', '', floor($record->column_fields['amount'])),$current_user->conv_rate); $sum[$lead_source][$sales_stage][$record->column_fields['assigned_user_id']] = $sum[$lead_source][$sales_stage][$record->column_fields['assigned_user_id']] + $amount; if (isset($count[$lead_source][$sales_stage][$record->column_fields['assigned_user_id']])) { $count[$lead_source][$sales_stage][$record->column_fields['assigned_user_id']]++; @@ -767,7 +767,7 @@ class jpgraph { } if (isset($record->column_fields['amount']) && in_array($record->column_fields['assigned_user_id'],$user_id)) { // Strip all non numbers from this string. - $amount = convertFromMasterCurrency(ereg_replace('[^0-9]', '', floor($record->column_fields['amount'])),$current_user->conv_rate); + $amount = convertFromMasterCurrency(preg_replace('/[^0-9]/', '', floor($record->column_fields['amount'])),$current_user->conv_rate); $sum[$record->column_fields['sales_stage']][$record->column_fields['assigned_user_id']] = $sum[$record->column_fields['sales_stage']][$record->column_fields['assigned_user_id']] + $amount; if (isset($count[$record->column_fields['sales_stage']][$record->column_fields['assigned_user_id']])) { $count[$record->column_fields['sales_stage']][$record->column_fields['assigned_user_id']]++; @@ -1029,7 +1029,7 @@ class jpgraph { if (!isset($sum[$record->column_fields['leadsource']])) $sum[$record->column_fields['leadsource']] = 0; if (isset($record->column_fields['amount']) && isset($record->column_fields['leadsource'])) { // Strip all non numbers from this string. - $amount = convertFromMasterCurrency(ereg_replace('[^0-9]', '', floor($record->column_fields['amount'])),$current_user->conv_rate); + $amount = convertFromMasterCurrency(preg_replace('/[^0-9]/', '', floor($record->column_fields['amount'])),$current_user->conv_rate); $sum[$record->column_fields['leadsource']] = $sum[$record->column_fields['leadsource']] + ($amount/1000); if (isset($count[$record->column_fields['leadsource']])) $count[$record->column_fields['leadsource']]++; else $count[$record->column_fields['leadsource']] = 1; diff --git a/oss/vtiger/trunk/modules/Potentials/DetailView.php b/oss/vtiger/trunk/modules/Potentials/DetailView.php index 29e3d383..a1b78b82 100644 --- a/oss/vtiger/trunk/modules/Potentials/DetailView.php +++ b/oss/vtiger/trunk/modules/Potentials/DetailView.php @@ -105,6 +105,14 @@ 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("IS_REL_LIST",isPresentRelatedLists($currentModule)); @@ -122,6 +130,12 @@ if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($ $focus->markAsViewed($current_user->id); // END +// Gather the custom link information to display +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)); +// END + $smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true)); $smarty->display("DetailView.tpl"); diff --git a/oss/vtiger/trunk/modules/Potentials/DetailViewAjax.php b/oss/vtiger/trunk/modules/Potentials/DetailViewAjax.php index 0ab8965d..51627f81 100644 --- a/oss/vtiger/trunk/modules/Potentials/DetailViewAjax.php +++ b/oss/vtiger/trunk/modules/Potentials/DetailViewAjax.php @@ -35,7 +35,6 @@ if($ajaxaction == "DETAILVIEW") $modObj->id = $crmid; $modObj->mode = "edit"; $modObj->save("Potentials"); - sendNotificationToOwner('Potentials',&$modObj); if($modObj->id != "") { echo ":#:SUCCESS"; @@ -47,5 +46,7 @@ if($ajaxaction == "DETAILVIEW") { 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/Potentials/ListView.php b/oss/vtiger/trunk/modules/Potentials/ListView.php index 536b6700..cc9d657f 100644 --- a/oss/vtiger/trunk/modules/Potentials/ListView.php +++ b/oss/vtiger/trunk/modules/Potentials/ListView.php @@ -67,15 +67,6 @@ $_SESSION['POTENTIALS_ORDER_BY'] = $order_by; $_SESSION['POTENTIALS_SORT_ORDER'] = $sorder; //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> -if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true') -{ - list($where, $ustring) = split("#@@#",getWhereCondition($currentModule)); - // we have a query - $url_string .="&query=true".$ustring; - $log->info("Here is the where clause for the list view: $where"); - $smarty->assign("SEARCH_URL",$url_string); -} - //<<<>>>>>> $oCustomView = new CustomView("Potentials"); $viewid = $oCustomView->getViewId($currentModule); @@ -112,23 +103,29 @@ if($viewnamedesc['viewname'] == 'All') //Retreive the list from Database //<<<<<<<<>>>>>>>> -if($viewid != "0") -{ - $listquery = getListQuery("Potentials"); - $list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Potentials"); -}else -{ - $list_query = getListQuery("Potentials"); +global $current_user; +$queryGenerator = new QueryGenerator($currentModule, $current_user); +if ($viewid != "0") { + $queryGenerator->initForCustomViewById($viewid); +} else { + $queryGenerator->initForDefaultCustomView(); } //<<<<<<<>>>>>>>> +if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true') { + $queryGenerator->addUserSearchConditions($_REQUEST); + $ustring = getSearchURL($_REQUEST); + // we have a query + $url_string .="&query=true".$ustring; + $smarty->assign("SEARCH_URL",$url_string); +} +$list_query = $queryGenerator->getQuery(); +$where = $queryGenerator->getConditionalWhere(); if(isset($where) && $where != '') { if(isset($_REQUEST['from_dashboard']) && $_REQUEST['from_dashboard'] == 'true') $list_query .= " AND vtiger_potential.sales_stage = '".$mod_strings['Closed Won']."' AND ".$where; elseif(isset($_REQUEST['from_homepagedb']) && $_REQUEST['from_homepagedb'] == 'true') $list_query .= " AND vtiger_potential.sales_stage not in( '".$mod_strings['Closed Won']."' , '".$mod_strings['Closed Lost']."' )AND ".$where; - else - $list_query .= " AND ".$where; $_SESSION['export_where'] = $where; } @@ -212,21 +209,24 @@ if( $adb->dbType == "pgsql") else $list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array()); -$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec); +$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows); $smarty->assign('recordListRange',$recordListRangeMsg); //Retreive the List View Table Header if($viewid !='') $url_string .="&viewname=".$viewid; -$listview_header = getListViewHeader($focus,"Potentials",$url_string,$sorder,$order_by,"",$oCustomView); +$controller = new ListViewController($adb, $current_user, $queryGenerator); +$listview_header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder, + $order_by); $smarty->assign("LISTHEADER", $listview_header); -$listview_header_search=getSearchListHeaderValues($focus,"Potentials",$url_string,$sorder,$order_by,"",$oCustomView); +$listview_header_search = $controller->getBasicSearchFieldInfoList(); $smarty->assign("SEARCHLISTHEADER", $listview_header_search); -$listview_entries = getListViewEntries($focus,"Potentials",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView); +$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result, + $navigation_array); $smarty->assign("LISTHEADER", $listview_header); $smarty->assign("LISTENTITY", $listview_entries); @@ -240,7 +240,7 @@ $smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";") $navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"Potentials","index",$viewid); $alphabetical = AlphabeticalSearch($currentModule,'index','potentialname','true','basic',"","","","",$viewid); -$fieldnames = getAdvSearchfields($currentModule); +$fieldnames = $controller->getAdvancedSearchOptionString(); $criteria = getcriteria_options(); $smarty->assign("CRITERIA", $criteria); $smarty->assign("FIELDNAMES", $fieldnames); @@ -253,6 +253,12 @@ $smarty->assign("CHECK", $check_button); $_SESSION[$currentModule.'_listquery'] = $list_query; +// Gather the custom link information to display +include_once('vtlib/Vtiger/Link.php'); +$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category); +$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params)); +// END + if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') $smarty->display("ListViewEntries.tpl"); else diff --git a/oss/vtiger/trunk/modules/Potentials/ListViewTop.php b/oss/vtiger/trunk/modules/Potentials/ListViewTop.php index ab30ab24..4973cf76 100644 --- a/oss/vtiger/trunk/modules/Potentials/ListViewTop.php +++ b/oss/vtiger/trunk/modules/Potentials/ListViewTop.php @@ -42,7 +42,7 @@ function getTopPotentials($maxval,$calCnt) $title[]='myTopOpenPotentials.gif'; $title[]=$current_module_strings['LBL_TOP_OPPORTUNITIES']; $title[]='home_mypot'; - $where = "AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','".$current_module_strings['Closed Won']."','".$current_module_strings['Closed Lost']."') AND vtiger_crmentity.smownerid='".$current_user->id."'"; + $where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','".$current_module_strings['Closed Won']."','".$current_module_strings['Closed Lost']."') AND vtiger_crmentity.smownerid='".$current_user->id."' AND vtiger_potential.amount > 0"; $header=array(); $header[]=$current_module_strings['LBL_LIST_OPPORTUNITY_NAME']; //$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME']; @@ -51,7 +51,13 @@ function getTopPotentials($maxval,$calCnt) $rate = $rate_symbol['rate']; $curr_symbol = $rate_symbol['symbol']; $header[]=$current_module_strings['LBL_LIST_AMOUNT'].'('.$curr_symbol.')'; - $list_query = getListQuery("Potentials",$where); + $list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname, + vtiger_potential.amount, potentialid + FROM vtiger_potential + IGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity + ON vtiger_crmentity.crmid = vtiger_potential.potentialid"; + $list_query .= getNonAdminAccessControlQuery('Potentials',$current_user); + $list_query .= "WHERE vtiger_crmentity.deleted = 0 ".$where; $list_query .=" ORDER BY amount DESC"; $list_query .=" LIMIT " . $adb->sql_escape_string($maxval); @@ -85,7 +91,7 @@ function getTopPotentials($maxval,$calCnt) } } - $search_qry = "&query=true&Fields0=vtiger_crmentity.smownerid&Condition0=is&Srch_value0=".$current_user->column_fields['user_name']."&Fields1=vtiger_potential.sales_stage&Condition1=dcts&Srch_value1=closed&searchtype=advance&search_cnt=2&matchtype=all"; + $search_qry = "&query=true&Fields0=assigned_user_id&Condition0=e&Srch_value0=".$current_user->column_fields['user_name']."&Fields1=sales_stage&Condition1=k&Srch_value1=closed&searchtype=advance&search_cnt=2&matchtype=all"; $values=Array('ModuleName'=>'Potentials','Title'=>$title,'Header'=>$header,'Entries'=>$entries,'search_qry'=>$search_qry); diff --git a/oss/vtiger/trunk/modules/Potentials/Potentials.php b/oss/vtiger/trunk/modules/Potentials/Potentials.php index e186e29a..51fff384 100644 --- a/oss/vtiger/trunk/modules/Potentials/Potentials.php +++ b/oss/vtiger/trunk/modules/Potentials/Potentials.php @@ -153,7 +153,7 @@ class Potentials extends CRMEntity { $tab_id = getTabid("Potentials"); $log->debug("Entering create_list_query(".$order_by.",". $where.") method ..."); // Determine if the vtiger_account name is present in the where clause. - $account_required = ereg("accounts\.name", $where); + $account_required = preg_match("/accounts\.name/", $where); if($account_required) { @@ -166,23 +166,13 @@ class Potentials extends CRMEntity { $where_auto = ' AND vtiger_crmentity.deleted=0'; } + $query .= $this->getNonAdminAccessControlQuery('Potentials',$current_user); if($where != "") $query .= " where $where ".$where_auto; else $query .= " where ".$where_auto; - if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3) - { - $sec_parameter=getListViewSecurityParameter("Potentials"); - $query .= $sec_parameter; - - } - if($order_by != "") $query .= " ORDER BY $order_by"; - else - $query .= " ORDER BY vtiger_potential.potentialname "; - - $log->debug("Exiting create_list_query method ..."); return $query; @@ -210,12 +200,14 @@ class Potentials extends CRMEntity { inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid=vtiger_users.id LEFT JOIN vtiger_account on vtiger_potential.related_to=vtiger_account.accountid + LEFT JOIN vtiger_contactdetails on vtiger_potential.related_to=vtiger_contactdetails.contactid LEFT JOIN vtiger_potentialscf on vtiger_potentialscf.potentialid=vtiger_potential.potentialid LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid LEFT JOIN vtiger_campaign ON vtiger_campaign.campaignid = vtiger_potential.campaignid"; + $query .= $this->getNonAdminAccessControlQuery('Potentials',$current_user); $where_auto = " vtiger_crmentity.deleted = 0 "; if($where != "") @@ -223,15 +215,6 @@ class Potentials extends CRMEntity { else $query .= " WHERE ".$where_auto; - require('user_privileges/user_privileges_'.$current_user->id.'.php'); - require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); - //we should add security check when the user has Private Access - if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[2] == 3) - { - //Added security check to get the permitted records only - $query = $query." ".getListViewSecurityParameter("Potentials"); - } - $log->debug("Exiting create_export_query method ..."); return $query; @@ -496,7 +479,7 @@ class Potentials extends CRMEntity { inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid - where (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task') + where (vtiger_activity.activitytype != 'Emails') and (vtiger_activity.status = 'Completed' or vtiger_activity.status = 'Deferred' or (vtiger_activity.eventstatus = 'Held' and vtiger_activity.eventstatus != '')) and vtiger_seactivityrel.crmid=".$id." and vtiger_crmentity.deleted = 0"; @@ -745,6 +728,10 @@ class Potentials extends CRMEntity { $this->db->pquery($sql, $params); } } + function whomToSendMail($module,$insertion_mode,$assigntype) + { + //do not send any mail + } + } - -?> +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Potentials/Save.php b/oss/vtiger/trunk/modules/Potentials/Save.php index 72d2369b..d1bdede7 100644 --- a/oss/vtiger/trunk/modules/Potentials/Save.php +++ b/oss/vtiger/trunk/modules/Potentials/Save.php @@ -65,10 +65,5 @@ $local_log->debug("Saved record with id of ".$return_id); if($_REQUEST['return_viewname'] == '') $return_viewname='0'; if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']); -//Added to send mail to the vtiger_potential-owner about the Potential -if($focus->mode == 'edit') { // For non-edit mode sending mail is handled during Save - $status = sendNotificationToOwner('Potentials',$focus); -} - header("Location: index.php?action=$return_action&module=$return_module&parenttab=$parenttab&record=$return_id&pot_id=$pot_id&viewname=$return_viewname&start=".vtlib_purify($_REQUEST['pagenumber']).$search); -?> \ No newline at end of file +?> diff --git a/oss/vtiger/trunk/modules/Potentials/language/en_us.lang.php b/oss/vtiger/trunk/modules/Potentials/language/en_us.lang.php index 656cf4e6..5255e165 100644 --- a/oss/vtiger/trunk/modules/Potentials/language/en_us.lang.php +++ b/oss/vtiger/trunk/modules/Potentials/language/en_us.lang.php @@ -151,6 +151,7 @@ $mod_strings = Array( 'Potential No' => 'Potential No', // END +'Related To' => 'Related To', ); ?>