Store information about objects transferred in last successful sync

This commit is contained in:
Mira Weller
2025-03-04 16:18:10 +01:00
parent 87570df3f8
commit e051470e91
6 changed files with 130 additions and 63 deletions

View File

@@ -46,6 +46,7 @@ from django.utils.html import escape, format_html
from django.utils.translation import gettext_lazy as _, pgettext_lazy
from i18nfield.strings import LazyI18nString
from pretix.base.datasync.datasync import sync_targets
from pretix.base.logentrytypes import (
DiscountLogEntryType, EventLogEntryType, ItemCategoryLogEntryType,
ItemLogEntryType, LogEntryType, OrderLogEntryType, QuestionLogEntryType,
@@ -420,11 +421,24 @@ class OrderPrintLogEntryType(OrderLogEntryType):
type=dict(PrintLog.PRINT_TYPES)[data["type"]],
)
@log_entry_types.new_from_dict({
"pretix.event.order.data_sync.success": _("Ticket data successfully transferred to {provider}."),
})
class OrderDataSyncLogentrytype(OrderLogEntryType):
pass
def display(self, logentry, data):
links = []
if data.get('provider') and data.get('objects'):
prov, meta = sync_targets.get(identifier=data['provider'])
if prov:
for objs in data['objects'].values():
links.append(", ".join(
prov.get_external_link_html(logentry.event, obj['external_link_href'], obj['external_link_display_name'])
for obj in objs
if obj and 'external_link_href' in obj and 'external_link_display_name' in obj
))
return mark_safe(super().display(logentry, data) + "".join("<p>" + link + "</p>" for link in links))
@log_entry_types.new_from_dict({