From 7466fd6da13c44bae540f68774a730a32a5fd0d6 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Wed, 17 Nov 2010 02:05:15 +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@643 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../Services/AddServiceToPriceBooks.php | 168 +++ .../Services/AddServicesToPriceBook.php | 185 +++ .../modules/Services/CallRelatedList.php | 86 ++ .../trunk/modules/Services/CustomView.php | 12 + oss/vtiger/trunk/modules/Services/Delete.php | 31 + .../Services/DeletePriceBookServiceRel.php | 30 + .../trunk/modules/Services/DetailView.php | 124 ++ .../trunk/modules/Services/DetailViewAjax.php | 41 + .../trunk/modules/Services/EditListPrice.php | 72 ++ .../trunk/modules/Services/EditView.php | 182 +++ .../trunk/modules/Services/ExportRecords.php | 12 + .../modules/Services/FindDuplicateRecords.php | 106 ++ oss/vtiger/trunk/modules/Services/Import.php | 12 + .../modules/Services/InventoryPriceAjax.php | 36 + .../modules/Services/InventoryTaxAjax.php | 68 + .../trunk/modules/Services/ListView.php | 212 ++++ .../modules/Services/ListViewPagging.php | 11 + .../trunk/modules/Services/MassEdit.php | 44 + .../trunk/modules/Services/MassEditSave.php | 58 + oss/vtiger/trunk/modules/Services/Popup.php | 11 + .../modules/Services/ProcessDuplicates.php | 134 ++ .../trunk/modules/Services/QuickCreate.php | 11 + oss/vtiger/trunk/modules/Services/Save.php | 59 + oss/vtiger/trunk/modules/Services/Services.js | 341 +++++ .../trunk/modules/Services/Services.php | 1113 +++++++++++++++++ .../trunk/modules/Services/ServicesAjax.php | 11 + .../trunk/modules/Services/Servicesslide.js | 103 ++ .../trunk/modules/Services/Settings.php | 13 + .../trunk/modules/Services/TagCloud.php | 11 + .../trunk/modules/Services/UnifiedSearch.php | 11 + .../modules/Services/UpdateListPrice.php | 24 + .../modules/Services/addPbServiceRelToDB.php | 63 + oss/vtiger/trunk/modules/Services/index.php | 15 + .../modules/Services/language/en_us.lang.php | 65 + .../modules/Services/language/zh_cn.lang.php | 76 ++ .../trunk/modules/Services/multifile.js | 173 +++ .../trunk/modules/Services/placeholder.gif | Bin 0 -> 80 bytes oss/vtiger/trunk/modules/Services/schema.xml | 36 + .../modules/Services/updateRelations.php | 48 + 39 files changed, 3808 insertions(+) create mode 100644 oss/vtiger/trunk/modules/Services/AddServiceToPriceBooks.php create mode 100644 oss/vtiger/trunk/modules/Services/AddServicesToPriceBook.php create mode 100644 oss/vtiger/trunk/modules/Services/CallRelatedList.php create mode 100644 oss/vtiger/trunk/modules/Services/CustomView.php create mode 100644 oss/vtiger/trunk/modules/Services/Delete.php create mode 100644 oss/vtiger/trunk/modules/Services/DeletePriceBookServiceRel.php create mode 100644 oss/vtiger/trunk/modules/Services/DetailView.php create mode 100644 oss/vtiger/trunk/modules/Services/DetailViewAjax.php create mode 100644 oss/vtiger/trunk/modules/Services/EditListPrice.php create mode 100644 oss/vtiger/trunk/modules/Services/EditView.php create mode 100644 oss/vtiger/trunk/modules/Services/ExportRecords.php create mode 100644 oss/vtiger/trunk/modules/Services/FindDuplicateRecords.php create mode 100644 oss/vtiger/trunk/modules/Services/Import.php create mode 100644 oss/vtiger/trunk/modules/Services/InventoryPriceAjax.php create mode 100644 oss/vtiger/trunk/modules/Services/InventoryTaxAjax.php create mode 100644 oss/vtiger/trunk/modules/Services/ListView.php create mode 100644 oss/vtiger/trunk/modules/Services/ListViewPagging.php create mode 100644 oss/vtiger/trunk/modules/Services/MassEdit.php create mode 100644 oss/vtiger/trunk/modules/Services/MassEditSave.php create mode 100644 oss/vtiger/trunk/modules/Services/Popup.php create mode 100644 oss/vtiger/trunk/modules/Services/ProcessDuplicates.php create mode 100644 oss/vtiger/trunk/modules/Services/QuickCreate.php create mode 100644 oss/vtiger/trunk/modules/Services/Save.php create mode 100644 oss/vtiger/trunk/modules/Services/Services.js create mode 100644 oss/vtiger/trunk/modules/Services/Services.php create mode 100644 oss/vtiger/trunk/modules/Services/ServicesAjax.php create mode 100644 oss/vtiger/trunk/modules/Services/Servicesslide.js create mode 100644 oss/vtiger/trunk/modules/Services/Settings.php create mode 100644 oss/vtiger/trunk/modules/Services/TagCloud.php create mode 100644 oss/vtiger/trunk/modules/Services/UnifiedSearch.php create mode 100644 oss/vtiger/trunk/modules/Services/UpdateListPrice.php create mode 100644 oss/vtiger/trunk/modules/Services/addPbServiceRelToDB.php create mode 100644 oss/vtiger/trunk/modules/Services/index.php create mode 100644 oss/vtiger/trunk/modules/Services/language/en_us.lang.php create mode 100644 oss/vtiger/trunk/modules/Services/language/zh_cn.lang.php create mode 100644 oss/vtiger/trunk/modules/Services/multifile.js create mode 100644 oss/vtiger/trunk/modules/Services/placeholder.gif create mode 100644 oss/vtiger/trunk/modules/Services/schema.xml create mode 100644 oss/vtiger/trunk/modules/Services/updateRelations.php diff --git a/oss/vtiger/trunk/modules/Services/AddServiceToPriceBooks.php b/oss/vtiger/trunk/modules/Services/AddServiceToPriceBooks.php new file mode 100644 index 00000000..06f43edd --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/AddServiceToPriceBooks.php @@ -0,0 +1,168 @@ +id,'unit_price') != '0'){ + echo ""; + echo "
"; + echo "
+ + + + + + + + + +
$app_strings[LBL_UNIT_PRICE_NOT_PERMITTED]
+ $app_strings[LBL_GO_BACK]
+
"; + echo "
"; + exit(); +} + +$smarty=new vtigerCRM_Smarty; + +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); +$smarty->assign("IMAGE_PATH",$image_path); + +$focus = new PriceBooks(); + +//Retreive the list of PriceBooks +$list_query = getListQuery("PriceBooks"); + +$list_query .= ' and vtiger_pricebook.active<>0 ORDER BY pricebookid DESC '; + +$list_result = $adb->query($list_query); +$num_rows = $adb->num_rows($list_result); + +$record_string= "Total No of PriceBooks : ".$num_rows; + +//Retreiving the array of already releated products +$sql1="select vtiger_crmentity.crmid, vtiger_pricebookproductrel.pricebookid,vtiger_service.unit_price + from vtiger_pricebookproductrel inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_pricebookproductrel.productid + inner join vtiger_service on vtiger_service.serviceid=vtiger_pricebookproductrel.productid + where vtiger_crmentity.deleted=0 and vtiger_pricebookproductrel.productid=?"; +$res1 = $adb->pquery($sql1, array($productid)); +$num_prod_rows = $adb->num_rows($res1); +$pbk_array = Array(); +for($i=0; $i<$num_prod_rows; $i++) +{ + $pbkid=$adb->query_result($res1,$i,"pricebookid"); + $pbk_array[$pbkid] = $pbkid; +} + +$pro_unit_price = getUnitPrice($productid, $currentModule); +$prod_price_details = getPriceDetailsForProduct($productid, $pro_unit_price, 'available', $currentModule); + +$prod_cur_price = array(); +for($i=0; $i + + '; + + //we should not display the Add to PriceBook button if there is no pricebooks to associate + if($num_rows != $num_prod_rows) + $other_text .=' '; + +$other_text .=''; +$other_text .=' + + '; + +$smarty->assign("PRICEBOOKLISTHEADER", get_form_header($current_module_strings['LBL_LIST_PRICEBOOK_FORM_TITLE'], $other_text, false )); + + +//List View Table Header +$list_header = ''; +$list_header .= ''; +$list_header .=''; +$list_header .= ''.$mod_strings['LBL_PRICEBOOK'].''; +$list_header .= ''.$app_strings['LBL_CURRENCY'].''; +$list_header .= ''.$mod_strings['LBL_PRODUCT_UNIT_PRICE'].''; +$list_header .= ''.$mod_strings['LBL_PB_LIST_PRICE'].''; +$list_header .= ''; + +$smarty->assign("LISTHEADER", $list_header); + +$list_body =''; +for($i=0; $i<$num_rows; $i++) +{ + $entity_id = $adb->query_result($list_result,$i,"crmid"); + if(! array_key_exists($entity_id, $pbk_array)) + { + $pk_currency_id = $adb->query_result($list_result,$i,"currency_id"); + $pk_currency_name = $adb->query_result($list_result,$i,"currency_name"); + $unit_price = $prod_cur_price[$pk_currency_id]; + $field_name = $entity_id."_listprice"; + $unit_price_array[]="'".$unit_price."'"; + $field_name_array[]="'".$field_name."'"; + + $list_body .= ''; + $list_body .= ''; + $list_body .= ''.$adb->query_result($list_result,$i,"bookname").''; + $list_body .= ''.$pk_currency_name.''; + $list_body .= ''.$unit_price.''; + + $list_body .=''; + if(isPermitted("PriceBooks","EditView","") == 'yes') + $list_body .= ''; + else + $list_body .= ''; + $list_body .= ''; + } + +} + +$smarty->assign("UNIT_PRICE_ARRAY",implode(",",$unit_price_array)); +$smarty->assign("FIELD_NAME_ARRAY",implode(",",$field_name_array)); + +if($order_by !='') + $url_string .="&order_by=".$order_by; +if($sorder !='') + $url_string .="&sorder=".$sorder; + +$smarty->assign("LISTENTITY", $list_body); +$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); +$smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); +$smarty->assign("RETURN_ID", $productid); +$smarty->assign("CATEGORY", $parenttab); + +$smarty->display("AddProductToPriceBooks.tpl"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/AddServicesToPriceBook.php b/oss/vtiger/trunk/modules/Services/AddServicesToPriceBook.php new file mode 100644 index 00000000..4e41fce4 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/AddServicesToPriceBook.php @@ -0,0 +1,185 @@ +id); +$parenttab = htmlspecialchars($_REQUEST['parenttab'],ENT_QUOTES,$default_charset); + +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; +require_once($theme_path.'layout_utils.php'); + +if(getFieldVisibilityPermission('Services',$current_user->id,'unit_price') != '0'){ + echo ""; + echo "
"; + echo "
+ + + + + + + + + +
$app_strings[LBL_UNIT_PRICE_NOT_PERMITTED]
+ $app_strings[LBL_GO_BACK]
+
"; + echo "
"; + exit(); +} + +$pricebookname = getPriceBookName($pricebook_id); + +$smarty= new vtigerCRM_Smarty; +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); +$smarty->assign("IMAGE_PATH",$image_path); + +$focus = new Services(); + +if (isset($_REQUEST['order_by'])) + $order_by = $adb->sql_escape_string($_REQUEST['order_by']); + +$url_string = ''; // assigning http url string +$sorder = 'ASC'; // Default sort order +if(isset($_REQUEST['sorder']) && $_REQUEST['sorder'] != '') + $sorder = $adb->sql_escape_string($_REQUEST['sorder']); + + +//Retreive the list of Services +$list_query = getListQuery("Services"); + +if(isset($order_by) && $order_by != '') +{ + $list_query .= ' and vtiger_service.discontinued<>0 ORDER BY '.$order_by.' '.$sorder; +} + +$list_query .= " and vtiger_service.discontinued<>0 group by vtiger_crmentity.crmid"; +$list_result = $adb->query($list_query); +$num_rows = $adb->num_rows($list_result); + +$record_string= "Total No of Service Available : ".$num_rows; + +//Retreiving the array of already releated services +$sql1 = "select productid as serviceid from vtiger_pricebookproductrel + INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_pricebookproductrel.productid + WHERE vtiger_crmentity.setype='Services' AND vtiger_crmentity.deleted=0 AND pricebookid=?"; +$res1 = $adb->pquery($sql1, array($pricebook_id)); +$num_prod_rows = $adb->num_rows($res1); +$prod_array = Array(); +for($i=0; $i<$num_prod_rows; $i++) +{ + $prodid=$adb->query_result($res1,$i,"serviceid"); + $prod_array[$prodid] = $prodid; +} + + +//Buttons Add To PriceBook and Cancel +$other_text = ' + + + + '; + +$other_text .=' + +
  + + + + '; + + //we should not display the Add to PriceBook button if there is no services to associate + if($num_rows != $num_prod_rows && $num_rows > 0) + $other_text .=''; + +$other_text .=' 
'; + +$smarty->assign("PRODUCTLISTHEADER", get_form_header($current_module_strings['LBL_LIST_FORM_TITLE'], $other_text, false )); + +//Retreive the List View Table Header + +$list_header = ''; +$list_header .= ''; +$list_header .=''; +$list_header .= ''.$mod_strings['LBL_LIST_SERVICE_NAME'].''; +if(getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') + $list_header .= ''.$mod_strings['LBL_SERVICE_UNIT_PRICE'].''; +$list_header .= ''.$mod_strings['LBL_PB_LIST_PRICE'].''; +$list_header .= ''; + +$smarty->assign("LISTHEADER", $list_header); + + +//if the service is not associated already then we should display that services +$new_prod_array = array(); +$unit_price_array=array(); +$field_name_array=array(); +$entity_id_array =array(); +for($i=0; $i<$num_rows; $i++) +{ + $entity_id = $adb->query_result($list_result,$i,"crmid"); + if(! array_key_exists($entity_id, $prod_array)) + { + $new_prod_array[] = $entity_id; + } + $entity_id_array[$entity_id] = $i; +} +$prod_price_list = getPricesForProducts($currency_id, $new_prod_array, 'Services'); + +$list_body =''; +for($i=0; $iinfo("Services :: Showing the List of services to be added in price book"); + $entity_id = $new_prod_array[$i]; + + $list_body .= ''; + $unit_price = $prod_price_list[$entity_id]; + $field_name = $entity_id."_listprice"; + $unit_price_array[]="'".$unit_price."'"; + $field_name_array[]="'".$field_name."'"; + + $list_body .= ''; + $list_body .= ''.$adb->query_result($list_result,$entity_id_array[$entity_id],"servicename").''; + + if(getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') + $list_body .= ''.$unit_price.''; + + $list_body .=''; + if(isPermitted("PriceBooks","EditView","") == 'yes') + $list_body .= ''; + else + $list_body .= ''; + $list_body .= ''; +} + +$smarty->assign("UNIT_PRICE_ARRAY",implode(",",$unit_price_array)); +$smarty->assign("FIELD_NAME_ARRAY",implode(",",$field_name_array)); + +if($order_by !='') + $url_string .="&order_by=".$order_by; +if($sorder !='') + $url_string .="&sorder=".$sorder; + +$smarty->assign("LISTENTITY", $list_body); +$smarty->assign("CATEGORY", $parenttab); + +$smarty->display("AddProductsToPriceBook.tpl"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/CallRelatedList.php b/oss/vtiger/trunk/modules/Services/CallRelatedList.php new file mode 100644 index 00000000..1870430b --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/CallRelatedList.php @@ -0,0 +1,86 @@ +retrieve_entity_info($record, $currentModule); + $focus->id = $record; + $service_base_currency = getProductBaseCurrency($focus->id,$currentModule); + } else { + $service_base_currency = fetchCurrency($current_user->id); + } + + $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)); + + $smarty->assign("CURRENCY_ID",$service_base_currency); + + // 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/Services/CustomView.php b/oss/vtiger/trunk/modules/Services/CustomView.php new file mode 100644 index 00000000..aebb8b53 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/CustomView.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Services/Delete.php b/oss/vtiger/trunk/modules/Services/Delete.php new file mode 100644 index 00000000..83411bbd --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/Delete.php @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/DeletePriceBookServiceRel.php b/oss/vtiger/trunk/modules/Services/DeletePriceBookServiceRel.php new file mode 100644 index 00000000..7b18d1aa --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/DeletePriceBookServiceRel.php @@ -0,0 +1,30 @@ +info("Products :: Deleting Price Book - Delete from PriceBook RelatedList"); + $query = "delete from vtiger_pricebookproductrel where pricebookid=? and productid=?"; + $adb->pquery($query, array($return_id, $record)); +} else { + $log->info("Products :: Deleting Price Book"); + $query = "delete from vtiger_pricebookproductrel where pricebookid=? and productid=?"; + $adb->pquery($query, array($record, $return_id)); +} + +header("Location: index.php?module=".$return_module."&action=".$return_module. + "Ajax&file=$return_action&ajax=true&record=".$return_id); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/DetailView.php b/oss/vtiger/trunk/modules/Services/DetailView.php new file mode 100644 index 00000000..22b1e030 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/DetailView.php @@ -0,0 +1,124 @@ +id = $record; + $focus->retrieve_entity_info($record, $currentModule); +} +if($isduplicate == 'true') $focus->id = ''; + +// 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', '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 + +//Added to display the Tax informations +$tax_details = getTaxDetailsForProduct($focus->id); + +for($i=0;$iid); +} +$smarty->assign("TAX_DETAILS", $tax_details); + +$price_details = getPriceDetailsForProduct($focus->id, $focus->unit_price, 'available_associated',$currentModule); +$smarty->assign("PRICE_DETAILS", $price_details); + +$smarty->assign('IS_REL_LIST',isPresentRelatedLists($currentModule)); + +$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); +} + +if(isPermitted($currentModule, 'EditView', $record) == 'yes') + $smarty->assign('EDIT_DUPLICATE', 'permitted'); +if(isPermitted($currentModule, 'Delete', $record) == 'yes') + $smarty->assign('DELETE', 'permitted'); + +$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', true)); + +$smarty->display("Inventory/InventoryDetailView.tpl"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/DetailViewAjax.php b/oss/vtiger/trunk/modules/Services/DetailViewAjax.php new file mode 100644 index 00000000..87b466bd --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/DetailViewAjax.php @@ -0,0 +1,41 @@ +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/Services/EditListPrice.php b/oss/vtiger/trunk/modules/Services/EditListPrice.php new file mode 100644 index 00000000..6cb9eb75 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/EditListPrice.php @@ -0,0 +1,72 @@ + + + + + + + + + + + + +
'.$mod_strings["LBL_EDITLISTPRICE"].''.$app_strings[
+ + + + +
+ + + + + +
'.$mod_strings["LBL_EDITLISTPRICE"].'
+
+ + + + +
+ + +
+ +'; + +echo $output; + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/EditView.php b/oss/vtiger/trunk/modules/Services/EditView.php new file mode 100644 index 00000000..fa582e25 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/EditView.php @@ -0,0 +1,182 @@ +assign("SEARCH", $searchurl); +//4600 ends + +if($record) { + $focus->id = $record; + $focus->mode = 'edit'; + $focus->retrieve_entity_info($record, $currentModule); + $service_base_currency = getProductBaseCurrency($focus->id,$currentModule); +} else { + $service_base_currency = fetchCurrency($current_user->id); +} + +if($isduplicate == 'true') { + $focus->id = ''; + $focus->mode = ''; +} +if(empty($_REQUEST['record']) && $focus->mode != 'edit'){ + setObjectValuesFromRequest($focus); +} + +//needed when creating a new service with a default vtiger_vendor name to passed +if (isset($_REQUEST['name']) && is_null($focus->name)) { + $focus->name = $_REQUEST['name']; +} + +$disp_view = getView($focus->mode); +if($disp_view == 'edit_view') { + $smarty->assign('BLOCKS', getBlocks($currentModule, $disp_view, $focus->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('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 + +//Tax handling (get the available taxes only) - starts +if($focus->mode == 'edit') +{ + $retrieve_taxes = true; + $serviceid = $focus->id; + $tax_details = getTaxDetailsForProduct($serviceid,'available_associated'); +} +elseif($_REQUEST['isDuplicate'] == 'true') +{ + $retrieve_taxes = true; + $serviceid = $_REQUEST['record']; + $tax_details = getTaxDetailsForProduct($serviceid,'available_associated'); +} +else { + $tax_details = getAllTaxes('available'); + $smarty->assign("PROD_MODE", "create"); +} + +for($i=0;$iassign("TAX_DETAILS", $tax_details); +//Tax handling - ends + +$unit_price = $focus->column_fields['unit_price']; +$price_details = getPriceDetailsForProduct($serviceid, $unit_price, 'available',$currentModule); +$smarty->assign("PRICE_DETAILS", $price_details); + +$base_currency = 'curname' . $service_base_currency; +$smarty->assign("BASE_CURRENCY", $base_currency); + +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/Services/ExportRecords.php b/oss/vtiger/trunk/modules/Services/ExportRecords.php new file mode 100644 index 00000000..31029bc0 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/ExportRecords.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Services/FindDuplicateRecords.php b/oss/vtiger/trunk/modules/Services/FindDuplicateRecords.php new file mode 100644 index 00000000..b1a36b7b --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/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/Services/Import.php b/oss/vtiger/trunk/modules/Services/Import.php new file mode 100644 index 00000000..576068f5 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/Import.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Services/InventoryPriceAjax.php b/oss/vtiger/trunk/modules/Services/InventoryPriceAjax.php new file mode 100644 index 00000000..0da43c2b --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/InventoryPriceAjax.php @@ -0,0 +1,36 @@ + 0) { + $product_prices = getPricesForProducts($currencyid, $product_ids); +} + +// To get the Price Values in the same order as the Products +for ($i=0;$i diff --git a/oss/vtiger/trunk/modules/Services/InventoryTaxAjax.php b/oss/vtiger/trunk/modules/Services/InventoryTaxAjax.php new file mode 100644 index 00000000..8401ad8f --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/InventoryTaxAjax.php @@ -0,0 +1,68 @@ + + + '.$app_strings['LABEL_SET_TAX_FOR'].' : '.$product_total.' +   + + + '; + +$net_tax_total = 0.00; +for($i=0,$j=$i+1;$i % + + + '.$tax_label.' + + + + + '; +} + +$tax_div .= ''; + +if($associated_tax_count == 0) +{ + $tax_div .= '
'.$mod_strings['LBL_NO_TAXES_ASSOCIATED'].'.
'; +} + +$tax_div .= ''; + +echo $tax_div; + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/ListView.php b/oss/vtiger/trunk/modules/Services/ListView.php new file mode 100644 index 00000000..703e4aff --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/ListView.php @@ -0,0 +1,212 @@ +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', true); + +$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(); +$where = $queryGenerator->getConditionalWhere(); +if(isset($where) && $where != '') { + $_SESSION['export_where'] = $where; +} else { + unset($_SESSION['export_where']); +} + +// Sorting +if(!empty($order_by)) { + if($order_by == 'smownerid') $list_query .= ' ORDER BY user_name '.$sorder; + else { + $tablename = getTableNameForField($currentModule, $order_by); + $tablename = ($tablename != '')? ($tablename . '.') : ''; + $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); + +$smarty->assign("CUSTOMVIEW_OPTION",$customview_html); + +$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); +$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result, + $navigation_array); +$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),";")); +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'); + +?> diff --git a/oss/vtiger/trunk/modules/Services/ListViewPagging.php b/oss/vtiger/trunk/modules/Services/ListViewPagging.php new file mode 100644 index 00000000..333f1768 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/ListViewPagging.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Services/MassEdit.php b/oss/vtiger/trunk/modules/Services/MassEdit.php new file mode 100644 index 00000000..7aad35e5 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/MassEdit.php @@ -0,0 +1,44 @@ +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,'',$focus->non_mass_edit_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/Services/MassEditSave.php b/oss/vtiger/trunk/modules/Services/MassEditSave.php new file mode 100644 index 00000000..0e92858e --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/MassEditSave.php @@ -0,0 +1,58 @@ +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(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/Services/Popup.php b/oss/vtiger/trunk/modules/Services/Popup.php new file mode 100644 index 00000000..40aae3fa --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/Popup.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/Services/ProcessDuplicates.php b/oss/vtiger/trunk/modules/Services/ProcessDuplicates.php new file mode 100644 index 00000000..bb5047fa --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/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/Services/QuickCreate.php b/oss/vtiger/trunk/modules/Services/QuickCreate.php new file mode 100644 index 00000000..78fe10f6 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/QuickCreate.php @@ -0,0 +1,11 @@ + diff --git a/oss/vtiger/trunk/modules/Services/Save.php b/oss/vtiger/trunk/modules/Services/Save.php new file mode 100644 index 00000000..14e736d5 --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/Save.php @@ -0,0 +1,59 @@ +mode = $mode; +if($record)$focus->id = $record; + +$currencyid=fetchCurrency($current_user->id); +$rate_symbol = getCurrencySymbolandCRate($currencyid); +$rate = $rate_symbol['rate']; + +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']); +} + +if(isset($_REQUEST['activity_mode'])) $return_action .= '&activity_mode='.vtlib_purify($_REQUEST['activity_mode']); + +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/Services/Services.js b/oss/vtiger/trunk/modules/Services/Services.js new file mode 100644 index 00000000..5c93c85c --- /dev/null +++ b/oss/vtiger/trunk/modules/Services/Services.js @@ -0,0 +1,341 @@ +/*+********************************************************************************** + * 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("