dépôts
/
garradin.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ajout du support des écritures ventilées.
[garradin.git]
/
www
/
admin
/
compta
/
import.php
diff --git
a/www/admin/compta/import.php
b/www/admin/compta/import.php
index
22a1137
..
b14fe02
100644
(file)
--- a/
www/admin/compta/import.php
+++ b/
www/admin/compta/import.php
@@
-10,6
+10,7
@@
if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
$e = new Compta_Exercices;
$import = new Compta_Import;
$e = new Compta_Exercices;
$import = new Compta_Import;
+$comptes = new Compta_Comptes;
if (isset($_GET['export']))
{
if (isset($_GET['export']))
{
@@
-27,7
+28,7
@@
if (!empty($_POST['import']))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
-
else
if (empty($_FILES['upload']['tmp_name']))
+ if (empty($_FILES['upload']['tmp_name']))
{
$error = 'Aucun fichier fourni.';
}
{
$error = 'Aucun fichier fourni.';
}
@@
-35,13
+36,23
@@
if (!empty($_POST['import']))
{
try
{
{
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')
{
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
{
}
else
{
@@
-62,4
+73,4
@@
$tpl->assign('ok', isset($_GET['ok']) ? true : false);
$tpl->display('admin/compta/import.tpl');
$tpl->display('admin/compta/import.tpl');
-?>
\ No newline at end of file
+?>