Don't add click-though text to non-clickthrough contracts
authorMagnus Hagander <magnus@hagander.net>
Tue, 27 May 2025 07:39:42 +0000 (09:39 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 27 May 2025 07:39:42 +0000 (09:39 +0200)
If the clickthrough fields were added to a contract, we'd include the
text even if the level wasn't clickthrough. This can happen when fields
are copied between contracts, thereby ending up with clickthrough fields
on non-clickthrough contracts.

postgresqleu/confsponsor/util.py

index f379e393171b4bac3c79863811a918abb4082920..f9daeafac4e57ab8a99cc25128f57990cfa4c2d1 100644 (file)
@@ -175,9 +175,11 @@ def get_pdf_fields_for_conference(conference, sponsor=None, overrides={}):
         fields.append(
             ('static:euvat', sponsor.vatnumber if sponsor else overrides.get('static:euvat', 'Sponsor EU VAT number')),
         )
-    fields.extend([
-        ('static:clickthrough', overrides.get('static:clickthrough', 'Click-through agreement')),
-        ('static:clickthroughdate', str(sponsor.signupat.date()) if sponsor else overrides.get('static:clickthroughdate', 'Click-through date')),
-    ])
+    if sponsor and sponsor.level.contractlevel == 1:
+        # Only add clickthrough contract fields if it's a clickthrough level (or a preview, with no sponsor yet)
+        fields.extend([
+            ('static:clickthrough', overrides.get('static:clickthrough', 'Click-through agreement')),
+            ('static:clickthroughdate', str(sponsor.signupat.date()) if sponsor else overrides.get('static:clickthroughdate', 'Click-through date')),
+        ])
 
     return fields