mirror of
https://github.com/pretix/pretix.git
synced 2026-06-21 02:56:16 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ce7c1870ea | |||
| 91e923805a | |||
| c1c7043da7 | |||
| fd4e87352b | |||
| dbf5dc0ef5 | |||
| a1f796da9e | |||
| 3a10a5387e | |||
| 6d405a608f |
+2
-1
@@ -10,7 +10,8 @@ tests:
|
||||
- cd src
|
||||
- python manage.py check
|
||||
- make all compress
|
||||
- PRETIX_CONFIG_FILE=tests/ci_sqlite.cfg py.test -n 3 tests --ignore=tests/e2e --maxfail=100
|
||||
- playwright install
|
||||
- PRETIX_CONFIG_FILE=tests/ci_sqlite.cfg py.test -n 3 tests --maxfail=100
|
||||
except:
|
||||
- '/^v.*$/'
|
||||
pypi:
|
||||
|
||||
@@ -872,7 +872,6 @@ def _redeem_process(*, checkinlists, raw_barcode, answers_data, datetime, force,
|
||||
'media_policy': e.media_policy,
|
||||
'media_type': e.media_type,
|
||||
'list': MiniCheckinListSerializer(list_by_event[op.order.event_id]).data,
|
||||
'reason': e.code,
|
||||
'reason_explanation': e.msg,
|
||||
}, status=400)
|
||||
except CheckInError as e:
|
||||
|
||||
@@ -74,7 +74,6 @@ class LocaleMiddleware(MiddlewareMixin):
|
||||
|
||||
def process_request(self, request: HttpRequest):
|
||||
language = get_language_from_request(request)
|
||||
region = None
|
||||
# Normally, this middleware runs *before* the event is set. However, on event frontend pages it
|
||||
# might be run a second time by pretix.presale.EventMiddleware and in this case the event is already
|
||||
# set and can be taken into account for the decision.
|
||||
@@ -95,16 +94,15 @@ class LocaleMiddleware(MiddlewareMixin):
|
||||
if '-' not in language and settings_holder.settings.region:
|
||||
language += '-' + settings_holder.settings.region
|
||||
if settings_holder.settings.region:
|
||||
region = settings_holder.settings.region
|
||||
set_region(settings_holder.settings.region)
|
||||
else:
|
||||
gs = global_settings_object(request)
|
||||
if '-' not in language and gs.settings.region:
|
||||
language += '-' + gs.settings.region
|
||||
if gs.settings.region:
|
||||
region = gs.settings.region
|
||||
set_region(gs.settings.region)
|
||||
|
||||
translation.activate(language)
|
||||
set_region(region)
|
||||
request.LANGUAGE_CODE = get_language_without_region()
|
||||
|
||||
tzname = None
|
||||
|
||||
@@ -1342,13 +1342,7 @@ class QuestionAnswerFilterForm(forms.Form):
|
||||
opqs = opqs.filter(canceled=False)
|
||||
if fdata.get("item", "") != "":
|
||||
i = fdata.get("item", "")
|
||||
if '-' in i:
|
||||
opqs = opqs.filter(
|
||||
item_id=i.split('-')[0],
|
||||
variation_id=i.split('-')[1],
|
||||
)
|
||||
else:
|
||||
opqs = opqs.filter(item_id=i)
|
||||
opqs = opqs.filter(item_id__in=(i,))
|
||||
|
||||
return opqs
|
||||
|
||||
|
||||
@@ -270,18 +270,18 @@ class ReportExporter(ReportlabExportMixin, BaseExporter):
|
||||
def _transaction_group_header_label(self):
|
||||
return _("Event") + " / " + _("Product")
|
||||
|
||||
def _transaction_group(self, form_data, r):
|
||||
def _transaction_group_label(self, form_data, r):
|
||||
if not self.is_multievent and not form_data.get("split_subevents"):
|
||||
return None, None
|
||||
return None
|
||||
if r.get("subevent_id"):
|
||||
return "{} - {} ({}) [{}]".format(
|
||||
r["order__event__name"],
|
||||
r["subevent__name"],
|
||||
date_format(r["subevent__date_from"]),
|
||||
r["order__event__slug"]
|
||||
), f"subevent-{r['subevent_id']}"
|
||||
)
|
||||
else:
|
||||
return "{} [{}]".format(r["order__event__name"], r["order__event__slug"]), f"event-{r['order__event__slug']}"
|
||||
return "{} [{}]".format(r["order__event__name"], r["order__event__slug"])
|
||||
|
||||
def _transaction_row_label(self, r):
|
||||
if r["item_id"]:
|
||||
@@ -343,17 +343,17 @@ class ReportExporter(ReportlabExportMixin, BaseExporter):
|
||||
last_group = None
|
||||
last_group_head_idx = 0
|
||||
for r in qs:
|
||||
group_label, group_id = self._transaction_group(form_data, r)
|
||||
e = self._transaction_group_label(form_data, r)
|
||||
|
||||
if group_id != last_group:
|
||||
if last_group_head_idx > 0 and group_id is not None:
|
||||
if e != last_group:
|
||||
if last_group_head_idx > 0 and e is not None:
|
||||
tdata[last_group_head_idx][4] = Paragraph(money_filter(sum_price_by_group - sum_tax_by_group, currency), tstyle_bold_right),
|
||||
tdata[last_group_head_idx][5] = Paragraph(money_filter(sum_tax_by_group, currency), tstyle_bold_right),
|
||||
tdata[last_group_head_idx][6] = Paragraph(money_filter(sum_price_by_group, currency), tstyle_bold_right),
|
||||
tdata.append(
|
||||
[
|
||||
FontFallbackParagraph(
|
||||
group_label,
|
||||
e,
|
||||
tstyle_bold,
|
||||
),
|
||||
"",
|
||||
@@ -367,7 +367,7 @@ class ReportExporter(ReportlabExportMixin, BaseExporter):
|
||||
tstyledata.append(
|
||||
("SPAN", (0, len(tdata) - 1), (3, len(tdata) - 1)),
|
||||
)
|
||||
last_group = group_id
|
||||
last_group = e
|
||||
last_group_head_idx = len(tdata) - 1
|
||||
sum_price_by_group = Decimal("0.00")
|
||||
sum_tax_by_group = Decimal("0.00")
|
||||
|
||||
@@ -2051,16 +2051,9 @@ var shared_root_methods = {
|
||||
this.$root.set_cart_id(data.cart_id);
|
||||
this.$root.overlay.frame_loading = false;
|
||||
callback()
|
||||
}, (xhr, data) => {
|
||||
if (xhr.status === 429 && typeof xhr.responseURL !== "undefined") {
|
||||
this.$root.overlay.error_message = strings['cart_error_429'];
|
||||
this.$root.overlay.frame_loading = false;
|
||||
this.$root.overlay.error_url_after = this.$root.newTabTarget;
|
||||
this.$root.overlay.error_url_after_new_tab = true;
|
||||
} else {
|
||||
}, () => {
|
||||
this.$root.overlay.error_message = strings['cart_error'];
|
||||
this.$root.overlay.frame_loading = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
get_cart_id: function() {
|
||||
@@ -2149,14 +2142,7 @@ var shared_root_computed = {
|
||||
if (this.subevent) {
|
||||
target = this.target_url + this.subevent + '/';
|
||||
}
|
||||
var parameters = this.$root.consent_parameter
|
||||
if (this.$root.additionalURLParams) {
|
||||
parameters += `&${this.$root.additionalURLParams}`
|
||||
}
|
||||
if (parameters) {
|
||||
target += '?' + parameters.replace(/^&/, '')
|
||||
}
|
||||
return target
|
||||
return target;
|
||||
},
|
||||
useIframe: function () {
|
||||
if (window.crossOriginIsolated === true) {
|
||||
|
||||
@@ -162,15 +162,7 @@ export function createWidgetStore (config: {
|
||||
return params.toString()
|
||||
},
|
||||
newTabTarget (): string {
|
||||
let url = this.subevent ? `${this.targetUrl}${this.subevent}/` : this.targetUrl
|
||||
let parameters = this.consentParameter
|
||||
if (this.additionalURLParams) {
|
||||
parameters += `&${this.additionalURLParams}`
|
||||
}
|
||||
if (parameters) {
|
||||
url += '?' + parameters.replace(/^&/, '')
|
||||
}
|
||||
return url
|
||||
return this.subevent ? `${this.targetUrl}${this.subevent}/` : this.targetUrl
|
||||
},
|
||||
formTarget (): string {
|
||||
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox')
|
||||
@@ -449,7 +441,6 @@ export function createWidgetStore (config: {
|
||||
this.overlay.frameLoading = false
|
||||
this.overlay.errorUrlAfter = this.newTabTarget
|
||||
this.overlay.errorUrlAfterNewTab = true
|
||||
return
|
||||
} else if (e.status === 405) {
|
||||
// Likely a redirect!
|
||||
this.targetUrl = e.responseUrl.substring(0, e.responseUrl.indexOf('/cart/add') - 18)
|
||||
@@ -469,18 +460,11 @@ export function createWidgetStore (config: {
|
||||
this.overlay.frameLoading = true
|
||||
const data = await createCart(url)
|
||||
this.setCartId(data.cart_id)
|
||||
return true
|
||||
} catch (e) {
|
||||
if (e instanceof ApiError && e.status === 429) {
|
||||
this.overlay.errorMessage = STRINGS.cart_error_429
|
||||
this.overlay.frameLoading = false
|
||||
this.overlay.errorUrlAfter = this.newTabTarget
|
||||
this.overlay.errorUrlAfterNewTab = true
|
||||
} else if (e instanceof ApiError && (e.status === 200 || (e.status >= 400 && e.status < 500))) {
|
||||
if (e instanceof ApiError && (e.status === 200 || (e.status >= 400 && e.status < 500))) {
|
||||
this.overlay.errorMessage = STRINGS.cart_error
|
||||
this.overlay.frameLoading = false
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
redeem (voucherCode: string, event?: Event) {
|
||||
@@ -500,7 +484,7 @@ export function createWidgetStore (config: {
|
||||
async resume () {
|
||||
if (!this.cartId && this.keepCart) {
|
||||
// create an empty cart whose id we can persist
|
||||
if (!await this.createCart()) return
|
||||
await this.createCart()
|
||||
}
|
||||
let redirectUrl = `${this.targetUrl}w/${globalWidgetId}/`
|
||||
if (this.subevent && this.isButton && this.items.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user