$title = 'Import Time - Upload File';

if(isset($_SESSION['SureInvoice']['TimeImport'])){
	$importer =& $_SESSION['SureInvoice']['TimeImport'];
	if($importer->hasMappings()){
		header("Location: ".getCurrentURL('time_import_3.php'));
		exit();			
	}
	if($importer->hasFile()){
		header("Location: ".getCurrentURL('time_import_2.php'));
		exit();	
	}
}

if($_POST['save']){
	$importer = new SI_TimeImport();
	$importer->processUploadedFile($_FILES['csv_file']);
	$_SESSION['SureInvoice']['TimeImport'] =& $importer;
	header("Location: ".getCurrentURL('time_import_2.php'));
	exit();
}

?>
<? require('header.php'); ?>
<div class="box">
<div class="boxTitle"><h3><?php 
echo $title;
?>
</h3><span class="boxTitleRight">&nbsp;</span><span class="boxTitleCorner">&nbsp;</span></div><div class="boxContent">
<form name="time_import" action="<?php 
echo $_SERVER['PHP_SELF'];
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 */
require_once('includes/common.php');
checkLogin();

require_once('includes/SI_Company.php');
require_once('includes/SI_ItemCode.php');

$title = 'Import Time - Preview Import';

$importer = new SI_TimeImport();
if(isset($_SESSION['SureInvoice']['TimeImport'])){
	$importer =& $_SESSION['SureInvoice']['TimeImport'];
}else{
	fatal_error("Import is not in progress!");
}
$headers = $importer->getColumnHeaders();

if(isset($_POST['restart'])){
	unset($_SESSION['SureInvoice']['TimeImport']);
	header("Location: ".getCurrentURL('time_import_1.php'));
	exit();
}

if(isset($_POST['back'])){
	header("Location: ".getCurrentURL('time_import_4.php'));
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 */
require_once('includes/common.php');
checkLogin();

require_once('includes/SI_Company.php');
require_once('includes/SI_ItemCode.php');

$title = 'Import Time - Map Tasks';

$importer = new SI_TimeImport();
if(isset($_SESSION['SureInvoice']['TimeImport'])){
	$importer =& $_SESSION['SureInvoice']['TimeImport'];
}else{
	fatal_error("Import is not in progress!");
}
$headers = $importer->getColumnHeaders();

if(isset($_POST['restart'])){
	unset($_SESSION['SureInvoice']['TimeImport']);
	header("Location: ".getCurrentURL('time_import_1.php'));
	exit();
}

if(isset($_POST['back'])){
	header("Location: ".getCurrentURL('time_import_3.php'));