Skip to content
Snippets Groups Projects
Commit 1589a222 authored by Uma's avatar Uma
Browse files

Fixes #1428 Notify user of scheduled import status and email translations is addressed

parent 5a522b0e
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -99,4 +99,10 @@ $languageStrings = array(
'LBL_UPLOAD_ICS'=>'Upload ICS File',
'LBL_IMPORT_FROM_ICS_FILE'=>'Import from ICS file',
'LBL_SELECT_ICS_FILE' => 'Select ICS file',
//Scheduled Import translations
'LBL_ENABLE_CRON' => '<b>Please do enable Scheduled Import cron job from settings scheduler</b>',
'LBL_SCHEDULE_IMPORT_SUBJECT' => 'vtiger CRM - Scheduled Import Report for',
'LBL_IMPORT_COMPLETED' => 'vtiger CRM has just completed your import process. <br/><br/>',
'LBL_CHECK_IMPORT_STATUS' => '<br/><br/> We recommend you to login to the CRM and check few records to confirm that the import has been successful.'
);
......@@ -24,6 +24,13 @@
</td>
</tr>
{/if}
{if $ENABLE_SCHEDULE_IMPORT_CRON}
<tr>
<td style="padding-left: 15px;">
{'LBL_ENABLE_CRON'|@vtranslate:$MODULE}
</td>
</tr>
{/if}
<tr>
<td>
<table cellpadding="10" cellspacing="0" align="center" class="table table-borderless">
......
......@@ -885,8 +885,7 @@ class Import_Data_Action extends Vtiger_Action_Controller {
$importDataController->importData();
$importStatusCount = $importDataController->getImportStatusCount();
$recordsToImport = $importDataController->getNumberOfRecordsToImport($importDataController->user);
$emailSubject = 'vtiger CRM - Scheduled Import Report for '.$importDataController->module;
$emailSubject = getTranslatedString('LBL_SCHEDULE_IMPORT_SUBJECT', 'Import').' '.$importDataController->module;
$viewer = new Vtiger_Viewer();
$viewer->assign('FOR_MODULE', $importDataController->module);
$viewer->assign('INVENTORY_MODULES', getInventoryModules());
......@@ -895,9 +894,7 @@ class Import_Data_Action extends Vtiger_Action_Controller {
$importResult = $viewer->view('Import_Result_Details.tpl','Import',true);
$importResult = str_replace('align="center"', '', $importResult);
$emailData = 'vtiger CRM has just completed your import process. <br/><br/>' .
$importResult.'<br/><br/>'.
'We recommend you to login to the CRM and check few records to confirm that the import has been successful.';
$emailData = getTranslatedString('LBL_IMPORT_COMPLETED', 'Import').' '.$importResult.getTranslatedString('LBL_CHECK_IMPORT_STATUS', 'Import');
$userName = getFullNameFromArray('Users', $importDataController->user->column_fields);
$userEmail = $importDataController->user->email1;
......
......@@ -34,9 +34,10 @@ class Import_Main_View extends Vtiger_View_Controller{
}
$isImportScheduled = $importController->request->get('is_scheduled');
$enableCron = $importController->request->get('enable_cron');
if($isImportScheduled) {
$importInfo = Import_Queue_Action::getUserCurrentImportInfo($importController->user);
self::showScheduledStatus($importInfo);
self::showScheduledStatus($importInfo, $enableCron);
} else {
$importController->triggerImport();
}
......@@ -133,12 +134,12 @@ class Import_Main_View extends Vtiger_View_Controller{
$viewer->view('ImportResult.tpl', 'Import');
}
public static function showScheduledStatus($importInfo) {
public function showScheduledStatus($importInfo, $enableCronStatus) {
$moduleName = $importInfo['module'];
$importId = $importInfo['id'];
$viewer = new Vtiger_Viewer();
$viewer->assign('ENABLE_SCHEDULE_IMPORT_CRON', $enableCronStatus);
$viewer->assign('FOR_MODULE', $moduleName);
$viewer->assign('MODULE', 'Import');
$viewer->assign('IMPORT_ID', $importId);
......@@ -196,6 +197,16 @@ class Import_Main_View extends Vtiger_View_Controller{
$immediateImportRecordLimit = $configReader->get('immediateImportLimit');
$pagingLimit = $configReader->get('importPagingLimit');
$cronTasks = Vtiger_Cron::listAllInstancesByModule('Import');
$importCronTask = $cronTasks[0];
if(!empty($importCronTask)){
$cronStatus = $importCronTask->getStatus();
$enableCron = false;
if(empty($cronStatus)){
$enableCron = true;
}
$this->request->set('enable_cron', $enableCron);
}
$numberOfRecordsToImport = $this->numberOfRecords;
if($numberOfRecordsToImport > $immediateImportRecordLimit) {
$this->request->set('is_scheduled', true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment