Check-in: New error reason for unapproved orders (#3741)

* Check-in: New error reason for unapproved orders

* Fix documentation verbiage
This commit is contained in:
Raphael Michel
2023-11-28 12:50:29 +01:00
committed by GitHub
parent 1593eacb6b
commit 965fcec9df
11 changed files with 46 additions and 37 deletions

View File

@@ -352,6 +352,7 @@ class Checkin(models.Model):
REASON_AMBIGUOUS = 'ambiguous'
REASON_ERROR = 'error'
REASON_BLOCKED = 'blocked'
REASON_UNAPPROVED = 'unapproved'
REASON_INVALID_TIME = 'invalid_time'
REASONS = (
(REASON_CANCELED, _('Order canceled')),
@@ -365,6 +366,7 @@ class Checkin(models.Model):
(REASON_AMBIGUOUS, _('Ticket code is ambiguous on list')),
(REASON_ERROR, _('Server error')),
(REASON_BLOCKED, _('Ticket blocked')),
(REASON_UNAPPROVED, _('Order not approved')),
(REASON_INVALID_TIME, _('Ticket not valid at this time')),
)

View File

@@ -874,6 +874,15 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
'blocked'
)
if op.order.status == Order.STATUS_PENDING and op.order.require_approval:
if force:
force_used = True
else:
raise CheckInError(
_('This order is not yet approved.'),
'unapproved',
)
if type != Checkin.TYPE_EXIT and op.valid_from and op.valid_from > dt:
if force:
force_used = True
@@ -941,14 +950,6 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
'product'
)
if op.order.status != Order.STATUS_PAID and op.order.require_approval:
if force:
force_used = True
else:
raise CheckInError(
_('This order is not yet approved.'),
'unpaid'
)
elif op.order.status != Order.STATUS_PAID and not op.order.valid_if_pending and not (
ignore_unpaid and clist.include_pending and op.order.status == Order.STATUS_PENDING
):

View File

@@ -278,8 +278,10 @@ export default {
return this.$root.strings['result.ok']
} else if (this.checkResult.status === 'incomplete') {
return this.$root.strings['result.questions']
} else {
} else if (this.$root.strings['result.' + this.checkResult.reason]) {
return this.$root.strings['result.' + this.checkResult.reason]
} else {
return this.checkResult.reason
}
},
checkResultColor () {

View File

@@ -62,6 +62,7 @@ window.vapp = new Vue({
'result.invalid_time': gettext('Ticket not valid at this time'),
'result.canceled': gettext('Order canceled'),
'result.ambiguous': gettext('Ticket code is ambiguous on list'),
'result.unapproved': gettext('Order not approved'),
'status.checkin': gettext('Checked-in Tickets'),
'status.position': gettext('Valid Tickets'),
'status.inside': gettext('Currently inside'),