<?php 
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
	die ( 'Not A Valid Entry Point' );

require_once ('modules/EcmSales/readXML.php');

$smarty = new Sugar_Smarty ();
$smarty->module = 'EcmSales';

global $mod_strings;



//get orders
$folders =  array('archive', 'temp', 'confirm');

$edi_orders = array();
$dir="/home/mz/edi/files/orders";
if(is_dir($dir)){
	if($dh=opendir($dir)){
		while (($file = readdir($dh))!==false){
			if(!is_dir($file) && !in_array($file, $folders)) {
				$reader = new readXML();
				$tmp = array();
				$tmp['file'] = $file;
				$tmp['name'] = $reader->loadAccount($file);
				$edi_orders[] = $tmp;
				unset($tmp);
				unset($reader);
			}
		}
		closedir($dh);
	}
}

$smarty->assign('EDI_ORDERS', $edi_orders);
$smarty->assign ( 'MOD', $mod_strings);
$smarty-> display('modules/EcmSales/tpls/importXML.tpl');
?>