Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Fix: Deleted products preventing attendee export (#867)

Dave Earley6d81e93e3d3d
diff --git a/backend/app/Exports/AttendeesExport.php b/backend/app/Exports/AttendeesExport.php
index 0880642ba..d617a5ca5 100644
--- a/backend/app/Exports/AttendeesExport.php
+++ b/backend/app/Exports/AttendeesExport.php
@@ -97,14 +97,18 @@ class AttendeesExport implements FromCollection, WithHeadings, WithMapping, With
/** @var ProductDomainObject $ticket */
$ticket = $attendee->getProduct();
- $ticketName = $ticket->getTitle();
- if ($ticket->getType() === ProductPriceType::TIERED->name) {
+ $ticketName = $ticket?->getTitle();
+ if ($ticket && $ticket->getType() === ProductPriceType::TIERED->name) {
$ticketName .= ' - ' . $ticket
->getProductPrices()
->first(fn(ProductPriceDomainObject $tp) => $tp->getId() === $attendee->getProductPriceId())
->getLabel();
}
+ if (!$ticketName) {
+ $ticketName = __('Unknown');
+ }
+
$checkIns = $attendee->getCheckIns()
? $attendee->getCheckIns()
->map(fn($checkIn) => sprintf(
diff --git a/backend/app/Repository/Eloquent/ProductRepository.php b/backend/app/Repository/Eloquent/ProductRepository.php
index 707bec536..7d2a45090 100644
--- a/backend/app/Repository/Eloquent/ProductRepository.php
+++ b/backend/app/Repository/Eloquent/ProductRepository.php
@@ -256,7 +256,11 @@ class ProductRepository extends BaseRepository implements ProductRepositoryInter
{
return $this->db->table('order_items')
->join('orders', 'order_items.order_id', '=', 'orders.id')
- ->whereIn('orders.status', [OrderStatus::COMPLETED->name, OrderStatus::CANCELLED->name])
+ ->whereIn('orders.status', [
+ OrderStatus::COMPLETED->name,
+ OrderStatus::CANCELLED->name,
+ OrderStatus::AWAITING_OFFLINE_PAYMENT->name,
+ ])
->where('order_items.product_id', $productId)
->exists();
}