示例#1
0
 public function finishImport()
 {
     Import_Lock_Action::unLock($this->user, $this->module);
     Import_Queue_Action::remove($this->id);
 }
示例#2
0
 public static function clearUserImportInfo($user)
 {
     $adb = PearDatabase::getInstance();
     $tableName = self::getDbTableName($user);
     $adb->query('DROP TABLE IF EXISTS ' . $tableName);
     Import_Lock_Action::unLock($user);
     Import_Queue_Action::removeForUser($user);
 }
示例#3
0
 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);
 }