$focus->id = ''; $focus->mode = ''; } $focus->preEditCheck($_REQUEST, $smarty); if (!empty($_REQUEST['save_error']) and $_REQUEST['save_error'] == "true") { if (!empty($_REQUEST['encode_val'])) { global $current_user; $encode_val = vtlib_purify($_REQUEST['encode_val']); $decode_val = base64_decode($encode_val); $explode_decode_val = explode('&', trim($decode_val, '&')); $tabid = getTabid($currentModule); foreach ($explode_decode_val as $fieldvalue) { $value = explode("=", $fieldvalue); $field_name_val = $value[0]; $field_value = urldecode($value[1]); $finfo = VTCacheUtils::lookupFieldInfo($tabid, $field_name_val); if ($finfo !== false) { if ($finfo['uitype'] == '56') { $field_value = $field_value == 'on' ? '1' : '0'; } if ($finfo['uitype'] == '71' or $finfo['uitype'] == '72') { $currencyField = new CurrencyField($field_value); $field_value = CurrencyField::convertToDBFormat($field_value, $current_user); } if ($finfo['uitype'] == '33' or $finfo['uitype'] == '3313') { if (is_array($field_value)) { $field_value = implode(' |##| ', $field_value); } } } $focus->column_fields[$field_name_val] = $field_value;
/** * Function to get the fieldid * * @param Integer $tabid * @param Boolean $onlyactive */ function getFieldid($tabid, $fieldname, $onlyactive = true) { global $adb; // Look up information at cache first $fieldinfo = VTCacheUtils::lookupFieldInfo($tabid, $fieldname); if ($fieldinfo === false) { $query = "SELECT fieldid, fieldlabel, columnname, tablename, uitype, typeofdata, presence \n\t\t\tFROM vtiger_field WHERE tabid=? AND fieldname=?"; $result = $adb->pquery($query, array($tabid, $fieldname)); if ($adb->num_rows($result)) { $resultrow = $adb->fetch_array($result); // Update information to cache for re-use VTCacheUtils::updateFieldInfo($tabid, $fieldname, $resultrow['fieldid'], $resultrow['fieldlabel'], $resultrow['columnname'], $resultrow['tablename'], $resultrow['uitype'], $resultrow['typeofdata'], $resultrow['presence']); $fieldinfo = VTCacheUtils::lookupFieldInfo($tabid, $fieldname); } } // Get the field id based on required criteria $fieldid = false; if ($fieldinfo) { $fieldid = $fieldinfo['fieldid']; if ($onlyactive && !in_array($fieldinfo['presence'], array('0', '2'))) { $fieldid = false; } } return $fieldid; }
/** * Function to get the fieldid * * @param Integer $tabid * @param Boolean $onlyactive */ function getFieldid($tabid, $fieldname, $onlyactive = true) { global $adb; // Look up information at cache first $fieldinfo = VTCacheUtils::lookupFieldInfo($tabid, $fieldname); if ($fieldinfo === false) { getColumnFields(getTabModuleName($tabid)); $fieldinfo = VTCacheUtils::lookupFieldInfo($tabid, $fieldname); } // Get the field id based on required criteria $fieldid = false; if ($fieldinfo) { $fieldid = $fieldinfo['fieldid']; if ($onlyactive && !in_array($fieldinfo['presence'], array('0', '2'))) { $fieldid = false; } } return $fieldid; }
function getFieldRelatedInfo($tabId, $fieldName) { $fieldInfo = VTCacheUtils::lookupFieldInfo($tabId, $fieldName); if ($fieldInfo === false) { getColumnFields(getTabModuleName($tabid)); $fieldInfo = VTCacheUtils::lookupFieldInfo($tabId, $fieldName); } return $fieldInfo; }