diff --git a/doc/api/resources/orders.rst b/doc/api/resources/orders.rst index 8f0ff758a0..f14fd1b1b8 100644 --- a/doc/api/resources/orders.rst +++ b/doc/api/resources/orders.rst @@ -864,6 +864,9 @@ Generating new secrets Triggers generation of new ``secret`` and ``web_secret`` attributes for both the order and all order positions. + Ticket secrets of order positions that have been used to issue a gift card can not + be changed. Only the link (``web_secret``) will be changed in this case. + **Example request**: .. sourcecode:: http @@ -895,6 +898,9 @@ Generating new secrets Triggers generation of a new ``secret`` and ``web_secret`` attribute for a single order position. + Ticket secrets of order positions that have been used to issue a gift card can not + be changed. Only the link (``web_secret``) will be changed in this case. + **Example request**: .. sourcecode:: http diff --git a/src/pretix/base/secrets.py b/src/pretix/base/secrets.py index da253e531b..a4b1b40bb5 100644 --- a/src/pretix/base/secrets.py +++ b/src/pretix/base/secrets.py @@ -245,6 +245,9 @@ def recv_classic(sender, **kwargs): def assign_ticket_secret(event, position, force_invalidate_if_revokation_list_used=False, force_invalidate=False, save=True): + if position.issued_gift_cards.exists(): + return + gen = event.ticket_secret_generator if gen.use_revocation_list and force_invalidate_if_revokation_list_used: force_invalidate = True diff --git a/src/pretix/base/services/orders.py b/src/pretix/base/services/orders.py index dc73363301..c26226e97d 100644 --- a/src/pretix/base/services/orders.py +++ b/src/pretix/base/services/orders.py @@ -1599,6 +1599,7 @@ class OrderChangeManager: 'seat_forbidden': gettext_lazy('The selected product does not allow to select a seat.'), 'tax_rule_country_blocked': gettext_lazy('The selected country is blocked by your tax rule.'), 'gift_card_change': gettext_lazy('You cannot change the price of a position that has been used to issue a gift card.'), + 'gift_card_secret': gettext_lazy('You cannot change the ticket secret of a position that has been used to issue a gift card.'), 'max_items_per_product': ngettext_lazy( "You cannot select more than %(max)s item of the product %(product)s.", "You cannot select more than %(max)s items of the product %(product)s.", @@ -1756,6 +1757,9 @@ class OrderChangeManager: self._operations.append(self.RegenerateSecretOperation(position)) def change_ticket_secret(self, position: OrderPosition, new_secret: str): + if position.issued_gift_cards.exists(): + raise OrderError(self.error_messages['gift_card_secret']) + self._operations.append(self.ChangeSecretOperation(position, new_secret)) def change_valid_from(self, position: OrderPosition, new_value: datetime): diff --git a/src/pretix/control/templates/pretixcontrol/order/change.html b/src/pretix/control/templates/pretixcontrol/order/change.html index a4dd0c83a7..00d29491c4 100644 --- a/src/pretix/control/templates/pretixcontrol/order/change.html +++ b/src/pretix/control/templates/pretixcontrol/order/change.html @@ -284,6 +284,14 @@