function getListFiledOfModule($moduleName, $relID = false) { $db = PearDatabase::getInstance(); $tabid = getTabid($moduleName); $sql = "select `fieldid`, `fieldlabel`, `uitype`, `block` from vtiger_field where tabid = ? AND presence <> ? AND typeofdata <> ? AND `block` NOT IN (?)"; $result = $db->pquery($sql, array($tabid, 1, 'P~M', 0)); $output = array(); $block = ['blockId' => '', 'blockLabel' => '']; for ($i = 0; $i < $db->num_rows($result); $i++) { $blockid = $db->query_result($result, $i, 'block'); if ($block['blockId'] != $blockid) { $block['blockId'] = $blockid; $block['blockLabel'] = getBlockName($blockid); } if ($relID) { $id = $db->query_result($result, $i, 'fieldid') . '||' . $relID; } else { $id = $db->query_result($result, $i, 'fieldid'); } $output[$blockid][$i]['label'] = vtranslate($db->query_result($result, $i, 'fieldlabel'), $moduleName); $output[$blockid][$i]['id'] = $id; $output[$blockid][$i]['uitype'] = $db->query_result($result, $i, 'uitype'); $output[$blockid]['blockLabel'] = vtranslate($block['blockLabel'], $moduleName); } return $output; }
function fixGetColumnsListbyBlockForInventory($module, $blockid, &$module_columnlist) { global $log; $blockname = getBlockName($blockid); if ($blockname == 'LBL_RELATED_PRODUCTS' && ($module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Quotes' || $module == 'Invoice')) { $fieldtablename = 'vtiger_inventoryproductrel'; $fields = array('productid' => getTranslatedString('Product Name', $module), 'serviceid' => getTranslatedString('Service Name', $module), 'listprice' => getTranslatedString('List Price', $module), 'discount_amount' => getTranslatedString('Discount', $module), 'quantity' => getTranslatedString('Quantity', $module), 'comment' => getTranslatedString('Comments', $module)); $fields_datatype = array('productid' => 'V', 'serviceid' => 'V', 'listprice' => 'I', 'discount_amount' => 'I', 'quantity' => 'I', 'comment' => 'V'); foreach ($fields as $fieldcolname => $label) { $column_name = str_replace(' ', '__', $label); $fieldtypeofdata = $fields_datatype[$fieldcolname]; $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "__" . $column_name . ":" . $fieldcolname . ":" . $fieldtypeofdata; $module_columnlist[$optionvalue] = $label; } } $log->info("Reports :: FieldColumns->Successfully returned ColumnslistbyBlock" . $module . $block); return $module_columnlist; }
/** Function to get vtiger_fields for the given module and block * This function gets the vtiger_fields for the given module * It accepts the module and the block as arguments and * returns the array column lists * Array module_columnlist[ vtiger_fieldtablename:fieldcolname:module_fieldlabel1:fieldname:fieldtypeofdata]=fieldlabel */ function getColumnsListbyBlock($module, $block) { global $adb, $log, $current_user; if (is_string($block)) { $block = explode(",", $block); } $skipTalbes = array('vtiger_emaildetails', 'vtiger_attachments'); $tabid = getTabid($module); if ($module == 'Calendar') { $tabid = array('9', '16'); } $params = array($tabid, $block); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; //Security Check if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) { $sql = "select * from vtiger_field where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_field.presence in (0,2) AND tablename NOT IN (" . generateQuestionMarks($skipTalbes) . ") "; //fix for Ticket #4016 if ($module == "Calendar") { $sql .= " group by vtiger_field.fieldlabel order by sequence"; } else { $sql .= " order by sequence"; } } else { $profileList = getCurrentUserProfileList(); $sql = "select * from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_field.presence in (0,2)"; if (count($profileList) > 0) { $sql .= " and vtiger_profile2field.profileid in (" . generateQuestionMarks($profileList) . ")"; array_push($params, $profileList); } $sql .= ' and tablename NOT IN (' . generateQuestionMarks($skipTalbes) . ') '; //fix for Ticket #4016 if ($module == "Calendar") { $sql .= " group by vtiger_field.fieldlabel order by sequence"; } else { $sql .= " group by vtiger_field.fieldid order by sequence"; } } array_push($params, $skipTalbes); $module_columnlist = array(); $result = $adb->pquery($sql, $params); $noofrows = $adb->num_rows($result); for ($i = 0; $i < $noofrows; $i++) { $fieldtablename = $adb->query_result($result, $i, "tablename"); $fieldcolname = $adb->query_result($result, $i, "columnname"); $fieldname = $adb->query_result($result, $i, "fieldname"); $fieldtype = $adb->query_result($result, $i, "typeofdata"); $uitype = $adb->query_result($result, $i, "uitype"); $fieldtype = explode("~", $fieldtype); $fieldtypeofdata = $fieldtype[0]; $blockid = $adb->query_result($result, $i, "block"); //Here we Changing the displaytype of the field. So that its criteria will be displayed correctly in Reports Advance Filter. $fieldtypeofdata = ChangeTypeOfData_Filter($fieldtablename, $fieldcolname, $fieldtypeofdata); if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } if ($fieldtablename == "vtiger_crmentity") { $fieldtablename = $fieldtablename . $module; } if ($fieldname == "assigned_user_id") { $fieldtablename = "vtiger_users" . $module; $fieldcolname = "user_name"; } if ($fieldname == "assigned_user_id1") { $fieldtablename = "vtiger_usersRel1"; $fieldcolname = "user_name"; } $fieldlabel = $adb->query_result($result, $i, "fieldlabel"); if ($module == 'Emails' and $fieldlabel == 'Date & Time Sent') { $fieldlabel = 'Date Sent'; $fieldtypeofdata = 'D'; } $fieldlabel1 = str_replace(' ', '_', $fieldlabel); $fieldlabel1 = ReportRun::replaceSpecialChar($fieldlabel1); $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $fieldlabel1 . ":" . $fieldname . ":" . $fieldtypeofdata; $this->adv_rel_fields[$fieldtypeofdata][] = '$' . $module . '#' . $fieldname . '$' . "::" . getTranslatedString($module, $module) . " " . getTranslatedString($fieldlabel, $module); $module_columnlist[$optionvalue] = $fieldlabel; } $blockname = getBlockName($block); if ($blockname == 'LBL_RELATED_PRODUCTS' && in_array($module, getInventoryModules())) { $fieldtablename = 'vtiger_inventoryproductrel'; $fields = array('productid' => getTranslatedString('Product Name', $module), 'serviceid' => getTranslatedString('Service Name', $module), 'listprice' => getTranslatedString('List Price', $module), 'discount' => getTranslatedString('Discount', $module), 'quantity' => getTranslatedString('Quantity', $module), 'comment' => getTranslatedString('Comments', $module)); $fields_datatype = array('productid' => 'V', 'serviceid' => 'V', 'listprice' => 'N', 'discount' => 'N', 'quantity' => 'N', 'comment' => 'V'); foreach ($fields as $fieldcolname => $label) { $fieldtypeofdata = $fields_datatype[$fieldcolname]; if ($fieldcolname != 'productid' || $fieldcolname != 'serviceid') { $optionvalue = $fieldtablename . $module . ":" . $fieldcolname . ":" . $module . "_" . $label . ":" . $fieldcolname . ":" . $fieldtypeofdata; } else { $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $label . ":" . $fieldcolname . ":" . $fieldtypeofdata; } $module_columnlist[$optionvalue] = $label; } } $log->info("Reports :: FieldColumns->Successfully returned ColumnslistbyBlock" . $module . $block); return $module_columnlist; }
public function getBlockName() { if (empty($this->blockName)) { $this->blockName = getBlockName($this->blockId); } return $this->blockName; }
public static function getMainModuleFields($moduleName) { $db = PearDatabase::getInstance(); if (is_array($moduleName)) { $moduleName = $moduleName['moduleName']; } elseif (strpos($moduleName, '+') !== false) { $moduleName = explode('+', $moduleName)[1]; } $tabId = getTabid($moduleName); $query = 'SELECT `fieldid`, `fieldlabel`, `fieldname`, `uitype`, `block` FROM `vtiger_field` WHERE `tabid` = ? AND `presence` != ? AND `typeofdata` != ? AND `block` NOT IN (?) ORDER BY block,sequence;'; $result = $db->pquery($query, [$tabId, 1, 'P~M', 0]); $output = []; $currentBlockId = ''; $currentBlockName = ''; $i = 0; while ($row = $db->fetchByAssoc($result)) { if ($currentBlockId != $row['block']) { $currentBlockName = vtranslate(getBlockName($row['block']), $moduleName); } $currentBlockId = $row['block']; $output[$currentBlockName][$i]['label'] = vtranslate($row['fieldlabel'], $moduleName); $output[$currentBlockName][$i]['id'] = $row['fieldid']; $output[$currentBlockName][$i]['name'] = $row['fieldname']; $output[$currentBlockName][$i]['uitype'] = $row['uitype']; $i++; } return $output; }
if (count($arr) < 3) { break; } $lines = explode(",", $arr[2]); foreach ($lines as $key => $value) { $lines[$key] = base64_decode($value); } $fdata = implode("<br />", $lines); break; case 23: case 24: $arr = explode("x ", $fdata); //Separate the quantity from the item/block number $item = explode(":", $arr[1]); //Separate the damage value from the item/block $changeString = $arr[0] . "x " . getBlockName($item[0]); //String is now "quantity"x "blockname" if ($item[1] != "0") { $changeString = $changeString . ":" . $item[1]; } //If item has a damage value other than 0, add it to changeString $fdata = $changeString; break; } $action = str_replace(array_reverse(array_keys($lang["actions"])), array_reverse($lang["actions"]), $action); //Add to output row array_push($row, $entry->data_id, $entry->timestamp, $players[$entry->player_id], $action, $worlds[$entry->world_id], round($entry->x, 1) . "," . round($entry->y, 1) . "," . round($entry->z, 1), $fdata); array_push($output["data"], $row); } echo json_encode($output); /*
/** Function to get vtiger_fields for the given module and block * This function gets the vtiger_fields for the given module * It accepts the module and the block as arguments and * returns the array column lists * Array module_columnlist[ vtiger_fieldtablename:fieldcolname:module_fieldlabel1:fieldname:fieldtypeofdata]=fieldlabel */ function getColumnsListbyBlock($module, $block) { global $adb; global $log; global $current_user; if (is_string($block)) { $block = explode(",", $block); } $tabid = getTabid($module); if ($module == 'Calendar') { $tabid = array('9', '16'); } $params = array($tabid, $block); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; //Security Check if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) { $sql = "select * from vtiger_field where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_field.presence in (0,2) "; //fix for Ticket #4016 if ($module == "Calendar") { $sql .= " group by vtiger_field.fieldlabel order by sequence"; } else { $sql .= " order by sequence"; } } else { $profileList = getCurrentUserProfileList(); $sql = "select * from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_field.presence in (0,2)"; if (count($profileList) > 0) { $sql .= " and vtiger_profile2field.profileid in (" . generateQuestionMarks($profileList) . ")"; array_push($params, $profileList); } //fix for Ticket #4016 if ($module == "Calendar") { $sql .= " group by vtiger_field.fieldid,vtiger_field.fieldlabel order by sequence"; } else { $sql .= " group by vtiger_field.fieldid order by sequence"; } } $result = $adb->pquery($sql, $params); $noofrows = $adb->num_rows($result); for ($i = 0; $i < $noofrows; $i++) { $fieldtablename = $adb->query_result($result, $i, "tablename"); $fieldcolname = $adb->query_result($result, $i, "columnname"); $fieldname = $adb->query_result($result, $i, "fieldname"); $fieldtype = $adb->query_result($result, $i, "typeofdata"); $uitype = $adb->query_result($result, $i, "uitype"); $fieldtype = explode("~", $fieldtype); $fieldtypeofdata = $fieldtype[0]; //Here we Changing the displaytype of the field. So that its criteria will be displayed correctly in Reports Advance Filter. $fieldtypeofdata = ChangeTypeOfData_Filter($fieldtablename, $fieldcolname, $fieldtypeofdata); if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } if ($fieldtablename == "vtiger_crmentity") { $fieldtablename = $fieldtablename . $module; } if ($fieldname == "assigned_user_id") { $fieldtablename = "vtiger_users" . $module; $fieldcolname = "user_name"; } if ($fieldname == "account_id") { $fieldtablename = "vtiger_account" . $module; $fieldcolname = "accountname"; } if ($fieldname == "contact_id") { $fieldtablename = "vtiger_contactdetails" . $module; $fieldcolname = "lastname"; } if ($fieldname == "parent_id") { $fieldtablename = "vtiger_crmentityRel" . $module; $fieldcolname = "setype"; } if ($fieldname == "vendor_id") { $fieldtablename = "vtiger_vendorRel" . $module; $fieldcolname = "vendorname"; } if ($fieldname == "potential_id") { $fieldtablename = "vtiger_potentialRel" . $module; $fieldcolname = "potentialname"; } if ($fieldname == "assigned_user_id1") { $fieldtablename = "vtiger_usersRel1"; $fieldcolname = "user_name"; } if ($fieldname == 'quote_id') { $fieldtablename = "vtiger_quotes" . $module; $fieldcolname = "subject"; } $product_id_tables = array("vtiger_troubletickets" => "vtiger_productsRel", "vtiger_campaign" => "vtiger_productsCampaigns", "vtiger_faq" => "vtiger_productsFaq"); if ($fieldname == 'product_id' && isset($product_id_tables[$fieldtablename])) { $fieldtablename = $product_id_tables[$fieldtablename]; $fieldcolname = "productname"; } if ($fieldname == 'campaignid' && $module == 'Potentials') { $fieldtablename = "vtiger_campaign" . $module; $fieldcolname = "campaignname"; } if ($fieldname == 'currency_id' && $fieldtablename == 'vtiger_pricebook') { $fieldtablename = "vtiger_currency_info" . $module; $fieldcolname = "currency_name"; } $fieldlabel = $adb->query_result($result, $i, "fieldlabel"); $fieldlabel1 = str_replace(" ", "_", $fieldlabel); $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $fieldlabel1 . ":" . $fieldname . ":" . $fieldtypeofdata; $this->adv_rel_fields[$fieldtypeofdata][] = '$' . $module . '#' . $fieldname . '$' . "::" . getTranslatedString($module, $module) . " " . $fieldlabel; //added to escape attachments fields in Reports as we have multiple attachments if ($module != 'HelpDesk' || $fieldname != 'filename') { $module_columnlist[$optionvalue] = $fieldlabel; } } $blockname = getBlockName($block); if ($blockname == 'LBL_RELATED_PRODUCTS' && ($module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Quotes' || $module == 'Invoice')) { $fieldtablename = 'vtiger_inventoryproductrel'; $fields = array('productid' => getTranslatedString('Product Name', $module), 'serviceid' => getTranslatedString('Service Name', $module), 'listprice' => getTranslatedString('List Price', $module), 'discount' => getTranslatedString('Discount', $module), 'quantity' => getTranslatedString('Quantity', $module), 'comment' => getTranslatedString('Comments', $module)); $fields_datatype = array('productid' => 'V', 'serviceid' => 'V', 'listprice' => 'I', 'discount' => 'I', 'quantity' => 'I', 'comment' => 'V'); foreach ($fields as $fieldcolname => $label) { $fieldtypeofdata = $fields_datatype[$fieldcolname]; $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $label . ":" . $fieldcolname . ":" . $fieldtypeofdata; $module_columnlist[$optionvalue] = $label; } } $log->info("Reports :: FieldColumns->Successfully returned ColumnslistbyBlock" . $module . $block); return $module_columnlist; }
/** Function to get vtiger_fields for the given module and block * This function gets the vtiger_fields for the given module * It accepts the module and the block as arguments and * returns the array column lists * Array module_columnlist[ vtiger_fieldtablename:fieldcolname:module_fieldlabel1:fieldname:fieldtypeofdata]=fieldlabel */ function getColumnsListbyBlock($module, $block, $relfieldid = "") { $r4u_columnlist_name = ITS4YouReports::getITS4YouReportStoreName($module, $block); $r4u_rel_fields_name = ITS4YouReports::getITS4YouReportStoreName("adv_rel_fields"); $r4u_sel_fields_name = ITS4YouReports::getITS4YouReportStoreName("adv_sel_fields"); unset($_SESSION[$r4u_columnlist_name]); unset($_SESSION[$r4u_rel_fields_name]); unset($_SESSION[$r4u_sel_fields_name]); //return false; if ($r4u_columnlist_name != "" && isset($_SESSION[$r4u_columnlist_name]) && !empty($_SESSION[$r4u_columnlist_name])) { $module_columnlist = unserialize($_SESSION[$r4u_columnlist_name]); $this->adv_rel_fields = unserialize($_SESSION[$r4u_rel_fields_name]); $this->adv_sel_fields = unserialize($_SESSION[$r4u_sel_fields_name]); return $module_columnlist; } else { unset($_SESSION[$r4u_columnlist_name]); //unset($_SESSION[$r4u_rel_fields_name]); //unset($_SESSION[$r4u_sel_fields_name]); $adb = PearDatabase::getInstance(); if (is_string($block)) { $block = explode(",", $block); } $tabid = getTabid($module); if ($module == 'Calendar') { $tabid = array('9', '16'); } $params = array($tabid, $block); $user_privileges_path = 'user_privileges/user_privileges_' . $this->current_user->id . '.php'; if (file_exists($user_privileges_path)) { require $user_privileges_path; } //Security Check if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) { $sql = "select * from vtiger_field where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_field.presence in (0,2) "; //fix for Ticket #4016 if ($module == "Calendar") { $sql .= " group by vtiger_field.fieldlabel order by sequence"; } else { $sql .= " order by sequence"; } } else { $profileList = getCurrentUserProfileList(); $sql = "select * from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_field.presence in (0,2)"; if (count($profileList) > 0) { $sql .= " and vtiger_profile2field.profileid in (" . generateQuestionMarks($profileList) . ")"; array_push($params, $profileList); } //fix for Ticket #4016 if ($module == "Calendar") { $sql .= " group by vtiger_field.fieldid,vtiger_field.fieldlabel order by sequence"; } else { $sql .= " group by vtiger_field.fieldid order by sequence"; } } //$adb->setDebug(true); $f_result = $adb->pquery($sql, $params); //$adb->setDebug(false); $noofrows = $adb->num_rows($f_result); $lead_converted_added = false; for ($i = 0; $i < $noofrows; $i++) { //$_SESSION_r4u_rel_fields = unserialize($_SESSION[$r4u_rel_fields_name]); //$_SESSION_r4u_sel_fields = unserialize($_SESSION[$r4u_sel_fields_name]); $fieldid = $adb->query_result($f_result, $i, "fieldid"); // ITS4YOU-UP SlOl 1. 10. 2013 10:46:35 $fieldtablename = $adb->query_result($f_result, $i, "tablename"); if ($this->primarymodule != $module) { $fieldtablename = $fieldtablename; if ($relfieldid != "") { $fieldtablename .= "_{$relfieldid}"; } } $fieldcolname = $adb->query_result($f_result, $i, "columnname"); $fieldname = $adb->query_result($f_result, $i, "fieldname"); $fieldtype = $adb->query_result($f_result, $i, "typeofdata"); $uitype = $adb->query_result($f_result, $i, "uitype"); $fieldtype = explode("~", $fieldtype); // Fix to get table alias for orderby and groupby sql /* if ($relfieldid == "" && in_array($uitype, array("10",))) { $relfieldid = $fieldid; } */ $fieldtypeofdata = $fieldtype[0]; //Here we Changing the displaytype of the field. So that its criteria will be displayed correctly in Reports Advance Filter. $fieldtypeofdata = ChangeTypeOfData_Filter($fieldtablename, $fieldcolname, $fieldtypeofdata); if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } $fieldlabel = $adb->query_result($f_result, $i, "fieldlabel"); $fieldlabel1 = $fieldlabel; if ($relfieldid != "") { $relfieldid_str = $relfieldid; } // this is defining module id for uitype 10 if ($relfieldid != "" && $this->primarymodule != $module) { $rel_field_row = $adb->fetchByAssoc($adb->pquery("SELECT uitype FROM vtiger_field WHERE fieldid = ? ", array($relfieldid)), 0); $rel_field_uitype = $rel_field_row["uitype"]; if ($rel_field_uitype == 10) { $relfieldid_str = getTabid($module) . ":" . $relfieldid; } } $module_lbl = vtranslate($module, $module); $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $fieldlabel1 . ":" . $fieldname . ":" . $fieldtypeofdata . ($relfieldid != "" ? ":" . $relfieldid_str : ""); // $optionvalue = $fieldtablename.":".$fieldcolname.":".$module."_".$fieldlabel1.":".$fieldname.":".$fieldtypeofdata; $adv_rel_field_val = '$' . $module . '#' . $fieldname . '$' . "::" . $module_lbl . " " . $fieldlabel; $this->adv_rel_fields[$fieldtypeofdata][] = $adv_rel_field_val; // ITS4YOU-CR SlOl 26. 3. 2014 10:57:41 if (in_array($uitype, ITS4YouReports::$s_uitypes) && !array_key_exists($optionvalue, $this->adv_sel_fields) && !in_array($module, array("Users"))) { $this->adv_sel_fields[$optionvalue] = true; } // ITS4YOU-END 26. 3. 2014 10:57:44 $translate_module = $module; //added to escape attachments fields in Reports as we have multiple attachments if ($module != 'HelpDesk' || $fieldname != 'filename') { $module_columnlist[$optionvalue] = vtranslate($fieldlabel, $translate_module); } // ITS4YOU-CR SlOl - IS CONVERTED FIELD FOR LEADS if ($module == "Leads" && $block == 13 && $i == $noofrows - 1 && $lead_converted_added != true) { $sc_col_str = "vtiger_leaddetails:converted:" . $module . "_Converted:converted:C"; $this->adv_sel_fields[$sc_col_str] = true; $lead_converted_added = true; $module_columnlist[$sc_col_str] = vtranslate("Converted", $module); } // CONVERTED END unset($_SESSION[$r4u_rel_fields_name]); $_SESSION[$r4u_rel_fields_name] = serialize($this->adv_rel_fields); unset($_SESSION[$r4u_sel_fields_name]); $_SESSION[$r4u_sel_fields_name] = serialize($this->adv_sel_fields); } $blockname = getBlockName($block); if ($blockname == 'LBL_RELATED_PRODUCTS' && in_array($module, self::$inventory_modules)) { if ($relfieldid != "") { $rel_field_row = $adb->fetchByAssoc($adb->pquery("SELECT uitype FROM vtiger_field WHERE fieldid = ? ", array($relfieldid)), 0); $rel_field_uitype = $rel_field_row["uitype"]; if ($rel_field_uitype == 10) { $relfieldid_str = ":" . getTabid($module) . ":" . $relfieldid; } else { $relfieldid_str = ":" . $relfieldid; } } $fieldtablename = 'vtiger_inventoryproductrel'; if ($relfieldid != "") { $fieldtablename .= "_{$relfieldid}"; } $fields = array('prodname' => $module_lbl . " " . vtranslate('LBL_PRODUCT_SERVICE_NAME', $this->currentModule), 'ps_productcategory' => $module_lbl . " " . vtranslate('LBL_ITEM_CATEGORY', $this->currentModule), 'ps_productno' => $module_lbl . " " . vtranslate('LBL_ITEM_NO', $this->currentModule), 'comment' => $module_lbl . " " . vtranslate('Comments', $module), 'quantity' => $module_lbl . " " . vtranslate('Quantity', $module), 'listprice' => $module_lbl . " " . vtranslate('List Price', $module), 'ps_producttotal' => $module_lbl . " " . vtranslate('LBL_PRODUCT_TOTAL', $this->currentModule), 'discount' => $module_lbl . " " . vtranslate('Discount', $module), 'ps_productstotalafterdiscount' => $module_lbl . " " . vtranslate('LBL_PRODUCTTOTALAFTERDISCOUNT', $this->currentModule), 'ps_productvatsum' => $module_lbl . " " . vtranslate('LBL_PRODUCT_VAT_SUM', $this->currentModule), 'ps_producttotalsum' => $module_lbl . " " . vtranslate('LBL_PRODUCT_TOTAL_VAT', $this->currentModule)); $fields_datatype = array('prodname' => 'V', 'ps_productcategory' => 'V', 'ps_productno' => 'V', 'comment' => 'V', 'prodname' => 'V', 'quantity' => 'I', 'listprice' => 'I', 'ps_producttotal' => 'I', 'discount' => 'I', 'ps_productstotalafterdiscount' => 'I', 'ps_productvatsum' => 'I', 'ps_producttotalsum' => 'I'); $module_lbl = vtranslate($module, $module); foreach ($fields as $fieldcolname => $label) { $fieldtypeofdata = $fields_datatype[$fieldcolname]; $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $label . ":" . $fieldcolname . ":" . $fieldtypeofdata . $relfieldid_str; $module_columnlist[$optionvalue] = $label; // $module_lbl." ". } } $_SESSION[$r4u_columnlist_name] = serialize($module_columnlist); return $module_columnlist; } }
function getFieldListbyBlock($module, $block, $type) { global $adb; global $log; global $current_user; if (is_string($block)) { $block = explode(",", $block); } $tabid = getTabid($module, $this->dbname); if ($module == 'Calendar') { $tabid = array('9', '16'); } $params = array($tabid, $block); $sql = "select * from {$this->dbname}.vtiger_field where vtiger_field.tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.block in (" . generateQuestionMarks($block) . ") and vtiger_field.displaytype in (1,2,3) and vtiger_field.presence in (0,2) "; $result = $adb->pquery($sql, $params); $pmod = getTabModuleName($this->primodule, $this->dbname); $noofrows = $adb->num_rows($result); for ($i = 0; $i < $noofrows; $i++) { $fieldtablename = $adb->query_result($result, $i, "tablename"); $fieldcolname = $adb->query_result($result, $i, "columnname"); $fieldname = $adb->query_result($result, $i, "fieldname"); $fieldtype = $adb->query_result($result, $i, "typeofdata"); $uitype = $adb->query_result($result, $i, "uitype"); $fieldid = $adb->query_result($result, $i, "fieldid"); $fieldtype = explode("~", $fieldtype); $fieldtypeofdata = $fieldtype[0]; if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } if ($fieldtablename == "vtiger_crmentity") { $fieldtablename = $fieldtablename . $module; } if ($fieldname == "assigned_user_id") { $fieldtablename = "vtiger_users" . $module; $fieldcolname = "user_name"; } if ($fieldname == "assigned_user_id1") { $fieldtablename = "vtiger_usersRel1"; $fieldcolname = "user_name"; } $fieldlabel = $adb->query_result($result, $i, "fieldlabel"); $fieldlabel1 = str_replace(" ", "_", $fieldlabel); if ($type == "related") { $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . ":" . $fieldname . ":" . $fieldid . ":" . $type . ":" . $this->rel_fields->{$pmod}->{$module}; } else { $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . ":" . $fieldname . ":" . $fieldid . ":" . $type; } if ($module != 'HelpDesk' || $fieldname != 'filename') { $module_columnlist[$optionvalue] = $fieldlabel; } } $blockname = getBlockName($block, $this->dbname); if ($blockname == 'LBL_RELATED_PRODUCTS' && ($module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Quotes' || $module == 'Invoice')) { $fieldtablename = 'vtiger_inventoryproductrel'; $fields = array('productid' => getTranslatedString('Product Name', $module), 'serviceid' => getTranslatedString('Service Name', $module), 'listprice' => getTranslatedString('List Price', $module), 'discount' => getTranslatedString('Discount', $module), 'quantity' => getTranslatedString('Quantity', $module), 'comment' => getTranslatedString('Comments', $module)); $fields_datatype = array('productid' => 'V', 'serviceid' => 'V', 'listprice' => 'I', 'discount' => 'I', 'quantity' => 'I', 'comment' => 'V'); foreach ($fields as $fieldcolname => $label) { $fieldtypeofdata = $fields_datatype[$fieldcolname]; if ($type == "related") { $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . ":" . $fieldcolname . ":" . $fieldid . ":" . $type . ":" . $this->rel_fields->{$pmod}->{$module}; } else { $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . ":" . $fieldcolname . ":" . $fieldid . ":" . $type; } $module_columnlist[$optionvalue] = $label; } } $log->info("Map :: FieldColumns->Successfully returned FieldlistbyBlock" . $module . $block); return $module_columnlist; }