summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-11-09 12:19:56 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:38:32 +0200
commit90dd4189664694779ce474757e9c88da5ab2ac6e (patch)
tree872612a89a432ed8d2f61dce5fd37a56eca7d305
parentafa3e0e21841eaaf8bfa7bec68fa6e94dbfe7d71 (diff)
downloadIshtar-90dd4189664694779ce474757e9c88da5ab2ac6e.tar.bz2
Ishtar-90dd4189664694779ce474757e9c88da5ab2ac6e.zip
✨ imports: add xlsm to available extensions
-rw-r--r--changelog/en/changelog_2022-06-15.md1
-rw-r--r--changelog/fr/changelog_2023-01-25.md1
-rw-r--r--ishtar_common/forms_common.py4
-rw-r--r--ishtar_common/models_imports.py3
4 files changed, 6 insertions, 3 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md
index e613df96f..75cdecdf4 100644
--- a/changelog/en/changelog_2022-06-15.md
+++ b/changelog/en/changelog_2022-06-15.md
@@ -3,6 +3,7 @@ v4.0.XX - 2099-12-31
### Features/improvements ###
- pre-import forms
+- imports : ability to use natively LibreOffice and Excel files (need Libreoffice extension)
- imports : refactoring of permission management
- imports: allow to exclude some errors messages
- imports: allow errors to be pointed out line by line
diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md
index 8e12a40b4..aa4ef9df0 100644
--- a/changelog/fr/changelog_2023-01-25.md
+++ b/changelog/fr/changelog_2023-01-25.md
@@ -3,6 +3,7 @@ v4.0.XX - 2099-12-31
### Fonctionnalités/améliorations ###
- ajout de formulaire pré-imports
+- imports : possibilité d'utiliser nativement les fichiers tableurs LibreOffice et Excel (nécessite l'extension Libreoffice)
- imports : refonte de la gestion des droits
- imports : possibilité d'ignorer certains messages d'erreur
- imports : possibilité de pointer les erreurs ligne par ligne
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 0d739fbfb..993b03766 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -396,7 +396,7 @@ class NewImportForm(BaseImportForm):
)
types = [".csv"]
if settings.USE_LIBREOFFICE:
- types += [".ods", ".xls", ".xlsx"]
+ types += [".ods", ".xls", ".xlsx", ".xlsm"]
self._clean_imported_file(types=types)
archive_required = self._need_archive(data)
if archive_required and (
@@ -490,7 +490,7 @@ class NewImportGISForm(BaseImportForm):
data = super().clean()
types = ["zip", "gpkg", "csv"]
if settings.USE_LIBREOFFICE:
- types += [".ods", ".xls", ".xlsx"]
+ types += [".ods", ".xls", ".xlsx", ".xlsm"]
self._clean_imported_file(types=types)
return data
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index 2967c18aa..6cb95b0ee 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -2119,7 +2119,8 @@ class Import(BaseImport):
if not settings.USE_LIBREOFFICE or not self.imported_file or not UnoCalc:
return
name = self.imported_file.name.lower()
- if not name.endswith(".ods") and not name.endswith(".xls") and not name.endswith(".xlsx"):
+ ext = name.split(".")[-1]
+ if ext not in ("ods", "xls", "xlsx", "xlsm"):
return
imported_file_path = os.path.abspath(self.imported_file.path)
media_root = os.path.abspath(settings.MEDIA_ROOT)