protected function getListViewTableFromFile($fileName, $tableName) { $has_header = $_REQUEST['has_header'] == 'on' ? TRUE : FALSE; $if = new ImportFile($fileName, ",", '"', FALSE, FALSE); $if->setHeaderRow($has_header); $lv = new ImportListView($if, array('offset' => 0), $tableName); return $lv->display(TRUE); }
function action_RefreshTable() { $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $tableID = isset($_REQUEST['tableID']) ? $_REQUEST['tableID'] : 'errors'; $has_header = $_REQUEST['has_header'] == 'on' ? TRUE : FALSE; if ($tableID == 'dup') { $tableFilename = ImportCacheFiles::getDuplicateFileName(); } else { $tableFilename = ImportCacheFiles::getErrorRecordsFileName(); } $if = new ImportFile($tableFilename, ",", '"', FALSE, FALSE); $if->setHeaderRow($has_header); $lv = new ImportListView($if, array('offset' => $offset), $tableID); $lv->display(FALSE); sugar_cleanup(TRUE); }
/** * @dataProvider providerRowCountData */ public function testRowCount($file, $count, $hasHeader) { // create the test file $sample_file = $GLOBALS['sugar_config']['upload_dir'] . '/' . $file; copy('tests/modules/Import/' . $file, $sample_file); $this->unlink[] = $sample_file; $importFile = new ImportFile($sample_file, ",", '', false, false); $this->assertTrue($importFile->fileExists()); $importFile->setHeaderRow($hasHeader); $c = $importFile->getTotalRecordCount(); $this->assertEquals($count, $c, 'incorrect row count.'); }