/** * Function to get customfield entries * @param string $module - Module name * return array $cflist - customfield entries */ function getFieldListEntries($module) { $tabid = getTabid($module); global $adb, $smarty, $log, $current_user; global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = "themes/images/"; $dbQuery = "select vtiger_blocks.*,vtiger_tab.presence as tabpresence from vtiger_blocks" . " inner join vtiger_tab on vtiger_tab.tabid = vtiger_blocks.tabid" . " where vtiger_blocks.tabid=? and vtiger_tab.presence = 0 order by sequence"; $result = $adb->pquery($dbQuery, array($tabid)); $row = $adb->fetch_array($result); $focus = CRMEntity::getInstance($module); $nonEditableUiTypes = array('4', '70'); // To get reference field names require_once 'include/Webservices/Utils.php'; $handler = vtws_getModuleHandlerFromName($module, $current_user); $meta = $handler->getMeta(); $referenceFieldNames = array_keys($meta->getReferenceFieldDetails()); $cflist = array(); $i = 0; if ($row != '') { do { if ($row["blocklabel"] == 'LBL_CUSTOM_INFORMATION') { $smarty->assign("CUSTOMSECTIONID", $row["blockid"]); } if ($row["blocklabel"] == 'LBL_RELATED_PRODUCTS') { $smarty->assign("RELPRODUCTSECTIONID", $row["blockid"]); } if ($row["blocklabel"] == 'LBL_COMMENTS' || $row['blocklabel'] == 'LBL_COMMENT_INFORMATION') { $smarty->assign("COMMENTSECTIONID", $row["blockid"]); } if ($row['blocklabel'] == 'LBL_TICKET_RESOLUTION') { $smarty->assign("SOLUTIONBLOCKID", $row["blockid"]); } if ($row['blocklabel'] == '') { continue; } $cflist[$i]['tabpresence'] = $row['tabpresence']; $cflist[$i]['module'] = $module; $cflist[$i]['blocklabel'] = getTranslatedString($row["blocklabel"], $module); $cflist[$i]['blockid'] = $row["blockid"]; $cflist[$i]['display_status'] = $row["display_status"]; $cflist[$i]['tabid'] = $tabid; $cflist[$i]['blockselect'] = $row["blockid"]; $cflist[$i]['sequence'] = $row["sequence"]; $cflist[$i]['iscustom'] = $row["iscustom"]; if ($module != 'Invoices' && $module != 'Quotes' && $module != 'SalesOrder' && $module != 'Invoice') { $sql_field = "select * from vtiger_field where block=? and vtiger_field.displaytype IN (1,2,4) order by sequence"; $sql_field_params = array($row["blockid"]); } else { $sql_field = "select * from vtiger_field where block=? and (vtiger_field.fieldlabel!='Total' and vtiger_field.fieldlabel!='Sub Total' and vtiger_field.fieldlabel!='Tax') and vtiger_field.displaytype IN (1,2,4) order by sequence"; $sql_field_params = array($row["blockid"]); } $result_field = $adb->pquery($sql_field, $sql_field_params); $row_field = $adb->fetch_array($result_field); if ($row_field != '') { $cf_element = array(); $cf_hidden_element = array(); $count = 0; $hiddencount = 0; do { $fieldid = $row_field['fieldid']; $presence = $row_field['presence']; $fieldname = $row_field['fieldname']; $customfieldflag = InStrCount($row_field['fieldname'], 'cf_', true); $quickcreate = $row_field['quickcreate']; $massedit = $row_field['masseditable']; $typeofdata = $row_field['typeofdata']; $displaytype = $row_field['displaytype']; $uitype = $row_field['uitype']; $fld_type_name = getCustomFieldTypeName($row_field['uitype']); $defaultValue = $row_field['defaultvalue']; if (!empty($defaultValue) && ($uitype == '5' || $uitype == '6' || $uitype == '23')) { $defaultValue = getValidDisplayDate($defaultValue); } $fieldlabel = getTranslatedString($row_field['fieldlabel'], $module); $defaultPermitted = true; $strictlyMandatory = false; if (isset($focus->mandatory_fields) && !empty($focus->mandatory_fields) && in_array($fieldname, $focus->mandatory_fields)) { $strictlyMandatory = true; $defaultPermitted = false; } elseif (in_array($uitype, $nonEditableUiTypes) || $displaytype == 2) { $strictlyMandatory = true; $defaultPermitted = false; } if (in_array($fieldname, $referenceFieldNames)) { $defaultPermitted = false; } $visibility = getFieldInfo($fieldname, $typeofdata, $quickcreate, $massedit, $presence, $strictlyMandatory, $customfieldflag, $displaytype, $uitype); $allValues = array(); if (in_array($uitype, array('15', '16', '33'))) { $allValues = getAllPickListValues($fieldname); } if ($presence == 0 || $presence == 2) { $cf_element[$count]['fieldselect'] = $fieldid; $cf_element[$count]['blockid'] = $row['blockid']; $cf_element[$count]['tabid'] = $tabid; $cf_element[$count]['no'] = $count; $cf_element[$count]['label'] = $fieldlabel; $cf_element[$count]['fieldlabel'] = $row_field['fieldlabel']; $cf_element[$count]['type'] = $fld_type_name; $cf_element[$count]['typeofdata'] = $typeofdata; $cf_element[$count]['uitype'] = $uitype; $cf_element[$count]['columnname'] = $row_field['columnname']; $cf_element[$count]['defaultvalue'] = array('permitted' => $defaultPermitted, 'value' => $defaultValue, '_allvalues' => $allValues); $cf_element[$count] = array_merge($cf_element[$count], $visibility); $count++; } else { $cf_hidden_element[$hiddencount]['fieldselect'] = $fieldid; $cf_hidden_element[$hiddencount]['blockid'] = $row['blockid']; $cf_hidden_element[$hiddencount]['tabid'] = $tabid; $cf_hidden_element[$hiddencount]['no'] = $hiddencount; $cf_hidden_element[$hiddencount]['label'] = $fieldlabel; $cf_hidden_element[$hiddencount]['fieldlabel'] = $row_field['fieldlabel']; $cf_hidden_element[$hiddencount]['type'] = $fld_type_name; $cf_hidden_element[$hiddencount]['typeofdata'] = $typeofdata; $cf_hidden_element[$hiddencount]['uitype'] = $uitype; $cf_hidden_element[$hiddencount]['columnname'] = $row_field['columnname']; $cf_hidden_element[$hiddencount]['defaultvalue'] = array('permitted' => $defaultPermitted, 'value' => $defaultValue, '_allvalues' => $allValues); $cf_hidden_element[$hiddencount] = array_merge($cf_hidden_element[$hiddencount], $visibility); $hiddencount++; } } while ($row_field = $adb->fetch_array($result_field)); $cflist[$i]['no'] = $count; $cflist[$i]['hidden_count'] = $hiddencount; } else { $cflist[$i]['no'] = 0; } $query_fields_not_in_block = 'select fieldid,fieldlabel,block from vtiger_field ' . 'inner join vtiger_blocks on vtiger_field.block=vtiger_blocks.blockid ' . 'where vtiger_field.block != ? and vtiger_blocks.blocklabel not in ("LBL_TICKET_RESOLUTION","LBL_COMMENTS","LBL_COMMENT_INFORMATION") ' . 'AND vtiger_field.tabid = ? and vtiger_field.displaytype IN (1,2,4) order by vtiger_field.sequence'; $params = array($row['blockid'], $tabid); $fields = $adb->pquery($query_fields_not_in_block, $params); $row_field = $adb->fetch_array($fields); if ($row_field != '') { $movefields = array(); $movefieldcount = 0; do { $movefields[$movefieldcount]['fieldid'] = $row_field['fieldid']; $movefields[$movefieldcount]['fieldlabel'] = getTranslatedString($row_field['fieldlabel'], $module); $movefieldcount++; } while ($row_field = $adb->fetch_array($fields)); $cflist[$i]['movefieldcount'] = $movefieldcount; } else { $cflist[$i]['movefieldcount'] = 0; } $cflist[$i]['field'] = $cf_element; $cflist[$i]['hiddenfield'] = $cf_hidden_element; $cflist[$i]['movefield'] = $movefields; $cflist[$i]['hascustomtable'] = $focus->customFieldTable; unset($cf_element); unset($cf_hidden_element); unset($movefields); $i++; } while ($row = $adb->fetch_array($result)); } return $cflist; }
private function getPickListValues($fieldName) { //Need to decode the picklist values twice which are saved from old ui return array_map('decode_html', getAllPickListValues($fieldName)); }
$smarty = new vtigerCRM_Smarty(); $smarty->assign("IMAGE_PATH", $image_path); $fieldName = vtlib_purify($_REQUEST["fieldname"]); $fieldLabel = vtlib_purify($_REQUEST['fieldlabel']); $moduleName = vtlib_purify($_REQUEST["moduleName"]); $roleid = vtlib_purify($_REQUEST['roleid']); if (!empty($roleid)) { $roleName = getRoleName($roleid); } if ($moduleName == 'Events') { $temp_module_strings = return_module_language($current_language, 'Calendar'); } else { $temp_module_strings = return_module_language($current_language, $moduleName); } if (!empty($fieldName)) { foreach (getAllPickListValues($fieldName, $temp_module_strings) as $key => $value) { $values[$key] = $value; } } foreach (getAssignedPicklistValues($fieldName, $roleid, $adb, $temp_module_strings) as $key => $value) { $assignedValues[$key] = $value; } $smarty->assign("THEME", $theme); $smarty->assign("FIELDNAME", $fieldName); $smarty->assign("FIELDLABEL", getTranslatedString($fieldLabel)); $smarty->assign("MODULE", $moduleName); $smarty->assign("PICKVAL", $values); $smarty->assign("ASSIGNED_VALUES", $assignedValues); $smarty->assign("ROLEID", $roleid); $smarty->assign("ROLENAME", $roleName); $smarty->assign("MOD", return_module_language($current_language, 'PickList'));
function getSalesStageList() { global $adb; require_once 'modules/PickList/PickListUtils.php'; global $adb; $sales_stage_list = array(); if (is_admin($this->current_user)) { $pick_list_values = getAllPickListValues('sales_stage'); } else { $pick_list_values = getAssignedPicklistValues('sales_stage', $this->current_user->roleid, $adb); } foreach ($pick_list_values as $value) { $sales_stage_list[$value]["value"] = $value; } return $sales_stage_list; }
echo $json->encode($picklistValues); } elseif ($subMode == 'editdependency') { $sourceField = vtlib_purify($_REQUEST['sourcefield']); $targetField = vtlib_purify($_REQUEST['targetfield']); $cyclicDependencyExists = Vtiger_DependencyPicklist::checkCyclicDependency($fld_module, $sourceField, $targetField); if ($cyclicDependencyExists) { $smarty->assign('RETURN_URL', 'index.php?module=PickList&action=PickListDependencySetup&parenttab=Settings&moduleName=' . $fld_module); $smarty->display("modules/PickList/PickListDependencyCyclicError.tpl"); } else { $available_module_picklist = Vtiger_DependencyPicklist::getAvailablePicklists($fld_module); $smarty->assign("ALL_LISTS", $available_module_picklist); $dependencyMap = array(); if (!empty($sourceField) && !empty($targetField)) { $sourceFieldValues = array(); $targetFieldValues = getAllPickListValues($targetField); foreach (getAllPickListValues($sourceField) as $key => $value) { $sourceFieldValues[htmlentities($value, ENT_QUOTES, 'UTF-8')] = $value; } $smarty->assign("SOURCE_VALUES", $sourceFieldValues); $smarty->assign("TARGET_VALUES", $targetFieldValues); $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($fld_module); $smarty->assign("DEPENDENT_PICKLISTS", $dependentPicklists); $dependencyMap = Vtiger_DependencyPicklist::getPickListDependency($fld_module, $sourceField, $targetField); } $smarty->assign("DEPENDENCY_MAP", $dependencyMap); $smarty->display("modules/PickList/PickListDependencyContents.tpl"); } } else { if ($subMode == 'savedependency') { $dependencyMapping = vtlib_purify($_REQUEST['dependencymapping']); $json = new Zend_Json();
public function beforeGetTaskform($data) { $wcecbkmkmsx = "data"; ${"GLOBALS"}["eqfxppvrlcg"] = "sql"; ${"GLOBALS"}["sxuujyumdvv"] = "script"; $rvezxijr = "adb"; $uwoefflj = "result"; global $current_user; $lnxjswg = "sql"; $rakhgqmsey = "result"; ${"GLOBALS"}["dhrsrgll"] = "data"; ${$rvezxijr} = \PearDatabase::getInstance(); list(${$wcecbkmkmsx}, ${${"GLOBALS"}["gxggivfo"]}) = ${${"GLOBALS"}["dhrsrgll"]}; ${${"GLOBALS"}["hvlighrh"]} = $this->parameter["fromModule"]; $sbxdhyqvqj = "script"; $qybdsfhc = "sql"; ${${"GLOBALS"}["hpoksfzufvi"]} = $this->parameter["toModule"]; ${${"GLOBALS"}["oyjhbrdojleb"]} = $this->parameter["additionalToFields"]; ${${"GLOBALS"}["ohrkdvokqlbt"]} = !empty($this->parameter["refFields"]) ? true : false; if (${${"GLOBALS"}["hvlighrh"]} === false) { ${${"GLOBALS"}["hvlighrh"]} = ${${"GLOBALS"}["hpoksfzufvi"]}; } ${${"GLOBALS"}["eqfxppvrlcg"]} = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'"; ${"GLOBALS"}["yefvtwdbtg"] = "fields"; ${"GLOBALS"}["roaznbo"] = "result"; ${"GLOBALS"}["hncdfohpf"] = "sql"; $yzltgwdg = "script"; $xobfnidjmu = "result"; ${${"GLOBALS"}["gcfgsatc"]} = $adb->query(${${"GLOBALS"}["txneufzr"]}); ${${"GLOBALS"}["zypsnrvnkiti"]} = $adb->query_result(${${"GLOBALS"}["roaznbo"]}, 0, "id"); ${"GLOBALS"}["gtxvsrw"] = "wsTabId"; ${${"GLOBALS"}["txneufzr"]} = "SELECT id,user_name,first_name,last_name FROM vtiger_users WHERE status = 'Active'"; ${"GLOBALS"}["fsmvqyhawbr"] = "index1"; $xngmezo = "fields"; ${"GLOBALS"}["tywugloncxe"] = "options"; ${${"GLOBALS"}["gcfgsatc"]} = $adb->query(${${"GLOBALS"}["hncdfohpf"]}); ${${"GLOBALS"}["mrugtuu"]} = array("user" => array(), "group" => array()); ${"GLOBALS"}["titxeedu"] = "availUser"; $stljtvxgmshw = "result"; while (${${"GLOBALS"}["yptigqgnbbw"]} = $adb->fetchByAssoc(${$uwoefflj})) { ${"GLOBALS"}["rjiaktga"] = "user"; $xwwbcezkcg = "user"; ${"GLOBALS"}["hjtqjfi"] = "user"; ${${"GLOBALS"}["hjtqjfi"]}["id"] = ${${"GLOBALS"}["rjiaktga"]}["id"]; ${${"GLOBALS"}["mrugtuu"]}["user"][] = ${$xwwbcezkcg}; } ${"GLOBALS"}["xuceoxb"] = "toModule"; ${${"GLOBALS"}["txneufzr"]} = "SELECT id FROM vtiger_ws_entity WHERE name = 'Groups'"; ${$xobfnidjmu} = $adb->query(${$qybdsfhc}); ${${"GLOBALS"}["gtxvsrw"]} = $adb->query_result(${${"GLOBALS"}["gcfgsatc"]}, 0, "id"); $mzhfkmici = "sql"; ${"GLOBALS"}["fqawgodflt"] = "refFields"; ${$lnxjswg} = "SELECT * FROM vtiger_groups ORDER BY groupname"; $wzihhlpcl = "data"; ${$stljtvxgmshw} = $adb->query(${$mzhfkmici}); while (${${"GLOBALS"}["kxxnbbihik"]} = $adb->fetchByAssoc(${$rakhgqmsey})) { $wuctugbbuk = "availUser"; ${"GLOBALS"}["dglkcz"] = "group"; $pdkdlnmwh = "group"; ${${"GLOBALS"}["dglkcz"]}["groupid"] = ${${"GLOBALS"}["kxxnbbihik"]}["groupid"]; ${$wuctugbbuk}["group"][] = ${$pdkdlnmwh}; } $viewer->assign("availUsers", ${${"GLOBALS"}["mrugtuu"]}); ${$xngmezo} = VtUtils::getFieldsWithBlocksForModule(${${"GLOBALS"}["xuceoxb"]}, ${${"GLOBALS"}["fqawgodflt"]} == true ? true : false); if (${${"GLOBALS"}["oyjhbrdojleb"]} !== false) { ${"GLOBALS"}["tnvuuieutqe"] = "fields"; reset(${${"GLOBALS"}["tnvuuieutqe"]}); $jexjswdeqysq = "addField"; ${${"GLOBALS"}["tbwjkww"]} = key(${${"GLOBALS"}["yxsjdkh"]}); foreach (${${"GLOBALS"}["oyjhbrdojleb"]} as ${$jexjswdeqysq}) { $uwpklhsk = "fields"; ${"GLOBALS"}["ouxgywsbfd"] = "addField"; ${"GLOBALS"}["iiedjg"] = "firstKey"; ${$uwpklhsk}[${${"GLOBALS"}["iiedjg"]}][] = ${${"GLOBALS"}["ouxgywsbfd"]}; } } $viewer->assign("fields", ${${"GLOBALS"}["yefvtwdbtg"]}); ${"GLOBALS"}["dbqfvyhyty"] = "script"; $afbxguwxvx = "setter_blocks"; $viewer->assign("fromFields", $this->getFromFields()); ${${"GLOBALS"}["eifgrvstdko"]} = array(); ${${"GLOBALS"}["qjntqv"]} = array(); foreach (${${"GLOBALS"}["yxsjdkh"]} as ${${"GLOBALS"}["fsmvqyhawbr"]} => ${${"GLOBALS"}["esuxyxb"]}) { ${"GLOBALS"}["voyvrmu"] = "block"; $hwxflshrpina = "field"; foreach (${${"GLOBALS"}["voyvrmu"]} as ${${"GLOBALS"}["qvktopqw"]} => ${$hwxflshrpina}) { $bohdzzxeqtf = "blockId"; ${"GLOBALS"}["cdrckm"] = "blockId"; ${${"GLOBALS"}["axgtprtc"]} = !empty($field->block->id) ? $field->block->id : 0; ${"GLOBALS"}["ghimyenlsug"] = "setter_fields"; if ($field->name == "eventstatus") { if ($this->parameter["activityType"] == "Task") { global $current_language; $bfscdk = "language"; ${"GLOBALS"}["ejmqgpjwwyv"] = "language"; ${${"GLOBALS"}["ejmqgpjwwyv"]} = \Vtiger_Language_Handler::getModuleStringsFromFile(${${"GLOBALS"}["yddleyi"]}, "Calendar"); if (empty(${$bfscdk})) { $nplkqgugw = "language"; ${$nplkqgugw} = \Vtiger_Language_Handler::getModuleStringsFromFile("en_us", "Calendar"); } $field->type->picklistValues = getAllPickListValues("taskstatus", ${${"GLOBALS"}["lssuihizyw"]}["languageStrings"]); } } ${${"GLOBALS"}["ghimyenlsug"]}[] = array("type" => $field->type, "name" => $field->name, "label" => $field->label, "blockId" => ${${"GLOBALS"}["cdrckm"]}, "sequence" => $field->sequence); if (!isset(${${"GLOBALS"}["qjntqv"]}["block_" . ${$bohdzzxeqtf}])) { $fodrrj = "blockId"; $ttvkvbxiqr = "toModule"; ${${"GLOBALS"}["qjntqv"]}["block_" . ${$fodrrj}] = array(${${"GLOBALS"}["axgtprtc"]}, getTranslatedString($field->block->label, ${$ttvkvbxiqr})); } } } $viewer->assign("setter_blocks", ${$afbxguwxvx}); $agvhdwtg = "script"; $viewer->assign("setterContent", $viewer->fetch("modules/Settings/Workflow2/helpers/Setter.tpl")); ${${"GLOBALS"}["nbtorrl"]} = $this->parameter; ${${"GLOBALS"}["tnnhuvubw"]} = "var setter_fields = " . json_encode(${${"GLOBALS"}["eifgrvstdko"]}) . ";\n"; ${$sbxdhyqvqj} .= "var setter_values = " . json_encode(${$wzihhlpcl}[$this->field]) . ";\n"; ${${"GLOBALS"}["sxuujyumdvv"]} .= "var available_users = " . json_encode(${${"GLOBALS"}["titxeedu"]}) . ";\n"; ${$yzltgwdg} .= "var WfSetterToModule = '" . ${${"GLOBALS"}["hpoksfzufvi"]} . "';\n"; ${${"GLOBALS"}["tnnhuvubw"]} .= "var WfSetterFromModule = '" . ${${"GLOBALS"}["hvlighrh"]} . "';\n"; ${${"GLOBALS"}["dbqfvyhyty"]} .= "var WfSetterOptions = " . json_encode(${${"GLOBALS"}["tywugloncxe"]}) . ";\n"; ${$agvhdwtg} .= "var availCurrency = " . json_encode(getAllCurrencies()) . ";\n"; ${${"GLOBALS"}["tnnhuvubw"]} .= "var dateFormat = '" . $current_user->date_format . "';\n"; $this->addInlineJS(${${"GLOBALS"}["tnnhuvubw"]}); }
global $adb, $current_user, $app_strings, $current_language, $theme; $smarty = new vtigerCRM_Smarty(); $smarty->assign("IMAGE_PATH", $image_path); $fieldName = vtlib_purify($_REQUEST["fieldname"]); $fieldLabel = vtlib_purify($_REQUEST['fieldlabel']); $moduleName = vtlib_purify($_REQUEST["moduleName"]); $roleid = vtlib_purify($_REQUEST['roleid']); if (!empty($roleid)) { $roleName = getRoleName($roleid); } if ($moduleName == 'Events') { $temp_module_strings = return_module_language($current_language, 'Calendar'); } else { $temp_module_strings = return_module_language($current_language, $moduleName); } if (!empty($fieldName)) { $values = getAllPickListValues($fieldName); } $assignedValues = getAssignedPicklistValues($fieldName, $roleid, $adb); $smarty->assign("THEME", $theme); $smarty->assign("FIELDNAME", $fieldName); $smarty->assign("FIELDLABEL", getTranslatedString($fieldLabel)); $smarty->assign("MODULE", $moduleName); $smarty->assign("PICKVAL", $values); $smarty->assign("ASSIGNED_VALUES", $assignedValues); $smarty->assign("ROLEID", $roleid); $smarty->assign("ROLENAME", $roleName); $smarty->assign("MOD", return_module_language($current_language, 'PickList')); $smarty->assign("APP", $app_strings); $data = $smarty->fetch("modules/PickList/AssignPicklistValues.tpl"); echo $data;
$json = new Zend_Json(); echo $json->encode($picklistValues); } elseif ($subMode == 'editdependency') { $sourceField = vtlib_purify($_REQUEST['sourcefield']); $targetField = vtlib_purify($_REQUEST['targetfield']); $cyclicDependencyExists = Vtiger_DependencyPicklist::checkCyclicDependency($fld_module, $sourceField, $targetField); if ($cyclicDependencyExists) { $smarty->assign('RETURN_URL', 'index.php?module=PickList&action=PickListDependencySetup&parenttab=Settings&moduleName=' . $fld_module); $smarty->display("modules/PickList/PickListDependencyCyclicError.tpl"); } else { $available_module_picklist = Vtiger_DependencyPicklist::getAvailablePicklists($fld_module); $smarty->assign("ALL_LISTS", $available_module_picklist); $dependencyMap = array(); if (!empty($sourceField) && !empty($targetField)) { $sourceFieldValues = getAllPickListValues($sourceField); $targetFieldValues = getAllPickListValues($targetField); $smarty->assign("SOURCE_VALUES", $sourceFieldValues); $smarty->assign("TARGET_VALUES", $targetFieldValues); $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($fld_module); $smarty->assign("DEPENDENT_PICKLISTS", $dependentPicklists); $dependencyMap = Vtiger_DependencyPicklist::getPickListDependency($fld_module, $sourceField, $targetField); } $smarty->assign("DEPENDENCY_MAP", $dependencyMap); $smarty->display("modules/PickList/PickListDependencyContents.tpl"); } } else { if ($subMode == 'savedependency') { $dependencyMapping = vtlib_purify($_REQUEST['dependencymapping']); $json = new Zend_Json(); $dependencyMappingData = $json->decode($dependencyMapping); Vtiger_DependencyPicklist::savePickListDependencies($fld_module, $dependencyMappingData);
public static function getFieldsWithBlocksForModule($module_name, $references = false, $refTemplate = "([source]: ([module]) [destination])") { global $current_language, $adb, $app_strings; \Vtiger_Cache::$cacheEnable = false; $start = microtime(true); if (empty($refTemplate) && $references == true) { $refTemplate = "([source]: ([module]) [destination])"; } //////echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>'; // Fields in this module include_once "vtlib/Vtiger/Module.php"; #$alle = glob(dirname(__FILE__).'/functions/*.inc.php'); #foreach($alle as $datei) { include $datei; } $module = $module_name; $instance = Vtiger_Module::getInstance($module); $blocks = Vtiger_Block::getAllForModule($instance); ////echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>'; if ($module != "Events") { $langModule = $module; } else { $langModule = "Calendar"; } $modLang = return_module_language($current_language, $langModule); //echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>'; $moduleFields = array(); $addReferences = array(); if (is_array($blocks)) { foreach ($blocks as $block) { $fields = Vtiger_Field::getAllForBlock($block, $instance); //echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>'; if (empty($fields) || !is_array($fields)) { continue; } foreach ($fields as $field) { $field->label = getTranslatedString($field->label, $langModule); $field->type = new StdClass(); $field->type->name = self::getFieldTypeName($field->uitype); if ($field->type->name == 'picklist') { $language = \Vtiger_Language_Handler::getModuleStringsFromFile($current_language, $field->block->module->name); if (empty($language)) { $language = \Vtiger_Language_Handler::getModuleStringsFromFile('en_us', $field->block->module->name); } switch ($field->name) { case 'hdnTaxType': $field->type->picklistValues = array('group' => 'Group', 'individual' => 'Individual'); break; case 'email_flag': $field->type->picklistValues = array('SAVED' => 'SAVED', 'SENT' => 'SENT', 'MAILSCANNER' => 'MAILSCANNER'); break; case 'currency_id': $field->type->picklistValues = array(); $currencies = getAllCurrencies(); foreach ($currencies as $currencies) { $field->type->picklistValues[$currencies['currency_id']] = $currencies['currencylabel']; } break; default: $field->type->picklistValues = getAllPickListValues($field->name, $language['languageStrings']); break; } } if (in_array($field->uitype, self::$referenceUitypes)) { $modules = self::getModuleForReference($field->block->module->id, $field->name, $field->uitype); $field->type->refersTo = $modules; } if ($references !== false) { switch ($field->uitype) { case "51": $addReferences[] = array($field, "Accounts"); break; case "52": $addReferences[] = array($field, "Users"); break; case "53": $addReferences[] = array($field, "Users"); break; case "57": $addReferences[] = array($field, "Contacts"); break; case "58": $addReferences[] = array($field, "Campaigns"); break; case "59": $addReferences[] = array($field, "Products"); break; case "73": $addReferences[] = array($field, "Accounts"); break; case "75": $addReferences[] = array($field, "Vendors"); break; case "81": $addReferences[] = array($field, "Vendors"); break; case "76": $addReferences[] = array($field, "Potentials"); break; case "78": $addReferences[] = array($field, "Quotes"); break; case "80": $addReferences[] = array($field, "SalesOrder"); break; case "68": $addReferences[] = array($field, "Accounts"); $addReferences[] = array($field, "Contacts"); break; case "10": # Possibly multiple relations $result = $adb->pquery('SELECT relmodule FROM `vtiger_fieldmodulerel` WHERE fieldid = ?', array($field->id)); while ($data = $adb->fetch_array($result)) { $addReferences[] = array($field, $data["relmodule"]); } break; } } $moduleFields[getTranslatedString($block->label, $langModule)][] = $field; } } $crmid = new StdClass(); $crmid->name = 'crmid'; $crmid->label = 'ID'; $crmid->type = 'string'; reset($moduleFields); $first_key = key($moduleFields); $moduleFields[$first_key] = array_merge(array($crmid), $moduleFields[$first_key]); } //echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>'; $rewriteFields = array("assigned_user_id" => "smownerid"); if ($references !== false) { $field = new StdClass(); $field->name = "current_user"; $field->label = getTranslatedString("LBL_CURRENT_USER", "CloudFile"); $addReferences[] = array($field, "Users"); } if (is_array($addReferences)) { foreach ($addReferences as $refField) { //echo 'C'.__LINE__.': '.round(microtime(true) - $start, 2).'<br/>'; $fields = self::getFieldsForModule($refField[1]); foreach ($fields as $field) { $field->label = "(" . (isset($app_strings[$refField[1]]) ? $app_strings[$refField[1]] : $refField[1]) . ") " . $field->label; if (!empty($rewriteFields[$refField[0]->name])) { $refField[0]->name = $rewriteFields[$refField[0]->name]; } $name = str_replace(array("[source]", "[module]", "[destination]"), array($refField[0]->name, $refField[1], $field->name), $refTemplate); $field->name = $name; $moduleFields["References (" . $refField[0]->label . ")"][] = $field; } } } \Vtiger_Cache::$cacheEnable = true; return $moduleFields; }
public static function getFieldsWithBlocksForModule($module_name, $references = false, $refTemplate = "([source]: ([module]) [destination])", $activityType = 'Event') { ${"GLOBALS"}["gmkxubmgqr"] = "module"; ${"GLOBALS"}["tckseueixvr"] = "start"; ${"GLOBALS"}["nyjbntl"] = "activityType"; global $current_language, $adb, $app_strings; \Vtiger_Cache::${${"GLOBALS"}["xmcqwbwjg"]} = false; ${${"GLOBALS"}["tckseueixvr"]} = microtime(true); if (empty(${${"GLOBALS"}["edetoedh"]}) && ${${"GLOBALS"}["joqrqyq"]} == true) { ${${"GLOBALS"}["edetoedh"]} = "([source]: ([module]) [destination])"; } include_once "vtlib/Vtiger/Module.php"; $ixhjukqo = "blocks"; ${"GLOBALS"}["uwtsvavwe"] = "module_name"; if (${${"GLOBALS"}["luxsvwk"]} == "Calendar" && ${${"GLOBALS"}["nyjbntl"]} == "Task") { $htxexutwez = "module_name"; ${$htxexutwez} = "Events"; } ${"GLOBALS"}["kgthgvdjgye"] = "langModule"; ${"GLOBALS"}["lefzyldkv"] = "rewriteFields"; ${${"GLOBALS"}["dmoyzhsy"]} = ${${"GLOBALS"}["uwtsvavwe"]}; ${${"GLOBALS"}["fqnjxp"]} = Vtiger_Module::getInstance(${${"GLOBALS"}["gmkxubmgqr"]}); ${"GLOBALS"}["cembvymw"] = "moduleFields"; ${$ixhjukqo} = Vtiger_Block::getAllForModule(${${"GLOBALS"}["fqnjxp"]}); if (${${"GLOBALS"}["dmoyzhsy"]} != "Events") { $yurstcpqdq = "langModule"; ${"GLOBALS"}["odbegiygfxd"] = "module"; ${$yurstcpqdq} = ${${"GLOBALS"}["odbegiygfxd"]}; } else { ${${"GLOBALS"}["hfdgvhqkst"]} = "Calendar"; } ${${"GLOBALS"}["odweooain"]} = return_module_language(${${"GLOBALS"}["tlshanufgw"]}, ${${"GLOBALS"}["kgthgvdjgye"]}); ${${"GLOBALS"}["jthlbvy"]} = array(); ${${"GLOBALS"}["kpscbcovfo"]} = array(); ${${"GLOBALS"}["iwqzew"]} = array(); if (is_array(${${"GLOBALS"}["bnieibcdywdw"]})) { ${"GLOBALS"}["xtfdbcuqc"] = "crmid"; $xolbwjrhxv = "first_key"; $pgrvdhpa = "moduleFields"; $zqkmhpowhabu = "blocks"; foreach (${$zqkmhpowhabu} as ${${"GLOBALS"}["crfolbxyozx"]}) { $ujbljy = "fields"; $dzmyfbqqwco = "fields"; ${$ujbljy} = Vtiger_Field::getAllForBlock(${${"GLOBALS"}["crfolbxyozx"]}, ${${"GLOBALS"}["fqnjxp"]}); $dccevwqqnq = "fields"; if (empty(${${"GLOBALS"}["tobmkodw"]}) || !is_array(${$dzmyfbqqwco})) { continue; } foreach (${$dccevwqqnq} as ${${"GLOBALS"}["eswxvskrqln"]}) { $qxwayslw = "field"; $field->label = getTranslatedString($field->label, ${${"GLOBALS"}["hfdgvhqkst"]}); $field->type = new StdClass(); $field->type->name = self::getFieldTypeName($field->uitype); if ($field->type->name == "picklist" || $field->type->name == "multipicklist") { ${"GLOBALS"}["iksvvksq"] = "currencies"; $oddvouy = "currencies"; ${"GLOBALS"}["ljzqlguwfbi"] = "language"; $pmkgbyr = "language"; switch ($field->name) { case "hdnTaxType": $field->type->picklistValues = array("group" => "Group", "individual" => "Individual"); break; case "currency_id": $field->type->picklistValues = array(); ${$oddvouy} = getAllCurrencies(); foreach (${${"GLOBALS"}["sxrrhtqc"]} as ${${"GLOBALS"}["iksvvksq"]}) { ${"GLOBALS"}["qbjjpiyh"] = "currencies"; $field->type->picklistValues[${${"GLOBALS"}["qbjjpiyh"]}["currency_id"]] = ${${"GLOBALS"}["sxrrhtqc"]}["currencylabel"]; } break; default: ${${"GLOBALS"}["ljzqlguwfbi"]} = \Vtiger_Language_Handler::getModuleStringsFromFile(${${"GLOBALS"}["tlshanufgw"]}, $field->block->module->name); if (empty(${$pmkgbyr})) { ${"GLOBALS"}["buzjfrxmswvm"] = "language"; ${${"GLOBALS"}["buzjfrxmswvm"]} = \Vtiger_Language_Handler::getModuleStringsFromFile("en_us", $field->block->module->name); } $field->type->picklistValues = getAllPickListValues($field->name, ${${"GLOBALS"}["fztutztrkj"]}["languageStrings"]); break; } } if ($field->uitype == 26) { $field->type->name = "picklist"; ${"GLOBALS"}["xrxfzxhc"] = "sql"; ${${"GLOBALS"}["xrxfzxhc"]} = "SELECT * FROM vtiger_attachmentsfolder ORDER BY foldername"; ${${"GLOBALS"}["yxurcyqzbn"]} = $adb->query(${${"GLOBALS"}["trhmtwd"]}); $field->type->picklistValues = array(); while (${${"GLOBALS"}["mnxpcyvt"]} = $adb->fetchByAssoc(${${"GLOBALS"}["yxurcyqzbn"]})) { ${"GLOBALS"}["njqgidyefk"] = "row"; $field->type->picklistValues[${${"GLOBALS"}["njqgidyefk"]}["folderid"]] = ${${"GLOBALS"}["mnxpcyvt"]}["foldername"]; } } if (in_array($field->uitype, self::${${"GLOBALS"}["rjqzcd"]})) { ${${"GLOBALS"}["szphwyugr"]} = self::getModuleForReference($field->block->module->id, $field->name, $field->uitype); $field->type->refersTo = ${${"GLOBALS"}["szphwyugr"]}; } if ($field->type->name == "reference") { ${"GLOBALS"}["xejhaonrgfo"] = "field"; $zqrofcrhbmr = "referenceFields"; ${$zqrofcrhbmr}[] = ${${"GLOBALS"}["xejhaonrgfo"]}; } $hmawaqcn = "langModule"; $badccgfkws = "references"; if (${$badccgfkws} !== false) { $hsfvndvp = "addReferences"; ${"GLOBALS"}["xjiagoolbl"] = "addReferences"; $zsvcjvgvzpi = "addReferences"; $hcfjsh = "addReferences"; $qrnywhi = "addReferences"; $ikrxlsms = "addReferences"; ${"GLOBALS"}["wahhwrswkass"] = "addReferences"; ${"GLOBALS"}["jqkkoegemsx"] = "addReferences"; ${"GLOBALS"}["lvdytrgaztu"] = "addReferences"; $zttgnnv = "field"; ${"GLOBALS"}["rchdzecqkwbn"] = "field"; $quunxooexcy = "field"; $xsyuflgxpgdz = "addReferences"; $vfrcqsgkwos = "field"; $yckigulnbsk = "addReferences"; ${"GLOBALS"}["issxnl"] = "field"; ${"GLOBALS"}["fyhpevqw"] = "addReferences"; ${"GLOBALS"}["ypyeok"] = "field"; ${"GLOBALS"}["vfgwlu"] = "field"; ${"GLOBALS"}["tqjctxrneb"] = "field"; $hgnhsyoeuxsi = "field"; switch ($field->uitype) { case "51": ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Accounts"); break; case "52": ${${"GLOBALS"}["xjiagoolbl"]}[] = array(${$vfrcqsgkwos}, "Users"); break; case "53": ${$hsfvndvp}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Users"); break; case "57": ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${${"GLOBALS"}["issxnl"]}, "Contacts"); break; case "58": ${$xsyuflgxpgdz}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Campaigns"); break; case "59": ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Products"); break; case "73": ${${"GLOBALS"}["lvdytrgaztu"]}[] = array(${$hgnhsyoeuxsi}, "Accounts"); break; case "75": ${${"GLOBALS"}["jqkkoegemsx"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Vendors"); break; case "81": ${$hcfjsh}[] = array(${${"GLOBALS"}["tqjctxrneb"]}, "Vendors"); break; case "76": ${$yckigulnbsk}[] = array(${${"GLOBALS"}["vfgwlu"]}, "Potentials"); break; case "78": ${$ikrxlsms}[] = array(${${"GLOBALS"}["rchdzecqkwbn"]}, "Quotes"); break; case "80": ${$qrnywhi}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "SalesOrder"); break; case "66": ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${$zttgnnv}, "Accounts"); ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${$quunxooexcy}, "Leads"); ${$zsvcjvgvzpi}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Potentials"); ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "HelpDesk"); ${${"GLOBALS"}["wahhwrswkass"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Campaigns"); break; case "68": ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, "Accounts"); ${${"GLOBALS"}["fyhpevqw"]}[] = array(${${"GLOBALS"}["ypyeok"]}, "Contacts"); break; case "10": ${${"GLOBALS"}["yxurcyqzbn"]} = \Workflow\VtUtils::pquery("SELECT relmodule FROM `vtiger_fieldmodulerel` WHERE fieldid = ?", array($field->id)); while (${${"GLOBALS"}["rpgtsocbjybb"]} = $adb->fetch_array(${${"GLOBALS"}["yxurcyqzbn"]})) { ${"GLOBALS"}["etvsumie"] = "data"; ${${"GLOBALS"}["kpscbcovfo"]}[] = array(${${"GLOBALS"}["eswxvskrqln"]}, ${${"GLOBALS"}["etvsumie"]}["relmodule"]); } break; } } ${${"GLOBALS"}["jthlbvy"]}[getTranslatedString($block->label, ${$hmawaqcn})][] = ${$qxwayslw}; } } ${"GLOBALS"}["bysquph"] = "InventoryModules"; ${${"GLOBALS"}["xtfdbcuqc"]} = new StdClass(); $crmid->name = "crmid"; $crmid->label = "ID"; $crmid->type = "string"; reset(${${"GLOBALS"}["jthlbvy"]}); ${${"GLOBALS"}["hohxkflr"]} = key(${${"GLOBALS"}["jthlbvy"]}); ${${"GLOBALS"}["jthlbvy"]}[${$xolbwjrhxv}] = array_merge(array(${${"GLOBALS"}["jyctope"]}), ${$pgrvdhpa}[${${"GLOBALS"}["hohxkflr"]}]); if (in_array(${${"GLOBALS"}["dmoyzhsy"]}, self::${${"GLOBALS"}["bysquph"]})) { ${"GLOBALS"}["henyvjuckpi"] = "module"; ${"GLOBALS"}["gxxfsgd"] = "first_key"; ${${"GLOBALS"}["jyctope"]} = new StdClass(); $kpjfmvzmghs = "first_key"; ${"GLOBALS"}["cwnxyjn"] = "moduleFields"; ${"GLOBALS"}["ktmspctvob"] = "crmid"; $crmid->name = "hdnS_H_Amount"; $crmid->label = getTranslatedString("Shipping & Handling Charges", ${${"GLOBALS"}["henyvjuckpi"]}); $crmid->type = "string"; reset(${${"GLOBALS"}["jthlbvy"]}); ${${"GLOBALS"}["hohxkflr"]} = key(${${"GLOBALS"}["jthlbvy"]}); ${${"GLOBALS"}["cwnxyjn"]}[${${"GLOBALS"}["gxxfsgd"]}] = array_merge(${${"GLOBALS"}["jthlbvy"]}[${$kpjfmvzmghs}], array(${${"GLOBALS"}["ktmspctvob"]})); } } ${"GLOBALS"}["upopmkvwurai"] = "addReferences"; ${${"GLOBALS"}["lefzyldkv"]} = array("assigned_user_id" => "smownerid"); ${"GLOBALS"}["scqvcmen"] = "cacheEnable"; if (${${"GLOBALS"}["joqrqyq"]} !== false) { ${"GLOBALS"}["dsrwuu"] = "addReferences"; ${"GLOBALS"}["sslclqqnfbw"] = "field"; $kmoixogjhxu = "field"; ${$kmoixogjhxu} = new StdClass(); $field->name = "current_user"; $field->label = getTranslatedString("LBL_CURRENT_USER", "Workflow2"); ${${"GLOBALS"}["dsrwuu"]}[] = array(${${"GLOBALS"}["sslclqqnfbw"]}, "Users"); if (!empty(${${"GLOBALS"}["iwqzew"]})) { foreach (${${"GLOBALS"}["iwqzew"]} as ${${"GLOBALS"}["mmuqgvsylc"]}) { $xvnqxelu = "first_key"; $xsxglkjgmm = "crmid"; $sbihixyuih = "crmid"; ${$xsxglkjgmm} = new StdClass(); $crmid->name = str_replace(array("[source]", "[module]", "[destination]"), array($refField->name, "ModuleName", "ModuleName"), ${${"GLOBALS"}["edetoedh"]}); $bdnfiyflkc = "moduleFields"; ${"GLOBALS"}["etcbqubpb"] = "moduleFields"; $crmid->label = $refField->label . " / Modulename"; $dmskkogg = "first_key"; $crmid->type = "string"; reset(${${"GLOBALS"}["etcbqubpb"]}); ${$xvnqxelu} = key(${${"GLOBALS"}["jthlbvy"]}); ${${"GLOBALS"}["jthlbvy"]}[${${"GLOBALS"}["hohxkflr"]}] = array_merge(${$bdnfiyflkc}[${$dmskkogg}], array(${$sbihixyuih})); } } } if (is_array(${${"GLOBALS"}["upopmkvwurai"]})) { ${"GLOBALS"}["fokpcifdbil"] = "addReferences"; foreach (${${"GLOBALS"}["fokpcifdbil"]} as ${${"GLOBALS"}["mmuqgvsylc"]}) { ${"GLOBALS"}["cxtkmhcqyn"] = "fields"; ${"GLOBALS"}["qcadikqoac"] = "fields"; ${${"GLOBALS"}["cxtkmhcqyn"]} = self::getFieldsForModule(${${"GLOBALS"}["mmuqgvsylc"]}[1]); foreach (${${"GLOBALS"}["qcadikqoac"]} as ${${"GLOBALS"}["eswxvskrqln"]}) { ${"GLOBALS"}["ivtfijph"] = "app_strings"; $hatpiz = "refTemplate"; ${"GLOBALS"}["ithqigutpn"] = "refField"; ${"GLOBALS"}["dhtzrkv"] = "app_strings"; ${"GLOBALS"}["bmvbvwup"] = "refField"; $sxktrqfnbw = "rewriteFields"; ${"GLOBALS"}["rsspnimhzpn"] = "refField"; $skfigxcabc = "name"; $field->label = "(" . (isset(${${"GLOBALS"}["ivtfijph"]}[${${"GLOBALS"}["rsspnimhzpn"]}[1]]) ? ${${"GLOBALS"}["dhtzrkv"]}[${${"GLOBALS"}["mmuqgvsylc"]}[1]] : ${${"GLOBALS"}["ithqigutpn"]}[1]) . ") " . $field->label; if (!empty(${$sxktrqfnbw}[${${"GLOBALS"}["mmuqgvsylc"]}[0]->name])) { $uykopfvgof = "rewriteFields"; ${${"GLOBALS"}["mmuqgvsylc"]}[0]->name = ${$uykopfvgof}[${${"GLOBALS"}["mmuqgvsylc"]}[0]->name]; } ${"GLOBALS"}["ufmoguryf"] = "moduleFields"; ${${"GLOBALS"}["urtuhewdod"]} = str_replace(array("[source]", "[module]", "[destination]"), array(${${"GLOBALS"}["mmuqgvsylc"]}[0]->name, ${${"GLOBALS"}["mmuqgvsylc"]}[1], $field->name), ${$hatpiz}); $kgqlxq = "field"; $field->name = ${$skfigxcabc}; ${${"GLOBALS"}["ufmoguryf"]}["References (" . ${${"GLOBALS"}["bmvbvwup"]}[0]->label . ")"][] = ${$kgqlxq}; } } } \Vtiger_Cache::${${"GLOBALS"}["scqvcmen"]} = true; return ${${"GLOBALS"}["cembvymw"]}; }