Exemple #1
0
$title = 'Import From Quickbooks';

if($_POST['save']){
	$importer = new QBImporter();
	$dest_file = '/tmp/'.basename($_FILES['iif_file']['name']);
	if(!move_uploaded_file($_FILES['iif_file']['tmp_name'], $dest_file)){
		$error_msg .= "Could not move uploaded file!";	
	}else{
		$data = $importer->import($dest_file);
		if($data === FALSE){
			$error_msg .= "Error importing file!";
			debug_message($importer->getLastError());
		}
		
		$company = new SI_Company();
		if($company->importQB($data) === FALSE){
			$error_msg .= "Error importing company data!";
			debug_message($company->getLastError());	
		}

		$code = new SI_ItemCode();
		if($code->importQB($data) === FALSE){
			$error_msg .= "Error importing item code data!";
			debug_message($code->getLastError());	
		}

		$account = new SI_Account();
		if($account->importQB($data) === FALSE){
			$error_msg .= "Error importing account data!";
			debug_message($account->getLastError());	
		}