get('nom_asso') . ' - ' . date('Y-m-d') . '.csv"'); $import->toCSV($e->getCurrentId()); exit; } $error = false; if (!empty($_POST['import'])) { if (!utils::CSRF_check('compta_import')) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } elseif (empty($_FILES['upload']['tmp_name'])) { $error = 'Aucun fichier fourni.'; } else { try { if (utils::post('type') == 'citizen') { $import->fromCitizen($_FILES['upload']['tmp_name']); } elseif (utils::post('type') == 'garradin') { $import->fromCSV($_FILES['upload']['tmp_name']); } else { throw new UserException('Import inconnu.'); } utils::redirect('/admin/compta/import.php?ok'); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('ok', isset($_GET['ok']) ? true : false); $tpl->display('admin/compta/import.tpl'); ?>