@@ -203,40 +203,6 @@ public function setAccepted(bool $accepted)
203203 $ this ->accepted_date = $ accepted ? new \DateTime ('now ' , new \DateTimeZone ('UTC ' )) : null ;
204204 }
205205
206- public function isAccepted (): bool
207- {
208-
209- $ bought_tickets = $ this ->getBoughtTicketTypesExcerpt ();
210-
211- Log::debug (sprintf ("SummitRegistrationInvitation::isAccepted %s bought_tickets %s " , $ this ->id , json_encode ($ bought_tickets )));
212- // check if we fullfill the invitation
213-
214- $ invitation_ticket_types = $ this ->ticket_types ;
215- if ($ invitation_ticket_types ->count () === 0 )
216- $ invitation_ticket_types = $ this ->summit ->getTicketTypesByAudience (SummitTicketType::Audience_With_Invitation);
217-
218- if ($ invitation_ticket_types ->count () === 0 )
219- throw new ValidationException
220- (
221- sprintf
222- (
223- "There are not Ticket Types with Audience %s for Summit %s. " ,
224- SummitTicketType::Audience_With_Invitation,
225- $ this ->summit ->getId ()
226- )
227- );
228-
229- foreach ($ invitation_ticket_types as $ ticket_type ){
230- if (!isset ($ bought_tickets [$ ticket_type ->getId ()])){
231- Log::debug (sprintf ("SummitRegistrationInvitation::isAccepted %s ticket type %s is not purchased yet " , $ this ->id , $ ticket_type ->getId ()));
232- $ this ->accepted_date = null ;
233- return false ;
234- }
235- }
236-
237- return !is_null ($ this ->accepted_date );
238- }
239-
240206 public function isSent (): bool
241207 {
242208 return !empty ($ this ->hash );
@@ -432,14 +398,20 @@ public function markAsAccepted(): void
432398
433399 foreach ($ invitation_ticket_types as $ ticket_type ){
434400 if (!isset ($ bought_tickets [$ ticket_type ->getId ()])){
435- Log::debug (sprintf ("SummitRegistrationInvitation::markAsAccepted %s ticket type is not purchased yet " , $ this ->id , $ ticket_type ->getId ()));
401+ Log::debug (sprintf ("SummitRegistrationInvitation::markAsAccepted %s ticket type %s is not purchased yet " , $ this ->id , $ ticket_type ->getId ()));
402+ $ this ->accepted_date = null ;
436403 return ;
437404 }
438405 }
439406 // once i bought all meant ticket types ... the invitation is marked as accepted
440407 $ this ->accepted_date = new \DateTime ('now ' , new \DateTimeZone ('UTC ' ));
441408 }
442409
410+ public function isAccepted (): bool
411+ {
412+ return !is_null ($ this ->accepted_date );
413+ }
414+
443415 public function addOrder (SummitOrder $ order ){
444416 if ($ this ->orders ->contains ($ order )) return ;
445417 $ this ->orders ->add ($ order );
@@ -468,7 +440,6 @@ public function addTicketType(SummitTicketType $ticketType)
468440 }
469441 if ($ this ->ticket_types ->contains ($ ticketType )) return ;
470442 $ this ->ticket_types ->add ($ ticketType );
471- $ this ->accepted_date = null ;
472443 $ this ->markAsAccepted ();
473444 }
474445
0 commit comments