public static function import($request, $user) { $importController = new Import_Main_View($request, $user); $importController->saveMap(); $fileReadStatus = $importController->copyFromFileToDB(); if ($fileReadStatus) { $importController->queueDataImport(); } $isImportScheduled = $importController->request->get('is_scheduled'); if ($isImportScheduled) { $importInfo = Import_Queue_Action::getUserCurrentImportInfo($importController->user); self::showScheduledStatus($importInfo); } else { $importController->triggerImport(); } }
function checkImportStatus(Vtiger_Request $request) { $moduleName = $request->getModule(); $user = Users_Record_Model::getCurrentUserModel(); $mode = $request->getMode(); // Check if import on the module is locked $lockInfo = Import_Lock_Action::isLockedForModule($moduleName); if ($lockInfo != null) { $lockedBy = $lockInfo['userid']; if ($user->id != $lockedBy && !$user->isAdminUser()) { Import_Utils_Helper::showImportLockedError($lockInfo); exit; } else { if ($mode == 'continueImport' && $user->id == $lockedBy) { $importController = new Import_Main_View($request, $user); $importController->triggerImport(true); } else { $importInfo = Import_Queue_Action::getImportInfoById($lockInfo['importid']); $lockOwner = $user; if ($user->id != $lockedBy) { $lockOwner = Users_Record_Model::getInstanceById($lockInfo['userid'], 'Users'); } Import_Main_View::showImportStatus($importInfo, $lockOwner); } exit; } } if (Import_Utils_Helper::isUserImportBlocked($user)) { $importInfo = Import_Queue_Action::getUserCurrentImportInfo($user); if ($importInfo != null) { Import_Main_View::showImportStatus($importInfo, $user); exit; } else { Import_Utils_Helper::showImportTableBlockedError($moduleName, $user); exit; } } Import_Utils_Helper::clearUserImportInfo($user); }