From 7ec2340b17ea27bbd2e7894d3be6f6ccc499240b Mon Sep 17 00:00:00 2001 From: Dimitrios Pantazis Date: Tue, 7 Jan 2025 14:18:41 +0200 Subject: [PATCH] Fix existing attendee format to be only ints or nulls --- src/Tickets/Commerce/Attendee.php | 3 +++ src/Tickets/Commerce/Flag_Actions/Generate_Attendees.php | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Tickets/Commerce/Attendee.php b/src/Tickets/Commerce/Attendee.php index a5efdeee58..1a8dd3da6c 100644 --- a/src/Tickets/Commerce/Attendee.php +++ b/src/Tickets/Commerce/Attendee.php @@ -501,6 +501,9 @@ public function upsert( \WP_Post $order, $ticket, array $args = [], ?int $existi $update_args['fields'] = $fields; } + // No need to update the security code. + unset( $update_args['security_code'] ); + /** * Allow the filtering of the update arguments for attendee. * diff --git a/src/Tickets/Commerce/Flag_Actions/Generate_Attendees.php b/src/Tickets/Commerce/Flag_Actions/Generate_Attendees.php index 84d49147d7..d0985a295d 100644 --- a/src/Tickets/Commerce/Flag_Actions/Generate_Attendees.php +++ b/src/Tickets/Commerce/Flag_Actions/Generate_Attendees.php @@ -123,8 +123,12 @@ public function handle( Status_Interface $new_status, $old_status, \WP_Post $ord 'ticket_id' => $ticket->ID, 'event_id' => $ticket->get_event_id(), ] - )->fields( 'ids' )->all( true ) as $attendee_id + )->get_ids( true ) as $attendee_id ) { + if ( ! is_int( $attendee_id ) || 0 >= $attendee_id ) { + $existing[] = null; + continue; + } $existing[] = $attendee_id; }