Add customizable terms of cancellation (Z#23135646) (#3704)

* Order: show user_cancel_deadline

* move to own parapgraph

* Remove date, add free text input for terms
This commit is contained in:
Richard Schreiber
2023-11-16 12:29:57 +01:00
committed by GitHub
parent 71e515f9c2
commit baf6144ee7
5 changed files with 54 additions and 24 deletions

View File

@@ -796,6 +796,8 @@ class EventSettingsSerializer(SettingsSerializer):
'cancel_allow_user_paid_refund_as_giftcard',
'cancel_allow_user_paid_require_approval',
'cancel_allow_user_paid_require_approval_fee_unknown',
'cancel_terms_paid',
'cancel_terms_unpaid',
'change_allow_user_variation',
'change_allow_user_addons',
'change_allow_user_until',

View File

@@ -1936,6 +1936,32 @@ DEFAULTS = {
label=_("Do not allow cancellations after"),
)
},
'cancel_terms_paid': {
'default': None,
'type': LazyI18nString,
'serializer_class': I18nField,
'form_class': I18nFormField,
'form_kwargs': dict(
label=_("Terms of cancellation"),
widget=I18nTextarea,
widget_kwargs={'attrs': {'rows': '2'}},
help_text=_("This text will be shown when cancellation is allowed for a paid order. Leave empty if you "
"want pretix to automatically generate the terms of cancellation based on your settings.")
)
},
'cancel_terms_unpaid': {
'default': None,
'type': LazyI18nString,
'serializer_class': I18nField,
'form_class': I18nFormField,
'form_kwargs': dict(
label=_("Terms of cancellation"),
widget=I18nTextarea,
widget_kwargs={'attrs': {'rows': '2'}},
help_text=_("This text will be shown when cancellation is allowed for an unpaid or free order. Leave empty "
"if you want pretix to automatically generate the terms of cancellation based on your settings.")
)
},
'contact_mail': {
'default': None,
'type': str,

View File

@@ -730,6 +730,8 @@ class CancelSettingsForm(SettingsForm):
'cancel_allow_user_paid_refund_as_giftcard',
'cancel_allow_user_paid_require_approval',
'cancel_allow_user_paid_require_approval_fee_unknown',
'cancel_terms_paid',
'cancel_terms_unpaid',
'change_allow_user_variation',
'change_allow_user_price',
'change_allow_user_until',

View File

@@ -14,6 +14,7 @@
{% bootstrap_field form.cancel_allow_user_unpaid_keep layout="control" %}
{% bootstrap_field form.cancel_allow_user_unpaid_keep_percentage layout="control" %}
{% bootstrap_field form.cancel_allow_user_unpaid_keep_fees layout="control" %}
{% bootstrap_field form.cancel_terms_unpaid layout="control" %}
</fieldset>
<fieldset>
<legend>{% trans "Paid orders" %}</legend>
@@ -32,6 +33,7 @@
{% bootstrap_field form.cancel_allow_user_paid_adjust_fees_step layout="control" %}
</div>
{% bootstrap_field form.cancel_allow_user_paid_refund_as_giftcard layout="control" %}
{% bootstrap_field form.cancel_terms_paid layout="control" %}
{% if not gets_notification %}
<div class="alert alert-warning">
{% blocktrans trimmed %}

View File

@@ -368,7 +368,9 @@
{% if user_cancel_allowed %}
<li class="list-group-item">
{% if order.status == "p" and order.total != 0 %}
{% if request.event.settings.cancel_allow_user_paid_require_approval and request.event.settings.cancel_allow_user_paid_require_approval_fee_unknown %}
{% if request.event.settings.cancel_terms_paid %}
{{ request.event.settings.cancel_terms_paid|rich_text }}
{% elif request.event.settings.cancel_allow_user_paid_require_approval and request.event.settings.cancel_allow_user_paid_require_approval_fee_unknown %}
<p>
{% blocktrans trimmed %}
You can request to cancel this order.
@@ -445,35 +447,31 @@
{% trans "This will invalidate all tickets in this order." %}
</p>
{% endif %}
{% else %}
<p>
{% if request.event.settings.cancel_terms_unpaid %}
{{ request.event.settings.cancel_terms_unpaid|rich_text }}
{% elif order.total != 0 and order.user_cancel_fee %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. As per our cancellation policy, you will still be required
to pay a cancellation fee of <strong>{{ fee }}</strong>.
{% endblocktrans %}
{% trans "This will invalidate all tickets in this order." %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% trans "This will invalidate all tickets in this order." %}
{% endif %}
</p>
{% endif %}
<p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove" aria-hidden="true"></span>
{% trans "Cancel order" %}
</a>
</p>
{% else %}
<p>
{% if order.total != 0 and order.user_cancel_fee %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. As per our cancellation policy, you will still be required
to pay a cancellation fee of <strong>{{ fee }}</strong>.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
<p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove" aria-hidden="true"></span>
{% trans "Cancel order" %}
</a>
</p>
{% endif %}
</p>
</li>
{% endif %}
</ul>