Exemplo n.º 1
0
        $current_bean_type = $module;
        $callInitImport = true;
    }
    // END
} else {
    $current_bean_type = "ImportContact";
}
$focus = new $current_bean_type();
// vtlib customization: Call the import initializer
if ($callInitImport) {
    $focus->initImport($module);
}
// END
//Constructing the custom vtiger_field Array
require_once 'include/CustomFieldUtil.php';
$custFldArray = getCustomFieldArray($_REQUEST['module']);
p("IMP 3: custFldArray");
p($custFldArray);
//Initializing  an empty Array to store the custom vtiger_field Column Name and Value
$resCustFldArray = array();
p("Getting from request");
// loop through all request variables
foreach ($_REQUEST as $name => $value) {
    p("name=" . $name . " value=" . $value);
    // only look for var names that start with "colnum"
    if (strncasecmp($name, "colnum", 6) != 0) {
        continue;
    }
    if ($value == "-1") {
        continue;
    }
Exemplo n.º 2
0
/** Function To create Email template variables dynamically -- Pavani */
function getEmailTemplateVariables()
{
    global $adb;
    $modules_list = array('Accounts', 'Contacts', 'Leads', 'Users');
    $module_cf_table = array('Accounts' => 'vtiger_accountscf', 'Contacts' => 'vtiger_contactscf', 'Leads' => 'vtiger_leadscf');
    foreach ($modules_list as $index => $module) {
        if ($module == 'Calendar') {
            $focus = new Activity();
        } else {
            $focus = new $module();
        }
        $tabname = $focus->table_name;
        $default_fields = $focus->emailTemplate_defaultFields;
        // Set the default email template fields for the given module
        if ($default_fields != null) {
            foreach ($default_fields as $index => $field) {
                if ($field == 'support_start_date' || $field == 'support_end_date') {
                    $tabname = 'vtiger_customerdetails';
                }
                $sql = "select fieldlabel from vtiger_field where tablename=? and columnname=? and vtiger_field.presence in (0,2)";
                $result = $adb->pquery($sql, array($tabname, $field));
                $norows = $adb->num_rows($result);
                if ($norows > 0) {
                    $option = array(getTranslatedString($module) . ': ' . getTranslatedString($adb->query_result($result, 'fieldlabel')), "\$" . strtolower($module) . "-" . $field . "\$");
                    $allFields[] = $option;
                }
            }
        }
        // Set the custom fields of a given module for Email templates
        $custFields = getCustomFieldArray($module);
        foreach ($custFields as $val => $key) {
            $sql = "select fieldlabel from vtiger_field where tablename=? and columnname=? and uitype!=56 and vtiger_field.presence in (0,2)";
            $result = $adb->pquery($sql, array($module_cf_table[$module], $val));
            $norows = $adb->num_rows($result);
            if ($norows > 0) {
                if ($adb->query_result($result, 'fieldlabel') != '' and $adb->query_result($result, 'fieldlabel') != NULL) {
                    $option = array(getTranslatedString($module) . ': ' . getTranslatedString($adb->query_result($result, 'fieldlabel')), "\$" . strtolower($module) . "-" . $val . "\$");
                    $allFields[] = $option;
                }
            }
        }
        //}
        $allOptions[] = $allFields;
        $allFields = "";
    }
    $option = array('Current Date', '$custom-currentdate$');
    $allFields[] = $option;
    $option = array('Current Time', '$custom-currenttime$');
    $allFields[] = $option;
    $allOptions[] = $allFields;
    return $allOptions;
}