mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Checkout: Delete invoice address if no longer required (Z#23203488) (#5358)
This commit is contained in:
@@ -959,6 +959,10 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||
d['phone'] = str(d['phone'])
|
||||
self.cart_session['contact_form_data'] = d
|
||||
if self.address_asked or self.request.event.settings.invoice_name_required:
|
||||
if not self.address_asked:
|
||||
# Invoice address was there, but is no longer asked for, however, name is still required
|
||||
self.invoice_form.instance.clear(except_name=True)
|
||||
|
||||
addr = self.invoice_form.save()
|
||||
|
||||
if self.cart_customer and self.invoice_form.cleaned_data.get('save'):
|
||||
@@ -997,6 +1001,10 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||
'rate to your purchase and the price of the products in your cart has '
|
||||
'changed accordingly.'))
|
||||
return redirect_to_url(self.get_next_url(request) + '?open_cart=true')
|
||||
elif 'invoice_address' in self.cart_session:
|
||||
# Invoice address was there, but is no longer asked for
|
||||
self.invoice_address.delete()
|
||||
del self.cart_session['invoice_address']
|
||||
|
||||
try:
|
||||
validate_memberships_in_order(self.cart_customer, self.positions, self.request.event, lock=False,
|
||||
|
||||
Reference in New Issue
Block a user