From 1786f23e58c724949d74a4029f0112d39bbb49bd Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Wed, 17 Nov 2010 03:11:45 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E7=89=88=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@653 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../trunk/modules/Vendors/CallRelatedList.php | 85 +++ .../trunk/modules/Vendors/CustomView.php | 14 + oss/vtiger/trunk/modules/Vendors/Delete.php | 38 ++ .../trunk/modules/Vendors/DetailView.php | 119 +++++ .../trunk/modules/Vendors/DetailViewAjax.php | 47 ++ oss/vtiger/trunk/modules/Vendors/EditView.php | 127 +++++ .../trunk/modules/Vendors/ExportRecords.php | 12 + .../modules/Vendors/FindDuplicateRecords.php | 107 ++++ oss/vtiger/trunk/modules/Vendors/Import.php | 16 + oss/vtiger/trunk/modules/Vendors/ListView.php | 243 +++++++++ .../trunk/modules/Vendors/ListViewPagging.php | 11 + oss/vtiger/trunk/modules/Vendors/MassEdit.php | 45 ++ .../trunk/modules/Vendors/MassEditSave.php | 68 +++ oss/vtiger/trunk/modules/Vendors/Popup.php | 14 + .../modules/Vendors/ProcessDuplicates.php | 134 +++++ .../trunk/modules/Vendors/QuickCreate.php | 12 + oss/vtiger/trunk/modules/Vendors/Save.php | 53 ++ oss/vtiger/trunk/modules/Vendors/Settings.php | 13 + oss/vtiger/trunk/modules/Vendors/TagCloud.php | 12 + .../trunk/modules/Vendors/UnifiedSearch.php | 11 + oss/vtiger/trunk/modules/Vendors/Vendors.js | 72 +++ oss/vtiger/trunk/modules/Vendors/Vendors.php | 499 ++++++++++++++++++ .../trunk/modules/Vendors/VendorsAjax.php | 13 + oss/vtiger/trunk/modules/Vendors/index.php | 20 + .../modules/Vendors/language/en_us.lang.php | 75 +++ .../modules/Vendors/language/zh_cn.lang.php | 52 ++ .../trunk/modules/Vendors/updateRelations.php | 51 ++ 27 files changed, 1963 insertions(+) create mode 100644 oss/vtiger/trunk/modules/Vendors/CallRelatedList.php create mode 100644 oss/vtiger/trunk/modules/Vendors/CustomView.php create mode 100644 oss/vtiger/trunk/modules/Vendors/Delete.php create mode 100644 oss/vtiger/trunk/modules/Vendors/DetailView.php create mode 100644 oss/vtiger/trunk/modules/Vendors/DetailViewAjax.php create mode 100644 oss/vtiger/trunk/modules/Vendors/EditView.php create mode 100644 oss/vtiger/trunk/modules/Vendors/ExportRecords.php create mode 100644 oss/vtiger/trunk/modules/Vendors/FindDuplicateRecords.php create mode 100644 oss/vtiger/trunk/modules/Vendors/Import.php create mode 100644 oss/vtiger/trunk/modules/Vendors/ListView.php create mode 100644 oss/vtiger/trunk/modules/Vendors/ListViewPagging.php create mode 100644 oss/vtiger/trunk/modules/Vendors/MassEdit.php create mode 100644 oss/vtiger/trunk/modules/Vendors/MassEditSave.php create mode 100644 oss/vtiger/trunk/modules/Vendors/Popup.php create mode 100644 oss/vtiger/trunk/modules/Vendors/ProcessDuplicates.php create mode 100644 oss/vtiger/trunk/modules/Vendors/QuickCreate.php create mode 100644 oss/vtiger/trunk/modules/Vendors/Save.php create mode 100644 oss/vtiger/trunk/modules/Vendors/Settings.php create mode 100644 oss/vtiger/trunk/modules/Vendors/TagCloud.php create mode 100644 oss/vtiger/trunk/modules/Vendors/UnifiedSearch.php create mode 100644 oss/vtiger/trunk/modules/Vendors/Vendors.js create mode 100644 oss/vtiger/trunk/modules/Vendors/Vendors.php create mode 100644 oss/vtiger/trunk/modules/Vendors/VendorsAjax.php create mode 100644 oss/vtiger/trunk/modules/Vendors/index.php create mode 100644 oss/vtiger/trunk/modules/Vendors/language/en_us.lang.php create mode 100644 oss/vtiger/trunk/modules/Vendors/language/zh_cn.lang.php create mode 100644 oss/vtiger/trunk/modules/Vendors/updateRelations.php diff --git a/oss/vtiger/trunk/modules/Vendors/CallRelatedList.php b/oss/vtiger/trunk/modules/Vendors/CallRelatedList.php new file mode 100644 index 00000000..360884d5 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/CallRelatedList.php @@ -0,0 +1,85 @@ +retrieve_entity_info($RECORD,$currentmodule); + $focus->id = $RECORD; + $focus->name=$focus->column_fields['vendorname']; + $log->debug("Vendor id =".$focus->id); + $log->debug("Vendor name =".$focus->name); + } + if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $focus->id = ""; + } + + $related_array=getRelatedLists($currentmodule,$focus); + + global $mod_strings; + global $app_strings; + global $theme, $currentModule; + $theme_path="themes/".$theme."/"; + $image_path=$theme_path."images/"; + + $smarty = new vtigerCRM_Smarty; + + $smarty->assign("CATEGORY",$category); + + if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') { + $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode'])); + } + if(isset($focus->name)) + $smarty->assign("UPDATEINFO",updateInfo($focus->id)); + $smarty->assign("NAME", $focus->name); + $smarty->assign("ID",$focus->id); + + // Module Sequence Numbering + $mod_seq_field = getModuleSequenceField($currentModule); + if ($mod_seq_field != null) { + $mod_seq_id = $focus->column_fields[$mod_seq_field['name']]; + } else { + $mod_seq_id = $focus->id; + } + $smarty->assign('MOD_SEQ_ID', $mod_seq_id); + // END + + $smarty->assign("MODULE",$currentModule); + $smarty->assign("SINGLE_MOD",$app_strings['Vendor']); + $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("MOD",$mod_strings); + $smarty->assign("APP",$app_strings); + $smarty->assign("THEME", $theme); + $smarty->assign("IMAGE_PATH", $image_path); + + $check_button = Button_Check($module); + $smarty->assign("CHECK", $check_button); + $smarty->display("RelatedLists.tpl"); +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/CustomView.php b/oss/vtiger/trunk/modules/Vendors/CustomView.php new file mode 100644 index 00000000..93231ed6 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/CustomView.php @@ -0,0 +1,14 @@ + diff --git a/oss/vtiger/trunk/modules/Vendors/Delete.php b/oss/vtiger/trunk/modules/Vendors/Delete.php new file mode 100644 index 00000000..a2ee6241 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/Delete.php @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/DetailView.php b/oss/vtiger/trunk/modules/Vendors/DetailView.php new file mode 100644 index 00000000..b8850c5b --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/DetailView.php @@ -0,0 +1,119 @@ +retrieve_entity_info($_REQUEST['record'],"Vendors"); + $focus->id = $_REQUEST['record']; + $focus->name = $focus->column_fields['vendorname']; +} + +if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') +{ + $focus->id = ""; +} + +global $app_strings,$mod_strings,$theme,$currentModule,$singlepane_view; + +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; +$smarty = new vtigerCRM_Smarty; +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); + +if(isset($focus->name)) + $smarty->assign("NAME", $focus->name); + +$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields)); + +$smarty->assign("CUSTOMFIELD", $cust_fld); + +if(isPermitted("Vendors","VendorEditView",$_REQUEST['record']) == 'yes') + $smarty->assign("EDIT_DUPLICATE","permitted"); +if(isPermitted("Vendors","DeleteVendor",$_REQUEST['record']) == 'yes') + $smarty->assign("DELETE","permitted"); + + +$category = getParentTab(); +$smarty->assign("CATEGORY",$category); + +$smarty->assign("UPDATEINFO",updateInfo($focus->id)); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path); +$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); +$smarty->assign("ID", vtlib_purify($_REQUEST['record'])); + +// Module Sequence Numbering +$mod_seq_field = getModuleSequenceField($currentModule); +if ($mod_seq_field != null) { + $mod_seq_id = $focus->column_fields[$mod_seq_field['name']]; +} else { + $mod_seq_id = $focus->id; +} +$smarty->assign('MOD_SEQ_ID', $mod_seq_id); +// END + +$smarty->assign("MODULE", $currentModule); +$smarty->assign("SINGLE_MOD", 'Vendor'); + +$check_button = Button_Check($module); +$smarty->assign("CHECK", $check_button); + +$tabid = getTabid("Vendors"); +$validationData = getDBValidationData($focus->tab_name,$tabid); +$data = split_validationdataArray($validationData); +$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']); +$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']); +$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']); +$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record'])); + +$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule)); + +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("SinglePane_View", $singlepane_view); + +if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){ + $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id); + VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id); +} +// Record Change Notification +$focus->markAsViewed($current_user->id); +// END + +// 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("Inventory/InventoryDetailView.tpl"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/DetailViewAjax.php b/oss/vtiger/trunk/modules/Vendors/DetailViewAjax.php new file mode 100644 index 00000000..9e7ddf3d --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/DetailViewAjax.php @@ -0,0 +1,47 @@ +retrieve_entity_info($crmid,"Vendors"); + $modObj->column_fields[$fieldname] = $fieldvalue; + $modObj->id = $crmid; + $modObj->mode = "edit"; + $modObj->save("Vendors"); + 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/Vendors/EditView.php b/oss/vtiger/trunk/modules/Vendors/EditView.php new file mode 100644 index 00000000..d0a1d8df --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/EditView.php @@ -0,0 +1,127 @@ +assign("SEARCH", $searchurl); +//4600 ends + +if(isset($_REQUEST['record']) && $_REQUEST['record'] != '') +{ + $focus->id = $_REQUEST['record']; + $focus->mode = 'edit'; + $focus->retrieve_entity_info($_REQUEST['record'],"Vendors"); + $focus->name = $focus->column_fields['vendorname']; +} +if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') +{ + $focus->id = ""; + $focus->mode = ''; +} +if(empty($_REQUEST['record']) && $focus->mode != 'edit'){ + setObjectValuesFromRequest($focus); +} + +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; + +$disp_view = getView($focus->mode); +if($disp_view == 'edit_view') + $smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields)); +else +{ + $bas_block = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS'); + $adv_block = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'ADV'); + + $blocks['basicTab'] = $bas_block; + if(is_array($adv_block )) + $blocks['moreTab'] = $adv_block; + + $smarty->assign("BLOCKS",$blocks); + $smarty->assign("BLOCKS_COUNT",count($blocks)); +} +$smarty->assign("OP_MODE",$disp_view); + +$smarty->assign("MODULE",$currentModule); +$smarty->assign("SINGLE_MOD",'Vendor'); + +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); + +$smarty->assign("ID", $focus->id); +if(isset($focus->name)) + $smarty->assign("NAME", $focus->name); + +if(isset($cust_fld)) +{ + $smarty->assign("CUSTOMFIELD", $cust_fld); +} + +$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); +$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT'])); +if($focus->mode == 'edit') +{ + $smarty->assign("UPDATEINFO",updateInfo($focus->id)); + $smarty->assign("MODE", $focus->mode); +} + +if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); +if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); +if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id'])); +if(isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname'])); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); + +$tabid = getTabid("Vendors"); +$validationData = getDBValidationData($focus->tab_name,$tabid); +$data = split_validationdataArray($validationData); +$category = getParentTab(); +$smarty->assign("CATEGORY",$category); +$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']); +$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']); +$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']); + +$check_button = Button_Check($module); +$smarty->assign("CHECK", $check_button); +$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate'])); + +global $adb; +// Module Sequence Numbering +$mod_seq_field = getModuleSequenceField($currentModule); +if($focus->mode != 'edit' && $mod_seq_field != null) { + $autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE'); + $mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1",array($currentModule)); + $mod_seq_prefix = $adb->query_result($mod_seq_string,0,'prefix'); + $mod_seq_no = $adb->query_result($mod_seq_string,0,'cur_id'); + if($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix.$mod_seq_no)) + echo '
'. getTranslatedString('LBL_DUPLICATE'). ' '. getTranslatedString($mod_seq_field['label']) + .' - '. getTranslatedString('LBL_CLICK') .' '.getTranslatedString('LBL_HERE').' ' + . getTranslatedString('LBL_TO_CONFIGURE'). ' '. getTranslatedString($mod_seq_field['label']) .''; + else + $smarty->assign("MOD_SEQ_ID",$autostr); +} else { + $smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]); +} +// END + + +if($focus->mode == 'edit') + $smarty->display('Inventory/InventoryEditView.tpl'); +else + $smarty->display('Inventory/InventoryCreateView.tpl'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/ExportRecords.php b/oss/vtiger/trunk/modules/Vendors/ExportRecords.php new file mode 100644 index 00000000..f2714fa3 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/ExportRecords.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Vendors/FindDuplicateRecords.php b/oss/vtiger/trunk/modules/Vendors/FindDuplicateRecords.php new file mode 100644 index 00000000..74ad2c8d --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/FindDuplicateRecords.php @@ -0,0 +1,107 @@ +pquery($sql, array($id)); + DeleteEntity($req_module,$return_module,$focus,$id,""); + } + else { + $ids_list[] = $id; + } +} + if(count($ids_list) > 0) { + $ret = getEntityName($req_module,$ids_list); + if(count($ret) > 0) + { + $errormsg = implode(',',$ret); + } + echo "
"; + echo "
+ + + + + + + + + +
+ $app_strings[LBL_DUP_PERMISSION] $req_module $errormsg
+ $app_strings[LBL_GO_BACK]
+
+
"; + echo "
"; + exit; + } +} + +include("include/saveMergeCriteria.php"); +$ret_arr=getDuplicateRecordsArr($req_module); + +$fld_values=$ret_arr[0]; +$total_num_group=count($fld_values); +$fld_name=$ret_arr[1]; +$ui_type=$ret_arr[2]; + +$smarty->assign("NAVIGATION",$ret_arr["navigation"]);//Added for page navigation +$smarty->assign("MODULE",$req_module); +$smarty->assign("NUM_GROUP",$total_num_group); +$smarty->assign("FIELD_NAMES",$fld_name); +$smarty->assign("CATEGORY",$parenttab); +$smarty->assign("ALL_VALUES",$fld_values); +if(isPermitted($req_module,'Delete','') == 'yes') + $button_del = $app_strings['LBL_MASS_DELETE']; +$smarty->assign("DELETE",$button_del); + +$smarty->assign("MOD", return_module_language($current_language,$req_module)); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("APP", $app_strings); +$smarty->assign("CMOD", $mod_strings); +$smarty->assign("MODE",'view'); +if(isset($_REQUEST['button_view'])) +{ + $smarty->assign("VIEW",'true'); +} +if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') + $smarty->display("FindDuplicateAjax.tpl"); +else + $smarty->display('FindDuplicateDisplay.tpl'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/Import.php b/oss/vtiger/trunk/modules/Vendors/Import.php new file mode 100644 index 00000000..7a1102d4 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/Import.php @@ -0,0 +1,16 @@ + + diff --git a/oss/vtiger/trunk/modules/Vendors/ListView.php b/oss/vtiger/trunk/modules/Vendors/ListView.php new file mode 100644 index 00000000..6da96cc9 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/ListView.php @@ -0,0 +1,243 @@ +assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("MODULE",$currentModule); +$smarty->assign("SINGLE_MOD",'Vendor'); +$category = getParentTab(); +$smarty->assign("CATEGORY",$category); + +$focus = new Vendors(); +// Initialize sort by fields +$focus->initSortbyField('Vendors'); +// END +$other_text = Array(); + +if(!$_SESSION['lvs'][$currentModule]) +{ + unset($_SESSION['lvs']); + $modObj = new ListViewSession(); + $modObj->sorder = $sorder; + $modObj->sortby = $order_by; + $_SESSION['lvs'][$currentModule] = get_object_vars($modObj); +} + +if($_REQUEST['errormsg'] != '') +{ + $errormsg = vtlib_purify($_REQUEST['errormsg']); + $smarty->assign("ERROR","The User does not have permission to delete ".$errormsg." ".$currentModule); +}else +{ + $smarty->assign("ERROR",""); +} +if (!isset($where)) $where = ""; + +//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> +if($_REQUEST['order_by'] != '') + $order_by = $adb->sql_escape_string($_REQUEST['order_by']); +else + $order_by = (($_SESSION['VENDORS_ORDER_BY'] != '')?($_SESSION['VENDORS_ORDER_BY']):($focus->default_order_by)); + +if($_REQUEST['sorder'] != '') + $sorder = $adb->sql_escape_string($_REQUEST['sorder']); +else + $sorder = (($_SESSION['VENDORS_SORT_ORDER'] != '')?($_SESSION['VENDORS_SORT_ORDER']):($focus->default_sort_order)); + +$_SESSION['VENDORS_ORDER_BY'] = $order_by; +$_SESSION['VENDORS_SORT_ORDER'] = $sorder; +//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> + +//<<<>>>>>> +$oCustomView = new CustomView("Vendors"); +$viewid = $oCustomView->getViewId($currentModule); +$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid); +$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid); + +//Added to handle approving or denying status-public by the admin in CustomView +$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']); +$smarty->assign("CUSTOMVIEW_PERMISSION",$statusdetails); + +//To check if a user is able to edit/delete a customview +$edit_permit = $oCustomView->isPermittedCustomView($viewid,'EditView',$currentModule); +$delete_permit = $oCustomView->isPermittedCustomView($viewid,'Delete',$currentModule); +$smarty->assign("CV_EDIT_PERMIT",$edit_permit); +$smarty->assign("CV_DELETE_PERMIT",$delete_permit); + +//<<<<>>>> + +// Buttons and View options +if(isPermitted('Vendors','DeleteVendor','') == 'yes') +{ + $other_text['del'] = $app_strings[LBL_MASS_DELETE]; +} +if(isPermitted('Vendors','EditView','') == 'yes') + $other_text['mass_edit'] = $app_strings[LBL_MASS_EDIT]; + +if($viewnamedesc['viewname'] == 'All') +{ + $smarty->assign("ALL", 'All'); +} +if($viewid ==0) +{ + echo "
"; + echo "
+ + + + + + + + + +
$app_strings[LBL_PERMISSION]
+ $app_strings[LBL_GO_BACK]
+
+
"; + echo "
"; + exit; +} + + +//Retreive the list from Database +//<<<<<<<<>>>>>>>> +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(); +$where = $queryGenerator->getConditionalWhere(); +if(isset($where) && $where != '') { + $_SESSION['export_where'] = $where; +} else { + unset($_SESSION['export_where']); +} + +if(isset($order_by) && $order_by != '') +{ + $tablename = getTableNameForField('Vendors',$order_by); + $tablename = (($tablename != '')?($tablename."."):''); + + if( $adb->dbType == "pgsql") + $list_query .= ' GROUP BY '.$tablename.$order_by; + + $list_query .= ' ORDER BY '.$tablename.$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); + +//Retreive the List View Table Header +if($viewid !='') +$url_string .="&viewname=".$viewid; + +$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 = $controller->getBasicSearchFieldInfoList(); +$smarty->assign("SEARCHLISTHEADER",$listview_header_search); + +$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result, + $navigation_array); +$smarty->assign("LISTENTITY", $listview_entries); + +$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),";")); + +$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html); +$smarty->assign("VIEWID", $viewid); +$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"Vendors","index",$viewid); +$alphabetical = AlphabeticalSearch($currentModule,'index','vendorname','true','basic',"","","","",$viewid); +$fieldnames = $controller->getAdvancedSearchOptionString(); +$criteria = getcriteria_options(); +$smarty->assign("CRITERIA", $criteria); +$smarty->assign("FIELDNAMES", $fieldnames); +$smarty->assign("ALPHABETICAL", $alphabetical); +$smarty->assign("NAVIGATION", $navigationOutput); +$smarty->assign("RECORD_COUNTS", $record_string); +$smarty->assign("BUTTONS", $other_text); + +$check_button = Button_Check($currentModule); +$smarty->assign("CHECK", $check_button); + +ListViewSession::setSessionQuery($currentModule,$list_query,$viewid); + +// 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/Vendors/ListViewPagging.php b/oss/vtiger/trunk/modules/Vendors/ListViewPagging.php new file mode 100644 index 00000000..333f1768 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/ListViewPagging.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/MassEdit.php b/oss/vtiger/trunk/modules/Vendors/MassEdit.php new file mode 100644 index 00000000..348dab37 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/MassEdit.php @@ -0,0 +1,45 @@ +mode = ''; +$mode = 'mass_edit'; +$disp_view = getView($focus->mode); + +$smarty = new vtigerCRM_Smarty; +$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields)); +$smarty->assign("IDS",$_REQUEST['idstring']); +$smarty->assign("MASS_EDIT","1"); +$smarty->assign("MODULE",$currentModule); +$smarty->assign("APP",$app_strings); +$smarty->assign("CATEGORY",getParentTab()); + +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path); + +// Field Validation Information +$tabid = getTabid($currentModule); +$validationData = getDBValidationData($focus->tab_name,$tabid); +$validationArray = split_validationdataArray($validationData); + +$smarty->assign("VALIDATION_DATA_FIELDNAME",$validationArray['fieldname']); +$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$validationArray['datatype']); +$smarty->assign("VALIDATION_DATA_FIELDLABEL",$validationArray['fieldlabel']); + +$smarty->display('MassEditForm.tpl'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/MassEditSave.php b/oss/vtiger/trunk/modules/Vendors/MassEditSave.php new file mode 100644 index 00000000..c587e5fc --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/MassEditSave.php @@ -0,0 +1,68 @@ +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"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/Popup.php b/oss/vtiger/trunk/modules/Vendors/Popup.php new file mode 100644 index 00000000..39b573a1 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/Popup.php @@ -0,0 +1,14 @@ + diff --git a/oss/vtiger/trunk/modules/Vendors/ProcessDuplicates.php b/oss/vtiger/trunk/modules/Vendors/ProcessDuplicates.php new file mode 100644 index 00000000..bb5047fa --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/ProcessDuplicates.php @@ -0,0 +1,134 @@ +pquery("SELECT count(*) AS count FROM vtiger_crmentity WHERE crmid=? and deleted=0", array($merge_id)); + $count = $adb->query_result($result,0,'count'); + + if($count > 0) + { + // First, save the primary record + $focus->mode="edit"; + setObjectValuesFromRequest($focus); + $focus->save($module); + $rec_values=$focus->column_fields; + + // Remove the id of primary record from the list of records to be deleted. + $del_value=explode(",",$recordids,-1); + $offset = array_search($merge_id,$del_value); + unset($del_value[$offset]); + + // Transfer the related lists of the records to be deleted, to the primary record's related list + if(method_exists($focus, 'transferRelatedRecords')){ + $focus->transferRelatedRecords($module,$del_value,$merge_id); + } else { + transferRelatedRecords($module,$del_value,$merge_id); + } + + // Delete the records by id specified in the list + foreach($del_value as $value) + { + DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$value,""); + } + } + + ?> + +assign("EDIT_DUPLICATE",""); + if($record_count == 2) { + if(isPermitted($currentModule,"EditView",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"EditView",$exploded_id[1]) == 'yes' + && isPermitted($currentModule,"Delete",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"Delete",$exploded_id[1]) == 'yes') + $smarty->assign("EDIT_DUPLICATE","permitted"); + } + else { + if(isPermitted($currentModule,"EditView",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"EditView",$exploded_id[1]) == 'yes' && isPermitted($currentModule,"EditView",$exploded_id[2]) == 'yes' + && isPermitted($currentModule,"Delete",$exploded_id[0]) == 'yes' && isPermitted($currentModule,"Delete",$exploded_id[1]) == 'yes' && isPermitted($currentModule,"Delete",$exploded_id[2]) == 'yes') + $smarty->assign("EDIT_DUPLICATE","permitted"); + } + + $all_values_array=getRecordValues($exploded_id,$module); + $all_values=$all_values_array[0]; + $js_arr_val=$all_values_array[1]; + $fld_array=$all_values_array[2]; + $js_arr=implode(",",$js_arr_val); + + $imported_records = Array(); + $sql="select bean_id from vtiger_users_last_import where bean_type=? and deleted=0"; + $result = $adb->pquery($sql, array($module)); + $num_rows=$adb->num_rows($result); + $count=0; + for($i=0; $i<$num_rows;$i++) + { + foreach($exploded_id as $value) + if($value == $adb->query_result($result,$i,"bean_id")) + $count++; + array_push($imported_records,$adb->query_result($result,$i,"bean_id")); + } + + if ($record_count == $count) + $no_existing=1; + else + $no_existing=0; + + $smarty->assign("MOD", $mod_strings); + $smarty->assign("APP", $app_strings); + $smarty->assign("RECORD_COUNT",$record_count); + $smarty->assign("THEME", $theme); + $smarty->assign("IMAGE_PATH", $image_path); + $smarty->assign("MODULENAME", $module); + $smarty->assign("PARENT_TAB", $parent_tab); + $smarty->assign("JS_ARRAY", $js_arr); + $smarty->assign("ID_ARRAY", $exploded_id); + $smarty->assign("IDSTRING",$idstring); + $smarty->assign("ALLVALUES", $all_values); + $smarty->assign("FIELD_ARRAY", $fld_array); + $smarty->assign("IMPORTED_RECORDS", $imported_records); + $smarty->assign("NO_EXISTING", $no_existing); + $smarty->display("MergeFields.tpl"); +} + +?> diff --git a/oss/vtiger/trunk/modules/Vendors/QuickCreate.php b/oss/vtiger/trunk/modules/Vendors/QuickCreate.php new file mode 100644 index 00000000..8d5998b8 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/QuickCreate.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Vendors/Save.php b/oss/vtiger/trunk/modules/Vendors/Save.php new file mode 100644 index 00000000..694801b3 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/Save.php @@ -0,0 +1,53 @@ +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("Vendors"); +$return_id = $focus->id; + +if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']); +else $return_module = "Vendors"; +if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = vtlib_purify($_REQUEST['return_action']); +else $return_action = "DetailView"; +if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = vtlib_purify($_REQUEST['return_id']); + +//code added for returning back to the current view after edit from list view +if($_REQUEST['return_viewname'] == '') $return_viewname='0'; +if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']); + +header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&viewname=$return_viewname&smodule=VENDOR&start=".vtlib_purify($_REQUEST['pagenumber']).$search); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/Settings.php b/oss/vtiger/trunk/modules/Vendors/Settings.php new file mode 100644 index 00000000..980dd078 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/Settings.php @@ -0,0 +1,13 @@ + diff --git a/oss/vtiger/trunk/modules/Vendors/TagCloud.php b/oss/vtiger/trunk/modules/Vendors/TagCloud.php new file mode 100644 index 00000000..859b11ff --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/TagCloud.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Vendors/UnifiedSearch.php b/oss/vtiger/trunk/modules/Vendors/UnifiedSearch.php new file mode 100644 index 00000000..9a37320c --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/UnifiedSearch.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Vendors/Vendors.js b/oss/vtiger/trunk/modules/Vendors/Vendors.js new file mode 100644 index 00000000..be3122d8 --- /dev/null +++ b/oss/vtiger/trunk/modules/Vendors/Vendors.js @@ -0,0 +1,72 @@ +/********************************************************************************* +** The contents of this file are subject to the vtiger CRM Public License Version 1.0 + * ("License"); You may not use this file except in compliance with the License + * The Original Code is: vtiger CRM Open Source + * The Initial Developer of the Original Code is vtiger. + * Portions created by vtiger are Copyright (C) vtiger. + * All Rights Reserved. + * + ********************************************************************************/ +document.write("