wcs-dynexport : paliatif aux corrections de formulaires en cours de route…
authorProgfou <jean-christophe.andre@auf.org>
Mon, 2 Nov 2015 18:44:41 +0000 (13:44 -0500)
committerProgfou <jean-christophe.andre@auf.org>
Mon, 2 Nov 2015 18:44:41 +0000 (13:44 -0500)
wcs/wcs-dynexport

index f6726f4..df72210 100755 (executable)
@@ -292,6 +292,22 @@ def get_wcs_form_data(domain, form):
                 continue
             field_name = fields[field_id]['name']
             data = object.data.get(field_id)
+            # paliatif aux corrections de formulaires en cours de route
+            # (compensation nécessaire pour l'import depuis Sigma 2)
+            if data is None and field.required:
+                if isinstance(field, StringField) \
+                or isinstance(field, TextField) \
+                or isinstance(field, EmailField) \
+                or isinstance(field, ItemField):
+                    result[field_name] = '(vide)'
+                elif isinstance(field, ItemsField) \
+                  or isinstance(field, TableField):
+                    result[field_name] = '(vide)'
+                elif isinstance(field, BoolField):
+                    result[field_name] = False
+                elif isinstance(field, DateField):
+                    result[field_name] = "9999-12-31"
+                continue
             if data is None:
                 result[field_name] = None
                 continue