From 8209afb369906b903565ee386b2cf5f861a0b70a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= <jschneider@entrouvert.com>
Date: Fri, 3 Oct 2014 11:06:12 +0200
Subject: [PATCH] dossiers: update transport cerfa to the last version

Closes #5473
---
 .../cerfa_50742_03_prescription_transport.pdf      | Bin 35036 -> 40254 bytes
 .../generate_transport_prescription_form.html      |   5 +-
 calebasse/dossiers/transport.py                    |   1 -
 calebasse/dossiers/transport_template.py           |  87 ++++++++++++---------
 4 files changed, 52 insertions(+), 41 deletions(-)

diff --git a/calebasse/dossiers/static/dossiers/cerfa_50742_03_prescription_transport.pdf b/calebasse/dossiers/static/dossiers/cerfa_50742_03_prescription_transport.pdf
index 81d9ec817c17c00e9a109257445a20cc9a676f03..ed5e39380bfd0a4831a5695f45483d0bac14ba9c 100644
GIT binary patch
diff --git a/calebasse/dossiers/templates/dossiers/generate_transport_prescription_form.html b/calebasse/dossiers/templates/dossiers/generate_transport_prescription_form.html
index 38202da..90566f2 100644
--- a/calebasse/dossiers/templates/dossiers/generate_transport_prescription_form.html
+++ b/calebasse/dossiers/templates/dossiers/generate_transport_prescription_form.html
@@ -33,7 +33,7 @@
     <em>(Maximum 3 lignes de 110 caractères.)</em>
     <textarea id="id_address" rows="3" cols="60" name="trajet_text">{{ choices.trajet_text }}</textarea><br/>
     Transport aller <input type="checkbox" name="trajet_choice_1" value="trajet_choice_1" {% if choices.trajet_choice_1 %}checked{% endif %}/> Transport retour <input type="checkbox" name="trajet_choice_2" value="trajet_choice_2" {% if choices.trajet_choice_2 %}checked{% endif %}/> Transport aller-retour <input type="checkbox" name="trajet_choice_3" value="trajet_choice_3" {% if choices.trajet_choice_3 %}checked{% endif %}/><br/>
-    Transport itératif <input type="checkbox" name="trajet_choice_4" value="trajet_choice_4" {% if choices.trajet_choice_4 %}checked{% endif %}/> Nombre <input id="id_trajet_nombre" type="text" name="trajet_number" value="{{ choices.trajet_number }}" %}"/>
+    Si transport en série, indiquez le nombre <input id="id_trajet_nombre" type="text" name="trajet_number" value="{{ choices.trajet_number }}" %}"/>
     </p>
 
     <p><strong>Ce transport est-il lié à une condition de prise en charge à 100% ? (grossesse de plus de 6 mois, ALD exonérante, AT/MP, autre... Se référer à la notice)</strong><br/>
@@ -54,7 +54,8 @@
     </p>
 
     <p><strong>Conditions particulières</strong><br/>
-    Appel du centre 15 <input type="checkbox" name="cdts_choice_1" value="cdts_choice_1" {% if choices.cdts_choice_1 %}checked{% endif %}/> Nécessité d'une asepsie rigoureuse <input type="checkbox" name="cdts_choice_2" value="cdts_choice_2" {% if choices.cdts_choice_2 %}checked{% endif %}/>
+    Nécessité d'une asepsie rigoureuse <input type="checkbox" name="cdts_choice_1" value="cdts_choice_1" {% if choices.cdts_choice_1 %}checked{% endif %}/><br/>
+    Urgence attestée par le médecin prescripteur <input type="checkbox" name="cdts_choice_2" value="cdts_choice_2" {% if choices.cdts_choice_2 %}checked{% endif %}/>
     </p>
 
     <p><strong>Signature</strong><br/>
diff --git a/calebasse/dossiers/transport.py b/calebasse/dossiers/transport.py
index 4f5b4ea..68c2697 100644
--- a/calebasse/dossiers/transport.py
+++ b/calebasse/dossiers/transport.py
@@ -29,7 +29,6 @@ def render_transport(patient, address, data={}):
         'TRAJET_CHOICE_1': 'trajet_choice_1' in data,
         'TRAJET_CHOICE_2': 'trajet_choice_2' in data,
         'TRAJET_CHOICE_3': 'trajet_choice_3' in data,
-        'TRAJET_CHOICE_4': 'trajet_choice_4' in data,
         'TRAJET_NUMBER': data.get('trajet_number', ''),
         'PC_CHOICE_1': 'pc_choice_1' in data,
         'PC_CHOICE_2': 'pc_choice_2' in data,
diff --git a/calebasse/dossiers/transport_template.py b/calebasse/dossiers/transport_template.py
index 36b607b..31b1aa0 100644
--- a/calebasse/dossiers/transport_template.py
+++ b/calebasse/dossiers/transport_template.py
@@ -13,130 +13,127 @@ from ..pdftk import PdfTk
 class TransportTemplate(object):
     fields = {
             'NOM_BENEFICIAIRE': {
-                'pos': (302, 186),
+                'pos': (302, 172),
             },
             'PRENOM_BENEFICIAIRE': {
-                'pos': (136, 200),
+                'pos': (136, 186),
             },
             'DATE': {
-                'pos': (532, 597),
-                'size': 8,
+                'pos': (530, 582),
+                'size': 7,
             },
             'LIEU': {
-                'pos': (596, 597),
+                'pos': (591, 583),
+                'size': 7,
             },
             'IDENTIFICATION_ETABLISSEMENT': {
                 'type': 'multiline',
-                'pos': (510, 652),
+                'pos': (510, 638),
             },
             'NIR_ASSURE': {
-                'pos': (325, 800),
+                'pos': (325, 781),
                 'size': 10,
             },
             'NIR_KEY_ASSURE': {
-                'pos': (527, 800),
+                'pos': (527, 781),
                 'size': 10,
             },
             'NOM_ASSURE': {
-                'pos': (492, 825),
+                'pos': (492, 805),
             },
             'CODE_ORGANISME_1': {
-                'pos': (328, 850),
+                'pos': (328, 832),
                 'size': 10,
             },
             'CODE_ORGANISME_2': {
-                'pos': (357, 850),
+                'pos': (357, 832),
                 'size': 10,
             },
             'CODE_ORGANISME_3': {
-                'pos': (401, 850),
+                'pos': (401, 832),
                 'size': 10,
             },
             'ADRESSE_BENEFICIAIRE': {
-                'pos': (92, 891),
+                'pos': (94, 873),
             },
             'SITUATION_CHOICE_1': {
-                'pos': (393, 264),
+                'pos': (386, 241),
                 'type': 'bool',
             },
             'SITUATION_CHOICE_2': {
-                'pos': (393, 280),
+                'pos': (386, 262),
                 'type': 'bool',
             },
             'SITUATION_CHOICE_3': {
-                'pos': (719, 264),
+                'pos': (711, 240),
                 'type': 'bool',
             },
             'SITUATION_CHOICE_4': {
-                'pos': (719, 280),
+                'pos': (711, 259),
                 'type': 'bool',
             },
             'SITUATION_DATE': {
-                'pos': (610, 299),
+                'pos': (606, 280),
                 'size': 8,
             },
             'TRAJET_TEXT': {
-                'pos': (84, 340),
+                'pos': (84, 320),
                 'size': 8,
             },
             'TRAJET_CHOICE_1': {
-                'pos': (201, 396),
+                'pos': (193, 375),
                 'type': 'bool',
             },
             'TRAJET_CHOICE_2': {
-                'pos': (454, 396),
+                'pos': (441, 375),
                 'type': 'bool',
             },
             'TRAJET_CHOICE_3': {
-                'pos': (719, 396),
-                'type': 'bool',
-            },
-            'TRAJET_CHOICE_4': {
-                'pos': (201, 419),
+                'pos': (711, 376),
                 'type': 'bool',
             },
             'TRAJET_NUMBER': {
-                'pos': (305, 409),
+                'pos': (308, 383),
                 'size': 8,
             },
             'PC_CHOICE_1': {
-                'pos': (567, 435),
+                'pos': (564, 410),
                 'type': 'bool',
             },
             'PC_CHOICE_2': {
-                'pos': (642, 435),
+                'pos': (638, 410),
                 'type': 'bool',
             },
             'MODE_CHOICE_1': {
-                'pos': (321, 484),
+                'pos': (320, 473),
                 'type': 'bool',
             },
             'MODE_CHOICE_2': {
-                'pos': (321, 499),
+                'pos': (320, 488),
                 'type': 'bool',
             },
             'MODE_CHOICE_3': {
-                'pos': (321, 515),
+                'pos': (320, 504),
                 'type': 'bool',
             },
             'MODE_CHOICE_4': {
-                'pos': (568, 528),
+                'pos': (564, 517),
                 'type': 'bool',
             },
             'MODE_CHOICE_5': {
-                'pos': (642, 528),
+                'pos': (638, 517),
                 'type': 'bool',
             },
             'MODE_CHOICE_6': {
-                'pos': (321, 546),
+                'pos': (320, 536),
                 'type': 'bool',
             },
             'CDTS_CHOICE_1': {
-                'pos': (404, 565),
+                'pos': (400, 552),
                 'type': 'bool',
             },
             'CDTS_CHOICE_2': {
-                'pos': (567, 563),
+                'pos': (661, 552),
                 'type': 'bool',
             },
     }
@@ -195,12 +192,26 @@ class TransportTemplate(object):
             for row in value:
                 for x, v in zip(field['cols'], row):
                     sub = {
-                            'pos': (offset + x, y),
                             'size': size,
                     }
                     self.draw_field(ctx, sub, v, 7)
                 y += field['lineheight']
 
+    def draw_grid(self, ctx):
+        ctx.set_source_rgb(0, 0, 0)
+        for i in range(0, 827, 100):
+            ctx.move_to(i, 5)
+            ctx.show_text(str(i // 100));
+            ctx.move_to(i, 0)
+            ctx.line_to(i, 1169)
+            ctx.stroke()
+        for i in range(0, 1169, 100):
+            ctx.move_to(0, i-5)
+            ctx.show_text(str(i // 100))
+            ctx.move_to(0, i)
+            ctx.line_to(827, i)
+            ctx.stroke()
+
     def generate(self, content, delete=True):
         width, height = 827, 1169
         with tempfile.NamedTemporaryFile(prefix=self.prefix,
-- 
2.1.1

