summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--postgresqleu/confsponsor/util.py4
-rw-r--r--postgresqleu/confsponsor/views.py29
-rw-r--r--template.jinja/confsponsor/mail/sponsor_contract_instant.txt10
-rw-r--r--template/confsponsor/admin_sponsor_details.html6
-rw-r--r--template/confsponsor/sponsor.html12
5 files changed, 55 insertions, 6 deletions
diff --git a/postgresqleu/confsponsor/util.py b/postgresqleu/confsponsor/util.py
index d37dd855..c88d87e1 100644
--- a/postgresqleu/confsponsor/util.py
+++ b/postgresqleu/confsponsor/util.py
@@ -174,5 +174,9 @@ 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')),
+ ])
return fields
diff --git a/postgresqleu/confsponsor/views.py b/postgresqleu/confsponsor/views.py
index 4a52186a..81069648 100644
--- a/postgresqleu/confsponsor/views.py
+++ b/postgresqleu/confsponsor/views.py
@@ -218,7 +218,25 @@ def sponsor_view_mail(request, sponsorid, mailid):
def sponsor_contractview(request, sponsorid):
sponsor, is_admin = _get_sponsor_and_admin(sponsorid, request)
- if not sponsor.contract.completed:
+ if not sponsor.level.contract:
+ # Should not happen
+ raise Http404("No contract at this level")
+
+ if sponsor.level.instantbuy:
+ # Click-through contract
+
+ resp = HttpResponse(content_type='application/pdf')
+ resp['Content-disposition'] = 'filename="%s.pdf"' % sponsor.name
+ resp.write(fill_pdf_fields(
+ sponsor.level.contract.contractpdf,
+ get_pdf_fields_for_conference(sponsor.conference, sponsor),
+ sponsor.level.contract.fieldjson,
+ ))
+ return resp
+
+ # Regular contract
+
+ if not (sponsor.contract and sponsor.contract.completed):
raise Http404("Contract not completed")
resp = HttpResponse(content_type='application/pdf')
@@ -368,7 +386,7 @@ def _generate_and_send_sponsor_contract(sponsor):
send_sponsor_manager_email(
sponsor,
'Your contract for {}'.format(conference.conferencename),
- 'confsponsor/mail/sponsor_contract_manual.txt',
+ 'confsponsor/mail/{}.txt'.format('sponsor_contract_instant' if level.instantbuy else 'sponsor_contract_manual'),
{
'conference': conference,
'sponsor': sponsor,
@@ -517,6 +535,11 @@ def sponsor_signup(request, confurlname, levelurlname):
error = None
if level.instantbuy:
+ if sponsor.level.contract:
+ # Instantbuy levels that has a contract should get an implicit contract
+ # attached to an email.
+ _generate_and_send_sponsor_contract(sponsor)
+
mailstr += "Level does not require a signed contract. Verify the details and approve\nthe sponsorship using:\n\n{0}/events/sponsor/admin/{1}/{2}/".format(
settings.SITEBASE, conference.urlname, sponsor.id)
else:
@@ -922,6 +945,8 @@ def sponsor_contract_preview(request, contractid):
get_pdf_fields_for_conference(contract.conference, overrides={
'static:sponsor': 'PREVIEW ONLY - sponsor company name',
'static:euvat': 'PREVIEW ONLY - do not sign this contract',
+ 'static:clickthrough': 'PREVIEW ONLY - no signature',
+ 'static:clickthrougdate': 'PREVIEW ONLY',
}),
contract.fieldjson,
)
diff --git a/template.jinja/confsponsor/mail/sponsor_contract_instant.txt b/template.jinja/confsponsor/mail/sponsor_contract_instant.txt
new file mode 100644
index 00000000..79f78f03
--- /dev/null
+++ b/template.jinja/confsponsor/mail/sponsor_contract_instant.txt
@@ -0,0 +1,10 @@
+Hello!
+
+You have signed up to be a sponsor of
+{{conference.conferencename}}
+for sponsorship level {{sponsor.level}}.
+
+This level uses a click-through contract model. Attached is a
+copy of the contract you agreed to by signing up.
+
+Thank you for your support of {{conference.conferencename}}!
diff --git a/template/confsponsor/admin_sponsor_details.html b/template/confsponsor/admin_sponsor_details.html
index dc3c88d1..371c3148 100644
--- a/template/confsponsor/admin_sponsor_details.html
+++ b/template/confsponsor/admin_sponsor_details.html
@@ -40,7 +40,11 @@
<th>Contract:</th>
<td>
{%if sponsor.level.instantbuy %}
- No contract needed, level is "instant buy". <form class="inline-block-form" method="post" action="resendcontract/">{% csrf_token %}<input type="submit" class="btn btn-sm btn-default confirm-btn" value="Re-send contract anyway" data-confirm="Are you sure you want to re-send a new contract to this sponsor?{%if sponsor.signmethod == 0%} {{conference.contractprovider.implementation.resendprompt}}{%endif%} Note that the level is instant buy, instructions may be confusing!"></form>
+ {%if sponsor.level.contract %}
+ Click-through contract completed. <form class="inline-block-form" method="post" action="resendcontract/">{% csrf_token %}<input type="submit" class="btn btn-sm btn-default confirm-btn" value="Re-send contract anyway" data-confirm="Are you sure you want to re-send a new contract to this sponsor?{%if sponsor.signmethod == 0%} {{conference.contractprovider.implementation.resendprompt}}{%endif%}"></form>
+ {%else%}
+ No contract needed for this level.
+ {%endif%}
{%else%}
{%if sponsor.signmethod == 0%}
Digital contract.<br/>
diff --git a/template/confsponsor/sponsor.html b/template/confsponsor/sponsor.html
index 3bb92aaf..da8f878e 100644
--- a/template/confsponsor/sponsor.html
+++ b/template/confsponsor/sponsor.html
@@ -34,14 +34,20 @@
<th>Status:</th>
<td>{%if sponsor.confirmed%}Confirmed ({{sponsor.confirmedat}}){%else%}<i>Awaiting confirmation</i>{%endif%}</td>
</tr>
-{% if sponsor.confirmed %}
+{% if sponsor.confirmed and sponsor.level.contract %}
<tr>
<th>Contract:</th>
- <td>{%if sponsor.signmethod == 0%}
+ <td>
+{% if sponsor.level.instantbuy %}
+ Click-through contract agreed to. <a href="contractview/" class="btn btn-outline-dark btn-sm">View copy of contract</a>
+{% else %}
+{%if sponsor.signmethod == 0%}
Digital contract completed {{sponsor.contract.completed}}.
{%if sponsor.contract.completed and sponsor.contract.has_completed_pdf %}<a href="contractview/" class="btn btn-outline-dark btn-sm">View signed contract</a>{%endif%}
{% else %}
-Manual contract.{% endif %}
+Manual contract.
+{% endif %}
+{% endif %}
</td>
</tr>
{% endif %}