Exemple #1
0
	$code = new SI_ItemCode();
	$output = $code->exportQB();
	if($output === FALSE){
		fatal_error("Error getting item code export data!\n".$code->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'account'){
	$account = new SI_Account();
	$output = $account->exportQB();
	if($output === FALSE){
		fatal_error("Error getting account export data!\n".$account->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'payment'){
	$payment = new SI_Payment();
	$output = $payment->exportQB();
	if($output === FALSE){
		fatal_error("Error getting payment export data!\n".$payment->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'invoice'){
	$invoice = new SI_Invoice();
	$output = $invoice->exportQB();
	if($output === FALSE){
		fatal_error("Error getting invoice export data!\n".$invoice->getLastError());
	}
}else{
	fatal_error("Unknown export mode!");
}

ob_end_clean();
header('Content-type: application/iif');
header('Content-Disposition: attachment; filename="'.$_REQUEST[mode].'.iif"');
print($output);
		}
	}

	if(isset($_POST['export_accounts']) && is_array($_POST['export_accounts'])){
		$account = new SI_Account();
		$account_output = $account->exportQB("WHERE id IN (".join(',', $_POST['export_accounts']).")");
		if($account_output === FALSE){
			fatal_error("Error getting account export data!\n".$account->getLastError());
		}else{
			$output .= $account_output;
		}
	}

	if(isset($_POST['export_invoices']) && is_array($_POST['export_invoices'])){
		$invoice = new SI_Invoice();
		$invoice_output = $invoice->exportQB("WHERE id IN (".join(',', $_POST['export_invoices']).")");
		if($invoice_output === FALSE){
			fatal_error("Error getting invoice export data!\n".$invoice->getLastError());
		}else{
			$output .= $invoice_output;
		}
	}
	
	if(isset($_POST['export_payments']) && is_array($_POST['export_payments'])){
		$payment = new SI_Payment();
		$payment_output = $payment->exportQB("WHERE id IN (".join(',', $_POST['export_payments']).")");
		if($payment_output === FALSE){
			fatal_error("Error getting payment export data!\n".$payment->getLastError());
		}else{
			$output .= $payment_output;
		}