Skip to content

Commit 6d81e93

Browse files
authored
Fix: Deleted products preventing attendee export (#867)
1 parent 7bb3307 commit 6d81e93

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

backend/app/Exports/AttendeesExport.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,18 @@ public function map($attendee): array
9797

9898
/** @var ProductDomainObject $ticket */
9999
$ticket = $attendee->getProduct();
100-
$ticketName = $ticket->getTitle();
101-
if ($ticket->getType() === ProductPriceType::TIERED->name) {
100+
$ticketName = $ticket?->getTitle();
101+
if ($ticket && $ticket->getType() === ProductPriceType::TIERED->name) {
102102
$ticketName .= ' - ' . $ticket
103103
->getProductPrices()
104104
->first(fn(ProductPriceDomainObject $tp) => $tp->getId() === $attendee->getProductPriceId())
105105
->getLabel();
106106
}
107107

108+
if (!$ticketName) {
109+
$ticketName = __('Unknown');
110+
}
111+
108112
$checkIns = $attendee->getCheckIns()
109113
? $attendee->getCheckIns()
110114
->map(fn($checkIn) => sprintf(

backend/app/Repository/Eloquent/ProductRepository.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ public function hasAssociatedOrders(int $productId): bool
256256
{
257257
return $this->db->table('order_items')
258258
->join('orders', 'order_items.order_id', '=', 'orders.id')
259-
->whereIn('orders.status', [OrderStatus::COMPLETED->name, OrderStatus::CANCELLED->name])
259+
->whereIn('orders.status', [
260+
OrderStatus::COMPLETED->name,
261+
OrderStatus::CANCELLED->name,
262+
OrderStatus::AWAITING_OFFLINE_PAYMENT->name,
263+
])
260264
->where('order_items.product_id', $productId)
261265
->exists();
262266
}

0 commit comments

Comments
 (0)