From 8759477cf53e3866b34f6b54759ded8b43ea618c Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 11 Aug 2023 14:48:23 +0200 Subject: [PATCH] Check-in: New scan type "print" --- doc/api/resources/checkin.rst | 2 +- doc/api/resources/checkinlists.rst | 2 +- src/pretix/base/models/checkin.py | 4 +++- src/pretix/base/services/checkin.py | 8 ++++---- src/pretix/control/logdisplay.py | 14 ++++++++++++++ .../templates/pretixcontrol/checkin/checkins.html | 1 + .../templates/pretixcontrol/order/index.html | 2 ++ 7 files changed, 26 insertions(+), 7 deletions(-) diff --git a/doc/api/resources/checkin.rst b/doc/api/resources/checkin.rst index 551294de1a..86cebc2b0d 100644 --- a/doc/api/resources/checkin.rst +++ b/doc/api/resources/checkin.rst @@ -34,7 +34,7 @@ Checking a ticket in : dt: + if type not in (Checkin.TYPE_PRINT, Checkin.TYPE_EXIT) and op.valid_from and op.valid_from > dt: if force: force_used = True else: @@ -787,7 +787,7 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict, ), ) - if type != Checkin.TYPE_EXIT and op.valid_until and op.valid_until < dt: + if type not in (Checkin.TYPE_PRINT, Checkin.TYPE_EXIT) and op.valid_until and op.valid_until < dt: if force: force_used = True else: @@ -886,9 +886,9 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict, if isinstance(auth, Device): device = auth - last_cis = list(op.checkins.order_by('-datetime').filter(list=clist).only('type', 'nonce')) + last_cis = list(op.checkins.order_by('-datetime').filter(list=clist, type__in=(Checkin.TYPE_ENTRY, Checkin.TYPE_EXIT)).only('type', 'nonce')) entry_allowed = ( - type == Checkin.TYPE_EXIT or + type in (Checkin.TYPE_EXIT, Checkin.TYPE_PRINT) or clist.allow_multiple_entries or not last_cis or all(c.type == Checkin.TYPE_EXIT for c in last_cis) or diff --git a/src/pretix/control/logdisplay.py b/src/pretix/control/logdisplay.py index ed6f38310a..b6ce0d77b8 100644 --- a/src/pretix/control/logdisplay.py +++ b/src/pretix/control/logdisplay.py @@ -295,6 +295,20 @@ def _display_checkin(event, logentry): posid=data.get('positionid'), list=checkin_list ) + + if data.get('type') == Checkin.TYPE_PRINT: + if show_dt: + return _('Position #{posid} has been printed out at {datetime} for list "{list}".').format( + posid=data.get('positionid'), + datetime=dt_formatted, + list=checkin_list + ) + else: + return _('Position #{posid} has been printed out for list "{list}".').format( + posid=data.get('positionid'), + list=checkin_list + ) + if data.get('first'): if show_dt: return _('Position #{posid} has been checked in at {datetime} for list "{list}".').format( diff --git a/src/pretix/control/templates/pretixcontrol/checkin/checkins.html b/src/pretix/control/templates/pretixcontrol/checkin/checkins.html index 3d40d15261..23fdf9a4c6 100644 --- a/src/pretix/control/templates/pretixcontrol/checkin/checkins.html +++ b/src/pretix/control/templates/pretixcontrol/checkin/checkins.html @@ -95,6 +95,7 @@ {% if c.type == "exit" %}{% endif %} {% if c.type == "entry" %}{% endif %} + {% if c.type == "print" %}{% endif %} {{ c.get_type_display }}
diff --git a/src/pretix/control/templates/pretixcontrol/order/index.html b/src/pretix/control/templates/pretixcontrol/order/index.html index 7050cd23b7..74a6b34ed2 100644 --- a/src/pretix/control/templates/pretixcontrol/order/index.html +++ b/src/pretix/control/templates/pretixcontrol/order/index.html @@ -385,6 +385,8 @@ {% else %} {% endif %} + {% elif c.type == "print" %} + {% elif c.forced %} {% elif c.auto_checked_in %}