コード例 #1
0
/**
 * Function to get the field information from module name and field label
 */
function getFieldByReportLabel($module, $label)
{
    $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label);
    if ($cacheLabel) {
        return $cacheLabel;
    }
    // this is required so the internal cache is populated or reused.
    getColumnFields($module);
    //lookup all the accessible fields
    $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
    $label = decode_html($label);
    if ($module == 'Calendar') {
        $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
        if ($cachedEventsFields) {
            if (empty($cachedModuleFields)) {
                $cachedModuleFields = $cachedEventsFields;
            } else {
                $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields);
            }
        }
        if ($label == 'Start_Date_and_Time') {
            $label = 'Start_Date_&_Time';
        }
    }
    if (empty($cachedModuleFields)) {
        return null;
    }
    foreach ($cachedModuleFields as $fieldInfo) {
        $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
        $fieldLabel = decode_html($fieldLabel);
        //SalesPlatform.ru begin fix get field info by label
        if ($label == $fieldLabel || $label == getTranslatedString($fieldLabel, $module)) {
            //if($label == $fieldLabel) {
            //SalesPlatform.ru end
            VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo);
            return $fieldInfo;
        }
    }
    return null;
}
コード例 #2
0
/**
 * Function to get the field information from module name and field label
 */
function getFieldByReportLabel($module, $label)
{
    $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label);
    if ($cacheLabel) {
        return $cacheLabel;
    }
    // this is required so the internal cache is populated or reused.
    getColumnFields($module);
    //lookup all the accessible fields
    $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
    if (empty($cachedModuleFields)) {
        return null;
    }
    foreach ($cachedModuleFields as $fieldInfo) {
        $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
        if ($label == $fieldLabel) {
            VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo);
            return $fieldInfo;
        }
    }
    return null;
}