$e = new Compta_Exercices;
$import = new Compta_Import;
+$comptes = new Compta_Comptes;
if (isset($_GET['export']))
{
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
- elseif (empty($_FILES['upload']['tmp_name']))
+ if (empty($_FILES['upload']['tmp_name']))
{
$error = 'Aucun fichier fourni.';
}
{
try
{
+ if (isset($_FILES['upload-plan-comptable']))
+ {
+ if (!$comptes->importPlan($_FILES['upload-plan-comptable']['tmp_name']))
+ {
+ throw new UserException('Erreur lors de l’import du plan comptable');
+ }
+ }
if (utils::post('type') == 'citizen')
{
$import->fromCitizen($_FILES['upload']['tmp_name']);
}
elseif (utils::post('type') == 'garradin')
{
- $import->fromCSV($_FILES['upload']['tmp_name']);
+ if (!$import->fromCSV($_FILES['upload']['tmp_name']))
+ {
+ throw new UserException('Erreur lors de l’import');
+ }
}
else
{
$tpl->display('admin/compta/import.tpl');
-?>
\ No newline at end of file
+?>