@@ 755-764 (lines=10) @@ | ||
752 | $transaction->ID(), |
|
753 | $registration->ticket_ID() |
|
754 | ); |
|
755 | if ( ! $ticket_line_item instanceof EE_Line_Item ) { |
|
756 | throw new EE_Error( |
|
757 | sprintf( |
|
758 | __( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
759 | 'event_espresso' ), |
|
760 | $transaction->ID(), |
|
761 | $registration->ticket_ID() |
|
762 | ) |
|
763 | ); |
|
764 | } |
|
765 | return $ticket_line_item; |
|
766 | } |
|
767 |
@@ 127-129 (lines=3) @@ | ||
124 | * @throws \EE_Error |
|
125 | */ |
|
126 | public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){ |
|
127 | if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) { |
|
128 | throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) ); |
|
129 | } |
|
130 | // either increment the qty for an existing ticket |
|
131 | $line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty ); |
|
132 | // or add a new one |