From 5b8630f09421e98fd8840e7599b2be77c5918a2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Wed, 17 Apr 2019 14:44:07 +0200
Subject: [PATCH] cartads: move zip upload to its own method (#32419)

---
 passerelle/apps/cartads_cs/models.py       |  10 +-
 passerelle/locale/fr/LC_MESSAGES/django.po | 155 +++++++++++++++------
 2 files changed, 120 insertions(+), 45 deletions(-)

diff --git a/passerelle/apps/cartads_cs/models.py b/passerelle/apps/cartads_cs/models.py
index c21706ca..eacce5d0 100644
--- a/passerelle/apps/cartads_cs/models.py
+++ b/passerelle/apps/cartads_cs/models.py
@@ -363,10 +363,7 @@ class AbstractCartaDSCS(BaseResource):
         dossier.save()
         self.add_job('send_to_cartads', dossier_id=dossier.id)
 
-    def send_to_cartads(self, dossier_id):
-        dossier = CartaDSDossier.objects.get(id=dossier_id)
-        zip_filename = os.path.join(default_storage.path('cartads_cs'), '%s.zip' % dossier.tracking_code)
-
+    def upload_zip(self, zip_filename):
         ftp = FTP(self.ftp_server)
         ftp.login(self.ftp_username, self.ftp_password)
         ftp.cwd(self.ftp_client_name)
@@ -375,6 +372,11 @@ class AbstractCartaDSCS(BaseResource):
                 open(zip_filename))
         ftp.quit()
 
+    def send_to_cartads(self, dossier_id):
+        dossier = CartaDSDossier.objects.get(id=dossier_id)
+        zip_filename = os.path.join(default_storage.path('cartads_cs'), '%s.zip' % dossier.tracking_code)
+        self.upload_zip(zip_filename)
+
         def key_value_of_stringstring(d):
             return {'KeyValueOfstringstring': [{'Key': x, 'Value': y} for x, y in d.items()]}
 
diff --git a/passerelle/locale/fr/LC_MESSAGES/django.po b/passerelle/locale/fr/LC_MESSAGES/django.po
index 005eddae..261b1e2d 100644
--- a/passerelle/locale/fr/LC_MESSAGES/django.po
+++ b/passerelle/locale/fr/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Passerelle 0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-04-04 11:35+0200\n"
+"POT-Creation-Date: 2019-04-17 03:38-0500\n"
 "PO-Revision-Date: 2019-02-21 13:32+0100\n"
 "Last-Translator: Frederic Peters <fpeters@entrouvert.com>\n"
 "Language: fr\n"
@@ -58,6 +58,105 @@ msgstr "Code du pays"
 msgid "City Name"
 msgstr "Nom de la ville"
 
+#: passerelle/apps/api_entreprise/models.py:69
+#: passerelle/apps/vivaticket/models.py:135
+msgid "API URL"
+msgstr "URL de l'API"
+
+#: passerelle/apps/api_entreprise/models.py:70
+msgid "API token"
+msgstr "Jeton d'accès aux API (API token)"
+
+#: passerelle/apps/api_entreprise/models.py:72
+#: passerelle/apps/api_particulier/models.py:188
+#: passerelle/apps/arpege_ecp/models.py:32
+#: passerelle/apps/atos_genesys/models.py:35 passerelle/apps/bdp/models.py:26
+#: passerelle/apps/clicrdv/models.py:42 passerelle/apps/cmis/models.py:51
+#: passerelle/apps/family/models.py:121 passerelle/apps/gdc/models.py:28
+#: passerelle/apps/okina/models.py:34 passerelle/apps/pastell/models.py:32
+#: passerelle/apps/solis/models.py:100 passerelle/apps/vivaticket/models.py:139
+#: passerelle/contrib/agoraplus/models.py:122
+#: passerelle/contrib/dpark/models.py:179
+#: passerelle/contrib/fake_family/models.py:31
+#: passerelle/contrib/gdema/models.py:152 passerelle/contrib/greco/models.py:69
+#: passerelle/contrib/grenoble_gru/models.py:72
+#: passerelle/contrib/iparapheur/models.py:83
+#: passerelle/contrib/iws/models.py:95 passerelle/contrib/maarch/models.py:37
+#: passerelle/contrib/mdph13/models.py:56
+#: passerelle/contrib/planitech/models.py:259
+#: passerelle/contrib/seisin_by_email/models.py:37
+#: passerelle/contrib/solis_apa/models.py:53
+#: passerelle/contrib/teamnet_axel/models.py:77
+msgid "Business Process Connectors"
+msgstr "Connecteurs métiers"
+
+#: passerelle/apps/api_entreprise/models.py:75
+msgid "API Entreprise"
+msgstr "API Entreprise"
+
+#: passerelle/apps/api_entreprise/models.py:124
+msgid "Get association's documents"
+msgstr "Récupéter les documents de l'associaiton"
+
+#: passerelle/apps/api_entreprise/models.py:127
+#: passerelle/apps/api_entreprise/models.py:266
+msgid "association id"
+msgstr "identifiant de l'association"
+
+#: passerelle/apps/api_entreprise/models.py:131
+#: passerelle/apps/api_entreprise/models.py:182
+#: passerelle/apps/api_entreprise/models.py:216
+#: passerelle/apps/api_entreprise/models.py:243
+#: passerelle/apps/api_entreprise/models.py:270
+#: passerelle/apps/api_entreprise/models.py:298
+msgid "request object"
+msgstr "objet de l'appel"
+
+#: passerelle/apps/api_entreprise/models.py:135
+#: passerelle/apps/api_entreprise/models.py:186
+#: passerelle/apps/api_entreprise/models.py:220
+#: passerelle/apps/api_entreprise/models.py:247
+#: passerelle/apps/api_entreprise/models.py:274
+#: passerelle/apps/api_entreprise/models.py:302
+msgid "request context"
+msgstr "cadre de l'appel"
+
+#: passerelle/apps/api_entreprise/models.py:139
+#: passerelle/apps/api_entreprise/models.py:190
+#: passerelle/apps/api_entreprise/models.py:224
+#: passerelle/apps/api_entreprise/models.py:251
+#: passerelle/apps/api_entreprise/models.py:278
+#: passerelle/apps/api_entreprise/models.py:306
+msgid "request recipient: usually customer number"
+msgstr "bénéficiaire de l'appel (généralement SIRET de l'administration)"
+
+#: passerelle/apps/api_entreprise/models.py:171
+msgid "Get institution's document"
+msgstr "Récupérer un document de l'association"
+
+#: passerelle/apps/api_entreprise/models.py:174
+#: passerelle/apps/api_entreprise/models.py:212
+#: passerelle/apps/api_entreprise/models.py:239
+#: passerelle/apps/api_entreprise/models.py:294
+msgid "institution id"
+msgstr "identifiant de l'organisation (SIREN)"
+
+#: passerelle/apps/api_entreprise/models.py:178
+msgid "document id"
+msgstr "identifiant du document"
+
+#: passerelle/apps/api_entreprise/models.py:209
+msgid "Get institution's data from Infogreffe"
+msgstr "Récupérer les données de l'organisation depuis Infogreffe"
+
+#: passerelle/apps/api_entreprise/models.py:236
+#: passerelle/apps/api_entreprise/models.py:263
+#: passerelle/apps/api_entreprise/models.py:291
+#, fuzzy
+#| msgid "Get citizen's fiscal informations"
+msgid "Get institution's related informations"
+msgstr "Récupérer les données fiscales d'un citoyen"
+
 #: passerelle/apps/api_particulier/models.py:38
 msgid "Production"
 msgstr "Production"
@@ -111,28 +210,6 @@ msgstr "code postal"
 msgid "recipient identifier"
 msgstr "numéro de l'allocataire"
 
-#: passerelle/apps/api_particulier/models.py:188
-#: passerelle/apps/arpege_ecp/models.py:32
-#: passerelle/apps/atos_genesys/models.py:35 passerelle/apps/bdp/models.py:26
-#: passerelle/apps/clicrdv/models.py:42 passerelle/apps/cmis/models.py:51
-#: passerelle/apps/family/models.py:121 passerelle/apps/gdc/models.py:28
-#: passerelle/apps/okina/models.py:34 passerelle/apps/pastell/models.py:32
-#: passerelle/apps/solis/models.py:100 passerelle/apps/vivaticket/models.py:134
-#: passerelle/contrib/agoraplus/models.py:122
-#: passerelle/contrib/dpark/models.py:179
-#: passerelle/contrib/fake_family/models.py:31
-#: passerelle/contrib/gdema/models.py:152 passerelle/contrib/greco/models.py:69
-#: passerelle/contrib/grenoble_gru/models.py:72
-#: passerelle/contrib/iparapheur/models.py:83
-#: passerelle/contrib/iws/models.py:95 passerelle/contrib/maarch/models.py:37
-#: passerelle/contrib/mdph13/models.py:56
-#: passerelle/contrib/planitech/models.py:259
-#: passerelle/contrib/seisin_by_email/models.py:37
-#: passerelle/contrib/solis_apa/models.py:53
-#: passerelle/contrib/teamnet_axel/models.py:77
-msgid "Business Process Connectors"
-msgstr "Connecteurs métiers"
-
 #: passerelle/apps/api_particulier/models.py:191
 msgid "API Particulier"
 msgstr "API Particulier"
@@ -328,34 +405,34 @@ msgstr ""
 msgid "Base Adresse Web Service"
 msgstr "Service Web Base Adresse"
 
-#: passerelle/apps/base_adresse/models.py:200
+#: passerelle/apps/base_adresse/models.py:207
 #: passerelle/apps/family/models.py:396 passerelle/apps/family/models.py:437
 #: passerelle/contrib/iws/models.py:159
 msgid "City"
 msgstr "Ville"
 
-#: passerelle/apps/base_adresse/models.py:201
+#: passerelle/apps/base_adresse/models.py:208
 #: passerelle/apps/family/models.py:392 passerelle/apps/family/models.py:433
 msgid "Street name"
 msgstr "Nom de la voie"
 
-#: passerelle/apps/base_adresse/models.py:202
+#: passerelle/apps/base_adresse/models.py:209
 msgid "Street name ascii char"
 msgstr "Nom de la voie (en ASCII)"
 
-#: passerelle/apps/base_adresse/models.py:203
+#: passerelle/apps/base_adresse/models.py:210
 msgid "Postal code"
 msgstr "Code postal"
 
-#: passerelle/apps/base_adresse/models.py:204
+#: passerelle/apps/base_adresse/models.py:211
 msgid "Street type"
 msgstr "Type de la voie"
 
-#: passerelle/apps/base_adresse/models.py:205
+#: passerelle/apps/base_adresse/models.py:212
 msgid "City Code"
 msgstr "Code de la ville (INSEE)"
 
-#: passerelle/apps/base_adresse/models.py:206
+#: passerelle/apps/base_adresse/models.py:213
 #: passerelle/contrib/tcl/models.py:159 passerelle/contrib/tcl/models.py:243
 msgid "Last update"
 msgstr "Dernière mise à jour"
@@ -1771,35 +1848,31 @@ msgstr ""
 "Filtrer les éléments ayant ces codes (liste de codes séparés par des "
 "virgules)"
 
-#: passerelle/apps/vivaticket/models.py:130
-msgid "API URL"
-msgstr "URL de l'API"
-
-#: passerelle/apps/vivaticket/models.py:131
+#: passerelle/apps/vivaticket/models.py:136
 msgid "API Login"
 msgstr "Login pour l'API"
 
-#: passerelle/apps/vivaticket/models.py:132
+#: passerelle/apps/vivaticket/models.py:137
 msgid "API Password"
 msgstr "Mot de passe pour l'API"
 
-#: passerelle/apps/vivaticket/models.py:191
+#: passerelle/apps/vivaticket/models.py:196
 msgid "Get event categories"
 msgstr "Récupérer les catégories d'événements"
 
-#: passerelle/apps/vivaticket/models.py:195
+#: passerelle/apps/vivaticket/models.py:200
 msgid "Get rooms"
 msgstr "Récupérer les salles"
 
-#: passerelle/apps/vivaticket/models.py:202
+#: passerelle/apps/vivaticket/models.py:207
 msgid "Get themes"
 msgstr "Récupérer les thèmes"
 
-#: passerelle/apps/vivaticket/models.py:244
+#: passerelle/apps/vivaticket/models.py:249
 msgid "Book an event"
 msgstr "Réserver un événement"
 
-#: passerelle/apps/vivaticket/models.py:246
+#: passerelle/apps/vivaticket/models.py:251
 msgid "Creates a booking for an event"
 msgstr "Créer une réservation pour un événement"
 
-- 
2.20.1

