Completed
Branch BUG/3560-ticket-taxes (10a1d2)
by
unknown
11:08 queued 08:59
created
single_page_checkout/templates/registration_page_wrapper.template.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,91 +1,91 @@
 block discarded – undo
1 1
 <div id="ee-single-page-checkout-dv" class="">
2 2
     <?php
3
-    if (! $empty_cart) {
4
-        if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
3
+	if (! $empty_cart) {
4
+		if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
5 5
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
6 6
                style="display: none;">
7 7
                 <?php echo sprintf(
8
-                    apply_filters(
9
-                        'FHEE__registration_page_wrapper_template___time_limit',
10
-                        __('You have %1$s to complete your registration.', 'event_espresso')
11
-                    ),
12
-                    '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' . $registration_time_limit . '</span>'
13
-                );
14
-                ?>
8
+					apply_filters(
9
+						'FHEE__registration_page_wrapper_template___time_limit',
10
+						__('You have %1$s to complete your registration.', 'event_espresso')
11
+					),
12
+					'<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' . $registration_time_limit . '</span>'
13
+				);
14
+				?>
15 15
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
16 16
             </p>
17 17
         <?php }
18
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
19
-            ?>
18
+		if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
19
+			?>
20 20
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"><?php _e(' Steps', 'event_espresso'); ?></h2>
21 21
 
22 22
             <div id="spco-steps-display-dv">
23 23
                 <?php
24
-                $step_nmbr = 1;
25
-                $total_steps = count($reg_steps) - 1;
26
-                foreach ($reg_steps as $reg_step) {
27
-                    if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
28
-                        $slug = $reg_step->slug();
29
-                        $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
30
-                        ?>
24
+				$step_nmbr = 1;
25
+				$total_steps = count($reg_steps) - 1;
26
+				foreach ($reg_steps as $reg_step) {
27
+					if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
28
+						$slug = $reg_step->slug();
29
+						$step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
30
+						?>
31 31
                         <div id="spco-step-<?php echo $slug; ?>-display-dv"
32 32
                              class="spco-step-display-dv <?php echo $step_display_dv_class; ?> steps-<?php echo $total_steps; ?>">
33 33
                             <h4 id="spco-step-<?php echo $slug; ?>-display-hdr" class="spco-steps-display-hdr">
34 34
                                 <span class="spco-step-big-nmbr"><?php echo $step_nmbr; ?></span>
35 35
                                 <span class="spco-step-name">
36 36
                                     <?php echo str_replace(
37
-                                        '&nbsp;',
38
-                                        '<br/>&nbsp;',
39
-                                        $reg_step->name()
40
-                                    ); ?>
37
+										'&nbsp;',
38
+										'<br/>&nbsp;',
39
+										$reg_step->name()
40
+									); ?>
41 41
                                 </span>
42 42
                             </h4>
43 43
                         </div>
44 44
 
45 45
                         <?php
46
-                        if ($step_nmbr < $total_steps) { ?>
46
+						if ($step_nmbr < $total_steps) { ?>
47 47
                             <div class="spco-step-arrow-dv">&raquo;</div>
48 48
                             <?php
49
-                        }
50
-                        $step_nmbr++;
51
-                    }
52
-                }
53
-                ?>
49
+						}
50
+						$step_nmbr++;
51
+					}
52
+				}
53
+				?>
54 54
                 <div class="clear-float"></div>
55 55
             </div>
56 56
 
57 57
             <?php
58
-        }
58
+		}
59 59
 
60
-        do_action('AHEE__SPCO__before_registration_steps');
61
-        $step_nmbr = 1;
62
-        foreach ($reg_steps as $reg_step) {
63
-            if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
64
-                $slug = $reg_step->slug();
65
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
66
-                // todo: deprecate hook AHEE__registration_page_attendee_information__start
67
-                ?>
60
+		do_action('AHEE__SPCO__before_registration_steps');
61
+		$step_nmbr = 1;
62
+		foreach ($reg_steps as $reg_step) {
63
+			if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
64
+				$slug = $reg_step->slug();
65
+				do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
66
+				// todo: deprecate hook AHEE__registration_page_attendee_information__start
67
+				?>
68 68
                 <div id="spco-<?php echo $slug; ?>-dv" class="spco-step-dv <?php echo $reg_step->div_class(); ?>">
69 69
                     <?php echo $reg_step->display_reg_form(); ?>
70 70
                     <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?>
71 71
                 </div>
72 72
                 <?php $step_nmbr++;
73
-            }
74
-        }
75
-        do_action('AHEE__SPCO__after_registration_steps');
76
-    } else {
77
-        ?>
73
+			}
74
+		}
75
+		do_action('AHEE__SPCO__after_registration_steps');
76
+	} else {
77
+		?>
78 78
         <h3 id="spco-empty-cart-hdr" class="spco-step-title-hdr">
79 79
             <?php esc_html_e(
80
-                'Nothing in your Event Queue',
81
-                'event_espresso'
82
-            ); ?></h3>
80
+				'Nothing in your Event Queue',
81
+				'event_espresso'
82
+			); ?></h3>
83 83
         <p><?php echo $empty_msg; ?></p>
84 84
         <?php echo $cookies_not_set_msg; ?>
85 85
         <?php
86
-    }
87
-    do_action('AHEE__SPCO__reg_form_footer');
88
-    ?>
86
+	}
87
+	do_action('AHEE__SPCO__reg_form_footer');
88
+	?>
89 89
 
90 90
 </div>
91 91
 
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorRowStandard.php 2 patches
Indentation   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -18,360 +18,360 @@
 block discarded – undo
18 18
 class TicketSelectorRowStandard extends TicketSelectorRow
19 19
 {
20 20
 
21
-    /**
22
-     * @var TicketDetails $ticket_details
23
-     */
24
-    protected $ticket_details;
25
-
26
-    /**
27
-     * @var \EE_Ticket_Selector_Config $template_settings
28
-     */
29
-    protected $template_settings;
30
-
31
-    /**
32
-     * @var EE_Tax_Config $tax_settings
33
-     */
34
-    protected $tax_settings;
35
-
36
-    /**
37
-     * @var boolean $prices_displayed_including_taxes
38
-     */
39
-    protected $prices_displayed_including_taxes;
40
-
41
-    /**
42
-     * @var int $row
43
-     */
44
-    protected $row;
45
-
46
-    /**
47
-     * @var int $cols
48
-     */
49
-    protected $cols;
50
-
51
-    /**
52
-     * @var boolean $hidden_input_qty
53
-     */
54
-    protected $hidden_input_qty;
55
-
56
-    /**
57
-     * @var string $ticket_datetime_classes
58
-     */
59
-    protected $ticket_datetime_classes;
60
-
61
-
62
-    /**
63
-     * TicketDetails constructor.
64
-     *
65
-     * @param TicketDetails $ticket_details
66
-     * @param EE_Tax_Config $tax_settings
67
-     * @param int           $total_tickets
68
-     * @param int           $max_attendees
69
-     * @param int           $row
70
-     * @param int           $cols
71
-     * @param boolean       $required_ticket_sold_out
72
-     * @param string        $event_status
73
-     * @param string        $ticket_datetime_classes
74
-     * @throws EE_Error
75
-     * @throws UnexpectedEntityException
76
-     */
77
-    public function __construct(
78
-        TicketDetails $ticket_details,
79
-        EE_Tax_Config $tax_settings,
80
-        $total_tickets,
81
-        $max_attendees,
82
-        $row,
83
-        $cols,
84
-        $required_ticket_sold_out,
85
-        $event_status,
86
-        $ticket_datetime_classes
87
-    ) {
88
-        $this->ticket_details = $ticket_details;
89
-        $this->template_settings = $ticket_details->getTemplateSettings();
90
-        $this->tax_settings = $tax_settings;
91
-        $this->row = $row;
92
-        $this->cols = $cols;
93
-        $this->ticket_datetime_classes = $ticket_datetime_classes;
94
-        parent::__construct(
95
-            $ticket_details->getTicket(),
96
-            $max_attendees,
97
-            $ticket_details->getDateFormat(),
98
-            $event_status,
99
-            $required_ticket_sold_out,
100
-            $total_tickets
101
-        );
102
-    }
103
-
104
-
105
-    /**
106
-     * other ticket rows will need to know if a required ticket is sold out,
107
-     * so that they are not offered for sale
108
-     *
109
-     * @return boolean
110
-     */
111
-    public function getRequiredTicketSoldOut()
112
-    {
113
-        return $this->required_ticket_sold_out;
114
-    }
115
-
116
-
117
-    /**
118
-     * @return int
119
-     */
120
-    public function getCols()
121
-    {
122
-        return $this->cols;
123
-    }
124
-
125
-
126
-    /**
127
-     * getHtml
128
-     *
129
-     * @return string
130
-     * @throws EE_Error
131
-     */
132
-    public function getHtml()
133
-    {
134
-        $this->min = 0;
135
-        $this->max = $this->ticket->max();
136
-        $remaining = $this->ticket->remaining();
137
-        $this->setTicketMinAndMax($remaining);
138
-        // set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
139
-        $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
140
-            ? $this->ticket->start_date()
141
-            : $this->required_ticket_sold_out;
142
-        $this->setTicketPriceDetails();
143
-        $this->setTicketStatusClasses($remaining);
144
-        $filtered_row_html = $this->getFilteredRowHtml();
145
-        if ($filtered_row_html !== false) {
146
-            return $filtered_row_html;
147
-        }
148
-        $ticket_selector_row_html = EEH_HTML::tr(
149
-            '',
150
-            '',
151
-            "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
152
-            . espresso_get_object_css_class($this->ticket)
153
-        );
154
-        $filtered_row_content = $this->getFilteredRowContents();
155
-        if ($filtered_row_content !== false && $this->max_attendees === 1) {
156
-            return $ticket_selector_row_html
157
-                   . $filtered_row_content
158
-                   . $this->ticketQtyAndIdHiddenInputs()
159
-                   . EEH_HTML::trx();
160
-        }
161
-        if ($filtered_row_content !== false) {
162
-            return $ticket_selector_row_html
163
-                   . $filtered_row_content
164
-                   . EEH_HTML::trx();
165
-        }
166
-        $this->hidden_input_qty = $this->max_attendees > 1;
167
-
168
-        $ticket_selector_row_html .= $this->ticketNameTableCell();
169
-        $ticket_selector_row_html .= $this->ticketPriceTableCell();
170
-        $ticket_selector_row_html .= EEH_HTML::td(
171
-            '',
172
-            '',
173
-            'tckt-slctr-tbl-td-qty cntr',
174
-            '',
175
-            'headers="quantity-' . $this->EVT_ID . '"'
176
-        );
177
-        $this->setTicketStatusDisplay($remaining);
178
-        if (empty($this->ticket_status_display)) {
179
-            if ($this->max_attendees === 1) {
180
-                // only ONE attendee is allowed to register at a time
181
-                $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
182
-            } elseif ($this->max > 0) {
183
-                $ticket_selector_row_html .= $this->ticketQuantitySelector();
184
-            }
185
-        }
186
-        $ticket_selector_row_html .= $this->ticket_status_display;
187
-        $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
188
-        $ticket_selector_row_html .= $this->ticket_details->display(
189
-            $this->ticket_price,
190
-            $remaining,
191
-            $this->cols
192
-        );
193
-        $ticket_selector_row_html .= EEH_HTML::tdx();
194
-        $ticket_selector_row_html .= EEH_HTML::trx();
195
-
196
-
197
-        $this->row++;
198
-        return $ticket_selector_row_html;
199
-    }
200
-
201
-
202
-    /**
203
-     * getTicketPriceDetails
204
-     *
205
-     * @return void
206
-     * @throws EE_Error
207
-     */
208
-    protected function setTicketPriceDetails()
209
-    {
210
-        $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
211
-            ? $this->ticket->get_ticket_total_with_taxes()
212
-            : $this->ticket->get_ticket_subtotal();
213
-        $this->ticket_bundle = false;
214
-        $ticket_min = $this->ticket->min();
215
-        // for ticket bundles, set min and max qty the same
216
-        if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
217
-            $this->ticket_price *= $ticket_min;
218
-            $this->ticket_bundle = true;
219
-        }
220
-        $this->ticket_price = apply_filters(
221
-            'FHEE__ticket_selector_chart_template__ticket_price',
222
-            $this->ticket_price,
223
-            $this->ticket
224
-        );
225
-    }
226
-
227
-
228
-    /**
229
-     * ticketNameTableCell
230
-     *
231
-     * @return string
232
-     * @throws EE_Error
233
-     */
234
-    protected function ticketNameTableCell()
235
-    {
236
-        $html = EEH_HTML::td(
237
-            '',
238
-            '',
239
-            'tckt-slctr-tbl-td-name',
240
-            '',
241
-            'headers="details-' . $this->EVT_ID . '"'
242
-        );
243
-        $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
244
-        $html .= $this->ticket_details->getShowHideLinks();
245
-        if ($this->ticket->required()) {
246
-            $html .= EEH_HTML::p(
247
-                apply_filters(
248
-                    'FHEE__ticket_selector_chart_template__ticket_required_message',
249
-                    esc_html__('This ticket is required and must be purchased.', 'event_espresso')
250
-                ),
251
-                '',
252
-                'ticket-required-pg'
253
-            );
254
-        }
255
-        $html .= EEH_HTML::tdx();
256
-        return $html;
257
-    }
258
-
259
-
260
-    /**
261
-     * ticketPriceTableCell
262
-     *
263
-     * @return string
264
-     * @throws EE_Error
265
-     */
266
-    protected function ticketPriceTableCell()
267
-    {
268
-        $html = '';
269
-        if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
270
-            $html .= EEH_HTML::td(
271
-                '',
272
-                '',
273
-                'tckt-slctr-tbl-td-price jst-rght',
274
-                '',
275
-                'headers="price-' . $this->EVT_ID . '"'
276
-            );
277
-            $html .= EEH_HTML::span(
278
-                EEH_Template::format_currency($this->ticket_price),
279
-                '',
280
-                'tckt-price--nowrap'
281
-            );
282
-            $html .= $this->ticket->taxable()
283
-                ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
284
-                : '';
285
-            $html .= '&nbsp;';
286
-            // phpcs:disable WordPress.WP.I18n.NoEmptyStrings
287
-            $html .= EEH_HTML::span(
288
-                $this->ticket_bundle
289
-                    ? apply_filters(
290
-                        'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
291
-                        __(' / bundle', 'event_espresso')
292
-                    )
293
-                    : apply_filters(
294
-                        'FHEE__ticket_selector_chart_template__per_ticket_text',
295
-                        __('', 'event_espresso')
296
-                    ),
297
-                '',
298
-                'smaller-text no-bold'
299
-            );
300
-            $html .= '&nbsp;';
301
-            $html .= EEH_HTML::tdx();
302
-            $this->cols++;
303
-        }
304
-        return $html;
305
-    }
306
-
307
-
308
-    /**
309
-     * onlyOneAttendeeCanRegister
310
-     *
311
-     * @return string
312
-     */
313
-    protected function onlyOneAttendeeCanRegister()
314
-    {
315
-        // display submit button since we have tickets available
316
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
317
-        $this->hidden_input_qty = false;
318
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
319
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
320
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
321
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
322
-        $html .= ' id="' . $id . '"';
323
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
324
-        $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
325
-        $html .= ' title=""/>';
326
-        return $html;
327
-    }
328
-
329
-
330
-    /**
331
-     * ticketQuantitySelector
332
-     *
333
-     * @return string
334
-     * @throws EE_Error
335
-     */
336
-    protected function ticketQuantitySelector()
337
-    {
338
-        // display submit button since we have tickets available
339
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
340
-        $this->hidden_input_qty = false;
341
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
342
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
343
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
344
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
345
-        $html .= ' id="' . $id . '"';
346
-        $html .= ' class="ticket-selector-tbl-qty-slct">';
347
-        // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
348
-        if ($this->min !== 0 && ! $this->ticket->required()) {
349
-            $html .= '<option value="0">&nbsp;0&nbsp;</option>';
350
-        }
351
-        // offer ticket quantities from the min to the max
352
-        for ($i = $this->min; $i <= $this->max; $i++) {
353
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
354
-        }
355
-        $html .= '</select>';
356
-        return $html;
357
-    }
358
-
359
-
360
-    /**
361
-     * getHiddenInputs
362
-     *
363
-     * @return string
364
-     * @throws EE_Error
365
-     */
366
-    protected function ticketQtyAndIdHiddenInputs()
367
-    {
368
-        $html = '';
369
-        // depending on group reg we need to change the format for qty
370
-        if ($this->hidden_input_qty) {
371
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
372
-        }
373
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
374
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
375
-        return $html;
376
-    }
21
+	/**
22
+	 * @var TicketDetails $ticket_details
23
+	 */
24
+	protected $ticket_details;
25
+
26
+	/**
27
+	 * @var \EE_Ticket_Selector_Config $template_settings
28
+	 */
29
+	protected $template_settings;
30
+
31
+	/**
32
+	 * @var EE_Tax_Config $tax_settings
33
+	 */
34
+	protected $tax_settings;
35
+
36
+	/**
37
+	 * @var boolean $prices_displayed_including_taxes
38
+	 */
39
+	protected $prices_displayed_including_taxes;
40
+
41
+	/**
42
+	 * @var int $row
43
+	 */
44
+	protected $row;
45
+
46
+	/**
47
+	 * @var int $cols
48
+	 */
49
+	protected $cols;
50
+
51
+	/**
52
+	 * @var boolean $hidden_input_qty
53
+	 */
54
+	protected $hidden_input_qty;
55
+
56
+	/**
57
+	 * @var string $ticket_datetime_classes
58
+	 */
59
+	protected $ticket_datetime_classes;
60
+
61
+
62
+	/**
63
+	 * TicketDetails constructor.
64
+	 *
65
+	 * @param TicketDetails $ticket_details
66
+	 * @param EE_Tax_Config $tax_settings
67
+	 * @param int           $total_tickets
68
+	 * @param int           $max_attendees
69
+	 * @param int           $row
70
+	 * @param int           $cols
71
+	 * @param boolean       $required_ticket_sold_out
72
+	 * @param string        $event_status
73
+	 * @param string        $ticket_datetime_classes
74
+	 * @throws EE_Error
75
+	 * @throws UnexpectedEntityException
76
+	 */
77
+	public function __construct(
78
+		TicketDetails $ticket_details,
79
+		EE_Tax_Config $tax_settings,
80
+		$total_tickets,
81
+		$max_attendees,
82
+		$row,
83
+		$cols,
84
+		$required_ticket_sold_out,
85
+		$event_status,
86
+		$ticket_datetime_classes
87
+	) {
88
+		$this->ticket_details = $ticket_details;
89
+		$this->template_settings = $ticket_details->getTemplateSettings();
90
+		$this->tax_settings = $tax_settings;
91
+		$this->row = $row;
92
+		$this->cols = $cols;
93
+		$this->ticket_datetime_classes = $ticket_datetime_classes;
94
+		parent::__construct(
95
+			$ticket_details->getTicket(),
96
+			$max_attendees,
97
+			$ticket_details->getDateFormat(),
98
+			$event_status,
99
+			$required_ticket_sold_out,
100
+			$total_tickets
101
+		);
102
+	}
103
+
104
+
105
+	/**
106
+	 * other ticket rows will need to know if a required ticket is sold out,
107
+	 * so that they are not offered for sale
108
+	 *
109
+	 * @return boolean
110
+	 */
111
+	public function getRequiredTicketSoldOut()
112
+	{
113
+		return $this->required_ticket_sold_out;
114
+	}
115
+
116
+
117
+	/**
118
+	 * @return int
119
+	 */
120
+	public function getCols()
121
+	{
122
+		return $this->cols;
123
+	}
124
+
125
+
126
+	/**
127
+	 * getHtml
128
+	 *
129
+	 * @return string
130
+	 * @throws EE_Error
131
+	 */
132
+	public function getHtml()
133
+	{
134
+		$this->min = 0;
135
+		$this->max = $this->ticket->max();
136
+		$remaining = $this->ticket->remaining();
137
+		$this->setTicketMinAndMax($remaining);
138
+		// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
139
+		$this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
140
+			? $this->ticket->start_date()
141
+			: $this->required_ticket_sold_out;
142
+		$this->setTicketPriceDetails();
143
+		$this->setTicketStatusClasses($remaining);
144
+		$filtered_row_html = $this->getFilteredRowHtml();
145
+		if ($filtered_row_html !== false) {
146
+			return $filtered_row_html;
147
+		}
148
+		$ticket_selector_row_html = EEH_HTML::tr(
149
+			'',
150
+			'',
151
+			"tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
152
+			. espresso_get_object_css_class($this->ticket)
153
+		);
154
+		$filtered_row_content = $this->getFilteredRowContents();
155
+		if ($filtered_row_content !== false && $this->max_attendees === 1) {
156
+			return $ticket_selector_row_html
157
+				   . $filtered_row_content
158
+				   . $this->ticketQtyAndIdHiddenInputs()
159
+				   . EEH_HTML::trx();
160
+		}
161
+		if ($filtered_row_content !== false) {
162
+			return $ticket_selector_row_html
163
+				   . $filtered_row_content
164
+				   . EEH_HTML::trx();
165
+		}
166
+		$this->hidden_input_qty = $this->max_attendees > 1;
167
+
168
+		$ticket_selector_row_html .= $this->ticketNameTableCell();
169
+		$ticket_selector_row_html .= $this->ticketPriceTableCell();
170
+		$ticket_selector_row_html .= EEH_HTML::td(
171
+			'',
172
+			'',
173
+			'tckt-slctr-tbl-td-qty cntr',
174
+			'',
175
+			'headers="quantity-' . $this->EVT_ID . '"'
176
+		);
177
+		$this->setTicketStatusDisplay($remaining);
178
+		if (empty($this->ticket_status_display)) {
179
+			if ($this->max_attendees === 1) {
180
+				// only ONE attendee is allowed to register at a time
181
+				$ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
182
+			} elseif ($this->max > 0) {
183
+				$ticket_selector_row_html .= $this->ticketQuantitySelector();
184
+			}
185
+		}
186
+		$ticket_selector_row_html .= $this->ticket_status_display;
187
+		$ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
188
+		$ticket_selector_row_html .= $this->ticket_details->display(
189
+			$this->ticket_price,
190
+			$remaining,
191
+			$this->cols
192
+		);
193
+		$ticket_selector_row_html .= EEH_HTML::tdx();
194
+		$ticket_selector_row_html .= EEH_HTML::trx();
195
+
196
+
197
+		$this->row++;
198
+		return $ticket_selector_row_html;
199
+	}
200
+
201
+
202
+	/**
203
+	 * getTicketPriceDetails
204
+	 *
205
+	 * @return void
206
+	 * @throws EE_Error
207
+	 */
208
+	protected function setTicketPriceDetails()
209
+	{
210
+		$this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
211
+			? $this->ticket->get_ticket_total_with_taxes()
212
+			: $this->ticket->get_ticket_subtotal();
213
+		$this->ticket_bundle = false;
214
+		$ticket_min = $this->ticket->min();
215
+		// for ticket bundles, set min and max qty the same
216
+		if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
217
+			$this->ticket_price *= $ticket_min;
218
+			$this->ticket_bundle = true;
219
+		}
220
+		$this->ticket_price = apply_filters(
221
+			'FHEE__ticket_selector_chart_template__ticket_price',
222
+			$this->ticket_price,
223
+			$this->ticket
224
+		);
225
+	}
226
+
227
+
228
+	/**
229
+	 * ticketNameTableCell
230
+	 *
231
+	 * @return string
232
+	 * @throws EE_Error
233
+	 */
234
+	protected function ticketNameTableCell()
235
+	{
236
+		$html = EEH_HTML::td(
237
+			'',
238
+			'',
239
+			'tckt-slctr-tbl-td-name',
240
+			'',
241
+			'headers="details-' . $this->EVT_ID . '"'
242
+		);
243
+		$html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
244
+		$html .= $this->ticket_details->getShowHideLinks();
245
+		if ($this->ticket->required()) {
246
+			$html .= EEH_HTML::p(
247
+				apply_filters(
248
+					'FHEE__ticket_selector_chart_template__ticket_required_message',
249
+					esc_html__('This ticket is required and must be purchased.', 'event_espresso')
250
+				),
251
+				'',
252
+				'ticket-required-pg'
253
+			);
254
+		}
255
+		$html .= EEH_HTML::tdx();
256
+		return $html;
257
+	}
258
+
259
+
260
+	/**
261
+	 * ticketPriceTableCell
262
+	 *
263
+	 * @return string
264
+	 * @throws EE_Error
265
+	 */
266
+	protected function ticketPriceTableCell()
267
+	{
268
+		$html = '';
269
+		if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
270
+			$html .= EEH_HTML::td(
271
+				'',
272
+				'',
273
+				'tckt-slctr-tbl-td-price jst-rght',
274
+				'',
275
+				'headers="price-' . $this->EVT_ID . '"'
276
+			);
277
+			$html .= EEH_HTML::span(
278
+				EEH_Template::format_currency($this->ticket_price),
279
+				'',
280
+				'tckt-price--nowrap'
281
+			);
282
+			$html .= $this->ticket->taxable()
283
+				? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
284
+				: '';
285
+			$html .= '&nbsp;';
286
+			// phpcs:disable WordPress.WP.I18n.NoEmptyStrings
287
+			$html .= EEH_HTML::span(
288
+				$this->ticket_bundle
289
+					? apply_filters(
290
+						'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
291
+						__(' / bundle', 'event_espresso')
292
+					)
293
+					: apply_filters(
294
+						'FHEE__ticket_selector_chart_template__per_ticket_text',
295
+						__('', 'event_espresso')
296
+					),
297
+				'',
298
+				'smaller-text no-bold'
299
+			);
300
+			$html .= '&nbsp;';
301
+			$html .= EEH_HTML::tdx();
302
+			$this->cols++;
303
+		}
304
+		return $html;
305
+	}
306
+
307
+
308
+	/**
309
+	 * onlyOneAttendeeCanRegister
310
+	 *
311
+	 * @return string
312
+	 */
313
+	protected function onlyOneAttendeeCanRegister()
314
+	{
315
+		// display submit button since we have tickets available
316
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
317
+		$this->hidden_input_qty = false;
318
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
319
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
320
+		$html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
321
+		$html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
322
+		$html .= ' id="' . $id . '"';
323
+		$html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
324
+		$html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
325
+		$html .= ' title=""/>';
326
+		return $html;
327
+	}
328
+
329
+
330
+	/**
331
+	 * ticketQuantitySelector
332
+	 *
333
+	 * @return string
334
+	 * @throws EE_Error
335
+	 */
336
+	protected function ticketQuantitySelector()
337
+	{
338
+		// display submit button since we have tickets available
339
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
340
+		$this->hidden_input_qty = false;
341
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
342
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
343
+		$html .= esc_html__('Quantity', 'event_espresso') . '</label>';
344
+		$html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
345
+		$html .= ' id="' . $id . '"';
346
+		$html .= ' class="ticket-selector-tbl-qty-slct">';
347
+		// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
348
+		if ($this->min !== 0 && ! $this->ticket->required()) {
349
+			$html .= '<option value="0">&nbsp;0&nbsp;</option>';
350
+		}
351
+		// offer ticket quantities from the min to the max
352
+		for ($i = $this->min; $i <= $this->max; $i++) {
353
+			$html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
354
+		}
355
+		$html .= '</select>';
356
+		return $html;
357
+	}
358
+
359
+
360
+	/**
361
+	 * getHiddenInputs
362
+	 *
363
+	 * @return string
364
+	 * @throws EE_Error
365
+	 */
366
+	protected function ticketQtyAndIdHiddenInputs()
367
+	{
368
+		$html = '';
369
+		// depending on group reg we need to change the format for qty
370
+		if ($this->hidden_input_qty) {
371
+			$html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
372
+		}
373
+		$html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
374
+		$html .= ' value="' . $this->ticket->ID() . '"/>';
375
+		return $html;
376
+	}
377 377
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             '',
173 173
             'tckt-slctr-tbl-td-qty cntr',
174 174
             '',
175
-            'headers="quantity-' . $this->EVT_ID . '"'
175
+            'headers="quantity-'.$this->EVT_ID.'"'
176 176
         );
177 177
         $this->setTicketStatusDisplay($remaining);
178 178
         if (empty($this->ticket_status_display)) {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             '',
239 239
             'tckt-slctr-tbl-td-name',
240 240
             '',
241
-            'headers="details-' . $this->EVT_ID . '"'
241
+            'headers="details-'.$this->EVT_ID.'"'
242 242
         );
243 243
         $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
244 244
         $html .= $this->ticket_details->getShowHideLinks();
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 '',
273 273
                 'tckt-slctr-tbl-td-price jst-rght',
274 274
                 '',
275
-                'headers="price-' . $this->EVT_ID . '"'
275
+                'headers="price-'.$this->EVT_ID.'"'
276 276
             );
277 277
             $html .= EEH_HTML::span(
278 278
                 EEH_Template::format_currency($this->ticket_price),
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
         // display submit button since we have tickets available
316 316
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
317 317
         $this->hidden_input_qty = false;
318
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
319
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
320
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
321
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
322
-        $html .= ' id="' . $id . '"';
323
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
318
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
319
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
320
+        $html .= esc_html__('Select this ticket', 'event_espresso').'</label>';
321
+        $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"';
322
+        $html .= ' id="'.$id.'"';
323
+        $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"';
324 324
         $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
325 325
         $html .= ' title=""/>';
326 326
         return $html;
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
         // display submit button since we have tickets available
339 339
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
340 340
         $this->hidden_input_qty = false;
341
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
342
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
343
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
344
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
345
-        $html .= ' id="' . $id . '"';
341
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
342
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
343
+        $html .= esc_html__('Quantity', 'event_espresso').'</label>';
344
+        $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"';
345
+        $html .= ' id="'.$id.'"';
346 346
         $html .= ' class="ticket-selector-tbl-qty-slct">';
347 347
         // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
348 348
         if ($this->min !== 0 && ! $this->ticket->required()) {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         }
351 351
         // offer ticket quantities from the min to the max
352 352
         for ($i = $this->min; $i <= $this->max; $i++) {
353
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
353
+            $html .= '<option value="'.$i.'">&nbsp;'.$i.'&nbsp;</option>';
354 354
         }
355 355
         $html .= '</select>';
356 356
         return $html;
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
         $html = '';
369 369
         // depending on group reg we need to change the format for qty
370 370
         if ($this->hidden_input_qty) {
371
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
371
+            $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>';
372 372
         }
373
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
374
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
373
+        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"';
374
+        $html .= ' value="'.$this->ticket->ID().'"/>';
375 375
         return $html;
376 376
     }
377 377
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Taxes.class.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -12,149 +12,149 @@
 block discarded – undo
12 12
 class EE_Taxes extends EE_Base
13 13
 {
14 14
 
15
-    /**
16
-     * This is used for when EE_Taxes is used statically by the admin
17
-     *
18
-     * @var array
19
-     */
20
-    private static $_subtotal = [];
15
+	/**
16
+	 * This is used for when EE_Taxes is used statically by the admin
17
+	 *
18
+	 * @var array
19
+	 */
20
+	private static $_subtotal = [];
21 21
 
22
-    /**
23
-     * This holds an array of EE_Price objects that are of PRT_ID == 4 (tax price types)
24
-     *
25
-     * @var EE_Price[]
26
-     */
27
-    private static $_default_taxes = [];
22
+	/**
23
+	 * This holds an array of EE_Price objects that are of PRT_ID == 4 (tax price types)
24
+	 *
25
+	 * @var EE_Price[]
26
+	 */
27
+	private static $_default_taxes = [];
28 28
 
29 29
 
30
-    /**
31
-     * This method simply calculates the total taxes for a given ticket (by pulling the prices attached to the ticket
32
-     * and applying default taxes to it). Note: this is just an intermediary helper method added to facilitate quick
33
-     * calc of taxes for tickets listed in the event editor.
34
-     *
35
-     * @param EE_Ticket $ticket incoming EE_Ticket
36
-     * @return float             total taxes to apply to ticket.
37
-     * @throws EE_Error
38
-     * @throws ReflectionException
39
-     */
40
-    public static function get_total_taxes_for_admin(EE_Ticket $ticket)
41
-    {
42
-        $tax = 0;
43
-        $total_tax = 0;
44
-        // This first checks to see if the given ticket is taxable.
45
-        if (! $ticket->taxable()) {
46
-            return $tax;
47
-        }
48
-        // get subtotal (notice we're only retrieving a subtotal if there isn't one given)
49
-        $subtotal = EE_Taxes::get_subtotal_for_admin($ticket);
50
-        // get taxes
51
-        $taxes = EE_Taxes::get_taxes_for_admin();
52
-        // apply taxes to subtotal
53
-        foreach ($taxes as $tax) {
54
-            // assuming taxes are not cumulative
55
-            $total_tax += $subtotal * $tax->amount() / 100;
56
-        }
57
-        return $total_tax;
58
-    }
30
+	/**
31
+	 * This method simply calculates the total taxes for a given ticket (by pulling the prices attached to the ticket
32
+	 * and applying default taxes to it). Note: this is just an intermediary helper method added to facilitate quick
33
+	 * calc of taxes for tickets listed in the event editor.
34
+	 *
35
+	 * @param EE_Ticket $ticket incoming EE_Ticket
36
+	 * @return float             total taxes to apply to ticket.
37
+	 * @throws EE_Error
38
+	 * @throws ReflectionException
39
+	 */
40
+	public static function get_total_taxes_for_admin(EE_Ticket $ticket)
41
+	{
42
+		$tax = 0;
43
+		$total_tax = 0;
44
+		// This first checks to see if the given ticket is taxable.
45
+		if (! $ticket->taxable()) {
46
+			return $tax;
47
+		}
48
+		// get subtotal (notice we're only retrieving a subtotal if there isn't one given)
49
+		$subtotal = EE_Taxes::get_subtotal_for_admin($ticket);
50
+		// get taxes
51
+		$taxes = EE_Taxes::get_taxes_for_admin();
52
+		// apply taxes to subtotal
53
+		foreach ($taxes as $tax) {
54
+			// assuming taxes are not cumulative
55
+			$total_tax += $subtotal * $tax->amount() / 100;
56
+		}
57
+		return $total_tax;
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * Gets the total percentage of tax that should be applied to taxable line items
63
-     *
64
-     * @return float the percentage of tax that should be added to taxable items
65
-     * @throws EE_Error
66
-     * @throws ReflectionException
67
-     * eg 20 for %20 tax (NOT 0.20, which
68
-     */
69
-    public static function get_total_taxes_percentage()
70
-    {
71
-        $total_tax_percent = 0;
72
-        foreach (EE_Taxes::get_taxes_for_admin() as $tax_price) {
73
-            $total_tax_percent += $tax_price->get('PRC_amount');
74
-        }
75
-        return $total_tax_percent;
76
-    }
61
+	/**
62
+	 * Gets the total percentage of tax that should be applied to taxable line items
63
+	 *
64
+	 * @return float the percentage of tax that should be added to taxable items
65
+	 * @throws EE_Error
66
+	 * @throws ReflectionException
67
+	 * eg 20 for %20 tax (NOT 0.20, which
68
+	 */
69
+	public static function get_total_taxes_percentage()
70
+	{
71
+		$total_tax_percent = 0;
72
+		foreach (EE_Taxes::get_taxes_for_admin() as $tax_price) {
73
+			$total_tax_percent += $tax_price->get('PRC_amount');
74
+		}
75
+		return $total_tax_percent;
76
+	}
77 77
 
78 78
 
79
-    /**
80
-     * @param EE_Ticket $ticket
81
-     * @return float
82
-     * @throws EE_Error
83
-     * @throws ReflectionException
84
-     */
85
-    public static function get_subtotal_for_admin(EE_Ticket $ticket)
86
-    {
87
-        $TKT_ID = $ticket->ID();
88
-        return isset(EE_Taxes::$_subtotal[ $TKT_ID ])
89
-            ? EE_Taxes::$_subtotal[ $TKT_ID ]
90
-            : EE_Taxes::_get_subtotal_for_admin($ticket);
91
-    }
79
+	/**
80
+	 * @param EE_Ticket $ticket
81
+	 * @return float
82
+	 * @throws EE_Error
83
+	 * @throws ReflectionException
84
+	 */
85
+	public static function get_subtotal_for_admin(EE_Ticket $ticket)
86
+	{
87
+		$TKT_ID = $ticket->ID();
88
+		return isset(EE_Taxes::$_subtotal[ $TKT_ID ])
89
+			? EE_Taxes::$_subtotal[ $TKT_ID ]
90
+			: EE_Taxes::_get_subtotal_for_admin($ticket);
91
+	}
92 92
 
93 93
 
94
-    /**
95
-     * simply take an incoming ticket and calculate the subtotal for the ticket
96
-     *
97
-     * @param EE_Ticket $ticket
98
-     * @return float     subtotal calculated from all EE_Price[] on Ticket.
99
-     * @throws EE_Error
100
-     * @throws ReflectionException
101
-     */
102
-    private static function _get_subtotal_for_admin(EE_Ticket $ticket)
103
-    {
104
-        $subtotal = 0;
105
-        // get all prices
106
-        $prices = $ticket->get_many_related(
107
-            'Price',
108
-            [
109
-                0 => [
110
-                    'Price_Type.PBT_ID' => ['NOT', EEM_Price_Type::base_type_tax],
111
-                ],
112
-                'default_where_conditions' => 'none',
113
-                'order_by'                 => ['PRC_order' => 'ASC'],
114
-            ]
115
-        );
116
-        // let's loop through them (base price is always the first item)
117
-        foreach ($prices as $price) {
118
-            if ($price instanceof EE_Price) {
119
-                $price_type = $price->type_obj();
120
-                if ($price_type instanceof EE_Price_Type) {
121
-                    switch ($price->type_obj()->base_type()) {
122
-                        case 1: // base price
123
-                        case 3: // surcharges
124
-                            $subtotal += $price->is_percent()
125
-                                ? $subtotal * $price->get('PRC_amount') / 100
126
-                                : $price->get('PRC_amount');
127
-                            break;
128
-                        case 2: // discounts
129
-                            $subtotal -= $price->is_percent()
130
-                                ? $subtotal * $price->get('PRC_amount') / 100
131
-                                : $price->get('PRC_amount');
132
-                            break;
133
-                    }
134
-                }
135
-            }
136
-        }
137
-        $TKT_ID = $ticket->ID();
138
-        EE_Taxes::$_subtotal[ $TKT_ID ] = $subtotal;
139
-        return $subtotal;
140
-    }
94
+	/**
95
+	 * simply take an incoming ticket and calculate the subtotal for the ticket
96
+	 *
97
+	 * @param EE_Ticket $ticket
98
+	 * @return float     subtotal calculated from all EE_Price[] on Ticket.
99
+	 * @throws EE_Error
100
+	 * @throws ReflectionException
101
+	 */
102
+	private static function _get_subtotal_for_admin(EE_Ticket $ticket)
103
+	{
104
+		$subtotal = 0;
105
+		// get all prices
106
+		$prices = $ticket->get_many_related(
107
+			'Price',
108
+			[
109
+				0 => [
110
+					'Price_Type.PBT_ID' => ['NOT', EEM_Price_Type::base_type_tax],
111
+				],
112
+				'default_where_conditions' => 'none',
113
+				'order_by'                 => ['PRC_order' => 'ASC'],
114
+			]
115
+		);
116
+		// let's loop through them (base price is always the first item)
117
+		foreach ($prices as $price) {
118
+			if ($price instanceof EE_Price) {
119
+				$price_type = $price->type_obj();
120
+				if ($price_type instanceof EE_Price_Type) {
121
+					switch ($price->type_obj()->base_type()) {
122
+						case 1: // base price
123
+						case 3: // surcharges
124
+							$subtotal += $price->is_percent()
125
+								? $subtotal * $price->get('PRC_amount') / 100
126
+								: $price->get('PRC_amount');
127
+							break;
128
+						case 2: // discounts
129
+							$subtotal -= $price->is_percent()
130
+								? $subtotal * $price->get('PRC_amount') / 100
131
+								: $price->get('PRC_amount');
132
+							break;
133
+					}
134
+				}
135
+			}
136
+		}
137
+		$TKT_ID = $ticket->ID();
138
+		EE_Taxes::$_subtotal[ $TKT_ID ] = $subtotal;
139
+		return $subtotal;
140
+	}
141 141
 
142 142
 
143
-    /**
144
-     * get all default prices that are a Tax price type (PRT_ID = 4) and return
145
-     *
146
-     * @return EE_Price[] EE_Price objects that have PRT_ID == 4
147
-     * @throws EE_Error
148
-     */
149
-    public static function get_taxes_for_admin()
150
-    {
151
-        if (empty(EE_Taxes::$_default_taxes)) {
152
-            /** @var EEM_Price $price_model */
153
-            $price_model = LoaderFactory::getLoader()->getShared('EEM_Price');
154
-            EE_Taxes::$_default_taxes = $price_model->get_all(
155
-                [['Price_Type.PBT_ID' => 4]]
156
-            );
157
-        }
158
-        return EE_Taxes::$_default_taxes;
159
-    }
143
+	/**
144
+	 * get all default prices that are a Tax price type (PRT_ID = 4) and return
145
+	 *
146
+	 * @return EE_Price[] EE_Price objects that have PRT_ID == 4
147
+	 * @throws EE_Error
148
+	 */
149
+	public static function get_taxes_for_admin()
150
+	{
151
+		if (empty(EE_Taxes::$_default_taxes)) {
152
+			/** @var EEM_Price $price_model */
153
+			$price_model = LoaderFactory::getLoader()->getShared('EEM_Price');
154
+			EE_Taxes::$_default_taxes = $price_model->get_all(
155
+				[['Price_Type.PBT_ID' => 4]]
156
+			);
157
+		}
158
+		return EE_Taxes::$_default_taxes;
159
+	}
160 160
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 1 patch
Indentation   +2005 added lines, -2005 removed lines patch added patch discarded remove patch
@@ -15,2013 +15,2013 @@
 block discarded – undo
15 15
 class EE_Ticket extends EE_Soft_Delete_Base_Class implements EEI_Line_Item_Object, EEI_Event_Relation, EEI_Has_Icon
16 16
 {
17 17
 
18
-    /**
19
-     * TicKet Sold out:
20
-     * constant used by ticket_status() to indicate that a ticket is sold out
21
-     * and no longer available for purchases
22
-     */
23
-    const sold_out = 'TKS';
24
-
25
-    /**
26
-     * TicKet Expired:
27
-     * constant used by ticket_status() to indicate that a ticket is expired
28
-     * and no longer available for purchase
29
-     */
30
-    const expired = 'TKE';
31
-
32
-    /**
33
-     * TicKet Archived:
34
-     * constant used by ticket_status() to indicate that a ticket is archived
35
-     * and no longer available for purchase
36
-     */
37
-    const archived = 'TKA';
38
-
39
-    /**
40
-     * TicKet Pending:
41
-     * constant used by ticket_status() to indicate that a ticket is pending
42
-     * and is NOT YET available for purchase
43
-     */
44
-    const pending = 'TKP';
45
-
46
-    /**
47
-     * TicKet On sale:
48
-     * constant used by ticket_status() to indicate that a ticket is On Sale
49
-     * and IS available for purchase
50
-     */
51
-    const onsale = 'TKO';
52
-
53
-    /**
54
-     * extra meta key for tracking ticket reservations
55
-     *
56
-     * @type string
57
-     */
58
-    const META_KEY_TICKET_RESERVATIONS = 'ticket_reservations';
59
-
60
-    /**
61
-     * override of parent property
62
-     *
63
-     * @var EEM_Ticket
64
-     */
65
-    protected $_model;
66
-
67
-    /**
68
-     * cached result from method of the same name
69
-     *
70
-     * @var float $_ticket_total_with_taxes
71
-     */
72
-    private $_ticket_total_with_taxes;
73
-
74
-
75
-    /**
76
-     * @param array  $props_n_values          incoming values
77
-     * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
78
-     *                                        used.)
79
-     * @param array  $date_formats            incoming date_formats in an array where the first value is the
80
-     *                                        date_format and the second value is the time format
81
-     * @return EE_Ticket
82
-     * @throws EE_Error
83
-     * @throws ReflectionException
84
-     */
85
-    public static function new_instance($props_n_values = [], $timezone = null, $date_formats = [])
86
-    {
87
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
88
-        return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
89
-    }
90
-
91
-
92
-    /**
93
-     * @param array  $props_n_values  incoming values from the database
94
-     * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
95
-     *                                the website will be used.
96
-     * @return EE_Ticket
97
-     * @throws EE_Error
98
-     * @throws ReflectionException
99
-     */
100
-    public static function new_instance_from_db($props_n_values = [], $timezone = null)
101
-    {
102
-        return new self($props_n_values, true, $timezone);
103
-    }
104
-
105
-
106
-    /**
107
-     * @return bool
108
-     * @throws EE_Error
109
-     * @throws ReflectionException
110
-     */
111
-    public function parent()
112
-    {
113
-        return $this->get('TKT_parent');
114
-    }
115
-
116
-
117
-    /**
118
-     * return if a ticket has quantities available for purchase
119
-     *
120
-     * @param int $DTT_ID the primary key for a particular datetime
121
-     * @return boolean
122
-     * @throws EE_Error
123
-     * @throws ReflectionException
124
-     */
125
-    public function available($DTT_ID = 0)
126
-    {
127
-        // are we checking availability for a particular datetime ?
128
-        if ($DTT_ID) {
129
-            // get that datetime object
130
-            $datetime = $this->get_first_related('Datetime', [['DTT_ID' => $DTT_ID]]);
131
-            // if  ticket sales for this datetime have exceeded the reg limit...
132
-            if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
133
-                return false;
134
-            }
135
-        }
136
-        // datetime is still open for registration, but is this ticket sold out ?
137
-        return $this->qty() < 1 || $this->qty() > $this->sold();
138
-    }
139
-
140
-
141
-    /**
142
-     * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired
143
-     *
144
-     * @param bool        $display   true = we'll return a localized string, otherwise we just return the value of the
145
-     *                               relevant status const
146
-     * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save
147
-     *                               further processing
148
-     * @return mixed status int if the display string isn't requested
149
-     * @throws EE_Error
150
-     * @throws ReflectionException
151
-     */
152
-    public function ticket_status($display = false, $remaining = null)
153
-    {
154
-        $remaining = is_bool($remaining) ? $remaining : $this->is_remaining();
155
-        if (! $remaining) {
156
-            return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, false, 'sentence') : EE_Ticket::sold_out;
157
-        }
158
-        if ($this->get('TKT_deleted')) {
159
-            return $display ? EEH_Template::pretty_status(EE_Ticket::archived, false, 'sentence') : EE_Ticket::archived;
160
-        }
161
-        if ($this->is_expired()) {
162
-            return $display ? EEH_Template::pretty_status(EE_Ticket::expired, false, 'sentence') : EE_Ticket::expired;
163
-        }
164
-        if ($this->is_pending()) {
165
-            return $display ? EEH_Template::pretty_status(EE_Ticket::pending, false, 'sentence') : EE_Ticket::pending;
166
-        }
167
-        if ($this->is_on_sale()) {
168
-            return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, false, 'sentence') : EE_Ticket::onsale;
169
-        }
170
-        return '';
171
-    }
172
-
173
-
174
-    /**
175
-     * The purpose of this method is to simply return a boolean for whether there are any tickets remaining for sale
176
-     * considering ALL the factors used for figuring that out.
177
-     *
178
-     * @access public
179
-     * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt.
180
-     * @return boolean         true = tickets remaining, false not.
181
-     * @throws EE_Error
182
-     * @throws ReflectionException
183
-     */
184
-    public function is_remaining($DTT_ID = 0)
185
-    {
186
-        $num_remaining = $this->remaining($DTT_ID);
187
-        if ($num_remaining === 0) {
188
-            return false;
189
-        }
190
-        if ($num_remaining > 0 && $num_remaining < $this->min()) {
191
-            return false;
192
-        }
193
-        return true;
194
-    }
195
-
196
-
197
-    /**
198
-     * return the total number of tickets available for purchase
199
-     *
200
-     * @param int $DTT_ID  the primary key for a particular datetime.
201
-     *                     set to 0 for all related datetimes
202
-     * @return int
203
-     * @throws EE_Error
204
-     * @throws ReflectionException
205
-     */
206
-    public function remaining($DTT_ID = 0)
207
-    {
208
-        return $this->real_quantity_on_ticket('saleable', $DTT_ID);
209
-    }
210
-
211
-
212
-    /**
213
-     * Gets min
214
-     *
215
-     * @return int
216
-     * @throws EE_Error
217
-     * @throws ReflectionException
218
-     */
219
-    public function min()
220
-    {
221
-        return $this->get('TKT_min');
222
-    }
223
-
224
-
225
-    /**
226
-     * return if a ticket is no longer available cause its available dates have expired.
227
-     *
228
-     * @return boolean
229
-     * @throws EE_Error
230
-     * @throws ReflectionException
231
-     */
232
-    public function is_expired()
233
-    {
234
-        return ($this->get_raw('TKT_end_date') < time());
235
-    }
236
-
237
-
238
-    /**
239
-     * Return if a ticket is yet to go on sale or not
240
-     *
241
-     * @return boolean
242
-     * @throws EE_Error
243
-     * @throws ReflectionException
244
-     */
245
-    public function is_pending()
246
-    {
247
-        return ($this->get_raw('TKT_start_date') >= time());
248
-    }
249
-
250
-
251
-    /**
252
-     * Return if a ticket is on sale or not
253
-     *
254
-     * @return boolean
255
-     * @throws EE_Error
256
-     * @throws ReflectionException
257
-     */
258
-    public function is_on_sale()
259
-    {
260
-        return ($this->get_raw('TKT_start_date') <= time() && $this->get_raw('TKT_end_date') >= time());
261
-    }
262
-
263
-
264
-    /**
265
-     * This returns the chronologically last datetime that this ticket is associated with
266
-     *
267
-     * @param string $date_format
268
-     * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with
269
-     *                            the end date ie: Jan 01 "to" Dec 31
270
-     * @return string
271
-     * @throws EE_Error
272
-     * @throws ReflectionException
273
-     */
274
-    public function date_range($date_format = '', $conjunction = ' - ')
275
-    {
276
-        $date_format = ! empty($date_format) ? $date_format : $this->_dt_frmt;
277
-        $first_date  = $this->first_datetime() instanceof EE_Datetime
278
-            ? $this->first_datetime()->get_i18n_datetime('DTT_EVT_start', $date_format)
279
-            : '';
280
-        $last_date   = $this->last_datetime() instanceof EE_Datetime
281
-            ? $this->last_datetime()->get_i18n_datetime('DTT_EVT_end', $date_format)
282
-            : '';
283
-
284
-        return $first_date && $last_date ? $first_date . $conjunction . $last_date : '';
285
-    }
286
-
287
-
288
-    /**
289
-     * This returns the chronologically first datetime that this ticket is associated with
290
-     *
291
-     * @return EE_Datetime
292
-     * @throws EE_Error
293
-     * @throws ReflectionException
294
-     */
295
-    public function first_datetime()
296
-    {
297
-        $datetimes = $this->datetimes(['limit' => 1]);
298
-        return reset($datetimes);
299
-    }
300
-
301
-
302
-    /**
303
-     * Gets all the datetimes this ticket can be used for attending.
304
-     * Unless otherwise specified, orders datetimes by start date.
305
-     *
306
-     * @param array $query_params @see
307
-     *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
308
-     * @return EE_Datetime[]|EE_Base_Class[]
309
-     * @throws EE_Error
310
-     * @throws ReflectionException
311
-     */
312
-    public function datetimes($query_params = [])
313
-    {
314
-        if (! isset($query_params['order_by'])) {
315
-            $query_params['order_by']['DTT_order'] = 'ASC';
316
-        }
317
-        return $this->get_many_related('Datetime', $query_params);
318
-    }
319
-
320
-
321
-    /**
322
-     * This returns the chronologically last datetime that this ticket is associated with
323
-     *
324
-     * @return EE_Datetime
325
-     * @throws EE_Error
326
-     * @throws ReflectionException
327
-     */
328
-    public function last_datetime()
329
-    {
330
-        $datetimes = $this->datetimes(['limit' => 1, 'order_by' => ['DTT_EVT_start' => 'DESC']]);
331
-        return end($datetimes);
332
-    }
333
-
334
-
335
-    /**
336
-     * This returns the total tickets sold depending on the given parameters.
337
-     *
338
-     * @param string $what    Can be one of two options: 'ticket', 'datetime'.
339
-     *                        'ticket' = total ticket sales for all datetimes this ticket is related to
340
-     *                        'datetime' = total ticket sales for a specified datetime (required $dtt_id)
341
-     *                        'datetime' = total ticket sales in the datetime_ticket table.
342
-     *                        If $dtt_id is not given then we return an array of sales indexed by datetime.
343
-     *                        If $dtt_id IS given then we return the tickets sold for that given datetime.
344
-     * @param int    $dtt_id  [optional] include the dtt_id with $what = 'datetime'.
345
-     * @return mixed (array|int)          how many tickets have sold
346
-     * @throws EE_Error
347
-     * @throws ReflectionException
348
-     */
349
-    public function tickets_sold($what = 'ticket', $dtt_id = null)
350
-    {
351
-        $total        = 0;
352
-        $tickets_sold = $this->_all_tickets_sold();
353
-        switch ($what) {
354
-            case 'ticket':
355
-                return $tickets_sold['ticket'];
356
-                break;
357
-            case 'datetime':
358
-                if (empty($tickets_sold['datetime'])) {
359
-                    return $total;
360
-                }
361
-                if (! empty($dtt_id) && ! isset($tickets_sold['datetime'][ $dtt_id ])) {
362
-                    EE_Error::add_error(
363
-                        __(
364
-                            'You\'ve requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?',
365
-                            'event_espresso'
366
-                        ),
367
-                        __FILE__,
368
-                        __FUNCTION__,
369
-                        __LINE__
370
-                    );
371
-                    return $total;
372
-                }
373
-                return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][ $dtt_id ];
374
-                break;
375
-            default:
376
-                return $total;
377
-        }
378
-    }
379
-
380
-
381
-    /**
382
-     * This returns an array indexed by datetime_id for tickets sold with this ticket.
383
-     *
384
-     * @return EE_Ticket[]
385
-     * @throws EE_Error
386
-     * @throws ReflectionException
387
-     */
388
-    protected function _all_tickets_sold()
389
-    {
390
-        $datetimes    = $this->get_many_related('Datetime');
391
-        $tickets_sold = [];
392
-        if (! empty($datetimes)) {
393
-            foreach ($datetimes as $datetime) {
394
-                $tickets_sold['datetime'][ $datetime->ID() ] = $datetime->get('DTT_sold');
395
-            }
396
-        }
397
-        // Tickets sold
398
-        $tickets_sold['ticket'] = $this->sold();
399
-        return $tickets_sold;
400
-    }
401
-
402
-
403
-    /**
404
-     * This returns the base price object for the ticket.
405
-     *
406
-     * @param bool $return_array whether to return as an array indexed by price id or just the object.
407
-     * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[]
408
-     * @throws EE_Error
409
-     * @throws ReflectionException
410
-     */
411
-    public function base_price($return_array = false)
412
-    {
413
-        $_where = ['Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price];
414
-        return $return_array
415
-            ? $this->get_many_related('Price', [$_where])
416
-            : $this->get_first_related('Price', [$_where]);
417
-    }
418
-
419
-
420
-    /**
421
-     * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price)
422
-     *
423
-     * @access public
424
-     * @return EE_Price[]
425
-     * @throws EE_Error
426
-     * @throws ReflectionException
427
-     */
428
-    public function price_modifiers()
429
-    {
430
-        $query_params = [
431
-            0 => [
432
-                'Price_Type.PBT_ID' => [
433
-                    'NOT IN',
434
-                    [EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax],
435
-                ],
436
-            ],
437
-        ];
438
-        return $this->prices($query_params);
439
-    }
440
-
441
-
442
-    /**
443
-     * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price)
444
-     *
445
-     * @access public
446
-     * @return EE_Price[]
447
-     * @throws EE_Error
448
-     * @throws ReflectionException
449
-     */
450
-    public function tax_price_modifiers()
451
-    {
452
-        $query_params = [
453
-            0 => [
454
-                'Price_Type.PBT_ID' => EEM_Price_Type::base_type_tax,
455
-            ],
456
-        ];
457
-        return $this->prices($query_params);
458
-    }
459
-
460
-
461
-    /**
462
-     * Gets all the prices that combine to form the final price of this ticket
463
-     *
464
-     * @param array $query_params @see
465
-     *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
466
-     * @return EE_Price[]|EE_Base_Class[]
467
-     * @throws EE_Error
468
-     * @throws ReflectionException
469
-     */
470
-    public function prices($query_params = [])
471
-    {
472
-        return $this->get_many_related('Price', $query_params);
473
-    }
474
-
475
-
476
-    /**
477
-     * Gets all the ticket datetimes (ie, relations between datetimes and tickets)
478
-     *
479
-     * @param array $query_params @see
480
-     *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
481
-     * @return EE_Datetime_Ticket|EE_Base_Class[]
482
-     * @throws EE_Error
483
-     * @throws ReflectionException
484
-     */
485
-    public function datetime_tickets($query_params = [])
486
-    {
487
-        return $this->get_many_related('Datetime_Ticket', $query_params);
488
-    }
489
-
490
-
491
-    /**
492
-     * Gets all the datetimes from the db ordered by DTT_order
493
-     *
494
-     * @param boolean $show_expired
495
-     * @param boolean $show_deleted
496
-     * @return EE_Datetime[]
497
-     * @throws EE_Error
498
-     * @throws ReflectionException
499
-     */
500
-    public function datetimes_ordered($show_expired = true, $show_deleted = false)
501
-    {
502
-        return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order(
503
-            $this->ID(),
504
-            $show_expired,
505
-            $show_deleted
506
-        );
507
-    }
508
-
509
-
510
-    /**
511
-     * Gets ID
512
-     *
513
-     * @return int
514
-     * @throws EE_Error
515
-     * @throws ReflectionException
516
-     */
517
-    public function ID()
518
-    {
519
-        return $this->get('TKT_ID');
520
-    }
521
-
522
-
523
-    /**
524
-     * get the author of the ticket.
525
-     *
526
-     * @return int
527
-     * @throws EE_Error
528
-     * @throws ReflectionException
529
-     * @since 4.5.0
530
-     */
531
-    public function wp_user()
532
-    {
533
-        return $this->get('TKT_wp_user');
534
-    }
535
-
536
-
537
-    /**
538
-     * Gets the template for the ticket
539
-     *
540
-     * @return EE_Ticket_Template|EE_Base_Class
541
-     * @throws EE_Error
542
-     * @throws ReflectionException
543
-     */
544
-    public function template()
545
-    {
546
-        return $this->get_first_related('Ticket_Template');
547
-    }
548
-
549
-
550
-    /**
551
-     * Simply returns an array of EE_Price objects that are taxes.
552
-     *
553
-     * @return EE_Price[]
554
-     * @throws EE_Error
555
-     * @throws ReflectionException
556
-     */
557
-    public function get_ticket_taxes_for_admin(): array
558
-    {
559
-        /** @var EE_Admin_Config $admin_config */
560
-        $admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
561
-        return $admin_config->useAdvancedEditor() ? $this->tax_price_modifiers() : EE_Taxes::get_taxes_for_admin();
562
-    }
563
-
564
-
565
-    /**
566
-     * @return float
567
-     * @throws EE_Error
568
-     * @throws ReflectionException
569
-     */
570
-    public function ticket_price()
571
-    {
572
-        return $this->get('TKT_price');
573
-    }
574
-
575
-
576
-    /**
577
-     * @return mixed
578
-     * @throws EE_Error
579
-     * @throws ReflectionException
580
-     */
581
-    public function pretty_price()
582
-    {
583
-        return $this->get_pretty('TKT_price');
584
-    }
585
-
586
-
587
-    /**
588
-     * @return bool
589
-     * @throws EE_Error
590
-     * @throws ReflectionException
591
-     */
592
-    public function is_free()
593
-    {
594
-        return $this->get_ticket_total_with_taxes() === (float) 0;
595
-    }
596
-
597
-
598
-    /**
599
-     * get_ticket_total_with_taxes
600
-     *
601
-     * @param bool $no_cache
602
-     * @return float
603
-     * @throws EE_Error
604
-     * @throws ReflectionException
605
-     */
606
-    public function get_ticket_total_with_taxes($no_cache = false)
607
-    {
608
-        if ($this->_ticket_total_with_taxes === null || $no_cache) {
609
-            /** @var EE_Admin_Config $admin_config */
610
-            $admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
611
-            $this->_ticket_total_with_taxes = $admin_config->useAdvancedEditor()
612
-                ? $this->ticket_price()
613
-                : $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
614
-        }
615
-        return (float) $this->_ticket_total_with_taxes;
616
-    }
617
-
618
-
619
-    /**
620
-     * @throws EE_Error
621
-     * @throws ReflectionException
622
-     */
623
-    public function ensure_TKT_Price_correct()
624
-    {
625
-        $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
626
-        $this->save();
627
-    }
628
-
629
-
630
-    /**
631
-     * @return float
632
-     * @throws EE_Error
633
-     * @throws ReflectionException
634
-     */
635
-    public function get_ticket_subtotal()
636
-    {
637
-        return EE_Taxes::get_subtotal_for_admin($this);
638
-    }
639
-
640
-
641
-    /**
642
-     * Returns the total taxes applied to this ticket
643
-     *
644
-     * @return float
645
-     * @throws EE_Error
646
-     * @throws ReflectionException
647
-     */
648
-    public function get_ticket_taxes_total_for_admin()
649
-    {
650
-        return EE_Taxes::get_total_taxes_for_admin($this);
651
-    }
652
-
653
-
654
-    /**
655
-     * Sets name
656
-     *
657
-     * @param string $name
658
-     * @throws EE_Error
659
-     * @throws ReflectionException
660
-     */
661
-    public function set_name($name)
662
-    {
663
-        $this->set('TKT_name', $name);
664
-    }
665
-
666
-
667
-    /**
668
-     * Gets description
669
-     *
670
-     * @return string
671
-     * @throws EE_Error
672
-     * @throws ReflectionException
673
-     */
674
-    public function description()
675
-    {
676
-        return $this->get('TKT_description');
677
-    }
678
-
679
-
680
-    /**
681
-     * Sets description
682
-     *
683
-     * @param string $description
684
-     * @throws EE_Error
685
-     * @throws ReflectionException
686
-     */
687
-    public function set_description($description)
688
-    {
689
-        $this->set('TKT_description', $description);
690
-    }
691
-
692
-
693
-    /**
694
-     * Gets start_date
695
-     *
696
-     * @param string $date_format
697
-     * @param string $time_format
698
-     * @return string
699
-     * @throws EE_Error
700
-     * @throws ReflectionException
701
-     */
702
-    public function start_date($date_format = '', $time_format = '')
703
-    {
704
-        return $this->_get_datetime('TKT_start_date', $date_format, $time_format);
705
-    }
706
-
707
-
708
-    /**
709
-     * Sets start_date
710
-     *
711
-     * @param string $start_date
712
-     * @return void
713
-     * @throws EE_Error
714
-     * @throws ReflectionException
715
-     */
716
-    public function set_start_date($start_date)
717
-    {
718
-        $this->_set_date_time('B', $start_date, 'TKT_start_date');
719
-    }
720
-
721
-
722
-    /**
723
-     * Gets end_date
724
-     *
725
-     * @param string $date_format
726
-     * @param string $time_format
727
-     * @return string
728
-     * @throws EE_Error
729
-     * @throws ReflectionException
730
-     */
731
-    public function end_date($date_format = '', $time_format = '')
732
-    {
733
-        return $this->_get_datetime('TKT_end_date', $date_format, $time_format);
734
-    }
735
-
736
-
737
-    /**
738
-     * Sets end_date
739
-     *
740
-     * @param string $end_date
741
-     * @return void
742
-     * @throws EE_Error
743
-     * @throws ReflectionException
744
-     */
745
-    public function set_end_date($end_date)
746
-    {
747
-        $this->_set_date_time('B', $end_date, 'TKT_end_date');
748
-    }
749
-
750
-
751
-    /**
752
-     * Sets sell until time
753
-     *
754
-     * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
755
-     * @throws EE_Error
756
-     * @throws ReflectionException
757
-     * @since 4.5.0
758
-     */
759
-    public function set_end_time($time)
760
-    {
761
-        $this->_set_time_for($time, 'TKT_end_date');
762
-    }
763
-
764
-
765
-    /**
766
-     * Sets min
767
-     *
768
-     * @param int $min
769
-     * @return void
770
-     * @throws EE_Error
771
-     * @throws ReflectionException
772
-     */
773
-    public function set_min($min)
774
-    {
775
-        $this->set('TKT_min', $min);
776
-    }
777
-
778
-
779
-    /**
780
-     * Gets max
781
-     *
782
-     * @return int
783
-     * @throws EE_Error
784
-     * @throws ReflectionException
785
-     */
786
-    public function max()
787
-    {
788
-        return $this->get('TKT_max');
789
-    }
790
-
791
-
792
-    /**
793
-     * Sets max
794
-     *
795
-     * @param int $max
796
-     * @return void
797
-     * @throws EE_Error
798
-     * @throws ReflectionException
799
-     */
800
-    public function set_max($max)
801
-    {
802
-        $this->set('TKT_max', $max);
803
-    }
804
-
805
-
806
-    /**
807
-     * Sets price
808
-     *
809
-     * @param float $price
810
-     * @return void
811
-     * @throws EE_Error
812
-     * @throws ReflectionException
813
-     */
814
-    public function set_price($price)
815
-    {
816
-        $this->set('TKT_price', $price);
817
-    }
818
-
819
-
820
-    /**
821
-     * Gets sold
822
-     *
823
-     * @return int
824
-     * @throws EE_Error
825
-     * @throws ReflectionException
826
-     */
827
-    public function sold()
828
-    {
829
-        return $this->get_raw('TKT_sold');
830
-    }
831
-
832
-
833
-    /**
834
-     * Sets sold
835
-     *
836
-     * @param int $sold
837
-     * @return void
838
-     * @throws EE_Error
839
-     * @throws ReflectionException
840
-     */
841
-    public function set_sold($sold)
842
-    {
843
-        // sold can not go below zero
844
-        $sold = max(0, $sold);
845
-        $this->set('TKT_sold', $sold);
846
-    }
847
-
848
-
849
-    /**
850
-     * Increments sold by amount passed by $qty AND decrements the reserved count on both this ticket and its
851
-     * associated datetimes.
852
-     *
853
-     * @param int $qty
854
-     * @return boolean
855
-     * @throws EE_Error
856
-     * @throws InvalidArgumentException
857
-     * @throws InvalidDataTypeException
858
-     * @throws InvalidInterfaceException
859
-     * @throws ReflectionException
860
-     * @since 4.9.80.p
861
-     */
862
-    public function increaseSold($qty = 1)
863
-    {
864
-        $qty = absint($qty);
865
-        // increment sold and decrement reserved datetime quantities simultaneously
866
-        // don't worry about failures, because they must have already had a spot reserved
867
-        $this->increaseSoldForDatetimes($qty);
868
-        // Increment and decrement ticket quantities simultaneously
869
-        $success = $this->adjustNumericFieldsInDb(
870
-            [
871
-                'TKT_reserved' => $qty * -1,
872
-                'TKT_sold'     => $qty,
873
-            ]
874
-        );
875
-        do_action(
876
-            'AHEE__EE_Ticket__increase_sold',
877
-            $this,
878
-            $qty,
879
-            $this->sold(),
880
-            $success
881
-        );
882
-        return $success;
883
-    }
884
-
885
-
886
-    /**
887
-     * On each datetime related to this ticket, increases its sold count and decreases its reserved count by $qty.
888
-     *
889
-     * @param int           $qty positive or negative. Positive means to increase sold counts (and decrease reserved
890
-     *                           counts), Negative means to decreases old counts (and increase reserved counts).
891
-     * @param EE_Datetime[] $datetimes
892
-     * @throws EE_Error
893
-     * @throws InvalidArgumentException
894
-     * @throws InvalidDataTypeException
895
-     * @throws InvalidInterfaceException
896
-     * @throws ReflectionException
897
-     * @since 4.9.80.p
898
-     */
899
-    protected function increaseSoldForDatetimes($qty, array $datetimes = [])
900
-    {
901
-        $datetimes = ! empty($datetimes) ? $datetimes : $this->datetimes();
902
-        foreach ($datetimes as $datetime) {
903
-            $datetime->increaseSold($qty);
904
-        }
905
-    }
906
-
907
-
908
-    /**
909
-     * Decrements (subtracts) sold by amount passed by $qty on both the ticket and its related datetimes directly in the
910
-     * DB and then updates the model objects.
911
-     * Does not affect the reserved counts.
912
-     *
913
-     * @param int $qty
914
-     * @return boolean
915
-     * @throws EE_Error
916
-     * @throws InvalidArgumentException
917
-     * @throws InvalidDataTypeException
918
-     * @throws InvalidInterfaceException
919
-     * @throws ReflectionException
920
-     * @since 4.9.80.p
921
-     */
922
-    public function decreaseSold($qty = 1)
923
-    {
924
-        $qty = absint($qty);
925
-        $this->decreaseSoldForDatetimes($qty);
926
-        $success = $this->adjustNumericFieldsInDb(
927
-            [
928
-                'TKT_sold' => $qty * -1,
929
-            ]
930
-        );
931
-        do_action(
932
-            'AHEE__EE_Ticket__decrease_sold',
933
-            $this,
934
-            $qty,
935
-            $this->sold(),
936
-            $success
937
-        );
938
-        return $success;
939
-    }
940
-
941
-
942
-    /**
943
-     * Decreases sold on related datetimes
944
-     *
945
-     * @param int           $qty
946
-     * @param EE_Datetime[] $datetimes
947
-     * @return void
948
-     * @throws EE_Error
949
-     * @throws InvalidArgumentException
950
-     * @throws InvalidDataTypeException
951
-     * @throws InvalidInterfaceException
952
-     * @throws ReflectionException
953
-     * @since 4.9.80.p
954
-     */
955
-    protected function decreaseSoldForDatetimes($qty = 1, array $datetimes = [])
956
-    {
957
-        $datetimes = ! empty($datetimes) ? $datetimes : $this->datetimes();
958
-        if (is_array($datetimes)) {
959
-            foreach ($datetimes as $datetime) {
960
-                if ($datetime instanceof EE_Datetime) {
961
-                    $datetime->decreaseSold($qty);
962
-                }
963
-            }
964
-        }
965
-    }
966
-
967
-
968
-    /**
969
-     * Gets qty of reserved tickets
970
-     *
971
-     * @return int
972
-     * @throws EE_Error
973
-     * @throws ReflectionException
974
-     */
975
-    public function reserved()
976
-    {
977
-        return $this->get_raw('TKT_reserved');
978
-    }
979
-
980
-
981
-    /**
982
-     * Sets reserved
983
-     *
984
-     * @param int $reserved
985
-     * @return void
986
-     * @throws EE_Error
987
-     * @throws ReflectionException
988
-     */
989
-    public function set_reserved($reserved)
990
-    {
991
-        // reserved can not go below zero
992
-        $reserved = max(0, (int) $reserved);
993
-        $this->set('TKT_reserved', $reserved);
994
-    }
995
-
996
-
997
-    /**
998
-     * Increments reserved by amount passed by $qty, and persists it immediately to the database.
999
-     *
1000
-     * @param int    $qty
1001
-     * @param string $source
1002
-     * @return bool whether we successfully reserved the ticket or not.
1003
-     * @throws EE_Error
1004
-     * @throws InvalidArgumentException
1005
-     * @throws ReflectionException
1006
-     * @throws InvalidDataTypeException
1007
-     * @throws InvalidInterfaceException
1008
-     * @since 4.9.80.p
1009
-     */
1010
-    public function increaseReserved($qty = 1, $source = 'unknown')
1011
-    {
1012
-        $qty = absint($qty);
1013
-        do_action(
1014
-            'AHEE__EE_Ticket__increase_reserved__begin',
1015
-            $this,
1016
-            $qty,
1017
-            $source
1018
-        );
1019
-        $this->add_extra_meta(EE_Ticket::META_KEY_TICKET_RESERVATIONS, "{$qty} from {$source}");
1020
-        $success                         = false;
1021
-        $datetimes_adjusted_successfully = $this->increaseReservedForDatetimes($qty);
1022
-        if ($datetimes_adjusted_successfully) {
1023
-            $success = $this->incrementFieldConditionallyInDb(
1024
-                'TKT_reserved',
1025
-                'TKT_sold',
1026
-                'TKT_qty',
1027
-                $qty
1028
-            );
1029
-            if (! $success) {
1030
-                // The datetimes were successfully bumped, but not the
1031
-                // ticket. So we need to manually rollback the datetimes.
1032
-                $this->decreaseReservedForDatetimes($qty);
1033
-            }
1034
-        }
1035
-        do_action(
1036
-            'AHEE__EE_Ticket__increase_reserved',
1037
-            $this,
1038
-            $qty,
1039
-            $this->reserved(),
1040
-            $success
1041
-        );
1042
-        return $success;
1043
-    }
1044
-
1045
-
1046
-    /**
1047
-     * Increases reserved counts on related datetimes
1048
-     *
1049
-     * @param int           $qty
1050
-     * @param EE_Datetime[] $datetimes
1051
-     * @return boolean indicating success
1052
-     * @throws EE_Error
1053
-     * @throws InvalidArgumentException
1054
-     * @throws InvalidDataTypeException
1055
-     * @throws InvalidInterfaceException
1056
-     * @throws ReflectionException
1057
-     * @since 4.9.80.p
1058
-     */
1059
-    protected function increaseReservedForDatetimes($qty = 1, array $datetimes = [])
1060
-    {
1061
-        $datetimes         = ! empty($datetimes) ? $datetimes : $this->datetimes();
1062
-        $datetimes_updated = [];
1063
-        $limit_exceeded    = false;
1064
-        if (is_array($datetimes)) {
1065
-            foreach ($datetimes as $datetime) {
1066
-                if ($datetime instanceof EE_Datetime) {
1067
-                    if ($datetime->increaseReserved($qty)) {
1068
-                        $datetimes_updated[] = $datetime;
1069
-                    } else {
1070
-                        $limit_exceeded = true;
1071
-                        break;
1072
-                    }
1073
-                }
1074
-            }
1075
-            // If somewhere along the way we detected a datetime whose
1076
-            // limit was exceeded, do a manual rollback.
1077
-            if ($limit_exceeded) {
1078
-                $this->decreaseReservedForDatetimes($qty, $datetimes_updated);
1079
-                return false;
1080
-            }
1081
-        }
1082
-        return true;
1083
-    }
1084
-
1085
-
1086
-    /**
1087
-     * Decrements (subtracts) reserved by amount passed by $qty, and persists it immediately to the database.
1088
-     *
1089
-     * @param int    $qty
1090
-     * @param bool   $adjust_datetimes
1091
-     * @param string $source
1092
-     * @return boolean
1093
-     * @throws EE_Error
1094
-     * @throws InvalidArgumentException
1095
-     * @throws ReflectionException
1096
-     * @throws InvalidDataTypeException
1097
-     * @throws InvalidInterfaceException
1098
-     * @since 4.9.80.p
1099
-     */
1100
-    public function decreaseReserved($qty = 1, $adjust_datetimes = true, $source = 'unknown')
1101
-    {
1102
-        $qty = absint($qty);
1103
-        $this->add_extra_meta(EE_Ticket::META_KEY_TICKET_RESERVATIONS, "-{$qty} from {$source}");
1104
-        if ($adjust_datetimes) {
1105
-            $this->decreaseReservedForDatetimes($qty);
1106
-        }
1107
-        $success = $this->adjustNumericFieldsInDb(
1108
-            [
1109
-                'TKT_reserved' => $qty * -1,
1110
-            ]
1111
-        );
1112
-        do_action(
1113
-            'AHEE__EE_Ticket__decrease_reserved',
1114
-            $this,
1115
-            $qty,
1116
-            $this->reserved(),
1117
-            $success
1118
-        );
1119
-        return $success;
1120
-    }
1121
-
1122
-
1123
-    /**
1124
-     * Decreases the reserved count on the specified datetimes.
1125
-     *
1126
-     * @param int           $qty
1127
-     * @param EE_Datetime[] $datetimes
1128
-     * @throws EE_Error
1129
-     * @throws InvalidArgumentException
1130
-     * @throws ReflectionException
1131
-     * @throws InvalidDataTypeException
1132
-     * @throws InvalidInterfaceException
1133
-     * @since 4.9.80.p
1134
-     */
1135
-    protected function decreaseReservedForDatetimes($qty = 1, array $datetimes = [])
1136
-    {
1137
-        $datetimes = ! empty($datetimes) ? $datetimes : $this->datetimes();
1138
-        foreach ($datetimes as $datetime) {
1139
-            if ($datetime instanceof EE_Datetime) {
1140
-                $datetime->decreaseReserved($qty);
1141
-            }
1142
-        }
1143
-    }
1144
-
1145
-
1146
-    /**
1147
-     * Gets ticket quantity
1148
-     *
1149
-     * @param string $context     ticket quantity is somewhat subjective depending on the exact information sought
1150
-     *                            therefore $context can be one of three values: '', 'reg_limit', or 'saleable'
1151
-     *                            '' (default) quantity is the actual db value for TKT_qty, unaffected by other objects
1152
-     *                            REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes
1153
-     *                            SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and
1154
-     *                            is therefore the truest measure of tickets that can be purchased at the moment
1155
-     * @return int
1156
-     * @throws EE_Error
1157
-     * @throws ReflectionException
1158
-     */
1159
-    public function qty($context = '')
1160
-    {
1161
-        switch ($context) {
1162
-            case 'reg_limit':
1163
-                return $this->real_quantity_on_ticket();
1164
-            case 'saleable':
1165
-                return $this->real_quantity_on_ticket('saleable');
1166
-            default:
1167
-                return $this->get_raw('TKT_qty');
1168
-        }
1169
-    }
1170
-
1171
-
1172
-    /**
1173
-     * Gets ticket quantity
1174
-     *
1175
-     * @param string $context     ticket quantity is somewhat subjective depending on the exact information sought
1176
-     *                            therefore $context can be one of two values: 'reg_limit', or 'saleable'
1177
-     *                            REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes
1178
-     *                            SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and
1179
-     *                            is therefore the truest measure of tickets that can be purchased at the moment
1180
-     * @param int    $DTT_ID      the primary key for a particular datetime.
1181
-     *                            set to 0 for all related datetimes
1182
-     * @return int
1183
-     * @throws EE_Error
1184
-     * @throws ReflectionException
1185
-     */
1186
-    public function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0)
1187
-    {
1188
-        $raw = $this->get_raw('TKT_qty');
1189
-        // return immediately if it's zero
1190
-        if ($raw === 0) {
1191
-            return $raw;
1192
-        }
1193
-        // echo "\n\n<br />Ticket: " . $this->name() . '<br />';
1194
-        // ensure qty doesn't exceed raw value for THIS ticket
1195
-        $qty = min(EE_INF, $raw);
1196
-        // echo "\n . qty: " . $qty . '<br />';
1197
-        // calculate this ticket's total sales and reservations
1198
-        $sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved();
1199
-        // echo "\n . sold: " . $this->sold() . '<br />';
1200
-        // echo "\n . reserved: " . $this->reserved() . '<br />';
1201
-        // echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />';
1202
-        // first we need to calculate the maximum number of tickets available for the datetime
1203
-        // do we want data for one datetime or all of them ?
1204
-        $query_params = $DTT_ID ? [['DTT_ID' => $DTT_ID]] : [];
1205
-        $datetimes    = $this->datetimes($query_params);
1206
-        if (is_array($datetimes) && ! empty($datetimes)) {
1207
-            foreach ($datetimes as $datetime) {
1208
-                if ($datetime instanceof EE_Datetime) {
1209
-                    $datetime->refresh_from_db();
1210
-                    // echo "\n . . datetime name: " . $datetime->name() . '<br />';
1211
-                    // echo "\n . . datetime ID: " . $datetime->ID() . '<br />';
1212
-                    // initialize with no restrictions for each datetime
1213
-                    // but adjust datetime qty based on datetime reg limit
1214
-                    $datetime_qty = min(EE_INF, $datetime->reg_limit());
1215
-                    // echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />';
1216
-                    // echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
1217
-                    // if we want the actual saleable amount, then we need to consider OTHER ticket sales
1218
-                    // and reservations for this datetime, that do NOT include sales and reservations
1219
-                    // for this ticket (so we add $this->sold() and $this->reserved() back in)
1220
-                    if ($context === 'saleable') {
1221
-                        $datetime_qty = max(
1222
-                            $datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket,
1223
-                            0
1224
-                        );
1225
-                        // echo "\n . . . datetime sold: " . $datetime->sold() . '<br />';
1226
-                        // echo "\n . . . datetime reserved: " . $datetime->reserved() . '<br />';
1227
-                        // echo "\n . . . datetime sold_and_reserved: " . $datetime->sold_and_reserved() . '<br />';
1228
-                        // echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
1229
-                        $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
1230
-                        // echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
1231
-                    }
1232
-                    $qty = min($datetime_qty, $qty);
1233
-                    // echo "\n . . qty: " . $qty . '<br />';
1234
-                }
1235
-            }
1236
-        }
1237
-        // NOW that we know the  maximum number of tickets available for the datetime
1238
-        // we can finally factor in the details for this specific ticket
1239
-        if ($qty > 0 && $context === 'saleable') {
1240
-            // and subtract the sales for THIS ticket
1241
-            $qty = max($qty - $sold_and_reserved_for_this_ticket, 0);
1242
-            // echo "\n . qty: " . $qty . '<br />';
1243
-        }
1244
-        // echo "\nFINAL QTY: " . $qty . "<br /><br />";
1245
-        return $qty;
1246
-    }
1247
-
1248
-
1249
-    /**
1250
-     * Sets qty - IMPORTANT!!! Does NOT allow QTY to be set higher than the lowest reg limit of any related datetimes
1251
-     *
1252
-     * @param int $qty
1253
-     * @return void
1254
-     * @throws EE_Error
1255
-     * @throws ReflectionException
1256
-     */
1257
-    public function set_qty($qty)
1258
-    {
1259
-        $datetimes = $this->datetimes();
1260
-        foreach ($datetimes as $datetime) {
1261
-            if ($datetime instanceof EE_Datetime) {
1262
-                $qty = min($qty, $datetime->reg_limit());
1263
-            }
1264
-        }
1265
-        $this->set('TKT_qty', $qty);
1266
-    }
1267
-
1268
-
1269
-    /**
1270
-     * Gets uses
1271
-     *
1272
-     * @return int
1273
-     * @throws EE_Error
1274
-     * @throws ReflectionException
1275
-     */
1276
-    public function uses()
1277
-    {
1278
-        return $this->get('TKT_uses');
1279
-    }
1280
-
1281
-
1282
-    /**
1283
-     * Sets uses
1284
-     *
1285
-     * @param int $uses
1286
-     * @return void
1287
-     * @throws EE_Error
1288
-     * @throws ReflectionException
1289
-     */
1290
-    public function set_uses($uses)
1291
-    {
1292
-        $this->set('TKT_uses', $uses);
1293
-    }
1294
-
1295
-
1296
-    /**
1297
-     * returns whether ticket is required or not.
1298
-     *
1299
-     * @return boolean
1300
-     * @throws EE_Error
1301
-     * @throws ReflectionException
1302
-     */
1303
-    public function required()
1304
-    {
1305
-        return $this->get('TKT_required');
1306
-    }
1307
-
1308
-
1309
-    /**
1310
-     * sets the TKT_required property
1311
-     *
1312
-     * @param boolean $required
1313
-     * @return void
1314
-     * @throws EE_Error
1315
-     * @throws ReflectionException
1316
-     */
1317
-    public function set_required($required)
1318
-    {
1319
-        $this->set('TKT_required', $required);
1320
-    }
1321
-
1322
-
1323
-    /**
1324
-     * Gets taxable
1325
-     *
1326
-     * @return boolean
1327
-     * @throws EE_Error
1328
-     * @throws ReflectionException
1329
-     */
1330
-    public function taxable()
1331
-    {
1332
-        return $this->get('TKT_taxable');
1333
-    }
1334
-
1335
-
1336
-    /**
1337
-     * Sets taxable
1338
-     *
1339
-     * @param boolean $taxable
1340
-     * @return void
1341
-     * @throws EE_Error
1342
-     * @throws ReflectionException
1343
-     */
1344
-    public function set_taxable($taxable)
1345
-    {
1346
-        $this->set('TKT_taxable', $taxable);
1347
-    }
1348
-
1349
-
1350
-    /**
1351
-     * Gets is_default
1352
-     *
1353
-     * @return boolean
1354
-     * @throws EE_Error
1355
-     * @throws ReflectionException
1356
-     */
1357
-    public function is_default()
1358
-    {
1359
-        return $this->get('TKT_is_default');
1360
-    }
1361
-
1362
-
1363
-    /**
1364
-     * Sets is_default
1365
-     *
1366
-     * @param boolean $is_default
1367
-     * @return void
1368
-     * @throws EE_Error
1369
-     * @throws ReflectionException
1370
-     */
1371
-    public function set_is_default($is_default)
1372
-    {
1373
-        $this->set('TKT_is_default', $is_default);
1374
-    }
1375
-
1376
-
1377
-    /**
1378
-     * Gets order
1379
-     *
1380
-     * @return int
1381
-     * @throws EE_Error
1382
-     * @throws ReflectionException
1383
-     */
1384
-    public function order()
1385
-    {
1386
-        return $this->get('TKT_order');
1387
-    }
1388
-
1389
-
1390
-    /**
1391
-     * Sets order
1392
-     *
1393
-     * @param int $order
1394
-     * @return void
1395
-     * @throws EE_Error
1396
-     * @throws ReflectionException
1397
-     */
1398
-    public function set_order($order)
1399
-    {
1400
-        $this->set('TKT_order', $order);
1401
-    }
1402
-
1403
-
1404
-    /**
1405
-     * Gets row
1406
-     *
1407
-     * @return int
1408
-     * @throws EE_Error
1409
-     * @throws ReflectionException
1410
-     */
1411
-    public function row()
1412
-    {
1413
-        return $this->get('TKT_row');
1414
-    }
1415
-
1416
-
1417
-    /**
1418
-     * Sets row
1419
-     *
1420
-     * @param int $row
1421
-     * @return void
1422
-     * @throws EE_Error
1423
-     * @throws ReflectionException
1424
-     */
1425
-    public function set_row($row)
1426
-    {
1427
-        $this->set('TKT_row', $row);
1428
-    }
1429
-
1430
-
1431
-    /**
1432
-     * Gets deleted
1433
-     *
1434
-     * @return boolean
1435
-     * @throws EE_Error
1436
-     * @throws ReflectionException
1437
-     */
1438
-    public function deleted()
1439
-    {
1440
-        return $this->get('TKT_deleted');
1441
-    }
1442
-
1443
-
1444
-    /**
1445
-     * Sets deleted
1446
-     *
1447
-     * @param boolean $deleted
1448
-     * @return void
1449
-     * @throws EE_Error
1450
-     * @throws ReflectionException
1451
-     */
1452
-    public function set_deleted($deleted)
1453
-    {
1454
-        $this->set('TKT_deleted', $deleted);
1455
-    }
1456
-
1457
-
1458
-    /**
1459
-     * Gets parent
1460
-     *
1461
-     * @return int
1462
-     * @throws EE_Error
1463
-     * @throws ReflectionException
1464
-     */
1465
-    public function parent_ID()
1466
-    {
1467
-        return $this->get('TKT_parent');
1468
-    }
1469
-
1470
-
1471
-    /**
1472
-     * Sets parent
1473
-     *
1474
-     * @param int $parent
1475
-     * @return void
1476
-     * @throws EE_Error
1477
-     * @throws ReflectionException
1478
-     */
1479
-    public function set_parent_ID($parent)
1480
-    {
1481
-        $this->set('TKT_parent', $parent);
1482
-    }
1483
-
1484
-
1485
-    /**
1486
-     * @return boolean
1487
-     * @throws EE_Error
1488
-     * @throws InvalidArgumentException
1489
-     * @throws InvalidDataTypeException
1490
-     * @throws InvalidInterfaceException
1491
-     * @throws ReflectionException
1492
-     */
1493
-    public function reverse_calculate()
1494
-    {
1495
-        return $this->get('TKT_reverse_calculate');
1496
-    }
1497
-
1498
-
1499
-    /**
1500
-     * @param boolean $reverse_calculate
1501
-     * @throws EE_Error
1502
-     * @throws InvalidArgumentException
1503
-     * @throws InvalidDataTypeException
1504
-     * @throws InvalidInterfaceException
1505
-     * @throws ReflectionException
1506
-     */
1507
-    public function set_reverse_calculate($reverse_calculate)
1508
-    {
1509
-        $this->set('TKT_reverse_calculate', $reverse_calculate);
1510
-    }
1511
-
1512
-
1513
-    /**
1514
-     * Gets a string which is handy for showing in gateways etc that describes the ticket.
1515
-     *
1516
-     * @return string
1517
-     * @throws EE_Error
1518
-     * @throws ReflectionException
1519
-     */
1520
-    public function name_and_info()
1521
-    {
1522
-        $times = [];
1523
-        foreach ($this->datetimes() as $datetime) {
1524
-            $times[] = $datetime->start_date_and_time();
1525
-        }
1526
-        return $this->name() . ' @ ' . implode(', ', $times) . ' for ' . $this->pretty_price();
1527
-    }
1528
-
1529
-
1530
-    /**
1531
-     * Gets name
1532
-     *
1533
-     * @return string
1534
-     * @throws EE_Error
1535
-     * @throws ReflectionException
1536
-     */
1537
-    public function name()
1538
-    {
1539
-        return $this->get('TKT_name');
1540
-    }
1541
-
1542
-
1543
-    /**
1544
-     * Gets price
1545
-     *
1546
-     * @return float
1547
-     * @throws EE_Error
1548
-     * @throws ReflectionException
1549
-     */
1550
-    public function price()
1551
-    {
1552
-        return $this->get('TKT_price');
1553
-    }
1554
-
1555
-
1556
-    /**
1557
-     * Gets all the registrations for this ticket
1558
-     *
1559
-     * @param array $query_params @see
1560
-     *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1561
-     * @return EE_Registration[]|EE_Base_Class[]
1562
-     * @throws EE_Error
1563
-     * @throws ReflectionException
1564
-     */
1565
-    public function registrations($query_params = [])
1566
-    {
1567
-        return $this->get_many_related('Registration', $query_params);
1568
-    }
1569
-
1570
-
1571
-    /**
1572
-     * Updates the TKT_sold attribute (and saves) based on the number of APPROVED registrations for this ticket.
1573
-     *
1574
-     * @return int
1575
-     * @throws EE_Error
1576
-     * @throws ReflectionException
1577
-     */
1578
-    public function update_tickets_sold()
1579
-    {
1580
-        $count_regs_for_this_ticket = $this->count_registrations(
1581
-            [
1582
-                [
1583
-                    'STS_ID'      => EEM_Registration::status_id_approved,
1584
-                    'REG_deleted' => 0,
1585
-                ],
1586
-            ]
1587
-        );
1588
-        $this->set_sold($count_regs_for_this_ticket);
1589
-        $this->save();
1590
-        return $count_regs_for_this_ticket;
1591
-    }
1592
-
1593
-
1594
-    /**
1595
-     * Counts the registrations for this ticket
1596
-     *
1597
-     * @param array $query_params @see
1598
-     *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1599
-     * @return int
1600
-     * @throws EE_Error
1601
-     * @throws ReflectionException
1602
-     */
1603
-    public function count_registrations($query_params = [])
1604
-    {
1605
-        return $this->count_related('Registration', $query_params);
1606
-    }
1607
-
1608
-
1609
-    /**
1610
-     * Implementation for EEI_Has_Icon interface method.
1611
-     *
1612
-     * @return string
1613
-     * @see EEI_Visual_Representation for comments
1614
-     */
1615
-    public function get_icon()
1616
-    {
1617
-        return '<span class="dashicons dashicons-tickets-alt"/>';
1618
-    }
1619
-
1620
-
1621
-    /**
1622
-     * Implementation of the EEI_Event_Relation interface method
1623
-     *
1624
-     * @return EE_Event
1625
-     * @throws EE_Error
1626
-     * @throws UnexpectedEntityException
1627
-     * @throws ReflectionException
1628
-     * @see EEI_Event_Relation for comments
1629
-     */
1630
-    public function get_related_event()
1631
-    {
1632
-        // get one datetime to use for getting the event
1633
-        $datetime = $this->first_datetime();
1634
-        if (! $datetime instanceof EE_Datetime) {
1635
-            throw new UnexpectedEntityException(
1636
-                $datetime,
1637
-                'EE_Datetime',
1638
-                sprintf(
1639
-                    __('The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'),
1640
-                    $this->name()
1641
-                )
1642
-            );
1643
-        }
1644
-        $event = $datetime->event();
1645
-        if (! $event instanceof EE_Event) {
1646
-            throw new UnexpectedEntityException(
1647
-                $event,
1648
-                'EE_Event',
1649
-                sprintf(
1650
-                    __('The ticket (%s) is not associated with a valid event.', 'event_espresso'),
1651
-                    $this->name()
1652
-                )
1653
-            );
1654
-        }
1655
-        return $event;
1656
-    }
1657
-
1658
-
1659
-    /**
1660
-     * Implementation of the EEI_Event_Relation interface method
1661
-     *
1662
-     * @return string
1663
-     * @throws UnexpectedEntityException
1664
-     * @throws EE_Error
1665
-     * @throws ReflectionException
1666
-     * @see EEI_Event_Relation for comments
1667
-     */
1668
-    public function get_event_name()
1669
-    {
1670
-        $event = $this->get_related_event();
1671
-        return $event instanceof EE_Event ? $event->name() : '';
1672
-    }
1673
-
1674
-
1675
-    /**
1676
-     * Implementation of the EEI_Event_Relation interface method
1677
-     *
1678
-     * @return int
1679
-     * @throws UnexpectedEntityException
1680
-     * @throws EE_Error
1681
-     * @throws ReflectionException
1682
-     * @see EEI_Event_Relation for comments
1683
-     */
1684
-    public function get_event_ID()
1685
-    {
1686
-        $event = $this->get_related_event();
1687
-        return $event instanceof EE_Event ? $event->ID() : 0;
1688
-    }
1689
-
1690
-
1691
-    /**
1692
-     * This simply returns whether a ticket can be permanently deleted or not.
1693
-     * The criteria for determining this is whether the ticket has any related registrations.
1694
-     * If there are none then it can be permanently deleted.
1695
-     *
1696
-     * @return bool
1697
-     * @throws EE_Error
1698
-     * @throws ReflectionException
1699
-     */
1700
-    public function is_permanently_deleteable()
1701
-    {
1702
-        return $this->count_registrations() === 0;
1703
-    }
1704
-
1705
-
1706
-    /**
1707
-     * @return int
1708
-     * @throws EE_Error
1709
-     * @throws ReflectionException
1710
-     * @since   $VID:$
1711
-     */
1712
-    public function visibility(): int
1713
-    {
1714
-        return $this->get('TKT_visibility');
1715
-    }
1716
-
1717
-
1718
-    /**
1719
-     * @return int
1720
-     * @throws EE_Error
1721
-     * @throws ReflectionException
1722
-     * @since   $VID:$
1723
-     */
1724
-    public function isHidden(): int
1725
-    {
1726
-        return $this->visibility() === EEM_Ticket::TICKET_VISIBILITY_NONE_VALUE;
1727
-    }
1728
-
1729
-
1730
-    /**
1731
-     * @return int
1732
-     * @throws EE_Error
1733
-     * @throws ReflectionException
1734
-     * @since   $VID:$
1735
-     */
1736
-    public function isNotHidden(): int
1737
-    {
1738
-        return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_NONE_VALUE;
1739
-    }
1740
-
1741
-
1742
-    /**
1743
-     * @return int
1744
-     * @throws EE_Error
1745
-     * @throws ReflectionException
1746
-     * @since   $VID:$
1747
-     */
1748
-    public function isPublicOnly(): int
1749
-    {
1750
-        return $this->isNotHidden() && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_PUBLIC_VALUE;
1751
-    }
1752
-
1753
-
1754
-    /**
1755
-     * @return int
1756
-     * @throws EE_Error
1757
-     * @throws ReflectionException
1758
-     * @since   $VID:$
1759
-     */
1760
-    public function isMembersOnly(): int
1761
-    {
1762
-        return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_PUBLIC_VALUE
1763
-               && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_MEMBERS_ONLY_VALUE;
1764
-    }
1765
-
1766
-
1767
-    /**
1768
-     * @return int
1769
-     * @throws EE_Error
1770
-     * @throws ReflectionException
1771
-     * @since   $VID:$
1772
-     */
1773
-    public function isAdminsOnly(): int
1774
-    {
1775
-        return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_MEMBERS_ONLY_VALUE
1776
-               && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_ADMINS_ONLY_VALUE;
1777
-    }
1778
-
1779
-
1780
-    /**
1781
-     * @return int
1782
-     * @throws EE_Error
1783
-     * @throws ReflectionException
1784
-     * @since   $VID:$
1785
-     */
1786
-    public function isAdminUiOnly(): int
1787
-    {
1788
-        return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_ADMINS_ONLY_VALUE
1789
-               && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_ADMIN_UI_ONLY_VALUE;
1790
-    }
1791
-
1792
-
1793
-    /**
1794
-     * @param int $visibility
1795
-     * @throws EE_Error
1796
-     * @throws ReflectionException
1797
-     * @since   $VID:$
1798
-     */
1799
-    public function set_visibility(int $visibility)
1800
-    {
1801
-
1802
-        $ticket_visibility_options = $this->_model->ticketVisibilityOptions();
1803
-        $ticket_visibility         = -1;
1804
-        foreach ($ticket_visibility_options as $ticket_visibility_option) {
1805
-            if ($visibility === $ticket_visibility_option) {
1806
-                $ticket_visibility = $visibility;
1807
-            }
1808
-        }
1809
-        if ($ticket_visibility === -1) {
1810
-            throw new DomainException(
1811
-                sprintf(
1812
-                    esc_html__(
1813
-                        'The supplied ticket visibility setting of "%1$s" is not valid. It needs to match one of the keys in the following array:%2$s %3$s ',
1814
-                        'event_espresso'
1815
-                    ),
1816
-                    $visibility,
1817
-                    '<br />',
1818
-                    var_export($ticket_visibility_options, true)
1819
-                )
1820
-            );
1821
-        }
1822
-        $this->set('TKT_visibility', $ticket_visibility);
1823
-    }
1824
-
1825
-
1826
-    /*******************************************************************
18
+	/**
19
+	 * TicKet Sold out:
20
+	 * constant used by ticket_status() to indicate that a ticket is sold out
21
+	 * and no longer available for purchases
22
+	 */
23
+	const sold_out = 'TKS';
24
+
25
+	/**
26
+	 * TicKet Expired:
27
+	 * constant used by ticket_status() to indicate that a ticket is expired
28
+	 * and no longer available for purchase
29
+	 */
30
+	const expired = 'TKE';
31
+
32
+	/**
33
+	 * TicKet Archived:
34
+	 * constant used by ticket_status() to indicate that a ticket is archived
35
+	 * and no longer available for purchase
36
+	 */
37
+	const archived = 'TKA';
38
+
39
+	/**
40
+	 * TicKet Pending:
41
+	 * constant used by ticket_status() to indicate that a ticket is pending
42
+	 * and is NOT YET available for purchase
43
+	 */
44
+	const pending = 'TKP';
45
+
46
+	/**
47
+	 * TicKet On sale:
48
+	 * constant used by ticket_status() to indicate that a ticket is On Sale
49
+	 * and IS available for purchase
50
+	 */
51
+	const onsale = 'TKO';
52
+
53
+	/**
54
+	 * extra meta key for tracking ticket reservations
55
+	 *
56
+	 * @type string
57
+	 */
58
+	const META_KEY_TICKET_RESERVATIONS = 'ticket_reservations';
59
+
60
+	/**
61
+	 * override of parent property
62
+	 *
63
+	 * @var EEM_Ticket
64
+	 */
65
+	protected $_model;
66
+
67
+	/**
68
+	 * cached result from method of the same name
69
+	 *
70
+	 * @var float $_ticket_total_with_taxes
71
+	 */
72
+	private $_ticket_total_with_taxes;
73
+
74
+
75
+	/**
76
+	 * @param array  $props_n_values          incoming values
77
+	 * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
78
+	 *                                        used.)
79
+	 * @param array  $date_formats            incoming date_formats in an array where the first value is the
80
+	 *                                        date_format and the second value is the time format
81
+	 * @return EE_Ticket
82
+	 * @throws EE_Error
83
+	 * @throws ReflectionException
84
+	 */
85
+	public static function new_instance($props_n_values = [], $timezone = null, $date_formats = [])
86
+	{
87
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
88
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
89
+	}
90
+
91
+
92
+	/**
93
+	 * @param array  $props_n_values  incoming values from the database
94
+	 * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
95
+	 *                                the website will be used.
96
+	 * @return EE_Ticket
97
+	 * @throws EE_Error
98
+	 * @throws ReflectionException
99
+	 */
100
+	public static function new_instance_from_db($props_n_values = [], $timezone = null)
101
+	{
102
+		return new self($props_n_values, true, $timezone);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return bool
108
+	 * @throws EE_Error
109
+	 * @throws ReflectionException
110
+	 */
111
+	public function parent()
112
+	{
113
+		return $this->get('TKT_parent');
114
+	}
115
+
116
+
117
+	/**
118
+	 * return if a ticket has quantities available for purchase
119
+	 *
120
+	 * @param int $DTT_ID the primary key for a particular datetime
121
+	 * @return boolean
122
+	 * @throws EE_Error
123
+	 * @throws ReflectionException
124
+	 */
125
+	public function available($DTT_ID = 0)
126
+	{
127
+		// are we checking availability for a particular datetime ?
128
+		if ($DTT_ID) {
129
+			// get that datetime object
130
+			$datetime = $this->get_first_related('Datetime', [['DTT_ID' => $DTT_ID]]);
131
+			// if  ticket sales for this datetime have exceeded the reg limit...
132
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
133
+				return false;
134
+			}
135
+		}
136
+		// datetime is still open for registration, but is this ticket sold out ?
137
+		return $this->qty() < 1 || $this->qty() > $this->sold();
138
+	}
139
+
140
+
141
+	/**
142
+	 * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired
143
+	 *
144
+	 * @param bool        $display   true = we'll return a localized string, otherwise we just return the value of the
145
+	 *                               relevant status const
146
+	 * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save
147
+	 *                               further processing
148
+	 * @return mixed status int if the display string isn't requested
149
+	 * @throws EE_Error
150
+	 * @throws ReflectionException
151
+	 */
152
+	public function ticket_status($display = false, $remaining = null)
153
+	{
154
+		$remaining = is_bool($remaining) ? $remaining : $this->is_remaining();
155
+		if (! $remaining) {
156
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, false, 'sentence') : EE_Ticket::sold_out;
157
+		}
158
+		if ($this->get('TKT_deleted')) {
159
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, false, 'sentence') : EE_Ticket::archived;
160
+		}
161
+		if ($this->is_expired()) {
162
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, false, 'sentence') : EE_Ticket::expired;
163
+		}
164
+		if ($this->is_pending()) {
165
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, false, 'sentence') : EE_Ticket::pending;
166
+		}
167
+		if ($this->is_on_sale()) {
168
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, false, 'sentence') : EE_Ticket::onsale;
169
+		}
170
+		return '';
171
+	}
172
+
173
+
174
+	/**
175
+	 * The purpose of this method is to simply return a boolean for whether there are any tickets remaining for sale
176
+	 * considering ALL the factors used for figuring that out.
177
+	 *
178
+	 * @access public
179
+	 * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt.
180
+	 * @return boolean         true = tickets remaining, false not.
181
+	 * @throws EE_Error
182
+	 * @throws ReflectionException
183
+	 */
184
+	public function is_remaining($DTT_ID = 0)
185
+	{
186
+		$num_remaining = $this->remaining($DTT_ID);
187
+		if ($num_remaining === 0) {
188
+			return false;
189
+		}
190
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
191
+			return false;
192
+		}
193
+		return true;
194
+	}
195
+
196
+
197
+	/**
198
+	 * return the total number of tickets available for purchase
199
+	 *
200
+	 * @param int $DTT_ID  the primary key for a particular datetime.
201
+	 *                     set to 0 for all related datetimes
202
+	 * @return int
203
+	 * @throws EE_Error
204
+	 * @throws ReflectionException
205
+	 */
206
+	public function remaining($DTT_ID = 0)
207
+	{
208
+		return $this->real_quantity_on_ticket('saleable', $DTT_ID);
209
+	}
210
+
211
+
212
+	/**
213
+	 * Gets min
214
+	 *
215
+	 * @return int
216
+	 * @throws EE_Error
217
+	 * @throws ReflectionException
218
+	 */
219
+	public function min()
220
+	{
221
+		return $this->get('TKT_min');
222
+	}
223
+
224
+
225
+	/**
226
+	 * return if a ticket is no longer available cause its available dates have expired.
227
+	 *
228
+	 * @return boolean
229
+	 * @throws EE_Error
230
+	 * @throws ReflectionException
231
+	 */
232
+	public function is_expired()
233
+	{
234
+		return ($this->get_raw('TKT_end_date') < time());
235
+	}
236
+
237
+
238
+	/**
239
+	 * Return if a ticket is yet to go on sale or not
240
+	 *
241
+	 * @return boolean
242
+	 * @throws EE_Error
243
+	 * @throws ReflectionException
244
+	 */
245
+	public function is_pending()
246
+	{
247
+		return ($this->get_raw('TKT_start_date') >= time());
248
+	}
249
+
250
+
251
+	/**
252
+	 * Return if a ticket is on sale or not
253
+	 *
254
+	 * @return boolean
255
+	 * @throws EE_Error
256
+	 * @throws ReflectionException
257
+	 */
258
+	public function is_on_sale()
259
+	{
260
+		return ($this->get_raw('TKT_start_date') <= time() && $this->get_raw('TKT_end_date') >= time());
261
+	}
262
+
263
+
264
+	/**
265
+	 * This returns the chronologically last datetime that this ticket is associated with
266
+	 *
267
+	 * @param string $date_format
268
+	 * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with
269
+	 *                            the end date ie: Jan 01 "to" Dec 31
270
+	 * @return string
271
+	 * @throws EE_Error
272
+	 * @throws ReflectionException
273
+	 */
274
+	public function date_range($date_format = '', $conjunction = ' - ')
275
+	{
276
+		$date_format = ! empty($date_format) ? $date_format : $this->_dt_frmt;
277
+		$first_date  = $this->first_datetime() instanceof EE_Datetime
278
+			? $this->first_datetime()->get_i18n_datetime('DTT_EVT_start', $date_format)
279
+			: '';
280
+		$last_date   = $this->last_datetime() instanceof EE_Datetime
281
+			? $this->last_datetime()->get_i18n_datetime('DTT_EVT_end', $date_format)
282
+			: '';
283
+
284
+		return $first_date && $last_date ? $first_date . $conjunction . $last_date : '';
285
+	}
286
+
287
+
288
+	/**
289
+	 * This returns the chronologically first datetime that this ticket is associated with
290
+	 *
291
+	 * @return EE_Datetime
292
+	 * @throws EE_Error
293
+	 * @throws ReflectionException
294
+	 */
295
+	public function first_datetime()
296
+	{
297
+		$datetimes = $this->datetimes(['limit' => 1]);
298
+		return reset($datetimes);
299
+	}
300
+
301
+
302
+	/**
303
+	 * Gets all the datetimes this ticket can be used for attending.
304
+	 * Unless otherwise specified, orders datetimes by start date.
305
+	 *
306
+	 * @param array $query_params @see
307
+	 *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
308
+	 * @return EE_Datetime[]|EE_Base_Class[]
309
+	 * @throws EE_Error
310
+	 * @throws ReflectionException
311
+	 */
312
+	public function datetimes($query_params = [])
313
+	{
314
+		if (! isset($query_params['order_by'])) {
315
+			$query_params['order_by']['DTT_order'] = 'ASC';
316
+		}
317
+		return $this->get_many_related('Datetime', $query_params);
318
+	}
319
+
320
+
321
+	/**
322
+	 * This returns the chronologically last datetime that this ticket is associated with
323
+	 *
324
+	 * @return EE_Datetime
325
+	 * @throws EE_Error
326
+	 * @throws ReflectionException
327
+	 */
328
+	public function last_datetime()
329
+	{
330
+		$datetimes = $this->datetimes(['limit' => 1, 'order_by' => ['DTT_EVT_start' => 'DESC']]);
331
+		return end($datetimes);
332
+	}
333
+
334
+
335
+	/**
336
+	 * This returns the total tickets sold depending on the given parameters.
337
+	 *
338
+	 * @param string $what    Can be one of two options: 'ticket', 'datetime'.
339
+	 *                        'ticket' = total ticket sales for all datetimes this ticket is related to
340
+	 *                        'datetime' = total ticket sales for a specified datetime (required $dtt_id)
341
+	 *                        'datetime' = total ticket sales in the datetime_ticket table.
342
+	 *                        If $dtt_id is not given then we return an array of sales indexed by datetime.
343
+	 *                        If $dtt_id IS given then we return the tickets sold for that given datetime.
344
+	 * @param int    $dtt_id  [optional] include the dtt_id with $what = 'datetime'.
345
+	 * @return mixed (array|int)          how many tickets have sold
346
+	 * @throws EE_Error
347
+	 * @throws ReflectionException
348
+	 */
349
+	public function tickets_sold($what = 'ticket', $dtt_id = null)
350
+	{
351
+		$total        = 0;
352
+		$tickets_sold = $this->_all_tickets_sold();
353
+		switch ($what) {
354
+			case 'ticket':
355
+				return $tickets_sold['ticket'];
356
+				break;
357
+			case 'datetime':
358
+				if (empty($tickets_sold['datetime'])) {
359
+					return $total;
360
+				}
361
+				if (! empty($dtt_id) && ! isset($tickets_sold['datetime'][ $dtt_id ])) {
362
+					EE_Error::add_error(
363
+						__(
364
+							'You\'ve requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?',
365
+							'event_espresso'
366
+						),
367
+						__FILE__,
368
+						__FUNCTION__,
369
+						__LINE__
370
+					);
371
+					return $total;
372
+				}
373
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][ $dtt_id ];
374
+				break;
375
+			default:
376
+				return $total;
377
+		}
378
+	}
379
+
380
+
381
+	/**
382
+	 * This returns an array indexed by datetime_id for tickets sold with this ticket.
383
+	 *
384
+	 * @return EE_Ticket[]
385
+	 * @throws EE_Error
386
+	 * @throws ReflectionException
387
+	 */
388
+	protected function _all_tickets_sold()
389
+	{
390
+		$datetimes    = $this->get_many_related('Datetime');
391
+		$tickets_sold = [];
392
+		if (! empty($datetimes)) {
393
+			foreach ($datetimes as $datetime) {
394
+				$tickets_sold['datetime'][ $datetime->ID() ] = $datetime->get('DTT_sold');
395
+			}
396
+		}
397
+		// Tickets sold
398
+		$tickets_sold['ticket'] = $this->sold();
399
+		return $tickets_sold;
400
+	}
401
+
402
+
403
+	/**
404
+	 * This returns the base price object for the ticket.
405
+	 *
406
+	 * @param bool $return_array whether to return as an array indexed by price id or just the object.
407
+	 * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[]
408
+	 * @throws EE_Error
409
+	 * @throws ReflectionException
410
+	 */
411
+	public function base_price($return_array = false)
412
+	{
413
+		$_where = ['Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price];
414
+		return $return_array
415
+			? $this->get_many_related('Price', [$_where])
416
+			: $this->get_first_related('Price', [$_where]);
417
+	}
418
+
419
+
420
+	/**
421
+	 * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price)
422
+	 *
423
+	 * @access public
424
+	 * @return EE_Price[]
425
+	 * @throws EE_Error
426
+	 * @throws ReflectionException
427
+	 */
428
+	public function price_modifiers()
429
+	{
430
+		$query_params = [
431
+			0 => [
432
+				'Price_Type.PBT_ID' => [
433
+					'NOT IN',
434
+					[EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax],
435
+				],
436
+			],
437
+		];
438
+		return $this->prices($query_params);
439
+	}
440
+
441
+
442
+	/**
443
+	 * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price)
444
+	 *
445
+	 * @access public
446
+	 * @return EE_Price[]
447
+	 * @throws EE_Error
448
+	 * @throws ReflectionException
449
+	 */
450
+	public function tax_price_modifiers()
451
+	{
452
+		$query_params = [
453
+			0 => [
454
+				'Price_Type.PBT_ID' => EEM_Price_Type::base_type_tax,
455
+			],
456
+		];
457
+		return $this->prices($query_params);
458
+	}
459
+
460
+
461
+	/**
462
+	 * Gets all the prices that combine to form the final price of this ticket
463
+	 *
464
+	 * @param array $query_params @see
465
+	 *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
466
+	 * @return EE_Price[]|EE_Base_Class[]
467
+	 * @throws EE_Error
468
+	 * @throws ReflectionException
469
+	 */
470
+	public function prices($query_params = [])
471
+	{
472
+		return $this->get_many_related('Price', $query_params);
473
+	}
474
+
475
+
476
+	/**
477
+	 * Gets all the ticket datetimes (ie, relations between datetimes and tickets)
478
+	 *
479
+	 * @param array $query_params @see
480
+	 *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
481
+	 * @return EE_Datetime_Ticket|EE_Base_Class[]
482
+	 * @throws EE_Error
483
+	 * @throws ReflectionException
484
+	 */
485
+	public function datetime_tickets($query_params = [])
486
+	{
487
+		return $this->get_many_related('Datetime_Ticket', $query_params);
488
+	}
489
+
490
+
491
+	/**
492
+	 * Gets all the datetimes from the db ordered by DTT_order
493
+	 *
494
+	 * @param boolean $show_expired
495
+	 * @param boolean $show_deleted
496
+	 * @return EE_Datetime[]
497
+	 * @throws EE_Error
498
+	 * @throws ReflectionException
499
+	 */
500
+	public function datetimes_ordered($show_expired = true, $show_deleted = false)
501
+	{
502
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order(
503
+			$this->ID(),
504
+			$show_expired,
505
+			$show_deleted
506
+		);
507
+	}
508
+
509
+
510
+	/**
511
+	 * Gets ID
512
+	 *
513
+	 * @return int
514
+	 * @throws EE_Error
515
+	 * @throws ReflectionException
516
+	 */
517
+	public function ID()
518
+	{
519
+		return $this->get('TKT_ID');
520
+	}
521
+
522
+
523
+	/**
524
+	 * get the author of the ticket.
525
+	 *
526
+	 * @return int
527
+	 * @throws EE_Error
528
+	 * @throws ReflectionException
529
+	 * @since 4.5.0
530
+	 */
531
+	public function wp_user()
532
+	{
533
+		return $this->get('TKT_wp_user');
534
+	}
535
+
536
+
537
+	/**
538
+	 * Gets the template for the ticket
539
+	 *
540
+	 * @return EE_Ticket_Template|EE_Base_Class
541
+	 * @throws EE_Error
542
+	 * @throws ReflectionException
543
+	 */
544
+	public function template()
545
+	{
546
+		return $this->get_first_related('Ticket_Template');
547
+	}
548
+
549
+
550
+	/**
551
+	 * Simply returns an array of EE_Price objects that are taxes.
552
+	 *
553
+	 * @return EE_Price[]
554
+	 * @throws EE_Error
555
+	 * @throws ReflectionException
556
+	 */
557
+	public function get_ticket_taxes_for_admin(): array
558
+	{
559
+		/** @var EE_Admin_Config $admin_config */
560
+		$admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
561
+		return $admin_config->useAdvancedEditor() ? $this->tax_price_modifiers() : EE_Taxes::get_taxes_for_admin();
562
+	}
563
+
564
+
565
+	/**
566
+	 * @return float
567
+	 * @throws EE_Error
568
+	 * @throws ReflectionException
569
+	 */
570
+	public function ticket_price()
571
+	{
572
+		return $this->get('TKT_price');
573
+	}
574
+
575
+
576
+	/**
577
+	 * @return mixed
578
+	 * @throws EE_Error
579
+	 * @throws ReflectionException
580
+	 */
581
+	public function pretty_price()
582
+	{
583
+		return $this->get_pretty('TKT_price');
584
+	}
585
+
586
+
587
+	/**
588
+	 * @return bool
589
+	 * @throws EE_Error
590
+	 * @throws ReflectionException
591
+	 */
592
+	public function is_free()
593
+	{
594
+		return $this->get_ticket_total_with_taxes() === (float) 0;
595
+	}
596
+
597
+
598
+	/**
599
+	 * get_ticket_total_with_taxes
600
+	 *
601
+	 * @param bool $no_cache
602
+	 * @return float
603
+	 * @throws EE_Error
604
+	 * @throws ReflectionException
605
+	 */
606
+	public function get_ticket_total_with_taxes($no_cache = false)
607
+	{
608
+		if ($this->_ticket_total_with_taxes === null || $no_cache) {
609
+			/** @var EE_Admin_Config $admin_config */
610
+			$admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
611
+			$this->_ticket_total_with_taxes = $admin_config->useAdvancedEditor()
612
+				? $this->ticket_price()
613
+				: $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
614
+		}
615
+		return (float) $this->_ticket_total_with_taxes;
616
+	}
617
+
618
+
619
+	/**
620
+	 * @throws EE_Error
621
+	 * @throws ReflectionException
622
+	 */
623
+	public function ensure_TKT_Price_correct()
624
+	{
625
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
626
+		$this->save();
627
+	}
628
+
629
+
630
+	/**
631
+	 * @return float
632
+	 * @throws EE_Error
633
+	 * @throws ReflectionException
634
+	 */
635
+	public function get_ticket_subtotal()
636
+	{
637
+		return EE_Taxes::get_subtotal_for_admin($this);
638
+	}
639
+
640
+
641
+	/**
642
+	 * Returns the total taxes applied to this ticket
643
+	 *
644
+	 * @return float
645
+	 * @throws EE_Error
646
+	 * @throws ReflectionException
647
+	 */
648
+	public function get_ticket_taxes_total_for_admin()
649
+	{
650
+		return EE_Taxes::get_total_taxes_for_admin($this);
651
+	}
652
+
653
+
654
+	/**
655
+	 * Sets name
656
+	 *
657
+	 * @param string $name
658
+	 * @throws EE_Error
659
+	 * @throws ReflectionException
660
+	 */
661
+	public function set_name($name)
662
+	{
663
+		$this->set('TKT_name', $name);
664
+	}
665
+
666
+
667
+	/**
668
+	 * Gets description
669
+	 *
670
+	 * @return string
671
+	 * @throws EE_Error
672
+	 * @throws ReflectionException
673
+	 */
674
+	public function description()
675
+	{
676
+		return $this->get('TKT_description');
677
+	}
678
+
679
+
680
+	/**
681
+	 * Sets description
682
+	 *
683
+	 * @param string $description
684
+	 * @throws EE_Error
685
+	 * @throws ReflectionException
686
+	 */
687
+	public function set_description($description)
688
+	{
689
+		$this->set('TKT_description', $description);
690
+	}
691
+
692
+
693
+	/**
694
+	 * Gets start_date
695
+	 *
696
+	 * @param string $date_format
697
+	 * @param string $time_format
698
+	 * @return string
699
+	 * @throws EE_Error
700
+	 * @throws ReflectionException
701
+	 */
702
+	public function start_date($date_format = '', $time_format = '')
703
+	{
704
+		return $this->_get_datetime('TKT_start_date', $date_format, $time_format);
705
+	}
706
+
707
+
708
+	/**
709
+	 * Sets start_date
710
+	 *
711
+	 * @param string $start_date
712
+	 * @return void
713
+	 * @throws EE_Error
714
+	 * @throws ReflectionException
715
+	 */
716
+	public function set_start_date($start_date)
717
+	{
718
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
719
+	}
720
+
721
+
722
+	/**
723
+	 * Gets end_date
724
+	 *
725
+	 * @param string $date_format
726
+	 * @param string $time_format
727
+	 * @return string
728
+	 * @throws EE_Error
729
+	 * @throws ReflectionException
730
+	 */
731
+	public function end_date($date_format = '', $time_format = '')
732
+	{
733
+		return $this->_get_datetime('TKT_end_date', $date_format, $time_format);
734
+	}
735
+
736
+
737
+	/**
738
+	 * Sets end_date
739
+	 *
740
+	 * @param string $end_date
741
+	 * @return void
742
+	 * @throws EE_Error
743
+	 * @throws ReflectionException
744
+	 */
745
+	public function set_end_date($end_date)
746
+	{
747
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
748
+	}
749
+
750
+
751
+	/**
752
+	 * Sets sell until time
753
+	 *
754
+	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
755
+	 * @throws EE_Error
756
+	 * @throws ReflectionException
757
+	 * @since 4.5.0
758
+	 */
759
+	public function set_end_time($time)
760
+	{
761
+		$this->_set_time_for($time, 'TKT_end_date');
762
+	}
763
+
764
+
765
+	/**
766
+	 * Sets min
767
+	 *
768
+	 * @param int $min
769
+	 * @return void
770
+	 * @throws EE_Error
771
+	 * @throws ReflectionException
772
+	 */
773
+	public function set_min($min)
774
+	{
775
+		$this->set('TKT_min', $min);
776
+	}
777
+
778
+
779
+	/**
780
+	 * Gets max
781
+	 *
782
+	 * @return int
783
+	 * @throws EE_Error
784
+	 * @throws ReflectionException
785
+	 */
786
+	public function max()
787
+	{
788
+		return $this->get('TKT_max');
789
+	}
790
+
791
+
792
+	/**
793
+	 * Sets max
794
+	 *
795
+	 * @param int $max
796
+	 * @return void
797
+	 * @throws EE_Error
798
+	 * @throws ReflectionException
799
+	 */
800
+	public function set_max($max)
801
+	{
802
+		$this->set('TKT_max', $max);
803
+	}
804
+
805
+
806
+	/**
807
+	 * Sets price
808
+	 *
809
+	 * @param float $price
810
+	 * @return void
811
+	 * @throws EE_Error
812
+	 * @throws ReflectionException
813
+	 */
814
+	public function set_price($price)
815
+	{
816
+		$this->set('TKT_price', $price);
817
+	}
818
+
819
+
820
+	/**
821
+	 * Gets sold
822
+	 *
823
+	 * @return int
824
+	 * @throws EE_Error
825
+	 * @throws ReflectionException
826
+	 */
827
+	public function sold()
828
+	{
829
+		return $this->get_raw('TKT_sold');
830
+	}
831
+
832
+
833
+	/**
834
+	 * Sets sold
835
+	 *
836
+	 * @param int $sold
837
+	 * @return void
838
+	 * @throws EE_Error
839
+	 * @throws ReflectionException
840
+	 */
841
+	public function set_sold($sold)
842
+	{
843
+		// sold can not go below zero
844
+		$sold = max(0, $sold);
845
+		$this->set('TKT_sold', $sold);
846
+	}
847
+
848
+
849
+	/**
850
+	 * Increments sold by amount passed by $qty AND decrements the reserved count on both this ticket and its
851
+	 * associated datetimes.
852
+	 *
853
+	 * @param int $qty
854
+	 * @return boolean
855
+	 * @throws EE_Error
856
+	 * @throws InvalidArgumentException
857
+	 * @throws InvalidDataTypeException
858
+	 * @throws InvalidInterfaceException
859
+	 * @throws ReflectionException
860
+	 * @since 4.9.80.p
861
+	 */
862
+	public function increaseSold($qty = 1)
863
+	{
864
+		$qty = absint($qty);
865
+		// increment sold and decrement reserved datetime quantities simultaneously
866
+		// don't worry about failures, because they must have already had a spot reserved
867
+		$this->increaseSoldForDatetimes($qty);
868
+		// Increment and decrement ticket quantities simultaneously
869
+		$success = $this->adjustNumericFieldsInDb(
870
+			[
871
+				'TKT_reserved' => $qty * -1,
872
+				'TKT_sold'     => $qty,
873
+			]
874
+		);
875
+		do_action(
876
+			'AHEE__EE_Ticket__increase_sold',
877
+			$this,
878
+			$qty,
879
+			$this->sold(),
880
+			$success
881
+		);
882
+		return $success;
883
+	}
884
+
885
+
886
+	/**
887
+	 * On each datetime related to this ticket, increases its sold count and decreases its reserved count by $qty.
888
+	 *
889
+	 * @param int           $qty positive or negative. Positive means to increase sold counts (and decrease reserved
890
+	 *                           counts), Negative means to decreases old counts (and increase reserved counts).
891
+	 * @param EE_Datetime[] $datetimes
892
+	 * @throws EE_Error
893
+	 * @throws InvalidArgumentException
894
+	 * @throws InvalidDataTypeException
895
+	 * @throws InvalidInterfaceException
896
+	 * @throws ReflectionException
897
+	 * @since 4.9.80.p
898
+	 */
899
+	protected function increaseSoldForDatetimes($qty, array $datetimes = [])
900
+	{
901
+		$datetimes = ! empty($datetimes) ? $datetimes : $this->datetimes();
902
+		foreach ($datetimes as $datetime) {
903
+			$datetime->increaseSold($qty);
904
+		}
905
+	}
906
+
907
+
908
+	/**
909
+	 * Decrements (subtracts) sold by amount passed by $qty on both the ticket and its related datetimes directly in the
910
+	 * DB and then updates the model objects.
911
+	 * Does not affect the reserved counts.
912
+	 *
913
+	 * @param int $qty
914
+	 * @return boolean
915
+	 * @throws EE_Error
916
+	 * @throws InvalidArgumentException
917
+	 * @throws InvalidDataTypeException
918
+	 * @throws InvalidInterfaceException
919
+	 * @throws ReflectionException
920
+	 * @since 4.9.80.p
921
+	 */
922
+	public function decreaseSold($qty = 1)
923
+	{
924
+		$qty = absint($qty);
925
+		$this->decreaseSoldForDatetimes($qty);
926
+		$success = $this->adjustNumericFieldsInDb(
927
+			[
928
+				'TKT_sold' => $qty * -1,
929
+			]
930
+		);
931
+		do_action(
932
+			'AHEE__EE_Ticket__decrease_sold',
933
+			$this,
934
+			$qty,
935
+			$this->sold(),
936
+			$success
937
+		);
938
+		return $success;
939
+	}
940
+
941
+
942
+	/**
943
+	 * Decreases sold on related datetimes
944
+	 *
945
+	 * @param int           $qty
946
+	 * @param EE_Datetime[] $datetimes
947
+	 * @return void
948
+	 * @throws EE_Error
949
+	 * @throws InvalidArgumentException
950
+	 * @throws InvalidDataTypeException
951
+	 * @throws InvalidInterfaceException
952
+	 * @throws ReflectionException
953
+	 * @since 4.9.80.p
954
+	 */
955
+	protected function decreaseSoldForDatetimes($qty = 1, array $datetimes = [])
956
+	{
957
+		$datetimes = ! empty($datetimes) ? $datetimes : $this->datetimes();
958
+		if (is_array($datetimes)) {
959
+			foreach ($datetimes as $datetime) {
960
+				if ($datetime instanceof EE_Datetime) {
961
+					$datetime->decreaseSold($qty);
962
+				}
963
+			}
964
+		}
965
+	}
966
+
967
+
968
+	/**
969
+	 * Gets qty of reserved tickets
970
+	 *
971
+	 * @return int
972
+	 * @throws EE_Error
973
+	 * @throws ReflectionException
974
+	 */
975
+	public function reserved()
976
+	{
977
+		return $this->get_raw('TKT_reserved');
978
+	}
979
+
980
+
981
+	/**
982
+	 * Sets reserved
983
+	 *
984
+	 * @param int $reserved
985
+	 * @return void
986
+	 * @throws EE_Error
987
+	 * @throws ReflectionException
988
+	 */
989
+	public function set_reserved($reserved)
990
+	{
991
+		// reserved can not go below zero
992
+		$reserved = max(0, (int) $reserved);
993
+		$this->set('TKT_reserved', $reserved);
994
+	}
995
+
996
+
997
+	/**
998
+	 * Increments reserved by amount passed by $qty, and persists it immediately to the database.
999
+	 *
1000
+	 * @param int    $qty
1001
+	 * @param string $source
1002
+	 * @return bool whether we successfully reserved the ticket or not.
1003
+	 * @throws EE_Error
1004
+	 * @throws InvalidArgumentException
1005
+	 * @throws ReflectionException
1006
+	 * @throws InvalidDataTypeException
1007
+	 * @throws InvalidInterfaceException
1008
+	 * @since 4.9.80.p
1009
+	 */
1010
+	public function increaseReserved($qty = 1, $source = 'unknown')
1011
+	{
1012
+		$qty = absint($qty);
1013
+		do_action(
1014
+			'AHEE__EE_Ticket__increase_reserved__begin',
1015
+			$this,
1016
+			$qty,
1017
+			$source
1018
+		);
1019
+		$this->add_extra_meta(EE_Ticket::META_KEY_TICKET_RESERVATIONS, "{$qty} from {$source}");
1020
+		$success                         = false;
1021
+		$datetimes_adjusted_successfully = $this->increaseReservedForDatetimes($qty);
1022
+		if ($datetimes_adjusted_successfully) {
1023
+			$success = $this->incrementFieldConditionallyInDb(
1024
+				'TKT_reserved',
1025
+				'TKT_sold',
1026
+				'TKT_qty',
1027
+				$qty
1028
+			);
1029
+			if (! $success) {
1030
+				// The datetimes were successfully bumped, but not the
1031
+				// ticket. So we need to manually rollback the datetimes.
1032
+				$this->decreaseReservedForDatetimes($qty);
1033
+			}
1034
+		}
1035
+		do_action(
1036
+			'AHEE__EE_Ticket__increase_reserved',
1037
+			$this,
1038
+			$qty,
1039
+			$this->reserved(),
1040
+			$success
1041
+		);
1042
+		return $success;
1043
+	}
1044
+
1045
+
1046
+	/**
1047
+	 * Increases reserved counts on related datetimes
1048
+	 *
1049
+	 * @param int           $qty
1050
+	 * @param EE_Datetime[] $datetimes
1051
+	 * @return boolean indicating success
1052
+	 * @throws EE_Error
1053
+	 * @throws InvalidArgumentException
1054
+	 * @throws InvalidDataTypeException
1055
+	 * @throws InvalidInterfaceException
1056
+	 * @throws ReflectionException
1057
+	 * @since 4.9.80.p
1058
+	 */
1059
+	protected function increaseReservedForDatetimes($qty = 1, array $datetimes = [])
1060
+	{
1061
+		$datetimes         = ! empty($datetimes) ? $datetimes : $this->datetimes();
1062
+		$datetimes_updated = [];
1063
+		$limit_exceeded    = false;
1064
+		if (is_array($datetimes)) {
1065
+			foreach ($datetimes as $datetime) {
1066
+				if ($datetime instanceof EE_Datetime) {
1067
+					if ($datetime->increaseReserved($qty)) {
1068
+						$datetimes_updated[] = $datetime;
1069
+					} else {
1070
+						$limit_exceeded = true;
1071
+						break;
1072
+					}
1073
+				}
1074
+			}
1075
+			// If somewhere along the way we detected a datetime whose
1076
+			// limit was exceeded, do a manual rollback.
1077
+			if ($limit_exceeded) {
1078
+				$this->decreaseReservedForDatetimes($qty, $datetimes_updated);
1079
+				return false;
1080
+			}
1081
+		}
1082
+		return true;
1083
+	}
1084
+
1085
+
1086
+	/**
1087
+	 * Decrements (subtracts) reserved by amount passed by $qty, and persists it immediately to the database.
1088
+	 *
1089
+	 * @param int    $qty
1090
+	 * @param bool   $adjust_datetimes
1091
+	 * @param string $source
1092
+	 * @return boolean
1093
+	 * @throws EE_Error
1094
+	 * @throws InvalidArgumentException
1095
+	 * @throws ReflectionException
1096
+	 * @throws InvalidDataTypeException
1097
+	 * @throws InvalidInterfaceException
1098
+	 * @since 4.9.80.p
1099
+	 */
1100
+	public function decreaseReserved($qty = 1, $adjust_datetimes = true, $source = 'unknown')
1101
+	{
1102
+		$qty = absint($qty);
1103
+		$this->add_extra_meta(EE_Ticket::META_KEY_TICKET_RESERVATIONS, "-{$qty} from {$source}");
1104
+		if ($adjust_datetimes) {
1105
+			$this->decreaseReservedForDatetimes($qty);
1106
+		}
1107
+		$success = $this->adjustNumericFieldsInDb(
1108
+			[
1109
+				'TKT_reserved' => $qty * -1,
1110
+			]
1111
+		);
1112
+		do_action(
1113
+			'AHEE__EE_Ticket__decrease_reserved',
1114
+			$this,
1115
+			$qty,
1116
+			$this->reserved(),
1117
+			$success
1118
+		);
1119
+		return $success;
1120
+	}
1121
+
1122
+
1123
+	/**
1124
+	 * Decreases the reserved count on the specified datetimes.
1125
+	 *
1126
+	 * @param int           $qty
1127
+	 * @param EE_Datetime[] $datetimes
1128
+	 * @throws EE_Error
1129
+	 * @throws InvalidArgumentException
1130
+	 * @throws ReflectionException
1131
+	 * @throws InvalidDataTypeException
1132
+	 * @throws InvalidInterfaceException
1133
+	 * @since 4.9.80.p
1134
+	 */
1135
+	protected function decreaseReservedForDatetimes($qty = 1, array $datetimes = [])
1136
+	{
1137
+		$datetimes = ! empty($datetimes) ? $datetimes : $this->datetimes();
1138
+		foreach ($datetimes as $datetime) {
1139
+			if ($datetime instanceof EE_Datetime) {
1140
+				$datetime->decreaseReserved($qty);
1141
+			}
1142
+		}
1143
+	}
1144
+
1145
+
1146
+	/**
1147
+	 * Gets ticket quantity
1148
+	 *
1149
+	 * @param string $context     ticket quantity is somewhat subjective depending on the exact information sought
1150
+	 *                            therefore $context can be one of three values: '', 'reg_limit', or 'saleable'
1151
+	 *                            '' (default) quantity is the actual db value for TKT_qty, unaffected by other objects
1152
+	 *                            REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes
1153
+	 *                            SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and
1154
+	 *                            is therefore the truest measure of tickets that can be purchased at the moment
1155
+	 * @return int
1156
+	 * @throws EE_Error
1157
+	 * @throws ReflectionException
1158
+	 */
1159
+	public function qty($context = '')
1160
+	{
1161
+		switch ($context) {
1162
+			case 'reg_limit':
1163
+				return $this->real_quantity_on_ticket();
1164
+			case 'saleable':
1165
+				return $this->real_quantity_on_ticket('saleable');
1166
+			default:
1167
+				return $this->get_raw('TKT_qty');
1168
+		}
1169
+	}
1170
+
1171
+
1172
+	/**
1173
+	 * Gets ticket quantity
1174
+	 *
1175
+	 * @param string $context     ticket quantity is somewhat subjective depending on the exact information sought
1176
+	 *                            therefore $context can be one of two values: 'reg_limit', or 'saleable'
1177
+	 *                            REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes
1178
+	 *                            SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and
1179
+	 *                            is therefore the truest measure of tickets that can be purchased at the moment
1180
+	 * @param int    $DTT_ID      the primary key for a particular datetime.
1181
+	 *                            set to 0 for all related datetimes
1182
+	 * @return int
1183
+	 * @throws EE_Error
1184
+	 * @throws ReflectionException
1185
+	 */
1186
+	public function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0)
1187
+	{
1188
+		$raw = $this->get_raw('TKT_qty');
1189
+		// return immediately if it's zero
1190
+		if ($raw === 0) {
1191
+			return $raw;
1192
+		}
1193
+		// echo "\n\n<br />Ticket: " . $this->name() . '<br />';
1194
+		// ensure qty doesn't exceed raw value for THIS ticket
1195
+		$qty = min(EE_INF, $raw);
1196
+		// echo "\n . qty: " . $qty . '<br />';
1197
+		// calculate this ticket's total sales and reservations
1198
+		$sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved();
1199
+		// echo "\n . sold: " . $this->sold() . '<br />';
1200
+		// echo "\n . reserved: " . $this->reserved() . '<br />';
1201
+		// echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />';
1202
+		// first we need to calculate the maximum number of tickets available for the datetime
1203
+		// do we want data for one datetime or all of them ?
1204
+		$query_params = $DTT_ID ? [['DTT_ID' => $DTT_ID]] : [];
1205
+		$datetimes    = $this->datetimes($query_params);
1206
+		if (is_array($datetimes) && ! empty($datetimes)) {
1207
+			foreach ($datetimes as $datetime) {
1208
+				if ($datetime instanceof EE_Datetime) {
1209
+					$datetime->refresh_from_db();
1210
+					// echo "\n . . datetime name: " . $datetime->name() . '<br />';
1211
+					// echo "\n . . datetime ID: " . $datetime->ID() . '<br />';
1212
+					// initialize with no restrictions for each datetime
1213
+					// but adjust datetime qty based on datetime reg limit
1214
+					$datetime_qty = min(EE_INF, $datetime->reg_limit());
1215
+					// echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />';
1216
+					// echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
1217
+					// if we want the actual saleable amount, then we need to consider OTHER ticket sales
1218
+					// and reservations for this datetime, that do NOT include sales and reservations
1219
+					// for this ticket (so we add $this->sold() and $this->reserved() back in)
1220
+					if ($context === 'saleable') {
1221
+						$datetime_qty = max(
1222
+							$datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket,
1223
+							0
1224
+						);
1225
+						// echo "\n . . . datetime sold: " . $datetime->sold() . '<br />';
1226
+						// echo "\n . . . datetime reserved: " . $datetime->reserved() . '<br />';
1227
+						// echo "\n . . . datetime sold_and_reserved: " . $datetime->sold_and_reserved() . '<br />';
1228
+						// echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
1229
+						$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
1230
+						// echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
1231
+					}
1232
+					$qty = min($datetime_qty, $qty);
1233
+					// echo "\n . . qty: " . $qty . '<br />';
1234
+				}
1235
+			}
1236
+		}
1237
+		// NOW that we know the  maximum number of tickets available for the datetime
1238
+		// we can finally factor in the details for this specific ticket
1239
+		if ($qty > 0 && $context === 'saleable') {
1240
+			// and subtract the sales for THIS ticket
1241
+			$qty = max($qty - $sold_and_reserved_for_this_ticket, 0);
1242
+			// echo "\n . qty: " . $qty . '<br />';
1243
+		}
1244
+		// echo "\nFINAL QTY: " . $qty . "<br /><br />";
1245
+		return $qty;
1246
+	}
1247
+
1248
+
1249
+	/**
1250
+	 * Sets qty - IMPORTANT!!! Does NOT allow QTY to be set higher than the lowest reg limit of any related datetimes
1251
+	 *
1252
+	 * @param int $qty
1253
+	 * @return void
1254
+	 * @throws EE_Error
1255
+	 * @throws ReflectionException
1256
+	 */
1257
+	public function set_qty($qty)
1258
+	{
1259
+		$datetimes = $this->datetimes();
1260
+		foreach ($datetimes as $datetime) {
1261
+			if ($datetime instanceof EE_Datetime) {
1262
+				$qty = min($qty, $datetime->reg_limit());
1263
+			}
1264
+		}
1265
+		$this->set('TKT_qty', $qty);
1266
+	}
1267
+
1268
+
1269
+	/**
1270
+	 * Gets uses
1271
+	 *
1272
+	 * @return int
1273
+	 * @throws EE_Error
1274
+	 * @throws ReflectionException
1275
+	 */
1276
+	public function uses()
1277
+	{
1278
+		return $this->get('TKT_uses');
1279
+	}
1280
+
1281
+
1282
+	/**
1283
+	 * Sets uses
1284
+	 *
1285
+	 * @param int $uses
1286
+	 * @return void
1287
+	 * @throws EE_Error
1288
+	 * @throws ReflectionException
1289
+	 */
1290
+	public function set_uses($uses)
1291
+	{
1292
+		$this->set('TKT_uses', $uses);
1293
+	}
1294
+
1295
+
1296
+	/**
1297
+	 * returns whether ticket is required or not.
1298
+	 *
1299
+	 * @return boolean
1300
+	 * @throws EE_Error
1301
+	 * @throws ReflectionException
1302
+	 */
1303
+	public function required()
1304
+	{
1305
+		return $this->get('TKT_required');
1306
+	}
1307
+
1308
+
1309
+	/**
1310
+	 * sets the TKT_required property
1311
+	 *
1312
+	 * @param boolean $required
1313
+	 * @return void
1314
+	 * @throws EE_Error
1315
+	 * @throws ReflectionException
1316
+	 */
1317
+	public function set_required($required)
1318
+	{
1319
+		$this->set('TKT_required', $required);
1320
+	}
1321
+
1322
+
1323
+	/**
1324
+	 * Gets taxable
1325
+	 *
1326
+	 * @return boolean
1327
+	 * @throws EE_Error
1328
+	 * @throws ReflectionException
1329
+	 */
1330
+	public function taxable()
1331
+	{
1332
+		return $this->get('TKT_taxable');
1333
+	}
1334
+
1335
+
1336
+	/**
1337
+	 * Sets taxable
1338
+	 *
1339
+	 * @param boolean $taxable
1340
+	 * @return void
1341
+	 * @throws EE_Error
1342
+	 * @throws ReflectionException
1343
+	 */
1344
+	public function set_taxable($taxable)
1345
+	{
1346
+		$this->set('TKT_taxable', $taxable);
1347
+	}
1348
+
1349
+
1350
+	/**
1351
+	 * Gets is_default
1352
+	 *
1353
+	 * @return boolean
1354
+	 * @throws EE_Error
1355
+	 * @throws ReflectionException
1356
+	 */
1357
+	public function is_default()
1358
+	{
1359
+		return $this->get('TKT_is_default');
1360
+	}
1361
+
1362
+
1363
+	/**
1364
+	 * Sets is_default
1365
+	 *
1366
+	 * @param boolean $is_default
1367
+	 * @return void
1368
+	 * @throws EE_Error
1369
+	 * @throws ReflectionException
1370
+	 */
1371
+	public function set_is_default($is_default)
1372
+	{
1373
+		$this->set('TKT_is_default', $is_default);
1374
+	}
1375
+
1376
+
1377
+	/**
1378
+	 * Gets order
1379
+	 *
1380
+	 * @return int
1381
+	 * @throws EE_Error
1382
+	 * @throws ReflectionException
1383
+	 */
1384
+	public function order()
1385
+	{
1386
+		return $this->get('TKT_order');
1387
+	}
1388
+
1389
+
1390
+	/**
1391
+	 * Sets order
1392
+	 *
1393
+	 * @param int $order
1394
+	 * @return void
1395
+	 * @throws EE_Error
1396
+	 * @throws ReflectionException
1397
+	 */
1398
+	public function set_order($order)
1399
+	{
1400
+		$this->set('TKT_order', $order);
1401
+	}
1402
+
1403
+
1404
+	/**
1405
+	 * Gets row
1406
+	 *
1407
+	 * @return int
1408
+	 * @throws EE_Error
1409
+	 * @throws ReflectionException
1410
+	 */
1411
+	public function row()
1412
+	{
1413
+		return $this->get('TKT_row');
1414
+	}
1415
+
1416
+
1417
+	/**
1418
+	 * Sets row
1419
+	 *
1420
+	 * @param int $row
1421
+	 * @return void
1422
+	 * @throws EE_Error
1423
+	 * @throws ReflectionException
1424
+	 */
1425
+	public function set_row($row)
1426
+	{
1427
+		$this->set('TKT_row', $row);
1428
+	}
1429
+
1430
+
1431
+	/**
1432
+	 * Gets deleted
1433
+	 *
1434
+	 * @return boolean
1435
+	 * @throws EE_Error
1436
+	 * @throws ReflectionException
1437
+	 */
1438
+	public function deleted()
1439
+	{
1440
+		return $this->get('TKT_deleted');
1441
+	}
1442
+
1443
+
1444
+	/**
1445
+	 * Sets deleted
1446
+	 *
1447
+	 * @param boolean $deleted
1448
+	 * @return void
1449
+	 * @throws EE_Error
1450
+	 * @throws ReflectionException
1451
+	 */
1452
+	public function set_deleted($deleted)
1453
+	{
1454
+		$this->set('TKT_deleted', $deleted);
1455
+	}
1456
+
1457
+
1458
+	/**
1459
+	 * Gets parent
1460
+	 *
1461
+	 * @return int
1462
+	 * @throws EE_Error
1463
+	 * @throws ReflectionException
1464
+	 */
1465
+	public function parent_ID()
1466
+	{
1467
+		return $this->get('TKT_parent');
1468
+	}
1469
+
1470
+
1471
+	/**
1472
+	 * Sets parent
1473
+	 *
1474
+	 * @param int $parent
1475
+	 * @return void
1476
+	 * @throws EE_Error
1477
+	 * @throws ReflectionException
1478
+	 */
1479
+	public function set_parent_ID($parent)
1480
+	{
1481
+		$this->set('TKT_parent', $parent);
1482
+	}
1483
+
1484
+
1485
+	/**
1486
+	 * @return boolean
1487
+	 * @throws EE_Error
1488
+	 * @throws InvalidArgumentException
1489
+	 * @throws InvalidDataTypeException
1490
+	 * @throws InvalidInterfaceException
1491
+	 * @throws ReflectionException
1492
+	 */
1493
+	public function reverse_calculate()
1494
+	{
1495
+		return $this->get('TKT_reverse_calculate');
1496
+	}
1497
+
1498
+
1499
+	/**
1500
+	 * @param boolean $reverse_calculate
1501
+	 * @throws EE_Error
1502
+	 * @throws InvalidArgumentException
1503
+	 * @throws InvalidDataTypeException
1504
+	 * @throws InvalidInterfaceException
1505
+	 * @throws ReflectionException
1506
+	 */
1507
+	public function set_reverse_calculate($reverse_calculate)
1508
+	{
1509
+		$this->set('TKT_reverse_calculate', $reverse_calculate);
1510
+	}
1511
+
1512
+
1513
+	/**
1514
+	 * Gets a string which is handy for showing in gateways etc that describes the ticket.
1515
+	 *
1516
+	 * @return string
1517
+	 * @throws EE_Error
1518
+	 * @throws ReflectionException
1519
+	 */
1520
+	public function name_and_info()
1521
+	{
1522
+		$times = [];
1523
+		foreach ($this->datetimes() as $datetime) {
1524
+			$times[] = $datetime->start_date_and_time();
1525
+		}
1526
+		return $this->name() . ' @ ' . implode(', ', $times) . ' for ' . $this->pretty_price();
1527
+	}
1528
+
1529
+
1530
+	/**
1531
+	 * Gets name
1532
+	 *
1533
+	 * @return string
1534
+	 * @throws EE_Error
1535
+	 * @throws ReflectionException
1536
+	 */
1537
+	public function name()
1538
+	{
1539
+		return $this->get('TKT_name');
1540
+	}
1541
+
1542
+
1543
+	/**
1544
+	 * Gets price
1545
+	 *
1546
+	 * @return float
1547
+	 * @throws EE_Error
1548
+	 * @throws ReflectionException
1549
+	 */
1550
+	public function price()
1551
+	{
1552
+		return $this->get('TKT_price');
1553
+	}
1554
+
1555
+
1556
+	/**
1557
+	 * Gets all the registrations for this ticket
1558
+	 *
1559
+	 * @param array $query_params @see
1560
+	 *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1561
+	 * @return EE_Registration[]|EE_Base_Class[]
1562
+	 * @throws EE_Error
1563
+	 * @throws ReflectionException
1564
+	 */
1565
+	public function registrations($query_params = [])
1566
+	{
1567
+		return $this->get_many_related('Registration', $query_params);
1568
+	}
1569
+
1570
+
1571
+	/**
1572
+	 * Updates the TKT_sold attribute (and saves) based on the number of APPROVED registrations for this ticket.
1573
+	 *
1574
+	 * @return int
1575
+	 * @throws EE_Error
1576
+	 * @throws ReflectionException
1577
+	 */
1578
+	public function update_tickets_sold()
1579
+	{
1580
+		$count_regs_for_this_ticket = $this->count_registrations(
1581
+			[
1582
+				[
1583
+					'STS_ID'      => EEM_Registration::status_id_approved,
1584
+					'REG_deleted' => 0,
1585
+				],
1586
+			]
1587
+		);
1588
+		$this->set_sold($count_regs_for_this_ticket);
1589
+		$this->save();
1590
+		return $count_regs_for_this_ticket;
1591
+	}
1592
+
1593
+
1594
+	/**
1595
+	 * Counts the registrations for this ticket
1596
+	 *
1597
+	 * @param array $query_params @see
1598
+	 *                            https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1599
+	 * @return int
1600
+	 * @throws EE_Error
1601
+	 * @throws ReflectionException
1602
+	 */
1603
+	public function count_registrations($query_params = [])
1604
+	{
1605
+		return $this->count_related('Registration', $query_params);
1606
+	}
1607
+
1608
+
1609
+	/**
1610
+	 * Implementation for EEI_Has_Icon interface method.
1611
+	 *
1612
+	 * @return string
1613
+	 * @see EEI_Visual_Representation for comments
1614
+	 */
1615
+	public function get_icon()
1616
+	{
1617
+		return '<span class="dashicons dashicons-tickets-alt"/>';
1618
+	}
1619
+
1620
+
1621
+	/**
1622
+	 * Implementation of the EEI_Event_Relation interface method
1623
+	 *
1624
+	 * @return EE_Event
1625
+	 * @throws EE_Error
1626
+	 * @throws UnexpectedEntityException
1627
+	 * @throws ReflectionException
1628
+	 * @see EEI_Event_Relation for comments
1629
+	 */
1630
+	public function get_related_event()
1631
+	{
1632
+		// get one datetime to use for getting the event
1633
+		$datetime = $this->first_datetime();
1634
+		if (! $datetime instanceof EE_Datetime) {
1635
+			throw new UnexpectedEntityException(
1636
+				$datetime,
1637
+				'EE_Datetime',
1638
+				sprintf(
1639
+					__('The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'),
1640
+					$this->name()
1641
+				)
1642
+			);
1643
+		}
1644
+		$event = $datetime->event();
1645
+		if (! $event instanceof EE_Event) {
1646
+			throw new UnexpectedEntityException(
1647
+				$event,
1648
+				'EE_Event',
1649
+				sprintf(
1650
+					__('The ticket (%s) is not associated with a valid event.', 'event_espresso'),
1651
+					$this->name()
1652
+				)
1653
+			);
1654
+		}
1655
+		return $event;
1656
+	}
1657
+
1658
+
1659
+	/**
1660
+	 * Implementation of the EEI_Event_Relation interface method
1661
+	 *
1662
+	 * @return string
1663
+	 * @throws UnexpectedEntityException
1664
+	 * @throws EE_Error
1665
+	 * @throws ReflectionException
1666
+	 * @see EEI_Event_Relation for comments
1667
+	 */
1668
+	public function get_event_name()
1669
+	{
1670
+		$event = $this->get_related_event();
1671
+		return $event instanceof EE_Event ? $event->name() : '';
1672
+	}
1673
+
1674
+
1675
+	/**
1676
+	 * Implementation of the EEI_Event_Relation interface method
1677
+	 *
1678
+	 * @return int
1679
+	 * @throws UnexpectedEntityException
1680
+	 * @throws EE_Error
1681
+	 * @throws ReflectionException
1682
+	 * @see EEI_Event_Relation for comments
1683
+	 */
1684
+	public function get_event_ID()
1685
+	{
1686
+		$event = $this->get_related_event();
1687
+		return $event instanceof EE_Event ? $event->ID() : 0;
1688
+	}
1689
+
1690
+
1691
+	/**
1692
+	 * This simply returns whether a ticket can be permanently deleted or not.
1693
+	 * The criteria for determining this is whether the ticket has any related registrations.
1694
+	 * If there are none then it can be permanently deleted.
1695
+	 *
1696
+	 * @return bool
1697
+	 * @throws EE_Error
1698
+	 * @throws ReflectionException
1699
+	 */
1700
+	public function is_permanently_deleteable()
1701
+	{
1702
+		return $this->count_registrations() === 0;
1703
+	}
1704
+
1705
+
1706
+	/**
1707
+	 * @return int
1708
+	 * @throws EE_Error
1709
+	 * @throws ReflectionException
1710
+	 * @since   $VID:$
1711
+	 */
1712
+	public function visibility(): int
1713
+	{
1714
+		return $this->get('TKT_visibility');
1715
+	}
1716
+
1717
+
1718
+	/**
1719
+	 * @return int
1720
+	 * @throws EE_Error
1721
+	 * @throws ReflectionException
1722
+	 * @since   $VID:$
1723
+	 */
1724
+	public function isHidden(): int
1725
+	{
1726
+		return $this->visibility() === EEM_Ticket::TICKET_VISIBILITY_NONE_VALUE;
1727
+	}
1728
+
1729
+
1730
+	/**
1731
+	 * @return int
1732
+	 * @throws EE_Error
1733
+	 * @throws ReflectionException
1734
+	 * @since   $VID:$
1735
+	 */
1736
+	public function isNotHidden(): int
1737
+	{
1738
+		return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_NONE_VALUE;
1739
+	}
1740
+
1741
+
1742
+	/**
1743
+	 * @return int
1744
+	 * @throws EE_Error
1745
+	 * @throws ReflectionException
1746
+	 * @since   $VID:$
1747
+	 */
1748
+	public function isPublicOnly(): int
1749
+	{
1750
+		return $this->isNotHidden() && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_PUBLIC_VALUE;
1751
+	}
1752
+
1753
+
1754
+	/**
1755
+	 * @return int
1756
+	 * @throws EE_Error
1757
+	 * @throws ReflectionException
1758
+	 * @since   $VID:$
1759
+	 */
1760
+	public function isMembersOnly(): int
1761
+	{
1762
+		return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_PUBLIC_VALUE
1763
+			   && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_MEMBERS_ONLY_VALUE;
1764
+	}
1765
+
1766
+
1767
+	/**
1768
+	 * @return int
1769
+	 * @throws EE_Error
1770
+	 * @throws ReflectionException
1771
+	 * @since   $VID:$
1772
+	 */
1773
+	public function isAdminsOnly(): int
1774
+	{
1775
+		return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_MEMBERS_ONLY_VALUE
1776
+			   && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_ADMINS_ONLY_VALUE;
1777
+	}
1778
+
1779
+
1780
+	/**
1781
+	 * @return int
1782
+	 * @throws EE_Error
1783
+	 * @throws ReflectionException
1784
+	 * @since   $VID:$
1785
+	 */
1786
+	public function isAdminUiOnly(): int
1787
+	{
1788
+		return $this->visibility() > EEM_Ticket::TICKET_VISIBILITY_ADMINS_ONLY_VALUE
1789
+			   && $this->visibility() <= EEM_Ticket::TICKET_VISIBILITY_ADMIN_UI_ONLY_VALUE;
1790
+	}
1791
+
1792
+
1793
+	/**
1794
+	 * @param int $visibility
1795
+	 * @throws EE_Error
1796
+	 * @throws ReflectionException
1797
+	 * @since   $VID:$
1798
+	 */
1799
+	public function set_visibility(int $visibility)
1800
+	{
1801
+
1802
+		$ticket_visibility_options = $this->_model->ticketVisibilityOptions();
1803
+		$ticket_visibility         = -1;
1804
+		foreach ($ticket_visibility_options as $ticket_visibility_option) {
1805
+			if ($visibility === $ticket_visibility_option) {
1806
+				$ticket_visibility = $visibility;
1807
+			}
1808
+		}
1809
+		if ($ticket_visibility === -1) {
1810
+			throw new DomainException(
1811
+				sprintf(
1812
+					esc_html__(
1813
+						'The supplied ticket visibility setting of "%1$s" is not valid. It needs to match one of the keys in the following array:%2$s %3$s ',
1814
+						'event_espresso'
1815
+					),
1816
+					$visibility,
1817
+					'<br />',
1818
+					var_export($ticket_visibility_options, true)
1819
+				)
1820
+			);
1821
+		}
1822
+		$this->set('TKT_visibility', $ticket_visibility);
1823
+	}
1824
+
1825
+
1826
+	/*******************************************************************
1827 1827
      ***********************  DEPRECATED METHODS  **********************
1828 1828
      *******************************************************************/
1829 1829
 
1830 1830
 
1831
-    /**
1832
-     * Increments sold by amount passed by $qty AND decrements the reserved count on both this ticket and its
1833
-     * associated datetimes.
1834
-     *
1835
-     * @param int $qty
1836
-     * @return void
1837
-     * @throws EE_Error
1838
-     * @throws InvalidArgumentException
1839
-     * @throws InvalidDataTypeException
1840
-     * @throws InvalidInterfaceException
1841
-     * @throws ReflectionException
1842
-     * @deprecated 4.9.80.p
1843
-     */
1844
-    public function increase_sold($qty = 1)
1845
-    {
1846
-        EE_Error::doing_it_wrong(
1847
-            __FUNCTION__,
1848
-            esc_html__('Please use EE_Ticket::increaseSold() instead', 'event_espresso'),
1849
-            '4.9.80.p',
1850
-            '5.0.0.p'
1851
-        );
1852
-        $this->increaseSold($qty);
1853
-    }
1854
-
1855
-
1856
-    /**
1857
-     * On each datetime related to this ticket, increases its sold count and decreases its reserved count by $qty.
1858
-     *
1859
-     * @param int $qty positive or negative. Positive means to increase sold counts (and decrease reserved counts),
1860
-     *                 Negative means to decreases old counts (and increase reserved counts).
1861
-     * @throws EE_Error
1862
-     * @throws InvalidArgumentException
1863
-     * @throws InvalidDataTypeException
1864
-     * @throws InvalidInterfaceException
1865
-     * @throws ReflectionException
1866
-     * @deprecated 4.9.80.p
1867
-     */
1868
-    protected function _increase_sold_for_datetimes($qty)
1869
-    {
1870
-        EE_Error::doing_it_wrong(
1871
-            __FUNCTION__,
1872
-            esc_html__('Please use EE_Ticket::increaseSoldForDatetimes() instead', 'event_espresso'),
1873
-            '4.9.80.p',
1874
-            '5.0.0.p'
1875
-        );
1876
-        $this->increaseSoldForDatetimes($qty);
1877
-    }
1878
-
1879
-
1880
-    /**
1881
-     * Decrements (subtracts) sold by amount passed by $qty on both the ticket and its related datetimes directly in the
1882
-     * DB and then updates the model objects.
1883
-     * Does not affect the reserved counts.
1884
-     *
1885
-     * @param int $qty
1886
-     * @return void
1887
-     * @throws EE_Error
1888
-     * @throws InvalidArgumentException
1889
-     * @throws InvalidDataTypeException
1890
-     * @throws InvalidInterfaceException
1891
-     * @throws ReflectionException
1892
-     * @deprecated 4.9.80.p
1893
-     */
1894
-    public function decrease_sold($qty = 1)
1895
-    {
1896
-        EE_Error::doing_it_wrong(
1897
-            __FUNCTION__,
1898
-            esc_html__('Please use EE_Ticket::decreaseSold() instead', 'event_espresso'),
1899
-            '4.9.80.p',
1900
-            '5.0.0.p'
1901
-        );
1902
-        $this->decreaseSold($qty);
1903
-    }
1904
-
1905
-
1906
-    /**
1907
-     * Decreases sold on related datetimes
1908
-     *
1909
-     * @param int $qty
1910
-     * @return void
1911
-     * @throws EE_Error
1912
-     * @throws InvalidArgumentException
1913
-     * @throws InvalidDataTypeException
1914
-     * @throws InvalidInterfaceException
1915
-     * @throws ReflectionException
1916
-     * @deprecated 4.9.80.p
1917
-     */
1918
-    protected function _decrease_sold_for_datetimes($qty = 1)
1919
-    {
1920
-        EE_Error::doing_it_wrong(
1921
-            __FUNCTION__,
1922
-            esc_html__('Please use EE_Ticket::decreaseSoldForDatetimes() instead', 'event_espresso'),
1923
-            '4.9.80.p',
1924
-            '5.0.0.p'
1925
-        );
1926
-        $this->decreaseSoldForDatetimes($qty);
1927
-    }
1928
-
1929
-
1930
-    /**
1931
-     * Increments reserved by amount passed by $qty, and persists it immediately to the database.
1932
-     *
1933
-     * @param int    $qty
1934
-     * @param string $source
1935
-     * @return bool whether we successfully reserved the ticket or not.
1936
-     * @throws EE_Error
1937
-     * @throws InvalidArgumentException
1938
-     * @throws ReflectionException
1939
-     * @throws InvalidDataTypeException
1940
-     * @throws InvalidInterfaceException
1941
-     * @deprecated 4.9.80.p
1942
-     */
1943
-    public function increase_reserved($qty = 1, $source = 'unknown')
1944
-    {
1945
-        EE_Error::doing_it_wrong(
1946
-            __FUNCTION__,
1947
-            esc_html__('Please use EE_Ticket::increaseReserved() instead', 'event_espresso'),
1948
-            '4.9.80.p',
1949
-            '5.0.0.p'
1950
-        );
1951
-        return $this->increaseReserved($qty);
1952
-    }
1953
-
1954
-
1955
-    /**
1956
-     * Increases sold on related datetimes
1957
-     *
1958
-     * @param int $qty
1959
-     * @return boolean indicating success
1960
-     * @throws EE_Error
1961
-     * @throws InvalidArgumentException
1962
-     * @throws InvalidDataTypeException
1963
-     * @throws InvalidInterfaceException
1964
-     * @throws ReflectionException
1965
-     * @deprecated 4.9.80.p
1966
-     */
1967
-    protected function _increase_reserved_for_datetimes($qty = 1)
1968
-    {
1969
-        EE_Error::doing_it_wrong(
1970
-            __FUNCTION__,
1971
-            esc_html__('Please use EE_Ticket::increaseReservedForDatetimes() instead', 'event_espresso'),
1972
-            '4.9.80.p',
1973
-            '5.0.0.p'
1974
-        );
1975
-        return $this->increaseReservedForDatetimes($qty);
1976
-    }
1977
-
1978
-
1979
-    /**
1980
-     * Decrements (subtracts) reserved by amount passed by $qty, and persists it immediately to the database.
1981
-     *
1982
-     * @param int    $qty
1983
-     * @param bool   $adjust_datetimes
1984
-     * @param string $source
1985
-     * @return void
1986
-     * @throws EE_Error
1987
-     * @throws InvalidArgumentException
1988
-     * @throws ReflectionException
1989
-     * @throws InvalidDataTypeException
1990
-     * @throws InvalidInterfaceException
1991
-     * @deprecated 4.9.80.p
1992
-     */
1993
-    public function decrease_reserved($qty = 1, $adjust_datetimes = true, $source = 'unknown')
1994
-    {
1995
-        EE_Error::doing_it_wrong(
1996
-            __FUNCTION__,
1997
-            esc_html__('Please use EE_Ticket::decreaseReserved() instead', 'event_espresso'),
1998
-            '4.9.80.p',
1999
-            '5.0.0.p'
2000
-        );
2001
-        $this->decreaseReserved($qty);
2002
-    }
2003
-
2004
-
2005
-    /**
2006
-     * Decreases reserved on related datetimes
2007
-     *
2008
-     * @param int $qty
2009
-     * @return void
2010
-     * @throws EE_Error
2011
-     * @throws InvalidArgumentException
2012
-     * @throws ReflectionException
2013
-     * @throws InvalidDataTypeException
2014
-     * @throws InvalidInterfaceException
2015
-     * @deprecated 4.9.80.p
2016
-     */
2017
-    protected function _decrease_reserved_for_datetimes($qty = 1)
2018
-    {
2019
-        EE_Error::doing_it_wrong(
2020
-            __FUNCTION__,
2021
-            esc_html__('Please use EE_Ticket::decreaseReservedForDatetimes() instead', 'event_espresso'),
2022
-            '4.9.80.p',
2023
-            '5.0.0.p'
2024
-        );
2025
-        $this->decreaseReservedForDatetimes($qty);
2026
-    }
1831
+	/**
1832
+	 * Increments sold by amount passed by $qty AND decrements the reserved count on both this ticket and its
1833
+	 * associated datetimes.
1834
+	 *
1835
+	 * @param int $qty
1836
+	 * @return void
1837
+	 * @throws EE_Error
1838
+	 * @throws InvalidArgumentException
1839
+	 * @throws InvalidDataTypeException
1840
+	 * @throws InvalidInterfaceException
1841
+	 * @throws ReflectionException
1842
+	 * @deprecated 4.9.80.p
1843
+	 */
1844
+	public function increase_sold($qty = 1)
1845
+	{
1846
+		EE_Error::doing_it_wrong(
1847
+			__FUNCTION__,
1848
+			esc_html__('Please use EE_Ticket::increaseSold() instead', 'event_espresso'),
1849
+			'4.9.80.p',
1850
+			'5.0.0.p'
1851
+		);
1852
+		$this->increaseSold($qty);
1853
+	}
1854
+
1855
+
1856
+	/**
1857
+	 * On each datetime related to this ticket, increases its sold count and decreases its reserved count by $qty.
1858
+	 *
1859
+	 * @param int $qty positive or negative. Positive means to increase sold counts (and decrease reserved counts),
1860
+	 *                 Negative means to decreases old counts (and increase reserved counts).
1861
+	 * @throws EE_Error
1862
+	 * @throws InvalidArgumentException
1863
+	 * @throws InvalidDataTypeException
1864
+	 * @throws InvalidInterfaceException
1865
+	 * @throws ReflectionException
1866
+	 * @deprecated 4.9.80.p
1867
+	 */
1868
+	protected function _increase_sold_for_datetimes($qty)
1869
+	{
1870
+		EE_Error::doing_it_wrong(
1871
+			__FUNCTION__,
1872
+			esc_html__('Please use EE_Ticket::increaseSoldForDatetimes() instead', 'event_espresso'),
1873
+			'4.9.80.p',
1874
+			'5.0.0.p'
1875
+		);
1876
+		$this->increaseSoldForDatetimes($qty);
1877
+	}
1878
+
1879
+
1880
+	/**
1881
+	 * Decrements (subtracts) sold by amount passed by $qty on both the ticket and its related datetimes directly in the
1882
+	 * DB and then updates the model objects.
1883
+	 * Does not affect the reserved counts.
1884
+	 *
1885
+	 * @param int $qty
1886
+	 * @return void
1887
+	 * @throws EE_Error
1888
+	 * @throws InvalidArgumentException
1889
+	 * @throws InvalidDataTypeException
1890
+	 * @throws InvalidInterfaceException
1891
+	 * @throws ReflectionException
1892
+	 * @deprecated 4.9.80.p
1893
+	 */
1894
+	public function decrease_sold($qty = 1)
1895
+	{
1896
+		EE_Error::doing_it_wrong(
1897
+			__FUNCTION__,
1898
+			esc_html__('Please use EE_Ticket::decreaseSold() instead', 'event_espresso'),
1899
+			'4.9.80.p',
1900
+			'5.0.0.p'
1901
+		);
1902
+		$this->decreaseSold($qty);
1903
+	}
1904
+
1905
+
1906
+	/**
1907
+	 * Decreases sold on related datetimes
1908
+	 *
1909
+	 * @param int $qty
1910
+	 * @return void
1911
+	 * @throws EE_Error
1912
+	 * @throws InvalidArgumentException
1913
+	 * @throws InvalidDataTypeException
1914
+	 * @throws InvalidInterfaceException
1915
+	 * @throws ReflectionException
1916
+	 * @deprecated 4.9.80.p
1917
+	 */
1918
+	protected function _decrease_sold_for_datetimes($qty = 1)
1919
+	{
1920
+		EE_Error::doing_it_wrong(
1921
+			__FUNCTION__,
1922
+			esc_html__('Please use EE_Ticket::decreaseSoldForDatetimes() instead', 'event_espresso'),
1923
+			'4.9.80.p',
1924
+			'5.0.0.p'
1925
+		);
1926
+		$this->decreaseSoldForDatetimes($qty);
1927
+	}
1928
+
1929
+
1930
+	/**
1931
+	 * Increments reserved by amount passed by $qty, and persists it immediately to the database.
1932
+	 *
1933
+	 * @param int    $qty
1934
+	 * @param string $source
1935
+	 * @return bool whether we successfully reserved the ticket or not.
1936
+	 * @throws EE_Error
1937
+	 * @throws InvalidArgumentException
1938
+	 * @throws ReflectionException
1939
+	 * @throws InvalidDataTypeException
1940
+	 * @throws InvalidInterfaceException
1941
+	 * @deprecated 4.9.80.p
1942
+	 */
1943
+	public function increase_reserved($qty = 1, $source = 'unknown')
1944
+	{
1945
+		EE_Error::doing_it_wrong(
1946
+			__FUNCTION__,
1947
+			esc_html__('Please use EE_Ticket::increaseReserved() instead', 'event_espresso'),
1948
+			'4.9.80.p',
1949
+			'5.0.0.p'
1950
+		);
1951
+		return $this->increaseReserved($qty);
1952
+	}
1953
+
1954
+
1955
+	/**
1956
+	 * Increases sold on related datetimes
1957
+	 *
1958
+	 * @param int $qty
1959
+	 * @return boolean indicating success
1960
+	 * @throws EE_Error
1961
+	 * @throws InvalidArgumentException
1962
+	 * @throws InvalidDataTypeException
1963
+	 * @throws InvalidInterfaceException
1964
+	 * @throws ReflectionException
1965
+	 * @deprecated 4.9.80.p
1966
+	 */
1967
+	protected function _increase_reserved_for_datetimes($qty = 1)
1968
+	{
1969
+		EE_Error::doing_it_wrong(
1970
+			__FUNCTION__,
1971
+			esc_html__('Please use EE_Ticket::increaseReservedForDatetimes() instead', 'event_espresso'),
1972
+			'4.9.80.p',
1973
+			'5.0.0.p'
1974
+		);
1975
+		return $this->increaseReservedForDatetimes($qty);
1976
+	}
1977
+
1978
+
1979
+	/**
1980
+	 * Decrements (subtracts) reserved by amount passed by $qty, and persists it immediately to the database.
1981
+	 *
1982
+	 * @param int    $qty
1983
+	 * @param bool   $adjust_datetimes
1984
+	 * @param string $source
1985
+	 * @return void
1986
+	 * @throws EE_Error
1987
+	 * @throws InvalidArgumentException
1988
+	 * @throws ReflectionException
1989
+	 * @throws InvalidDataTypeException
1990
+	 * @throws InvalidInterfaceException
1991
+	 * @deprecated 4.9.80.p
1992
+	 */
1993
+	public function decrease_reserved($qty = 1, $adjust_datetimes = true, $source = 'unknown')
1994
+	{
1995
+		EE_Error::doing_it_wrong(
1996
+			__FUNCTION__,
1997
+			esc_html__('Please use EE_Ticket::decreaseReserved() instead', 'event_espresso'),
1998
+			'4.9.80.p',
1999
+			'5.0.0.p'
2000
+		);
2001
+		$this->decreaseReserved($qty);
2002
+	}
2003
+
2004
+
2005
+	/**
2006
+	 * Decreases reserved on related datetimes
2007
+	 *
2008
+	 * @param int $qty
2009
+	 * @return void
2010
+	 * @throws EE_Error
2011
+	 * @throws InvalidArgumentException
2012
+	 * @throws ReflectionException
2013
+	 * @throws InvalidDataTypeException
2014
+	 * @throws InvalidInterfaceException
2015
+	 * @deprecated 4.9.80.p
2016
+	 */
2017
+	protected function _decrease_reserved_for_datetimes($qty = 1)
2018
+	{
2019
+		EE_Error::doing_it_wrong(
2020
+			__FUNCTION__,
2021
+			esc_html__('Please use EE_Ticket::decreaseReservedForDatetimes() instead', 'event_espresso'),
2022
+			'4.9.80.p',
2023
+			'5.0.0.p'
2024
+		);
2025
+		$this->decreaseReservedForDatetimes($qty);
2026
+	}
2027 2027
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Line_Item_List_Shortcodes.lib.php 2 patches
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -22,201 +22,201 @@
 block discarded – undo
22 22
 {
23 23
 
24 24
 
25
-    protected function _init_props()
26
-    {
27
-        $this->label = __('Line Item List Shortcodes', 'event_espresso');
28
-        $this->description = __('All shortcodes specific to line item lists', 'event_espresso');
29
-        $this->_shortcodes = array(
30
-            '[TICKET_LINE_ITEM_LIST]'         => __('Outputs a list of ticket line items.', 'event_espresso'),
31
-            '[TAX_LINE_ITEM_LIST]'            => __('Outputs a list of tax line items.', 'event_espresso'),
32
-            '[ADDITIONAL_LINE_ITEM_LIST]'     => __(
33
-                'Outputs a list of additional line items (other charges or discounts)',
34
-                'event_espresso'
35
-            ),
36
-            '[PRICE_MODIFIER_LINE_ITEM_LIST]' => __('Outputs a list of price modifier line items', 'event_espresso'),
37
-        );
38
-    }
39
-
40
-
41
-    protected function _parser($shortcode)
42
-    {
43
-
44
-        switch ($shortcode) {
45
-            case '[TICKET_LINE_ITEM_LIST]':
46
-                return $this->_get_ticket_line_item_list();
47
-
48
-            case '[TAX_LINE_ITEM_LIST]':
49
-                return $this->_get_tax_line_item_list();
50
-
51
-            case '[PRICE_MODIFIER_LINE_ITEM_LIST]':
52
-                return $this->_get_price_mod_line_item_list();
53
-
54
-            case '[ADDITIONAL_LINE_ITEM_LIST]':
55
-                return $this->_get_additional_line_item_list();
56
-
57
-            default:
58
-                return '';
59
-        }
60
-    }
61
-
62
-
63
-    /**
64
-     * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event.
65
-     *
66
-     * @since 4.5.0
67
-     *
68
-     * @return string parsed ticket line item list.
69
-     */
70
-    private function _get_ticket_line_item_list()
71
-    {
72
-        $this->_validate_list_requirements();
73
-
74
-        if (! $this->_data['data'] instanceof EE_Ticket) {
75
-            return '';
76
-        }
77
-
78
-        $valid_shortcodes = array('line_item', 'line_item_list', 'ticket');
79
-
80
-        $ticket = $this->_data['data'];
81
-        $templates = $this->_extra_data['template'];
82
-        $addressee_obj = $this->_extra_data['data'];
83
-
84
-        // made it here so we have an EE_Ticket, so we should have what we need.
85
-        $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item'])
86
-            ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null;
87
-        $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'])
88
-            ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array();
89
-
90
-        $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms']
91
-            : $templates['ticket_line_item_pms'];
92
-
93
-        if (empty($ticket_line_item) || empty($sub_line_items)) {
94
-            return '';
95
-        }
96
-
97
-        // now we just return the appropriate template parsed for each ticket.
98
-        return $this->_shortcode_helper->parse_line_item_list_template(
99
-            $template,
100
-            $ticket_line_item,
101
-            $valid_shortcodes,
102
-            $this->_extra_data
103
-        );
104
-    }
105
-
106
-
107
-    /**
108
-     * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction.
109
-     *
110
-     * @return string  parsed tax line item list.
111
-     * @throws EE_Error
112
-     * @since 4.5.0
113
-     */
114
-    private function _get_tax_line_item_list()
115
-    {
116
-        /** @var EE_Admin_Config $admin_config */
117
-        $admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
118
-        if ($admin_config->useAdvancedEditor()) {
119
-            return '';
120
-        }
121
-        $this->_validate_list_requirements();
122
-
123
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
124
-            return '';
125
-        }
126
-
127
-        // made it here so we're good to go.
128
-        $valid_shortcodes = array('line_item');
129
-        $templates = $this->_data['template'];
130
-
131
-        $tax_line_items = $this->_data['data']->tax_line_items;
132
-        $line_item_list = '';
133
-        foreach ($tax_line_items as $line_item) {
134
-            $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
135
-                $templates['tax_line_item_list'],
136
-                $line_item,
137
-                $valid_shortcodes,
138
-                $this->_extra_data
139
-            );
140
-        }
141
-
142
-        return $line_item_list;
143
-    }
144
-
145
-    /**
146
-     * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction.
147
-     *
148
-     * @since 4.5.0
149
-     *
150
-     * @return string  parsed other line item list.
151
-     */
152
-    private function _get_additional_line_item_list()
153
-    {
154
-
155
-        $this->_validate_list_requirements();
156
-
157
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
158
-            return '';
159
-        }
160
-
161
-        // made it here so we're good to go.
162
-        $valid_shortcodes = array('line_item');
163
-        $templates = $this->_data['template'];
164
-
165
-        $additional_line_items = $this->_data['data']->additional_line_items;
166
-        $line_item_list = '';
167
-        foreach ($additional_line_items as $line_item) {
168
-            $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
169
-                $templates['additional_line_item_list'],
170
-                $line_item,
171
-                $valid_shortcodes,
172
-                $this->_extra_data
173
-            );
174
-        }
175
-
176
-
177
-        return $line_item_list;
178
-    }
179
-
180
-
181
-    /**
182
-     * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a
183
-     * parent ticket line item.
184
-     *
185
-     * @since 4.5.0
186
-     *
187
-     * @return string parsed price modifier line item list.
188
-     */
189
-    private function _get_price_mod_line_item_list()
190
-    {
191
-        $this->_validate_list_requirements();
192
-
193
-        if (! $this->_data['data'] instanceof EE_Line_Item) {
194
-            return '';
195
-        }
196
-
197
-        // made it here so we're good to go.
198
-        $main_line_item = $this->_data['data'];
199
-        $templates = $this->_extra_data['template'];
200
-        $addressee_obj = $this->_extra_data['data'];
201
-
202
-        $valid_shortcodes = array('line_item');
203
-
204
-        $main_line_item_id = $main_line_item->ID();
205
-
206
-        $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children'])
207
-            ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array();
208
-
209
-        $line_item_list = '';
210
-
211
-        foreach ($price_mod_line_items as $line_item) {
212
-            $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
213
-                $templates['price_modifier_line_item_list'],
214
-                $line_item,
215
-                $valid_shortcodes,
216
-                $this->_extra_data
217
-            );
218
-        }
219
-
220
-        return $line_item_list;
221
-    }
25
+	protected function _init_props()
26
+	{
27
+		$this->label = __('Line Item List Shortcodes', 'event_espresso');
28
+		$this->description = __('All shortcodes specific to line item lists', 'event_espresso');
29
+		$this->_shortcodes = array(
30
+			'[TICKET_LINE_ITEM_LIST]'         => __('Outputs a list of ticket line items.', 'event_espresso'),
31
+			'[TAX_LINE_ITEM_LIST]'            => __('Outputs a list of tax line items.', 'event_espresso'),
32
+			'[ADDITIONAL_LINE_ITEM_LIST]'     => __(
33
+				'Outputs a list of additional line items (other charges or discounts)',
34
+				'event_espresso'
35
+			),
36
+			'[PRICE_MODIFIER_LINE_ITEM_LIST]' => __('Outputs a list of price modifier line items', 'event_espresso'),
37
+		);
38
+	}
39
+
40
+
41
+	protected function _parser($shortcode)
42
+	{
43
+
44
+		switch ($shortcode) {
45
+			case '[TICKET_LINE_ITEM_LIST]':
46
+				return $this->_get_ticket_line_item_list();
47
+
48
+			case '[TAX_LINE_ITEM_LIST]':
49
+				return $this->_get_tax_line_item_list();
50
+
51
+			case '[PRICE_MODIFIER_LINE_ITEM_LIST]':
52
+				return $this->_get_price_mod_line_item_list();
53
+
54
+			case '[ADDITIONAL_LINE_ITEM_LIST]':
55
+				return $this->_get_additional_line_item_list();
56
+
57
+			default:
58
+				return '';
59
+		}
60
+	}
61
+
62
+
63
+	/**
64
+	 * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event.
65
+	 *
66
+	 * @since 4.5.0
67
+	 *
68
+	 * @return string parsed ticket line item list.
69
+	 */
70
+	private function _get_ticket_line_item_list()
71
+	{
72
+		$this->_validate_list_requirements();
73
+
74
+		if (! $this->_data['data'] instanceof EE_Ticket) {
75
+			return '';
76
+		}
77
+
78
+		$valid_shortcodes = array('line_item', 'line_item_list', 'ticket');
79
+
80
+		$ticket = $this->_data['data'];
81
+		$templates = $this->_extra_data['template'];
82
+		$addressee_obj = $this->_extra_data['data'];
83
+
84
+		// made it here so we have an EE_Ticket, so we should have what we need.
85
+		$ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item'])
86
+			? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null;
87
+		$sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'])
88
+			? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array();
89
+
90
+		$template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms']
91
+			: $templates['ticket_line_item_pms'];
92
+
93
+		if (empty($ticket_line_item) || empty($sub_line_items)) {
94
+			return '';
95
+		}
96
+
97
+		// now we just return the appropriate template parsed for each ticket.
98
+		return $this->_shortcode_helper->parse_line_item_list_template(
99
+			$template,
100
+			$ticket_line_item,
101
+			$valid_shortcodes,
102
+			$this->_extra_data
103
+		);
104
+	}
105
+
106
+
107
+	/**
108
+	 * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction.
109
+	 *
110
+	 * @return string  parsed tax line item list.
111
+	 * @throws EE_Error
112
+	 * @since 4.5.0
113
+	 */
114
+	private function _get_tax_line_item_list()
115
+	{
116
+		/** @var EE_Admin_Config $admin_config */
117
+		$admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
118
+		if ($admin_config->useAdvancedEditor()) {
119
+			return '';
120
+		}
121
+		$this->_validate_list_requirements();
122
+
123
+		if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
124
+			return '';
125
+		}
126
+
127
+		// made it here so we're good to go.
128
+		$valid_shortcodes = array('line_item');
129
+		$templates = $this->_data['template'];
130
+
131
+		$tax_line_items = $this->_data['data']->tax_line_items;
132
+		$line_item_list = '';
133
+		foreach ($tax_line_items as $line_item) {
134
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
135
+				$templates['tax_line_item_list'],
136
+				$line_item,
137
+				$valid_shortcodes,
138
+				$this->_extra_data
139
+			);
140
+		}
141
+
142
+		return $line_item_list;
143
+	}
144
+
145
+	/**
146
+	 * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction.
147
+	 *
148
+	 * @since 4.5.0
149
+	 *
150
+	 * @return string  parsed other line item list.
151
+	 */
152
+	private function _get_additional_line_item_list()
153
+	{
154
+
155
+		$this->_validate_list_requirements();
156
+
157
+		if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
158
+			return '';
159
+		}
160
+
161
+		// made it here so we're good to go.
162
+		$valid_shortcodes = array('line_item');
163
+		$templates = $this->_data['template'];
164
+
165
+		$additional_line_items = $this->_data['data']->additional_line_items;
166
+		$line_item_list = '';
167
+		foreach ($additional_line_items as $line_item) {
168
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
169
+				$templates['additional_line_item_list'],
170
+				$line_item,
171
+				$valid_shortcodes,
172
+				$this->_extra_data
173
+			);
174
+		}
175
+
176
+
177
+		return $line_item_list;
178
+	}
179
+
180
+
181
+	/**
182
+	 * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a
183
+	 * parent ticket line item.
184
+	 *
185
+	 * @since 4.5.0
186
+	 *
187
+	 * @return string parsed price modifier line item list.
188
+	 */
189
+	private function _get_price_mod_line_item_list()
190
+	{
191
+		$this->_validate_list_requirements();
192
+
193
+		if (! $this->_data['data'] instanceof EE_Line_Item) {
194
+			return '';
195
+		}
196
+
197
+		// made it here so we're good to go.
198
+		$main_line_item = $this->_data['data'];
199
+		$templates = $this->_extra_data['template'];
200
+		$addressee_obj = $this->_extra_data['data'];
201
+
202
+		$valid_shortcodes = array('line_item');
203
+
204
+		$main_line_item_id = $main_line_item->ID();
205
+
206
+		$price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children'])
207
+			? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array();
208
+
209
+		$line_item_list = '';
210
+
211
+		foreach ($price_mod_line_items as $line_item) {
212
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template(
213
+				$templates['price_modifier_line_item_list'],
214
+				$line_item,
215
+				$valid_shortcodes,
216
+				$this->_extra_data
217
+			);
218
+		}
219
+
220
+		return $line_item_list;
221
+	}
222 222
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $this->_validate_list_requirements();
73 73
 
74
-        if (! $this->_data['data'] instanceof EE_Ticket) {
74
+        if ( ! $this->_data['data'] instanceof EE_Ticket) {
75 75
             return '';
76 76
         }
77 77
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
         $addressee_obj = $this->_extra_data['data'];
83 83
 
84 84
         // made it here so we have an EE_Ticket, so we should have what we need.
85
-        $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item'])
86
-            ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null;
87
-        $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'])
88
-            ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array();
85
+        $ticket_line_item = isset($addressee_obj->tickets[$ticket->ID()]['line_item'])
86
+            ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null;
87
+        $sub_line_items = isset($addressee_obj->tickets[$ticket->ID()]['sub_line_items'])
88
+            ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array();
89 89
 
90 90
         $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms']
91 91
             : $templates['ticket_line_item_pms'];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         }
121 121
         $this->_validate_list_requirements();
122 122
 
123
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
123
+        if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) {
124 124
             return '';
125 125
         }
126 126
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
         $this->_validate_list_requirements();
156 156
 
157
-        if (! $this->_data['data'] instanceof EE_Messages_Addressee) {
157
+        if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) {
158 158
             return '';
159 159
         }
160 160
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     {
191 191
         $this->_validate_list_requirements();
192 192
 
193
-        if (! $this->_data['data'] instanceof EE_Line_Item) {
193
+        if ( ! $this->_data['data'] instanceof EE_Line_Item) {
194 194
             return '';
195 195
         }
196 196
 
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 
204 204
         $main_line_item_id = $main_line_item->ID();
205 205
 
206
-        $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children'])
207
-            ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array();
206
+        $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[$main_line_item_id]['children'])
207
+            ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array();
208 208
 
209 209
         $line_item_list = '';
210 210
 
Please login to merge, or discard this patch.
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 2 patches
Indentation   +659 added lines, -659 removed lines patch added patch discarded remove patch
@@ -12,663 +12,663 @@
 block discarded – undo
12 12
 class EE_SPCO_Line_Item_Display_Strategy implements EEI_Line_Item_Display
13 13
 {
14 14
 
15
-    /**
16
-     * array of events
17
-     *
18
-     * @type EE_Line_Item[] $_events
19
-     */
20
-    private $_events = array();
21
-
22
-    /**
23
-     * whether to display the taxes row or not
24
-     *
25
-     * @type bool $_show_taxes
26
-     */
27
-    private $_show_taxes = false;
28
-
29
-    /**
30
-     * html for any tax rows
31
-     *
32
-     * @type string $_show_taxes
33
-     */
34
-    private $_taxes_html = '';
35
-
36
-    /**
37
-     * total amount including tax we can bill for at this time
38
-     *
39
-     * @type float $_grand_total
40
-     */
41
-    private $_grand_total = 0.00;
42
-
43
-    /**
44
-     * total number of items being billed for
45
-     *
46
-     * @type int $_total_items
47
-     */
48
-    private $_total_items = 0;
49
-
50
-
51
-
52
-    /**
53
-     * @return float
54
-     */
55
-    public function grand_total()
56
-    {
57
-        return $this->_grand_total;
58
-    }
59
-
60
-
61
-
62
-    /**
63
-     * @return int
64
-     */
65
-    public function total_items()
66
-    {
67
-        return $this->_total_items;
68
-    }
69
-
70
-
71
-
72
-    /**
73
-     * @param EE_Line_Item $line_item
74
-     * @param array        $options
75
-     * @param EE_Line_Item $parent_line_item
76
-     * @return mixed
77
-     * @throws EE_Error
78
-     */
79
-    public function display_line_item(
80
-        EE_Line_Item $line_item,
81
-        $options = array(),
82
-        EE_Line_Item $parent_line_item = null
83
-    ) {
84
-        $html = '';
85
-        // set some default options and merge with incoming
86
-        $default_options = array(
87
-            'show_desc' => true,  //    true        false
88
-            'odd'       => false,
89
-        );
90
-        $options = array_merge($default_options, (array) $options);
91
-        switch ($line_item->type()) {
92
-            case EEM_Line_Item::type_line_item:
93
-                $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
94
-                if ($line_item->OBJ_type() === 'Ticket') {
95
-                    // item row
96
-                    $html .= $this->_ticket_row($line_item, $options);
97
-                } else {
98
-                    // item row
99
-                    $html .= $this->_item_row($line_item, $options);
100
-                }
101
-                if (
102
-                    apply_filters(
103
-                        'FHEE__EE_SPCO_Line_Item_Display_Strategy__display_line_item__display_sub_line_items',
104
-                        true
105
-                    )
106
-                ) {
107
-                    // got any kids?
108
-                    foreach ($line_item->children() as $child_line_item) {
109
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
110
-                    }
111
-                }
112
-                break;
113
-            case EEM_Line_Item::type_sub_line_item:
114
-                $html .= $this->_sub_item_row($line_item, $options, $parent_line_item);
115
-                break;
116
-            case EEM_Line_Item::type_sub_total:
117
-                static $sub_total = 0;
118
-                $event_sub_total = 0;
119
-                $text = esc_html__('Sub-Total', 'event_espresso');
120
-                if ($line_item->OBJ_type() === 'Event') {
121
-                    $options['event_id'] = $event_id = $line_item->OBJ_ID();
122
-                    if (! isset($this->_events[ $options['event_id'] ])) {
123
-                        $event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
124
-                        // if event has default reg status of Not Approved, then don't display info on it
125
-                        if (
126
-                            $event instanceof EE_Event
127
-                            && $event->default_registration_status() === EEM_Registration::status_id_not_approved
128
-                        ) {
129
-                            $display_event = false;
130
-                            // unless there are registrations for it that are returning to pay
131
-                            if (isset($options['registrations']) && is_array($options['registrations'])) {
132
-                                foreach ($options['registrations'] as $registration) {
133
-                                    if (! $registration instanceof EE_Registration) {
134
-                                        continue;
135
-                                    }
136
-                                    $display_event = $registration->event_ID() === $options['event_id']
137
-                                                     && $registration->status_ID() !== EEM_Registration::status_id_not_approved
138
-                                        ? true
139
-                                        : $display_event;
140
-                                }
141
-                            }
142
-                            if (! $display_event) {
143
-                                return '';
144
-                            }
145
-                        }
146
-                        $this->_events[ $options['event_id'] ] = 0;
147
-                        $html .= $this->_event_row($line_item);
148
-                        $text = esc_html__('Event Sub-Total', 'event_espresso');
149
-                    }
150
-                }
151
-                $child_line_items = $line_item->children();
152
-                // loop thru children
153
-                foreach ($child_line_items as $child_line_item) {
154
-                    // recursively feed children back into this method
155
-                    $html .= $this->display_line_item($child_line_item, $options, $line_item);
156
-                }
157
-                $event_sub_total += isset($options['event_id']) ? $this->_events[ $options['event_id'] ] : 0;
158
-                $sub_total += $event_sub_total;
159
-                if (
160
-                    (
161
-                        // event subtotals
162
-                        $line_item->code() !== 'pre-tax-subtotal' && count($child_line_items) > 1
163
-                    )
164
-                    || (
165
-                        // pre-tax subtotals
166
-                        $line_item->code() === 'pre-tax-subtotal' && count($this->_events) > 1
167
-                    )
168
-                ) {
169
-                    $options['sub_total'] = $line_item->OBJ_type() === 'Event' ? $event_sub_total : $sub_total;
170
-                    $html .= $this->_sub_total_row($line_item, $text, $options);
171
-                }
172
-                break;
173
-            case EEM_Line_Item::type_tax:
174
-                if ($this->_show_taxes) {
175
-                    $this->_taxes_html .= $this->_tax_row($line_item, $options);
176
-                }
177
-                break;
178
-            case EEM_Line_Item::type_tax_sub_total:
179
-                if ($this->_show_taxes) {
180
-                    $child_line_items = $line_item->children();
181
-                    // loop thru children
182
-                    foreach ($child_line_items as $child_line_item) {
183
-                        // recursively feed children back into this method
184
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
185
-                    }
186
-                    if (count($child_line_items) > 1) {
187
-                        $this->_taxes_html .= $this->_total_tax_row($line_item, esc_html__('Tax Total', 'event_espresso'));
188
-                    }
189
-                }
190
-                break;
191
-            case EEM_Line_Item::type_total:
192
-                // get all child line items
193
-                $children = $line_item->children();
194
-                // loop thru all non-tax child line items
195
-                foreach ($children as $child_line_item) {
196
-                    if ($child_line_item->type() !== EEM_Line_Item::type_tax_sub_total) {
197
-                        // recursively feed children back into this method
198
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
199
-                    }
200
-                }
201
-                // now loop thru  tax child line items
202
-                foreach ($children as $child_line_item) {
203
-                    if ($child_line_item->type() === EEM_Line_Item::type_tax_sub_total) {
204
-                        // recursively feed children back into this method
205
-                        $html .= $this->display_line_item($child_line_item, $options, $line_item);
206
-                    }
207
-                }
208
-                $html .= $this->_taxes_html;
209
-                $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'));
210
-                $html .= $this->_payments_and_amount_owing_rows($line_item, $options);
211
-                break;
212
-        }
213
-        return $html;
214
-    }
215
-
216
-
217
-
218
-    /**
219
-     * _event_row - basically a Heading row displayed once above each event's ticket rows
220
-     *
221
-     * @param EE_Line_Item $line_item
222
-     * @return mixed
223
-     */
224
-    private function _event_row(EE_Line_Item $line_item)
225
-    {
226
-        // start of row
227
-        $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
228
-        // event name td
229
-        $html .= EEH_HTML::td(
230
-            EEH_HTML::strong($line_item->name()),
231
-            '',
232
-            'event-header',
233
-            '',
234
-            ' colspan="4"'
235
-        );
236
-        // end of row
237
-        $html .= EEH_HTML::trx();
238
-        return $html;
239
-    }
240
-
241
-
242
-
243
-    /**
244
-     * _ticket_row
245
-     *
246
-     * @param EE_Line_Item $line_item
247
-     * @param array        $options
248
-     * @return mixed
249
-     * @throws EE_Error
250
-     */
251
-    private function _ticket_row(EE_Line_Item $line_item, $options = array())
252
-    {
253
-        // start of row
254
-        $row_class = $options['odd'] ? 'item odd' : 'item';
255
-        $html = EEH_HTML::tr('', '', $row_class);
256
-        // name && desc
257
-        $name_and_desc = apply_filters(
258
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
259
-            $line_item->name(),
260
-            $line_item
261
-        );
262
-        $name_and_desc .= apply_filters(
263
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
264
-            (
265
-                $options['show_desc']
266
-                    ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
267
-                    : ''
268
-            ),
269
-            $line_item,
270
-            $options
271
-        );
272
-        $name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
273
-        $name_and_desc = apply_filters(
274
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy___ticket_row__name_and_desc',
275
-            $name_and_desc,
276
-            $line_item,
277
-            $options
278
-        );
279
-
280
-        // name td
281
-        $html .= EEH_HTML::td( /*__FUNCTION__ .*/
282
-            $name_and_desc,
283
-            '',
284
-            'item_l'
285
-        );
286
-        // price td
287
-        $price = apply_filters(
288
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy___ticket_row__price',
289
-            $line_item->unit_price_no_code(),
290
-            $line_item
291
-        );
292
-        $html .= EEH_HTML::td($price, '', 'spco-nowrap item_c jst-rght');
293
-        // quantity td
294
-        $html .= EEH_HTML::td($line_item->quantity(), '', 'spco-nowrap item_l jst-rght');
295
-        $this->_total_items += $line_item->quantity();
296
-        // determine total for line item
297
-        $total = apply_filters(
298
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy___ticket_row__total',
299
-            $line_item->total(),
300
-            $line_item
301
-        );
302
-        $this->_events[ $options['event_id'] ] += $total;
303
-        // total td
304
-        $html .= EEH_HTML::td(
305
-            EEH_Template::format_currency($total, false, false),
306
-            '',
307
-            'spco-nowrap item_r jst-rght'
308
-        );
309
-        // end of row
310
-        $html .= EEH_HTML::trx();
311
-        return $html;
312
-    }
313
-
314
-
315
-
316
-    /**
317
-     * _item_row
318
-     *
319
-     * @param EE_Line_Item $line_item
320
-     * @param array        $options
321
-     * @return mixed
322
-     * @throws EE_Error
323
-     */
324
-    private function _item_row(EE_Line_Item $line_item, $options = array())
325
-    {
326
-        // start of row
327
-        $row_class = $options['odd'] ? 'item odd' : 'item';
328
-        $html = EEH_HTML::tr('', '', $row_class);
329
-        $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
330
-        // name && desc
331
-        $name_and_desc = apply_filters(
332
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
333
-            $obj_name . $line_item->name(),
334
-            $line_item
335
-        );
336
-        $name_and_desc .= apply_filters(
337
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
338
-            (
339
-                $options['show_desc']
340
-                ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
341
-                : ''
342
-            ),
343
-            $line_item,
344
-            $options
345
-        );
346
-        $name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
347
-        $name_and_desc = apply_filters(
348
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy___item_row__name_and_desc',
349
-            $name_and_desc,
350
-            $line_item,
351
-            $options
352
-        );
353
-
354
-        // name td
355
-        $html .= EEH_HTML::td($name_and_desc, '', 'item_l');
356
-        // price td
357
-        if ($line_item->is_percent()) {
358
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'spco-nowrap item_c jst-rght');
359
-        } else {
360
-            $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'spco-nowrap item_c jst-rght');
361
-        }
362
-        // quantity td
363
-        $html .= EEH_HTML::td($line_item->quantity(), '', 'spco-nowrap item_l jst-rght');
364
-        // $total = $line_item->total() * $line_item->quantity();
365
-        $total = $line_item->total();
366
-        if (isset($options['event_id'], $this->_events[ $options['event_id'] ])) {
367
-            $this->_events[ $options['event_id'] ] += $total;
368
-        }
369
-        // total td
370
-        $html .= EEH_HTML::td(
371
-            EEH_Template::format_currency($total, false, false),
372
-            '',
373
-            'spco-nowrap item_r jst-rght'
374
-        );
375
-        // end of row
376
-        $html .= EEH_HTML::trx();
377
-        return $html;
378
-    }
379
-
380
-
381
-
382
-    /**
383
-     * _sub_item_row
384
-     *
385
-     * @param EE_Line_Item $line_item
386
-     * @param array        $options
387
-     * @param EE_Line_Item $parent_line_item
388
-     * @return mixed
389
-     * @throws EE_Error
390
-     */
391
-    private function _sub_item_row(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null)
392
-    {
393
-        if (
394
-            $parent_line_item instanceof  EE_Line_Item
395
-            && $line_item->children() === array()
396
-            && $line_item->name() === $parent_line_item->name()
397
-            && apply_filters(
398
-                'FHEE__EE_SPCO_Line_Item_Display_Strategy___sub_item_row__hide_main_sub_line_item',
399
-                true
400
-            )
401
-        ) {
402
-            return '';
403
-        }
404
-        // start of row
405
-        $html = EEH_HTML::tr('', '', 'item sub-item-row');
406
-        // name && desc
407
-        $name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right')
408
-                         . $line_item->name();
409
-        $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '
410
-                                                  . $line_item->desc()
411
-                                                  . '</span>' : '';
412
-        // name td
413
-        $html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
414
-        $qty = $parent_line_item instanceof EE_Line_Item ? $parent_line_item->quantity() : 1;
415
-        // discount/surcharge td
416
-        if ($line_item->is_percent()) {
417
-            $html .= EEH_HTML::td(
418
-                EEH_Template::format_currency(
419
-                    $line_item->total() / $qty,
420
-                    false,
421
-                    false
422
-                ),
423
-                '',
424
-                'spco-nowrap item_c jst-rght'
425
-            );
426
-        } else {
427
-            $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'spco-nowrap item_c jst-rght');
428
-        }
429
-        // no quantity td
430
-        $html .= EEH_HTML::td();
431
-        // no total td
432
-        $html .= EEH_HTML::td();
433
-        // end of row
434
-        $html .= EEH_HTML::trx();
435
-        $html = apply_filters(
436
-            'FHEE__EE_SPCO_Line_Item_Display_Strategy___sub_item_row__html',
437
-            $html,
438
-            $line_item,
439
-            $options,
440
-            $parent_line_item
441
-        );
442
-        return $html;
443
-    }
444
-
445
-
446
-
447
-    /**
448
-     * _tax_row
449
-     *
450
-     * @param EE_Line_Item $line_item
451
-     * @param array        $options
452
-     * @return mixed
453
-     * @throws EE_Error
454
-     */
455
-    private function _tax_row(EE_Line_Item $line_item, $options = array())
456
-    {
457
-        // start of row
458
-        $html = EEH_HTML::tr('', 'item sub-item tax-total');
459
-        // name && desc
460
-        $name_and_desc = $line_item->name();
461
-        $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'
462
-                          . esc_html__(' * taxable items', 'event_espresso') . '</span>';
463
-        $name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
464
-        // name td
465
-        $html .= EEH_HTML::td( /*__FUNCTION__ .*/
466
-            $name_and_desc,
467
-            '',
468
-            'item_l sub-item'
469
-        );
470
-        // percent td
471
-        $html .= EEH_HTML::td($line_item->percent() . '%', '', 'spco-nowrap jst-rght', '');
472
-        // empty td (price)
473
-        $html .= EEH_HTML::td(EEH_HTML::nbsp());
474
-        // total td
475
-        $html .= EEH_HTML::td(
476
-            EEH_Template::format_currency(
477
-                $line_item->total(),
478
-                false,
479
-                false
480
-            ),
481
-            '',
482
-            'spco-nowrap item_r jst-rght'
483
-        );
484
-        // end of row
485
-        $html .= EEH_HTML::trx();
486
-        return $html;
487
-    }
488
-
489
-
490
-
491
-    /**
492
-     * _total_row
493
-     *
494
-     * @param EE_Line_Item $line_item
495
-     * @param string       $text
496
-     * @return mixed
497
-     * @throws EE_Error
498
-     */
499
-    private function _total_tax_row(EE_Line_Item $line_item, $text = '')
500
-    {
501
-        $html = '';
502
-        if ($line_item->total()) {
503
-            // start of row
504
-            $html = EEH_HTML::tr('', '', 'total_tr odd');
505
-            // total td
506
-            $html .= EEH_HTML::td(
507
-                $text,
508
-                '',
509
-                'total_currency total jst-rght',
510
-                '',
511
-                ' colspan="2"'
512
-            );
513
-            // empty td (price)
514
-            $html .= EEH_HTML::td(EEH_HTML::nbsp());
515
-            // total td
516
-            $html .= EEH_HTML::td(
517
-                EEH_Template::format_currency($line_item->total(), false, false),
518
-                '',
519
-                'spco-nowrap total jst-rght'
520
-            );
521
-            // end of row
522
-            $html .= EEH_HTML::trx();
523
-        }
524
-        return $html;
525
-    }
526
-
527
-
528
-
529
-    /**
530
-     * _total_row
531
-     *
532
-     * @param EE_Line_Item $line_item
533
-     * @param string       $text
534
-     * @param array        $options
535
-     * @return mixed
536
-     * @throws EE_Error
537
-     */
538
-    private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array())
539
-    {
540
-        $html = '';
541
-        if ($line_item->total()) {
542
-            // start of row
543
-            $html = EEH_HTML::tr('', '', 'total_tr odd');
544
-            // total td
545
-            $html .= EEH_HTML::td(
546
-                $text,
547
-                '',
548
-                'total_currency total jst-rght',
549
-                '',
550
-                ' colspan="3"'
551
-            );
552
-            // total td
553
-            $html .= EEH_HTML::td(
554
-                EEH_Template::format_currency($options['sub_total'], false, false),
555
-                '',
556
-                'spco-nowrap total jst-rght'
557
-            );
558
-            // end of row
559
-            $html .= EEH_HTML::trx();
560
-        }
561
-        return $html;
562
-    }
563
-
564
-
565
-
566
-    /**
567
-     * _total_row
568
-     *
569
-     * @param EE_Line_Item $line_item
570
-     * @param string       $text
571
-     * @return mixed
572
-     * @throws EE_Error
573
-     */
574
-    private function _total_row(EE_Line_Item $line_item, $text = '')
575
-    {
576
-        // start of row
577
-        $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
578
-        // total td
579
-        $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
580
-        // total td
581
-        $html .= EEH_HTML::td(
582
-            EEH_Template::format_currency($line_item->total(), false, false),
583
-            '',
584
-            'spco-nowrap total jst-rght'
585
-        );
586
-        // end of row
587
-        $html .= EEH_HTML::trx();
588
-        return $html;
589
-    }
590
-
591
-
592
-
593
-    /**
594
-     * _payments_and_amount_owing_rows
595
-     *
596
-     * @param EE_Line_Item $line_item
597
-     * @param array        $options
598
-     * @return mixed
599
-     * @throws EE_Error
600
-     */
601
-    private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array())
602
-    {
603
-        $html = '';
604
-        $owing = $line_item->total();
605
-        $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
606
-        if ($transaction instanceof EE_Transaction) {
607
-            $registration_payments = array();
608
-            $registrations = ! empty($options['registrations'])
609
-                ? $options['registrations']
610
-                : $transaction->registrations();
611
-            foreach ($registrations as $registration) {
612
-                if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
613
-                    $registration_payments += $registration->registration_payments();
614
-                }
615
-            }
616
-            if (! empty($registration_payments)) {
617
-                foreach ($registration_payments as $registration_payment) {
618
-                    if ($registration_payment instanceof EE_Registration_Payment) {
619
-                        $owing -= $registration_payment->amount();
620
-                        $payment = $registration_payment->payment();
621
-                        $payment_desc = '';
622
-                        if ($payment instanceof EE_Payment) {
623
-                            $payment_desc = sprintf(
624
-                                esc_html__('Payment%1$s Received: %2$s', 'event_espresso'),
625
-                                $payment->txn_id_chq_nmbr() !== ''
626
-                                    ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
627
-                                    : '',
628
-                                $payment->timestamp()
629
-                            );
630
-                        }
631
-                        // start of row
632
-                        $html .= EEH_HTML::tr('', '', 'total_tr odd');
633
-                        // payment desc
634
-                        $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
635
-                        // total td
636
-                        $html .= EEH_HTML::td(
637
-                            EEH_Template::format_currency(
638
-                                $registration_payment->amount(),
639
-                                false,
640
-                                false
641
-                            ),
642
-                            '',
643
-                            'spco-nowrap total jst-rght'
644
-                        );
645
-                        // end of row
646
-                        $html .= EEH_HTML::trx();
647
-                    }
648
-                }
649
-                if ($line_item->total()) {
650
-                    // start of row
651
-                    $html .= EEH_HTML::tr('', '', 'total_tr odd');
652
-                    // total td
653
-                    $html .= EEH_HTML::td(
654
-                        esc_html__('Amount Owing', 'event_espresso'),
655
-                        '',
656
-                        'total_currency total jst-rght',
657
-                        '',
658
-                        ' colspan="3"'
659
-                    );
660
-                    // total td
661
-                    $html .= EEH_HTML::td(
662
-                        EEH_Template::format_currency($owing, false, false),
663
-                        '',
664
-                        'spco-nowrap total jst-rght'
665
-                    );
666
-                    // end of row
667
-                    $html .= EEH_HTML::trx();
668
-                }
669
-            }
670
-        }
671
-        $this->_grand_total = $owing;
672
-        return $html;
673
-    }
15
+	/**
16
+	 * array of events
17
+	 *
18
+	 * @type EE_Line_Item[] $_events
19
+	 */
20
+	private $_events = array();
21
+
22
+	/**
23
+	 * whether to display the taxes row or not
24
+	 *
25
+	 * @type bool $_show_taxes
26
+	 */
27
+	private $_show_taxes = false;
28
+
29
+	/**
30
+	 * html for any tax rows
31
+	 *
32
+	 * @type string $_show_taxes
33
+	 */
34
+	private $_taxes_html = '';
35
+
36
+	/**
37
+	 * total amount including tax we can bill for at this time
38
+	 *
39
+	 * @type float $_grand_total
40
+	 */
41
+	private $_grand_total = 0.00;
42
+
43
+	/**
44
+	 * total number of items being billed for
45
+	 *
46
+	 * @type int $_total_items
47
+	 */
48
+	private $_total_items = 0;
49
+
50
+
51
+
52
+	/**
53
+	 * @return float
54
+	 */
55
+	public function grand_total()
56
+	{
57
+		return $this->_grand_total;
58
+	}
59
+
60
+
61
+
62
+	/**
63
+	 * @return int
64
+	 */
65
+	public function total_items()
66
+	{
67
+		return $this->_total_items;
68
+	}
69
+
70
+
71
+
72
+	/**
73
+	 * @param EE_Line_Item $line_item
74
+	 * @param array        $options
75
+	 * @param EE_Line_Item $parent_line_item
76
+	 * @return mixed
77
+	 * @throws EE_Error
78
+	 */
79
+	public function display_line_item(
80
+		EE_Line_Item $line_item,
81
+		$options = array(),
82
+		EE_Line_Item $parent_line_item = null
83
+	) {
84
+		$html = '';
85
+		// set some default options and merge with incoming
86
+		$default_options = array(
87
+			'show_desc' => true,  //    true        false
88
+			'odd'       => false,
89
+		);
90
+		$options = array_merge($default_options, (array) $options);
91
+		switch ($line_item->type()) {
92
+			case EEM_Line_Item::type_line_item:
93
+				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
94
+				if ($line_item->OBJ_type() === 'Ticket') {
95
+					// item row
96
+					$html .= $this->_ticket_row($line_item, $options);
97
+				} else {
98
+					// item row
99
+					$html .= $this->_item_row($line_item, $options);
100
+				}
101
+				if (
102
+					apply_filters(
103
+						'FHEE__EE_SPCO_Line_Item_Display_Strategy__display_line_item__display_sub_line_items',
104
+						true
105
+					)
106
+				) {
107
+					// got any kids?
108
+					foreach ($line_item->children() as $child_line_item) {
109
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
110
+					}
111
+				}
112
+				break;
113
+			case EEM_Line_Item::type_sub_line_item:
114
+				$html .= $this->_sub_item_row($line_item, $options, $parent_line_item);
115
+				break;
116
+			case EEM_Line_Item::type_sub_total:
117
+				static $sub_total = 0;
118
+				$event_sub_total = 0;
119
+				$text = esc_html__('Sub-Total', 'event_espresso');
120
+				if ($line_item->OBJ_type() === 'Event') {
121
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
122
+					if (! isset($this->_events[ $options['event_id'] ])) {
123
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
124
+						// if event has default reg status of Not Approved, then don't display info on it
125
+						if (
126
+							$event instanceof EE_Event
127
+							&& $event->default_registration_status() === EEM_Registration::status_id_not_approved
128
+						) {
129
+							$display_event = false;
130
+							// unless there are registrations for it that are returning to pay
131
+							if (isset($options['registrations']) && is_array($options['registrations'])) {
132
+								foreach ($options['registrations'] as $registration) {
133
+									if (! $registration instanceof EE_Registration) {
134
+										continue;
135
+									}
136
+									$display_event = $registration->event_ID() === $options['event_id']
137
+													 && $registration->status_ID() !== EEM_Registration::status_id_not_approved
138
+										? true
139
+										: $display_event;
140
+								}
141
+							}
142
+							if (! $display_event) {
143
+								return '';
144
+							}
145
+						}
146
+						$this->_events[ $options['event_id'] ] = 0;
147
+						$html .= $this->_event_row($line_item);
148
+						$text = esc_html__('Event Sub-Total', 'event_espresso');
149
+					}
150
+				}
151
+				$child_line_items = $line_item->children();
152
+				// loop thru children
153
+				foreach ($child_line_items as $child_line_item) {
154
+					// recursively feed children back into this method
155
+					$html .= $this->display_line_item($child_line_item, $options, $line_item);
156
+				}
157
+				$event_sub_total += isset($options['event_id']) ? $this->_events[ $options['event_id'] ] : 0;
158
+				$sub_total += $event_sub_total;
159
+				if (
160
+					(
161
+						// event subtotals
162
+						$line_item->code() !== 'pre-tax-subtotal' && count($child_line_items) > 1
163
+					)
164
+					|| (
165
+						// pre-tax subtotals
166
+						$line_item->code() === 'pre-tax-subtotal' && count($this->_events) > 1
167
+					)
168
+				) {
169
+					$options['sub_total'] = $line_item->OBJ_type() === 'Event' ? $event_sub_total : $sub_total;
170
+					$html .= $this->_sub_total_row($line_item, $text, $options);
171
+				}
172
+				break;
173
+			case EEM_Line_Item::type_tax:
174
+				if ($this->_show_taxes) {
175
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
176
+				}
177
+				break;
178
+			case EEM_Line_Item::type_tax_sub_total:
179
+				if ($this->_show_taxes) {
180
+					$child_line_items = $line_item->children();
181
+					// loop thru children
182
+					foreach ($child_line_items as $child_line_item) {
183
+						// recursively feed children back into this method
184
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
185
+					}
186
+					if (count($child_line_items) > 1) {
187
+						$this->_taxes_html .= $this->_total_tax_row($line_item, esc_html__('Tax Total', 'event_espresso'));
188
+					}
189
+				}
190
+				break;
191
+			case EEM_Line_Item::type_total:
192
+				// get all child line items
193
+				$children = $line_item->children();
194
+				// loop thru all non-tax child line items
195
+				foreach ($children as $child_line_item) {
196
+					if ($child_line_item->type() !== EEM_Line_Item::type_tax_sub_total) {
197
+						// recursively feed children back into this method
198
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
199
+					}
200
+				}
201
+				// now loop thru  tax child line items
202
+				foreach ($children as $child_line_item) {
203
+					if ($child_line_item->type() === EEM_Line_Item::type_tax_sub_total) {
204
+						// recursively feed children back into this method
205
+						$html .= $this->display_line_item($child_line_item, $options, $line_item);
206
+					}
207
+				}
208
+				$html .= $this->_taxes_html;
209
+				$html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'));
210
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
211
+				break;
212
+		}
213
+		return $html;
214
+	}
215
+
216
+
217
+
218
+	/**
219
+	 * _event_row - basically a Heading row displayed once above each event's ticket rows
220
+	 *
221
+	 * @param EE_Line_Item $line_item
222
+	 * @return mixed
223
+	 */
224
+	private function _event_row(EE_Line_Item $line_item)
225
+	{
226
+		// start of row
227
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
228
+		// event name td
229
+		$html .= EEH_HTML::td(
230
+			EEH_HTML::strong($line_item->name()),
231
+			'',
232
+			'event-header',
233
+			'',
234
+			' colspan="4"'
235
+		);
236
+		// end of row
237
+		$html .= EEH_HTML::trx();
238
+		return $html;
239
+	}
240
+
241
+
242
+
243
+	/**
244
+	 * _ticket_row
245
+	 *
246
+	 * @param EE_Line_Item $line_item
247
+	 * @param array        $options
248
+	 * @return mixed
249
+	 * @throws EE_Error
250
+	 */
251
+	private function _ticket_row(EE_Line_Item $line_item, $options = array())
252
+	{
253
+		// start of row
254
+		$row_class = $options['odd'] ? 'item odd' : 'item';
255
+		$html = EEH_HTML::tr('', '', $row_class);
256
+		// name && desc
257
+		$name_and_desc = apply_filters(
258
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
259
+			$line_item->name(),
260
+			$line_item
261
+		);
262
+		$name_and_desc .= apply_filters(
263
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
264
+			(
265
+				$options['show_desc']
266
+					? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
267
+					: ''
268
+			),
269
+			$line_item,
270
+			$options
271
+		);
272
+		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
273
+		$name_and_desc = apply_filters(
274
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy___ticket_row__name_and_desc',
275
+			$name_and_desc,
276
+			$line_item,
277
+			$options
278
+		);
279
+
280
+		// name td
281
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/
282
+			$name_and_desc,
283
+			'',
284
+			'item_l'
285
+		);
286
+		// price td
287
+		$price = apply_filters(
288
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy___ticket_row__price',
289
+			$line_item->unit_price_no_code(),
290
+			$line_item
291
+		);
292
+		$html .= EEH_HTML::td($price, '', 'spco-nowrap item_c jst-rght');
293
+		// quantity td
294
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'spco-nowrap item_l jst-rght');
295
+		$this->_total_items += $line_item->quantity();
296
+		// determine total for line item
297
+		$total = apply_filters(
298
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy___ticket_row__total',
299
+			$line_item->total(),
300
+			$line_item
301
+		);
302
+		$this->_events[ $options['event_id'] ] += $total;
303
+		// total td
304
+		$html .= EEH_HTML::td(
305
+			EEH_Template::format_currency($total, false, false),
306
+			'',
307
+			'spco-nowrap item_r jst-rght'
308
+		);
309
+		// end of row
310
+		$html .= EEH_HTML::trx();
311
+		return $html;
312
+	}
313
+
314
+
315
+
316
+	/**
317
+	 * _item_row
318
+	 *
319
+	 * @param EE_Line_Item $line_item
320
+	 * @param array        $options
321
+	 * @return mixed
322
+	 * @throws EE_Error
323
+	 */
324
+	private function _item_row(EE_Line_Item $line_item, $options = array())
325
+	{
326
+		// start of row
327
+		$row_class = $options['odd'] ? 'item odd' : 'item';
328
+		$html = EEH_HTML::tr('', '', $row_class);
329
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
330
+		// name && desc
331
+		$name_and_desc = apply_filters(
332
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
333
+			$obj_name . $line_item->name(),
334
+			$line_item
335
+		);
336
+		$name_and_desc .= apply_filters(
337
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
338
+			(
339
+				$options['show_desc']
340
+				? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
341
+				: ''
342
+			),
343
+			$line_item,
344
+			$options
345
+		);
346
+		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
347
+		$name_and_desc = apply_filters(
348
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy___item_row__name_and_desc',
349
+			$name_and_desc,
350
+			$line_item,
351
+			$options
352
+		);
353
+
354
+		// name td
355
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
356
+		// price td
357
+		if ($line_item->is_percent()) {
358
+			$html .= EEH_HTML::td($line_item->percent() . '%', '', 'spco-nowrap item_c jst-rght');
359
+		} else {
360
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'spco-nowrap item_c jst-rght');
361
+		}
362
+		// quantity td
363
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'spco-nowrap item_l jst-rght');
364
+		// $total = $line_item->total() * $line_item->quantity();
365
+		$total = $line_item->total();
366
+		if (isset($options['event_id'], $this->_events[ $options['event_id'] ])) {
367
+			$this->_events[ $options['event_id'] ] += $total;
368
+		}
369
+		// total td
370
+		$html .= EEH_HTML::td(
371
+			EEH_Template::format_currency($total, false, false),
372
+			'',
373
+			'spco-nowrap item_r jst-rght'
374
+		);
375
+		// end of row
376
+		$html .= EEH_HTML::trx();
377
+		return $html;
378
+	}
379
+
380
+
381
+
382
+	/**
383
+	 * _sub_item_row
384
+	 *
385
+	 * @param EE_Line_Item $line_item
386
+	 * @param array        $options
387
+	 * @param EE_Line_Item $parent_line_item
388
+	 * @return mixed
389
+	 * @throws EE_Error
390
+	 */
391
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array(), EE_Line_Item $parent_line_item = null)
392
+	{
393
+		if (
394
+			$parent_line_item instanceof  EE_Line_Item
395
+			&& $line_item->children() === array()
396
+			&& $line_item->name() === $parent_line_item->name()
397
+			&& apply_filters(
398
+				'FHEE__EE_SPCO_Line_Item_Display_Strategy___sub_item_row__hide_main_sub_line_item',
399
+				true
400
+			)
401
+		) {
402
+			return '';
403
+		}
404
+		// start of row
405
+		$html = EEH_HTML::tr('', '', 'item sub-item-row');
406
+		// name && desc
407
+		$name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right')
408
+						 . $line_item->name();
409
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '
410
+												  . $line_item->desc()
411
+												  . '</span>' : '';
412
+		// name td
413
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
414
+		$qty = $parent_line_item instanceof EE_Line_Item ? $parent_line_item->quantity() : 1;
415
+		// discount/surcharge td
416
+		if ($line_item->is_percent()) {
417
+			$html .= EEH_HTML::td(
418
+				EEH_Template::format_currency(
419
+					$line_item->total() / $qty,
420
+					false,
421
+					false
422
+				),
423
+				'',
424
+				'spco-nowrap item_c jst-rght'
425
+			);
426
+		} else {
427
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'spco-nowrap item_c jst-rght');
428
+		}
429
+		// no quantity td
430
+		$html .= EEH_HTML::td();
431
+		// no total td
432
+		$html .= EEH_HTML::td();
433
+		// end of row
434
+		$html .= EEH_HTML::trx();
435
+		$html = apply_filters(
436
+			'FHEE__EE_SPCO_Line_Item_Display_Strategy___sub_item_row__html',
437
+			$html,
438
+			$line_item,
439
+			$options,
440
+			$parent_line_item
441
+		);
442
+		return $html;
443
+	}
444
+
445
+
446
+
447
+	/**
448
+	 * _tax_row
449
+	 *
450
+	 * @param EE_Line_Item $line_item
451
+	 * @param array        $options
452
+	 * @return mixed
453
+	 * @throws EE_Error
454
+	 */
455
+	private function _tax_row(EE_Line_Item $line_item, $options = array())
456
+	{
457
+		// start of row
458
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
459
+		// name && desc
460
+		$name_and_desc = $line_item->name();
461
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'
462
+						  . esc_html__(' * taxable items', 'event_espresso') . '</span>';
463
+		$name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
464
+		// name td
465
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/
466
+			$name_and_desc,
467
+			'',
468
+			'item_l sub-item'
469
+		);
470
+		// percent td
471
+		$html .= EEH_HTML::td($line_item->percent() . '%', '', 'spco-nowrap jst-rght', '');
472
+		// empty td (price)
473
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
474
+		// total td
475
+		$html .= EEH_HTML::td(
476
+			EEH_Template::format_currency(
477
+				$line_item->total(),
478
+				false,
479
+				false
480
+			),
481
+			'',
482
+			'spco-nowrap item_r jst-rght'
483
+		);
484
+		// end of row
485
+		$html .= EEH_HTML::trx();
486
+		return $html;
487
+	}
488
+
489
+
490
+
491
+	/**
492
+	 * _total_row
493
+	 *
494
+	 * @param EE_Line_Item $line_item
495
+	 * @param string       $text
496
+	 * @return mixed
497
+	 * @throws EE_Error
498
+	 */
499
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '')
500
+	{
501
+		$html = '';
502
+		if ($line_item->total()) {
503
+			// start of row
504
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
505
+			// total td
506
+			$html .= EEH_HTML::td(
507
+				$text,
508
+				'',
509
+				'total_currency total jst-rght',
510
+				'',
511
+				' colspan="2"'
512
+			);
513
+			// empty td (price)
514
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
515
+			// total td
516
+			$html .= EEH_HTML::td(
517
+				EEH_Template::format_currency($line_item->total(), false, false),
518
+				'',
519
+				'spco-nowrap total jst-rght'
520
+			);
521
+			// end of row
522
+			$html .= EEH_HTML::trx();
523
+		}
524
+		return $html;
525
+	}
526
+
527
+
528
+
529
+	/**
530
+	 * _total_row
531
+	 *
532
+	 * @param EE_Line_Item $line_item
533
+	 * @param string       $text
534
+	 * @param array        $options
535
+	 * @return mixed
536
+	 * @throws EE_Error
537
+	 */
538
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array())
539
+	{
540
+		$html = '';
541
+		if ($line_item->total()) {
542
+			// start of row
543
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
544
+			// total td
545
+			$html .= EEH_HTML::td(
546
+				$text,
547
+				'',
548
+				'total_currency total jst-rght',
549
+				'',
550
+				' colspan="3"'
551
+			);
552
+			// total td
553
+			$html .= EEH_HTML::td(
554
+				EEH_Template::format_currency($options['sub_total'], false, false),
555
+				'',
556
+				'spco-nowrap total jst-rght'
557
+			);
558
+			// end of row
559
+			$html .= EEH_HTML::trx();
560
+		}
561
+		return $html;
562
+	}
563
+
564
+
565
+
566
+	/**
567
+	 * _total_row
568
+	 *
569
+	 * @param EE_Line_Item $line_item
570
+	 * @param string       $text
571
+	 * @return mixed
572
+	 * @throws EE_Error
573
+	 */
574
+	private function _total_row(EE_Line_Item $line_item, $text = '')
575
+	{
576
+		// start of row
577
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
578
+		// total td
579
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
580
+		// total td
581
+		$html .= EEH_HTML::td(
582
+			EEH_Template::format_currency($line_item->total(), false, false),
583
+			'',
584
+			'spco-nowrap total jst-rght'
585
+		);
586
+		// end of row
587
+		$html .= EEH_HTML::trx();
588
+		return $html;
589
+	}
590
+
591
+
592
+
593
+	/**
594
+	 * _payments_and_amount_owing_rows
595
+	 *
596
+	 * @param EE_Line_Item $line_item
597
+	 * @param array        $options
598
+	 * @return mixed
599
+	 * @throws EE_Error
600
+	 */
601
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array())
602
+	{
603
+		$html = '';
604
+		$owing = $line_item->total();
605
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
606
+		if ($transaction instanceof EE_Transaction) {
607
+			$registration_payments = array();
608
+			$registrations = ! empty($options['registrations'])
609
+				? $options['registrations']
610
+				: $transaction->registrations();
611
+			foreach ($registrations as $registration) {
612
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
613
+					$registration_payments += $registration->registration_payments();
614
+				}
615
+			}
616
+			if (! empty($registration_payments)) {
617
+				foreach ($registration_payments as $registration_payment) {
618
+					if ($registration_payment instanceof EE_Registration_Payment) {
619
+						$owing -= $registration_payment->amount();
620
+						$payment = $registration_payment->payment();
621
+						$payment_desc = '';
622
+						if ($payment instanceof EE_Payment) {
623
+							$payment_desc = sprintf(
624
+								esc_html__('Payment%1$s Received: %2$s', 'event_espresso'),
625
+								$payment->txn_id_chq_nmbr() !== ''
626
+									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
627
+									: '',
628
+								$payment->timestamp()
629
+							);
630
+						}
631
+						// start of row
632
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
633
+						// payment desc
634
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
635
+						// total td
636
+						$html .= EEH_HTML::td(
637
+							EEH_Template::format_currency(
638
+								$registration_payment->amount(),
639
+								false,
640
+								false
641
+							),
642
+							'',
643
+							'spco-nowrap total jst-rght'
644
+						);
645
+						// end of row
646
+						$html .= EEH_HTML::trx();
647
+					}
648
+				}
649
+				if ($line_item->total()) {
650
+					// start of row
651
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
652
+					// total td
653
+					$html .= EEH_HTML::td(
654
+						esc_html__('Amount Owing', 'event_espresso'),
655
+						'',
656
+						'total_currency total jst-rght',
657
+						'',
658
+						' colspan="3"'
659
+					);
660
+					// total td
661
+					$html .= EEH_HTML::td(
662
+						EEH_Template::format_currency($owing, false, false),
663
+						'',
664
+						'spco-nowrap total jst-rght'
665
+					);
666
+					// end of row
667
+					$html .= EEH_HTML::trx();
668
+				}
669
+			}
670
+		}
671
+		$this->_grand_total = $owing;
672
+		return $html;
673
+	}
674 674
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $html = '';
85 85
         // set some default options and merge with incoming
86 86
         $default_options = array(
87
-            'show_desc' => true,  //    true        false
87
+            'show_desc' => true, //    true        false
88 88
             'odd'       => false,
89 89
         );
90 90
         $options = array_merge($default_options, (array) $options);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 $text = esc_html__('Sub-Total', 'event_espresso');
120 120
                 if ($line_item->OBJ_type() === 'Event') {
121 121
                     $options['event_id'] = $event_id = $line_item->OBJ_ID();
122
-                    if (! isset($this->_events[ $options['event_id'] ])) {
122
+                    if ( ! isset($this->_events[$options['event_id']])) {
123 123
                         $event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
124 124
                         // if event has default reg status of Not Approved, then don't display info on it
125 125
                         if (
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                             // unless there are registrations for it that are returning to pay
131 131
                             if (isset($options['registrations']) && is_array($options['registrations'])) {
132 132
                                 foreach ($options['registrations'] as $registration) {
133
-                                    if (! $registration instanceof EE_Registration) {
133
+                                    if ( ! $registration instanceof EE_Registration) {
134 134
                                         continue;
135 135
                                     }
136 136
                                     $display_event = $registration->event_ID() === $options['event_id']
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
                                         : $display_event;
140 140
                                 }
141 141
                             }
142
-                            if (! $display_event) {
142
+                            if ( ! $display_event) {
143 143
                                 return '';
144 144
                             }
145 145
                         }
146
-                        $this->_events[ $options['event_id'] ] = 0;
146
+                        $this->_events[$options['event_id']] = 0;
147 147
                         $html .= $this->_event_row($line_item);
148 148
                         $text = esc_html__('Event Sub-Total', 'event_espresso');
149 149
                     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     // recursively feed children back into this method
155 155
                     $html .= $this->display_line_item($child_line_item, $options, $line_item);
156 156
                 }
157
-                $event_sub_total += isset($options['event_id']) ? $this->_events[ $options['event_id'] ] : 0;
157
+                $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
158 158
                 $sub_total += $event_sub_total;
159 159
                 if (
160 160
                     (
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
264 264
             (
265 265
                 $options['show_desc']
266
-                    ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
266
+                    ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>'
267 267
                     : ''
268 268
             ),
269 269
             $line_item,
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             $line_item->total(),
300 300
             $line_item
301 301
         );
302
-        $this->_events[ $options['event_id'] ] += $total;
302
+        $this->_events[$options['event_id']] += $total;
303 303
         // total td
304 304
         $html .= EEH_HTML::td(
305 305
             EEH_Template::format_currency($total, false, false),
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
         // start of row
327 327
         $row_class = $options['odd'] ? 'item odd' : 'item';
328 328
         $html = EEH_HTML::tr('', '', $row_class);
329
-        $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
329
+        $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().': ' : '';
330 330
         // name && desc
331 331
         $name_and_desc = apply_filters(
332 332
             'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
333
-            $obj_name . $line_item->name(),
333
+            $obj_name.$line_item->name(),
334 334
             $line_item
335 335
         );
336 336
         $name_and_desc .= apply_filters(
337 337
             'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
338 338
             (
339 339
                 $options['show_desc']
340
-                ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>'
340
+                ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>'
341 341
                 : ''
342 342
             ),
343 343
             $line_item,
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $html .= EEH_HTML::td($name_and_desc, '', 'item_l');
356 356
         // price td
357 357
         if ($line_item->is_percent()) {
358
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'spco-nowrap item_c jst-rght');
358
+            $html .= EEH_HTML::td($line_item->percent().'%', '', 'spco-nowrap item_c jst-rght');
359 359
         } else {
360 360
             $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'spco-nowrap item_c jst-rght');
361 361
         }
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
         $html .= EEH_HTML::td($line_item->quantity(), '', 'spco-nowrap item_l jst-rght');
364 364
         // $total = $line_item->total() * $line_item->quantity();
365 365
         $total = $line_item->total();
366
-        if (isset($options['event_id'], $this->_events[ $options['event_id'] ])) {
367
-            $this->_events[ $options['event_id'] ] += $total;
366
+        if (isset($options['event_id'], $this->_events[$options['event_id']])) {
367
+            $this->_events[$options['event_id']] += $total;
368 368
         }
369 369
         // total td
370 370
         $html .= EEH_HTML::td(
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
         // name && desc
460 460
         $name_and_desc = $line_item->name();
461 461
         $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'
462
-                          . esc_html__(' * taxable items', 'event_espresso') . '</span>';
463
-        $name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
462
+                          . esc_html__(' * taxable items', 'event_espresso').'</span>';
463
+        $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
464 464
         // name td
465 465
         $html .= EEH_HTML::td( /*__FUNCTION__ .*/
466 466
             $name_and_desc,
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
             'item_l sub-item'
469 469
         );
470 470
         // percent td
471
-        $html .= EEH_HTML::td($line_item->percent() . '%', '', 'spco-nowrap jst-rght', '');
471
+        $html .= EEH_HTML::td($line_item->percent().'%', '', 'spco-nowrap jst-rght', '');
472 472
         // empty td (price)
473 473
         $html .= EEH_HTML::td(EEH_HTML::nbsp());
474 474
         // total td
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                     $registration_payments += $registration->registration_payments();
614 614
                 }
615 615
             }
616
-            if (! empty($registration_payments)) {
616
+            if ( ! empty($registration_payments)) {
617 617
                 foreach ($registration_payments as $registration_payment) {
618 618
                     if ($registration_payment instanceof EE_Registration_Payment) {
619 619
                         $owing -= $registration_payment->amount();
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                             $payment_desc = sprintf(
624 624
                                 esc_html__('Payment%1$s Received: %2$s', 'event_espresso'),
625 625
                                 $payment->txn_id_chq_nmbr() !== ''
626
-                                    ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
626
+                                    ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
627 627
                                     : '',
628 628
                                 $payment->timestamp()
629 629
                             );
Please login to merge, or discard this patch.
core/domain/services/registration/form/v1/RegistrantForm.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -17,192 +17,192 @@
 block discarded – undo
17 17
 class RegistrantForm extends EE_Form_Section_Proper
18 18
 {
19 19
 
20
-    /**
21
-     * @var EEM_Event_Question_Group
22
-     */
23
-    public $event_question_group_model;
24
-
25
-    /**
26
-     * @var bool
27
-     */
28
-    private $has_questions = false;
29
-
30
-
31
-    /**
32
-     * RegistrantForm constructor.
33
-     *
34
-     * @param EE_Registration          $registration
35
-     * @param bool                     $admin_request
36
-     * @param bool                     $copy_attendee_info
37
-     * @param callable                 $enablePrintCopyInfo
38
-     * @param EEM_Event_Question_Group $event_question_group_model
39
-     * @throws EE_Error
40
-     * @throws ReflectionException
41
-     */
42
-    public function __construct(
43
-        EE_Registration $registration,
44
-        bool $admin_request,
45
-        bool $copy_attendee_info,
46
-        callable $enablePrintCopyInfo,
47
-        EEM_Event_Question_Group $event_question_group_model
48
-    ) {
49
-        $this->event_question_group_model = $event_question_group_model;
50
-        parent::__construct(
51
-            $this->generateFormArgs($registration, $admin_request, $copy_attendee_info, $enablePrintCopyInfo)
52
-        );
53
-    }
54
-
55
-
56
-    /**
57
-     * @return bool
58
-     */
59
-    public function hasQuestions(): bool
60
-    {
61
-        return $this->has_questions;
62
-    }
63
-
64
-
65
-    /**
66
-     * @param EE_Registration $registration
67
-     * @param bool            $admin_request
68
-     * @param bool            $copy_attendee_info
69
-     * @param callable        $enablePrintCopyInfo
70
-     * @return array
71
-     * @throws EE_Error
72
-     * @throws ReflectionException
73
-     */
74
-    private function generateFormArgs(
75
-        EE_Registration $registration,
76
-        bool $admin_request,
77
-        bool $copy_attendee_info,
78
-        callable $enablePrintCopyInfo
79
-    ): array {
80
-        static $attendee_nmbr = 1;
81
-        $form_args = [];
82
-        // verify that registration has valid event
83
-        if ($registration->event() instanceof EE_Event) {
84
-            $field_name      = 'Event_Question_Group.' . $this->event_question_group_model->fieldNameForContext(
85
-                $registration->is_primary_registrant()
86
-            );
87
-            $question_groups = $registration->event()->question_groups(
88
-                apply_filters(
89
-                    // @codingStandardsIgnoreStart
90
-                    'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__question_groups_query_parameters',
91
-                    // @codingStandardsIgnoreEnd
92
-                    [
93
-                        [
94
-                            'Event.EVT_ID' => $registration->event()->ID(),
95
-                            $field_name    => true,
96
-                        ],
97
-                        'order_by' => ['QSG_order' => 'ASC'],
98
-                    ],
99
-                    $registration,
100
-                    $this
101
-                )
102
-            );
103
-            if ($question_groups) {
104
-                // array of params to pass to parent constructor
105
-                $form_args = [
106
-                    'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
107
-                    'html_class'      => 'ee-reg-form-attendee-dv',
108
-                    'html_style'      => $admin_request
109
-                        ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
110
-                        : '',
111
-                    'subsections'     => [],
112
-                    'layout_strategy' => new EE_Fieldset_Section_Layout(
113
-                        [
114
-                            'legend_class' => 'spco-attendee-lgnd',
115
-                            'legend_text'  => sprintf(
116
-                                esc_html_x(
117
-                                    'Attendee %d',
118
-                                    'Attendee 123',
119
-                                    'event_espresso'
120
-                                ),
121
-                                $attendee_nmbr
122
-                            ),
123
-                        ]
124
-                    ),
125
-                ];
126
-                foreach ($question_groups as $question_group) {
127
-                    if ($question_group instanceof EE_Question_Group) {
128
-                        $question_group_reg_form = LoaderFactory::getNew(
129
-                            RegFormQuestionGroup::class,
130
-                            [$registration, $question_group, $admin_request]
131
-                        );
132
-                        $form_args['subsections'][ $question_group->identifier() ] = apply_filters(
133
-                            'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
134
-                            $question_group_reg_form,
135
-                            $registration,
136
-                            $question_group,
137
-                            $this
138
-                        );
139
-                    }
140
-                }
141
-                // add hidden input
142
-                $form_args['subsections']['additional_attendee_reg_info'] = $this->additionalAttendeeRegInfoInput(
143
-                    $registration
144
-                );
145
-
146
-                // If we have question groups for additional attendees, then display the copy options
147
-                $printCopyInfo = apply_filters(
148
-                    'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form___printCopyInfo',
149
-                    $attendee_nmbr > 1 && $copy_attendee_info,
150
-                    $attendee_nmbr
151
-                );
152
-                if ($printCopyInfo) {
153
-                    $enablePrintCopyInfo();
154
-                }
155
-
156
-
157
-                if ($registration->is_primary_registrant()) {
158
-                    // generate hidden input
159
-                    $form_args['subsections']['primary_registrant'] = $this->additionalPrimaryRegistrantInputs(
160
-                        $registration
161
-                    );
162
-                }
163
-            }
164
-        }
165
-        $attendee_nmbr++;
166
-
167
-        // Increment the reg forms number if form is valid.
168
-        if (! empty($form_args)) {
169
-            $this->has_questions = true;
170
-        }
171
-
172
-        return $form_args;
173
-    }
174
-
175
-
176
-    /**
177
-     * @param EE_Registration $registration
178
-     * @return EE_Form_Input_Base
179
-     * @throws EE_Error
180
-     */
181
-    private function additionalAttendeeRegInfoInput(EE_Registration $registration)
182
-    {
183
-        // generate hidden input
184
-        return new EE_Hidden_Input(
185
-            [
186
-                'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
187
-                'default' => true,
188
-            ]
189
-        );
190
-    }
191
-
192
-
193
-    /**
194
-     * @param EE_Registration $registration
195
-     * @return    EE_Form_Input_Base
196
-     * @throws EE_Error
197
-     */
198
-    private function additionalPrimaryRegistrantInputs(EE_Registration $registration)
199
-    {
200
-        // generate hidden input
201
-        return new EE_Hidden_Input(
202
-            [
203
-                'html_id' => 'primary_registrant',
204
-                'default' => $registration->reg_url_link(),
205
-            ]
206
-        );
207
-    }
20
+	/**
21
+	 * @var EEM_Event_Question_Group
22
+	 */
23
+	public $event_question_group_model;
24
+
25
+	/**
26
+	 * @var bool
27
+	 */
28
+	private $has_questions = false;
29
+
30
+
31
+	/**
32
+	 * RegistrantForm constructor.
33
+	 *
34
+	 * @param EE_Registration          $registration
35
+	 * @param bool                     $admin_request
36
+	 * @param bool                     $copy_attendee_info
37
+	 * @param callable                 $enablePrintCopyInfo
38
+	 * @param EEM_Event_Question_Group $event_question_group_model
39
+	 * @throws EE_Error
40
+	 * @throws ReflectionException
41
+	 */
42
+	public function __construct(
43
+		EE_Registration $registration,
44
+		bool $admin_request,
45
+		bool $copy_attendee_info,
46
+		callable $enablePrintCopyInfo,
47
+		EEM_Event_Question_Group $event_question_group_model
48
+	) {
49
+		$this->event_question_group_model = $event_question_group_model;
50
+		parent::__construct(
51
+			$this->generateFormArgs($registration, $admin_request, $copy_attendee_info, $enablePrintCopyInfo)
52
+		);
53
+	}
54
+
55
+
56
+	/**
57
+	 * @return bool
58
+	 */
59
+	public function hasQuestions(): bool
60
+	{
61
+		return $this->has_questions;
62
+	}
63
+
64
+
65
+	/**
66
+	 * @param EE_Registration $registration
67
+	 * @param bool            $admin_request
68
+	 * @param bool            $copy_attendee_info
69
+	 * @param callable        $enablePrintCopyInfo
70
+	 * @return array
71
+	 * @throws EE_Error
72
+	 * @throws ReflectionException
73
+	 */
74
+	private function generateFormArgs(
75
+		EE_Registration $registration,
76
+		bool $admin_request,
77
+		bool $copy_attendee_info,
78
+		callable $enablePrintCopyInfo
79
+	): array {
80
+		static $attendee_nmbr = 1;
81
+		$form_args = [];
82
+		// verify that registration has valid event
83
+		if ($registration->event() instanceof EE_Event) {
84
+			$field_name      = 'Event_Question_Group.' . $this->event_question_group_model->fieldNameForContext(
85
+				$registration->is_primary_registrant()
86
+			);
87
+			$question_groups = $registration->event()->question_groups(
88
+				apply_filters(
89
+					// @codingStandardsIgnoreStart
90
+					'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__question_groups_query_parameters',
91
+					// @codingStandardsIgnoreEnd
92
+					[
93
+						[
94
+							'Event.EVT_ID' => $registration->event()->ID(),
95
+							$field_name    => true,
96
+						],
97
+						'order_by' => ['QSG_order' => 'ASC'],
98
+					],
99
+					$registration,
100
+					$this
101
+				)
102
+			);
103
+			if ($question_groups) {
104
+				// array of params to pass to parent constructor
105
+				$form_args = [
106
+					'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
107
+					'html_class'      => 'ee-reg-form-attendee-dv',
108
+					'html_style'      => $admin_request
109
+						? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
110
+						: '',
111
+					'subsections'     => [],
112
+					'layout_strategy' => new EE_Fieldset_Section_Layout(
113
+						[
114
+							'legend_class' => 'spco-attendee-lgnd',
115
+							'legend_text'  => sprintf(
116
+								esc_html_x(
117
+									'Attendee %d',
118
+									'Attendee 123',
119
+									'event_espresso'
120
+								),
121
+								$attendee_nmbr
122
+							),
123
+						]
124
+					),
125
+				];
126
+				foreach ($question_groups as $question_group) {
127
+					if ($question_group instanceof EE_Question_Group) {
128
+						$question_group_reg_form = LoaderFactory::getNew(
129
+							RegFormQuestionGroup::class,
130
+							[$registration, $question_group, $admin_request]
131
+						);
132
+						$form_args['subsections'][ $question_group->identifier() ] = apply_filters(
133
+							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
134
+							$question_group_reg_form,
135
+							$registration,
136
+							$question_group,
137
+							$this
138
+						);
139
+					}
140
+				}
141
+				// add hidden input
142
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->additionalAttendeeRegInfoInput(
143
+					$registration
144
+				);
145
+
146
+				// If we have question groups for additional attendees, then display the copy options
147
+				$printCopyInfo = apply_filters(
148
+					'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form___printCopyInfo',
149
+					$attendee_nmbr > 1 && $copy_attendee_info,
150
+					$attendee_nmbr
151
+				);
152
+				if ($printCopyInfo) {
153
+					$enablePrintCopyInfo();
154
+				}
155
+
156
+
157
+				if ($registration->is_primary_registrant()) {
158
+					// generate hidden input
159
+					$form_args['subsections']['primary_registrant'] = $this->additionalPrimaryRegistrantInputs(
160
+						$registration
161
+					);
162
+				}
163
+			}
164
+		}
165
+		$attendee_nmbr++;
166
+
167
+		// Increment the reg forms number if form is valid.
168
+		if (! empty($form_args)) {
169
+			$this->has_questions = true;
170
+		}
171
+
172
+		return $form_args;
173
+	}
174
+
175
+
176
+	/**
177
+	 * @param EE_Registration $registration
178
+	 * @return EE_Form_Input_Base
179
+	 * @throws EE_Error
180
+	 */
181
+	private function additionalAttendeeRegInfoInput(EE_Registration $registration)
182
+	{
183
+		// generate hidden input
184
+		return new EE_Hidden_Input(
185
+			[
186
+				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
187
+				'default' => true,
188
+			]
189
+		);
190
+	}
191
+
192
+
193
+	/**
194
+	 * @param EE_Registration $registration
195
+	 * @return    EE_Form_Input_Base
196
+	 * @throws EE_Error
197
+	 */
198
+	private function additionalPrimaryRegistrantInputs(EE_Registration $registration)
199
+	{
200
+		// generate hidden input
201
+		return new EE_Hidden_Input(
202
+			[
203
+				'html_id' => 'primary_registrant',
204
+				'default' => $registration->reg_url_link(),
205
+			]
206
+		);
207
+	}
208 208
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Line_Item.helper.php 1 patch
Indentation   +2060 added lines, -2060 removed lines patch added patch discarded remove patch
@@ -22,2064 +22,2064 @@
 block discarded – undo
22 22
 class EEH_Line_Item
23 23
 {
24 24
 
25
-    /**
26
-     * Adds a simple item (unrelated to any other model object) to the provided PARENT line item.
27
-     * Does NOT automatically re-calculate the line item totals or update the related transaction.
28
-     * You should call recalculate_total_including_taxes() on the grant total line item after this
29
-     * to update the subtotals, and EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
30
-     * to keep the registration final prices in-sync with the transaction's total.
31
-     *
32
-     * @param EE_Line_Item $parent_line_item
33
-     * @param string       $name
34
-     * @param float        $unit_price
35
-     * @param string       $description
36
-     * @param int          $quantity
37
-     * @param boolean      $taxable
38
-     * @param boolean      $code if set to a value, ensures there is only one line item with that code
39
-     * @return boolean success
40
-     * @throws EE_Error
41
-     * @throws InvalidArgumentException
42
-     * @throws InvalidDataTypeException
43
-     * @throws InvalidInterfaceException
44
-     * @throws ReflectionException
45
-     */
46
-    public static function add_unrelated_item(
47
-        EE_Line_Item $parent_line_item,
48
-        $name,
49
-        $unit_price,
50
-        $description = '',
51
-        $quantity = 1,
52
-        $taxable = false,
53
-        $code = null
54
-    ) {
55
-        $items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
56
-        $line_item = EE_Line_Item::new_instance(array(
57
-            'LIN_name'       => $name,
58
-            'LIN_desc'       => $description,
59
-            'LIN_unit_price' => $unit_price,
60
-            'LIN_quantity'   => $quantity,
61
-            'LIN_percent'    => null,
62
-            'LIN_is_taxable' => $taxable,
63
-            'LIN_order'      => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
64
-            'LIN_total'      => (float) $unit_price * (int) $quantity,
65
-            'LIN_type'       => EEM_Line_Item::type_line_item,
66
-            'LIN_code'       => $code,
67
-        ));
68
-        $line_item = apply_filters(
69
-            'FHEE__EEH_Line_Item__add_unrelated_item__line_item',
70
-            $line_item,
71
-            $parent_line_item
72
-        );
73
-        return self::add_item($parent_line_item, $line_item);
74
-    }
75
-
76
-
77
-    /**
78
-     * Adds a simple item ( unrelated to any other model object) to the total line item,
79
-     * in the correct spot in the line item tree. Does not automatically
80
-     * re-calculate the line item totals, nor update the related transaction, nor upgrade the transaction's
81
-     * registrations' final prices (which should probably change because of this).
82
-     * You should call recalculate_total_including_taxes() on the grand total line item, then
83
-     * update the transaction's total, and EE_Registration_Processor::update_registration_final_prices()
84
-     * after using this, to keep the registration final prices in-sync with the transaction's total.
85
-     *
86
-     * @param EE_Line_Item $parent_line_item
87
-     * @param string       $name
88
-     * @param float        $percentage_amount
89
-     * @param string       $description
90
-     * @param boolean      $taxable
91
-     * @return boolean success
92
-     * @throws EE_Error
93
-     */
94
-    public static function add_percentage_based_item(
95
-        EE_Line_Item $parent_line_item,
96
-        $name,
97
-        $percentage_amount,
98
-        $description = '',
99
-        $taxable = false
100
-    ) {
101
-        $line_item = EE_Line_Item::new_instance(array(
102
-            'LIN_name'       => $name,
103
-            'LIN_desc'       => $description,
104
-            'LIN_unit_price' => 0,
105
-            'LIN_percent'    => $percentage_amount,
106
-            'LIN_quantity'   => 1,
107
-            'LIN_is_taxable' => $taxable,
108
-            'LIN_total'      => (float) ($percentage_amount * ($parent_line_item->total() / 100)),
109
-            'LIN_type'       => EEM_Line_Item::type_line_item,
110
-            'LIN_parent'     => $parent_line_item->ID(),
111
-        ));
112
-        $line_item = apply_filters(
113
-            'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
114
-            $line_item
115
-        );
116
-        return $parent_line_item->add_child_line_item($line_item, false);
117
-    }
118
-
119
-
120
-    /**
121
-     * Returns the new line item created by adding a purchase of the ticket
122
-     * ensures that ticket line item is saved, and that cart total has been recalculated.
123
-     * If this ticket has already been purchased, just increments its count.
124
-     * Automatically re-calculates the line item totals and updates the related transaction. But
125
-     * DOES NOT automatically upgrade the transaction's registrations' final prices (which
126
-     * should probably change because of this).
127
-     * You should call EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
128
-     * after using this, to keep the registration final prices in-sync with the transaction's total.
129
-     *
130
-     * @param EE_Line_Item $total_line_item grand total line item of type EEM_Line_Item::type_total
131
-     * @param EE_Ticket    $ticket
132
-     * @param int          $qty
133
-     * @return EE_Line_Item
134
-     * @throws EE_Error
135
-     * @throws InvalidArgumentException
136
-     * @throws InvalidDataTypeException
137
-     * @throws InvalidInterfaceException
138
-     * @throws ReflectionException
139
-     */
140
-    public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1)
141
-    {
142
-        if (! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
143
-            throw new EE_Error(
144
-                sprintf(
145
-                    esc_html__(
146
-                        'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.',
147
-                        'event_espresso'
148
-                    ),
149
-                    $ticket->ID(),
150
-                    $total_line_item->ID()
151
-                )
152
-            );
153
-        }
154
-        // either increment the qty for an existing ticket
155
-        $line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
156
-        // or add a new one
157
-        if (! $line_item instanceof EE_Line_Item) {
158
-            $line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
159
-        }
160
-        $total_line_item->recalculate_total_including_taxes();
161
-        return $line_item;
162
-    }
163
-
164
-
165
-    /**
166
-     * Returns the new line item created by adding a purchase of the ticket
167
-     *
168
-     * @param EE_Line_Item $total_line_item
169
-     * @param EE_Ticket    $ticket
170
-     * @param int          $qty
171
-     * @return EE_Line_Item
172
-     * @throws EE_Error
173
-     * @throws InvalidArgumentException
174
-     * @throws InvalidDataTypeException
175
-     * @throws InvalidInterfaceException
176
-     * @throws ReflectionException
177
-     */
178
-    public static function increment_ticket_qty_if_already_in_cart(
179
-        EE_Line_Item $total_line_item,
180
-        EE_Ticket $ticket,
181
-        $qty = 1
182
-    ) {
183
-        $line_item = null;
184
-        if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
185
-            $ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
186
-            foreach ((array) $ticket_line_items as $ticket_line_item) {
187
-                if (
188
-                    $ticket_line_item instanceof EE_Line_Item
189
-                    && (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
190
-                ) {
191
-                    $line_item = $ticket_line_item;
192
-                    break;
193
-                }
194
-            }
195
-        }
196
-        if ($line_item instanceof EE_Line_Item) {
197
-            EEH_Line_Item::increment_quantity($line_item, $qty);
198
-            return $line_item;
199
-        }
200
-        return null;
201
-    }
202
-
203
-
204
-    /**
205
-     * Increments the line item and all its children's quantity by $qty (but percent line items are unaffected).
206
-     * Does NOT save or recalculate other line items totals
207
-     *
208
-     * @param EE_Line_Item $line_item
209
-     * @param int          $qty
210
-     * @return void
211
-     * @throws EE_Error
212
-     * @throws InvalidArgumentException
213
-     * @throws InvalidDataTypeException
214
-     * @throws InvalidInterfaceException
215
-     * @throws ReflectionException
216
-     */
217
-    public static function increment_quantity(EE_Line_Item $line_item, $qty = 1)
218
-    {
219
-        if (! $line_item->is_percent()) {
220
-            $qty += $line_item->quantity();
221
-            $line_item->set_quantity($qty);
222
-            $line_item->set_total($line_item->unit_price() * $qty);
223
-            $line_item->save();
224
-        }
225
-        foreach ($line_item->children() as $child) {
226
-            if ($child->is_sub_line_item()) {
227
-                EEH_Line_Item::update_quantity($child, $qty);
228
-            }
229
-        }
230
-    }
231
-
232
-
233
-    /**
234
-     * Decrements the line item and all its children's quantity by $qty (but percent line items are unaffected).
235
-     * Does NOT save or recalculate other line items totals
236
-     *
237
-     * @param EE_Line_Item $line_item
238
-     * @param int          $qty
239
-     * @return void
240
-     * @throws EE_Error
241
-     * @throws InvalidArgumentException
242
-     * @throws InvalidDataTypeException
243
-     * @throws InvalidInterfaceException
244
-     * @throws ReflectionException
245
-     */
246
-    public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1)
247
-    {
248
-        if (! $line_item->is_percent()) {
249
-            $qty = $line_item->quantity() - $qty;
250
-            $qty = max($qty, 0);
251
-            $line_item->set_quantity($qty);
252
-            $line_item->set_total($line_item->unit_price() * $qty);
253
-            $line_item->save();
254
-        }
255
-        foreach ($line_item->children() as $child) {
256
-            if ($child->is_sub_line_item()) {
257
-                EEH_Line_Item::update_quantity($child, $qty);
258
-            }
259
-        }
260
-    }
261
-
262
-
263
-    /**
264
-     * Updates the line item and its children's quantities to the specified number.
265
-     * Does NOT save them or recalculate totals.
266
-     *
267
-     * @param EE_Line_Item $line_item
268
-     * @param int          $new_quantity
269
-     * @throws EE_Error
270
-     * @throws InvalidArgumentException
271
-     * @throws InvalidDataTypeException
272
-     * @throws InvalidInterfaceException
273
-     * @throws ReflectionException
274
-     */
275
-    public static function update_quantity(EE_Line_Item $line_item, $new_quantity)
276
-    {
277
-        if (! $line_item->is_percent()) {
278
-            $line_item->set_quantity($new_quantity);
279
-            $line_item->set_total($line_item->unit_price() * $new_quantity);
280
-            $line_item->save();
281
-        }
282
-        foreach ($line_item->children() as $child) {
283
-            if ($child->is_sub_line_item()) {
284
-                EEH_Line_Item::update_quantity($child, $new_quantity);
285
-            }
286
-        }
287
-    }
288
-
289
-
290
-    /**
291
-     * Returns the new line item created by adding a purchase of the ticket
292
-     *
293
-     * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
294
-     * @param EE_Ticket    $ticket
295
-     * @param int          $qty
296
-     * @return EE_Line_Item
297
-     * @throws EE_Error
298
-     * @throws InvalidArgumentException
299
-     * @throws InvalidDataTypeException
300
-     * @throws InvalidInterfaceException
301
-     * @throws ReflectionException
302
-     */
303
-    public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1)
304
-    {
305
-        $datetimes = $ticket->datetimes();
306
-        $first_datetime = reset($datetimes);
307
-        $first_datetime_name = esc_html__('Event', 'event_espresso');
308
-        if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
309
-            $first_datetime_name = $first_datetime->event()->name();
310
-        }
311
-        $event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
312
-        // get event subtotal line
313
-        $events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
314
-        $taxes = $ticket->tax_price_modifiers();
315
-        $is_taxable = empty($taxes) ? $ticket->taxable() : false;
316
-        // add $ticket to cart
317
-        $line_item = EE_Line_Item::new_instance(array(
318
-            'LIN_name'       => $ticket->name(),
319
-            'LIN_desc'       => $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
320
-            'LIN_unit_price' => $ticket->price(),
321
-            'LIN_quantity'   => $qty,
322
-            'LIN_is_taxable' => $is_taxable,
323
-            'LIN_order'      => count($events_sub_total->children()),
324
-            'LIN_total'      => $ticket->price() * $qty,
325
-            'LIN_type'       => EEM_Line_Item::type_line_item,
326
-            'OBJ_ID'         => $ticket->ID(),
327
-            'OBJ_type'       => EEM_Line_Item::OBJ_TYPE_TICKET,
328
-        ));
329
-        $line_item = apply_filters(
330
-            'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
331
-            $line_item
332
-        );
333
-        $events_sub_total->add_child_line_item($line_item);
334
-        // now add the sub-line items
335
-        $running_total_for_ticket = 0;
336
-        foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
337
-            $sign = $price->is_discount() ? -1 : 1;
338
-            $price_total = $price->is_percent()
339
-                ? $running_total_for_ticket * $price->amount() / 100
340
-                : $price->amount() * $qty;
341
-            $sub_line_item = EE_Line_Item::new_instance(array(
342
-                'LIN_name'       => $price->name(),
343
-                'LIN_desc'       => $price->desc(),
344
-                'LIN_quantity'   => $price->is_percent() ? null : $qty,
345
-                'LIN_is_taxable' => false,
346
-                'LIN_order'      => $price->order(),
347
-                'LIN_total'      => $sign * $price_total,
348
-                'LIN_type'       => EEM_Line_Item::type_sub_line_item,
349
-                'OBJ_ID'         => $price->ID(),
350
-                'OBJ_type'       => EEM_Line_Item::OBJ_TYPE_PRICE,
351
-            ));
352
-            $sub_line_item = apply_filters(
353
-                'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
354
-                $sub_line_item
355
-            );
356
-            if ($price->is_percent()) {
357
-                $sub_line_item->set_percent($sign * $price->amount());
358
-            } else {
359
-                $sub_line_item->set_unit_price($sign * $price->amount());
360
-            }
361
-            $running_total_for_ticket += $price_total;
362
-            $line_item->add_child_line_item($sub_line_item);
363
-        }
364
-        return $line_item;
365
-    }
366
-
367
-
368
-    /**
369
-     * Adds the specified item under the pre-tax-sub-total line item. Automatically
370
-     * re-calculates the line item totals and updates the related transaction. But
371
-     * DOES NOT automatically upgrade the transaction's registrations' final prices (which
372
-     * should probably change because of this).
373
-     * You should call EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
374
-     * after using this, to keep the registration final prices in-sync with the transaction's total.
375
-     *
376
-     * @param EE_Line_Item $total_line_item
377
-     * @param EE_Line_Item $item to be added
378
-     * @return boolean
379
-     * @throws EE_Error
380
-     * @throws InvalidArgumentException
381
-     * @throws InvalidDataTypeException
382
-     * @throws InvalidInterfaceException
383
-     * @throws ReflectionException
384
-     */
385
-    public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item)
386
-    {
387
-        $pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
388
-        if ($pre_tax_subtotal instanceof EE_Line_Item) {
389
-            $success = $pre_tax_subtotal->add_child_line_item($item);
390
-        } else {
391
-            return false;
392
-        }
393
-        $total_line_item->recalculate_total_including_taxes();
394
-        return $success;
395
-    }
396
-
397
-
398
-    /**
399
-     * cancels an existing ticket line item,
400
-     * by decrementing it's quantity by 1 and adding a new "type_cancellation" sub-line-item.
401
-     * ALL totals and subtotals will NEED TO BE UPDATED after performing this action
402
-     *
403
-     * @param EE_Line_Item $ticket_line_item
404
-     * @param int          $qty
405
-     * @return bool success
406
-     * @throws EE_Error
407
-     * @throws InvalidArgumentException
408
-     * @throws InvalidDataTypeException
409
-     * @throws InvalidInterfaceException
410
-     * @throws ReflectionException
411
-     */
412
-    public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1)
413
-    {
414
-        // validate incoming line_item
415
-        if ($ticket_line_item->OBJ_type() !== EEM_Line_Item::OBJ_TYPE_TICKET) {
416
-            throw new EE_Error(
417
-                sprintf(
418
-                    esc_html__(
419
-                        'The supplied line item must have an Object Type of "Ticket", not %1$s.',
420
-                        'event_espresso'
421
-                    ),
422
-                    $ticket_line_item->type()
423
-                )
424
-            );
425
-        }
426
-        if ($ticket_line_item->quantity() < $qty) {
427
-            throw new EE_Error(
428
-                sprintf(
429
-                    esc_html__(
430
-                        'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.',
431
-                        'event_espresso'
432
-                    ),
433
-                    $qty,
434
-                    $ticket_line_item->quantity()
435
-                )
436
-            );
437
-        }
438
-        // decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
439
-        $ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
440
-        foreach ($ticket_line_item->children() as $child_line_item) {
441
-            if (
442
-                $child_line_item->is_sub_line_item()
443
-                && ! $child_line_item->is_percent()
444
-                && ! $child_line_item->is_cancellation()
445
-            ) {
446
-                $child_line_item->set_quantity($child_line_item->quantity() - $qty);
447
-            }
448
-        }
449
-        // get cancellation sub line item
450
-        $cancellation_line_item = EEH_Line_Item::get_descendants_of_type(
451
-            $ticket_line_item,
452
-            EEM_Line_Item::type_cancellation
453
-        );
454
-        $cancellation_line_item = reset($cancellation_line_item);
455
-        // verify that this ticket was indeed previously cancelled
456
-        if ($cancellation_line_item instanceof EE_Line_Item) {
457
-            // increment cancelled quantity
458
-            $cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
459
-        } else {
460
-            // create cancellation sub line item
461
-            $cancellation_line_item = EE_Line_Item::new_instance(array(
462
-                'LIN_name'       => esc_html__('Cancellation', 'event_espresso'),
463
-                'LIN_desc'       => sprintf(
464
-                    esc_html_x(
465
-                        'Cancelled %1$s : %2$s',
466
-                        'Cancelled Ticket Name : 2015-01-01 11:11',
467
-                        'event_espresso'
468
-                    ),
469
-                    $ticket_line_item->name(),
470
-                    current_time(get_option('date_format') . ' ' . get_option('time_format'))
471
-                ),
472
-                'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
473
-                'LIN_quantity'   => $qty,
474
-                'LIN_is_taxable' => $ticket_line_item->is_taxable(),
475
-                'LIN_order'      => count($ticket_line_item->children()),
476
-                'LIN_total'      => 0, // $ticket_line_item->unit_price()
477
-                'LIN_type'       => EEM_Line_Item::type_cancellation,
478
-            ));
479
-            $ticket_line_item->add_child_line_item($cancellation_line_item);
480
-        }
481
-        if ($ticket_line_item->save_this_and_descendants() > 0) {
482
-            // decrement parent line item quantity
483
-            $event_line_item = $ticket_line_item->parent();
484
-            if (
485
-                $event_line_item instanceof EE_Line_Item
486
-                && $event_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
487
-            ) {
488
-                $event_line_item->set_quantity($event_line_item->quantity() - $qty);
489
-                $event_line_item->save();
490
-            }
491
-            EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
492
-            return true;
493
-        }
494
-        return false;
495
-    }
496
-
497
-
498
-    /**
499
-     * reinstates (un-cancels?) a previously canceled ticket line item,
500
-     * by incrementing it's quantity by 1, and decrementing it's "type_cancellation" sub-line-item.
501
-     * ALL totals and subtotals will NEED TO BE UPDATED after performing this action
502
-     *
503
-     * @param EE_Line_Item $ticket_line_item
504
-     * @param int          $qty
505
-     * @return bool success
506
-     * @throws EE_Error
507
-     * @throws InvalidArgumentException
508
-     * @throws InvalidDataTypeException
509
-     * @throws InvalidInterfaceException
510
-     * @throws ReflectionException
511
-     */
512
-    public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1)
513
-    {
514
-        // validate incoming line_item
515
-        if ($ticket_line_item->OBJ_type() !== EEM_Line_Item::OBJ_TYPE_TICKET) {
516
-            throw new EE_Error(
517
-                sprintf(
518
-                    esc_html__(
519
-                        'The supplied line item must have an Object Type of "Ticket", not %1$s.',
520
-                        'event_espresso'
521
-                    ),
522
-                    $ticket_line_item->type()
523
-                )
524
-            );
525
-        }
526
-        // get cancellation sub line item
527
-        $cancellation_line_item = EEH_Line_Item::get_descendants_of_type(
528
-            $ticket_line_item,
529
-            EEM_Line_Item::type_cancellation
530
-        );
531
-        $cancellation_line_item = reset($cancellation_line_item);
532
-        // verify that this ticket was indeed previously cancelled
533
-        if (! $cancellation_line_item instanceof EE_Line_Item) {
534
-            return false;
535
-        }
536
-        if ($cancellation_line_item->quantity() > $qty) {
537
-            // decrement cancelled quantity
538
-            $cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
539
-        } elseif ($cancellation_line_item->quantity() === $qty) {
540
-            // decrement cancelled quantity in case anyone still has the object kicking around
541
-            $cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
542
-            // delete because quantity will end up as 0
543
-            $cancellation_line_item->delete();
544
-            // and attempt to destroy the object,
545
-            // even though PHP won't actually destroy it until it needs the memory
546
-            unset($cancellation_line_item);
547
-        } else {
548
-            // what ?!?! negative quantity ?!?!
549
-            throw new EE_Error(
550
-                sprintf(
551
-                    esc_html__(
552
-                        'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
553
-                        'event_espresso'
554
-                    ),
555
-                    $qty,
556
-                    $cancellation_line_item->quantity()
557
-                )
558
-            );
559
-        }
560
-        // increment ticket quantity
561
-        $ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
562
-        if ($ticket_line_item->save_this_and_descendants() > 0) {
563
-            // increment parent line item quantity
564
-            $event_line_item = $ticket_line_item->parent();
565
-            if (
566
-                $event_line_item instanceof EE_Line_Item
567
-                && $event_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
568
-            ) {
569
-                $event_line_item->set_quantity($event_line_item->quantity() + $qty);
570
-            }
571
-            EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
572
-            return true;
573
-        }
574
-        return false;
575
-    }
576
-
577
-
578
-    /**
579
-     * calls EEH_Line_Item::find_transaction_grand_total_for_line_item()
580
-     * then EE_Line_Item::recalculate_total_including_taxes() on the result
581
-     *
582
-     * @param EE_Line_Item $line_item
583
-     * @return float
584
-     * @throws EE_Error
585
-     * @throws InvalidArgumentException
586
-     * @throws InvalidDataTypeException
587
-     * @throws InvalidInterfaceException
588
-     * @throws ReflectionException
589
-     */
590
-    public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item)
591
-    {
592
-        $grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
593
-        return $grand_total_line_item->recalculate_total_including_taxes();
594
-    }
595
-
596
-
597
-    /**
598
-     * Gets the line item which contains the subtotal of all the items
599
-     *
600
-     * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
601
-     * @return EE_Line_Item
602
-     * @throws EE_Error
603
-     * @throws InvalidArgumentException
604
-     * @throws InvalidDataTypeException
605
-     * @throws InvalidInterfaceException
606
-     * @throws ReflectionException
607
-     */
608
-    public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item)
609
-    {
610
-        $pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
611
-        return $pre_tax_subtotal instanceof EE_Line_Item
612
-            ? $pre_tax_subtotal
613
-            : self::create_pre_tax_subtotal($total_line_item);
614
-    }
615
-
616
-
617
-    /**
618
-     * Gets the line item for the taxes subtotal
619
-     *
620
-     * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
621
-     * @return EE_Line_Item
622
-     * @throws EE_Error
623
-     * @throws InvalidArgumentException
624
-     * @throws InvalidDataTypeException
625
-     * @throws InvalidInterfaceException
626
-     * @throws ReflectionException
627
-     */
628
-    public static function get_taxes_subtotal(EE_Line_Item $total_line_item)
629
-    {
630
-        $taxes = $total_line_item->get_child_line_item('taxes');
631
-        return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
632
-    }
633
-
634
-
635
-    /**
636
-     * sets the TXN ID on an EE_Line_Item if passed a valid EE_Transaction object
637
-     *
638
-     * @param EE_Line_Item   $line_item
639
-     * @param EE_Transaction $transaction
640
-     * @return void
641
-     * @throws EE_Error
642
-     * @throws InvalidArgumentException
643
-     * @throws InvalidDataTypeException
644
-     * @throws InvalidInterfaceException
645
-     * @throws ReflectionException
646
-     */
647
-    public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = null)
648
-    {
649
-        if ($transaction) {
650
-            /** @type EEM_Transaction $EEM_Transaction */
651
-            $EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
652
-            $TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
653
-            $line_item->set_TXN_ID($TXN_ID);
654
-        }
655
-    }
656
-
657
-
658
-    /**
659
-     * Creates a new default total line item for the transaction,
660
-     * and its tickets subtotal and taxes subtotal line items (and adds the
661
-     * existing taxes as children of the taxes subtotal line item)
662
-     *
663
-     * @param EE_Transaction $transaction
664
-     * @return EE_Line_Item of type total
665
-     * @throws EE_Error
666
-     * @throws InvalidArgumentException
667
-     * @throws InvalidDataTypeException
668
-     * @throws InvalidInterfaceException
669
-     * @throws ReflectionException
670
-     */
671
-    public static function create_total_line_item($transaction = null)
672
-    {
673
-        $total_line_item = EE_Line_Item::new_instance(array(
674
-            'LIN_code' => 'total',
675
-            'LIN_name' => esc_html__('Grand Total', 'event_espresso'),
676
-            'LIN_type' => EEM_Line_Item::type_total,
677
-            'OBJ_type' => EEM_Line_Item::OBJ_TYPE_TRANSACTION,
678
-        ));
679
-        $total_line_item = apply_filters(
680
-            'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
681
-            $total_line_item
682
-        );
683
-        self::set_TXN_ID($total_line_item, $transaction);
684
-        self::create_pre_tax_subtotal($total_line_item, $transaction);
685
-        self::create_taxes_subtotal($total_line_item, $transaction);
686
-        return $total_line_item;
687
-    }
688
-
689
-
690
-    /**
691
-     * Creates a default items subtotal line item
692
-     *
693
-     * @param EE_Line_Item   $total_line_item
694
-     * @param EE_Transaction $transaction
695
-     * @return EE_Line_Item
696
-     * @throws EE_Error
697
-     * @throws InvalidArgumentException
698
-     * @throws InvalidDataTypeException
699
-     * @throws InvalidInterfaceException
700
-     * @throws ReflectionException
701
-     */
702
-    protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = null)
703
-    {
704
-        $pre_tax_line_item = EE_Line_Item::new_instance(array(
705
-            'LIN_code' => 'pre-tax-subtotal',
706
-            'LIN_name' => esc_html__('Pre-Tax Subtotal', 'event_espresso'),
707
-            'LIN_type' => EEM_Line_Item::type_sub_total,
708
-        ));
709
-        $pre_tax_line_item = apply_filters(
710
-            'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
711
-            $pre_tax_line_item
712
-        );
713
-        self::set_TXN_ID($pre_tax_line_item, $transaction);
714
-        $total_line_item->add_child_line_item($pre_tax_line_item);
715
-        self::create_event_subtotal($pre_tax_line_item, $transaction);
716
-        return $pre_tax_line_item;
717
-    }
718
-
719
-
720
-    /**
721
-     * Creates a line item for the taxes subtotal and finds all the tax prices
722
-     * and applies taxes to it
723
-     *
724
-     * @param EE_Line_Item   $total_line_item of type EEM_Line_Item::type_total
725
-     * @param EE_Transaction $transaction
726
-     * @return EE_Line_Item
727
-     * @throws EE_Error
728
-     * @throws InvalidArgumentException
729
-     * @throws InvalidDataTypeException
730
-     * @throws InvalidInterfaceException
731
-     * @throws ReflectionException
732
-     */
733
-    protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = null)
734
-    {
735
-        $tax_line_item = EE_Line_Item::new_instance(array(
736
-            'LIN_code'  => 'taxes',
737
-            'LIN_name'  => esc_html__('Taxes', 'event_espresso'),
738
-            'LIN_type'  => EEM_Line_Item::type_tax_sub_total,
739
-            'LIN_order' => 1000,// this should always come last
740
-        ));
741
-        $tax_line_item = apply_filters(
742
-            'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
743
-            $tax_line_item
744
-        );
745
-        self::set_TXN_ID($tax_line_item, $transaction);
746
-        $total_line_item->add_child_line_item($tax_line_item);
747
-        // and lastly, add the actual taxes
748
-        self::apply_taxes($total_line_item);
749
-        return $tax_line_item;
750
-    }
751
-
752
-
753
-    /**
754
-     * Creates a default items subtotal line item
755
-     *
756
-     * @param EE_Line_Item   $pre_tax_line_item
757
-     * @param EE_Transaction $transaction
758
-     * @param EE_Event       $event
759
-     * @return EE_Line_Item
760
-     * @throws EE_Error
761
-     * @throws InvalidArgumentException
762
-     * @throws InvalidDataTypeException
763
-     * @throws InvalidInterfaceException
764
-     * @throws ReflectionException
765
-     */
766
-    public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = null, $event = null)
767
-    {
768
-        $event_line_item = EE_Line_Item::new_instance(array(
769
-            'LIN_code' => self::get_event_code($event),
770
-            'LIN_name' => self::get_event_name($event),
771
-            'LIN_desc' => self::get_event_desc($event),
772
-            'LIN_type' => EEM_Line_Item::type_sub_total,
773
-            'OBJ_type' => EEM_Line_Item::OBJ_TYPE_EVENT,
774
-            'OBJ_ID'   => $event instanceof EE_Event ? $event->ID() : 0,
775
-        ));
776
-        $event_line_item = apply_filters(
777
-            'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
778
-            $event_line_item
779
-        );
780
-        self::set_TXN_ID($event_line_item, $transaction);
781
-        $pre_tax_line_item->add_child_line_item($event_line_item);
782
-        return $event_line_item;
783
-    }
784
-
785
-
786
-    /**
787
-     * Gets what the event ticket's code SHOULD be
788
-     *
789
-     * @param EE_Event $event
790
-     * @return string
791
-     * @throws EE_Error
792
-     */
793
-    public static function get_event_code($event)
794
-    {
795
-        return 'event-' . ($event instanceof EE_Event ? $event->ID() : '0');
796
-    }
797
-
798
-
799
-    /**
800
-     * Gets the event name
801
-     *
802
-     * @param EE_Event $event
803
-     * @return string
804
-     * @throws EE_Error
805
-     */
806
-    public static function get_event_name($event)
807
-    {
808
-        return $event instanceof EE_Event
809
-            ? mb_substr($event->name(), 0, 245)
810
-            : esc_html__('Event', 'event_espresso');
811
-    }
812
-
813
-
814
-    /**
815
-     * Gets the event excerpt
816
-     *
817
-     * @param EE_Event $event
818
-     * @return string
819
-     * @throws EE_Error
820
-     */
821
-    public static function get_event_desc($event)
822
-    {
823
-        return $event instanceof EE_Event ? $event->short_description() : '';
824
-    }
825
-
826
-
827
-    /**
828
-     * Given the grand total line item and a ticket, finds the event sub-total
829
-     * line item the ticket's purchase should be added onto
830
-     *
831
-     * @access public
832
-     * @param EE_Line_Item $grand_total the grand total line item
833
-     * @param EE_Ticket    $ticket
834
-     * @return EE_Line_Item
835
-     * @throws EE_Error
836
-     * @throws InvalidArgumentException
837
-     * @throws InvalidDataTypeException
838
-     * @throws InvalidInterfaceException
839
-     * @throws ReflectionException
840
-     */
841
-    public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket)
842
-    {
843
-        $first_datetime = $ticket->first_datetime();
844
-        if (! $first_datetime instanceof EE_Datetime) {
845
-            throw new EE_Error(
846
-                sprintf(
847
-                    __('The supplied ticket (ID %d) has no datetimes', 'event_espresso'),
848
-                    $ticket->ID()
849
-                )
850
-            );
851
-        }
852
-        $event = $first_datetime->event();
853
-        if (! $event instanceof EE_Event) {
854
-            throw new EE_Error(
855
-                sprintf(
856
-                    esc_html__(
857
-                        'The supplied ticket (ID %d) has no event data associated with it.',
858
-                        'event_espresso'
859
-                    ),
860
-                    $ticket->ID()
861
-                )
862
-            );
863
-        }
864
-        $events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
865
-        if (! $events_sub_total instanceof EE_Line_Item) {
866
-            throw new EE_Error(
867
-                sprintf(
868
-                    esc_html__(
869
-                        'There is no events sub-total for ticket %s on total line item %d',
870
-                        'event_espresso'
871
-                    ),
872
-                    $ticket->ID(),
873
-                    $grand_total->ID()
874
-                )
875
-            );
876
-        }
877
-        return $events_sub_total;
878
-    }
879
-
880
-
881
-    /**
882
-     * Gets the event line item
883
-     *
884
-     * @param EE_Line_Item $grand_total
885
-     * @param EE_Event     $event
886
-     * @return EE_Line_Item for the event subtotal which is a child of $grand_total
887
-     * @throws EE_Error
888
-     * @throws InvalidArgumentException
889
-     * @throws InvalidDataTypeException
890
-     * @throws InvalidInterfaceException
891
-     * @throws ReflectionException
892
-     */
893
-    public static function get_event_line_item(EE_Line_Item $grand_total, $event)
894
-    {
895
-        /** @type EE_Event $event */
896
-        $event = EEM_Event::instance()->ensure_is_obj($event, true);
897
-        $event_line_item = null;
898
-        $found = false;
899
-        foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
900
-            // default event subtotal, we should only ever find this the first time this method is called
901
-            if (! $event_line_item->OBJ_ID()) {
902
-                // let's use this! but first... set the event details
903
-                EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
904
-                $found = true;
905
-                break;
906
-            }
907
-            if ($event_line_item->OBJ_ID() === $event->ID()) {
908
-                // found existing line item for this event in the cart, so break out of loop and use this one
909
-                $found = true;
910
-                break;
911
-            }
912
-        }
913
-        if (! $found) {
914
-            // there is no event sub-total yet, so add it
915
-            $pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
916
-            // create a new "event" subtotal below that
917
-            $event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
918
-            // and set the event details
919
-            EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
920
-        }
921
-        return $event_line_item;
922
-    }
923
-
924
-
925
-    /**
926
-     * Creates a default items subtotal line item
927
-     *
928
-     * @param EE_Line_Item   $event_line_item
929
-     * @param EE_Event       $event
930
-     * @param EE_Transaction $transaction
931
-     * @return void
932
-     * @throws EE_Error
933
-     * @throws InvalidArgumentException
934
-     * @throws InvalidDataTypeException
935
-     * @throws InvalidInterfaceException
936
-     * @throws ReflectionException
937
-     */
938
-    public static function set_event_subtotal_details(
939
-        EE_Line_Item $event_line_item,
940
-        EE_Event $event,
941
-        $transaction = null
942
-    ) {
943
-        if ($event instanceof EE_Event) {
944
-            $event_line_item->set_code(self::get_event_code($event));
945
-            $event_line_item->set_name(self::get_event_name($event));
946
-            $event_line_item->set_desc(self::get_event_desc($event));
947
-            $event_line_item->set_OBJ_ID($event->ID());
948
-        }
949
-        self::set_TXN_ID($event_line_item, $transaction);
950
-    }
951
-
952
-
953
-    /**
954
-     * Finds what taxes should apply, adds them as tax line items under the taxes sub-total,
955
-     * and recalculates the taxes sub-total and the grand total. Resets the taxes, so
956
-     * any old taxes are removed
957
-     *
958
-     * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
959
-     * @param bool         $update_txn_status
960
-     * @return bool
961
-     * @throws EE_Error
962
-     * @throws InvalidArgumentException
963
-     * @throws InvalidDataTypeException
964
-     * @throws InvalidInterfaceException
965
-     * @throws ReflectionException
966
-     * @throws RuntimeException
967
-     */
968
-    public static function apply_taxes(EE_Line_Item $total_line_item, $update_txn_status = false)
969
-    {
970
-        /** @var EE_Admin_Config $admin_config */
971
-        $admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
972
-        if ($admin_config->useAdvancedEditor()) {
973
-            return false;
974
-        }
975
-        /** @type EEM_Price $EEM_Price */
976
-        $EEM_Price = EE_Registry::instance()->load_model('Price');
977
-        // get array of taxes via Price Model
978
-        $ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
979
-        ksort($ordered_taxes);
980
-        $taxes_line_item = self::get_taxes_subtotal($total_line_item);
981
-        // just to be safe, remove its old tax line items
982
-        $deleted = $taxes_line_item->delete_children_line_items();
983
-        $updates = false;
984
-        // loop thru taxes
985
-        foreach ($ordered_taxes as $order => $taxes) {
986
-            foreach ($taxes as $tax) {
987
-                if ($tax instanceof EE_Price) {
988
-                    $tax_line_item = EE_Line_Item::new_instance(
989
-                        array(
990
-                            'LIN_name'       => $tax->name(),
991
-                            'LIN_desc'       => $tax->desc(),
992
-                            'LIN_percent'    => $tax->amount(),
993
-                            'LIN_is_taxable' => false,
994
-                            'LIN_order'      => $order,
995
-                            'LIN_total'      => 0,
996
-                            'LIN_type'       => EEM_Line_Item::type_tax,
997
-                            'OBJ_type'       => EEM_Line_Item::OBJ_TYPE_PRICE,
998
-                            'OBJ_ID'         => $tax->ID(),
999
-                        )
1000
-                    );
1001
-                    $tax_line_item = apply_filters(
1002
-                        'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
1003
-                        $tax_line_item
1004
-                    );
1005
-                    $updates = $taxes_line_item->add_child_line_item($tax_line_item) ?
1006
-                        true :
1007
-                        $updates;
1008
-                }
1009
-            }
1010
-        }
1011
-        // only recalculate totals if something changed
1012
-        if ($deleted || $updates) {
1013
-            $total_line_item->recalculate_total_including_taxes($update_txn_status);
1014
-            return true;
1015
-        }
1016
-        return false;
1017
-    }
1018
-
1019
-
1020
-    /**
1021
-     * Ensures that taxes have been applied to the order, if not applies them.
1022
-     * Returns the total amount of tax
1023
-     *
1024
-     * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
1025
-     * @return float
1026
-     * @throws EE_Error
1027
-     * @throws InvalidArgumentException
1028
-     * @throws InvalidDataTypeException
1029
-     * @throws InvalidInterfaceException
1030
-     * @throws ReflectionException
1031
-     */
1032
-    public static function ensure_taxes_applied($total_line_item)
1033
-    {
1034
-        $taxes_subtotal = self::get_taxes_subtotal($total_line_item);
1035
-        if (! $taxes_subtotal->children()) {
1036
-            self::apply_taxes($total_line_item);
1037
-        }
1038
-        return $taxes_subtotal->total();
1039
-    }
1040
-
1041
-
1042
-    /**
1043
-     * Deletes ALL children of the passed line item
1044
-     *
1045
-     * @param EE_Line_Item $parent_line_item
1046
-     * @return bool
1047
-     * @throws EE_Error
1048
-     * @throws InvalidArgumentException
1049
-     * @throws InvalidDataTypeException
1050
-     * @throws InvalidInterfaceException
1051
-     * @throws ReflectionException
1052
-     */
1053
-    public static function delete_all_child_items(EE_Line_Item $parent_line_item)
1054
-    {
1055
-        $deleted = 0;
1056
-        foreach ($parent_line_item->children() as $child_line_item) {
1057
-            if ($child_line_item instanceof EE_Line_Item) {
1058
-                $deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
1059
-                if ($child_line_item->ID()) {
1060
-                    $child_line_item->delete();
1061
-                    unset($child_line_item);
1062
-                } else {
1063
-                    $parent_line_item->delete_child_line_item($child_line_item->code());
1064
-                }
1065
-                $deleted++;
1066
-            }
1067
-        }
1068
-        return $deleted;
1069
-    }
1070
-
1071
-
1072
-    /**
1073
-     * Deletes the line items as indicated by the line item code(s) provided,
1074
-     * regardless of where they're found in the line item tree. Automatically
1075
-     * re-calculates the line item totals and updates the related transaction. But
1076
-     * DOES NOT automatically upgrade the transaction's registrations' final prices (which
1077
-     * should probably change because of this).
1078
-     * You should call EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
1079
-     * after using this, to keep the registration final prices in-sync with the transaction's total.
1080
-     *
1081
-     * @param EE_Line_Item      $total_line_item of type EEM_Line_Item::type_total
1082
-     * @param array|bool|string $line_item_codes
1083
-     * @return int number of items successfully removed
1084
-     * @throws EE_Error
1085
-     */
1086
-    public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = false)
1087
-    {
1088
-
1089
-        if ($total_line_item->type() !== EEM_Line_Item::type_total) {
1090
-            EE_Error::doing_it_wrong(
1091
-                'EEH_Line_Item::delete_items',
1092
-                esc_html__(
1093
-                    'This static method should only be called with a TOTAL line item, otherwise we won\'t recalculate the totals correctly',
1094
-                    'event_espresso'
1095
-                ),
1096
-                '4.6.18'
1097
-            );
1098
-        }
1099
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1100
-
1101
-        // check if only a single line_item_id was passed
1102
-        if (! empty($line_item_codes) && ! is_array($line_item_codes)) {
1103
-            // place single line_item_id in an array to appear as multiple line_item_ids
1104
-            $line_item_codes = array($line_item_codes);
1105
-        }
1106
-        $removals = 0;
1107
-        // cycle thru line_item_ids
1108
-        foreach ($line_item_codes as $line_item_id) {
1109
-            $removals += $total_line_item->delete_child_line_item($line_item_id);
1110
-        }
1111
-
1112
-        if ($removals > 0) {
1113
-            $total_line_item->recalculate_taxes_and_tax_total();
1114
-            return $removals;
1115
-        } else {
1116
-            return false;
1117
-        }
1118
-    }
1119
-
1120
-
1121
-    /**
1122
-     * Overwrites the previous tax by clearing out the old taxes, and creates a new
1123
-     * tax and updates the total line item accordingly
1124
-     *
1125
-     * @param EE_Line_Item $total_line_item
1126
-     * @param float        $amount
1127
-     * @param string       $name
1128
-     * @param string       $description
1129
-     * @param string       $code
1130
-     * @param boolean      $add_to_existing_line_item
1131
-     *                          if true, and a duplicate line item with the same code is found,
1132
-     *                          $amount will be added onto it; otherwise will simply set the taxes to match $amount
1133
-     * @return EE_Line_Item the new tax line item created
1134
-     * @throws EE_Error
1135
-     * @throws InvalidArgumentException
1136
-     * @throws InvalidDataTypeException
1137
-     * @throws InvalidInterfaceException
1138
-     * @throws ReflectionException
1139
-     */
1140
-    public static function set_total_tax_to(
1141
-        EE_Line_Item $total_line_item,
1142
-        $amount,
1143
-        $name = null,
1144
-        $description = null,
1145
-        $code = null,
1146
-        $add_to_existing_line_item = false
1147
-    ) {
1148
-        $tax_subtotal = self::get_taxes_subtotal($total_line_item);
1149
-        $taxable_total = $total_line_item->taxable_total();
1150
-
1151
-        if ($add_to_existing_line_item) {
1152
-            $new_tax = $tax_subtotal->get_child_line_item($code);
1153
-            EEM_Line_Item::instance()->delete(
1154
-                array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
1155
-            );
1156
-        } else {
1157
-            $new_tax = null;
1158
-            $tax_subtotal->delete_children_line_items();
1159
-        }
1160
-        if ($new_tax) {
1161
-            $new_tax->set_total($new_tax->total() + $amount);
1162
-            $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
1163
-        } else {
1164
-            // no existing tax item. Create it
1165
-            $new_tax = EE_Line_Item::new_instance(array(
1166
-                'TXN_ID'      => $total_line_item->TXN_ID(),
1167
-                'LIN_name'    => $name ? $name : esc_html__('Tax', 'event_espresso'),
1168
-                'LIN_desc'    => $description ? $description : '',
1169
-                'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
1170
-                'LIN_total'   => $amount,
1171
-                'LIN_parent'  => $tax_subtotal->ID(),
1172
-                'LIN_type'    => EEM_Line_Item::type_tax,
1173
-                'LIN_code'    => $code,
1174
-            ));
1175
-        }
1176
-
1177
-        $new_tax = apply_filters(
1178
-            'FHEE__EEH_Line_Item__set_total_tax_to__new_tax_subtotal',
1179
-            $new_tax,
1180
-            $total_line_item
1181
-        );
1182
-        $new_tax->save();
1183
-        $tax_subtotal->set_total($new_tax->total());
1184
-        $tax_subtotal->save();
1185
-        $total_line_item->recalculate_total_including_taxes();
1186
-        return $new_tax;
1187
-    }
1188
-
1189
-
1190
-    /**
1191
-     * Makes all the line items which are children of $line_item taxable (or not).
1192
-     * Does NOT save the line items
1193
-     *
1194
-     * @param EE_Line_Item $line_item
1195
-     * @param boolean      $taxable
1196
-     * @param string       $code_substring_for_whitelist if this string is part of the line item's code
1197
-     *                                                   it will be whitelisted (ie, except from becoming taxable)
1198
-     * @throws EE_Error
1199
-     */
1200
-    public static function set_line_items_taxable(
1201
-        EE_Line_Item $line_item,
1202
-        $taxable = true,
1203
-        $code_substring_for_whitelist = null
1204
-    ) {
1205
-        $whitelisted = false;
1206
-        if ($code_substring_for_whitelist !== null) {
1207
-            $whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false;
1208
-        }
1209
-        if (! $whitelisted && $line_item->is_line_item()) {
1210
-            $line_item->set_is_taxable($taxable);
1211
-        }
1212
-        foreach ($line_item->children() as $child_line_item) {
1213
-            EEH_Line_Item::set_line_items_taxable(
1214
-                $child_line_item,
1215
-                $taxable,
1216
-                $code_substring_for_whitelist
1217
-            );
1218
-        }
1219
-    }
1220
-
1221
-
1222
-    /**
1223
-     * Gets all descendants that are event subtotals
1224
-     *
1225
-     * @uses  EEH_Line_Item::get_subtotals_of_object_type()
1226
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1227
-     * @return EE_Line_Item[]
1228
-     * @throws EE_Error
1229
-     */
1230
-    public static function get_event_subtotals(EE_Line_Item $parent_line_item)
1231
-    {
1232
-        return self::get_subtotals_of_object_type($parent_line_item, EEM_Line_Item::OBJ_TYPE_EVENT);
1233
-    }
1234
-
1235
-
1236
-    /**
1237
-     * Gets all descendants subtotals that match the supplied object type
1238
-     *
1239
-     * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1240
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1241
-     * @param string       $obj_type
1242
-     * @return EE_Line_Item[]
1243
-     * @throws EE_Error
1244
-     */
1245
-    public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '')
1246
-    {
1247
-        return self::_get_descendants_by_type_and_object_type(
1248
-            $parent_line_item,
1249
-            EEM_Line_Item::type_sub_total,
1250
-            $obj_type
1251
-        );
1252
-    }
1253
-
1254
-
1255
-    /**
1256
-     * Gets all descendants that are tickets
1257
-     *
1258
-     * @uses  EEH_Line_Item::get_line_items_of_object_type()
1259
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1260
-     * @return EE_Line_Item[]
1261
-     * @throws EE_Error
1262
-     */
1263
-    public static function get_ticket_line_items(EE_Line_Item $parent_line_item)
1264
-    {
1265
-        return self::get_line_items_of_object_type(
1266
-            $parent_line_item,
1267
-            EEM_Line_Item::OBJ_TYPE_TICKET
1268
-        );
1269
-    }
1270
-
1271
-
1272
-    /**
1273
-     * Gets all descendants subtotals that match the supplied object type
1274
-     *
1275
-     * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1276
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1277
-     * @param string       $obj_type
1278
-     * @return EE_Line_Item[]
1279
-     * @throws EE_Error
1280
-     */
1281
-    public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '')
1282
-    {
1283
-        return self::_get_descendants_by_type_and_object_type(
1284
-            $parent_line_item,
1285
-            EEM_Line_Item::type_line_item,
1286
-            $obj_type
1287
-        );
1288
-    }
1289
-
1290
-
1291
-    /**
1292
-     * Gets all the descendants (ie, children or children of children etc) that are of the type 'tax'
1293
-     *
1294
-     * @uses  EEH_Line_Item::get_descendants_of_type()
1295
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1296
-     * @return EE_Line_Item[]
1297
-     * @throws EE_Error
1298
-     */
1299
-    public static function get_tax_descendants(EE_Line_Item $parent_line_item)
1300
-    {
1301
-        return EEH_Line_Item::get_descendants_of_type(
1302
-            $parent_line_item,
1303
-            EEM_Line_Item::type_tax
1304
-        );
1305
-    }
1306
-
1307
-
1308
-    /**
1309
-     * Gets all the real items purchased which are children of this item
1310
-     *
1311
-     * @uses  EEH_Line_Item::get_descendants_of_type()
1312
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1313
-     * @return EE_Line_Item[]
1314
-     * @throws EE_Error
1315
-     */
1316
-    public static function get_line_item_descendants(EE_Line_Item $parent_line_item)
1317
-    {
1318
-        return EEH_Line_Item::get_descendants_of_type(
1319
-            $parent_line_item,
1320
-            EEM_Line_Item::type_line_item
1321
-        );
1322
-    }
1323
-
1324
-
1325
-    /**
1326
-     * Gets all descendants of supplied line item that match the supplied line item type
1327
-     *
1328
-     * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1329
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1330
-     * @param string       $line_item_type   one of the EEM_Line_Item constants
1331
-     * @return EE_Line_Item[]
1332
-     * @throws EE_Error
1333
-     */
1334
-    public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type)
1335
-    {
1336
-        return self::_get_descendants_by_type_and_object_type(
1337
-            $parent_line_item,
1338
-            $line_item_type,
1339
-            null
1340
-        );
1341
-    }
1342
-
1343
-
1344
-    /**
1345
-     * Gets all descendants of supplied line item that match the supplied line item type and possibly the object type
1346
-     * as well
1347
-     *
1348
-     * @param EE_Line_Item  $parent_line_item - the line item to find descendants of
1349
-     * @param string        $line_item_type   one of the EEM_Line_Item constants
1350
-     * @param string | NULL $obj_type         object model class name (minus prefix) or NULL to ignore object type when
1351
-     *                                        searching
1352
-     * @return EE_Line_Item[]
1353
-     * @throws EE_Error
1354
-     */
1355
-    protected static function _get_descendants_by_type_and_object_type(
1356
-        EE_Line_Item $parent_line_item,
1357
-        $line_item_type,
1358
-        $obj_type = null
1359
-    ) {
1360
-        $objects = array();
1361
-        foreach ($parent_line_item->children() as $child_line_item) {
1362
-            if ($child_line_item instanceof EE_Line_Item) {
1363
-                if (
1364
-                    $child_line_item->type() === $line_item_type
1365
-                    && (
1366
-                        $child_line_item->OBJ_type() === $obj_type || $obj_type === null
1367
-                    )
1368
-                ) {
1369
-                    $objects[] = $child_line_item;
1370
-                } else {
1371
-                    // go-through-all-its children looking for more matches
1372
-                    $objects = array_merge(
1373
-                        $objects,
1374
-                        self::_get_descendants_by_type_and_object_type(
1375
-                            $child_line_item,
1376
-                            $line_item_type,
1377
-                            $obj_type
1378
-                        )
1379
-                    );
1380
-                }
1381
-            }
1382
-        }
1383
-        return $objects;
1384
-    }
1385
-
1386
-
1387
-    /**
1388
-     * Gets all descendants subtotals that match the supplied object type
1389
-     *
1390
-     * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1391
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1392
-     * @param string       $OBJ_type         object type (like Event)
1393
-     * @param array        $OBJ_IDs          array of OBJ_IDs
1394
-     * @return EE_Line_Item[]
1395
-     * @throws EE_Error
1396
-     */
1397
-    public static function get_line_items_by_object_type_and_IDs(
1398
-        EE_Line_Item $parent_line_item,
1399
-        $OBJ_type = '',
1400
-        $OBJ_IDs = array()
1401
-    ) {
1402
-        return self::_get_descendants_by_object_type_and_object_ID(
1403
-            $parent_line_item,
1404
-            $OBJ_type,
1405
-            $OBJ_IDs
1406
-        );
1407
-    }
1408
-
1409
-
1410
-    /**
1411
-     * Gets all descendants of supplied line item that match the supplied line item type and possibly the object type
1412
-     * as well
1413
-     *
1414
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1415
-     * @param string       $OBJ_type         object type (like Event)
1416
-     * @param array        $OBJ_IDs          array of OBJ_IDs
1417
-     * @return EE_Line_Item[]
1418
-     * @throws EE_Error
1419
-     */
1420
-    protected static function _get_descendants_by_object_type_and_object_ID(
1421
-        EE_Line_Item $parent_line_item,
1422
-        $OBJ_type,
1423
-        $OBJ_IDs
1424
-    ) {
1425
-        $objects = array();
1426
-        foreach ($parent_line_item->children() as $child_line_item) {
1427
-            if ($child_line_item instanceof EE_Line_Item) {
1428
-                if (
1429
-                    $child_line_item->OBJ_type() === $OBJ_type
1430
-                    && is_array($OBJ_IDs)
1431
-                    && in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1432
-                ) {
1433
-                    $objects[] = $child_line_item;
1434
-                } else {
1435
-                    // go-through-all-its children looking for more matches
1436
-                    $objects = array_merge(
1437
-                        $objects,
1438
-                        self::_get_descendants_by_object_type_and_object_ID(
1439
-                            $child_line_item,
1440
-                            $OBJ_type,
1441
-                            $OBJ_IDs
1442
-                        )
1443
-                    );
1444
-                }
1445
-            }
1446
-        }
1447
-        return $objects;
1448
-    }
1449
-
1450
-
1451
-    /**
1452
-     * Uses a breadth-first-search in order to find the nearest descendant of
1453
-     * the specified type and returns it, else NULL
1454
-     *
1455
-     * @uses  EEH_Line_Item::_get_nearest_descendant()
1456
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1457
-     * @param string       $type             like one of the EEM_Line_Item::type_*
1458
-     * @return EE_Line_Item
1459
-     * @throws EE_Error
1460
-     * @throws InvalidArgumentException
1461
-     * @throws InvalidDataTypeException
1462
-     * @throws InvalidInterfaceException
1463
-     * @throws ReflectionException
1464
-     */
1465
-    public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type)
1466
-    {
1467
-        return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1468
-    }
1469
-
1470
-
1471
-    /**
1472
-     * Uses a breadth-first-search in order to find the nearest descendant
1473
-     * having the specified LIN_code and returns it, else NULL
1474
-     *
1475
-     * @uses  EEH_Line_Item::_get_nearest_descendant()
1476
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1477
-     * @param string       $code             any value used for LIN_code
1478
-     * @return EE_Line_Item
1479
-     * @throws EE_Error
1480
-     * @throws InvalidArgumentException
1481
-     * @throws InvalidDataTypeException
1482
-     * @throws InvalidInterfaceException
1483
-     * @throws ReflectionException
1484
-     */
1485
-    public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code)
1486
-    {
1487
-        return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1488
-    }
1489
-
1490
-
1491
-    /**
1492
-     * Uses a breadth-first-search in order to find the nearest descendant
1493
-     * having the specified LIN_code and returns it, else NULL
1494
-     *
1495
-     * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1496
-     * @param string       $search_field     name of EE_Line_Item property
1497
-     * @param string       $value            any value stored in $search_field
1498
-     * @return EE_Line_Item
1499
-     * @throws EE_Error
1500
-     * @throws InvalidArgumentException
1501
-     * @throws InvalidDataTypeException
1502
-     * @throws InvalidInterfaceException
1503
-     * @throws ReflectionException
1504
-     */
1505
-    protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value)
1506
-    {
1507
-        foreach ($parent_line_item->children() as $child) {
1508
-            if ($child->get($search_field) == $value) {
1509
-                return $child;
1510
-            }
1511
-        }
1512
-        foreach ($parent_line_item->children() as $child) {
1513
-            $descendant_found = self::_get_nearest_descendant(
1514
-                $child,
1515
-                $search_field,
1516
-                $value
1517
-            );
1518
-            if ($descendant_found) {
1519
-                return $descendant_found;
1520
-            }
1521
-        }
1522
-        return null;
1523
-    }
1524
-
1525
-
1526
-    /**
1527
-     * if passed line item has a TXN ID, uses that to jump directly to the grand total line item for the transaction,
1528
-     * else recursively walks up the line item tree until a parent of type total is found,
1529
-     *
1530
-     * @param EE_Line_Item $line_item
1531
-     * @return EE_Line_Item
1532
-     * @throws EE_Error
1533
-     */
1534
-    public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item)
1535
-    {
1536
-        if ($line_item->TXN_ID()) {
1537
-            $total_line_item = $line_item->transaction()->total_line_item(false);
1538
-            if ($total_line_item instanceof EE_Line_Item) {
1539
-                return $total_line_item;
1540
-            }
1541
-        } else {
1542
-            $line_item_parent = $line_item->parent();
1543
-            if ($line_item_parent instanceof EE_Line_Item) {
1544
-                if ($line_item_parent->is_total()) {
1545
-                    return $line_item_parent;
1546
-                }
1547
-                return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1548
-            }
1549
-        }
1550
-        throw new EE_Error(
1551
-            sprintf(
1552
-                esc_html__(
1553
-                    'A valid grand total for line item %1$d was not found.',
1554
-                    'event_espresso'
1555
-                ),
1556
-                $line_item->ID()
1557
-            )
1558
-        );
1559
-    }
1560
-
1561
-
1562
-    /**
1563
-     * Prints out a representation of the line item tree
1564
-     *
1565
-     * @param EE_Line_Item $line_item
1566
-     * @param int          $indentation
1567
-     * @return void
1568
-     * @throws EE_Error
1569
-     */
1570
-    public static function visualize(EE_Line_Item $line_item, $indentation = 0)
1571
-    {
1572
-        echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1573
-        if (! $indentation) {
1574
-            echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1575
-        }
1576
-        for ($i = 0; $i < $indentation; $i++) {
1577
-            echo '. ';
1578
-        }
1579
-        $breakdown = '';
1580
-        if ($line_item->is_line_item()) {
1581
-            if ($line_item->is_percent()) {
1582
-                $breakdown = "{$line_item->percent()}%";
1583
-            } else {
1584
-                $breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1585
-            }
1586
-        }
1587
-        echo $line_item->name();
1588
-        echo " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ";
1589
-        echo '$' . (string) $line_item->total();
1590
-        if ($breakdown) {
1591
-            echo " ( {$breakdown} )";
1592
-        }
1593
-        if ($line_item->is_taxable()) {
1594
-            echo '  * taxable';
1595
-        }
1596
-        if ($line_item->children()) {
1597
-            foreach ($line_item->children() as $child) {
1598
-                self::visualize($child, $indentation + 1);
1599
-            }
1600
-        }
1601
-    }
1602
-
1603
-
1604
-    /**
1605
-     * Calculates the registration's final price, taking into account that they
1606
-     * need to not only help pay for their OWN ticket, but also any transaction-wide surcharges and taxes,
1607
-     * and receive a portion of any transaction-wide discounts.
1608
-     * eg1, if I buy a $1 ticket and brent buys a $9 ticket, and we receive a $5 discount
1609
-     * then I'll get 1/10 of that $5 discount, which is $0.50, and brent will get
1610
-     * 9/10ths of that $5 discount, which is $4.50. So my final price should be $0.50
1611
-     * and brent's final price should be $5.50.
1612
-     * In order to do this, we basically need to traverse the line item tree calculating
1613
-     * the running totals (just as if we were recalculating the total), but when we identify
1614
-     * regular line items, we need to keep track of their share of the grand total.
1615
-     * Also, we need to keep track of the TAXABLE total for each ticket purchase, so
1616
-     * we can know how to apply taxes to it. (Note: "taxable total" does not equal the "pretax total"
1617
-     * when there are non-taxable items; otherwise they would be the same)
1618
-     *
1619
-     * @param EE_Line_Item $line_item
1620
-     * @param array        $billable_ticket_quantities  array of EE_Ticket IDs and their corresponding quantity that
1621
-     *                                                  can be included in price calculations at this moment
1622
-     * @return array        keys are line items for tickets IDs and values are their share of the running total,
1623
-     *                                                  plus the key 'total', and 'taxable' which also has keys of all
1624
-     *                                                  the ticket IDs.
1625
-     *                                                  Eg array(
1626
-     *                                                      12 => 4.3
1627
-     *                                                      23 => 8.0
1628
-     *                                                      'total' => 16.6,
1629
-     *                                                      'taxable' => array(
1630
-     *                                                          12 => 10,
1631
-     *                                                          23 => 4
1632
-     *                                                      ).
1633
-     *                                                  So to find which registrations have which final price, we need
1634
-     *                                                  to find which line item is theirs, which can be done with
1635
-     *                                                  `EEM_Line_Item::instance()->get_line_item_for_registration(
1636
-     *                                                  $registration );`
1637
-     * @throws EE_Error
1638
-     * @throws InvalidArgumentException
1639
-     * @throws InvalidDataTypeException
1640
-     * @throws InvalidInterfaceException
1641
-     * @throws ReflectionException
1642
-     */
1643
-    public static function calculate_reg_final_prices_per_line_item(
1644
-        EE_Line_Item $line_item,
1645
-        $billable_ticket_quantities = array()
1646
-    ) {
1647
-        $running_totals = [
1648
-            'total'   => 0,
1649
-            'taxable' => ['total' => 0]
1650
-        ];
1651
-        foreach ($line_item->children() as $child_line_item) {
1652
-            switch ($child_line_item->type()) {
1653
-                case EEM_Line_Item::type_sub_total:
1654
-                    $running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1655
-                        $child_line_item,
1656
-                        $billable_ticket_quantities
1657
-                    );
1658
-                    // combine arrays but preserve numeric keys
1659
-                    $running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1660
-                    $running_totals['total'] += $running_totals_from_subtotal['total'];
1661
-                    $running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1662
-                    break;
1663
-
1664
-                case EEM_Line_Item::type_tax_sub_total:
1665
-                    // find how much the taxes percentage is
1666
-                    if ($child_line_item->percent() !== 0) {
1667
-                        $tax_percent_decimal = $child_line_item->percent() / 100;
1668
-                    } else {
1669
-                        $tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1670
-                    }
1671
-                    // and apply to all the taxable totals, and add to the pretax totals
1672
-                    foreach ($running_totals as $line_item_id => $this_running_total) {
1673
-                        // "total" and "taxable" array key is an exception
1674
-                        if ($line_item_id === 'taxable') {
1675
-                            continue;
1676
-                        }
1677
-                        $taxable_total = $running_totals['taxable'][ $line_item_id ];
1678
-                        $running_totals[ $line_item_id ] += ($taxable_total * $tax_percent_decimal);
1679
-                    }
1680
-                    break;
1681
-
1682
-                case EEM_Line_Item::type_line_item:
1683
-                    // ticket line items or ????
1684
-                    if ($child_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET) {
1685
-                        // kk it's a ticket
1686
-                        if (isset($running_totals[ $child_line_item->ID() ])) {
1687
-                            // huh? that shouldn't happen.
1688
-                            $running_totals['total'] += $child_line_item->total();
1689
-                        } else {
1690
-                            // its not in our running totals yet. great.
1691
-                            if ($child_line_item->is_taxable()) {
1692
-                                $taxable_amount = $child_line_item->unit_price();
1693
-                            } else {
1694
-                                $taxable_amount = 0;
1695
-                            }
1696
-                            // are we only calculating totals for some tickets?
1697
-                            if (isset($billable_ticket_quantities[ $child_line_item->OBJ_ID() ])) {
1698
-                                $quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1699
-                                $running_totals[ $child_line_item->ID() ] = $quantity
1700
-                                    ? $child_line_item->unit_price()
1701
-                                    : 0;
1702
-                                $running_totals['taxable'][ $child_line_item->ID() ] = $quantity
1703
-                                    ? $taxable_amount
1704
-                                    : 0;
1705
-                            } else {
1706
-                                $quantity = $child_line_item->quantity();
1707
-                                $running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1708
-                                $running_totals['taxable'][ $child_line_item->ID() ] = $taxable_amount;
1709
-                            }
1710
-                            $running_totals['taxable']['total'] += $taxable_amount * $quantity;
1711
-                            $running_totals['total'] += $child_line_item->unit_price() * $quantity;
1712
-                        }
1713
-                    } else {
1714
-                        // it's some other type of item added to the cart
1715
-                        // it should affect the running totals
1716
-                        // basically we want to convert it into a PERCENT modifier. Because
1717
-                        // more clearly affect all registration's final price equally
1718
-                        $line_items_percent_of_running_total = $running_totals['total'] > 0
1719
-                            ? ($child_line_item->total() / $running_totals['total']) + 1
1720
-                            : 1;
1721
-                        foreach ($running_totals as $line_item_id => $this_running_total) {
1722
-                            // the "taxable" array key is an exception
1723
-                            if ($line_item_id === 'taxable') {
1724
-                                continue;
1725
-                            }
1726
-                            // update the running totals
1727
-                            // yes this actually even works for the running grand total!
1728
-                            $running_totals[ $line_item_id ] =
1729
-                                $line_items_percent_of_running_total * $this_running_total;
1730
-
1731
-                            if ($child_line_item->is_taxable()) {
1732
-                                $running_totals['taxable'][ $line_item_id ] =
1733
-                                    $line_items_percent_of_running_total * $running_totals['taxable'][ $line_item_id ];
1734
-                            }
1735
-                        }
1736
-                    }
1737
-                    break;
1738
-            }
1739
-        }
1740
-        return $running_totals;
1741
-    }
1742
-
1743
-
1744
-    /**
1745
-     * @param EE_Line_Item $total_line_item
1746
-     * @param EE_Line_Item $ticket_line_item
1747
-     * @return float | null
1748
-     * @throws EE_Error
1749
-     * @throws InvalidArgumentException
1750
-     * @throws InvalidDataTypeException
1751
-     * @throws InvalidInterfaceException
1752
-     * @throws OutOfRangeException
1753
-     * @throws ReflectionException
1754
-     */
1755
-    public static function calculate_final_price_for_ticket_line_item(
1756
-        EE_Line_Item $total_line_item,
1757
-        EE_Line_Item $ticket_line_item
1758
-    ) {
1759
-        static $final_prices_per_ticket_line_item = array();
1760
-        if (empty($final_prices_per_ticket_line_item) || empty($final_prices_per_ticket_line_item[ $total_line_item->ID() ])) {
1761
-            $final_prices_per_ticket_line_item[ $total_line_item->ID() ] = EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1762
-                $total_line_item
1763
-            );
1764
-        }
1765
-        // ok now find this new registration's final price
1766
-        if (isset($final_prices_per_ticket_line_item[ $total_line_item->ID() ][ $ticket_line_item->ID() ])) {
1767
-            return $final_prices_per_ticket_line_item[ $total_line_item->ID() ][ $ticket_line_item->ID() ];
1768
-        }
1769
-        $message = sprintf(
1770
-            esc_html__(
1771
-                'The final price for the ticket line item (ID:%1$d) could not be calculated.',
1772
-                'event_espresso'
1773
-            ),
1774
-            $ticket_line_item->ID()
1775
-        );
1776
-        if (WP_DEBUG) {
1777
-            $message .= '<br>' . print_r($final_prices_per_ticket_line_item, true);
1778
-            throw new OutOfRangeException($message);
1779
-        }
1780
-        EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1781
-        return null;
1782
-    }
1783
-
1784
-
1785
-    /**
1786
-     * Creates a duplicate of the line item tree, except only includes billable items
1787
-     * and the portion of line items attributed to billable things
1788
-     *
1789
-     * @param EE_Line_Item      $line_item
1790
-     * @param EE_Registration[] $registrations
1791
-     * @return EE_Line_Item
1792
-     * @throws EE_Error
1793
-     * @throws InvalidArgumentException
1794
-     * @throws InvalidDataTypeException
1795
-     * @throws InvalidInterfaceException
1796
-     * @throws ReflectionException
1797
-     */
1798
-    public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations)
1799
-    {
1800
-        $copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1801
-        foreach ($line_item->children() as $child_li) {
1802
-            $copy_li->add_child_line_item(
1803
-                EEH_Line_Item::billable_line_item_tree($child_li, $registrations)
1804
-            );
1805
-        }
1806
-        // if this is the grand total line item, make sure the totals all add up
1807
-        // (we could have duplicated this logic AS we copied the line items, but
1808
-        // it seems DRYer this way)
1809
-        if ($copy_li->type() === EEM_Line_Item::type_total) {
1810
-            $copy_li->recalculate_total_including_taxes();
1811
-        }
1812
-        return $copy_li;
1813
-    }
1814
-
1815
-
1816
-    /**
1817
-     * Creates a new, unsaved line item from $line_item that factors in the
1818
-     * number of billable registrations on $registrations.
1819
-     *
1820
-     * @param EE_Line_Item      $line_item
1821
-     * @param EE_Registration[] $registrations
1822
-     * @return EE_Line_Item
1823
-     * @throws EE_Error
1824
-     * @throws InvalidArgumentException
1825
-     * @throws InvalidDataTypeException
1826
-     * @throws InvalidInterfaceException
1827
-     * @throws ReflectionException
1828
-     */
1829
-    public static function billable_line_item(EE_Line_Item $line_item, $registrations)
1830
-    {
1831
-        $new_li_fields = $line_item->model_field_array();
1832
-        if (
1833
-            $line_item->type() === EEM_Line_Item::type_line_item &&
1834
-            $line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1835
-        ) {
1836
-            $count = 0;
1837
-            foreach ($registrations as $registration) {
1838
-                if (
1839
-                    $line_item->OBJ_ID() === $registration->ticket_ID() &&
1840
-                    in_array(
1841
-                        $registration->status_ID(),
1842
-                        EEM_Registration::reg_statuses_that_allow_payment(),
1843
-                        true
1844
-                    )
1845
-                ) {
1846
-                    $count++;
1847
-                }
1848
-            }
1849
-            $new_li_fields['LIN_quantity'] = $count;
1850
-        }
1851
-        // don't set the total. We'll leave that up to the code that calculates it
1852
-        unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1853
-        return EE_Line_Item::new_instance($new_li_fields);
1854
-    }
1855
-
1856
-
1857
-    /**
1858
-     * Returns a modified line item tree where all the subtotals which have a total of 0
1859
-     * are removed, and line items with a quantity of 0
1860
-     *
1861
-     * @param EE_Line_Item $line_item |null
1862
-     * @return EE_Line_Item|null
1863
-     * @throws EE_Error
1864
-     * @throws InvalidArgumentException
1865
-     * @throws InvalidDataTypeException
1866
-     * @throws InvalidInterfaceException
1867
-     * @throws ReflectionException
1868
-     */
1869
-    public static function non_empty_line_items(EE_Line_Item $line_item)
1870
-    {
1871
-        $copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1872
-        if ($copied_li === null) {
1873
-            return null;
1874
-        }
1875
-        // if this is an event subtotal, we want to only include it if it
1876
-        // has a non-zero total and at least one ticket line item child
1877
-        $ticket_children = 0;
1878
-        foreach ($line_item->children() as $child_li) {
1879
-            $child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1880
-            if ($child_li_copy !== null) {
1881
-                $copied_li->add_child_line_item($child_li_copy);
1882
-                if (
1883
-                    $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1884
-                    $child_li_copy->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1885
-                ) {
1886
-                    $ticket_children++;
1887
-                }
1888
-            }
1889
-        }
1890
-        // if this is an event subtotal with NO ticket children
1891
-        // we basically want to ignore it
1892
-        if (
1893
-            $ticket_children === 0
1894
-            && $line_item->type() === EEM_Line_Item::type_sub_total
1895
-            && $line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
1896
-            && $line_item->total() === 0
1897
-        ) {
1898
-            return null;
1899
-        }
1900
-        return $copied_li;
1901
-    }
1902
-
1903
-
1904
-    /**
1905
-     * Creates a new, unsaved line item, but if it's a ticket line item
1906
-     * with a total of 0, or a subtotal of 0, returns null instead
1907
-     *
1908
-     * @param EE_Line_Item $line_item
1909
-     * @return EE_Line_Item
1910
-     * @throws EE_Error
1911
-     * @throws InvalidArgumentException
1912
-     * @throws InvalidDataTypeException
1913
-     * @throws InvalidInterfaceException
1914
-     * @throws ReflectionException
1915
-     */
1916
-    public static function non_empty_line_item(EE_Line_Item $line_item)
1917
-    {
1918
-        if (
1919
-            $line_item->type() === EEM_Line_Item::type_line_item
1920
-            && $line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1921
-            && $line_item->quantity() === 0
1922
-        ) {
1923
-            return null;
1924
-        }
1925
-        $new_li_fields = $line_item->model_field_array();
1926
-        // don't set the total. We'll leave that up to the code that calculates it
1927
-        unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1928
-        return EE_Line_Item::new_instance($new_li_fields);
1929
-    }
1930
-
1931
-
1932
-    /**
1933
-     * Cycles through all of the ticket line items for the supplied total line item
1934
-     * and ensures that the line item's "is_taxable" field matches that of its corresponding ticket
1935
-     *
1936
-     * @param EE_Line_Item $total_line_item
1937
-     * @since 4.9.79.p
1938
-     * @throws EE_Error
1939
-     * @throws InvalidArgumentException
1940
-     * @throws InvalidDataTypeException
1941
-     * @throws InvalidInterfaceException
1942
-     * @throws ReflectionException
1943
-     */
1944
-    public static function resetIsTaxableForTickets(EE_Line_Item $total_line_item)
1945
-    {
1946
-        $ticket_line_items = self::get_ticket_line_items($total_line_item);
1947
-        foreach ($ticket_line_items as $ticket_line_item) {
1948
-            if (
1949
-                $ticket_line_item instanceof EE_Line_Item
1950
-                && $ticket_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1951
-            ) {
1952
-                $ticket = $ticket_line_item->ticket();
1953
-                if ($ticket instanceof EE_Ticket && $ticket->taxable() !== $ticket_line_item->is_taxable()) {
1954
-                    $ticket_line_item->set_is_taxable($ticket->taxable());
1955
-                    $ticket_line_item->save();
1956
-                }
1957
-            }
1958
-        }
1959
-    }
1960
-
1961
-
1962
-
1963
-    /**************************************** @DEPRECATED METHODS *************************************** */
1964
-    /**
1965
-     * @deprecated
1966
-     * @param EE_Line_Item $total_line_item
1967
-     * @return EE_Line_Item
1968
-     * @throws EE_Error
1969
-     * @throws InvalidArgumentException
1970
-     * @throws InvalidDataTypeException
1971
-     * @throws InvalidInterfaceException
1972
-     * @throws ReflectionException
1973
-     */
1974
-    public static function get_items_subtotal(EE_Line_Item $total_line_item)
1975
-    {
1976
-        EE_Error::doing_it_wrong(
1977
-            'EEH_Line_Item::get_items_subtotal()',
1978
-            sprintf(
1979
-                esc_html__('Method replaced with %1$s', 'event_espresso'),
1980
-                'EEH_Line_Item::get_pre_tax_subtotal()'
1981
-            ),
1982
-            '4.6.0'
1983
-        );
1984
-        return self::get_pre_tax_subtotal($total_line_item);
1985
-    }
1986
-
1987
-
1988
-    /**
1989
-     * @deprecated
1990
-     * @param EE_Transaction $transaction
1991
-     * @return EE_Line_Item
1992
-     * @throws EE_Error
1993
-     * @throws InvalidArgumentException
1994
-     * @throws InvalidDataTypeException
1995
-     * @throws InvalidInterfaceException
1996
-     * @throws ReflectionException
1997
-     */
1998
-    public static function create_default_total_line_item($transaction = null)
1999
-    {
2000
-        EE_Error::doing_it_wrong(
2001
-            'EEH_Line_Item::create_default_total_line_item()',
2002
-            sprintf(
2003
-                esc_html__('Method replaced with %1$s', 'event_espresso'),
2004
-                'EEH_Line_Item::create_total_line_item()'
2005
-            ),
2006
-            '4.6.0'
2007
-        );
2008
-        return self::create_total_line_item($transaction);
2009
-    }
2010
-
2011
-
2012
-    /**
2013
-     * @deprecated
2014
-     * @param EE_Line_Item   $total_line_item
2015
-     * @param EE_Transaction $transaction
2016
-     * @return EE_Line_Item
2017
-     * @throws EE_Error
2018
-     * @throws InvalidArgumentException
2019
-     * @throws InvalidDataTypeException
2020
-     * @throws InvalidInterfaceException
2021
-     * @throws ReflectionException
2022
-     */
2023
-    public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = null)
2024
-    {
2025
-        EE_Error::doing_it_wrong(
2026
-            'EEH_Line_Item::create_default_tickets_subtotal()',
2027
-            sprintf(
2028
-                esc_html__('Method replaced with %1$s', 'event_espresso'),
2029
-                'EEH_Line_Item::create_pre_tax_subtotal()'
2030
-            ),
2031
-            '4.6.0'
2032
-        );
2033
-        return self::create_pre_tax_subtotal($total_line_item, $transaction);
2034
-    }
2035
-
2036
-
2037
-    /**
2038
-     * @deprecated
2039
-     * @param EE_Line_Item   $total_line_item
2040
-     * @param EE_Transaction $transaction
2041
-     * @return EE_Line_Item
2042
-     * @throws EE_Error
2043
-     * @throws InvalidArgumentException
2044
-     * @throws InvalidDataTypeException
2045
-     * @throws InvalidInterfaceException
2046
-     * @throws ReflectionException
2047
-     */
2048
-    public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = null)
2049
-    {
2050
-        EE_Error::doing_it_wrong(
2051
-            'EEH_Line_Item::create_default_taxes_subtotal()',
2052
-            sprintf(
2053
-                esc_html__('Method replaced with %1$s', 'event_espresso'),
2054
-                'EEH_Line_Item::create_taxes_subtotal()'
2055
-            ),
2056
-            '4.6.0'
2057
-        );
2058
-        return self::create_taxes_subtotal($total_line_item, $transaction);
2059
-    }
2060
-
2061
-
2062
-    /**
2063
-     * @deprecated
2064
-     * @param EE_Line_Item   $total_line_item
2065
-     * @param EE_Transaction $transaction
2066
-     * @return EE_Line_Item
2067
-     * @throws EE_Error
2068
-     * @throws InvalidArgumentException
2069
-     * @throws InvalidDataTypeException
2070
-     * @throws InvalidInterfaceException
2071
-     * @throws ReflectionException
2072
-     */
2073
-    public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = null)
2074
-    {
2075
-        EE_Error::doing_it_wrong(
2076
-            'EEH_Line_Item::create_default_event_subtotal()',
2077
-            sprintf(
2078
-                esc_html__('Method replaced with %1$s', 'event_espresso'),
2079
-                'EEH_Line_Item::create_event_subtotal()'
2080
-            ),
2081
-            '4.6.0'
2082
-        );
2083
-        return self::create_event_subtotal($total_line_item, $transaction);
2084
-    }
25
+	/**
26
+	 * Adds a simple item (unrelated to any other model object) to the provided PARENT line item.
27
+	 * Does NOT automatically re-calculate the line item totals or update the related transaction.
28
+	 * You should call recalculate_total_including_taxes() on the grant total line item after this
29
+	 * to update the subtotals, and EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
30
+	 * to keep the registration final prices in-sync with the transaction's total.
31
+	 *
32
+	 * @param EE_Line_Item $parent_line_item
33
+	 * @param string       $name
34
+	 * @param float        $unit_price
35
+	 * @param string       $description
36
+	 * @param int          $quantity
37
+	 * @param boolean      $taxable
38
+	 * @param boolean      $code if set to a value, ensures there is only one line item with that code
39
+	 * @return boolean success
40
+	 * @throws EE_Error
41
+	 * @throws InvalidArgumentException
42
+	 * @throws InvalidDataTypeException
43
+	 * @throws InvalidInterfaceException
44
+	 * @throws ReflectionException
45
+	 */
46
+	public static function add_unrelated_item(
47
+		EE_Line_Item $parent_line_item,
48
+		$name,
49
+		$unit_price,
50
+		$description = '',
51
+		$quantity = 1,
52
+		$taxable = false,
53
+		$code = null
54
+	) {
55
+		$items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
56
+		$line_item = EE_Line_Item::new_instance(array(
57
+			'LIN_name'       => $name,
58
+			'LIN_desc'       => $description,
59
+			'LIN_unit_price' => $unit_price,
60
+			'LIN_quantity'   => $quantity,
61
+			'LIN_percent'    => null,
62
+			'LIN_is_taxable' => $taxable,
63
+			'LIN_order'      => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
64
+			'LIN_total'      => (float) $unit_price * (int) $quantity,
65
+			'LIN_type'       => EEM_Line_Item::type_line_item,
66
+			'LIN_code'       => $code,
67
+		));
68
+		$line_item = apply_filters(
69
+			'FHEE__EEH_Line_Item__add_unrelated_item__line_item',
70
+			$line_item,
71
+			$parent_line_item
72
+		);
73
+		return self::add_item($parent_line_item, $line_item);
74
+	}
75
+
76
+
77
+	/**
78
+	 * Adds a simple item ( unrelated to any other model object) to the total line item,
79
+	 * in the correct spot in the line item tree. Does not automatically
80
+	 * re-calculate the line item totals, nor update the related transaction, nor upgrade the transaction's
81
+	 * registrations' final prices (which should probably change because of this).
82
+	 * You should call recalculate_total_including_taxes() on the grand total line item, then
83
+	 * update the transaction's total, and EE_Registration_Processor::update_registration_final_prices()
84
+	 * after using this, to keep the registration final prices in-sync with the transaction's total.
85
+	 *
86
+	 * @param EE_Line_Item $parent_line_item
87
+	 * @param string       $name
88
+	 * @param float        $percentage_amount
89
+	 * @param string       $description
90
+	 * @param boolean      $taxable
91
+	 * @return boolean success
92
+	 * @throws EE_Error
93
+	 */
94
+	public static function add_percentage_based_item(
95
+		EE_Line_Item $parent_line_item,
96
+		$name,
97
+		$percentage_amount,
98
+		$description = '',
99
+		$taxable = false
100
+	) {
101
+		$line_item = EE_Line_Item::new_instance(array(
102
+			'LIN_name'       => $name,
103
+			'LIN_desc'       => $description,
104
+			'LIN_unit_price' => 0,
105
+			'LIN_percent'    => $percentage_amount,
106
+			'LIN_quantity'   => 1,
107
+			'LIN_is_taxable' => $taxable,
108
+			'LIN_total'      => (float) ($percentage_amount * ($parent_line_item->total() / 100)),
109
+			'LIN_type'       => EEM_Line_Item::type_line_item,
110
+			'LIN_parent'     => $parent_line_item->ID(),
111
+		));
112
+		$line_item = apply_filters(
113
+			'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
114
+			$line_item
115
+		);
116
+		return $parent_line_item->add_child_line_item($line_item, false);
117
+	}
118
+
119
+
120
+	/**
121
+	 * Returns the new line item created by adding a purchase of the ticket
122
+	 * ensures that ticket line item is saved, and that cart total has been recalculated.
123
+	 * If this ticket has already been purchased, just increments its count.
124
+	 * Automatically re-calculates the line item totals and updates the related transaction. But
125
+	 * DOES NOT automatically upgrade the transaction's registrations' final prices (which
126
+	 * should probably change because of this).
127
+	 * You should call EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
128
+	 * after using this, to keep the registration final prices in-sync with the transaction's total.
129
+	 *
130
+	 * @param EE_Line_Item $total_line_item grand total line item of type EEM_Line_Item::type_total
131
+	 * @param EE_Ticket    $ticket
132
+	 * @param int          $qty
133
+	 * @return EE_Line_Item
134
+	 * @throws EE_Error
135
+	 * @throws InvalidArgumentException
136
+	 * @throws InvalidDataTypeException
137
+	 * @throws InvalidInterfaceException
138
+	 * @throws ReflectionException
139
+	 */
140
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1)
141
+	{
142
+		if (! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
143
+			throw new EE_Error(
144
+				sprintf(
145
+					esc_html__(
146
+						'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.',
147
+						'event_espresso'
148
+					),
149
+					$ticket->ID(),
150
+					$total_line_item->ID()
151
+				)
152
+			);
153
+		}
154
+		// either increment the qty for an existing ticket
155
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
156
+		// or add a new one
157
+		if (! $line_item instanceof EE_Line_Item) {
158
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
159
+		}
160
+		$total_line_item->recalculate_total_including_taxes();
161
+		return $line_item;
162
+	}
163
+
164
+
165
+	/**
166
+	 * Returns the new line item created by adding a purchase of the ticket
167
+	 *
168
+	 * @param EE_Line_Item $total_line_item
169
+	 * @param EE_Ticket    $ticket
170
+	 * @param int          $qty
171
+	 * @return EE_Line_Item
172
+	 * @throws EE_Error
173
+	 * @throws InvalidArgumentException
174
+	 * @throws InvalidDataTypeException
175
+	 * @throws InvalidInterfaceException
176
+	 * @throws ReflectionException
177
+	 */
178
+	public static function increment_ticket_qty_if_already_in_cart(
179
+		EE_Line_Item $total_line_item,
180
+		EE_Ticket $ticket,
181
+		$qty = 1
182
+	) {
183
+		$line_item = null;
184
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
185
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
186
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
187
+				if (
188
+					$ticket_line_item instanceof EE_Line_Item
189
+					&& (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
190
+				) {
191
+					$line_item = $ticket_line_item;
192
+					break;
193
+				}
194
+			}
195
+		}
196
+		if ($line_item instanceof EE_Line_Item) {
197
+			EEH_Line_Item::increment_quantity($line_item, $qty);
198
+			return $line_item;
199
+		}
200
+		return null;
201
+	}
202
+
203
+
204
+	/**
205
+	 * Increments the line item and all its children's quantity by $qty (but percent line items are unaffected).
206
+	 * Does NOT save or recalculate other line items totals
207
+	 *
208
+	 * @param EE_Line_Item $line_item
209
+	 * @param int          $qty
210
+	 * @return void
211
+	 * @throws EE_Error
212
+	 * @throws InvalidArgumentException
213
+	 * @throws InvalidDataTypeException
214
+	 * @throws InvalidInterfaceException
215
+	 * @throws ReflectionException
216
+	 */
217
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1)
218
+	{
219
+		if (! $line_item->is_percent()) {
220
+			$qty += $line_item->quantity();
221
+			$line_item->set_quantity($qty);
222
+			$line_item->set_total($line_item->unit_price() * $qty);
223
+			$line_item->save();
224
+		}
225
+		foreach ($line_item->children() as $child) {
226
+			if ($child->is_sub_line_item()) {
227
+				EEH_Line_Item::update_quantity($child, $qty);
228
+			}
229
+		}
230
+	}
231
+
232
+
233
+	/**
234
+	 * Decrements the line item and all its children's quantity by $qty (but percent line items are unaffected).
235
+	 * Does NOT save or recalculate other line items totals
236
+	 *
237
+	 * @param EE_Line_Item $line_item
238
+	 * @param int          $qty
239
+	 * @return void
240
+	 * @throws EE_Error
241
+	 * @throws InvalidArgumentException
242
+	 * @throws InvalidDataTypeException
243
+	 * @throws InvalidInterfaceException
244
+	 * @throws ReflectionException
245
+	 */
246
+	public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1)
247
+	{
248
+		if (! $line_item->is_percent()) {
249
+			$qty = $line_item->quantity() - $qty;
250
+			$qty = max($qty, 0);
251
+			$line_item->set_quantity($qty);
252
+			$line_item->set_total($line_item->unit_price() * $qty);
253
+			$line_item->save();
254
+		}
255
+		foreach ($line_item->children() as $child) {
256
+			if ($child->is_sub_line_item()) {
257
+				EEH_Line_Item::update_quantity($child, $qty);
258
+			}
259
+		}
260
+	}
261
+
262
+
263
+	/**
264
+	 * Updates the line item and its children's quantities to the specified number.
265
+	 * Does NOT save them or recalculate totals.
266
+	 *
267
+	 * @param EE_Line_Item $line_item
268
+	 * @param int          $new_quantity
269
+	 * @throws EE_Error
270
+	 * @throws InvalidArgumentException
271
+	 * @throws InvalidDataTypeException
272
+	 * @throws InvalidInterfaceException
273
+	 * @throws ReflectionException
274
+	 */
275
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity)
276
+	{
277
+		if (! $line_item->is_percent()) {
278
+			$line_item->set_quantity($new_quantity);
279
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
280
+			$line_item->save();
281
+		}
282
+		foreach ($line_item->children() as $child) {
283
+			if ($child->is_sub_line_item()) {
284
+				EEH_Line_Item::update_quantity($child, $new_quantity);
285
+			}
286
+		}
287
+	}
288
+
289
+
290
+	/**
291
+	 * Returns the new line item created by adding a purchase of the ticket
292
+	 *
293
+	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
294
+	 * @param EE_Ticket    $ticket
295
+	 * @param int          $qty
296
+	 * @return EE_Line_Item
297
+	 * @throws EE_Error
298
+	 * @throws InvalidArgumentException
299
+	 * @throws InvalidDataTypeException
300
+	 * @throws InvalidInterfaceException
301
+	 * @throws ReflectionException
302
+	 */
303
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1)
304
+	{
305
+		$datetimes = $ticket->datetimes();
306
+		$first_datetime = reset($datetimes);
307
+		$first_datetime_name = esc_html__('Event', 'event_espresso');
308
+		if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
309
+			$first_datetime_name = $first_datetime->event()->name();
310
+		}
311
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
312
+		// get event subtotal line
313
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
314
+		$taxes = $ticket->tax_price_modifiers();
315
+		$is_taxable = empty($taxes) ? $ticket->taxable() : false;
316
+		// add $ticket to cart
317
+		$line_item = EE_Line_Item::new_instance(array(
318
+			'LIN_name'       => $ticket->name(),
319
+			'LIN_desc'       => $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
320
+			'LIN_unit_price' => $ticket->price(),
321
+			'LIN_quantity'   => $qty,
322
+			'LIN_is_taxable' => $is_taxable,
323
+			'LIN_order'      => count($events_sub_total->children()),
324
+			'LIN_total'      => $ticket->price() * $qty,
325
+			'LIN_type'       => EEM_Line_Item::type_line_item,
326
+			'OBJ_ID'         => $ticket->ID(),
327
+			'OBJ_type'       => EEM_Line_Item::OBJ_TYPE_TICKET,
328
+		));
329
+		$line_item = apply_filters(
330
+			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
331
+			$line_item
332
+		);
333
+		$events_sub_total->add_child_line_item($line_item);
334
+		// now add the sub-line items
335
+		$running_total_for_ticket = 0;
336
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
337
+			$sign = $price->is_discount() ? -1 : 1;
338
+			$price_total = $price->is_percent()
339
+				? $running_total_for_ticket * $price->amount() / 100
340
+				: $price->amount() * $qty;
341
+			$sub_line_item = EE_Line_Item::new_instance(array(
342
+				'LIN_name'       => $price->name(),
343
+				'LIN_desc'       => $price->desc(),
344
+				'LIN_quantity'   => $price->is_percent() ? null : $qty,
345
+				'LIN_is_taxable' => false,
346
+				'LIN_order'      => $price->order(),
347
+				'LIN_total'      => $sign * $price_total,
348
+				'LIN_type'       => EEM_Line_Item::type_sub_line_item,
349
+				'OBJ_ID'         => $price->ID(),
350
+				'OBJ_type'       => EEM_Line_Item::OBJ_TYPE_PRICE,
351
+			));
352
+			$sub_line_item = apply_filters(
353
+				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
354
+				$sub_line_item
355
+			);
356
+			if ($price->is_percent()) {
357
+				$sub_line_item->set_percent($sign * $price->amount());
358
+			} else {
359
+				$sub_line_item->set_unit_price($sign * $price->amount());
360
+			}
361
+			$running_total_for_ticket += $price_total;
362
+			$line_item->add_child_line_item($sub_line_item);
363
+		}
364
+		return $line_item;
365
+	}
366
+
367
+
368
+	/**
369
+	 * Adds the specified item under the pre-tax-sub-total line item. Automatically
370
+	 * re-calculates the line item totals and updates the related transaction. But
371
+	 * DOES NOT automatically upgrade the transaction's registrations' final prices (which
372
+	 * should probably change because of this).
373
+	 * You should call EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
374
+	 * after using this, to keep the registration final prices in-sync with the transaction's total.
375
+	 *
376
+	 * @param EE_Line_Item $total_line_item
377
+	 * @param EE_Line_Item $item to be added
378
+	 * @return boolean
379
+	 * @throws EE_Error
380
+	 * @throws InvalidArgumentException
381
+	 * @throws InvalidDataTypeException
382
+	 * @throws InvalidInterfaceException
383
+	 * @throws ReflectionException
384
+	 */
385
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item)
386
+	{
387
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
388
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
389
+			$success = $pre_tax_subtotal->add_child_line_item($item);
390
+		} else {
391
+			return false;
392
+		}
393
+		$total_line_item->recalculate_total_including_taxes();
394
+		return $success;
395
+	}
396
+
397
+
398
+	/**
399
+	 * cancels an existing ticket line item,
400
+	 * by decrementing it's quantity by 1 and adding a new "type_cancellation" sub-line-item.
401
+	 * ALL totals and subtotals will NEED TO BE UPDATED after performing this action
402
+	 *
403
+	 * @param EE_Line_Item $ticket_line_item
404
+	 * @param int          $qty
405
+	 * @return bool success
406
+	 * @throws EE_Error
407
+	 * @throws InvalidArgumentException
408
+	 * @throws InvalidDataTypeException
409
+	 * @throws InvalidInterfaceException
410
+	 * @throws ReflectionException
411
+	 */
412
+	public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1)
413
+	{
414
+		// validate incoming line_item
415
+		if ($ticket_line_item->OBJ_type() !== EEM_Line_Item::OBJ_TYPE_TICKET) {
416
+			throw new EE_Error(
417
+				sprintf(
418
+					esc_html__(
419
+						'The supplied line item must have an Object Type of "Ticket", not %1$s.',
420
+						'event_espresso'
421
+					),
422
+					$ticket_line_item->type()
423
+				)
424
+			);
425
+		}
426
+		if ($ticket_line_item->quantity() < $qty) {
427
+			throw new EE_Error(
428
+				sprintf(
429
+					esc_html__(
430
+						'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.',
431
+						'event_espresso'
432
+					),
433
+					$qty,
434
+					$ticket_line_item->quantity()
435
+				)
436
+			);
437
+		}
438
+		// decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
439
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
440
+		foreach ($ticket_line_item->children() as $child_line_item) {
441
+			if (
442
+				$child_line_item->is_sub_line_item()
443
+				&& ! $child_line_item->is_percent()
444
+				&& ! $child_line_item->is_cancellation()
445
+			) {
446
+				$child_line_item->set_quantity($child_line_item->quantity() - $qty);
447
+			}
448
+		}
449
+		// get cancellation sub line item
450
+		$cancellation_line_item = EEH_Line_Item::get_descendants_of_type(
451
+			$ticket_line_item,
452
+			EEM_Line_Item::type_cancellation
453
+		);
454
+		$cancellation_line_item = reset($cancellation_line_item);
455
+		// verify that this ticket was indeed previously cancelled
456
+		if ($cancellation_line_item instanceof EE_Line_Item) {
457
+			// increment cancelled quantity
458
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
459
+		} else {
460
+			// create cancellation sub line item
461
+			$cancellation_line_item = EE_Line_Item::new_instance(array(
462
+				'LIN_name'       => esc_html__('Cancellation', 'event_espresso'),
463
+				'LIN_desc'       => sprintf(
464
+					esc_html_x(
465
+						'Cancelled %1$s : %2$s',
466
+						'Cancelled Ticket Name : 2015-01-01 11:11',
467
+						'event_espresso'
468
+					),
469
+					$ticket_line_item->name(),
470
+					current_time(get_option('date_format') . ' ' . get_option('time_format'))
471
+				),
472
+				'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
473
+				'LIN_quantity'   => $qty,
474
+				'LIN_is_taxable' => $ticket_line_item->is_taxable(),
475
+				'LIN_order'      => count($ticket_line_item->children()),
476
+				'LIN_total'      => 0, // $ticket_line_item->unit_price()
477
+				'LIN_type'       => EEM_Line_Item::type_cancellation,
478
+			));
479
+			$ticket_line_item->add_child_line_item($cancellation_line_item);
480
+		}
481
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
482
+			// decrement parent line item quantity
483
+			$event_line_item = $ticket_line_item->parent();
484
+			if (
485
+				$event_line_item instanceof EE_Line_Item
486
+				&& $event_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
487
+			) {
488
+				$event_line_item->set_quantity($event_line_item->quantity() - $qty);
489
+				$event_line_item->save();
490
+			}
491
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
492
+			return true;
493
+		}
494
+		return false;
495
+	}
496
+
497
+
498
+	/**
499
+	 * reinstates (un-cancels?) a previously canceled ticket line item,
500
+	 * by incrementing it's quantity by 1, and decrementing it's "type_cancellation" sub-line-item.
501
+	 * ALL totals and subtotals will NEED TO BE UPDATED after performing this action
502
+	 *
503
+	 * @param EE_Line_Item $ticket_line_item
504
+	 * @param int          $qty
505
+	 * @return bool success
506
+	 * @throws EE_Error
507
+	 * @throws InvalidArgumentException
508
+	 * @throws InvalidDataTypeException
509
+	 * @throws InvalidInterfaceException
510
+	 * @throws ReflectionException
511
+	 */
512
+	public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1)
513
+	{
514
+		// validate incoming line_item
515
+		if ($ticket_line_item->OBJ_type() !== EEM_Line_Item::OBJ_TYPE_TICKET) {
516
+			throw new EE_Error(
517
+				sprintf(
518
+					esc_html__(
519
+						'The supplied line item must have an Object Type of "Ticket", not %1$s.',
520
+						'event_espresso'
521
+					),
522
+					$ticket_line_item->type()
523
+				)
524
+			);
525
+		}
526
+		// get cancellation sub line item
527
+		$cancellation_line_item = EEH_Line_Item::get_descendants_of_type(
528
+			$ticket_line_item,
529
+			EEM_Line_Item::type_cancellation
530
+		);
531
+		$cancellation_line_item = reset($cancellation_line_item);
532
+		// verify that this ticket was indeed previously cancelled
533
+		if (! $cancellation_line_item instanceof EE_Line_Item) {
534
+			return false;
535
+		}
536
+		if ($cancellation_line_item->quantity() > $qty) {
537
+			// decrement cancelled quantity
538
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
539
+		} elseif ($cancellation_line_item->quantity() === $qty) {
540
+			// decrement cancelled quantity in case anyone still has the object kicking around
541
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
542
+			// delete because quantity will end up as 0
543
+			$cancellation_line_item->delete();
544
+			// and attempt to destroy the object,
545
+			// even though PHP won't actually destroy it until it needs the memory
546
+			unset($cancellation_line_item);
547
+		} else {
548
+			// what ?!?! negative quantity ?!?!
549
+			throw new EE_Error(
550
+				sprintf(
551
+					esc_html__(
552
+						'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
553
+						'event_espresso'
554
+					),
555
+					$qty,
556
+					$cancellation_line_item->quantity()
557
+				)
558
+			);
559
+		}
560
+		// increment ticket quantity
561
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
562
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
563
+			// increment parent line item quantity
564
+			$event_line_item = $ticket_line_item->parent();
565
+			if (
566
+				$event_line_item instanceof EE_Line_Item
567
+				&& $event_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
568
+			) {
569
+				$event_line_item->set_quantity($event_line_item->quantity() + $qty);
570
+			}
571
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
572
+			return true;
573
+		}
574
+		return false;
575
+	}
576
+
577
+
578
+	/**
579
+	 * calls EEH_Line_Item::find_transaction_grand_total_for_line_item()
580
+	 * then EE_Line_Item::recalculate_total_including_taxes() on the result
581
+	 *
582
+	 * @param EE_Line_Item $line_item
583
+	 * @return float
584
+	 * @throws EE_Error
585
+	 * @throws InvalidArgumentException
586
+	 * @throws InvalidDataTypeException
587
+	 * @throws InvalidInterfaceException
588
+	 * @throws ReflectionException
589
+	 */
590
+	public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item)
591
+	{
592
+		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
593
+		return $grand_total_line_item->recalculate_total_including_taxes();
594
+	}
595
+
596
+
597
+	/**
598
+	 * Gets the line item which contains the subtotal of all the items
599
+	 *
600
+	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
601
+	 * @return EE_Line_Item
602
+	 * @throws EE_Error
603
+	 * @throws InvalidArgumentException
604
+	 * @throws InvalidDataTypeException
605
+	 * @throws InvalidInterfaceException
606
+	 * @throws ReflectionException
607
+	 */
608
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item)
609
+	{
610
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
611
+		return $pre_tax_subtotal instanceof EE_Line_Item
612
+			? $pre_tax_subtotal
613
+			: self::create_pre_tax_subtotal($total_line_item);
614
+	}
615
+
616
+
617
+	/**
618
+	 * Gets the line item for the taxes subtotal
619
+	 *
620
+	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
621
+	 * @return EE_Line_Item
622
+	 * @throws EE_Error
623
+	 * @throws InvalidArgumentException
624
+	 * @throws InvalidDataTypeException
625
+	 * @throws InvalidInterfaceException
626
+	 * @throws ReflectionException
627
+	 */
628
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item)
629
+	{
630
+		$taxes = $total_line_item->get_child_line_item('taxes');
631
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
632
+	}
633
+
634
+
635
+	/**
636
+	 * sets the TXN ID on an EE_Line_Item if passed a valid EE_Transaction object
637
+	 *
638
+	 * @param EE_Line_Item   $line_item
639
+	 * @param EE_Transaction $transaction
640
+	 * @return void
641
+	 * @throws EE_Error
642
+	 * @throws InvalidArgumentException
643
+	 * @throws InvalidDataTypeException
644
+	 * @throws InvalidInterfaceException
645
+	 * @throws ReflectionException
646
+	 */
647
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = null)
648
+	{
649
+		if ($transaction) {
650
+			/** @type EEM_Transaction $EEM_Transaction */
651
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
652
+			$TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
653
+			$line_item->set_TXN_ID($TXN_ID);
654
+		}
655
+	}
656
+
657
+
658
+	/**
659
+	 * Creates a new default total line item for the transaction,
660
+	 * and its tickets subtotal and taxes subtotal line items (and adds the
661
+	 * existing taxes as children of the taxes subtotal line item)
662
+	 *
663
+	 * @param EE_Transaction $transaction
664
+	 * @return EE_Line_Item of type total
665
+	 * @throws EE_Error
666
+	 * @throws InvalidArgumentException
667
+	 * @throws InvalidDataTypeException
668
+	 * @throws InvalidInterfaceException
669
+	 * @throws ReflectionException
670
+	 */
671
+	public static function create_total_line_item($transaction = null)
672
+	{
673
+		$total_line_item = EE_Line_Item::new_instance(array(
674
+			'LIN_code' => 'total',
675
+			'LIN_name' => esc_html__('Grand Total', 'event_espresso'),
676
+			'LIN_type' => EEM_Line_Item::type_total,
677
+			'OBJ_type' => EEM_Line_Item::OBJ_TYPE_TRANSACTION,
678
+		));
679
+		$total_line_item = apply_filters(
680
+			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
681
+			$total_line_item
682
+		);
683
+		self::set_TXN_ID($total_line_item, $transaction);
684
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
685
+		self::create_taxes_subtotal($total_line_item, $transaction);
686
+		return $total_line_item;
687
+	}
688
+
689
+
690
+	/**
691
+	 * Creates a default items subtotal line item
692
+	 *
693
+	 * @param EE_Line_Item   $total_line_item
694
+	 * @param EE_Transaction $transaction
695
+	 * @return EE_Line_Item
696
+	 * @throws EE_Error
697
+	 * @throws InvalidArgumentException
698
+	 * @throws InvalidDataTypeException
699
+	 * @throws InvalidInterfaceException
700
+	 * @throws ReflectionException
701
+	 */
702
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = null)
703
+	{
704
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
705
+			'LIN_code' => 'pre-tax-subtotal',
706
+			'LIN_name' => esc_html__('Pre-Tax Subtotal', 'event_espresso'),
707
+			'LIN_type' => EEM_Line_Item::type_sub_total,
708
+		));
709
+		$pre_tax_line_item = apply_filters(
710
+			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
711
+			$pre_tax_line_item
712
+		);
713
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
714
+		$total_line_item->add_child_line_item($pre_tax_line_item);
715
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
716
+		return $pre_tax_line_item;
717
+	}
718
+
719
+
720
+	/**
721
+	 * Creates a line item for the taxes subtotal and finds all the tax prices
722
+	 * and applies taxes to it
723
+	 *
724
+	 * @param EE_Line_Item   $total_line_item of type EEM_Line_Item::type_total
725
+	 * @param EE_Transaction $transaction
726
+	 * @return EE_Line_Item
727
+	 * @throws EE_Error
728
+	 * @throws InvalidArgumentException
729
+	 * @throws InvalidDataTypeException
730
+	 * @throws InvalidInterfaceException
731
+	 * @throws ReflectionException
732
+	 */
733
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = null)
734
+	{
735
+		$tax_line_item = EE_Line_Item::new_instance(array(
736
+			'LIN_code'  => 'taxes',
737
+			'LIN_name'  => esc_html__('Taxes', 'event_espresso'),
738
+			'LIN_type'  => EEM_Line_Item::type_tax_sub_total,
739
+			'LIN_order' => 1000,// this should always come last
740
+		));
741
+		$tax_line_item = apply_filters(
742
+			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
743
+			$tax_line_item
744
+		);
745
+		self::set_TXN_ID($tax_line_item, $transaction);
746
+		$total_line_item->add_child_line_item($tax_line_item);
747
+		// and lastly, add the actual taxes
748
+		self::apply_taxes($total_line_item);
749
+		return $tax_line_item;
750
+	}
751
+
752
+
753
+	/**
754
+	 * Creates a default items subtotal line item
755
+	 *
756
+	 * @param EE_Line_Item   $pre_tax_line_item
757
+	 * @param EE_Transaction $transaction
758
+	 * @param EE_Event       $event
759
+	 * @return EE_Line_Item
760
+	 * @throws EE_Error
761
+	 * @throws InvalidArgumentException
762
+	 * @throws InvalidDataTypeException
763
+	 * @throws InvalidInterfaceException
764
+	 * @throws ReflectionException
765
+	 */
766
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = null, $event = null)
767
+	{
768
+		$event_line_item = EE_Line_Item::new_instance(array(
769
+			'LIN_code' => self::get_event_code($event),
770
+			'LIN_name' => self::get_event_name($event),
771
+			'LIN_desc' => self::get_event_desc($event),
772
+			'LIN_type' => EEM_Line_Item::type_sub_total,
773
+			'OBJ_type' => EEM_Line_Item::OBJ_TYPE_EVENT,
774
+			'OBJ_ID'   => $event instanceof EE_Event ? $event->ID() : 0,
775
+		));
776
+		$event_line_item = apply_filters(
777
+			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
778
+			$event_line_item
779
+		);
780
+		self::set_TXN_ID($event_line_item, $transaction);
781
+		$pre_tax_line_item->add_child_line_item($event_line_item);
782
+		return $event_line_item;
783
+	}
784
+
785
+
786
+	/**
787
+	 * Gets what the event ticket's code SHOULD be
788
+	 *
789
+	 * @param EE_Event $event
790
+	 * @return string
791
+	 * @throws EE_Error
792
+	 */
793
+	public static function get_event_code($event)
794
+	{
795
+		return 'event-' . ($event instanceof EE_Event ? $event->ID() : '0');
796
+	}
797
+
798
+
799
+	/**
800
+	 * Gets the event name
801
+	 *
802
+	 * @param EE_Event $event
803
+	 * @return string
804
+	 * @throws EE_Error
805
+	 */
806
+	public static function get_event_name($event)
807
+	{
808
+		return $event instanceof EE_Event
809
+			? mb_substr($event->name(), 0, 245)
810
+			: esc_html__('Event', 'event_espresso');
811
+	}
812
+
813
+
814
+	/**
815
+	 * Gets the event excerpt
816
+	 *
817
+	 * @param EE_Event $event
818
+	 * @return string
819
+	 * @throws EE_Error
820
+	 */
821
+	public static function get_event_desc($event)
822
+	{
823
+		return $event instanceof EE_Event ? $event->short_description() : '';
824
+	}
825
+
826
+
827
+	/**
828
+	 * Given the grand total line item and a ticket, finds the event sub-total
829
+	 * line item the ticket's purchase should be added onto
830
+	 *
831
+	 * @access public
832
+	 * @param EE_Line_Item $grand_total the grand total line item
833
+	 * @param EE_Ticket    $ticket
834
+	 * @return EE_Line_Item
835
+	 * @throws EE_Error
836
+	 * @throws InvalidArgumentException
837
+	 * @throws InvalidDataTypeException
838
+	 * @throws InvalidInterfaceException
839
+	 * @throws ReflectionException
840
+	 */
841
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket)
842
+	{
843
+		$first_datetime = $ticket->first_datetime();
844
+		if (! $first_datetime instanceof EE_Datetime) {
845
+			throw new EE_Error(
846
+				sprintf(
847
+					__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'),
848
+					$ticket->ID()
849
+				)
850
+			);
851
+		}
852
+		$event = $first_datetime->event();
853
+		if (! $event instanceof EE_Event) {
854
+			throw new EE_Error(
855
+				sprintf(
856
+					esc_html__(
857
+						'The supplied ticket (ID %d) has no event data associated with it.',
858
+						'event_espresso'
859
+					),
860
+					$ticket->ID()
861
+				)
862
+			);
863
+		}
864
+		$events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
865
+		if (! $events_sub_total instanceof EE_Line_Item) {
866
+			throw new EE_Error(
867
+				sprintf(
868
+					esc_html__(
869
+						'There is no events sub-total for ticket %s on total line item %d',
870
+						'event_espresso'
871
+					),
872
+					$ticket->ID(),
873
+					$grand_total->ID()
874
+				)
875
+			);
876
+		}
877
+		return $events_sub_total;
878
+	}
879
+
880
+
881
+	/**
882
+	 * Gets the event line item
883
+	 *
884
+	 * @param EE_Line_Item $grand_total
885
+	 * @param EE_Event     $event
886
+	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
887
+	 * @throws EE_Error
888
+	 * @throws InvalidArgumentException
889
+	 * @throws InvalidDataTypeException
890
+	 * @throws InvalidInterfaceException
891
+	 * @throws ReflectionException
892
+	 */
893
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event)
894
+	{
895
+		/** @type EE_Event $event */
896
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
897
+		$event_line_item = null;
898
+		$found = false;
899
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
900
+			// default event subtotal, we should only ever find this the first time this method is called
901
+			if (! $event_line_item->OBJ_ID()) {
902
+				// let's use this! but first... set the event details
903
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
904
+				$found = true;
905
+				break;
906
+			}
907
+			if ($event_line_item->OBJ_ID() === $event->ID()) {
908
+				// found existing line item for this event in the cart, so break out of loop and use this one
909
+				$found = true;
910
+				break;
911
+			}
912
+		}
913
+		if (! $found) {
914
+			// there is no event sub-total yet, so add it
915
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
916
+			// create a new "event" subtotal below that
917
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
918
+			// and set the event details
919
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
920
+		}
921
+		return $event_line_item;
922
+	}
923
+
924
+
925
+	/**
926
+	 * Creates a default items subtotal line item
927
+	 *
928
+	 * @param EE_Line_Item   $event_line_item
929
+	 * @param EE_Event       $event
930
+	 * @param EE_Transaction $transaction
931
+	 * @return void
932
+	 * @throws EE_Error
933
+	 * @throws InvalidArgumentException
934
+	 * @throws InvalidDataTypeException
935
+	 * @throws InvalidInterfaceException
936
+	 * @throws ReflectionException
937
+	 */
938
+	public static function set_event_subtotal_details(
939
+		EE_Line_Item $event_line_item,
940
+		EE_Event $event,
941
+		$transaction = null
942
+	) {
943
+		if ($event instanceof EE_Event) {
944
+			$event_line_item->set_code(self::get_event_code($event));
945
+			$event_line_item->set_name(self::get_event_name($event));
946
+			$event_line_item->set_desc(self::get_event_desc($event));
947
+			$event_line_item->set_OBJ_ID($event->ID());
948
+		}
949
+		self::set_TXN_ID($event_line_item, $transaction);
950
+	}
951
+
952
+
953
+	/**
954
+	 * Finds what taxes should apply, adds them as tax line items under the taxes sub-total,
955
+	 * and recalculates the taxes sub-total and the grand total. Resets the taxes, so
956
+	 * any old taxes are removed
957
+	 *
958
+	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
959
+	 * @param bool         $update_txn_status
960
+	 * @return bool
961
+	 * @throws EE_Error
962
+	 * @throws InvalidArgumentException
963
+	 * @throws InvalidDataTypeException
964
+	 * @throws InvalidInterfaceException
965
+	 * @throws ReflectionException
966
+	 * @throws RuntimeException
967
+	 */
968
+	public static function apply_taxes(EE_Line_Item $total_line_item, $update_txn_status = false)
969
+	{
970
+		/** @var EE_Admin_Config $admin_config */
971
+		$admin_config = LoaderFactory::getShared(EE_Admin_Config::class);
972
+		if ($admin_config->useAdvancedEditor()) {
973
+			return false;
974
+		}
975
+		/** @type EEM_Price $EEM_Price */
976
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
977
+		// get array of taxes via Price Model
978
+		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
979
+		ksort($ordered_taxes);
980
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
981
+		// just to be safe, remove its old tax line items
982
+		$deleted = $taxes_line_item->delete_children_line_items();
983
+		$updates = false;
984
+		// loop thru taxes
985
+		foreach ($ordered_taxes as $order => $taxes) {
986
+			foreach ($taxes as $tax) {
987
+				if ($tax instanceof EE_Price) {
988
+					$tax_line_item = EE_Line_Item::new_instance(
989
+						array(
990
+							'LIN_name'       => $tax->name(),
991
+							'LIN_desc'       => $tax->desc(),
992
+							'LIN_percent'    => $tax->amount(),
993
+							'LIN_is_taxable' => false,
994
+							'LIN_order'      => $order,
995
+							'LIN_total'      => 0,
996
+							'LIN_type'       => EEM_Line_Item::type_tax,
997
+							'OBJ_type'       => EEM_Line_Item::OBJ_TYPE_PRICE,
998
+							'OBJ_ID'         => $tax->ID(),
999
+						)
1000
+					);
1001
+					$tax_line_item = apply_filters(
1002
+						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
1003
+						$tax_line_item
1004
+					);
1005
+					$updates = $taxes_line_item->add_child_line_item($tax_line_item) ?
1006
+						true :
1007
+						$updates;
1008
+				}
1009
+			}
1010
+		}
1011
+		// only recalculate totals if something changed
1012
+		if ($deleted || $updates) {
1013
+			$total_line_item->recalculate_total_including_taxes($update_txn_status);
1014
+			return true;
1015
+		}
1016
+		return false;
1017
+	}
1018
+
1019
+
1020
+	/**
1021
+	 * Ensures that taxes have been applied to the order, if not applies them.
1022
+	 * Returns the total amount of tax
1023
+	 *
1024
+	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
1025
+	 * @return float
1026
+	 * @throws EE_Error
1027
+	 * @throws InvalidArgumentException
1028
+	 * @throws InvalidDataTypeException
1029
+	 * @throws InvalidInterfaceException
1030
+	 * @throws ReflectionException
1031
+	 */
1032
+	public static function ensure_taxes_applied($total_line_item)
1033
+	{
1034
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
1035
+		if (! $taxes_subtotal->children()) {
1036
+			self::apply_taxes($total_line_item);
1037
+		}
1038
+		return $taxes_subtotal->total();
1039
+	}
1040
+
1041
+
1042
+	/**
1043
+	 * Deletes ALL children of the passed line item
1044
+	 *
1045
+	 * @param EE_Line_Item $parent_line_item
1046
+	 * @return bool
1047
+	 * @throws EE_Error
1048
+	 * @throws InvalidArgumentException
1049
+	 * @throws InvalidDataTypeException
1050
+	 * @throws InvalidInterfaceException
1051
+	 * @throws ReflectionException
1052
+	 */
1053
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item)
1054
+	{
1055
+		$deleted = 0;
1056
+		foreach ($parent_line_item->children() as $child_line_item) {
1057
+			if ($child_line_item instanceof EE_Line_Item) {
1058
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
1059
+				if ($child_line_item->ID()) {
1060
+					$child_line_item->delete();
1061
+					unset($child_line_item);
1062
+				} else {
1063
+					$parent_line_item->delete_child_line_item($child_line_item->code());
1064
+				}
1065
+				$deleted++;
1066
+			}
1067
+		}
1068
+		return $deleted;
1069
+	}
1070
+
1071
+
1072
+	/**
1073
+	 * Deletes the line items as indicated by the line item code(s) provided,
1074
+	 * regardless of where they're found in the line item tree. Automatically
1075
+	 * re-calculates the line item totals and updates the related transaction. But
1076
+	 * DOES NOT automatically upgrade the transaction's registrations' final prices (which
1077
+	 * should probably change because of this).
1078
+	 * You should call EE_Registration_Processor::calculate_reg_final_prices_per_line_item()
1079
+	 * after using this, to keep the registration final prices in-sync with the transaction's total.
1080
+	 *
1081
+	 * @param EE_Line_Item      $total_line_item of type EEM_Line_Item::type_total
1082
+	 * @param array|bool|string $line_item_codes
1083
+	 * @return int number of items successfully removed
1084
+	 * @throws EE_Error
1085
+	 */
1086
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = false)
1087
+	{
1088
+
1089
+		if ($total_line_item->type() !== EEM_Line_Item::type_total) {
1090
+			EE_Error::doing_it_wrong(
1091
+				'EEH_Line_Item::delete_items',
1092
+				esc_html__(
1093
+					'This static method should only be called with a TOTAL line item, otherwise we won\'t recalculate the totals correctly',
1094
+					'event_espresso'
1095
+				),
1096
+				'4.6.18'
1097
+			);
1098
+		}
1099
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1100
+
1101
+		// check if only a single line_item_id was passed
1102
+		if (! empty($line_item_codes) && ! is_array($line_item_codes)) {
1103
+			// place single line_item_id in an array to appear as multiple line_item_ids
1104
+			$line_item_codes = array($line_item_codes);
1105
+		}
1106
+		$removals = 0;
1107
+		// cycle thru line_item_ids
1108
+		foreach ($line_item_codes as $line_item_id) {
1109
+			$removals += $total_line_item->delete_child_line_item($line_item_id);
1110
+		}
1111
+
1112
+		if ($removals > 0) {
1113
+			$total_line_item->recalculate_taxes_and_tax_total();
1114
+			return $removals;
1115
+		} else {
1116
+			return false;
1117
+		}
1118
+	}
1119
+
1120
+
1121
+	/**
1122
+	 * Overwrites the previous tax by clearing out the old taxes, and creates a new
1123
+	 * tax and updates the total line item accordingly
1124
+	 *
1125
+	 * @param EE_Line_Item $total_line_item
1126
+	 * @param float        $amount
1127
+	 * @param string       $name
1128
+	 * @param string       $description
1129
+	 * @param string       $code
1130
+	 * @param boolean      $add_to_existing_line_item
1131
+	 *                          if true, and a duplicate line item with the same code is found,
1132
+	 *                          $amount will be added onto it; otherwise will simply set the taxes to match $amount
1133
+	 * @return EE_Line_Item the new tax line item created
1134
+	 * @throws EE_Error
1135
+	 * @throws InvalidArgumentException
1136
+	 * @throws InvalidDataTypeException
1137
+	 * @throws InvalidInterfaceException
1138
+	 * @throws ReflectionException
1139
+	 */
1140
+	public static function set_total_tax_to(
1141
+		EE_Line_Item $total_line_item,
1142
+		$amount,
1143
+		$name = null,
1144
+		$description = null,
1145
+		$code = null,
1146
+		$add_to_existing_line_item = false
1147
+	) {
1148
+		$tax_subtotal = self::get_taxes_subtotal($total_line_item);
1149
+		$taxable_total = $total_line_item->taxable_total();
1150
+
1151
+		if ($add_to_existing_line_item) {
1152
+			$new_tax = $tax_subtotal->get_child_line_item($code);
1153
+			EEM_Line_Item::instance()->delete(
1154
+				array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
1155
+			);
1156
+		} else {
1157
+			$new_tax = null;
1158
+			$tax_subtotal->delete_children_line_items();
1159
+		}
1160
+		if ($new_tax) {
1161
+			$new_tax->set_total($new_tax->total() + $amount);
1162
+			$new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
1163
+		} else {
1164
+			// no existing tax item. Create it
1165
+			$new_tax = EE_Line_Item::new_instance(array(
1166
+				'TXN_ID'      => $total_line_item->TXN_ID(),
1167
+				'LIN_name'    => $name ? $name : esc_html__('Tax', 'event_espresso'),
1168
+				'LIN_desc'    => $description ? $description : '',
1169
+				'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
1170
+				'LIN_total'   => $amount,
1171
+				'LIN_parent'  => $tax_subtotal->ID(),
1172
+				'LIN_type'    => EEM_Line_Item::type_tax,
1173
+				'LIN_code'    => $code,
1174
+			));
1175
+		}
1176
+
1177
+		$new_tax = apply_filters(
1178
+			'FHEE__EEH_Line_Item__set_total_tax_to__new_tax_subtotal',
1179
+			$new_tax,
1180
+			$total_line_item
1181
+		);
1182
+		$new_tax->save();
1183
+		$tax_subtotal->set_total($new_tax->total());
1184
+		$tax_subtotal->save();
1185
+		$total_line_item->recalculate_total_including_taxes();
1186
+		return $new_tax;
1187
+	}
1188
+
1189
+
1190
+	/**
1191
+	 * Makes all the line items which are children of $line_item taxable (or not).
1192
+	 * Does NOT save the line items
1193
+	 *
1194
+	 * @param EE_Line_Item $line_item
1195
+	 * @param boolean      $taxable
1196
+	 * @param string       $code_substring_for_whitelist if this string is part of the line item's code
1197
+	 *                                                   it will be whitelisted (ie, except from becoming taxable)
1198
+	 * @throws EE_Error
1199
+	 */
1200
+	public static function set_line_items_taxable(
1201
+		EE_Line_Item $line_item,
1202
+		$taxable = true,
1203
+		$code_substring_for_whitelist = null
1204
+	) {
1205
+		$whitelisted = false;
1206
+		if ($code_substring_for_whitelist !== null) {
1207
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false;
1208
+		}
1209
+		if (! $whitelisted && $line_item->is_line_item()) {
1210
+			$line_item->set_is_taxable($taxable);
1211
+		}
1212
+		foreach ($line_item->children() as $child_line_item) {
1213
+			EEH_Line_Item::set_line_items_taxable(
1214
+				$child_line_item,
1215
+				$taxable,
1216
+				$code_substring_for_whitelist
1217
+			);
1218
+		}
1219
+	}
1220
+
1221
+
1222
+	/**
1223
+	 * Gets all descendants that are event subtotals
1224
+	 *
1225
+	 * @uses  EEH_Line_Item::get_subtotals_of_object_type()
1226
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1227
+	 * @return EE_Line_Item[]
1228
+	 * @throws EE_Error
1229
+	 */
1230
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item)
1231
+	{
1232
+		return self::get_subtotals_of_object_type($parent_line_item, EEM_Line_Item::OBJ_TYPE_EVENT);
1233
+	}
1234
+
1235
+
1236
+	/**
1237
+	 * Gets all descendants subtotals that match the supplied object type
1238
+	 *
1239
+	 * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1240
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1241
+	 * @param string       $obj_type
1242
+	 * @return EE_Line_Item[]
1243
+	 * @throws EE_Error
1244
+	 */
1245
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '')
1246
+	{
1247
+		return self::_get_descendants_by_type_and_object_type(
1248
+			$parent_line_item,
1249
+			EEM_Line_Item::type_sub_total,
1250
+			$obj_type
1251
+		);
1252
+	}
1253
+
1254
+
1255
+	/**
1256
+	 * Gets all descendants that are tickets
1257
+	 *
1258
+	 * @uses  EEH_Line_Item::get_line_items_of_object_type()
1259
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1260
+	 * @return EE_Line_Item[]
1261
+	 * @throws EE_Error
1262
+	 */
1263
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item)
1264
+	{
1265
+		return self::get_line_items_of_object_type(
1266
+			$parent_line_item,
1267
+			EEM_Line_Item::OBJ_TYPE_TICKET
1268
+		);
1269
+	}
1270
+
1271
+
1272
+	/**
1273
+	 * Gets all descendants subtotals that match the supplied object type
1274
+	 *
1275
+	 * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1276
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1277
+	 * @param string       $obj_type
1278
+	 * @return EE_Line_Item[]
1279
+	 * @throws EE_Error
1280
+	 */
1281
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '')
1282
+	{
1283
+		return self::_get_descendants_by_type_and_object_type(
1284
+			$parent_line_item,
1285
+			EEM_Line_Item::type_line_item,
1286
+			$obj_type
1287
+		);
1288
+	}
1289
+
1290
+
1291
+	/**
1292
+	 * Gets all the descendants (ie, children or children of children etc) that are of the type 'tax'
1293
+	 *
1294
+	 * @uses  EEH_Line_Item::get_descendants_of_type()
1295
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1296
+	 * @return EE_Line_Item[]
1297
+	 * @throws EE_Error
1298
+	 */
1299
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item)
1300
+	{
1301
+		return EEH_Line_Item::get_descendants_of_type(
1302
+			$parent_line_item,
1303
+			EEM_Line_Item::type_tax
1304
+		);
1305
+	}
1306
+
1307
+
1308
+	/**
1309
+	 * Gets all the real items purchased which are children of this item
1310
+	 *
1311
+	 * @uses  EEH_Line_Item::get_descendants_of_type()
1312
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1313
+	 * @return EE_Line_Item[]
1314
+	 * @throws EE_Error
1315
+	 */
1316
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item)
1317
+	{
1318
+		return EEH_Line_Item::get_descendants_of_type(
1319
+			$parent_line_item,
1320
+			EEM_Line_Item::type_line_item
1321
+		);
1322
+	}
1323
+
1324
+
1325
+	/**
1326
+	 * Gets all descendants of supplied line item that match the supplied line item type
1327
+	 *
1328
+	 * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1329
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1330
+	 * @param string       $line_item_type   one of the EEM_Line_Item constants
1331
+	 * @return EE_Line_Item[]
1332
+	 * @throws EE_Error
1333
+	 */
1334
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type)
1335
+	{
1336
+		return self::_get_descendants_by_type_and_object_type(
1337
+			$parent_line_item,
1338
+			$line_item_type,
1339
+			null
1340
+		);
1341
+	}
1342
+
1343
+
1344
+	/**
1345
+	 * Gets all descendants of supplied line item that match the supplied line item type and possibly the object type
1346
+	 * as well
1347
+	 *
1348
+	 * @param EE_Line_Item  $parent_line_item - the line item to find descendants of
1349
+	 * @param string        $line_item_type   one of the EEM_Line_Item constants
1350
+	 * @param string | NULL $obj_type         object model class name (minus prefix) or NULL to ignore object type when
1351
+	 *                                        searching
1352
+	 * @return EE_Line_Item[]
1353
+	 * @throws EE_Error
1354
+	 */
1355
+	protected static function _get_descendants_by_type_and_object_type(
1356
+		EE_Line_Item $parent_line_item,
1357
+		$line_item_type,
1358
+		$obj_type = null
1359
+	) {
1360
+		$objects = array();
1361
+		foreach ($parent_line_item->children() as $child_line_item) {
1362
+			if ($child_line_item instanceof EE_Line_Item) {
1363
+				if (
1364
+					$child_line_item->type() === $line_item_type
1365
+					&& (
1366
+						$child_line_item->OBJ_type() === $obj_type || $obj_type === null
1367
+					)
1368
+				) {
1369
+					$objects[] = $child_line_item;
1370
+				} else {
1371
+					// go-through-all-its children looking for more matches
1372
+					$objects = array_merge(
1373
+						$objects,
1374
+						self::_get_descendants_by_type_and_object_type(
1375
+							$child_line_item,
1376
+							$line_item_type,
1377
+							$obj_type
1378
+						)
1379
+					);
1380
+				}
1381
+			}
1382
+		}
1383
+		return $objects;
1384
+	}
1385
+
1386
+
1387
+	/**
1388
+	 * Gets all descendants subtotals that match the supplied object type
1389
+	 *
1390
+	 * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1391
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1392
+	 * @param string       $OBJ_type         object type (like Event)
1393
+	 * @param array        $OBJ_IDs          array of OBJ_IDs
1394
+	 * @return EE_Line_Item[]
1395
+	 * @throws EE_Error
1396
+	 */
1397
+	public static function get_line_items_by_object_type_and_IDs(
1398
+		EE_Line_Item $parent_line_item,
1399
+		$OBJ_type = '',
1400
+		$OBJ_IDs = array()
1401
+	) {
1402
+		return self::_get_descendants_by_object_type_and_object_ID(
1403
+			$parent_line_item,
1404
+			$OBJ_type,
1405
+			$OBJ_IDs
1406
+		);
1407
+	}
1408
+
1409
+
1410
+	/**
1411
+	 * Gets all descendants of supplied line item that match the supplied line item type and possibly the object type
1412
+	 * as well
1413
+	 *
1414
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1415
+	 * @param string       $OBJ_type         object type (like Event)
1416
+	 * @param array        $OBJ_IDs          array of OBJ_IDs
1417
+	 * @return EE_Line_Item[]
1418
+	 * @throws EE_Error
1419
+	 */
1420
+	protected static function _get_descendants_by_object_type_and_object_ID(
1421
+		EE_Line_Item $parent_line_item,
1422
+		$OBJ_type,
1423
+		$OBJ_IDs
1424
+	) {
1425
+		$objects = array();
1426
+		foreach ($parent_line_item->children() as $child_line_item) {
1427
+			if ($child_line_item instanceof EE_Line_Item) {
1428
+				if (
1429
+					$child_line_item->OBJ_type() === $OBJ_type
1430
+					&& is_array($OBJ_IDs)
1431
+					&& in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1432
+				) {
1433
+					$objects[] = $child_line_item;
1434
+				} else {
1435
+					// go-through-all-its children looking for more matches
1436
+					$objects = array_merge(
1437
+						$objects,
1438
+						self::_get_descendants_by_object_type_and_object_ID(
1439
+							$child_line_item,
1440
+							$OBJ_type,
1441
+							$OBJ_IDs
1442
+						)
1443
+					);
1444
+				}
1445
+			}
1446
+		}
1447
+		return $objects;
1448
+	}
1449
+
1450
+
1451
+	/**
1452
+	 * Uses a breadth-first-search in order to find the nearest descendant of
1453
+	 * the specified type and returns it, else NULL
1454
+	 *
1455
+	 * @uses  EEH_Line_Item::_get_nearest_descendant()
1456
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1457
+	 * @param string       $type             like one of the EEM_Line_Item::type_*
1458
+	 * @return EE_Line_Item
1459
+	 * @throws EE_Error
1460
+	 * @throws InvalidArgumentException
1461
+	 * @throws InvalidDataTypeException
1462
+	 * @throws InvalidInterfaceException
1463
+	 * @throws ReflectionException
1464
+	 */
1465
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type)
1466
+	{
1467
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1468
+	}
1469
+
1470
+
1471
+	/**
1472
+	 * Uses a breadth-first-search in order to find the nearest descendant
1473
+	 * having the specified LIN_code and returns it, else NULL
1474
+	 *
1475
+	 * @uses  EEH_Line_Item::_get_nearest_descendant()
1476
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1477
+	 * @param string       $code             any value used for LIN_code
1478
+	 * @return EE_Line_Item
1479
+	 * @throws EE_Error
1480
+	 * @throws InvalidArgumentException
1481
+	 * @throws InvalidDataTypeException
1482
+	 * @throws InvalidInterfaceException
1483
+	 * @throws ReflectionException
1484
+	 */
1485
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code)
1486
+	{
1487
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1488
+	}
1489
+
1490
+
1491
+	/**
1492
+	 * Uses a breadth-first-search in order to find the nearest descendant
1493
+	 * having the specified LIN_code and returns it, else NULL
1494
+	 *
1495
+	 * @param EE_Line_Item $parent_line_item - the line item to find descendants of
1496
+	 * @param string       $search_field     name of EE_Line_Item property
1497
+	 * @param string       $value            any value stored in $search_field
1498
+	 * @return EE_Line_Item
1499
+	 * @throws EE_Error
1500
+	 * @throws InvalidArgumentException
1501
+	 * @throws InvalidDataTypeException
1502
+	 * @throws InvalidInterfaceException
1503
+	 * @throws ReflectionException
1504
+	 */
1505
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value)
1506
+	{
1507
+		foreach ($parent_line_item->children() as $child) {
1508
+			if ($child->get($search_field) == $value) {
1509
+				return $child;
1510
+			}
1511
+		}
1512
+		foreach ($parent_line_item->children() as $child) {
1513
+			$descendant_found = self::_get_nearest_descendant(
1514
+				$child,
1515
+				$search_field,
1516
+				$value
1517
+			);
1518
+			if ($descendant_found) {
1519
+				return $descendant_found;
1520
+			}
1521
+		}
1522
+		return null;
1523
+	}
1524
+
1525
+
1526
+	/**
1527
+	 * if passed line item has a TXN ID, uses that to jump directly to the grand total line item for the transaction,
1528
+	 * else recursively walks up the line item tree until a parent of type total is found,
1529
+	 *
1530
+	 * @param EE_Line_Item $line_item
1531
+	 * @return EE_Line_Item
1532
+	 * @throws EE_Error
1533
+	 */
1534
+	public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item)
1535
+	{
1536
+		if ($line_item->TXN_ID()) {
1537
+			$total_line_item = $line_item->transaction()->total_line_item(false);
1538
+			if ($total_line_item instanceof EE_Line_Item) {
1539
+				return $total_line_item;
1540
+			}
1541
+		} else {
1542
+			$line_item_parent = $line_item->parent();
1543
+			if ($line_item_parent instanceof EE_Line_Item) {
1544
+				if ($line_item_parent->is_total()) {
1545
+					return $line_item_parent;
1546
+				}
1547
+				return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1548
+			}
1549
+		}
1550
+		throw new EE_Error(
1551
+			sprintf(
1552
+				esc_html__(
1553
+					'A valid grand total for line item %1$d was not found.',
1554
+					'event_espresso'
1555
+				),
1556
+				$line_item->ID()
1557
+			)
1558
+		);
1559
+	}
1560
+
1561
+
1562
+	/**
1563
+	 * Prints out a representation of the line item tree
1564
+	 *
1565
+	 * @param EE_Line_Item $line_item
1566
+	 * @param int          $indentation
1567
+	 * @return void
1568
+	 * @throws EE_Error
1569
+	 */
1570
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0)
1571
+	{
1572
+		echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1573
+		if (! $indentation) {
1574
+			echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1575
+		}
1576
+		for ($i = 0; $i < $indentation; $i++) {
1577
+			echo '. ';
1578
+		}
1579
+		$breakdown = '';
1580
+		if ($line_item->is_line_item()) {
1581
+			if ($line_item->is_percent()) {
1582
+				$breakdown = "{$line_item->percent()}%";
1583
+			} else {
1584
+				$breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1585
+			}
1586
+		}
1587
+		echo $line_item->name();
1588
+		echo " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ";
1589
+		echo '$' . (string) $line_item->total();
1590
+		if ($breakdown) {
1591
+			echo " ( {$breakdown} )";
1592
+		}
1593
+		if ($line_item->is_taxable()) {
1594
+			echo '  * taxable';
1595
+		}
1596
+		if ($line_item->children()) {
1597
+			foreach ($line_item->children() as $child) {
1598
+				self::visualize($child, $indentation + 1);
1599
+			}
1600
+		}
1601
+	}
1602
+
1603
+
1604
+	/**
1605
+	 * Calculates the registration's final price, taking into account that they
1606
+	 * need to not only help pay for their OWN ticket, but also any transaction-wide surcharges and taxes,
1607
+	 * and receive a portion of any transaction-wide discounts.
1608
+	 * eg1, if I buy a $1 ticket and brent buys a $9 ticket, and we receive a $5 discount
1609
+	 * then I'll get 1/10 of that $5 discount, which is $0.50, and brent will get
1610
+	 * 9/10ths of that $5 discount, which is $4.50. So my final price should be $0.50
1611
+	 * and brent's final price should be $5.50.
1612
+	 * In order to do this, we basically need to traverse the line item tree calculating
1613
+	 * the running totals (just as if we were recalculating the total), but when we identify
1614
+	 * regular line items, we need to keep track of their share of the grand total.
1615
+	 * Also, we need to keep track of the TAXABLE total for each ticket purchase, so
1616
+	 * we can know how to apply taxes to it. (Note: "taxable total" does not equal the "pretax total"
1617
+	 * when there are non-taxable items; otherwise they would be the same)
1618
+	 *
1619
+	 * @param EE_Line_Item $line_item
1620
+	 * @param array        $billable_ticket_quantities  array of EE_Ticket IDs and their corresponding quantity that
1621
+	 *                                                  can be included in price calculations at this moment
1622
+	 * @return array        keys are line items for tickets IDs and values are their share of the running total,
1623
+	 *                                                  plus the key 'total', and 'taxable' which also has keys of all
1624
+	 *                                                  the ticket IDs.
1625
+	 *                                                  Eg array(
1626
+	 *                                                      12 => 4.3
1627
+	 *                                                      23 => 8.0
1628
+	 *                                                      'total' => 16.6,
1629
+	 *                                                      'taxable' => array(
1630
+	 *                                                          12 => 10,
1631
+	 *                                                          23 => 4
1632
+	 *                                                      ).
1633
+	 *                                                  So to find which registrations have which final price, we need
1634
+	 *                                                  to find which line item is theirs, which can be done with
1635
+	 *                                                  `EEM_Line_Item::instance()->get_line_item_for_registration(
1636
+	 *                                                  $registration );`
1637
+	 * @throws EE_Error
1638
+	 * @throws InvalidArgumentException
1639
+	 * @throws InvalidDataTypeException
1640
+	 * @throws InvalidInterfaceException
1641
+	 * @throws ReflectionException
1642
+	 */
1643
+	public static function calculate_reg_final_prices_per_line_item(
1644
+		EE_Line_Item $line_item,
1645
+		$billable_ticket_quantities = array()
1646
+	) {
1647
+		$running_totals = [
1648
+			'total'   => 0,
1649
+			'taxable' => ['total' => 0]
1650
+		];
1651
+		foreach ($line_item->children() as $child_line_item) {
1652
+			switch ($child_line_item->type()) {
1653
+				case EEM_Line_Item::type_sub_total:
1654
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1655
+						$child_line_item,
1656
+						$billable_ticket_quantities
1657
+					);
1658
+					// combine arrays but preserve numeric keys
1659
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1660
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1661
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1662
+					break;
1663
+
1664
+				case EEM_Line_Item::type_tax_sub_total:
1665
+					// find how much the taxes percentage is
1666
+					if ($child_line_item->percent() !== 0) {
1667
+						$tax_percent_decimal = $child_line_item->percent() / 100;
1668
+					} else {
1669
+						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1670
+					}
1671
+					// and apply to all the taxable totals, and add to the pretax totals
1672
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1673
+						// "total" and "taxable" array key is an exception
1674
+						if ($line_item_id === 'taxable') {
1675
+							continue;
1676
+						}
1677
+						$taxable_total = $running_totals['taxable'][ $line_item_id ];
1678
+						$running_totals[ $line_item_id ] += ($taxable_total * $tax_percent_decimal);
1679
+					}
1680
+					break;
1681
+
1682
+				case EEM_Line_Item::type_line_item:
1683
+					// ticket line items or ????
1684
+					if ($child_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET) {
1685
+						// kk it's a ticket
1686
+						if (isset($running_totals[ $child_line_item->ID() ])) {
1687
+							// huh? that shouldn't happen.
1688
+							$running_totals['total'] += $child_line_item->total();
1689
+						} else {
1690
+							// its not in our running totals yet. great.
1691
+							if ($child_line_item->is_taxable()) {
1692
+								$taxable_amount = $child_line_item->unit_price();
1693
+							} else {
1694
+								$taxable_amount = 0;
1695
+							}
1696
+							// are we only calculating totals for some tickets?
1697
+							if (isset($billable_ticket_quantities[ $child_line_item->OBJ_ID() ])) {
1698
+								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1699
+								$running_totals[ $child_line_item->ID() ] = $quantity
1700
+									? $child_line_item->unit_price()
1701
+									: 0;
1702
+								$running_totals['taxable'][ $child_line_item->ID() ] = $quantity
1703
+									? $taxable_amount
1704
+									: 0;
1705
+							} else {
1706
+								$quantity = $child_line_item->quantity();
1707
+								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1708
+								$running_totals['taxable'][ $child_line_item->ID() ] = $taxable_amount;
1709
+							}
1710
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1711
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1712
+						}
1713
+					} else {
1714
+						// it's some other type of item added to the cart
1715
+						// it should affect the running totals
1716
+						// basically we want to convert it into a PERCENT modifier. Because
1717
+						// more clearly affect all registration's final price equally
1718
+						$line_items_percent_of_running_total = $running_totals['total'] > 0
1719
+							? ($child_line_item->total() / $running_totals['total']) + 1
1720
+							: 1;
1721
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1722
+							// the "taxable" array key is an exception
1723
+							if ($line_item_id === 'taxable') {
1724
+								continue;
1725
+							}
1726
+							// update the running totals
1727
+							// yes this actually even works for the running grand total!
1728
+							$running_totals[ $line_item_id ] =
1729
+								$line_items_percent_of_running_total * $this_running_total;
1730
+
1731
+							if ($child_line_item->is_taxable()) {
1732
+								$running_totals['taxable'][ $line_item_id ] =
1733
+									$line_items_percent_of_running_total * $running_totals['taxable'][ $line_item_id ];
1734
+							}
1735
+						}
1736
+					}
1737
+					break;
1738
+			}
1739
+		}
1740
+		return $running_totals;
1741
+	}
1742
+
1743
+
1744
+	/**
1745
+	 * @param EE_Line_Item $total_line_item
1746
+	 * @param EE_Line_Item $ticket_line_item
1747
+	 * @return float | null
1748
+	 * @throws EE_Error
1749
+	 * @throws InvalidArgumentException
1750
+	 * @throws InvalidDataTypeException
1751
+	 * @throws InvalidInterfaceException
1752
+	 * @throws OutOfRangeException
1753
+	 * @throws ReflectionException
1754
+	 */
1755
+	public static function calculate_final_price_for_ticket_line_item(
1756
+		EE_Line_Item $total_line_item,
1757
+		EE_Line_Item $ticket_line_item
1758
+	) {
1759
+		static $final_prices_per_ticket_line_item = array();
1760
+		if (empty($final_prices_per_ticket_line_item) || empty($final_prices_per_ticket_line_item[ $total_line_item->ID() ])) {
1761
+			$final_prices_per_ticket_line_item[ $total_line_item->ID() ] = EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1762
+				$total_line_item
1763
+			);
1764
+		}
1765
+		// ok now find this new registration's final price
1766
+		if (isset($final_prices_per_ticket_line_item[ $total_line_item->ID() ][ $ticket_line_item->ID() ])) {
1767
+			return $final_prices_per_ticket_line_item[ $total_line_item->ID() ][ $ticket_line_item->ID() ];
1768
+		}
1769
+		$message = sprintf(
1770
+			esc_html__(
1771
+				'The final price for the ticket line item (ID:%1$d) could not be calculated.',
1772
+				'event_espresso'
1773
+			),
1774
+			$ticket_line_item->ID()
1775
+		);
1776
+		if (WP_DEBUG) {
1777
+			$message .= '<br>' . print_r($final_prices_per_ticket_line_item, true);
1778
+			throw new OutOfRangeException($message);
1779
+		}
1780
+		EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1781
+		return null;
1782
+	}
1783
+
1784
+
1785
+	/**
1786
+	 * Creates a duplicate of the line item tree, except only includes billable items
1787
+	 * and the portion of line items attributed to billable things
1788
+	 *
1789
+	 * @param EE_Line_Item      $line_item
1790
+	 * @param EE_Registration[] $registrations
1791
+	 * @return EE_Line_Item
1792
+	 * @throws EE_Error
1793
+	 * @throws InvalidArgumentException
1794
+	 * @throws InvalidDataTypeException
1795
+	 * @throws InvalidInterfaceException
1796
+	 * @throws ReflectionException
1797
+	 */
1798
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations)
1799
+	{
1800
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1801
+		foreach ($line_item->children() as $child_li) {
1802
+			$copy_li->add_child_line_item(
1803
+				EEH_Line_Item::billable_line_item_tree($child_li, $registrations)
1804
+			);
1805
+		}
1806
+		// if this is the grand total line item, make sure the totals all add up
1807
+		// (we could have duplicated this logic AS we copied the line items, but
1808
+		// it seems DRYer this way)
1809
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1810
+			$copy_li->recalculate_total_including_taxes();
1811
+		}
1812
+		return $copy_li;
1813
+	}
1814
+
1815
+
1816
+	/**
1817
+	 * Creates a new, unsaved line item from $line_item that factors in the
1818
+	 * number of billable registrations on $registrations.
1819
+	 *
1820
+	 * @param EE_Line_Item      $line_item
1821
+	 * @param EE_Registration[] $registrations
1822
+	 * @return EE_Line_Item
1823
+	 * @throws EE_Error
1824
+	 * @throws InvalidArgumentException
1825
+	 * @throws InvalidDataTypeException
1826
+	 * @throws InvalidInterfaceException
1827
+	 * @throws ReflectionException
1828
+	 */
1829
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations)
1830
+	{
1831
+		$new_li_fields = $line_item->model_field_array();
1832
+		if (
1833
+			$line_item->type() === EEM_Line_Item::type_line_item &&
1834
+			$line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1835
+		) {
1836
+			$count = 0;
1837
+			foreach ($registrations as $registration) {
1838
+				if (
1839
+					$line_item->OBJ_ID() === $registration->ticket_ID() &&
1840
+					in_array(
1841
+						$registration->status_ID(),
1842
+						EEM_Registration::reg_statuses_that_allow_payment(),
1843
+						true
1844
+					)
1845
+				) {
1846
+					$count++;
1847
+				}
1848
+			}
1849
+			$new_li_fields['LIN_quantity'] = $count;
1850
+		}
1851
+		// don't set the total. We'll leave that up to the code that calculates it
1852
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1853
+		return EE_Line_Item::new_instance($new_li_fields);
1854
+	}
1855
+
1856
+
1857
+	/**
1858
+	 * Returns a modified line item tree where all the subtotals which have a total of 0
1859
+	 * are removed, and line items with a quantity of 0
1860
+	 *
1861
+	 * @param EE_Line_Item $line_item |null
1862
+	 * @return EE_Line_Item|null
1863
+	 * @throws EE_Error
1864
+	 * @throws InvalidArgumentException
1865
+	 * @throws InvalidDataTypeException
1866
+	 * @throws InvalidInterfaceException
1867
+	 * @throws ReflectionException
1868
+	 */
1869
+	public static function non_empty_line_items(EE_Line_Item $line_item)
1870
+	{
1871
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1872
+		if ($copied_li === null) {
1873
+			return null;
1874
+		}
1875
+		// if this is an event subtotal, we want to only include it if it
1876
+		// has a non-zero total and at least one ticket line item child
1877
+		$ticket_children = 0;
1878
+		foreach ($line_item->children() as $child_li) {
1879
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1880
+			if ($child_li_copy !== null) {
1881
+				$copied_li->add_child_line_item($child_li_copy);
1882
+				if (
1883
+					$child_li_copy->type() === EEM_Line_Item::type_line_item &&
1884
+					$child_li_copy->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1885
+				) {
1886
+					$ticket_children++;
1887
+				}
1888
+			}
1889
+		}
1890
+		// if this is an event subtotal with NO ticket children
1891
+		// we basically want to ignore it
1892
+		if (
1893
+			$ticket_children === 0
1894
+			&& $line_item->type() === EEM_Line_Item::type_sub_total
1895
+			&& $line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
1896
+			&& $line_item->total() === 0
1897
+		) {
1898
+			return null;
1899
+		}
1900
+		return $copied_li;
1901
+	}
1902
+
1903
+
1904
+	/**
1905
+	 * Creates a new, unsaved line item, but if it's a ticket line item
1906
+	 * with a total of 0, or a subtotal of 0, returns null instead
1907
+	 *
1908
+	 * @param EE_Line_Item $line_item
1909
+	 * @return EE_Line_Item
1910
+	 * @throws EE_Error
1911
+	 * @throws InvalidArgumentException
1912
+	 * @throws InvalidDataTypeException
1913
+	 * @throws InvalidInterfaceException
1914
+	 * @throws ReflectionException
1915
+	 */
1916
+	public static function non_empty_line_item(EE_Line_Item $line_item)
1917
+	{
1918
+		if (
1919
+			$line_item->type() === EEM_Line_Item::type_line_item
1920
+			&& $line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1921
+			&& $line_item->quantity() === 0
1922
+		) {
1923
+			return null;
1924
+		}
1925
+		$new_li_fields = $line_item->model_field_array();
1926
+		// don't set the total. We'll leave that up to the code that calculates it
1927
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1928
+		return EE_Line_Item::new_instance($new_li_fields);
1929
+	}
1930
+
1931
+
1932
+	/**
1933
+	 * Cycles through all of the ticket line items for the supplied total line item
1934
+	 * and ensures that the line item's "is_taxable" field matches that of its corresponding ticket
1935
+	 *
1936
+	 * @param EE_Line_Item $total_line_item
1937
+	 * @since 4.9.79.p
1938
+	 * @throws EE_Error
1939
+	 * @throws InvalidArgumentException
1940
+	 * @throws InvalidDataTypeException
1941
+	 * @throws InvalidInterfaceException
1942
+	 * @throws ReflectionException
1943
+	 */
1944
+	public static function resetIsTaxableForTickets(EE_Line_Item $total_line_item)
1945
+	{
1946
+		$ticket_line_items = self::get_ticket_line_items($total_line_item);
1947
+		foreach ($ticket_line_items as $ticket_line_item) {
1948
+			if (
1949
+				$ticket_line_item instanceof EE_Line_Item
1950
+				&& $ticket_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1951
+			) {
1952
+				$ticket = $ticket_line_item->ticket();
1953
+				if ($ticket instanceof EE_Ticket && $ticket->taxable() !== $ticket_line_item->is_taxable()) {
1954
+					$ticket_line_item->set_is_taxable($ticket->taxable());
1955
+					$ticket_line_item->save();
1956
+				}
1957
+			}
1958
+		}
1959
+	}
1960
+
1961
+
1962
+
1963
+	/**************************************** @DEPRECATED METHODS *************************************** */
1964
+	/**
1965
+	 * @deprecated
1966
+	 * @param EE_Line_Item $total_line_item
1967
+	 * @return EE_Line_Item
1968
+	 * @throws EE_Error
1969
+	 * @throws InvalidArgumentException
1970
+	 * @throws InvalidDataTypeException
1971
+	 * @throws InvalidInterfaceException
1972
+	 * @throws ReflectionException
1973
+	 */
1974
+	public static function get_items_subtotal(EE_Line_Item $total_line_item)
1975
+	{
1976
+		EE_Error::doing_it_wrong(
1977
+			'EEH_Line_Item::get_items_subtotal()',
1978
+			sprintf(
1979
+				esc_html__('Method replaced with %1$s', 'event_espresso'),
1980
+				'EEH_Line_Item::get_pre_tax_subtotal()'
1981
+			),
1982
+			'4.6.0'
1983
+		);
1984
+		return self::get_pre_tax_subtotal($total_line_item);
1985
+	}
1986
+
1987
+
1988
+	/**
1989
+	 * @deprecated
1990
+	 * @param EE_Transaction $transaction
1991
+	 * @return EE_Line_Item
1992
+	 * @throws EE_Error
1993
+	 * @throws InvalidArgumentException
1994
+	 * @throws InvalidDataTypeException
1995
+	 * @throws InvalidInterfaceException
1996
+	 * @throws ReflectionException
1997
+	 */
1998
+	public static function create_default_total_line_item($transaction = null)
1999
+	{
2000
+		EE_Error::doing_it_wrong(
2001
+			'EEH_Line_Item::create_default_total_line_item()',
2002
+			sprintf(
2003
+				esc_html__('Method replaced with %1$s', 'event_espresso'),
2004
+				'EEH_Line_Item::create_total_line_item()'
2005
+			),
2006
+			'4.6.0'
2007
+		);
2008
+		return self::create_total_line_item($transaction);
2009
+	}
2010
+
2011
+
2012
+	/**
2013
+	 * @deprecated
2014
+	 * @param EE_Line_Item   $total_line_item
2015
+	 * @param EE_Transaction $transaction
2016
+	 * @return EE_Line_Item
2017
+	 * @throws EE_Error
2018
+	 * @throws InvalidArgumentException
2019
+	 * @throws InvalidDataTypeException
2020
+	 * @throws InvalidInterfaceException
2021
+	 * @throws ReflectionException
2022
+	 */
2023
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = null)
2024
+	{
2025
+		EE_Error::doing_it_wrong(
2026
+			'EEH_Line_Item::create_default_tickets_subtotal()',
2027
+			sprintf(
2028
+				esc_html__('Method replaced with %1$s', 'event_espresso'),
2029
+				'EEH_Line_Item::create_pre_tax_subtotal()'
2030
+			),
2031
+			'4.6.0'
2032
+		);
2033
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
2034
+	}
2035
+
2036
+
2037
+	/**
2038
+	 * @deprecated
2039
+	 * @param EE_Line_Item   $total_line_item
2040
+	 * @param EE_Transaction $transaction
2041
+	 * @return EE_Line_Item
2042
+	 * @throws EE_Error
2043
+	 * @throws InvalidArgumentException
2044
+	 * @throws InvalidDataTypeException
2045
+	 * @throws InvalidInterfaceException
2046
+	 * @throws ReflectionException
2047
+	 */
2048
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = null)
2049
+	{
2050
+		EE_Error::doing_it_wrong(
2051
+			'EEH_Line_Item::create_default_taxes_subtotal()',
2052
+			sprintf(
2053
+				esc_html__('Method replaced with %1$s', 'event_espresso'),
2054
+				'EEH_Line_Item::create_taxes_subtotal()'
2055
+			),
2056
+			'4.6.0'
2057
+		);
2058
+		return self::create_taxes_subtotal($total_line_item, $transaction);
2059
+	}
2060
+
2061
+
2062
+	/**
2063
+	 * @deprecated
2064
+	 * @param EE_Line_Item   $total_line_item
2065
+	 * @param EE_Transaction $transaction
2066
+	 * @return EE_Line_Item
2067
+	 * @throws EE_Error
2068
+	 * @throws InvalidArgumentException
2069
+	 * @throws InvalidDataTypeException
2070
+	 * @throws InvalidInterfaceException
2071
+	 * @throws ReflectionException
2072
+	 */
2073
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = null)
2074
+	{
2075
+		EE_Error::doing_it_wrong(
2076
+			'EEH_Line_Item::create_default_event_subtotal()',
2077
+			sprintf(
2078
+				esc_html__('Method replaced with %1$s', 'event_espresso'),
2079
+				'EEH_Line_Item::create_event_subtotal()'
2080
+			),
2081
+			'4.6.0'
2082
+		);
2083
+		return self::create_event_subtotal($total_line_item, $transaction);
2084
+	}
2085 2085
 }
Please login to merge, or discard this patch.
languages/event_espresso-translations-js.php 1 patch
Spacing   +699 added lines, -699 removed lines patch added patch discarded remove patch
@@ -2,137 +2,137 @@  discard block
 block discarded – undo
2 2
 /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
3 3
 $generated_i18n_strings = array(
4 4
 	// Reference: packages/ui-components/src/Pagination/constants.ts:6
5
-	__( '2', 'event_espresso' ),
5
+	__('2', 'event_espresso'),
6 6
 
7 7
 	// Reference: packages/ui-components/src/Pagination/constants.ts:7
8
-	__( '6', 'event_espresso' ),
8
+	__('6', 'event_espresso'),
9 9
 
10 10
 	// Reference: packages/ui-components/src/Pagination/constants.ts:8
11
-	__( '12', 'event_espresso' ),
11
+	__('12', 'event_espresso'),
12 12
 
13 13
 	// Reference: packages/ui-components/src/Pagination/constants.ts:9
14
-	__( '24', 'event_espresso' ),
14
+	__('24', 'event_espresso'),
15 15
 
16 16
 	// Reference: packages/ui-components/src/Pagination/constants.ts:10
17
-	__( '48', 'event_espresso' ),
17
+	__('48', 'event_espresso'),
18 18
 
19 19
 	// Reference: domains/core/admin/blocks/src/components/AvatarImage.tsx:27
20
-	__( 'contact avatar', 'event_espresso' ),
20
+	__('contact avatar', 'event_espresso'),
21 21
 
22 22
 	// Reference: domains/core/admin/blocks/src/components/OrderByControl.tsx:12
23
-	__( 'Order by', 'event_espresso' ),
23
+	__('Order by', 'event_espresso'),
24 24
 
25 25
 	// Reference: domains/core/admin/blocks/src/components/RegStatusControl.tsx:17
26 26
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectStatus.tsx:13
27
-	__( 'Select Registration Status', 'event_espresso' ),
27
+	__('Select Registration Status', 'event_espresso'),
28 28
 
29 29
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:14
30
-	__( 'Ascending', 'event_espresso' ),
30
+	__('Ascending', 'event_espresso'),
31 31
 
32 32
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:18
33
-	__( 'Descending', 'event_espresso' ),
33
+	__('Descending', 'event_espresso'),
34 34
 
35 35
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:24
36
-	__( 'Sort order:', 'event_espresso' ),
36
+	__('Sort order:', 'event_espresso'),
37 37
 
38 38
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:41
39
-	__( 'There was some error fetching attendees list', 'event_espresso' ),
39
+	__('There was some error fetching attendees list', 'event_espresso'),
40 40
 
41 41
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:47
42
-	__( 'To get started, select what event you want to show attendees from in the block settings.', 'event_espresso' ),
42
+	__('To get started, select what event you want to show attendees from in the block settings.', 'event_espresso'),
43 43
 
44 44
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:53
45
-	__( 'There are no attendees for selected options.', 'event_espresso' ),
45
+	__('There are no attendees for selected options.', 'event_espresso'),
46 46
 
47 47
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:12
48
-	__( 'Display on Archives', 'event_espresso' ),
48
+	__('Display on Archives', 'event_espresso'),
49 49
 
50 50
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:17
51
-	__( 'Attendees are shown whenever this post is listed in an archive view.', 'event_espresso' ),
51
+	__('Attendees are shown whenever this post is listed in an archive view.', 'event_espresso'),
52 52
 
53 53
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:18
54
-	__( 'Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso' ),
54
+	__('Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso'),
55 55
 
56 56
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:29
57
-	__( 'Number of Attendees to Display:', 'event_espresso' ),
57
+	__('Number of Attendees to Display:', 'event_espresso'),
58 58
 
59 59
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:34
60 60
 	/* translators: %d attendees count */
61
-	_n_noop( 'Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso' ),
61
+	_n_noop('Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso'),
62 62
 
63 63
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:27
64
-	__( 'Display Gravatar', 'event_espresso' ),
64
+	__('Display Gravatar', 'event_espresso'),
65 65
 
66 66
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:32
67
-	__( 'Gravatar images are shown for each attendee.', 'event_espresso' ),
67
+	__('Gravatar images are shown for each attendee.', 'event_espresso'),
68 68
 
69 69
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:33
70
-	__( 'No gravatar images are shown for each attendee.', 'event_espresso' ),
70
+	__('No gravatar images are shown for each attendee.', 'event_espresso'),
71 71
 
72 72
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:38
73
-	__( 'Size of Gravatar', 'event_espresso' ),
73
+	__('Size of Gravatar', 'event_espresso'),
74 74
 
75 75
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectDatetime.tsx:22
76
-	__( 'Select Datetime', 'event_espresso' ),
76
+	__('Select Datetime', 'event_espresso'),
77 77
 
78 78
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectEvent.tsx:22
79 79
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectEvent.tsx:22
80
-	__( 'Select Event', 'event_espresso' ),
80
+	__('Select Event', 'event_espresso'),
81 81
 
82 82
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:11
83
-	__( 'Attendee id', 'event_espresso' ),
83
+	__('Attendee id', 'event_espresso'),
84 84
 
85 85
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:15
86
-	__( 'Last name only', 'event_espresso' ),
86
+	__('Last name only', 'event_espresso'),
87 87
 
88 88
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:19
89
-	__( 'First name only', 'event_espresso' ),
89
+	__('First name only', 'event_espresso'),
90 90
 
91 91
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:23
92
-	__( 'First, then Last name', 'event_espresso' ),
92
+	__('First, then Last name', 'event_espresso'),
93 93
 
94 94
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:27
95
-	__( 'Last, then First name', 'event_espresso' ),
95
+	__('Last, then First name', 'event_espresso'),
96 96
 
97 97
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:41
98
-	__( 'Order Attendees by:', 'event_espresso' ),
98
+	__('Order Attendees by:', 'event_espresso'),
99 99
 
100 100
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectTicket.tsx:22
101
-	__( 'Select Ticket', 'event_espresso' ),
101
+	__('Select Ticket', 'event_espresso'),
102 102
 
103 103
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:21
104
-	__( 'Filter By Settings', 'event_espresso' ),
104
+	__('Filter By Settings', 'event_espresso'),
105 105
 
106 106
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:36
107
-	__( 'Gravatar Setttings', 'event_espresso' ),
107
+	__('Gravatar Setttings', 'event_espresso'),
108 108
 
109 109
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:39
110
-	__( 'Archive Settings', 'event_espresso' ),
110
+	__('Archive Settings', 'event_espresso'),
111 111
 
112 112
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:10
113
-	__( 'Event Attendees', 'event_espresso' ),
113
+	__('Event Attendees', 'event_espresso'),
114 114
 
115 115
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:11
116
-	__( 'Displays a list of people that have registered for the specified event', 'event_espresso' ),
116
+	__('Displays a list of people that have registered for the specified event', 'event_espresso'),
117 117
 
118 118
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
119 119
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:12
120 120
 	// Reference: packages/edtr-services/src/constants.ts:25
121
-	__( 'event', 'event_espresso' ),
121
+	__('event', 'event_espresso'),
122 122
 
123 123
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
124
-	__( 'attendees', 'event_espresso' ),
124
+	__('attendees', 'event_espresso'),
125 125
 
126 126
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
127
-	__( 'list', 'event_espresso' ),
127
+	__('list', 'event_espresso'),
128 128
 
129 129
 	// Reference: domains/core/admin/blocks/src/event/DisplayField.tsx:41
130
-	__( 'An unknown error occurred while fetching event details.', 'event_espresso' ),
130
+	__('An unknown error occurred while fetching event details.', 'event_espresso'),
131 131
 
132 132
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:10
133 133
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:24
134 134
 	// Reference: packages/utils/src/list/index.ts:14
135
-	__( 'Select…', 'event_espresso' ),
135
+	__('Select…', 'event_espresso'),
136 136
 
137 137
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:15
138 138
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:75
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:97
142 142
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:49
143 143
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:40
144
-	__( 'Name', 'event_espresso' ),
144
+	__('Name', 'event_espresso'),
145 145
 
146 146
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:19
147 147
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:80
@@ -149,398 +149,398 @@  discard block
 block discarded – undo
149 149
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:102
150 150
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:55
151 151
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:47
152
-	__( 'Description', 'event_espresso' ),
152
+	__('Description', 'event_espresso'),
153 153
 
154 154
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:23
155
-	__( 'Short description', 'event_espresso' ),
155
+	__('Short description', 'event_espresso'),
156 156
 
157 157
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:35
158
-	__( 'Select Field', 'event_espresso' ),
158
+	__('Select Field', 'event_espresso'),
159 159
 
160 160
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:27
161
-	__( 'Text Color', 'event_espresso' ),
161
+	__('Text Color', 'event_espresso'),
162 162
 
163 163
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:32
164
-	__( 'Background Color', 'event_espresso' ),
164
+	__('Background Color', 'event_espresso'),
165 165
 
166 166
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:41
167 167
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:22
168 168
 	// Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:21
169
-	__( 'Settings', 'event_espresso' ),
169
+	__('Settings', 'event_espresso'),
170 170
 
171 171
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:45
172
-	__( 'Typography', 'event_espresso' ),
172
+	__('Typography', 'event_espresso'),
173 173
 
174 174
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:48
175
-	__( 'Color', 'event_espresso' ),
175
+	__('Color', 'event_espresso'),
176 176
 
177 177
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:12
178
-	__( 'field', 'event_espresso' ),
178
+	__('field', 'event_espresso'),
179 179
 
180 180
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:8
181
-	__( 'Event Field', 'event_espresso' ),
181
+	__('Event Field', 'event_espresso'),
182 182
 
183 183
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:9
184
-	__( 'Displays the selected field of an event', 'event_espresso' ),
184
+	__('Displays the selected field of an event', 'event_espresso'),
185 185
 
186 186
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:17
187
-	__( 'Error', 'event_espresso' ),
187
+	__('Error', 'event_espresso'),
188 188
 
189 189
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:9
190
-	__( 'Loading…', 'event_espresso' ),
190
+	__('Loading…', 'event_espresso'),
191 191
 
192 192
 	// Reference: domains/core/admin/eventEditor/src/ui/EventDescription.tsx:33
193
-	__( 'Event Description', 'event_espresso' ),
193
+	__('Event Description', 'event_espresso'),
194 194
 
195 195
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/ActiveStatus.tsx:29
196
-	__( 'Active status', 'event_espresso' ),
196
+	__('Active status', 'event_espresso'),
197 197
 
198 198
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/AltRegPage.tsx:12
199
-	__( 'Alternative Registration Page', 'event_espresso' ),
199
+	__('Alternative Registration Page', 'event_espresso'),
200 200
 
201 201
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/DefaultRegistrationStatus.tsx:26
202
-	__( 'Default Registration Status', 'event_espresso' ),
202
+	__('Default Registration Status', 'event_espresso'),
203 203
 
204 204
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8
205
-	__( 'Donations Enabled', 'event_espresso' ),
205
+	__('Donations Enabled', 'event_espresso'),
206 206
 
207 207
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8
208
-	__( 'Donations Disabled', 'event_espresso' ),
208
+	__('Donations Disabled', 'event_espresso'),
209 209
 
210 210
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventManager.tsx:16
211
-	__( 'Event Manager', 'event_espresso' ),
211
+	__('Event Manager', 'event_espresso'),
212 212
 
213 213
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventPhoneNumber.tsx:15
214
-	__( 'Event Phone Number', 'event_espresso' ),
214
+	__('Event Phone Number', 'event_espresso'),
215 215
 
216 216
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/MaxRegistrations.tsx:13
217
-	__( 'Max Registrations per Transaction', 'event_espresso' ),
217
+	__('Max Registrations per Transaction', 'event_espresso'),
218 218
 
219 219
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8
220
-	__( 'Ticket Selector Enabled', 'event_espresso' ),
220
+	__('Ticket Selector Enabled', 'event_espresso'),
221 221
 
222 222
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8
223
-	__( 'Ticket Selector Disabled', 'event_espresso' ),
223
+	__('Ticket Selector Disabled', 'event_espresso'),
224 224
 
225 225
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:41
226
-	__( 'Event Details', 'event_espresso' ),
226
+	__('Event Details', 'event_espresso'),
227 227
 
228 228
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:47
229
-	__( 'Registration Options', 'event_espresso' ),
229
+	__('Registration Options', 'event_espresso'),
230 230
 
231 231
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/DateRegistrationsLink.tsx:13
232
-	__( 'view ALL registrations for this date.', 'event_espresso' ),
232
+	__('view ALL registrations for this date.', 'event_espresso'),
233 233
 
234 234
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10
235
-	__( 'primary information about the date', 'event_espresso' ),
235
+	__('primary information about the date', 'event_espresso'),
236 236
 
237 237
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10
238
-	__( 'Date Details', 'event_espresso' ),
238
+	__('Date Details', 'event_espresso'),
239 239
 
240 240
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
241 241
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16
242 242
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16
243
-	__( 'relations between tickets and dates', 'event_espresso' ),
243
+	__('relations between tickets and dates', 'event_espresso'),
244 244
 
245 245
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
246
-	__( 'Assign Tickets', 'event_espresso' ),
246
+	__('Assign Tickets', 'event_espresso'),
247 247
 
248 248
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/FooterButtons.tsx:22
249
-	__( 'Save and assign tickets', 'event_espresso' ),
249
+	__('Save and assign tickets', 'event_espresso'),
250 250
 
251 251
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:27
252 252
 	/* translators: %s datetime id */
253
-	__( 'Edit datetime %s', 'event_espresso' ),
253
+	__('Edit datetime %s', 'event_espresso'),
254 254
 
255 255
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:30
256
-	__( 'New Datetime', 'event_espresso' ),
256
+	__('New Datetime', 'event_espresso'),
257 257
 
258 258
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:110
259 259
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:108
260 260
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:132
261 261
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:108
262
-	__( 'Details', 'event_espresso' ),
262
+	__('Details', 'event_espresso'),
263 263
 
264 264
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:114
265 265
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:112
266 266
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:81
267
-	__( 'Capacity', 'event_espresso' ),
267
+	__('Capacity', 'event_espresso'),
268 268
 
269 269
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:119
270
-	__( 'The maximum number of registrants that can attend the event at this particular date.', 'event_espresso' ),
270
+	__('The maximum number of registrants that can attend the event at this particular date.', 'event_espresso'),
271 271
 
272 272
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:123
273
-	__( 'Set to 0 to close registration or leave blank for no limit.', 'event_espresso' ),
273
+	__('Set to 0 to close registration or leave blank for no limit.', 'event_espresso'),
274 274
 
275 275
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:129
276 276
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:209
277
-	__( 'Trash', 'event_espresso' ),
277
+	__('Trash', 'event_espresso'),
278 278
 
279 279
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:71
280 280
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:45
281 281
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:93
282 282
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:45
283
-	__( 'Basics', 'event_espresso' ),
283
+	__('Basics', 'event_espresso'),
284 284
 
285 285
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:88
286 286
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:63
287 287
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:63
288
-	__( 'Dates', 'event_espresso' ),
288
+	__('Dates', 'event_espresso'),
289 289
 
290 290
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:92
291 291
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:51
292 292
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:114
293
-	__( 'Start Date', 'event_espresso' ),
293
+	__('Start Date', 'event_espresso'),
294 294
 
295 295
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:99
296 296
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:65
297 297
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:121
298
-	__( 'End Date', 'event_espresso' ),
298
+	__('End Date', 'event_espresso'),
299 299
 
300 300
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:35
301 301
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/TableView.tsx:33
302
-	__( 'Event Dates', 'event_espresso' ),
302
+	__('Event Dates', 'event_espresso'),
303 303
 
304 304
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:38
305
-	__( 'loading event dates…', 'event_espresso' ),
305
+	__('loading event dates…', 'event_espresso'),
306 306
 
307 307
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:20
308
-	__( 'Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso' ),
308
+	__('Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso'),
309 309
 
310 310
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:30
311
-	__( 'Ticket Assignments', 'event_espresso' ),
311
+	__('Ticket Assignments', 'event_espresso'),
312 312
 
313 313
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:25
314
-	__( 'Number of related tickets', 'event_espresso' ),
314
+	__('Number of related tickets', 'event_espresso'),
315 315
 
316 316
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:26
317
-	__( 'There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso' ),
317
+	__('There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso'),
318 318
 
319 319
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:34
320
-	__( 'assign tickets', 'event_espresso' ),
320
+	__('assign tickets', 'event_espresso'),
321 321
 
322 322
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:25
323
-	__( 'Permanently delete Datetime?', 'event_espresso' ),
323
+	__('Permanently delete Datetime?', 'event_espresso'),
324 324
 
325 325
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:25
326
-	__( 'Move Datetime to Trash?', 'event_espresso' ),
326
+	__('Move Datetime to Trash?', 'event_espresso'),
327 327
 
328 328
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:27
329
-	__( 'Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso' ),
329
+	__('Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso'),
330 330
 
331 331
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:30
332
-	__( 'Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso' ),
332
+	__('Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso'),
333 333
 
334 334
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:39
335 335
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:44
336
-	__( 'delete permanently', 'event_espresso' ),
336
+	__('delete permanently', 'event_espresso'),
337 337
 
338 338
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:39
339
-	__( 'trash datetime', 'event_espresso' ),
339
+	__('trash datetime', 'event_espresso'),
340 340
 
341 341
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:45
342
-	__( 'event date main menu', 'event_espresso' ),
342
+	__('event date main menu', 'event_espresso'),
343 343
 
344 344
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:59
345
-	__( 'edit datetime', 'event_espresso' ),
345
+	__('edit datetime', 'event_espresso'),
346 346
 
347 347
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:60
348
-	__( 'copy datetime', 'event_espresso' ),
348
+	__('copy datetime', 'event_espresso'),
349 349
 
350 350
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:36
351 351
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:39
352 352
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:43
353
-	__( 'bulk actions', 'event_espresso' ),
353
+	__('bulk actions', 'event_espresso'),
354 354
 
355 355
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:40
356
-	__( 'edit datetime details', 'event_espresso' ),
356
+	__('edit datetime details', 'event_espresso'),
357 357
 
358 358
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:44
359
-	__( 'delete datetimes', 'event_espresso' ),
359
+	__('delete datetimes', 'event_espresso'),
360 360
 
361 361
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:44
362
-	__( 'trash datetimes', 'event_espresso' ),
362
+	__('trash datetimes', 'event_espresso'),
363 363
 
364 364
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:14
365
-	__( 'Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso' ),
365
+	__('Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso'),
366 366
 
367 367
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15
368
-	__( 'Are you sure you want to trash these datetimes?', 'event_espresso' ),
368
+	__('Are you sure you want to trash these datetimes?', 'event_espresso'),
369 369
 
370 370
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16
371
-	__( 'Delete datetimes permanently', 'event_espresso' ),
371
+	__('Delete datetimes permanently', 'event_espresso'),
372 372
 
373 373
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16
374
-	__( 'Trash datetimes', 'event_espresso' ),
374
+	__('Trash datetimes', 'event_espresso'),
375 375
 
376 376
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:21
377
-	__( 'Bulk edit date details', 'event_espresso' ),
377
+	__('Bulk edit date details', 'event_espresso'),
378 378
 
379 379
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:22
380
-	__( 'any changes will be applied to ALL of the selected dates.', 'event_espresso' ),
380
+	__('any changes will be applied to ALL of the selected dates.', 'event_espresso'),
381 381
 
382 382
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/formValidation.ts:12
383 383
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/formValidation.ts:12
384
-	__( 'Name must be at least three characters', 'event_espresso' ),
384
+	__('Name must be at least three characters', 'event_espresso'),
385 385
 
386 386
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:67
387 387
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:67
388
-	__( 'Shift dates', 'event_espresso' ),
388
+	__('Shift dates', 'event_espresso'),
389 389
 
390 390
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:92
391 391
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:92
392
-	__( 'earlier', 'event_espresso' ),
392
+	__('earlier', 'event_espresso'),
393 393
 
394 394
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:96
395 395
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:96
396
-	__( 'later', 'event_espresso' ),
396
+	__('later', 'event_espresso'),
397 397
 
398 398
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCapacity.tsx:31
399 399
 	/* translators: click to edit capacity<linebreak>(registration limit)… */
400
-	__( 'click to edit capacity%s(registration limit)…', 'event_espresso' ),
400
+	__('click to edit capacity%s(registration limit)…', 'event_espresso'),
401 401
 
402 402
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:31
403 403
 	// Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:27
404 404
 	// Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:34
405
-	__( 'starts', 'event_espresso' ),
405
+	__('starts', 'event_espresso'),
406 406
 
407 407
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
408 408
 	// Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:34
409 409
 	// Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:47
410
-	__( 'ends', 'event_espresso' ),
410
+	__('ends', 'event_espresso'),
411 411
 
412 412
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
413
-	__( 'started', 'event_espresso' ),
413
+	__('started', 'event_espresso'),
414 414
 
415 415
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
416
-	__( 'ended', 'event_espresso' ),
416
+	__('ended', 'event_espresso'),
417 417
 
418 418
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:46
419
-	__( 'Edit Event Date', 'event_espresso' ),
419
+	__('Edit Event Date', 'event_espresso'),
420 420
 
421 421
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:50
422
-	__( 'edit start and end dates', 'event_espresso' ),
422
+	__('edit start and end dates', 'event_espresso'),
423 423
 
424 424
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:15
425 425
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:15
426
-	__( 'sold', 'event_espresso' ),
426
+	__('sold', 'event_espresso'),
427 427
 
428 428
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:28
429
-	__( 'capacity', 'event_espresso' ),
429
+	__('capacity', 'event_espresso'),
430 430
 
431 431
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:34
432 432
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:33
433
-	__( 'reg list', 'event_espresso' ),
433
+	__('reg list', 'event_espresso'),
434 434
 
435 435
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:52
436 436
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:44
437
-	__( 'add description…', 'event_espresso' ),
437
+	__('add description…', 'event_espresso'),
438 438
 
439 439
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:53
440 440
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:45
441
-	__( 'Edit description', 'event_espresso' ),
441
+	__('Edit description', 'event_espresso'),
442 442
 
443 443
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:54
444 444
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:46
445
-	__( 'click to edit description…', 'event_espresso' ),
445
+	__('click to edit description…', 'event_espresso'),
446 446
 
447 447
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:10
448
-	__( 'Move Date to Trash', 'event_espresso' ),
448
+	__('Move Date to Trash', 'event_espresso'),
449 449
 
450 450
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:13
451 451
 	// Reference: packages/constants/src/datetime.ts:6
452
-	__( 'Active', 'event_espresso' ),
452
+	__('Active', 'event_espresso'),
453 453
 
454 454
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:14
455 455
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:13
456
-	__( 'Trashed', 'event_espresso' ),
456
+	__('Trashed', 'event_espresso'),
457 457
 
458 458
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:15
459 459
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:14
460 460
 	// Reference: packages/constants/src/datetime.ts:8
461
-	__( 'Expired', 'event_espresso' ),
461
+	__('Expired', 'event_espresso'),
462 462
 
463 463
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:16
464 464
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:16
465
-	__( 'Sold Out', 'event_espresso' ),
465
+	__('Sold Out', 'event_espresso'),
466 466
 
467 467
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:17
468 468
 	// Reference: packages/constants/src/datetime.ts:12
469
-	__( 'Upcoming', 'event_espresso' ),
469
+	__('Upcoming', 'event_espresso'),
470 470
 
471 471
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:7
472
-	__( 'Edit Event Date Details', 'event_espresso' ),
472
+	__('Edit Event Date Details', 'event_espresso'),
473 473
 
474 474
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:8
475
-	__( 'View Registrations for this Date', 'event_espresso' ),
475
+	__('View Registrations for this Date', 'event_espresso'),
476 476
 
477 477
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:9
478
-	__( 'Manage Ticket Assignments', 'event_espresso' ),
478
+	__('Manage Ticket Assignments', 'event_espresso'),
479 479
 
480 480
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:41
481 481
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:41
482
-	__( 'click to edit title…', 'event_espresso' ),
482
+	__('click to edit title…', 'event_espresso'),
483 483
 
484 484
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:42
485 485
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:42
486
-	__( 'add title…', 'event_espresso' ),
486
+	__('add title…', 'event_espresso'),
487 487
 
488 488
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/ActiveDatesFilters.tsx:17
489 489
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/ActiveTicketsFilters.tsx:17
490
-	__( 'ON', 'event_espresso' ),
490
+	__('ON', 'event_espresso'),
491 491
 
492 492
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:10
493
-	__( 'end dates only', 'event_espresso' ),
493
+	__('end dates only', 'event_espresso'),
494 494
 
495 495
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:11
496
-	__( 'start and end dates', 'event_espresso' ),
496
+	__('start and end dates', 'event_espresso'),
497 497
 
498 498
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:16
499
-	__( 'dates above 90% capacity', 'event_espresso' ),
499
+	__('dates above 90% capacity', 'event_espresso'),
500 500
 
501 501
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:17
502
-	__( 'dates above 75% capacity', 'event_espresso' ),
502
+	__('dates above 75% capacity', 'event_espresso'),
503 503
 
504 504
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:18
505
-	__( 'dates above 50% capacity', 'event_espresso' ),
505
+	__('dates above 50% capacity', 'event_espresso'),
506 506
 
507 507
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:19
508
-	__( 'dates below 50% capacity', 'event_espresso' ),
508
+	__('dates below 50% capacity', 'event_espresso'),
509 509
 
510 510
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:23
511
-	__( 'all dates', 'event_espresso' ),
511
+	__('all dates', 'event_espresso'),
512 512
 
513 513
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:24
514
-	__( 'all active and upcoming', 'event_espresso' ),
514
+	__('all active and upcoming', 'event_espresso'),
515 515
 
516 516
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:25
517
-	__( 'active dates only', 'event_espresso' ),
517
+	__('active dates only', 'event_espresso'),
518 518
 
519 519
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:26
520
-	__( 'upcoming dates only', 'event_espresso' ),
520
+	__('upcoming dates only', 'event_espresso'),
521 521
 
522 522
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:27
523
-	__( 'next active or upcoming only', 'event_espresso' ),
523
+	__('next active or upcoming only', 'event_espresso'),
524 524
 
525 525
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:28
526
-	__( 'sold out dates only', 'event_espresso' ),
526
+	__('sold out dates only', 'event_espresso'),
527 527
 
528 528
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:29
529
-	__( 'recently expired dates', 'event_espresso' ),
529
+	__('recently expired dates', 'event_espresso'),
530 530
 
531 531
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:30
532
-	__( 'all expired dates', 'event_espresso' ),
532
+	__('all expired dates', 'event_espresso'),
533 533
 
534 534
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:31
535
-	__( 'trashed dates only', 'event_espresso' ),
535
+	__('trashed dates only', 'event_espresso'),
536 536
 
537 537
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:35
538 538
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:9
539 539
 	// Reference: packages/dates/src/components/DateRangePicker/index.tsx:61
540
-	__( 'start date', 'event_espresso' ),
540
+	__('start date', 'event_espresso'),
541 541
 
542 542
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:36
543
-	__( 'name', 'event_espresso' ),
543
+	__('name', 'event_espresso'),
544 544
 
545 545
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:37
546 546
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:31
@@ -548,182 +548,182 @@  discard block
 block discarded – undo
548 548
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/HeaderCell.tsx:27
549 549
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:31
550 550
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:23
551
-	__( 'ID', 'event_espresso' ),
551
+	__('ID', 'event_espresso'),
552 552
 
553 553
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:38
554 554
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:47
555
-	__( 'custom order', 'event_espresso' ),
555
+	__('custom order', 'event_espresso'),
556 556
 
557 557
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:42
558 558
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:51
559
-	__( 'display', 'event_espresso' ),
559
+	__('display', 'event_espresso'),
560 560
 
561 561
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:43
562
-	__( 'recurrence', 'event_espresso' ),
562
+	__('recurrence', 'event_espresso'),
563 563
 
564 564
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:44
565 565
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:53
566
-	__( 'sales', 'event_espresso' ),
566
+	__('sales', 'event_espresso'),
567 567
 
568 568
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:45
569 569
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:55
570
-	__( 'sort by', 'event_espresso' ),
570
+	__('sort by', 'event_espresso'),
571 571
 
572 572
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:46
573 573
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:54
574 574
 	// Reference: packages/ee-components/src/EntityList/EntityListFilterBar.tsx:46
575
-	__( 'search', 'event_espresso' ),
575
+	__('search', 'event_espresso'),
576 576
 
577 577
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:47
578 578
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:56
579
-	__( 'status', 'event_espresso' ),
579
+	__('status', 'event_espresso'),
580 580
 
581 581
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:9
582
-	__( 'start dates only', 'event_espresso' ),
582
+	__('start dates only', 'event_espresso'),
583 583
 
584 584
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26
585 585
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/NewDateModal.tsx:12
586 586
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/OptionsModalButton.tsx:16
587
-	__( 'Add New Date', 'event_espresso' ),
587
+	__('Add New Date', 'event_espresso'),
588 588
 
589 589
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26
590
-	__( 'Add Single Date', 'event_espresso' ),
590
+	__('Add Single Date', 'event_espresso'),
591 591
 
592 592
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:44
593
-	__( 'Add a single date that only occurs once', 'event_espresso' ),
593
+	__('Add a single date that only occurs once', 'event_espresso'),
594 594
 
595 595
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:46
596
-	__( 'Single Date', 'event_espresso' ),
596
+	__('Single Date', 'event_espresso'),
597 597
 
598 598
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:106
599
-	__( 'Reg list', 'event_espresso' ),
599
+	__('Reg list', 'event_espresso'),
600 600
 
601 601
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:107
602 602
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:111
603
-	__( 'Regs', 'event_espresso' ),
603
+	__('Regs', 'event_espresso'),
604 604
 
605 605
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:122
606 606
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:126
607 607
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:59
608
-	__( 'Actions', 'event_espresso' ),
608
+	__('Actions', 'event_espresso'),
609 609
 
610 610
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:52
611
-	__( 'Start', 'event_espresso' ),
611
+	__('Start', 'event_espresso'),
612 612
 
613 613
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:66
614
-	__( 'End', 'event_espresso' ),
614
+	__('End', 'event_espresso'),
615 615
 
616 616
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:82
617
-	__( 'Cap', 'event_espresso' ),
617
+	__('Cap', 'event_espresso'),
618 618
 
619 619
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:94
620 620
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:98
621
-	__( 'Sold', 'event_espresso' ),
621
+	__('Sold', 'event_espresso'),
622 622
 
623 623
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:33
624 624
 	// Reference: packages/form-builder/src/constants.ts:67
625
-	__( 'Text Input', 'event_espresso' ),
625
+	__('Text Input', 'event_espresso'),
626 626
 
627 627
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:34
628 628
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:32
629
-	__( 'Attendee First Name', 'event_espresso' ),
629
+	__('Attendee First Name', 'event_espresso'),
630 630
 
631 631
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:39
632 632
 	/* translators: field name */
633
-	__( 'Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso' ),
633
+	__('Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso'),
634 634
 
635 635
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:40
636 636
 	// Reference: packages/form-builder/src/constants.ts:82
637
-	__( 'Email Address', 'event_espresso' ),
637
+	__('Email Address', 'event_espresso'),
638 638
 
639 639
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:41
640 640
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:40
641
-	__( 'Attendee Email Address', 'event_espresso' ),
641
+	__('Attendee Email Address', 'event_espresso'),
642 642
 
643 643
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:49
644
-	__( 'Please add the required fields', 'event_espresso' ),
644
+	__('Please add the required fields', 'event_espresso'),
645 645
 
646 646
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/RegistrationForm.tsx:12
647
-	__( 'Registration Form', 'event_espresso' ),
647
+	__('Registration Form', 'event_espresso'),
648 648
 
649 649
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:13
650
-	__( 'primary registrant', 'event_espresso' ),
650
+	__('primary registrant', 'event_espresso'),
651 651
 
652 652
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:17
653
-	__( 'purchaser', 'event_espresso' ),
653
+	__('purchaser', 'event_espresso'),
654 654
 
655 655
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:21
656
-	__( 'registrants', 'event_espresso' ),
656
+	__('registrants', 'event_espresso'),
657 657
 
658 658
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:36
659
-	__( 'Attendee Last Name', 'event_espresso' ),
659
+	__('Attendee Last Name', 'event_espresso'),
660 660
 
661 661
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:44
662
-	__( 'Attendee Address', 'event_espresso' ),
662
+	__('Attendee Address', 'event_espresso'),
663 663
 
664 664
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:9
665
-	__( 'all', 'event_espresso' ),
665
+	__('all', 'event_espresso'),
666 666
 
667 667
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:18
668
-	__( 'Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. 
669
-Please correct the assignments for the highlighted cells.', 'event_espresso' ),
668
+	__('Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. 
669
+Please correct the assignments for the highlighted cells.', 'event_espresso'),
670 670
 
671 671
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:22
672
-	__( 'Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. 
673
-Please correct the assignments for the highlighted cells.', 'event_espresso' ),
672
+	__('Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. 
673
+Please correct the assignments for the highlighted cells.', 'event_espresso'),
674 674
 
675 675
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:32
676
-	__( 'Please Update Assignments', 'event_espresso' ),
676
+	__('Please Update Assignments', 'event_espresso'),
677 677
 
678 678
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:26
679
-	__( 'There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso' ),
679
+	__('There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso'),
680 680
 
681 681
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:29
682 682
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:74
683 683
 	// Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:21
684
-	__( 'Alert!', 'event_espresso' ),
684
+	__('Alert!', 'event_espresso'),
685 685
 
686 686
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:42
687 687
 	/* translators: 1 entity id, 2 entity name */
688
-	__( 'Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso' ),
688
+	__('Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso'),
689 689
 
690 690
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:49
691 691
 	/* translators: 1 entity id, 2 entity name */
692
-	__( 'Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso' ),
692
+	__('Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso'),
693 693
 
694 694
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal.tsx:28
695 695
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/Table.tsx:13
696
-	__( 'Ticket Assignment Manager', 'event_espresso' ),
696
+	__('Ticket Assignment Manager', 'event_espresso'),
697 697
 
698 698
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:10
699
-	__( 'existing relation', 'event_espresso' ),
699
+	__('existing relation', 'event_espresso'),
700 700
 
701 701
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:15
702
-	__( 'remove existing relation', 'event_espresso' ),
702
+	__('remove existing relation', 'event_espresso'),
703 703
 
704 704
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:20
705
-	__( 'add new relation', 'event_espresso' ),
705
+	__('add new relation', 'event_espresso'),
706 706
 
707 707
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:25
708
-	__( 'invalid relation', 'event_espresso' ),
708
+	__('invalid relation', 'event_espresso'),
709 709
 
710 710
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:29
711
-	__( 'no relation', 'event_espresso' ),
711
+	__('no relation', 'event_espresso'),
712 712
 
713 713
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/BodyCell.tsx:23
714
-	__( 'assign ticket', 'event_espresso' ),
714
+	__('assign ticket', 'event_espresso'),
715 715
 
716 716
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:15
717
-	__( 'Assignments', 'event_espresso' ),
717
+	__('Assignments', 'event_espresso'),
718 718
 
719 719
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:16
720
-	__( 'Event Dates are listed below', 'event_espresso' ),
720
+	__('Event Dates are listed below', 'event_espresso'),
721 721
 
722 722
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:17
723
-	__( 'Tickets are listed along the top', 'event_espresso' ),
723
+	__('Tickets are listed along the top', 'event_espresso'),
724 724
 
725 725
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:18
726
-	__( 'Click the cell buttons to toggle assigments', 'event_espresso' ),
726
+	__('Click the cell buttons to toggle assigments', 'event_espresso'),
727 727
 
728 728
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/useSubmitButtonProps.ts:29
729 729
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:16
@@ -732,1533 +732,1533 @@  discard block
 block discarded – undo
732 732
 	// Reference: packages/tpc/src/buttons/useSubmitButtonProps.tsx:29
733 733
 	// Reference: packages/ui-components/src/Modal/useSubmitButtonProps.tsx:13
734 734
 	// Reference: packages/ui-components/src/Stepper/buttons/Submit.tsx:7
735
-	__( 'Submit', 'event_espresso' ),
735
+	__('Submit', 'event_espresso'),
736 736
 
737 737
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:20
738
-	__( 'All Dates', 'event_espresso' ),
738
+	__('All Dates', 'event_espresso'),
739 739
 
740 740
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:27
741
-	__( 'dates by month', 'event_espresso' ),
741
+	__('dates by month', 'event_espresso'),
742 742
 
743 743
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowExpiredTicketsControl.tsx:16
744
-	__( 'show expired tickets', 'event_espresso' ),
744
+	__('show expired tickets', 'event_espresso'),
745 745
 
746 746
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedDatesControl.tsx:13
747
-	__( 'show trashed dates', 'event_espresso' ),
747
+	__('show trashed dates', 'event_espresso'),
748 748
 
749 749
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedTicketsControl.tsx:16
750
-	__( 'show trashed tickets', 'event_espresso' ),
750
+	__('show trashed tickets', 'event_espresso'),
751 751
 
752 752
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/TicketRegistrationsLink.tsx:13
753
-	__( 'total registrations.', 'event_espresso' ),
753
+	__('total registrations.', 'event_espresso'),
754 754
 
755 755
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/TicketRegistrationsLink.tsx:14
756
-	__( 'view ALL registrations for this ticket.', 'event_espresso' ),
756
+	__('view ALL registrations for this ticket.', 'event_espresso'),
757 757
 
758 758
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/Container.tsx:38
759 759
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actions/Actions.tsx:21
760
-	__( 'Default tickets', 'event_espresso' ),
760
+	__('Default tickets', 'event_espresso'),
761 761
 
762 762
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/ModalBody.tsx:63
763 763
 	// Reference: packages/edtr-services/src/constants.ts:26
764
-	__( 'ticket', 'event_espresso' ),
764
+	__('ticket', 'event_espresso'),
765 765
 
766 766
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:26
767 767
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:33
768
-	__( 'Set ticket prices', 'event_espresso' ),
768
+	__('Set ticket prices', 'event_espresso'),
769 769
 
770 770
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:31
771
-	__( 'Skip prices - Save', 'event_espresso' ),
771
+	__('Skip prices - Save', 'event_espresso'),
772 772
 
773 773
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:37
774 774
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:57
775
-	__( 'Ticket details', 'event_espresso' ),
775
+	__('Ticket details', 'event_espresso'),
776 776
 
777 777
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:38
778
-	__( 'Save', 'event_espresso' ),
778
+	__('Save', 'event_espresso'),
779 779
 
780 780
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:22
781 781
 	/* translators: %s ticket id */
782
-	__( 'Edit ticket %s', 'event_espresso' ),
782
+	__('Edit ticket %s', 'event_espresso'),
783 783
 
784 784
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:25
785 785
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:30
786
-	__( 'New Ticket Details', 'event_espresso' ),
786
+	__('New Ticket Details', 'event_espresso'),
787 787
 
788 788
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10
789 789
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10
790
-	__( 'primary information about the ticket', 'event_espresso' ),
790
+	__('primary information about the ticket', 'event_espresso'),
791 791
 
792 792
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10
793 793
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10
794
-	__( 'Ticket Details', 'event_espresso' ),
794
+	__('Ticket Details', 'event_espresso'),
795 795
 
796 796
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:12
797 797
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:12
798
-	__( 'apply ticket price modifiers and taxes', 'event_espresso' ),
798
+	__('apply ticket price modifiers and taxes', 'event_espresso'),
799 799
 
800 800
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:14
801 801
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:14
802
-	__( 'Price Calculator', 'event_espresso' ),
802
+	__('Price Calculator', 'event_espresso'),
803 803
 
804 804
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16
805 805
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16
806
-	__( 'Assign Dates', 'event_espresso' ),
806
+	__('Assign Dates', 'event_espresso'),
807 807
 
808 808
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:39
809
-	__( 'Skip prices - assign dates', 'event_espresso' ),
809
+	__('Skip prices - assign dates', 'event_espresso'),
810 810
 
811 811
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:50
812
-	__( 'Save and assign dates', 'event_espresso' ),
812
+	__('Save and assign dates', 'event_espresso'),
813 813
 
814 814
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:26
815 815
 	/* translators: 1 ticket name, 2 ticket id */
816
-	__( 'Edit ticket "%1$s" - %2$s', 'event_espresso' ),
816
+	__('Edit ticket "%1$s" - %2$s', 'event_espresso'),
817 817
 
818 818
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:110
819
-	__( 'Ticket Sales', 'event_espresso' ),
819
+	__('Ticket Sales', 'event_espresso'),
820 820
 
821 821
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:136
822 822
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:112
823
-	__( 'Quantity For Sale', 'event_espresso' ),
823
+	__('Quantity For Sale', 'event_espresso'),
824 824
 
825 825
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:142
826
-	__( 'The maximum number of this ticket available for sale.', 'event_espresso' ),
826
+	__('The maximum number of this ticket available for sale.', 'event_espresso'),
827 827
 
828 828
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:144
829
-	__( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ),
829
+	__('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'),
830 830
 
831 831
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:150
832 832
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:121
833
-	__( 'Number of Uses', 'event_espresso' ),
833
+	__('Number of Uses', 'event_espresso'),
834 834
 
835 835
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:156
836
-	__( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ),
836
+	__('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'),
837 837
 
838 838
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:160
839
-	__( 'Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso' ),
839
+	__('Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso'),
840 840
 
841 841
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:168
842 842
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:129
843
-	__( 'Minimum Quantity', 'event_espresso' ),
843
+	__('Minimum Quantity', 'event_espresso'),
844 844
 
845 845
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:173
846
-	__( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
846
+	__('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
847 847
 
848 848
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:177
849
-	__( 'Leave blank for no minimum.', 'event_espresso' ),
849
+	__('Leave blank for no minimum.', 'event_espresso'),
850 850
 
851 851
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:183
852 852
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:137
853
-	__( 'Maximum Quantity', 'event_espresso' ),
853
+	__('Maximum Quantity', 'event_espresso'),
854 854
 
855 855
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:189
856
-	__( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
856
+	__('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
857 857
 
858 858
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:193
859
-	__( 'Leave blank for no maximum.', 'event_espresso' ),
859
+	__('Leave blank for no maximum.', 'event_espresso'),
860 860
 
861 861
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:199
862 862
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:146
863
-	__( 'Required Ticket', 'event_espresso' ),
863
+	__('Required Ticket', 'event_espresso'),
864 864
 
865 865
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:201
866
-	__( 'If enabled, the ticket must be selected and will appear first in frontend ticket lists.', 'event_espresso' ),
866
+	__('If enabled, the ticket must be selected and will appear first in frontend ticket lists.', 'event_espresso'),
867 867
 
868 868
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:215
869
-	__( 'Visibility', 'event_espresso' ),
869
+	__('Visibility', 'event_espresso'),
870 870
 
871 871
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:217
872
-	__( 'Where the ticket can be viewed throughout the UI.', 'event_espresso' ),
872
+	__('Where the ticket can be viewed throughout the UI.', 'event_espresso'),
873 873
 
874 874
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:36
875
-	__( 'Available Tickets', 'event_espresso' ),
875
+	__('Available Tickets', 'event_espresso'),
876 876
 
877 877
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:39
878
-	__( 'loading tickets…', 'event_espresso' ),
878
+	__('loading tickets…', 'event_espresso'),
879 879
 
880 880
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:26
881
-	__( 'Number of related dates', 'event_espresso' ),
881
+	__('Number of related dates', 'event_espresso'),
882 882
 
883 883
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:27
884
-	__( 'There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso' ),
884
+	__('There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso'),
885 885
 
886 886
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:37
887
-	__( 'assign dates', 'event_espresso' ),
887
+	__('assign dates', 'event_espresso'),
888 888
 
889 889
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:18
890
-	__( 'Permanently delete Ticket?', 'event_espresso' ),
890
+	__('Permanently delete Ticket?', 'event_espresso'),
891 891
 
892 892
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:18
893
-	__( 'Move Ticket to Trash?', 'event_espresso' ),
893
+	__('Move Ticket to Trash?', 'event_espresso'),
894 894
 
895 895
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:21
896
-	__( 'Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso' ),
896
+	__('Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso'),
897 897
 
898 898
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:22
899
-	__( 'Are you sure you want to move this ticket to the trash? You can "untrash" this ticket later if you need to.', 'event_espresso' ),
899
+	__('Are you sure you want to move this ticket to the trash? You can "untrash" this ticket later if you need to.', 'event_espresso'),
900 900
 
901 901
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:44
902 902
 	// Reference: packages/ee-components/src/SimpleTicketCard/actions/Trash.tsx:6
903
-	__( 'trash ticket', 'event_espresso' ),
903
+	__('trash ticket', 'event_espresso'),
904 904
 
905 905
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:25
906
-	__( 'ticket main menu', 'event_espresso' ),
906
+	__('ticket main menu', 'event_espresso'),
907 907
 
908 908
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:38
909 909
 	// Reference: packages/ee-components/src/SimpleTicketCard/actions/Edit.tsx:15
910
-	__( 'edit ticket', 'event_espresso' ),
910
+	__('edit ticket', 'event_espresso'),
911 911
 
912 912
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:39
913
-	__( 'copy ticket', 'event_espresso' ),
913
+	__('copy ticket', 'event_espresso'),
914 914
 
915 915
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:43
916
-	__( 'edit ticket details', 'event_espresso' ),
916
+	__('edit ticket details', 'event_espresso'),
917 917
 
918 918
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47
919
-	__( 'delete tickets', 'event_espresso' ),
919
+	__('delete tickets', 'event_espresso'),
920 920
 
921 921
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47
922
-	__( 'trash tickets', 'event_espresso' ),
922
+	__('trash tickets', 'event_espresso'),
923 923
 
924 924
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:51
925
-	__( 'edit ticket prices', 'event_espresso' ),
925
+	__('edit ticket prices', 'event_espresso'),
926 926
 
927 927
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:14
928
-	__( 'Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso' ),
928
+	__('Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso'),
929 929
 
930 930
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15
931
-	__( 'Are you sure you want to trash these tickets?', 'event_espresso' ),
931
+	__('Are you sure you want to trash these tickets?', 'event_espresso'),
932 932
 
933 933
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16
934
-	__( 'Delete tickets permanently', 'event_espresso' ),
934
+	__('Delete tickets permanently', 'event_espresso'),
935 935
 
936 936
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16
937
-	__( 'Trash tickets', 'event_espresso' ),
937
+	__('Trash tickets', 'event_espresso'),
938 938
 
939 939
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:21
940
-	__( 'Bulk edit ticket details', 'event_espresso' ),
940
+	__('Bulk edit ticket details', 'event_espresso'),
941 941
 
942 942
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:22
943
-	__( 'any changes will be applied to ALL of the selected tickets.', 'event_espresso' ),
943
+	__('any changes will be applied to ALL of the selected tickets.', 'event_espresso'),
944 944
 
945 945
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/EditPrices.tsx:19
946
-	__( 'Bulk edit ticket prices', 'event_espresso' ),
946
+	__('Bulk edit ticket prices', 'event_espresso'),
947 947
 
948 948
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:20
949
-	__( 'Edit all prices together', 'event_espresso' ),
949
+	__('Edit all prices together', 'event_espresso'),
950 950
 
951 951
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:21
952
-	__( 'Edit all the selected ticket prices dynamically', 'event_espresso' ),
952
+	__('Edit all the selected ticket prices dynamically', 'event_espresso'),
953 953
 
954 954
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:25
955
-	__( 'Edit prices individually', 'event_espresso' ),
955
+	__('Edit prices individually', 'event_espresso'),
956 956
 
957 957
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:26
958
-	__( 'Edit prices for each ticket individually', 'event_espresso' ),
958
+	__('Edit prices for each ticket individually', 'event_espresso'),
959 959
 
960 960
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:14
961 961
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:34
962 962
 	// Reference: packages/form/src/ResetButton.tsx:18
963 963
 	// Reference: packages/tpc/src/buttons/useResetButtonProps.tsx:12
964
-	__( 'Reset', 'event_espresso' ),
964
+	__('Reset', 'event_espresso'),
965 965
 
966 966
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:15
967 967
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:76
968 968
 	// Reference: packages/ui-components/src/Modal/useCancelButtonProps.tsx:10
969
-	__( 'Cancel', 'event_espresso' ),
969
+	__('Cancel', 'event_espresso'),
970 970
 
971 971
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/editSeparately/TPCInstance.tsx:26
972 972
 	/* translators: %s ticket name */
973
-	__( 'Edit prices for Ticket: %s', 'event_espresso' ),
973
+	__('Edit prices for Ticket: %s', 'event_espresso'),
974 974
 
975 975
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:30
976
-	__( 'sales start', 'event_espresso' ),
976
+	__('sales start', 'event_espresso'),
977 977
 
978 978
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:33
979
-	__( 'sales began', 'event_espresso' ),
979
+	__('sales began', 'event_espresso'),
980 980
 
981 981
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:35
982
-	__( 'sales ended', 'event_espresso' ),
982
+	__('sales ended', 'event_espresso'),
983 983
 
984 984
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:36
985
-	__( 'sales end', 'event_espresso' ),
985
+	__('sales end', 'event_espresso'),
986 986
 
987 987
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:50
988
-	__( 'Edit Ticket Sale Dates', 'event_espresso' ),
988
+	__('Edit Ticket Sale Dates', 'event_espresso'),
989 989
 
990 990
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:54
991
-	__( 'edit ticket sales start and end dates', 'event_espresso' ),
991
+	__('edit ticket sales start and end dates', 'event_espresso'),
992 992
 
993 993
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:28
994
-	__( 'quantity', 'event_espresso' ),
994
+	__('quantity', 'event_espresso'),
995 995
 
996 996
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:28
997 997
 	// Reference: packages/edtr-services/src/apollo/mutations/tickets/useUpdateTicketQtyByCapacity.ts:78
998
-	__( 'Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso' ),
998
+	__('Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso'),
999 999
 
1000 1000
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:51
1001
-	__( 'edit quantity of tickets available…', 'event_espresso' ),
1001
+	__('edit quantity of tickets available…', 'event_espresso'),
1002 1002
 
1003 1003
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:10
1004
-	__( 'Move Ticket to Trash', 'event_espresso' ),
1004
+	__('Move Ticket to Trash', 'event_espresso'),
1005 1005
 
1006 1006
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:15
1007 1007
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:52
1008
-	__( 'On Sale', 'event_espresso' ),
1008
+	__('On Sale', 'event_espresso'),
1009 1009
 
1010 1010
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:17
1011
-	__( 'Pending', 'event_espresso' ),
1011
+	__('Pending', 'event_espresso'),
1012 1012
 
1013 1013
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:7
1014
-	__( 'Edit Ticket Details', 'event_espresso' ),
1014
+	__('Edit Ticket Details', 'event_espresso'),
1015 1015
 
1016 1016
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:8
1017
-	__( 'Manage Date Assignments', 'event_espresso' ),
1017
+	__('Manage Date Assignments', 'event_espresso'),
1018 1018
 
1019 1019
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:9
1020 1020
 	// Reference: packages/tpc/src/components/table/Table.tsx:43
1021
-	__( 'Ticket Price Calculator', 'event_espresso' ),
1021
+	__('Ticket Price Calculator', 'event_espresso'),
1022 1022
 
1023 1023
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:39
1024
-	__( 'edit ticket total…', 'event_espresso' ),
1024
+	__('edit ticket total…', 'event_espresso'),
1025 1025
 
1026 1026
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:53
1027
-	__( 'set price…', 'event_espresso' ),
1027
+	__('set price…', 'event_espresso'),
1028 1028
 
1029 1029
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:23
1030
-	__( 'tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso' ),
1030
+	__('tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso'),
1031 1031
 
1032 1032
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:24
1033
-	__( 'tickets list is unlinked and is showing tickets for all event dates', 'event_espresso' ),
1033
+	__('tickets list is unlinked and is showing tickets for all event dates', 'event_espresso'),
1034 1034
 
1035 1035
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:10
1036
-	__( 'ticket sales start and end dates', 'event_espresso' ),
1036
+	__('ticket sales start and end dates', 'event_espresso'),
1037 1037
 
1038 1038
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:15
1039
-	__( 'tickets with 90% or more sold', 'event_espresso' ),
1039
+	__('tickets with 90% or more sold', 'event_espresso'),
1040 1040
 
1041 1041
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:16
1042
-	__( 'tickets with 75% or more sold', 'event_espresso' ),
1042
+	__('tickets with 75% or more sold', 'event_espresso'),
1043 1043
 
1044 1044
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:17
1045
-	__( 'tickets with 50% or more sold', 'event_espresso' ),
1045
+	__('tickets with 50% or more sold', 'event_espresso'),
1046 1046
 
1047 1047
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:19
1048
-	__( 'tickets with less than 50% sold', 'event_espresso' ),
1048
+	__('tickets with less than 50% sold', 'event_espresso'),
1049 1049
 
1050 1050
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:28
1051
-	__( 'all tickets for all dates', 'event_espresso' ),
1051
+	__('all tickets for all dates', 'event_espresso'),
1052 1052
 
1053 1053
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:29
1054
-	__( 'all on sale and sale pending', 'event_espresso' ),
1054
+	__('all on sale and sale pending', 'event_espresso'),
1055 1055
 
1056 1056
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:30
1057
-	__( 'on sale tickets only', 'event_espresso' ),
1057
+	__('on sale tickets only', 'event_espresso'),
1058 1058
 
1059 1059
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:31
1060
-	__( 'sale pending tickets only', 'event_espresso' ),
1060
+	__('sale pending tickets only', 'event_espresso'),
1061 1061
 
1062 1062
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:32
1063
-	__( 'next on sale or sale pending only', 'event_espresso' ),
1063
+	__('next on sale or sale pending only', 'event_espresso'),
1064 1064
 
1065 1065
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:33
1066
-	__( 'sold out tickets only', 'event_espresso' ),
1066
+	__('sold out tickets only', 'event_espresso'),
1067 1067
 
1068 1068
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:34
1069
-	__( 'expired tickets only', 'event_espresso' ),
1069
+	__('expired tickets only', 'event_espresso'),
1070 1070
 
1071 1071
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:35
1072
-	__( 'trashed tickets only', 'event_espresso' ),
1072
+	__('trashed tickets only', 'event_espresso'),
1073 1073
 
1074 1074
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:40
1075
-	__( 'all tickets for above dates', 'event_espresso' ),
1075
+	__('all tickets for above dates', 'event_espresso'),
1076 1076
 
1077 1077
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:44
1078
-	__( 'ticket sale date', 'event_espresso' ),
1078
+	__('ticket sale date', 'event_espresso'),
1079 1079
 
1080 1080
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:45
1081
-	__( 'ticket name', 'event_espresso' ),
1081
+	__('ticket name', 'event_espresso'),
1082 1082
 
1083 1083
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:46
1084
-	__( 'ticket ID', 'event_espresso' ),
1084
+	__('ticket ID', 'event_espresso'),
1085 1085
 
1086 1086
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:52
1087
-	__( 'link', 'event_espresso' ),
1087
+	__('link', 'event_espresso'),
1088 1088
 
1089 1089
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:8
1090
-	__( 'ticket sales start date only', 'event_espresso' ),
1090
+	__('ticket sales start date only', 'event_espresso'),
1091 1091
 
1092 1092
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:9
1093
-	__( 'ticket sales end date only', 'event_espresso' ),
1093
+	__('ticket sales end date only', 'event_espresso'),
1094 1094
 
1095 1095
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:18
1096
-	__( 'Add New Ticket', 'event_espresso' ),
1096
+	__('Add New Ticket', 'event_espresso'),
1097 1097
 
1098 1098
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:32
1099
-	__( 'Add a single ticket and assign the dates to it', 'event_espresso' ),
1099
+	__('Add a single ticket and assign the dates to it', 'event_espresso'),
1100 1100
 
1101 1101
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:34
1102
-	__( 'Single Ticket', 'event_espresso' ),
1102
+	__('Single Ticket', 'event_espresso'),
1103 1103
 
1104 1104
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/TableView.tsx:39
1105
-	__( 'Tickets', 'event_espresso' ),
1105
+	__('Tickets', 'event_espresso'),
1106 1106
 
1107 1107
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:110
1108
-	__( 'Registrations', 'event_espresso' ),
1108
+	__('Registrations', 'event_espresso'),
1109 1109
 
1110 1110
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:51
1111
-	__( 'Goes on Sale', 'event_espresso' ),
1111
+	__('Goes on Sale', 'event_espresso'),
1112 1112
 
1113 1113
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:65
1114
-	__( 'Sale Ends', 'event_espresso' ),
1114
+	__('Sale Ends', 'event_espresso'),
1115 1115
 
1116 1116
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:66
1117
-	__( 'Ends', 'event_espresso' ),
1117
+	__('Ends', 'event_espresso'),
1118 1118
 
1119 1119
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:78
1120
-	__( 'Price', 'event_espresso' ),
1120
+	__('Price', 'event_espresso'),
1121 1121
 
1122 1122
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:88
1123
-	__( 'Quantity', 'event_espresso' ),
1123
+	__('Quantity', 'event_espresso'),
1124 1124
 
1125 1125
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:105
1126
-	__( 'Select a Venue for the Event', 'event_espresso' ),
1126
+	__('Select a Venue for the Event', 'event_espresso'),
1127 1127
 
1128 1128
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:21
1129
-	__( 'Venue Details', 'event_espresso' ),
1129
+	__('Venue Details', 'event_espresso'),
1130 1130
 
1131 1131
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:38
1132
-	__( 'unlimited space', 'event_espresso' ),
1132
+	__('unlimited space', 'event_espresso'),
1133 1133
 
1134 1134
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:41
1135 1135
 	/* translators: %d venue capacity */
1136
-	__( 'Space for up to %d people', 'event_espresso' ),
1136
+	__('Space for up to %d people', 'event_espresso'),
1137 1137
 
1138 1138
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:60
1139
-	__( 'no image', 'event_espresso' ),
1139
+	__('no image', 'event_espresso'),
1140 1140
 
1141 1141
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:96
1142
-	__( 'Edit this Venue', 'event_espresso' ),
1142
+	__('Edit this Venue', 'event_espresso'),
1143 1143
 
1144 1144
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:29
1145
-	__( 'Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso' ),
1145
+	__('Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso'),
1146 1146
 
1147 1147
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:40
1148
-	__( 'Skip', 'event_espresso' ),
1148
+	__('Skip', 'event_espresso'),
1149 1149
 
1150 1150
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:42
1151
-	__( 'Sure I\'ll help', 'event_espresso' ),
1151
+	__('Sure I\'ll help', 'event_espresso'),
1152 1152
 
1153 1153
 	// Reference: packages/adapters/src/Pagination/Pagination.tsx:23
1154
-	__( 'pagination', 'event_espresso' ),
1154
+	__('pagination', 'event_espresso'),
1155 1155
 
1156 1156
 	// Reference: packages/adapters/src/TagSelector/TagSelector.tsx:112
1157
-	__( 'toggle menu', 'event_espresso' ),
1157
+	__('toggle menu', 'event_espresso'),
1158 1158
 
1159 1159
 	// Reference: packages/constants/src/datetime.ts:10
1160
-	__( 'Postponed', 'event_espresso' ),
1160
+	__('Postponed', 'event_espresso'),
1161 1161
 
1162 1162
 	// Reference: packages/constants/src/datetime.ts:11
1163
-	__( 'SoldOut', 'event_espresso' ),
1163
+	__('SoldOut', 'event_espresso'),
1164 1164
 
1165 1165
 	// Reference: packages/constants/src/datetime.ts:7
1166 1166
 	// Reference: packages/predicates/src/registration/statusOptions.ts:11
1167
-	__( 'Cancelled', 'event_espresso' ),
1167
+	__('Cancelled', 'event_espresso'),
1168 1168
 
1169 1169
 	// Reference: packages/constants/src/datetime.ts:9
1170
-	__( 'Inactive', 'event_espresso' ),
1170
+	__('Inactive', 'event_espresso'),
1171 1171
 
1172 1172
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:25
1173
-	__( 'error creating %s', 'event_espresso' ),
1173
+	__('error creating %s', 'event_espresso'),
1174 1174
 
1175 1175
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:26
1176
-	__( 'error deleting %s', 'event_espresso' ),
1176
+	__('error deleting %s', 'event_espresso'),
1177 1177
 
1178 1178
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:27
1179
-	__( 'error updating %s', 'event_espresso' ),
1179
+	__('error updating %s', 'event_espresso'),
1180 1180
 
1181 1181
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:28
1182
-	__( 'creating %s', 'event_espresso' ),
1182
+	__('creating %s', 'event_espresso'),
1183 1183
 
1184 1184
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:29
1185
-	__( 'deleting %s', 'event_espresso' ),
1185
+	__('deleting %s', 'event_espresso'),
1186 1186
 
1187 1187
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:30
1188
-	__( 'updating %s', 'event_espresso' ),
1188
+	__('updating %s', 'event_espresso'),
1189 1189
 
1190 1190
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:31
1191
-	__( 'successfully created %s', 'event_espresso' ),
1191
+	__('successfully created %s', 'event_espresso'),
1192 1192
 
1193 1193
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:32
1194
-	__( 'successfully deleted %s', 'event_espresso' ),
1194
+	__('successfully deleted %s', 'event_espresso'),
1195 1195
 
1196 1196
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:33
1197
-	__( 'successfully updated %s', 'event_espresso' ),
1197
+	__('successfully updated %s', 'event_espresso'),
1198 1198
 
1199 1199
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:13
1200
-	__( 'day in range', 'event_espresso' ),
1200
+	__('day in range', 'event_espresso'),
1201 1201
 
1202 1202
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:17
1203 1203
 	// Reference: packages/dates/src/components/DateRangePicker/index.tsx:79
1204
-	__( 'end date', 'event_espresso' ),
1204
+	__('end date', 'event_espresso'),
1205 1205
 
1206 1206
 	// Reference: packages/dates/src/components/DateTimePicker.tsx:13
1207 1207
 	// Reference: packages/dates/src/components/TimePicker.tsx:14
1208 1208
 	// Reference: packages/form-builder/src/state/utils.ts:433
1209
-	__( 'time', 'event_espresso' ),
1209
+	__('time', 'event_espresso'),
1210 1210
 
1211 1211
 	// Reference: packages/dates/src/constants.ts:5
1212
-	__( 'End Date & Time must be set later than the Start Date & Time', 'event_espresso' ),
1212
+	__('End Date & Time must be set later than the Start Date & Time', 'event_espresso'),
1213 1213
 
1214 1214
 	// Reference: packages/dates/src/constants.ts:7
1215
-	__( 'Start Date & Time must be set before the End Date & Time', 'event_espresso' ),
1215
+	__('Start Date & Time must be set before the End Date & Time', 'event_espresso'),
1216 1216
 
1217 1217
 	// Reference: packages/dates/src/utils/misc.ts:16
1218
-	__( 'month(s)', 'event_espresso' ),
1218
+	__('month(s)', 'event_espresso'),
1219 1219
 
1220 1220
 	// Reference: packages/dates/src/utils/misc.ts:17
1221
-	__( 'week(s)', 'event_espresso' ),
1221
+	__('week(s)', 'event_espresso'),
1222 1222
 
1223 1223
 	// Reference: packages/dates/src/utils/misc.ts:18
1224
-	__( 'day(s)', 'event_espresso' ),
1224
+	__('day(s)', 'event_espresso'),
1225 1225
 
1226 1226
 	// Reference: packages/dates/src/utils/misc.ts:19
1227
-	__( 'hour(s)', 'event_espresso' ),
1227
+	__('hour(s)', 'event_espresso'),
1228 1228
 
1229 1229
 	// Reference: packages/dates/src/utils/misc.ts:20
1230
-	__( 'minute(s)', 'event_espresso' ),
1230
+	__('minute(s)', 'event_espresso'),
1231 1231
 
1232 1232
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:107
1233
-	__( 'price types initialized', 'event_espresso' ),
1233
+	__('price types initialized', 'event_espresso'),
1234 1234
 
1235 1235
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:117
1236
-	__( 'datetimes initialized', 'event_espresso' ),
1236
+	__('datetimes initialized', 'event_espresso'),
1237 1237
 
1238 1238
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:127
1239
-	__( 'tickets initialized', 'event_espresso' ),
1239
+	__('tickets initialized', 'event_espresso'),
1240 1240
 
1241 1241
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:137
1242
-	__( 'prices initialized', 'event_espresso' ),
1242
+	__('prices initialized', 'event_espresso'),
1243 1243
 
1244 1244
 	// Reference: packages/edtr-services/src/apollo/mutations/useReorderEntities.ts:72
1245
-	__( 'reordering has been applied', 'event_espresso' ),
1245
+	__('reordering has been applied', 'event_espresso'),
1246 1246
 
1247 1247
 	// Reference: packages/edtr-services/src/constants.ts:24
1248
-	__( 'datetime', 'event_espresso' ),
1248
+	__('datetime', 'event_espresso'),
1249 1249
 
1250 1250
 	// Reference: packages/edtr-services/src/constants.ts:27
1251
-	__( 'price', 'event_espresso' ),
1251
+	__('price', 'event_espresso'),
1252 1252
 
1253 1253
 	// Reference: packages/edtr-services/src/constants.ts:28
1254 1254
 	// Reference: packages/tpc/src/inputs/PriceTypeInput.tsx:19
1255
-	__( 'price type', 'event_espresso' ),
1255
+	__('price type', 'event_espresso'),
1256 1256
 
1257 1257
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:38
1258 1258
 	// Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:39
1259
-	__( 'End date has been adjusted', 'event_espresso' ),
1259
+	__('End date has been adjusted', 'event_espresso'),
1260 1260
 
1261 1261
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:59
1262
-	__( 'Required', 'event_espresso' ),
1262
+	__('Required', 'event_espresso'),
1263 1263
 
1264 1264
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:64
1265
-	__( 'Start Date is required', 'event_espresso' ),
1265
+	__('Start Date is required', 'event_espresso'),
1266 1266
 
1267 1267
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:68
1268
-	__( 'End Date is required', 'event_espresso' ),
1268
+	__('End Date is required', 'event_espresso'),
1269 1269
 
1270 1270
 	// Reference: packages/ee-components/src/EntityList/EntityList.tsx:31
1271
-	__( 'no results found', 'event_espresso' ),
1271
+	__('no results found', 'event_espresso'),
1272 1272
 
1273 1273
 	// Reference: packages/ee-components/src/EntityList/EntityList.tsx:32
1274
-	__( 'try changing filter settings', 'event_espresso' ),
1274
+	__('try changing filter settings', 'event_espresso'),
1275 1275
 
1276 1276
 	// Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:38
1277 1277
 	/* translators: %d entity id */
1278
-	__( 'select entity with id %d', 'event_espresso' ),
1278
+	__('select entity with id %d', 'event_espresso'),
1279 1279
 
1280 1280
 	// Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:41
1281
-	__( 'select all entities', 'event_espresso' ),
1281
+	__('select all entities', 'event_espresso'),
1282 1282
 
1283 1283
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20
1284
-	__( 'Note: ', 'event_espresso' ),
1284
+	__('Note: ', 'event_espresso'),
1285 1285
 
1286 1286
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20
1287
-	__( 'any changes will be applied to ALL of the selected entities.', 'event_espresso' ),
1287
+	__('any changes will be applied to ALL of the selected entities.', 'event_espresso'),
1288 1288
 
1289 1289
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:27
1290
-	__( 'Bulk edit details', 'event_espresso' ),
1290
+	__('Bulk edit details', 'event_espresso'),
1291 1291
 
1292 1292
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:17
1293
-	__( 'Are you sure you want to bulk update the details?', 'event_espresso' ),
1293
+	__('Are you sure you want to bulk update the details?', 'event_espresso'),
1294 1294
 
1295 1295
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:18
1296
-	__( 'Bulk update details', 'event_espresso' ),
1296
+	__('Bulk update details', 'event_espresso'),
1297 1297
 
1298 1298
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:27
1299
-	__( 'reorder dates', 'event_espresso' ),
1299
+	__('reorder dates', 'event_espresso'),
1300 1300
 
1301 1301
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:27
1302
-	__( 'reorder tickets', 'event_espresso' ),
1302
+	__('reorder tickets', 'event_espresso'),
1303 1303
 
1304 1304
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:32
1305
-	__( 'delete form element', 'event_espresso' ),
1305
+	__('delete form element', 'event_espresso'),
1306 1306
 
1307 1307
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:49
1308
-	__( 'form element settings', 'event_espresso' ),
1308
+	__('form element settings', 'event_espresso'),
1309 1309
 
1310 1310
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:59
1311
-	__( 'copy form element', 'event_espresso' ),
1311
+	__('copy form element', 'event_espresso'),
1312 1312
 
1313 1313
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:69
1314
-	__( 'click, hold, and drag to reorder form element', 'event_espresso' ),
1314
+	__('click, hold, and drag to reorder form element', 'event_espresso'),
1315 1315
 
1316 1316
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:20
1317
-	__( 'remove option', 'event_espresso' ),
1317
+	__('remove option', 'event_espresso'),
1318 1318
 
1319 1319
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:42
1320
-	__( 'value', 'event_espresso' ),
1320
+	__('value', 'event_espresso'),
1321 1321
 
1322 1322
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:52
1323
-	__( 'label', 'event_espresso' ),
1323
+	__('label', 'event_espresso'),
1324 1324
 
1325 1325
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:63
1326
-	__( 'click, hold, and drag to reorder field option', 'event_espresso' ),
1326
+	__('click, hold, and drag to reorder field option', 'event_espresso'),
1327 1327
 
1328 1328
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:61
1329
-	__( 'Options are the choices you give people to select from.', 'event_espresso' ),
1329
+	__('Options are the choices you give people to select from.', 'event_espresso'),
1330 1330
 
1331 1331
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:63
1332
-	__( 'The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso' ),
1332
+	__('The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso'),
1333 1333
 
1334 1334
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:96
1335
-	__( 'add new option', 'event_espresso' ),
1335
+	__('add new option', 'event_espresso'),
1336 1336
 
1337 1337
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:26
1338 1338
 	// Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:25
1339
-	__( 'Styles', 'event_espresso' ),
1339
+	__('Styles', 'event_espresso'),
1340 1340
 
1341 1341
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:30
1342
-	__( 'Validation', 'event_espresso' ),
1342
+	__('Validation', 'event_espresso'),
1343 1343
 
1344 1344
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:18
1345
-	__( 'Change input type', 'event_espresso' ),
1345
+	__('Change input type', 'event_espresso'),
1346 1346
 
1347 1347
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:19
1348
-	__( 'Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso' ),
1348
+	__('Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso'),
1349 1349
 
1350 1350
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:40
1351
-	__( 'type', 'event_espresso' ),
1351
+	__('type', 'event_espresso'),
1352 1352
 
1353 1353
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:26
1354 1354
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:17
1355
-	__( 'public label', 'event_espresso' ),
1355
+	__('public label', 'event_espresso'),
1356 1356
 
1357 1357
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:33
1358 1358
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:22
1359
-	__( 'admin label', 'event_espresso' ),
1359
+	__('admin label', 'event_espresso'),
1360 1360
 
1361 1361
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:40
1362
-	__( 'content', 'event_espresso' ),
1362
+	__('content', 'event_espresso'),
1363 1363
 
1364 1364
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:48
1365
-	__( 'options', 'event_espresso' ),
1365
+	__('options', 'event_espresso'),
1366 1366
 
1367 1367
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:51
1368
-	__( 'placeholder', 'event_espresso' ),
1368
+	__('placeholder', 'event_espresso'),
1369 1369
 
1370 1370
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:57
1371
-	__( 'admin only', 'event_espresso' ),
1371
+	__('admin only', 'event_espresso'),
1372 1372
 
1373 1373
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:62
1374
-	__( 'help text', 'event_espresso' ),
1374
+	__('help text', 'event_espresso'),
1375 1375
 
1376 1376
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:71
1377
-	__( 'maps to', 'event_espresso' ),
1377
+	__('maps to', 'event_espresso'),
1378 1378
 
1379 1379
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:15
1380 1380
 	// Reference: packages/form-builder/src/FormSection/Tabs/Styles.tsx:13
1381
-	__( 'css class', 'event_espresso' ),
1381
+	__('css class', 'event_espresso'),
1382 1382
 
1383 1383
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:20
1384
-	__( 'help text css class', 'event_espresso' ),
1384
+	__('help text css class', 'event_espresso'),
1385 1385
 
1386 1386
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:27
1387
-	__( 'size', 'event_espresso' ),
1387
+	__('size', 'event_espresso'),
1388 1388
 
1389 1389
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:35
1390
-	__( 'step', 'event_espresso' ),
1390
+	__('step', 'event_espresso'),
1391 1391
 
1392 1392
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:41
1393
-	__( 'maxlength', 'event_espresso' ),
1393
+	__('maxlength', 'event_espresso'),
1394 1394
 
1395 1395
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:123
1396
-	__( 'min', 'event_espresso' ),
1396
+	__('min', 'event_espresso'),
1397 1397
 
1398 1398
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:128
1399
-	__( 'max', 'event_espresso' ),
1399
+	__('max', 'event_espresso'),
1400 1400
 
1401 1401
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:28
1402
-	__( 'Germany', 'event_espresso' ),
1402
+	__('Germany', 'event_espresso'),
1403 1403
 
1404 1404
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:32
1405
-	__( 'France', 'event_espresso' ),
1405
+	__('France', 'event_espresso'),
1406 1406
 
1407 1407
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:36
1408
-	__( 'United Kingdom', 'event_espresso' ),
1408
+	__('United Kingdom', 'event_espresso'),
1409 1409
 
1410 1410
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:40
1411
-	__( 'United States', 'event_espresso' ),
1411
+	__('United States', 'event_espresso'),
1412 1412
 
1413 1413
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:44
1414
-	__( 'Custom', 'event_espresso' ),
1414
+	__('Custom', 'event_espresso'),
1415 1415
 
1416 1416
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:54
1417
-	__( 'required', 'event_espresso' ),
1417
+	__('required', 'event_espresso'),
1418 1418
 
1419 1419
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:59
1420
-	__( 'required text', 'event_espresso' ),
1420
+	__('required text', 'event_espresso'),
1421 1421
 
1422 1422
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:66
1423
-	__( 'autocomplete', 'event_espresso' ),
1423
+	__('autocomplete', 'event_espresso'),
1424 1424
 
1425 1425
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:74
1426
-	__( 'custom format', 'event_espresso' ),
1426
+	__('custom format', 'event_espresso'),
1427 1427
 
1428 1428
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:75
1429
-	__( 'format', 'event_espresso' ),
1429
+	__('format', 'event_espresso'),
1430 1430
 
1431 1431
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:83
1432
-	__( 'pattern', 'event_espresso' ),
1432
+	__('pattern', 'event_espresso'),
1433 1433
 
1434 1434
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:110
1435
-	__( 'add new form element', 'event_espresso' ),
1435
+	__('add new form element', 'event_espresso'),
1436 1436
 
1437 1437
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:117
1438 1438
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:52
1439
-	__( 'Add', 'event_espresso' ),
1439
+	__('Add', 'event_espresso'),
1440 1440
 
1441 1441
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:76
1442
-	__( 'Add Form Element', 'event_espresso' ),
1442
+	__('Add Form Element', 'event_espresso'),
1443 1443
 
1444 1444
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:85
1445
-	__( 'form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso' ),
1445
+	__('form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso'),
1446 1446
 
1447 1447
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:92
1448
-	__( 'load existing form section', 'event_espresso' ),
1448
+	__('load existing form section', 'event_espresso'),
1449 1449
 
1450 1450
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:32
1451
-	__( 'delete form section', 'event_espresso' ),
1451
+	__('delete form section', 'event_espresso'),
1452 1452
 
1453 1453
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:47
1454
-	__( 'form section settings', 'event_espresso' ),
1454
+	__('form section settings', 'event_espresso'),
1455 1455
 
1456 1456
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:57
1457
-	__( 'copy form section', 'event_espresso' ),
1457
+	__('copy form section', 'event_espresso'),
1458 1458
 
1459 1459
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:74
1460
-	__( 'click, hold, and drag to reorder form section', 'event_espresso' ),
1460
+	__('click, hold, and drag to reorder form section', 'event_espresso'),
1461 1461
 
1462 1462
 	// Reference: packages/form-builder/src/FormSection/FormSections.tsx:26
1463
-	__( 'Add Form Section', 'event_espresso' ),
1463
+	__('Add Form Section', 'event_espresso'),
1464 1464
 
1465 1465
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:47
1466
-	__( 'save form section for use in other forms', 'event_espresso' ),
1466
+	__('save form section for use in other forms', 'event_espresso'),
1467 1467
 
1468 1468
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:51
1469
-	__( 'save as', 'event_espresso' ),
1469
+	__('save as', 'event_espresso'),
1470 1470
 
1471 1471
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:55
1472
-	__( 'default', 'event_espresso' ),
1472
+	__('default', 'event_espresso'),
1473 1473
 
1474 1474
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:58
1475
-	__( ' a copy of this form section will be automatically added to ALL new events', 'event_espresso' ),
1475
+	__(' a copy of this form section will be automatically added to ALL new events', 'event_espresso'),
1476 1476
 
1477 1477
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:61
1478
-	__( 'shared', 'event_espresso' ),
1478
+	__('shared', 'event_espresso'),
1479 1479
 
1480 1480
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:64
1481
-	__( 'a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso' ),
1481
+	__('a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso'),
1482 1482
 
1483 1483
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:27
1484
-	__( 'show label', 'event_espresso' ),
1484
+	__('show label', 'event_espresso'),
1485 1485
 
1486 1486
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:33
1487
-	__( 'applies to', 'event_espresso' ),
1487
+	__('applies to', 'event_espresso'),
1488 1488
 
1489 1489
 	// Reference: packages/form-builder/src/constants.ts:102
1490 1490
 	// Reference: packages/form-builder/src/state/utils.ts:436
1491
-	__( 'URL', 'event_espresso' ),
1491
+	__('URL', 'event_espresso'),
1492 1492
 
1493 1493
 	// Reference: packages/form-builder/src/constants.ts:104
1494
-	__( 'adds a text input for entering a URL address', 'event_espresso' ),
1494
+	__('adds a text input for entering a URL address', 'event_espresso'),
1495 1495
 
1496 1496
 	// Reference: packages/form-builder/src/constants.ts:107
1497
-	__( 'Date', 'event_espresso' ),
1497
+	__('Date', 'event_espresso'),
1498 1498
 
1499 1499
 	// Reference: packages/form-builder/src/constants.ts:109
1500
-	__( 'adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso' ),
1500
+	__('adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso'),
1501 1501
 
1502 1502
 	// Reference: packages/form-builder/src/constants.ts:112
1503 1503
 	// Reference: packages/form-builder/src/state/utils.ts:369
1504
-	__( 'Local Date', 'event_espresso' ),
1504
+	__('Local Date', 'event_espresso'),
1505 1505
 
1506 1506
 	// Reference: packages/form-builder/src/constants.ts:117
1507
-	__( 'Month', 'event_espresso' ),
1507
+	__('Month', 'event_espresso'),
1508 1508
 
1509 1509
 	// Reference: packages/form-builder/src/constants.ts:119
1510
-	__( 'adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso' ),
1510
+	__('adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso'),
1511 1511
 
1512 1512
 	// Reference: packages/form-builder/src/constants.ts:122
1513
-	__( 'Time', 'event_espresso' ),
1513
+	__('Time', 'event_espresso'),
1514 1514
 
1515 1515
 	// Reference: packages/form-builder/src/constants.ts:124
1516
-	__( 'adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso' ),
1516
+	__('adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso'),
1517 1517
 
1518 1518
 	// Reference: packages/form-builder/src/constants.ts:127
1519
-	__( 'Week', 'event_espresso' ),
1519
+	__('Week', 'event_espresso'),
1520 1520
 
1521 1521
 	// Reference: packages/form-builder/src/constants.ts:129
1522
-	__( 'adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso' ),
1522
+	__('adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso'),
1523 1523
 
1524 1524
 	// Reference: packages/form-builder/src/constants.ts:132
1525
-	__( 'Day Selector', 'event_espresso' ),
1525
+	__('Day Selector', 'event_espresso'),
1526 1526
 
1527 1527
 	// Reference: packages/form-builder/src/constants.ts:134
1528
-	__( 'adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso' ),
1528
+	__('adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso'),
1529 1529
 
1530 1530
 	// Reference: packages/form-builder/src/constants.ts:137
1531
-	__( 'Month Selector', 'event_espresso' ),
1531
+	__('Month Selector', 'event_espresso'),
1532 1532
 
1533 1533
 	// Reference: packages/form-builder/src/constants.ts:139
1534
-	__( 'adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso' ),
1534
+	__('adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso'),
1535 1535
 
1536 1536
 	// Reference: packages/form-builder/src/constants.ts:142
1537
-	__( 'Year Selector', 'event_espresso' ),
1537
+	__('Year Selector', 'event_espresso'),
1538 1538
 
1539 1539
 	// Reference: packages/form-builder/src/constants.ts:144
1540
-	__( 'adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso' ),
1540
+	__('adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso'),
1541 1541
 
1542 1542
 	// Reference: packages/form-builder/src/constants.ts:147
1543
-	__( 'Radio Buttons', 'event_espresso' ),
1543
+	__('Radio Buttons', 'event_espresso'),
1544 1544
 
1545 1545
 	// Reference: packages/form-builder/src/constants.ts:149
1546
-	__( 'adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso' ),
1546
+	__('adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso'),
1547 1547
 
1548 1548
 	// Reference: packages/form-builder/src/constants.ts:152
1549 1549
 	// Reference: packages/form-builder/src/state/utils.ts:375
1550
-	__( 'Decimal Number', 'event_espresso' ),
1550
+	__('Decimal Number', 'event_espresso'),
1551 1551
 
1552 1552
 	// Reference: packages/form-builder/src/constants.ts:154
1553
-	__( 'adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso' ),
1553
+	__('adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso'),
1554 1554
 
1555 1555
 	// Reference: packages/form-builder/src/constants.ts:157
1556 1556
 	// Reference: packages/form-builder/src/state/utils.ts:378
1557
-	__( 'Whole Number', 'event_espresso' ),
1557
+	__('Whole Number', 'event_espresso'),
1558 1558
 
1559 1559
 	// Reference: packages/form-builder/src/constants.ts:159
1560
-	__( 'adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso' ),
1560
+	__('adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso'),
1561 1561
 
1562 1562
 	// Reference: packages/form-builder/src/constants.ts:162
1563
-	__( 'Number Range', 'event_espresso' ),
1563
+	__('Number Range', 'event_espresso'),
1564 1564
 
1565 1565
 	// Reference: packages/form-builder/src/constants.ts:167
1566
-	__( 'Phone Number', 'event_espresso' ),
1566
+	__('Phone Number', 'event_espresso'),
1567 1567
 
1568 1568
 	// Reference: packages/form-builder/src/constants.ts:172
1569
-	__( 'Dropdown', 'event_espresso' ),
1569
+	__('Dropdown', 'event_espresso'),
1570 1570
 
1571 1571
 	// Reference: packages/form-builder/src/constants.ts:174
1572
-	__( 'adds a dropdown selector that accepts a single value', 'event_espresso' ),
1572
+	__('adds a dropdown selector that accepts a single value', 'event_espresso'),
1573 1573
 
1574 1574
 	// Reference: packages/form-builder/src/constants.ts:177
1575
-	__( 'Multi Select', 'event_espresso' ),
1575
+	__('Multi Select', 'event_espresso'),
1576 1576
 
1577 1577
 	// Reference: packages/form-builder/src/constants.ts:179
1578
-	__( 'adds a dropdown selector that accepts multiple values', 'event_espresso' ),
1578
+	__('adds a dropdown selector that accepts multiple values', 'event_espresso'),
1579 1579
 
1580 1580
 	// Reference: packages/form-builder/src/constants.ts:182
1581
-	__( 'Toggle/Switch', 'event_espresso' ),
1581
+	__('Toggle/Switch', 'event_espresso'),
1582 1582
 
1583 1583
 	// Reference: packages/form-builder/src/constants.ts:184
1584
-	__( 'adds a toggle or a switch to accept true or false value', 'event_espresso' ),
1584
+	__('adds a toggle or a switch to accept true or false value', 'event_espresso'),
1585 1585
 
1586 1586
 	// Reference: packages/form-builder/src/constants.ts:187
1587
-	__( 'Multi Checkbox', 'event_espresso' ),
1587
+	__('Multi Checkbox', 'event_espresso'),
1588 1588
 
1589 1589
 	// Reference: packages/form-builder/src/constants.ts:189
1590
-	__( 'adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso' ),
1590
+	__('adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso'),
1591 1591
 
1592 1592
 	// Reference: packages/form-builder/src/constants.ts:192
1593
-	__( 'Country Selector', 'event_espresso' ),
1593
+	__('Country Selector', 'event_espresso'),
1594 1594
 
1595 1595
 	// Reference: packages/form-builder/src/constants.ts:194
1596
-	__( 'adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso' ),
1596
+	__('adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso'),
1597 1597
 
1598 1598
 	// Reference: packages/form-builder/src/constants.ts:197
1599
-	__( 'State Selector', 'event_espresso' ),
1599
+	__('State Selector', 'event_espresso'),
1600 1600
 
1601 1601
 	// Reference: packages/form-builder/src/constants.ts:202
1602
-	__( 'Button', 'event_espresso' ),
1602
+	__('Button', 'event_espresso'),
1603 1603
 
1604 1604
 	// Reference: packages/form-builder/src/constants.ts:204
1605
-	__( 'adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso' ),
1605
+	__('adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso'),
1606 1606
 
1607 1607
 	// Reference: packages/form-builder/src/constants.ts:207
1608
-	__( 'Reset Button', 'event_espresso' ),
1608
+	__('Reset Button', 'event_espresso'),
1609 1609
 
1610 1610
 	// Reference: packages/form-builder/src/constants.ts:209
1611
-	__( 'adds a button that will reset the form back to its original state.', 'event_espresso' ),
1611
+	__('adds a button that will reset the form back to its original state.', 'event_espresso'),
1612 1612
 
1613 1613
 	// Reference: packages/form-builder/src/constants.ts:55
1614
-	__( 'Form Section', 'event_espresso' ),
1614
+	__('Form Section', 'event_espresso'),
1615 1615
 
1616 1616
 	// Reference: packages/form-builder/src/constants.ts:57
1617
-	__( 'Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso' ),
1617
+	__('Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso'),
1618 1618
 
1619 1619
 	// Reference: packages/form-builder/src/constants.ts:62
1620
-	__( 'HTML Block', 'event_espresso' ),
1620
+	__('HTML Block', 'event_espresso'),
1621 1621
 
1622 1622
 	// Reference: packages/form-builder/src/constants.ts:64
1623
-	__( 'allows you to add HTML like headings or text paragraphs to your form', 'event_espresso' ),
1623
+	__('allows you to add HTML like headings or text paragraphs to your form', 'event_espresso'),
1624 1624
 
1625 1625
 	// Reference: packages/form-builder/src/constants.ts:69
1626
-	__( 'adds a text input that only accepts plain text', 'event_espresso' ),
1626
+	__('adds a text input that only accepts plain text', 'event_espresso'),
1627 1627
 
1628 1628
 	// Reference: packages/form-builder/src/constants.ts:72
1629
-	__( 'Plain Text Area', 'event_espresso' ),
1629
+	__('Plain Text Area', 'event_espresso'),
1630 1630
 
1631 1631
 	// Reference: packages/form-builder/src/constants.ts:74
1632
-	__( 'adds a textarea block that only accepts plain text', 'event_espresso' ),
1632
+	__('adds a textarea block that only accepts plain text', 'event_espresso'),
1633 1633
 
1634 1634
 	// Reference: packages/form-builder/src/constants.ts:77
1635
-	__( 'HTML Text Area', 'event_espresso' ),
1635
+	__('HTML Text Area', 'event_espresso'),
1636 1636
 
1637 1637
 	// Reference: packages/form-builder/src/constants.ts:79
1638
-	__( 'adds a textarea block that accepts text including simple HTML markup', 'event_espresso' ),
1638
+	__('adds a textarea block that accepts text including simple HTML markup', 'event_espresso'),
1639 1639
 
1640 1640
 	// Reference: packages/form-builder/src/constants.ts:84
1641
-	__( 'adds a text input that only accepts a valid email address', 'event_espresso' ),
1641
+	__('adds a text input that only accepts a valid email address', 'event_espresso'),
1642 1642
 
1643 1643
 	// Reference: packages/form-builder/src/constants.ts:87
1644
-	__( 'Email Confirmation', 'event_espresso' ),
1644
+	__('Email Confirmation', 'event_espresso'),
1645 1645
 
1646 1646
 	// Reference: packages/form-builder/src/constants.ts:92
1647
-	__( 'Password', 'event_espresso' ),
1647
+	__('Password', 'event_espresso'),
1648 1648
 
1649 1649
 	// Reference: packages/form-builder/src/constants.ts:94
1650
-	__( 'adds a text input that accepts text but masks what the user enters', 'event_espresso' ),
1650
+	__('adds a text input that accepts text but masks what the user enters', 'event_espresso'),
1651 1651
 
1652 1652
 	// Reference: packages/form-builder/src/constants.ts:97
1653
-	__( 'Password Confirmation', 'event_espresso' ),
1653
+	__('Password Confirmation', 'event_espresso'),
1654 1654
 
1655 1655
 	// Reference: packages/form-builder/src/data/useElementMutator.ts:54
1656
-	__( 'element', 'event_espresso' ),
1656
+	__('element', 'event_espresso'),
1657 1657
 
1658 1658
 	// Reference: packages/form-builder/src/data/useSectionMutator.ts:54
1659
-	__( 'section', 'event_espresso' ),
1659
+	__('section', 'event_espresso'),
1660 1660
 
1661 1661
 	// Reference: packages/form-builder/src/state/utils.ts:360
1662
-	__( 'click', 'event_espresso' ),
1662
+	__('click', 'event_espresso'),
1663 1663
 
1664 1664
 	// Reference: packages/form-builder/src/state/utils.ts:363
1665
-	__( 'checkboxes', 'event_espresso' ),
1665
+	__('checkboxes', 'event_espresso'),
1666 1666
 
1667 1667
 	// Reference: packages/form-builder/src/state/utils.ts:366
1668
-	__( 'date', 'event_espresso' ),
1668
+	__('date', 'event_espresso'),
1669 1669
 
1670 1670
 	// Reference: packages/form-builder/src/state/utils.ts:372
1671
-	__( 'day', 'event_espresso' ),
1671
+	__('day', 'event_espresso'),
1672 1672
 
1673 1673
 	// Reference: packages/form-builder/src/state/utils.ts:381
1674
-	__( 'email address', 'event_espresso' ),
1674
+	__('email address', 'event_espresso'),
1675 1675
 
1676 1676
 	// Reference: packages/form-builder/src/state/utils.ts:384
1677
-	__( 'confirm email address', 'event_espresso' ),
1677
+	__('confirm email address', 'event_espresso'),
1678 1678
 
1679 1679
 	// Reference: packages/form-builder/src/state/utils.ts:388
1680
-	__( 'month', 'event_espresso' ),
1680
+	__('month', 'event_espresso'),
1681 1681
 
1682 1682
 	// Reference: packages/form-builder/src/state/utils.ts:391
1683
-	__( 'password', 'event_espresso' ),
1683
+	__('password', 'event_espresso'),
1684 1684
 
1685 1685
 	// Reference: packages/form-builder/src/state/utils.ts:394
1686
-	__( 'confirm password', 'event_espresso' ),
1686
+	__('confirm password', 'event_espresso'),
1687 1687
 
1688 1688
 	// Reference: packages/form-builder/src/state/utils.ts:397
1689
-	__( 'radio buttons', 'event_espresso' ),
1689
+	__('radio buttons', 'event_espresso'),
1690 1690
 
1691 1691
 	// Reference: packages/form-builder/src/state/utils.ts:400
1692
-	__( 'number range', 'event_espresso' ),
1692
+	__('number range', 'event_espresso'),
1693 1693
 
1694 1694
 	// Reference: packages/form-builder/src/state/utils.ts:403
1695
-	__( 'selection dropdown', 'event_espresso' ),
1695
+	__('selection dropdown', 'event_espresso'),
1696 1696
 
1697 1697
 	// Reference: packages/form-builder/src/state/utils.ts:406
1698
-	__( 'country', 'event_espresso' ),
1698
+	__('country', 'event_espresso'),
1699 1699
 
1700 1700
 	// Reference: packages/form-builder/src/state/utils.ts:409
1701
-	__( 'multi-select dropdown', 'event_espresso' ),
1701
+	__('multi-select dropdown', 'event_espresso'),
1702 1702
 
1703 1703
 	// Reference: packages/form-builder/src/state/utils.ts:412
1704
-	__( 'state/province', 'event_espresso' ),
1704
+	__('state/province', 'event_espresso'),
1705 1705
 
1706 1706
 	// Reference: packages/form-builder/src/state/utils.ts:415
1707
-	__( 'on/off switch', 'event_espresso' ),
1707
+	__('on/off switch', 'event_espresso'),
1708 1708
 
1709 1709
 	// Reference: packages/form-builder/src/state/utils.ts:418
1710
-	__( 'reset', 'event_espresso' ),
1710
+	__('reset', 'event_espresso'),
1711 1711
 
1712 1712
 	// Reference: packages/form-builder/src/state/utils.ts:421
1713
-	__( 'phone number', 'event_espresso' ),
1713
+	__('phone number', 'event_espresso'),
1714 1714
 
1715 1715
 	// Reference: packages/form-builder/src/state/utils.ts:424
1716
-	__( 'text', 'event_espresso' ),
1716
+	__('text', 'event_espresso'),
1717 1717
 
1718 1718
 	// Reference: packages/form-builder/src/state/utils.ts:427
1719
-	__( 'simple textarea', 'event_espresso' ),
1719
+	__('simple textarea', 'event_espresso'),
1720 1720
 
1721 1721
 	// Reference: packages/form-builder/src/state/utils.ts:430
1722
-	__( 'html textarea', 'event_espresso' ),
1722
+	__('html textarea', 'event_espresso'),
1723 1723
 
1724 1724
 	// Reference: packages/form-builder/src/state/utils.ts:439
1725
-	__( 'week', 'event_espresso' ),
1725
+	__('week', 'event_espresso'),
1726 1726
 
1727 1727
 	// Reference: packages/form-builder/src/state/utils.ts:442
1728
-	__( 'year', 'event_espresso' ),
1728
+	__('year', 'event_espresso'),
1729 1729
 
1730 1730
 	// Reference: packages/form/src/adapters/WPMediaImage.tsx:12
1731
-	__( 'Select Image', 'event_espresso' ),
1731
+	__('Select Image', 'event_espresso'),
1732 1732
 
1733 1733
 	// Reference: packages/form/src/adapters/WPMediaImage.tsx:44
1734 1734
 	// Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:11
1735 1735
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:12
1736 1736
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityTemplate.tsx:32
1737
-	__( 'Select', 'event_espresso' ),
1737
+	__('Select', 'event_espresso'),
1738 1738
 
1739 1739
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:36
1740 1740
 	/* translators: %d the entry number */
1741
-	__( 'Entry %d', 'event_espresso' ),
1741
+	__('Entry %d', 'event_espresso'),
1742 1742
 
1743 1743
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:11
1744 1744
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:17
1745
-	__( 'sold out', 'event_espresso' ),
1745
+	__('sold out', 'event_espresso'),
1746 1746
 
1747 1747
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:14
1748 1748
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:14
1749
-	__( 'expired', 'event_espresso' ),
1749
+	__('expired', 'event_espresso'),
1750 1750
 
1751 1751
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:17
1752
-	__( 'upcoming', 'event_espresso' ),
1752
+	__('upcoming', 'event_espresso'),
1753 1753
 
1754 1754
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:20
1755
-	__( 'active', 'event_espresso' ),
1755
+	__('active', 'event_espresso'),
1756 1756
 
1757 1757
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:23
1758 1758
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:11
1759
-	__( 'trashed', 'event_espresso' ),
1759
+	__('trashed', 'event_espresso'),
1760 1760
 
1761 1761
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:26
1762
-	__( 'cancelled', 'event_espresso' ),
1762
+	__('cancelled', 'event_espresso'),
1763 1763
 
1764 1764
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:29
1765
-	__( 'postponed', 'event_espresso' ),
1765
+	__('postponed', 'event_espresso'),
1766 1766
 
1767 1767
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:33
1768
-	__( 'inactive', 'event_espresso' ),
1768
+	__('inactive', 'event_espresso'),
1769 1769
 
1770 1770
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:20
1771
-	__( 'pending', 'event_espresso' ),
1771
+	__('pending', 'event_espresso'),
1772 1772
 
1773 1773
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:23
1774
-	__( 'on sale', 'event_espresso' ),
1774
+	__('on sale', 'event_espresso'),
1775 1775
 
1776 1776
 	// Reference: packages/predicates/src/registration/statusOptions.ts:16
1777
-	__( 'Declined', 'event_espresso' ),
1777
+	__('Declined', 'event_espresso'),
1778 1778
 
1779 1779
 	// Reference: packages/predicates/src/registration/statusOptions.ts:21
1780
-	__( 'Incomplete', 'event_espresso' ),
1780
+	__('Incomplete', 'event_espresso'),
1781 1781
 
1782 1782
 	// Reference: packages/predicates/src/registration/statusOptions.ts:26
1783
-	__( 'Not Approved', 'event_espresso' ),
1783
+	__('Not Approved', 'event_espresso'),
1784 1784
 
1785 1785
 	// Reference: packages/predicates/src/registration/statusOptions.ts:31
1786
-	__( 'Pending Payment', 'event_espresso' ),
1786
+	__('Pending Payment', 'event_espresso'),
1787 1787
 
1788 1788
 	// Reference: packages/predicates/src/registration/statusOptions.ts:36
1789
-	__( 'Wait List', 'event_espresso' ),
1789
+	__('Wait List', 'event_espresso'),
1790 1790
 
1791 1791
 	// Reference: packages/predicates/src/registration/statusOptions.ts:6
1792
-	__( 'Approved', 'event_espresso' ),
1792
+	__('Approved', 'event_espresso'),
1793 1793
 
1794 1794
 	// Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:9
1795 1795
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:10
1796
-	__( 'Select media', 'event_espresso' ),
1796
+	__('Select media', 'event_espresso'),
1797 1797
 
1798 1798
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/RichTextEditor.tsx:84
1799
-	__( 'Write something…', 'event_espresso' ),
1799
+	__('Write something…', 'event_espresso'),
1800 1800
 
1801 1801
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/Toolbar.tsx:20
1802
-	__( 'RTE Toolbar', 'event_espresso' ),
1802
+	__('RTE Toolbar', 'event_espresso'),
1803 1803
 
1804 1804
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:11
1805
-	__( 'Normal', 'event_espresso' ),
1805
+	__('Normal', 'event_espresso'),
1806 1806
 
1807 1807
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:12
1808
-	__( 'H1', 'event_espresso' ),
1808
+	__('H1', 'event_espresso'),
1809 1809
 
1810 1810
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:13
1811
-	__( 'H2', 'event_espresso' ),
1811
+	__('H2', 'event_espresso'),
1812 1812
 
1813 1813
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:14
1814
-	__( 'H3', 'event_espresso' ),
1814
+	__('H3', 'event_espresso'),
1815 1815
 
1816 1816
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:15
1817
-	__( 'H4', 'event_espresso' ),
1817
+	__('H4', 'event_espresso'),
1818 1818
 
1819 1819
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:16
1820
-	__( 'H5', 'event_espresso' ),
1820
+	__('H5', 'event_espresso'),
1821 1821
 
1822 1822
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:17
1823
-	__( 'H6', 'event_espresso' ),
1823
+	__('H6', 'event_espresso'),
1824 1824
 
1825 1825
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:18
1826
-	__( 'Block quote', 'event_espresso' ),
1826
+	__('Block quote', 'event_espresso'),
1827 1827
 
1828 1828
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:19
1829
-	__( 'Code', 'event_espresso' ),
1829
+	__('Code', 'event_espresso'),
1830 1830
 
1831 1831
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:36
1832
-	__( 'Set color', 'event_espresso' ),
1832
+	__('Set color', 'event_espresso'),
1833 1833
 
1834 1834
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:45
1835
-	__( 'Text color', 'event_espresso' ),
1835
+	__('Text color', 'event_espresso'),
1836 1836
 
1837 1837
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:47
1838
-	__( 'Background color', 'event_espresso' ),
1838
+	__('Background color', 'event_espresso'),
1839 1839
 
1840 1840
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:39
1841
-	__( 'Add image', 'event_espresso' ),
1841
+	__('Add image', 'event_espresso'),
1842 1842
 
1843 1843
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:51
1844
-	__( 'Image URL', 'event_espresso' ),
1844
+	__('Image URL', 'event_espresso'),
1845 1845
 
1846 1846
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:55
1847
-	__( 'Alt text', 'event_espresso' ),
1847
+	__('Alt text', 'event_espresso'),
1848 1848
 
1849 1849
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:56
1850
-	__( 'Width', 'event_espresso' ),
1850
+	__('Width', 'event_espresso'),
1851 1851
 
1852 1852
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:60
1853
-	__( 'Height', 'event_espresso' ),
1853
+	__('Height', 'event_espresso'),
1854 1854
 
1855 1855
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:54
1856
-	__( 'Edit link', 'event_espresso' ),
1856
+	__('Edit link', 'event_espresso'),
1857 1857
 
1858 1858
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:64
1859
-	__( 'URL title', 'event_espresso' ),
1859
+	__('URL title', 'event_espresso'),
1860 1860
 
1861 1861
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:11
1862
-	__( 'Unordered list', 'event_espresso' ),
1862
+	__('Unordered list', 'event_espresso'),
1863 1863
 
1864 1864
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:12
1865
-	__( 'Ordered list', 'event_espresso' ),
1865
+	__('Ordered list', 'event_espresso'),
1866 1866
 
1867 1867
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:13
1868 1868
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:13
1869
-	__( 'Indent', 'event_espresso' ),
1869
+	__('Indent', 'event_espresso'),
1870 1870
 
1871 1871
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:14
1872 1872
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:14
1873
-	__( 'Outdent', 'event_espresso' ),
1873
+	__('Outdent', 'event_espresso'),
1874 1874
 
1875 1875
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:11
1876
-	__( 'Unordered textalign', 'event_espresso' ),
1876
+	__('Unordered textalign', 'event_espresso'),
1877 1877
 
1878 1878
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:12
1879
-	__( 'Ordered textalign', 'event_espresso' ),
1879
+	__('Ordered textalign', 'event_espresso'),
1880 1880
 
1881 1881
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/render/Image/Toolbar.tsx:32
1882
-	__( 'Image toolbar', 'event_espresso' ),
1882
+	__('Image toolbar', 'event_espresso'),
1883 1883
 
1884 1884
 	// Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:62
1885 1885
 	// Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:35
1886
-	__( 'Visual editor', 'event_espresso' ),
1886
+	__('Visual editor', 'event_espresso'),
1887 1887
 
1888 1888
 	// Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:66
1889 1889
 	// Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:39
1890
-	__( 'HTML editor', 'event_espresso' ),
1890
+	__('HTML editor', 'event_espresso'),
1891 1891
 
1892 1892
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:68
1893
-	__( 'Add Media', 'event_espresso' ),
1893
+	__('Add Media', 'event_espresso'),
1894 1894
 
1895 1895
 	// Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:14
1896
-	__( 'add new price modifier after this row', 'event_espresso' ),
1896
+	__('add new price modifier after this row', 'event_espresso'),
1897 1897
 
1898 1898
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:14
1899
-	__( 'Delete all prices', 'event_espresso' ),
1899
+	__('Delete all prices', 'event_espresso'),
1900 1900
 
1901 1901
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:27
1902
-	__( 'Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso' ),
1902
+	__('Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso'),
1903 1903
 
1904 1904
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:31
1905
-	__( 'Delete all prices?', 'event_espresso' ),
1905
+	__('Delete all prices?', 'event_espresso'),
1906 1906
 
1907 1907
 	// Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12
1908
-	__( 'delete price modifier', 'event_espresso' ),
1908
+	__('delete price modifier', 'event_espresso'),
1909 1909
 
1910 1910
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:14
1911
-	__( 'Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso' ),
1911
+	__('Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso'),
1912 1912
 
1913 1913
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:17
1914
-	__( 'Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso' ),
1914
+	__('Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso'),
1915 1915
 
1916 1916
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21
1917
-	__( 'Disable reverse calculate', 'event_espresso' ),
1917
+	__('Disable reverse calculate', 'event_espresso'),
1918 1918
 
1919 1919
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21
1920
-	__( 'Enable reverse calculate', 'event_espresso' ),
1920
+	__('Enable reverse calculate', 'event_espresso'),
1921 1921
 
1922 1922
 	// Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:28
1923
-	__( 'ticket price calculator', 'event_espresso' ),
1923
+	__('ticket price calculator', 'event_espresso'),
1924 1924
 
1925 1925
 	// Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:9
1926
-	__( 'Add default taxes', 'event_espresso' ),
1926
+	__('Add default taxes', 'event_espresso'),
1927 1927
 
1928 1928
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:10
1929
-	__( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ),
1929
+	__('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'),
1930 1930
 
1931 1931
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:14
1932
-	__( 'Remove all taxes?', 'event_espresso' ),
1932
+	__('Remove all taxes?', 'event_espresso'),
1933 1933
 
1934 1934
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:7
1935
-	__( 'Remove taxes', 'event_espresso' ),
1935
+	__('Remove taxes', 'event_espresso'),
1936 1936
 
1937 1937
 	// Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:29
1938
-	__( 'Modify default prices.', 'event_espresso' ),
1938
+	__('Modify default prices.', 'event_espresso'),
1939 1939
 
1940 1940
 	// Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:29
1941
-	__( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ),
1941
+	__('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'),
1942 1942
 
1943 1943
 	// Reference: packages/tpc/src/components/LockedTicketsBanner.tsx:12
1944
-	__( 'Editing of prices is disabled', 'event_espresso' ),
1944
+	__('Editing of prices is disabled', 'event_espresso'),
1945 1945
 
1946 1946
 	// Reference: packages/tpc/src/components/NoPricesBanner/AddDefaultPricesButton.tsx:9
1947
-	__( 'Add default prices', 'event_espresso' ),
1947
+	__('Add default prices', 'event_espresso'),
1948 1948
 
1949 1949
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:13
1950
-	__( 'This Ticket is Currently Free', 'event_espresso' ),
1950
+	__('This Ticket is Currently Free', 'event_espresso'),
1951 1951
 
1952 1952
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:21
1953 1953
 	/* translators: %s default prices */
1954
-	__( 'Click the button below to load your %s into the calculator.', 'event_espresso' ),
1954
+	__('Click the button below to load your %s into the calculator.', 'event_espresso'),
1955 1955
 
1956 1956
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:22
1957
-	__( 'default prices', 'event_espresso' ),
1957
+	__('default prices', 'event_espresso'),
1958 1958
 
1959 1959
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:29
1960
-	__( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ),
1960
+	__('Additional ticket price modifiers can be added or removed.', 'event_espresso'),
1961 1961
 
1962 1962
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:32
1963
-	__( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ),
1963
+	__('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'),
1964 1964
 
1965 1965
 	// Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:32
1966 1966
 	/* translators: %s ticket name */
1967
-	__( 'Price Calculator for Ticket: %s', 'event_espresso' ),
1967
+	__('Price Calculator for Ticket: %s', 'event_espresso'),
1968 1968
 
1969 1969
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:48
1970
-	__( 'Total', 'event_espresso' ),
1970
+	__('Total', 'event_espresso'),
1971 1971
 
1972 1972
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:57
1973
-	__( 'ticket total', 'event_espresso' ),
1973
+	__('ticket total', 'event_espresso'),
1974 1974
 
1975 1975
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29
1976
-	__( 'Order', 'event_espresso' ),
1976
+	__('Order', 'event_espresso'),
1977 1977
 
1978 1978
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35
1979
-	__( 'Price Type', 'event_espresso' ),
1979
+	__('Price Type', 'event_espresso'),
1980 1980
 
1981 1981
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41
1982
-	__( 'Label', 'event_espresso' ),
1982
+	__('Label', 'event_espresso'),
1983 1983
 
1984 1984
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53
1985
-	__( 'Amount', 'event_espresso' ),
1985
+	__('Amount', 'event_espresso'),
1986 1986
 
1987 1987
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:22
1988
-	__( 'Copy ticket', 'event_espresso' ),
1988
+	__('Copy ticket', 'event_espresso'),
1989 1989
 
1990 1990
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:26
1991
-	__( 'Copy and archive this ticket', 'event_espresso' ),
1991
+	__('Copy and archive this ticket', 'event_espresso'),
1992 1992
 
1993 1993
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:29
1994
-	__( 'OK', 'event_espresso' ),
1994
+	__('OK', 'event_espresso'),
1995 1995
 
1996 1996
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:32
1997
-	__( 'amount', 'event_espresso' ),
1997
+	__('amount', 'event_espresso'),
1998 1998
 
1999 1999
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:44
2000
-	__( 'amount…', 'event_espresso' ),
2000
+	__('amount…', 'event_espresso'),
2001 2001
 
2002 2002
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:14
2003
-	__( 'description…', 'event_espresso' ),
2003
+	__('description…', 'event_espresso'),
2004 2004
 
2005 2005
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:9
2006
-	__( 'price description', 'event_espresso' ),
2006
+	__('price description', 'event_espresso'),
2007 2007
 
2008 2008
 	// Reference: packages/tpc/src/inputs/PriceIdInput.tsx:5
2009
-	__( 'price id', 'event_espresso' ),
2009
+	__('price id', 'event_espresso'),
2010 2010
 
2011 2011
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:13
2012
-	__( 'label…', 'event_espresso' ),
2012
+	__('label…', 'event_espresso'),
2013 2013
 
2014 2014
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:8
2015
-	__( 'price name', 'event_espresso' ),
2015
+	__('price name', 'event_espresso'),
2016 2016
 
2017 2017
 	// Reference: packages/tpc/src/inputs/PriceOrderInput.tsx:14
2018
-	__( 'price order', 'event_espresso' ),
2018
+	__('price order', 'event_espresso'),
2019 2019
 
2020 2020
 	// Reference: packages/tpc/src/utils/constants.ts:8
2021
-	__( 'Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso' ),
2021
+	__('Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso'),
2022 2022
 
2023 2023
 	// Reference: packages/ui-components/src/ActiveFilters/ActiveFilters.tsx:8
2024
-	__( 'active filters:', 'event_espresso' ),
2024
+	__('active filters:', 'event_espresso'),
2025 2025
 
2026 2026
 	// Reference: packages/ui-components/src/ActiveFilters/FilterTag/index.tsx:15
2027 2027
 	/* translators: %s filter name */
2028
-	__( 'remove filter - %s', 'event_espresso' ),
2028
+	__('remove filter - %s', 'event_espresso'),
2029 2029
 
2030 2030
 	// Reference: packages/ui-components/src/Address/Address.tsx:72
2031
-	__( 'Address:', 'event_espresso' ),
2031
+	__('Address:', 'event_espresso'),
2032 2032
 
2033 2033
 	// Reference: packages/ui-components/src/Address/Address.tsx:80
2034
-	__( 'City:', 'event_espresso' ),
2034
+	__('City:', 'event_espresso'),
2035 2035
 
2036 2036
 	// Reference: packages/ui-components/src/Address/Address.tsx:86
2037
-	__( 'State:', 'event_espresso' ),
2037
+	__('State:', 'event_espresso'),
2038 2038
 
2039 2039
 	// Reference: packages/ui-components/src/Address/Address.tsx:92
2040
-	__( 'Country:', 'event_espresso' ),
2040
+	__('Country:', 'event_espresso'),
2041 2041
 
2042 2042
 	// Reference: packages/ui-components/src/Address/Address.tsx:98
2043
-	__( 'Zip:', 'event_espresso' ),
2043
+	__('Zip:', 'event_espresso'),
2044 2044
 
2045 2045
 	// Reference: packages/ui-components/src/CalendarDateRange/CalendarDateRange.tsx:37
2046
-	__( 'to', 'event_espresso' ),
2046
+	__('to', 'event_espresso'),
2047 2047
 
2048 2048
 	// Reference: packages/ui-components/src/CalendarPageDate/CalendarPageDate.tsx:54
2049
-	__( 'TO', 'event_espresso' ),
2049
+	__('TO', 'event_espresso'),
2050 2050
 
2051 2051
 	// Reference: packages/ui-components/src/ColorPicker/ColorPicker.tsx:60
2052
-	__( 'Custom color', 'event_espresso' ),
2052
+	__('Custom color', 'event_espresso'),
2053 2053
 
2054 2054
 	// Reference: packages/ui-components/src/ColorPicker/Swatch.tsx:23
2055 2055
 	/* translators: color name */
2056
-	__( 'Color: %s', 'event_espresso' ),
2056
+	__('Color: %s', 'event_espresso'),
2057 2057
 
2058 2058
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:13
2059
-	__( 'Cyan bluish gray', 'event_espresso' ),
2059
+	__('Cyan bluish gray', 'event_espresso'),
2060 2060
 
2061 2061
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:17
2062
-	__( 'White', 'event_espresso' ),
2062
+	__('White', 'event_espresso'),
2063 2063
 
2064 2064
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:21
2065
-	__( 'Pale pink', 'event_espresso' ),
2065
+	__('Pale pink', 'event_espresso'),
2066 2066
 
2067 2067
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:25
2068
-	__( 'Vivid red', 'event_espresso' ),
2068
+	__('Vivid red', 'event_espresso'),
2069 2069
 
2070 2070
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:29
2071
-	__( 'Luminous vivid orange', 'event_espresso' ),
2071
+	__('Luminous vivid orange', 'event_espresso'),
2072 2072
 
2073 2073
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:33
2074
-	__( 'Luminous vivid amber', 'event_espresso' ),
2074
+	__('Luminous vivid amber', 'event_espresso'),
2075 2075
 
2076 2076
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:37
2077
-	__( 'Light green cyan', 'event_espresso' ),
2077
+	__('Light green cyan', 'event_espresso'),
2078 2078
 
2079 2079
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:41
2080
-	__( 'Vivid green cyan', 'event_espresso' ),
2080
+	__('Vivid green cyan', 'event_espresso'),
2081 2081
 
2082 2082
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:45
2083
-	__( 'Pale cyan blue', 'event_espresso' ),
2083
+	__('Pale cyan blue', 'event_espresso'),
2084 2084
 
2085 2085
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:49
2086
-	__( 'Vivid cyan blue', 'event_espresso' ),
2086
+	__('Vivid cyan blue', 'event_espresso'),
2087 2087
 
2088 2088
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:53
2089
-	__( 'Vivid purple', 'event_espresso' ),
2089
+	__('Vivid purple', 'event_espresso'),
2090 2090
 
2091 2091
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:9
2092
-	__( 'Black', 'event_espresso' ),
2092
+	__('Black', 'event_espresso'),
2093 2093
 
2094 2094
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:7
2095 2095
 	// Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:22
2096
-	__( 'Are you sure you want to close this?', 'event_espresso' ),
2096
+	__('Are you sure you want to close this?', 'event_espresso'),
2097 2097
 
2098 2098
 	// Reference: packages/ui-components/src/Confirm/ConfirmDelete.tsx:7
2099
-	__( 'Are you sure you want to delete this?', 'event_espresso' ),
2099
+	__('Are you sure you want to delete this?', 'event_espresso'),
2100 2100
 
2101 2101
 	// Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:10
2102
-	__( 'Please confirm this action.', 'event_espresso' ),
2102
+	__('Please confirm this action.', 'event_espresso'),
2103 2103
 
2104 2104
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:32
2105
-	__( 'No', 'event_espresso' ),
2105
+	__('No', 'event_espresso'),
2106 2106
 
2107 2107
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:33
2108
-	__( 'Yes', 'event_espresso' ),
2108
+	__('Yes', 'event_espresso'),
2109 2109
 
2110 2110
 	// Reference: packages/ui-components/src/CurrencyDisplay/CurrencyDisplay.tsx:34
2111
-	__( 'free', 'event_espresso' ),
2111
+	__('free', 'event_espresso'),
2112 2112
 
2113 2113
 	// Reference: packages/ui-components/src/DateTimeRangePicker/DateTimeRangePicker.tsx:117
2114 2114
 	// Reference: packages/ui-components/src/Popover/PopoverForm/PopoverForm.tsx:44
2115
-	__( 'save', 'event_espresso' ),
2115
+	__('save', 'event_espresso'),
2116 2116
 
2117 2117
 	// Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36
2118
-	__( 'Hide Debug Info', 'event_espresso' ),
2118
+	__('Hide Debug Info', 'event_espresso'),
2119 2119
 
2120 2120
 	// Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36
2121
-	__( 'Show Debug Info', 'event_espresso' ),
2121
+	__('Show Debug Info', 'event_espresso'),
2122 2122
 
2123 2123
 	// Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:49
2124
-	__( 'Edit Start and End Dates and Times', 'event_espresso' ),
2124
+	__('Edit Start and End Dates and Times', 'event_espresso'),
2125 2125
 
2126 2126
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Copy.tsx:8
2127
-	__( 'copy', 'event_espresso' ),
2127
+	__('copy', 'event_espresso'),
2128 2128
 
2129 2129
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Edit.tsx:8
2130
-	__( 'edit', 'event_espresso' ),
2130
+	__('edit', 'event_espresso'),
2131 2131
 
2132 2132
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Trash.tsx:8
2133
-	__( 'trash', 'event_espresso' ),
2133
+	__('trash', 'event_espresso'),
2134 2134
 
2135 2135
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Untrash.tsx:8
2136
-	__( 'untrash', 'event_espresso' ),
2136
+	__('untrash', 'event_espresso'),
2137 2137
 
2138 2138
 	// Reference: packages/ui-components/src/EntityDetailsPanel/EntityDetailsPanelSold.tsx:37
2139
-	__( 'view approved registrations for this date.', 'event_espresso' ),
2139
+	__('view approved registrations for this date.', 'event_espresso'),
2140 2140
 
2141 2141
 	// Reference: packages/ui-components/src/EntityDetailsPanel/EntityDetailsPanelSold.tsx:38
2142
-	__( 'view approved registrations for this ticket.', 'event_espresso' ),
2142
+	__('view approved registrations for this ticket.', 'event_espresso'),
2143 2143
 
2144 2144
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22
2145
-	__( 'card view', 'event_espresso' ),
2145
+	__('card view', 'event_espresso'),
2146 2146
 
2147 2147
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:21
2148
-	__( 'table view', 'event_espresso' ),
2148
+	__('table view', 'event_espresso'),
2149 2149
 
2150 2150
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8
2151
-	__( 'hide bulk actions', 'event_espresso' ),
2151
+	__('hide bulk actions', 'event_espresso'),
2152 2152
 
2153 2153
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8
2154
-	__( 'show bulk actions', 'event_espresso' ),
2154
+	__('show bulk actions', 'event_espresso'),
2155 2155
 
2156 2156
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:9
2157
-	__( 'hide filters', 'event_espresso' ),
2157
+	__('hide filters', 'event_espresso'),
2158 2158
 
2159 2159
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:9
2160
-	__( 'show filters', 'event_espresso' ),
2160
+	__('show filters', 'event_espresso'),
2161 2161
 
2162 2162
 	// Reference: packages/ui-components/src/Legend/ToggleLegendButton.tsx:26
2163
-	__( 'hide legend', 'event_espresso' ),
2163
+	__('hide legend', 'event_espresso'),
2164 2164
 
2165 2165
 	// Reference: packages/ui-components/src/Legend/ToggleLegendButton.tsx:26
2166
-	__( 'show legend', 'event_espresso' ),
2166
+	__('show legend', 'event_espresso'),
2167 2167
 
2168 2168
 	// Reference: packages/ui-components/src/LoadingNotice/LoadingNotice.tsx:11
2169
-	__( 'loading…', 'event_espresso' ),
2169
+	__('loading…', 'event_espresso'),
2170 2170
 
2171 2171
 	// Reference: packages/ui-components/src/Modal/Modal.tsx:58
2172
-	__( 'close modal', 'event_espresso' ),
2172
+	__('close modal', 'event_espresso'),
2173 2173
 
2174 2174
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:10
2175
-	__( 'jump to previous', 'event_espresso' ),
2175
+	__('jump to previous', 'event_espresso'),
2176 2176
 
2177 2177
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:11
2178
-	__( 'jump to next', 'event_espresso' ),
2178
+	__('jump to next', 'event_espresso'),
2179 2179
 
2180 2180
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:12
2181
-	__( 'page', 'event_espresso' ),
2181
+	__('page', 'event_espresso'),
2182 2182
 
2183 2183
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:8
2184
-	__( 'previous', 'event_espresso' ),
2184
+	__('previous', 'event_espresso'),
2185 2185
 
2186 2186
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:9
2187
-	__( 'next', 'event_espresso' ),
2187
+	__('next', 'event_espresso'),
2188 2188
 
2189 2189
 	// Reference: packages/ui-components/src/Pagination/PerPage.tsx:37
2190
-	__( 'items per page', 'event_espresso' ),
2190
+	__('items per page', 'event_espresso'),
2191 2191
 
2192 2192
 	// Reference: packages/ui-components/src/Pagination/constants.ts:10
2193 2193
 	/* translators: %s is per page value */
2194
-	__( '%s / page', 'event_espresso' ),
2194
+	__('%s / page', 'event_espresso'),
2195 2195
 
2196 2196
 	// Reference: packages/ui-components/src/Pagination/constants.ts:13
2197
-	__( 'Next Page', 'event_espresso' ),
2197
+	__('Next Page', 'event_espresso'),
2198 2198
 
2199 2199
 	// Reference: packages/ui-components/src/Pagination/constants.ts:14
2200
-	__( 'Previous Page', 'event_espresso' ),
2200
+	__('Previous Page', 'event_espresso'),
2201 2201
 
2202 2202
 	// Reference: packages/ui-components/src/PercentSign/index.tsx:10
2203
-	__( '%', 'event_espresso' ),
2203
+	__('%', 'event_espresso'),
2204 2204
 
2205 2205
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:31
2206 2206
 	/* translators: entity type to select */
2207
-	__( 'Select an existing %s to use as a template.', 'event_espresso' ),
2207
+	__('Select an existing %s to use as a template.', 'event_espresso'),
2208 2208
 
2209 2209
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:38
2210
-	__( 'or', 'event_espresso' ),
2210
+	__('or', 'event_espresso'),
2211 2211
 
2212 2212
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:43
2213 2213
 	/* translators: entity type to add */
2214
-	__( 'Add a new %s and insert details manually', 'event_espresso' ),
2214
+	__('Add a new %s and insert details manually', 'event_espresso'),
2215 2215
 
2216 2216
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:48
2217
-	__( 'Add New', 'event_espresso' ),
2217
+	__('Add New', 'event_espresso'),
2218 2218
 
2219 2219
 	// Reference: packages/ui-components/src/Stepper/buttons/Next.tsx:8
2220
-	__( 'Next', 'event_espresso' ),
2220
+	__('Next', 'event_espresso'),
2221 2221
 
2222 2222
 	// Reference: packages/ui-components/src/Stepper/buttons/Previous.tsx:8
2223
-	__( 'Previous', 'event_espresso' ),
2223
+	__('Previous', 'event_espresso'),
2224 2224
 
2225 2225
 	// Reference: packages/ui-components/src/Steps/Steps.tsx:31
2226
-	__( 'Steps', 'event_espresso' ),
2226
+	__('Steps', 'event_espresso'),
2227 2227
 
2228 2228
 	// Reference: packages/ui-components/src/TabbableText/index.tsx:21
2229
-	__( 'click to edit…', 'event_espresso' ),
2229
+	__('click to edit…', 'event_espresso'),
2230 2230
 
2231 2231
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:14
2232
-	__( 'The Website\'s Time Zone', 'event_espresso' ),
2232
+	__('The Website\'s Time Zone', 'event_espresso'),
2233 2233
 
2234 2234
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:19
2235
-	__( 'UTC (Greenwich Mean Time)', 'event_espresso' ),
2235
+	__('UTC (Greenwich Mean Time)', 'event_espresso'),
2236 2236
 
2237 2237
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:9
2238
-	__( 'Your Local Time Zone', 'event_espresso' ),
2238
+	__('Your Local Time Zone', 'event_espresso'),
2239 2239
 
2240 2240
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:27
2241
-	__( 'click for timezone information', 'event_espresso' ),
2241
+	__('click for timezone information', 'event_espresso'),
2242 2242
 
2243 2243
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:32
2244
-	__( 'This Date Converted To:', 'event_espresso' ),
2244
+	__('This Date Converted To:', 'event_espresso'),
2245 2245
 
2246 2246
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:120
2247
-	__( 'Add New Venue', 'event_espresso' ),
2247
+	__('Add New Venue', 'event_espresso'),
2248 2248
 
2249 2249
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:36
2250
-	__( '~ no venue ~', 'event_espresso' ),
2250
+	__('~ no venue ~', 'event_espresso'),
2251 2251
 
2252 2252
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:43
2253
-	__( 'assign venue…', 'event_espresso' ),
2253
+	__('assign venue…', 'event_espresso'),
2254 2254
 
2255 2255
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:44
2256
-	__( 'click to select a venue…', 'event_espresso' ),
2256
+	__('click to select a venue…', 'event_espresso'),
2257 2257
 
2258 2258
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:51
2259
-	__( 'select all', 'event_espresso' ),
2259
+	__('select all', 'event_espresso'),
2260 2260
 
2261 2261
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:54
2262
-	__( 'apply', 'event_espresso' )
2262
+	__('apply', 'event_espresso')
2263 2263
 );
2264 2264
 /* THIS IS THE END OF THE GENERATED FILE */
Please login to merge, or discard this patch.