示例#1
0
        $query = "update vtiger_import_maps set deleted=1 where id = ?";
        $adb->pquery($query, array($_REQUEST['mapping']));
    }
    $mapping_file = new ImportMap();
    $mapping_arr = $mapping_file->getSavedMappingContent($_REQUEST['mapping']);
    $importable_fields = $_SESSION['import_module_object_column_fields'];
    $field_count = $_SESSION['import_module_field_count'];
    $required_fields = $_SESSION['import_module_object_required_fields'];
    $translated_column_fields = $_SESSION['import_module_translated_column_fields'];
    $tablename = '';
    $has_header = $_SESSION['import_has_header'];
    $firstrow = $_SESSION['import_firstrow'];
    $field_map =& $mapping_arr;
    //$_SESSION['import_field_map'];
    $smarty_array1 = array();
    for ($i = 0; $i < $field_count; $i++) {
        $suggest = '';
        if ($has_header && isset($field_map[$firstrow[$i]])) {
            $suggest = $field_map[$firstrow[$i]];
        } else {
            if (isset($field_map[$i])) {
                $suggest = $field_map[$i];
            }
        }
        $smarty_array1[$i + 1] = getFieldSelect($importable_fields, $i, $required_fields, $suggest, $translated_column_fields, $tablename);
    }
    $smarty = new vtigerCRM_Smarty();
    $smarty->assign("FIRSTROW", $firstrow);
    $smarty->assign("SELECTFIELD", $smarty_array1);
    $smarty->display('modules/Accounting/ImportMap.tpl');
}
示例#2
0
        $focus1 = new HelpDesk();
    }
    if ($_REQUEST['module'] == 'Vendors') {
        $tablename = 'Vendors';
        $focus1 = new Vendors();
    }
    // vtlib customization: Hook to provide generic import for other modules
    if ($_REQUEST['module']) {
        $focus1 = CRMEntity::getInstance($_REQUEST['module']);
        $tablename = $focus->table_name;
    }
    // END
    $smarty->assign("FIRSTROW", $firstrow);
    $smarty->assign("SECONDROW", $secondrow);
    $smarty->assign("THIRDROW", $thirdrow);
    $smarty_array[$field_count + 1] = getFieldSelect($focus->importable_fields, $field_count, $focus->required_fields, $suggest, $translated_column_fields, $tablename);
    $pos = 0;
    foreach ($rows as $row) {
        if (isset($row[$field_count]) && $row[$field_count] != '') {
            $smarty->assign("CELL", htmlspecialchars($row[$field_count]));
        }
        $cnt++;
    }
}
@session_unregister('import_delimiter');
@session_unregister('import_has_header');
@session_unregister('import_firstrow');
@session_unregister('import_field_map');
@session_unregister('import_module_object_column_fields');
@session_unregister('import_module_field_count');
@session_unregister('import_module_object_required_fields');
        $field_def['label'] = preg_replace('/^MOD\\./', '', $field_def['label']);
        $translated_column_fields[$field_def['name']] = translate($field_def['label'], $_REQUEST['module']);
        $importable_fields[$field_def['name']] = 1;
    }
}
for ($field_count = 0; $field_count < $ret_field_count; $field_count++) {
    $xtpl->assign("COLCOUNT", $field_count + 1);
    $suggest = "";
    if ($has_header && isset($field_map[$firstrow[$field_count]])) {
        $suggest = $field_map[$firstrow[$field_count]];
    } else {
        if (isset($field_map[$field_count])) {
            $suggest = $field_map[$field_count];
        }
    }
    $xtpl->assign("SELECTFIELD", getFieldSelect($importable_fields, $field_count, $focus->required_fields, $suggest, $translated_column_fields));
    $xtpl->parse("main.table.row.headcell");
    $pos = 0;
    foreach ($rows as $row) {
        if (isset($row[$field_count]) && $row[$field_count] != '') {
            //replace double quotes with empty space
            $str = str_replace("&quot;", "", htmlspecialchars($row[$field_count]));
            $xtpl->assign("CELL", $str);
            $xtpl->parse("main.table.row.cell");
        } else {
            $xtpl->parse("main.table.row.cellempty");
        }
    }
    $xtpl->parse("main.table.row");
}
//get the indices for this bean from the vardef declarations