예제 #1
0
/**
 * Function to get customfield entries
 * @param string $module - Module name
 * return array  $cflist - customfield entries
 */
function getCFListEntries($module)
{
    global $adb, $app_strings, $theme, $smarty, $log;
    $tabid = getTabid($module);
    if ($module == 'Calendar') {
        $tabid = array(9, 16);
    }
    $theme_path = "themes/" . $theme . "/";
    $image_path = "themes/images/";
    $dbQuery = "select fieldid,columnname,fieldlabel,uitype,displaytype,block,vtiger_convertleadmapping.cfmid,tabid from vtiger_field left join vtiger_convertleadmapping on  vtiger_convertleadmapping.leadfid = vtiger_field.fieldid where tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.presence in (0,2) and generatedtype = 2 order by sequence";
    $result = $adb->pquery($dbQuery, array($tabid));
    $row = $adb->fetch_array($result);
    $count = 1;
    $cflist = array();
    if ($row != '') {
        do {
            $cf_element = array();
            $cf_element['no'] = $count;
            $cf_element['label'] = getTranslatedString($row["fieldlabel"], $module);
            $fld_type_name = getCustomFieldTypeName($row["uitype"]);
            $cf_element['type'] = $fld_type_name;
            $cf_tab_id = $row["tabid"];
            if ($module == 'Leads') {
                $mapping_details = getListLeadMapping($row["cfmid"]);
                $cf_element[] = $mapping_details['accountlabel'];
                $cf_element[] = $mapping_details['contactlabel'];
                $cf_element[] = $mapping_details['potentiallabel'];
            }
            if ($module == 'Calendar') {
                if ($cf_tab_id == '9') {
                    $cf_element['activitytype'] = getTranslatedString('Task', $module);
                } else {
                    $cf_element['activitytype'] = getTranslatedString('Event', $module);
                }
            }
            if ($module == 'Calendar') {
                $cf_element['tool'] = '&nbsp;<img style="cursor:pointer;" onClick="deleteCustomField(' . $row["fieldid"] . ',\'' . $module . '\', \'' . $row["columnname"] . '\', \'' . $row["uitype"] . '\')" src="' . vtiger_imageurl('delete.gif', $theme) . '" border="0"  alt="' . $app_strings['LBL_DELETE_BUTTON_LABEL'] . '" title="' . $app_strings['LBL_DELETE_BUTTON_LABEL'] . '"/></a>';
            }
            $cflist[] = $cf_element;
            $count++;
        } while ($row = $adb->fetch_array($result));
    }
    return $cflist;
}
예제 #2
0
/**
 * Function to get customfield entries for leads
 * @param string $module - Module name
 * return array  $cflist - customfield entries
 */
function getCFLeadMapping($module)
{
    global $adb, $app_strings, $theme, $smarty, $log;
    $tabid = getTabid($module);
    $theme_path = "themes/" . $theme . "/";
    $image_path = "themes/images/";
    $dbQuery = "SELECT fieldid,columnname,fieldlabel,uitype,displaytype,block,vtiger_convertleadmapping.cfmid,vtiger_convertleadmapping.editable,tabid FROM vtiger_convertleadmapping LEFT JOIN vtiger_field\n\t\t\t\tON  vtiger_field.fieldid=vtiger_convertleadmapping.leadfid \n\t\t\t\tWHERE tabid IN (" . generateQuestionMarks($tabid) . ")\n\t\t\t\tAND vtiger_field.presence IN (0,2)\n\t\t\t\tAND generatedtype IN (1,2)\n\t\t\t\tAND vtiger_field.fieldname NOT IN('assigned_user_id','createdtime','modifiedtime','lead_no','modifiedby','campaignrelstatus')\n\t\t\t\tORDER BY vtiger_field.fieldlabel";
    $result = $adb->pquery($dbQuery, array($tabid));
    $row = $adb->fetch_array($result);
    $count = 1;
    $cflist = array();
    if ($row != '') {
        do {
            $cf_element = array();
            $cf_element['map']['no'] = $count;
            $cf_element['map']['label'] = getTranslatedString($row["fieldlabel"], $module);
            $fld_type_name = getCustomFieldTypeName($row["uitype"]);
            $cf_element['map']['type'] = $fld_type_name;
            $cf_tab_id = $row["tabid"];
            $cf_element['cfmid'] = $row["cfmid"];
            $cf_element['editable'] = $row["editable"];
            if ($module == 'Leads') {
                $mapping_details = getListLeadMapping($row["cfmid"]);
                $cf_element['map'][] = $mapping_details['accountlabel'];
                $cf_element['map'][] = $mapping_details['contactlabel'];
                $cf_element['map'][] = $mapping_details['potentiallabel'];
            }
            $cflist[] = $cf_element;
            $count++;
        } while ($row = $adb->fetch_array($result));
    }
    return $cflist;
}