本文整理汇总了PHP中UsersLastImport::mark_deleted_by_user_id方法的典型用法代码示例。如果您正苦于以下问题:PHP UsersLastImport::mark_deleted_by_user_id方法的具体用法?PHP UsersLastImport::mark_deleted_by_user_id怎么用?PHP UsersLastImport::mark_deleted_by_user_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsersLastImport
的用法示例。
在下文中一共展示了UsersLastImport::mark_deleted_by_user_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//This file will be included only once at the first time. Will not be included when we redirect from ImportSave
include "modules/Import/picklist_addition.php";
}
$saved_ids = array();
$firstrow = 0;
if (!isset($datarows)) {
$error = $mod_strings['LBL_FILE_ALREADY_BEEN_OR'];
$datarows = array();
}
if ($has_header == 1) {
$firstrow = array_shift($datarows);
}
//Mark the last imported records as deleted which are imported by the current user in vtiger_users_last_import vtiger_table
if (!isset($_REQUEST['startval'])) {
$seedUsersLastImport = new UsersLastImport();
$seedUsersLastImport->mark_deleted_by_user_id($current_user->id);
}
$skip_required_count = 0;
p("processing started ret_field_count=" . $ret_field_count);
$adb->println($datarows);
$error = '';
$focus = new $current_bean_type();
$focus->initRequiredFields($module);
// SAVE MAPPING IF REQUESTED
if (isset($_REQUEST['save_map']) && $_REQUEST['save_map'] == 'on' && isset($_REQUEST['save_map_as']) && $_REQUEST['save_map_as'] != '') {
p("save map");
$serialized_mapping = '';
if ($has_header) {
foreach ($col_pos_to_field as $pos => $field_name) {
if (isset($firstrow[$pos]) && isset($field_name)) {
$header_to_field[$firstrow[$pos]] = $field_name;
示例2: UsersLastImport
define('_BENNU_VERSION', '0.1');
require_once 'Smarty_setup.php';
include 'modules/Calendar/iCal/iCalendar_rfc2445.php';
include 'modules/Calendar/iCal/iCalendar_components.php';
include 'modules/Calendar/iCal/iCalendar_properties.php';
include 'modules/Calendar/iCal/iCalendar_parameters.php';
include 'modules/Calendar/iCal/ical-parser-class.php';
require_once 'include/Zend/Json.php';
require_once 'modules/Import/UsersLastImport.php';
require_once 'include/utils/utils.php';
require_once 'data/CRMEntity.php';
global $import_dir, $current_user, $mod_strings, $app_strings, $currentModule;
if ($_REQUEST['step'] != 'undo') {
$last_import = new UsersLastImport();
$last_import->mark_deleted_by_user_id($current_user->id);
$file_details = $_FILES['ics_file'];
$binFile = 'vtiger_import' . date('YmdHis');
$file = $import_dir . '' . $binFile;
$filetmp_name = $file_details['tmp_name'];
$upload_status = move_uploaded_file($filetmp_name, $file);
$skip_fields = array('Events' => array('duration_hours'), 'Calendar' => array('eventstatus'));
$required_fields = array();
$modules = array('Events', 'Calendar');
foreach ($modules as $module) {
$calendar = CRMEntity::getInstance('Calendar');
$calendar->initRequiredFields($module);
$val = array_keys($calendar->required_fields);
$required_fields[$module] = array_diff($val, $skip_fields[$module]);
}
$ical = new iCal();
示例3: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings, $current_user, $sugar_config, $app_list_strings, $locale;
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
$has_header = isset($_REQUEST['has_header']) ? 1 : 0;
$sugar_config['import_max_records_per_file'] = empty($sugar_config['import_max_records_per_file']) ? 1000 : $sugar_config['import_max_records_per_file'];
// Clear out this user's last import
$seedUsersLastImport = new UsersLastImport();
$seedUsersLastImport->mark_deleted_by_user_id($current_user->id);
ImportCacheFiles::clearCacheFiles();
// attempt to lookup a preexisting field map
// use the custom one if specfied to do so in step 1
$field_map = array();
$default_values = array();
$ignored_fields = array();
if (!empty($_REQUEST['source_id'])) {
$mapping_file = new ImportMap();
$mapping_file->retrieve($_REQUEST['source_id'], false);
$_REQUEST['source'] = $mapping_file->source;
$has_header = $mapping_file->has_header;
if (isset($mapping_file->delimiter)) {
$_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
}
if (isset($mapping_file->enclosure)) {
$_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
}
$field_map = $mapping_file->getMapping();
$default_values = $mapping_file->getDefaultValues();
$this->ss->assign("MAPNAME", $mapping_file->name);
$this->ss->assign("CHECKMAP", 'checked="checked" value="on"');
} else {
// Try to see if we have a custom mapping we can use
// based upon the where the records are coming from
// and what module we are importing into
$classname = 'ImportMap' . ucfirst($_REQUEST['source']);
if (file_exists("modules/Import/{$classname}.php")) {
require_once "modules/Import/{$classname}.php";
} elseif (file_exists("custom/modules/Import/{$classname}.php")) {
require_once "custom/modules/Import/{$classname}.php";
} else {
require_once "custom/modules/Import/ImportMapOther.php";
$classname = 'ImportMapOther';
$_REQUEST['source'] = 'other';
}
if (class_exists($classname)) {
$mapping_file = new $classname();
if (isset($mapping_file->delimiter)) {
$_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
}
if (isset($mapping_file->enclosure)) {
$_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
}
$ignored_fields = $mapping_file->getIgnoredFields($_REQUEST['import_module']);
$field_map = $mapping_file->getMapping($_REQUEST['import_module']);
}
}
$this->ss->assign("CUSTOM_DELIMITER", !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : ",");
$this->ss->assign("CUSTOM_ENCLOSURE", !empty($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : "");
// handle uploaded file
$uploadFile = new UploadFile('userfile');
if (isset($_FILES['userfile']) && $uploadFile->confirm_upload()) {
$uploadFile->final_move('IMPORT_' . $this->bean->object_name . '_' . $current_user->id);
$uploadFileName = $uploadFile->get_upload_path('IMPORT_' . $this->bean->object_name . '_' . $current_user->id);
} else {
$this->_showImportError($mod_strings['LBL_IMPORT_MODULE_ERROR_NO_UPLOAD'], $_REQUEST['import_module'], 'Step2');
return;
}
// split file into parts
$splitter = new ImportFileSplitter($uploadFileName, $sugar_config['import_max_records_per_file']);
$splitter->splitSourceFile($_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), $has_header);
// Now parse the file and look for errors
$importFile = new ImportFile($uploadFileName, $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES));
if (!$importFile->fileExists()) {
$this->_showImportError($mod_strings['LBL_CANNOT_OPEN'], $_REQUEST['import_module'], 'Step2');
return;
}
// retrieve first 3 rows
$rows = array();
$system_charset = $locale->default_export_charset;
$user_charset = $locale->getExportCharset();
$other_charsets = 'UTF-8, UTF-7, ASCII, CP1252, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP';
$detectable_charsets = "UTF-8, {$user_charset}, {$system_charset}, {$other_charsets}";
// Bug 26824 - mb_detect_encoding() thinks CP1252 is IS0-8859-1, so use that instead in the encoding list passed to the function
$detectable_charsets = str_replace('CP1252', 'ISO-8859-1', $detectable_charsets);
$charset_for_import = $user_charset;
//We will set the default import charset option by user's preference.
$able_to_detect = function_exists('mb_detect_encoding');
for ($i = 0; $i < 3; $i++) {
$rows[$i] = $importFile->getNextRow();
if (!empty($rows[$i]) && $able_to_detect) {
foreach ($rows[$i] as &$temp_value) {
$current_charset = mb_detect_encoding($temp_value, $detectable_charsets);
if (!empty($current_charset) && $current_charset != "UTF-8") {
$temp_value = $locale->translateCharset($temp_value, $current_charset);
// we will use utf-8 for displaying the data on the page.
$charset_for_import = $current_charset;
//set the default import charset option according to the current_charset.
//.........这里部分代码省略.........
示例4: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings, $current_user;
global $sugar_config, $locale;
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
$this->ss->assign("TYPE", !empty($_REQUEST['type']) ? $_REQUEST['type'] : "import");
$this->ss->assign("SOURCE_ID", $_REQUEST['source_id']);
$this->instruction = 'LBL_SELECT_PROPERTY_INSTRUCTION';
$this->ss->assign('INSTRUCTION', $this->getInstruction());
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false), ENT_NOQUOTES);
$this->ss->assign("CURRENT_STEP", $this->currentStep);
$sugar_config['import_max_records_per_file'] = empty($sugar_config['import_max_records_per_file']) ? 1000 : $sugar_config['import_max_records_per_file'];
$importSource = isset($_REQUEST['source']) ? $_REQUEST['source'] : 'csv';
// Clear out this user's last import
$seedUsersLastImport = new UsersLastImport();
$seedUsersLastImport->mark_deleted_by_user_id($current_user->id);
ImportCacheFiles::clearCacheFiles();
// handle uploaded file
$uploadFile = new UploadFile('userfile');
if (isset($_FILES['userfile']) && $uploadFile->confirm_upload()) {
$uploadFile->final_move('IMPORT_' . $this->bean->object_name . '_' . $current_user->id);
$uploadFileName = $uploadFile->get_upload_path('IMPORT_' . $this->bean->object_name . '_' . $current_user->id);
} elseif (!empty($_REQUEST['tmp_file'])) {
$uploadFileName = "upload://" . basename($_REQUEST['tmp_file']);
} else {
$this->_showImportError($mod_strings['LBL_IMPORT_MODULE_ERROR_NO_UPLOAD'], $_REQUEST['import_module'], 'Step2', true, null, true);
return;
}
//check the file size, we dont want to process an empty file
if (isset($_FILES['userfile']['size']) && $_FILES['userfile']['size'] == 0) {
//this file is empty, throw error message
$this->_showImportError($mod_strings['LBL_NO_LINES'], $_REQUEST['import_module'], 'Step2', false, null, true);
return;
}
$mimeTypeOk = true;
//check to see if the file mime type is not a form of text or application octed streramand fire error if not
if (isset($_FILES['userfile']['type']) && strpos($_FILES['userfile']['type'], 'octet-stream') === false && strpos($_FILES['userfile']['type'], 'text') === false && strpos($_FILES['userfile']['type'], 'application/vnd.ms-excel') === false) {
//this file does not have a known text or application type of mime type, issue the warning
$error_msgs[] = $mod_strings['LBL_MIME_TYPE_ERROR_1'];
$error_msgs[] = $mod_strings['LBL_MIME_TYPE_ERROR_2'];
$this->_showImportError($error_msgs, $_REQUEST['import_module'], 'Step2', true, $mod_strings['LBL_OK']);
$mimeTypeOk = false;
}
$this->ss->assign("FILE_NAME", $uploadFileName);
// Now parse the file and look for errors
$importFile = new ImportFile($uploadFileName, $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), FALSE);
if ($this->shouldAutoDetectProperties($importSource)) {
$GLOBALS['log']->debug("Auto detecing csv properties...");
$autoDetectOk = $importFile->autoDetectCSVProperties();
$importFileMap = array();
$this->ss->assign("SOURCE", 'csv');
if ($autoDetectOk === FALSE) {
//show error only if previous mime type check has passed
if ($mimeTypeOk) {
$this->ss->assign("AUTO_DETECT_ERROR", $mod_strings['LBL_AUTO_DETECT_ERROR']);
}
} else {
$dateFormat = $importFile->getDateFormat();
$timeFormat = $importFile->getTimeFormat();
if ($dateFormat) {
$importFileMap['importlocale_dateformat'] = $dateFormat;
}
if ($timeFormat) {
$importFileMap['importlocale_timeformat'] = $timeFormat;
}
}
} else {
$impotMapSeed = $this->getImportMap($importSource);
$importFile->setImportFileMap($impotMapSeed);
$importFileMap = $impotMapSeed->getMapping($_REQUEST['import_module']);
}
$delimeter = $importFile->getFieldDelimeter();
$enclosure = $importFile->getFieldEnclosure();
$hasHeader = $importFile->hasHeaderRow();
$encodeOutput = TRUE;
//Handle users navigating back through the wizard.
if (!empty($_REQUEST['previous_action']) && $_REQUEST['previous_action'] == 'Confirm') {
$encodeOutput = FALSE;
$importFileMap = $this->overloadImportFileMapFromRequest($importFileMap);
$delimeter = !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : $delimeter;
$enclosure = isset($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : $enclosure;
$enclosure = html_entity_decode($enclosure, ENT_QUOTES);
$hasHeader = !empty($_REQUEST['has_header']) ? $_REQUEST['has_header'] : $hasHeader;
if ($hasHeader == 'on') {
$hasHeader = true;
} else {
if ($hasHeader == 'off') {
$hasHeader = false;
}
}
}
$this->ss->assign("IMPORT_ENCLOSURE_OPTIONS", $this->getEnclosureOptions($enclosure));
$this->ss->assign("IMPORT_DELIMETER_OPTIONS", $this->getDelimeterOptions($delimeter));
$this->ss->assign("CUSTOM_DELIMITER", $delimeter);
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities($enclosure, ENT_QUOTES));
$hasHeaderFlag = $hasHeader ? " CHECKED" : "";
$this->ss->assign("HAS_HEADER_CHECKED", $hasHeaderFlag);
//.........这里部分代码省略.........