@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param array $options |
16 | 16 | */ |
17 | - public function __construct($options = array()){ |
|
17 | + public function __construct($options = array()) { |
|
18 | 18 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
19 | 19 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
20 | 20 | parent::__construct($options); |
21 | 21 | //if the input hasn't specifically mentioned a more lenient validation strategy, |
22 | 22 | //apply plaintext validation strategy |
23 | - if( ! $this->has_validation_strategy( |
|
23 | + if ( ! $this->has_validation_strategy( |
|
24 | 24 | array( |
25 | 25 | 'EE_Full_HTML_Validation_Strategy', |
26 | 26 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ) { |
30 | 30 | //by default we use the plaintext validation. If you want something else, |
31 | 31 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
32 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
32 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 |
@@ -8,8 +8,8 @@ |
||
8 | 8 | foreach( $form_section->subsections() as $subsection ) { |
9 | 9 | if( $subsection instanceof EE_Form_Input_Base ) { |
10 | 10 | if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal |
11 | - || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
|
12 | - || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
|
11 | + || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
|
12 | + || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
|
13 | 13 | continue; |
14 | 14 | } |
15 | 15 | if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
@@ -1,38 +1,38 @@ |
||
1 | 1 | <div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv"> |
2 | -<?php if ( empty($billing_form) ) : ?> |
|
2 | +<?php if (empty($billing_form)) : ?> |
|
3 | 3 | <div class="clearfix"> |
4 | - <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
|
4 | + <?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/> |
|
5 | 5 | </div> |
6 | 6 | <?php else : |
7 | - function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) { |
|
8 | - foreach( $form_section->subsections() as $subsection ) { |
|
9 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
10 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal |
|
7 | + function ee_show_billing_info_cleaned(EE_Form_Section_Proper $form_section, $found_cc_data = false) { |
|
8 | + foreach ($form_section->subsections() as $subsection) { |
|
9 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
10 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal |
|
11 | 11 | || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
12 | - || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
|
12 | + || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy) { |
|
13 | 13 | continue; |
14 | 14 | } |
15 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
|
15 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal) { |
|
16 | 16 | $found_cc_data = true; |
17 | 17 | } |
18 | 18 | ?> |
19 | 19 | <div class="clearfix"> |
20 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label();?></span><?php echo $subsection->pretty_value();?> |
|
20 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label(); ?></span><?php echo $subsection->pretty_value(); ?> |
|
21 | 21 | </div><?php |
22 | - } elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
23 | - $found_cc_data = ee_show_billing_info_cleaned( $subsection, $found_cc_data); |
|
22 | + } elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
23 | + $found_cc_data = ee_show_billing_info_cleaned($subsection, $found_cc_data); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | return $found_cc_data; |
27 | 27 | } |
28 | - $found_cc_data = ee_show_billing_info_cleaned( $billing_form ); |
|
29 | - if( apply_filters( |
|
28 | + $found_cc_data = ee_show_billing_info_cleaned($billing_form); |
|
29 | + if (apply_filters( |
|
30 | 30 | 'FHEE__txn_admin_details_side_meta_box_billing_info__show_default_note', |
31 | 31 | $found_cc_data, |
32 | - $billing_form ) ) {?> |
|
33 | - <p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p> |
|
32 | + $billing_form )) {?> |
|
33 | + <p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p> |
|
34 | 34 | <?php } |
35 | - do_action( 'AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form ); |
|
35 | + do_action('AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form); |
|
36 | 36 | endif; ?> |
37 | 37 | |
38 | 38 | </div> |
@@ -3,7 +3,8 @@ discard block |
||
3 | 3 | <div class="clearfix"> |
4 | 4 | <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
5 | 5 | </div> |
6 | -<?php else : |
|
6 | +<?php else { |
|
7 | + : |
|
7 | 8 | function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) { |
8 | 9 | foreach( $form_section->subsections() as $subsection ) { |
9 | 10 | if( $subsection instanceof EE_Form_Input_Base ) { |
@@ -11,6 +12,7 @@ discard block |
||
11 | 12 | || $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal |
12 | 13 | || $subsection->get_display_strategy() instanceof EE_Hidden_Display_Strategy ){ |
13 | 14 | continue; |
15 | +} |
|
14 | 16 | } |
15 | 17 | if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
16 | 18 | $found_cc_data = true; |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | "display-{$this->cssId()}", |
97 | 97 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
98 | 98 | '', |
99 | - 'rel="' . $this->cssId() . '"' |
|
100 | - ) . \EEH_HTML::link( |
|
99 | + 'rel="'.$this->cssId().'"' |
|
100 | + ).\EEH_HTML::link( |
|
101 | 101 | '', |
102 | 102 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
103 | 103 | esc_attr( |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | "hide-{$this->cssId()}", |
110 | 110 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
111 | 111 | 'display:none;', |
112 | - 'rel="' . $this->cssId() . '"' |
|
112 | + 'rel="'.$this->cssId().'"' |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return \EEH_Template::locate_template( |
164 | 164 | apply_filters( |
165 | 165 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
166 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
167 | 167 | $this->ticket |
168 | 168 | ), |
169 | 169 | $template_args |
@@ -17,198 +17,198 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @var \EE_Ticket $ticket |
|
22 | - */ |
|
23 | - protected $ticket; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
27 | - */ |
|
28 | - protected $template_settings; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string $date_format |
|
32 | - */ |
|
33 | - protected $date_format; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var string $time_format |
|
37 | - */ |
|
38 | - protected $time_format; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var boolean $event_is_expired |
|
42 | - */ |
|
43 | - protected $event_is_expired; |
|
44 | - |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * TicketDetails constructor. |
|
49 | - * |
|
50 | - * @param \EE_Ticket $ticket |
|
51 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
52 | - * @param array $template_args |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - \EE_Ticket $ticket, |
|
56 | - \EE_Ticket_Selector_Config $template_settings, |
|
57 | - array $template_args |
|
58 | - ) |
|
59 | - { |
|
60 | - $this->ticket = $ticket; |
|
61 | - $this->template_settings = $template_settings; |
|
62 | - $this->date_format = $template_args['date_format']; |
|
63 | - $this->time_format = $template_args['time_format']; |
|
64 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @return \EE_Ticket |
|
71 | - */ |
|
72 | - public function getTicket() |
|
73 | - { |
|
74 | - return $this->ticket; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @return bool |
|
81 | - */ |
|
82 | - public function showTicketDetails() |
|
83 | - { |
|
84 | - return $this->template_settings->show_ticket_details; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @return \EE_Ticket_Selector_Config |
|
91 | - */ |
|
92 | - public function getTemplateSettings() |
|
93 | - { |
|
94 | - return $this->template_settings; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function getDateFormat() |
|
103 | - { |
|
104 | - return $this->date_format; |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public function getTimeFormat() |
|
113 | - { |
|
114 | - return $this->time_format; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function getShowHideLinks() |
|
123 | - { |
|
124 | - if ( ! $this->showTicketDetails()) { |
|
125 | - return ''; |
|
126 | - } |
|
127 | - return \EEH_HTML::link( |
|
128 | - '', |
|
129 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
130 | - esc_attr( |
|
131 | - apply_filters( |
|
132 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
133 | - __('click to show additional ticket details', 'event_espresso') |
|
134 | - ) |
|
135 | - ), |
|
136 | - "display-{$this->cssId()}", |
|
137 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
138 | - '', |
|
139 | - 'rel="' . $this->cssId() . '"' |
|
140 | - ) . \EEH_HTML::link( |
|
141 | - '', |
|
142 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
143 | - esc_attr( |
|
144 | - apply_filters( |
|
145 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
146 | - __('click to hide additional ticket details', 'event_espresso') |
|
147 | - ) |
|
148 | - ), |
|
149 | - "hide-{$this->cssId()}", |
|
150 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
151 | - 'display:none;', |
|
152 | - 'rel="' . $this->cssId() . '"' |
|
153 | - ); |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * @return string |
|
160 | - */ |
|
161 | - public function cssId() |
|
162 | - { |
|
163 | - return apply_filters( |
|
164 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
165 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
166 | - ); |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * @param float $ticket_price |
|
173 | - * @param int $remaining |
|
174 | - * @param int $cols |
|
175 | - * @return string |
|
176 | - */ |
|
177 | - public function display( |
|
178 | - $ticket_price = 0.00, |
|
179 | - $remaining, |
|
180 | - $cols = 2 |
|
181 | - ) { |
|
182 | - $template_args = array(); |
|
183 | - $template_args['ticket'] = $this->ticket; |
|
184 | - $template_args['ticket_price'] = $ticket_price; |
|
185 | - $template_args['remaining'] = $remaining; |
|
186 | - $template_args['cols'] = $cols; |
|
187 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
188 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
189 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
190 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
191 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
192 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
193 | - true |
|
194 | - ); |
|
195 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
196 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
197 | - esc_html__('Price', 'event_espresso') |
|
198 | - ); |
|
199 | - $template_args['date_format'] = $this->date_format; |
|
200 | - $template_args['time_format'] = $this->time_format; |
|
201 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
202 | - |
|
203 | - return \EEH_Template::locate_template( |
|
204 | - apply_filters( |
|
205 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
206 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
207 | - $this->ticket |
|
208 | - ), |
|
209 | - $template_args |
|
210 | - ); |
|
211 | - } |
|
20 | + /** |
|
21 | + * @var \EE_Ticket $ticket |
|
22 | + */ |
|
23 | + protected $ticket; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
27 | + */ |
|
28 | + protected $template_settings; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string $date_format |
|
32 | + */ |
|
33 | + protected $date_format; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var string $time_format |
|
37 | + */ |
|
38 | + protected $time_format; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var boolean $event_is_expired |
|
42 | + */ |
|
43 | + protected $event_is_expired; |
|
44 | + |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * TicketDetails constructor. |
|
49 | + * |
|
50 | + * @param \EE_Ticket $ticket |
|
51 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
52 | + * @param array $template_args |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + \EE_Ticket $ticket, |
|
56 | + \EE_Ticket_Selector_Config $template_settings, |
|
57 | + array $template_args |
|
58 | + ) |
|
59 | + { |
|
60 | + $this->ticket = $ticket; |
|
61 | + $this->template_settings = $template_settings; |
|
62 | + $this->date_format = $template_args['date_format']; |
|
63 | + $this->time_format = $template_args['time_format']; |
|
64 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @return \EE_Ticket |
|
71 | + */ |
|
72 | + public function getTicket() |
|
73 | + { |
|
74 | + return $this->ticket; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @return bool |
|
81 | + */ |
|
82 | + public function showTicketDetails() |
|
83 | + { |
|
84 | + return $this->template_settings->show_ticket_details; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @return \EE_Ticket_Selector_Config |
|
91 | + */ |
|
92 | + public function getTemplateSettings() |
|
93 | + { |
|
94 | + return $this->template_settings; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function getDateFormat() |
|
103 | + { |
|
104 | + return $this->date_format; |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public function getTimeFormat() |
|
113 | + { |
|
114 | + return $this->time_format; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function getShowHideLinks() |
|
123 | + { |
|
124 | + if ( ! $this->showTicketDetails()) { |
|
125 | + return ''; |
|
126 | + } |
|
127 | + return \EEH_HTML::link( |
|
128 | + '', |
|
129 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
130 | + esc_attr( |
|
131 | + apply_filters( |
|
132 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
133 | + __('click to show additional ticket details', 'event_espresso') |
|
134 | + ) |
|
135 | + ), |
|
136 | + "display-{$this->cssId()}", |
|
137 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
138 | + '', |
|
139 | + 'rel="' . $this->cssId() . '"' |
|
140 | + ) . \EEH_HTML::link( |
|
141 | + '', |
|
142 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
143 | + esc_attr( |
|
144 | + apply_filters( |
|
145 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
146 | + __('click to hide additional ticket details', 'event_espresso') |
|
147 | + ) |
|
148 | + ), |
|
149 | + "hide-{$this->cssId()}", |
|
150 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
151 | + 'display:none;', |
|
152 | + 'rel="' . $this->cssId() . '"' |
|
153 | + ); |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * @return string |
|
160 | + */ |
|
161 | + public function cssId() |
|
162 | + { |
|
163 | + return apply_filters( |
|
164 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
165 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
166 | + ); |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * @param float $ticket_price |
|
173 | + * @param int $remaining |
|
174 | + * @param int $cols |
|
175 | + * @return string |
|
176 | + */ |
|
177 | + public function display( |
|
178 | + $ticket_price = 0.00, |
|
179 | + $remaining, |
|
180 | + $cols = 2 |
|
181 | + ) { |
|
182 | + $template_args = array(); |
|
183 | + $template_args['ticket'] = $this->ticket; |
|
184 | + $template_args['ticket_price'] = $ticket_price; |
|
185 | + $template_args['remaining'] = $remaining; |
|
186 | + $template_args['cols'] = $cols; |
|
187 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
188 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
189 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
190 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
191 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
192 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
193 | + true |
|
194 | + ); |
|
195 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
196 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
197 | + esc_html__('Price', 'event_espresso') |
|
198 | + ); |
|
199 | + $template_args['date_format'] = $this->date_format; |
|
200 | + $template_args['time_format'] = $this->time_format; |
|
201 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
202 | + |
|
203 | + return \EEH_Template::locate_template( |
|
204 | + apply_filters( |
|
205 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
206 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
207 | + $this->ticket |
|
208 | + ), |
|
209 | + $template_args |
|
210 | + ); |
|
211 | + } |
|
212 | 212 | |
213 | 213 | } |
214 | 214 | // End of file TicketDetails.php |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <h3><?php esc_html_e('Need help with Event Espresso?', 'event_espresso'); ?></h3> |
3 | 3 | |
4 | - <h4><?php esc_html_e( 'You may be able to find an answer for your question or concern here:', 'event_espresso' ); ?></h4> |
|
4 | + <h4><?php esc_html_e('You may be able to find an answer for your question or concern here:', 'event_espresso'); ?></h4> |
|
5 | 5 | <ol> |
6 | - <li><strong><em><?php esc_html_e( 'A known issue.', 'event_espresso' ); ?></em></strong> <?php printf( esc_html__( 'Some themes and plugins have %1$sknown conflicts%2$s with Event Espresso. (You can also browse the %3$sEvent Espresso support pages%2$s or %4$sEvent Espresso support forums%2$s to see if other members have experienced and solved the problem.)', 'event_espresso' ), '<a href="https://eventespresso.com/wiki/known-third-party-plugin-theme-conflicts/" target="_blank">','</a>', '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4" target="_blank">', '<a href="https://eventespresso.com/support/forums/" target="_blank">' ); ?></li> |
|
7 | - <li><strong><em><?php esc_html_e( 'A plugin conflict.', 'event_espresso' ); ?></em></strong> <?php esc_html_e( 'You can check to see if there is a plugin conflict by temporarily deactivating all plugins except for Event Espresso. If the problem goes away, then reactivate your plugins one by one until the issue returns. This will help you pinpoint the source of the conflict.', 'event_espresso' ); ?></li> |
|
6 | + <li><strong><em><?php esc_html_e('A known issue.', 'event_espresso'); ?></em></strong> <?php printf(esc_html__('Some themes and plugins have %1$sknown conflicts%2$s with Event Espresso. (You can also browse the %3$sEvent Espresso support pages%2$s or %4$sEvent Espresso support forums%2$s to see if other members have experienced and solved the problem.)', 'event_espresso'), '<a href="https://eventespresso.com/wiki/known-third-party-plugin-theme-conflicts/" target="_blank">', '</a>', '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4" target="_blank">', '<a href="https://eventespresso.com/support/forums/" target="_blank">'); ?></li> |
|
7 | + <li><strong><em><?php esc_html_e('A plugin conflict.', 'event_espresso'); ?></em></strong> <?php esc_html_e('You can check to see if there is a plugin conflict by temporarily deactivating all plugins except for Event Espresso. If the problem goes away, then reactivate your plugins one by one until the issue returns. This will help you pinpoint the source of the conflict.', 'event_espresso'); ?></li> |
|
8 | 8 | <li> |
9 | - <strong><em><?php esc_html_e( 'A theme conflict.', 'event_espresso' ); ?></em></strong> |
|
9 | + <strong><em><?php esc_html_e('A theme conflict.', 'event_espresso'); ?></em></strong> |
|
10 | 10 | <?php |
11 | - $default_theme = wp_get_theme( WP_DEFAULT_THEME ); |
|
11 | + $default_theme = wp_get_theme(WP_DEFAULT_THEME); |
|
12 | 12 | |
13 | - if ( $default_theme->exists() ) { |
|
14 | - printf( esc_html__( 'If your problem is not a known issue or caused by a plugin, then try activating %s (the default WordPress theme).', 'event_espresso' ), $default_theme->get( 'Name' ) ); |
|
13 | + if ($default_theme->exists()) { |
|
14 | + printf(esc_html__('If your problem is not a known issue or caused by a plugin, then try activating %s (the default WordPress theme).', 'event_espresso'), $default_theme->get('Name')); |
|
15 | 15 | } else { |
16 | - esc_html_e( 'If your problem is not a known issue or caused by a plugin, then try activating the default WordPress theme.', 'event_espresso' ); |
|
16 | + esc_html_e('If your problem is not a known issue or caused by a plugin, then try activating the default WordPress theme.', 'event_espresso'); |
|
17 | 17 | } |
18 | 18 | ?> |
19 | - <?php esc_html_e( 'If this solves the problem for you, then something in your theme is causing this issue. Check to see if an update is available for your WordPress theme or reach out to the theme author.', 'event_espresso' ); ?> |
|
19 | + <?php esc_html_e('If this solves the problem for you, then something in your theme is causing this issue. Check to see if an update is available for your WordPress theme or reach out to the theme author.', 'event_espresso'); ?> |
|
20 | 20 | </li> |
21 | 21 | </ol> |
22 | 22 | |
23 | - <p><?php esc_html_e( 'If none of the suggestions above help you find a solution, then feel free to reach out to the support team at Event Espresso.', 'event_espresso' ); ?></p> |
|
24 | - <p><?php printf( esc_html__( 'Login to your account on EventEspresso.com and %1$screate a support post in our member support forums%2$s. Use a %3$sclear and descriptive title%4$s in your support post, %3$sdescribe the issue to the best of your knowledge%4$s, and %3$snever post any sensitive information such as login details%4$s. Be sure to also include %5$simportant information in the section below%2$s about your WordPress site.', 'event_espresso' ), '<a href="https://eventespresso.com/support/forums/" target="_blank">','</a>','<strong>','</strong>','<a href="#espresso_important_information_settings">' ); ?></p> |
|
23 | + <p><?php esc_html_e('If none of the suggestions above help you find a solution, then feel free to reach out to the support team at Event Espresso.', 'event_espresso'); ?></p> |
|
24 | + <p><?php printf(esc_html__('Login to your account on EventEspresso.com and %1$screate a support post in our member support forums%2$s. Use a %3$sclear and descriptive title%4$s in your support post, %3$sdescribe the issue to the best of your knowledge%4$s, and %3$snever post any sensitive information such as login details%4$s. Be sure to also include %5$simportant information in the section below%2$s about your WordPress site.', 'event_espresso'), '<a href="https://eventespresso.com/support/forums/" target="_blank">', '</a>', '<strong>', '</strong>', '<a href="#espresso_important_information_settings">'); ?></p> |
|
25 | 25 | |
26 | - <h4><?php esc_html_e( 'Have an emergency?', 'event_espresso' ); ?></h4> |
|
26 | + <h4><?php esc_html_e('Have an emergency?', 'event_espresso'); ?></h4> |
|
27 | 27 | |
28 | - <p><?php printf( esc_html__( 'We offer support tokens to members that need help with a time-sensitive issue. A support token will provide you with up to 30 minutes of one-on-one time with a team member at Event Espresso. If you have an emergency and need help quickly, then please %1$spurchase a support token%2$s.', 'event_espresso' ), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">','</a>' ); ?></p> |
|
28 | + <p><?php printf(esc_html__('We offer support tokens to members that need help with a time-sensitive issue. A support token will provide you with up to 30 minutes of one-on-one time with a team member at Event Espresso. If you have an emergency and need help quickly, then please %1$spurchase a support token%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">', '</a>'); ?></p> |
|
29 | 29 | </div> |
30 | 30 | \ No newline at end of file |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <div class="padding"> |
2 | - <?php esc_html_e( 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', 'event_espresso' ); ?> |
|
3 | - <h2><?php esc_html_e( 'Developer Resources', 'event_espresso' ); ?></h2> |
|
2 | + <?php esc_html_e('If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', 'event_espresso'); ?> |
|
3 | + <h2><?php esc_html_e('Developer Resources', 'event_espresso'); ?></h2> |
|
4 | 4 | <ul> |
5 | - <li><?php printf( esc_html__( '%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank">','</a>' ); ?></li> |
|
6 | - <li><?php printf( esc_html__( '%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso' ), '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
7 | - <li><?php printf( esc_html__( '%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>','<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' ); ?></li> |
|
5 | + <li><?php printf(esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank">', '</a>'); ?></li> |
|
6 | + <li><?php printf(esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
7 | + <li><?php printf(esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>', '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">'); ?></li> |
|
8 | 8 | </ul> |
9 | 9 | |
10 | - <h2><?php esc_html_e( 'Event Espresso 4 Articles for Developers', 'event_espresso' ); ?></h2> |
|
10 | + <h2><?php esc_html_e('Event Espresso 4 Articles for Developers', 'event_espresso'); ?></h2> |
|
11 | 11 | <ul> |
12 | - <li><?php printf( esc_html__( '%1$sCustom Post Types Usage%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
13 | - <li><?php printf( esc_html__( '%1$sTheme Development%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
14 | - <li><?php printf( esc_html__( '%1$sCapability System%2$s', 'event_espresso' ), '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
15 | - <li><?php printf( esc_html__( '%1$sPayment Method Development%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank">','</a>' ); ?></li> |
|
16 | - <li><?php printf( esc_html__( '%1$sMessages System in Event Espresso 4%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
17 | - <li><?php printf( esc_html__( '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', 'event_espresso' ), '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li> |
|
12 | + <li><?php printf(esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
13 | + <li><?php printf(esc_html__('%1$sTheme Development%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
14 | + <li><?php printf(esc_html__('%1$sCapability System%2$s', 'event_espresso'), '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
15 | + <li><?php printf(esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank">', '</a>'); ?></li> |
|
16 | + <li><?php printf(esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
17 | + <li><?php printf(esc_html__('%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', 'event_espresso'), '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li> |
|
18 | 18 | </ul> |
19 | 19 | |
20 | - <h2><?php esc_html_e( 'REST API Resources', 'event_espresso' ); ?></h2> |
|
20 | + <h2><?php esc_html_e('REST API Resources', 'event_espresso'); ?></h2> |
|
21 | 21 | <ul> |
22 | - <li><?php printf( esc_html__( '%1$sREST API: Introduction%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank">','</a>' ); ?></li> |
|
23 | - <li><?php printf( esc_html__( '%1$sREST API: Reading Data%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank">','</a>' ); ?></li> |
|
24 | - <li><?php printf( esc_html__( '%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank">','</a>' ); ?></li> |
|
22 | + <li><?php printf(esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank">', '</a>'); ?></li> |
|
23 | + <li><?php printf(esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank">', '</a>'); ?></li> |
|
24 | + <li><?php printf(esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank">', '</a>'); ?></li> |
|
25 | 25 | </ul> |
26 | 26 | </div> |
27 | 27 | \ No newline at end of file |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * returns any events attached to this attendee ($_Event property); |
581 | 581 | * |
582 | - * @return array |
|
582 | + * @return EE_Base_Class[] |
|
583 | 583 | */ |
584 | 584 | public function events() |
585 | 585 | { |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * used to save the billing info |
595 | 595 | * |
596 | 596 | * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
597 | - * @return EE_Form_Section_Proper|null |
|
597 | + * @return null|EE_Billing_Info_Form |
|
598 | 598 | */ |
599 | 599 | public function billing_info_for_payment_method($payment_method) |
600 | 600 | { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -23,670 +23,670 @@ discard block |
||
23 | 23 | class EE_Attendee extends EE_CPT_Base implements EEI_Contact, EEI_Address, EEI_Admin_Links, EEI_Attendee |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Sets some dynamic defaults |
|
28 | - * |
|
29 | - * @param array $fieldValues |
|
30 | - * @param bool $bydb |
|
31 | - * @param string $timezone |
|
32 | - * @param array $date_formats |
|
33 | - */ |
|
34 | - protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array()) |
|
35 | - { |
|
36 | - if (! isset($fieldValues['ATT_full_name'])) { |
|
37 | - $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; |
|
38 | - $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
39 | - $fieldValues['ATT_full_name'] = $fname . $lname; |
|
40 | - } |
|
41 | - if (! isset($fieldValues['ATT_slug'])) { |
|
42 | - // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
|
43 | - $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
44 | - } |
|
45 | - if (! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
46 | - $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
47 | - } |
|
48 | - parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @param array $props_n_values incoming values |
|
54 | - * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
55 | - * used.) |
|
56 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
57 | - * date_format and the second value is the time format |
|
58 | - * @return EE_Attendee |
|
59 | - */ |
|
60 | - public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
61 | - { |
|
62 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
63 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @param array $props_n_values incoming values from the database |
|
69 | - * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
70 | - * the website will be used. |
|
71 | - * @return EE_Attendee |
|
72 | - */ |
|
73 | - public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
74 | - { |
|
75 | - return new self($props_n_values, true, $timezone); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Set Attendee First Name |
|
81 | - * |
|
82 | - * @access public |
|
83 | - * @param string $fname |
|
84 | - */ |
|
85 | - public function set_fname($fname = '') |
|
86 | - { |
|
87 | - $this->set('ATT_fname', $fname); |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * Set Attendee Last Name |
|
93 | - * |
|
94 | - * @access public |
|
95 | - * @param string $lname |
|
96 | - */ |
|
97 | - public function set_lname($lname = '') |
|
98 | - { |
|
99 | - $this->set('ATT_lname', $lname); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * Set Attendee Address |
|
105 | - * |
|
106 | - * @access public |
|
107 | - * @param string $address |
|
108 | - */ |
|
109 | - public function set_address($address = '') |
|
110 | - { |
|
111 | - $this->set('ATT_address', $address); |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * Set Attendee Address2 |
|
117 | - * |
|
118 | - * @access public |
|
119 | - * @param string $address2 |
|
120 | - */ |
|
121 | - public function set_address2($address2 = '') |
|
122 | - { |
|
123 | - $this->set('ATT_address2', $address2); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * Set Attendee City |
|
129 | - * |
|
130 | - * @access public |
|
131 | - * @param string $city |
|
132 | - */ |
|
133 | - public function set_city($city = '') |
|
134 | - { |
|
135 | - $this->set('ATT_city', $city); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * Set Attendee State ID |
|
141 | - * |
|
142 | - * @access public |
|
143 | - * @param int $STA_ID |
|
144 | - */ |
|
145 | - public function set_state($STA_ID = 0) |
|
146 | - { |
|
147 | - $this->set('STA_ID', $STA_ID); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * Set Attendee Country ISO Code |
|
153 | - * |
|
154 | - * @access public |
|
155 | - * @param string $CNT_ISO |
|
156 | - */ |
|
157 | - public function set_country($CNT_ISO = '') |
|
158 | - { |
|
159 | - $this->set('CNT_ISO', $CNT_ISO); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * Set Attendee Zip/Postal Code |
|
165 | - * |
|
166 | - * @access public |
|
167 | - * @param string $zip |
|
168 | - */ |
|
169 | - public function set_zip($zip = '') |
|
170 | - { |
|
171 | - $this->set('ATT_zip', $zip); |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * Set Attendee Email Address |
|
177 | - * |
|
178 | - * @access public |
|
179 | - * @param string $email |
|
180 | - */ |
|
181 | - public function set_email($email = '') |
|
182 | - { |
|
183 | - $this->set('ATT_email', $email); |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * Set Attendee Phone |
|
189 | - * |
|
190 | - * @access public |
|
191 | - * @param string $phone |
|
192 | - */ |
|
193 | - public function set_phone($phone = '') |
|
194 | - { |
|
195 | - $this->set('ATT_phone', $phone); |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - /** |
|
200 | - * set deleted |
|
201 | - * |
|
202 | - * @access public |
|
203 | - * @param bool $ATT_deleted |
|
204 | - */ |
|
205 | - public function set_deleted($ATT_deleted = false) |
|
206 | - { |
|
207 | - $this->set('ATT_deleted', $ATT_deleted); |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - /** |
|
212 | - * Returns the value for the post_author id saved with the cpt |
|
213 | - * |
|
214 | - * @since 4.5.0 |
|
215 | - * @return int |
|
216 | - */ |
|
217 | - public function wp_user() |
|
218 | - { |
|
219 | - return $this->get('ATT_author'); |
|
220 | - } |
|
221 | - |
|
222 | - |
|
223 | - /** |
|
224 | - * get Attendee First Name |
|
225 | - * |
|
226 | - * @access public |
|
227 | - * @return string |
|
228 | - */ |
|
229 | - public function fname() |
|
230 | - { |
|
231 | - return $this->get('ATT_fname'); |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * echoes out the attendee's first name |
|
237 | - * |
|
238 | - * @return void |
|
239 | - */ |
|
240 | - public function e_full_name() |
|
241 | - { |
|
242 | - echo $this->full_name(); |
|
243 | - } |
|
244 | - |
|
245 | - |
|
246 | - /** |
|
247 | - * Returns the first and last name concatenated together with a space. |
|
248 | - * |
|
249 | - * @param bool $apply_html_entities |
|
250 | - * @return string |
|
251 | - */ |
|
252 | - public function full_name($apply_html_entities = false) |
|
253 | - { |
|
254 | - $full_name = array( |
|
255 | - $this->fname(), |
|
256 | - $this->lname() |
|
257 | - ); |
|
258 | - $full_name = array_filter($full_name); |
|
259 | - $full_name = implode(' ', $full_name); |
|
260 | - return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
261 | - } |
|
262 | - |
|
263 | - |
|
264 | - /** |
|
265 | - * This returns the value of the `ATT_full_name` field which is usually equivalent to calling `full_name()` unless |
|
266 | - * the post_title field has been directly modified in the db for the post (espresso_attendees post type) for this |
|
267 | - * attendee. |
|
268 | - * |
|
269 | - * @param bool $apply_html_entities |
|
270 | - * @return string |
|
271 | - */ |
|
272 | - public function ATT_full_name($apply_html_entities = false) |
|
273 | - { |
|
274 | - return $apply_html_entities |
|
275 | - ? htmlentities($this->get('ATT_full_name'), ENT_QUOTES, 'UTF-8') |
|
276 | - : $this->get('ATT_full_name'); |
|
277 | - } |
|
278 | - |
|
279 | - |
|
280 | - /** |
|
281 | - * get Attendee Last Name |
|
282 | - * |
|
283 | - * @access public |
|
284 | - * @return string |
|
285 | - */ |
|
286 | - public function lname() |
|
287 | - { |
|
288 | - return $this->get('ATT_lname'); |
|
289 | - } |
|
290 | - |
|
291 | - |
|
292 | - /** |
|
293 | - * Gets the attendee's full address as an array so client code can decide hwo to display it |
|
294 | - * |
|
295 | - * @return array numerically indexed, with each part of the address that is known. |
|
296 | - * Eg, if the user only responded to state and country, |
|
297 | - * it would be array(0=>'Alabama',1=>'USA') |
|
298 | - * @return array |
|
299 | - */ |
|
300 | - public function full_address_as_array() |
|
301 | - { |
|
302 | - $full_address_array = array(); |
|
303 | - $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
304 | - foreach ($initial_address_fields as $address_field_name) { |
|
305 | - $address_fields_value = $this->get($address_field_name); |
|
306 | - if (! empty($address_fields_value)) { |
|
307 | - $full_address_array[] = $address_fields_value; |
|
308 | - } |
|
309 | - } |
|
310 | - //now handle state and country |
|
311 | - $state_obj = $this->state_obj(); |
|
312 | - if (! empty($state_obj)) { |
|
313 | - $full_address_array[] = $state_obj->name(); |
|
314 | - } |
|
315 | - $country_obj = $this->country_obj(); |
|
316 | - if (! empty($country_obj)) { |
|
317 | - $full_address_array[] = $country_obj->name(); |
|
318 | - } |
|
319 | - //lastly get the xip |
|
320 | - $zip_value = $this->zip(); |
|
321 | - if (! empty($zip_value)) { |
|
322 | - $full_address_array[] = $zip_value; |
|
323 | - } |
|
324 | - return $full_address_array; |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * get Attendee Address |
|
330 | - * |
|
331 | - * @return string |
|
332 | - */ |
|
333 | - public function address() |
|
334 | - { |
|
335 | - return $this->get('ATT_address'); |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - /** |
|
340 | - * get Attendee Address2 |
|
341 | - * |
|
342 | - * @return string |
|
343 | - */ |
|
344 | - public function address2() |
|
345 | - { |
|
346 | - return $this->get('ATT_address2'); |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - /** |
|
351 | - * get Attendee City |
|
352 | - * |
|
353 | - * @return string |
|
354 | - */ |
|
355 | - public function city() |
|
356 | - { |
|
357 | - return $this->get('ATT_city'); |
|
358 | - } |
|
359 | - |
|
360 | - |
|
361 | - /** |
|
362 | - * get Attendee State ID |
|
363 | - * |
|
364 | - * @return string |
|
365 | - */ |
|
366 | - public function state_ID() |
|
367 | - { |
|
368 | - return $this->get('STA_ID'); |
|
369 | - } |
|
370 | - |
|
371 | - |
|
372 | - /** |
|
373 | - * @return string |
|
374 | - */ |
|
375 | - public function state_abbrev() |
|
376 | - { |
|
377 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : ''; |
|
378 | - } |
|
379 | - |
|
380 | - |
|
381 | - /** |
|
382 | - * Gets the state set to this attendee |
|
383 | - * |
|
384 | - * @return EE_State |
|
385 | - */ |
|
386 | - public function state_obj() |
|
387 | - { |
|
388 | - return $this->get_first_related('State'); |
|
389 | - } |
|
390 | - |
|
391 | - |
|
392 | - /** |
|
393 | - * Returns the state's name, otherwise 'Unknown' |
|
394 | - * |
|
395 | - * @return string |
|
396 | - */ |
|
397 | - public function state_name() |
|
398 | - { |
|
399 | - if ($this->state_obj()) { |
|
400 | - return $this->state_obj()->name(); |
|
401 | - } else { |
|
402 | - return ''; |
|
403 | - } |
|
404 | - } |
|
405 | - |
|
406 | - |
|
407 | - /** |
|
408 | - * either displays the state abbreviation or the state name, as determined |
|
409 | - * by the "FHEE__EEI_Address__state__use_abbreviation" filter. |
|
410 | - * defaults to abbreviation |
|
411 | - * |
|
412 | - * @return string |
|
413 | - */ |
|
414 | - public function state() |
|
415 | - { |
|
416 | - if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
417 | - return $this->state_abbrev(); |
|
418 | - } else { |
|
419 | - return $this->state_name(); |
|
420 | - } |
|
421 | - } |
|
422 | - |
|
423 | - |
|
424 | - /** |
|
425 | - * get Attendee Country ISO Code |
|
426 | - * |
|
427 | - * @return string |
|
428 | - */ |
|
429 | - public function country_ID() |
|
430 | - { |
|
431 | - return $this->get('CNT_ISO'); |
|
432 | - } |
|
433 | - |
|
434 | - |
|
435 | - /** |
|
436 | - * Gets country set for this attendee |
|
437 | - * |
|
438 | - * @return EE_Country |
|
439 | - */ |
|
440 | - public function country_obj() |
|
441 | - { |
|
442 | - return $this->get_first_related('Country'); |
|
443 | - } |
|
444 | - |
|
445 | - |
|
446 | - /** |
|
447 | - * Returns the country's name if known, otherwise 'Unknown' |
|
448 | - * |
|
449 | - * @return string |
|
450 | - */ |
|
451 | - public function country_name() |
|
452 | - { |
|
453 | - if ($this->country_obj()) { |
|
454 | - return $this->country_obj()->name(); |
|
455 | - } else { |
|
456 | - return ''; |
|
457 | - } |
|
458 | - } |
|
459 | - |
|
460 | - |
|
461 | - /** |
|
462 | - * either displays the country ISO2 code or the country name, as determined |
|
463 | - * by the "FHEE__EEI_Address__country__use_abbreviation" filter. |
|
464 | - * defaults to abbreviation |
|
465 | - * |
|
466 | - * @return string |
|
467 | - */ |
|
468 | - public function country() |
|
469 | - { |
|
470 | - if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
471 | - return $this->country_ID(); |
|
472 | - } else { |
|
473 | - return $this->country_name(); |
|
474 | - } |
|
475 | - } |
|
476 | - |
|
477 | - |
|
478 | - /** |
|
479 | - * get Attendee Zip/Postal Code |
|
480 | - * |
|
481 | - * @return string |
|
482 | - */ |
|
483 | - public function zip() |
|
484 | - { |
|
485 | - return $this->get('ATT_zip'); |
|
486 | - } |
|
487 | - |
|
488 | - |
|
489 | - /** |
|
490 | - * get Attendee Email Address |
|
491 | - * |
|
492 | - * @return string |
|
493 | - */ |
|
494 | - public function email() |
|
495 | - { |
|
496 | - return $this->get('ATT_email'); |
|
497 | - } |
|
498 | - |
|
499 | - |
|
500 | - /** |
|
501 | - * get Attendee Phone # |
|
502 | - * |
|
503 | - * @return string |
|
504 | - */ |
|
505 | - public function phone() |
|
506 | - { |
|
507 | - return $this->get('ATT_phone'); |
|
508 | - } |
|
509 | - |
|
510 | - |
|
511 | - /** |
|
512 | - * get deleted |
|
513 | - * |
|
514 | - * @return bool |
|
515 | - */ |
|
516 | - public function deleted() |
|
517 | - { |
|
518 | - return $this->get('ATT_deleted'); |
|
519 | - } |
|
520 | - |
|
521 | - |
|
522 | - /** |
|
523 | - * Gets registrations of this attendee |
|
524 | - * |
|
525 | - * @param array $query_params |
|
526 | - * @return EE_Registration[] |
|
527 | - */ |
|
528 | - public function get_registrations($query_params = array()) |
|
529 | - { |
|
530 | - return $this->get_many_related('Registration', $query_params); |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - /** |
|
535 | - * Gets the most recent registration of this attendee |
|
536 | - * |
|
537 | - * @return EE_Registration |
|
538 | - */ |
|
539 | - public function get_most_recent_registration() |
|
540 | - { |
|
541 | - return $this->get_first_related('Registration', |
|
542 | - array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
543 | - } |
|
544 | - |
|
545 | - |
|
546 | - /** |
|
547 | - * Gets the most recent registration for this attend at this event |
|
548 | - * |
|
549 | - * @param int $event_id |
|
550 | - * @return EE_Registration |
|
551 | - */ |
|
552 | - public function get_most_recent_registration_for_event($event_id) |
|
553 | - { |
|
554 | - return $this->get_first_related('Registration', |
|
555 | - array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
556 | - } |
|
557 | - |
|
558 | - |
|
559 | - /** |
|
560 | - * returns any events attached to this attendee ($_Event property); |
|
561 | - * |
|
562 | - * @return array |
|
563 | - */ |
|
564 | - public function events() |
|
565 | - { |
|
566 | - return $this->get_many_related('Event'); |
|
567 | - } |
|
568 | - |
|
569 | - |
|
570 | - /** |
|
571 | - * Gets the billing info array where keys match espresso_reg_page_billing_inputs(), |
|
572 | - * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was |
|
573 | - * used to save the billing info |
|
574 | - * |
|
575 | - * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
|
576 | - * @return EE_Form_Section_Proper|null |
|
577 | - */ |
|
578 | - public function billing_info_for_payment_method($payment_method) |
|
579 | - { |
|
580 | - $pm_type = $payment_method->type_obj(); |
|
581 | - if (! $pm_type instanceof EE_PMT_Base) { |
|
582 | - return null; |
|
583 | - } |
|
584 | - $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
585 | - if (! $billing_info) { |
|
586 | - return null; |
|
587 | - } |
|
588 | - $billing_form = $pm_type->billing_form(); |
|
589 | - if ($billing_form instanceof EE_Form_Section_Proper) { |
|
590 | - $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), false); |
|
591 | - } |
|
592 | - return $billing_form; |
|
593 | - } |
|
594 | - |
|
595 | - |
|
596 | - /** |
|
597 | - * Gets the postmeta key that holds this attendee's billing info for the |
|
598 | - * specified payment method |
|
599 | - * |
|
600 | - * @param EE_Payment_Method $payment_method |
|
601 | - * @return string |
|
602 | - */ |
|
603 | - public function get_billing_info_postmeta_name($payment_method) |
|
604 | - { |
|
605 | - if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
606 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
607 | - } else { |
|
608 | - return null; |
|
609 | - } |
|
610 | - } |
|
611 | - |
|
612 | - |
|
613 | - /** |
|
614 | - * Saves the billing info to the attendee. @see EE_Attendee::billing_info_for_payment_method() which is used to |
|
615 | - * retrieve it |
|
616 | - * |
|
617 | - * @param EE_Billing_Attendee_Info_Form $billing_form |
|
618 | - * @param EE_Payment_Method $payment_method |
|
619 | - * @return boolean |
|
620 | - */ |
|
621 | - public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) |
|
622 | - { |
|
623 | - if (! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
624 | - EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
625 | - return false; |
|
626 | - } |
|
627 | - $billing_form->clean_sensitive_data(); |
|
628 | - return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), |
|
629 | - $billing_form->input_values(true)); |
|
630 | - } |
|
631 | - |
|
632 | - |
|
633 | - /** |
|
634 | - * Return the link to the admin details for the object. |
|
635 | - * |
|
636 | - * @return string |
|
637 | - */ |
|
638 | - public function get_admin_details_link() |
|
639 | - { |
|
640 | - return $this->get_admin_edit_link(); |
|
641 | - } |
|
642 | - |
|
643 | - |
|
644 | - /** |
|
645 | - * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
646 | - * |
|
647 | - * @return string |
|
648 | - */ |
|
649 | - public function get_admin_edit_link() |
|
650 | - { |
|
651 | - EE_Registry::instance()->load_helper('URL'); |
|
652 | - return EEH_URL::add_query_args_and_nonce( |
|
653 | - array( |
|
654 | - 'page' => 'espresso_registrations', |
|
655 | - 'action' => 'edit_attendee', |
|
656 | - 'post' => $this->ID(), |
|
657 | - ), |
|
658 | - admin_url('admin.php') |
|
659 | - ); |
|
660 | - } |
|
661 | - |
|
662 | - |
|
663 | - /** |
|
664 | - * Returns the link to a settings page for the object. |
|
665 | - * |
|
666 | - * @return string |
|
667 | - */ |
|
668 | - public function get_admin_settings_link() |
|
669 | - { |
|
670 | - return $this->get_admin_edit_link(); |
|
671 | - } |
|
672 | - |
|
673 | - |
|
674 | - /** |
|
675 | - * Returns the link to the "overview" for the object (typically the "list table" view). |
|
676 | - * |
|
677 | - * @return string |
|
678 | - */ |
|
679 | - public function get_admin_overview_link() |
|
680 | - { |
|
681 | - EE_Registry::instance()->load_helper('URL'); |
|
682 | - return EEH_URL::add_query_args_and_nonce( |
|
683 | - array( |
|
684 | - 'page' => 'espresso_registrations', |
|
685 | - 'action' => 'contact_list', |
|
686 | - ), |
|
687 | - admin_url('admin.php') |
|
688 | - ); |
|
689 | - } |
|
26 | + /** |
|
27 | + * Sets some dynamic defaults |
|
28 | + * |
|
29 | + * @param array $fieldValues |
|
30 | + * @param bool $bydb |
|
31 | + * @param string $timezone |
|
32 | + * @param array $date_formats |
|
33 | + */ |
|
34 | + protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array()) |
|
35 | + { |
|
36 | + if (! isset($fieldValues['ATT_full_name'])) { |
|
37 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; |
|
38 | + $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
39 | + $fieldValues['ATT_full_name'] = $fname . $lname; |
|
40 | + } |
|
41 | + if (! isset($fieldValues['ATT_slug'])) { |
|
42 | + // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
|
43 | + $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
44 | + } |
|
45 | + if (! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
46 | + $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
47 | + } |
|
48 | + parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @param array $props_n_values incoming values |
|
54 | + * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
55 | + * used.) |
|
56 | + * @param array $date_formats incoming date_formats in an array where the first value is the |
|
57 | + * date_format and the second value is the time format |
|
58 | + * @return EE_Attendee |
|
59 | + */ |
|
60 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
61 | + { |
|
62 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
63 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @param array $props_n_values incoming values from the database |
|
69 | + * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
70 | + * the website will be used. |
|
71 | + * @return EE_Attendee |
|
72 | + */ |
|
73 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
74 | + { |
|
75 | + return new self($props_n_values, true, $timezone); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Set Attendee First Name |
|
81 | + * |
|
82 | + * @access public |
|
83 | + * @param string $fname |
|
84 | + */ |
|
85 | + public function set_fname($fname = '') |
|
86 | + { |
|
87 | + $this->set('ATT_fname', $fname); |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * Set Attendee Last Name |
|
93 | + * |
|
94 | + * @access public |
|
95 | + * @param string $lname |
|
96 | + */ |
|
97 | + public function set_lname($lname = '') |
|
98 | + { |
|
99 | + $this->set('ATT_lname', $lname); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * Set Attendee Address |
|
105 | + * |
|
106 | + * @access public |
|
107 | + * @param string $address |
|
108 | + */ |
|
109 | + public function set_address($address = '') |
|
110 | + { |
|
111 | + $this->set('ATT_address', $address); |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * Set Attendee Address2 |
|
117 | + * |
|
118 | + * @access public |
|
119 | + * @param string $address2 |
|
120 | + */ |
|
121 | + public function set_address2($address2 = '') |
|
122 | + { |
|
123 | + $this->set('ATT_address2', $address2); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * Set Attendee City |
|
129 | + * |
|
130 | + * @access public |
|
131 | + * @param string $city |
|
132 | + */ |
|
133 | + public function set_city($city = '') |
|
134 | + { |
|
135 | + $this->set('ATT_city', $city); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * Set Attendee State ID |
|
141 | + * |
|
142 | + * @access public |
|
143 | + * @param int $STA_ID |
|
144 | + */ |
|
145 | + public function set_state($STA_ID = 0) |
|
146 | + { |
|
147 | + $this->set('STA_ID', $STA_ID); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * Set Attendee Country ISO Code |
|
153 | + * |
|
154 | + * @access public |
|
155 | + * @param string $CNT_ISO |
|
156 | + */ |
|
157 | + public function set_country($CNT_ISO = '') |
|
158 | + { |
|
159 | + $this->set('CNT_ISO', $CNT_ISO); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * Set Attendee Zip/Postal Code |
|
165 | + * |
|
166 | + * @access public |
|
167 | + * @param string $zip |
|
168 | + */ |
|
169 | + public function set_zip($zip = '') |
|
170 | + { |
|
171 | + $this->set('ATT_zip', $zip); |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * Set Attendee Email Address |
|
177 | + * |
|
178 | + * @access public |
|
179 | + * @param string $email |
|
180 | + */ |
|
181 | + public function set_email($email = '') |
|
182 | + { |
|
183 | + $this->set('ATT_email', $email); |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * Set Attendee Phone |
|
189 | + * |
|
190 | + * @access public |
|
191 | + * @param string $phone |
|
192 | + */ |
|
193 | + public function set_phone($phone = '') |
|
194 | + { |
|
195 | + $this->set('ATT_phone', $phone); |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + /** |
|
200 | + * set deleted |
|
201 | + * |
|
202 | + * @access public |
|
203 | + * @param bool $ATT_deleted |
|
204 | + */ |
|
205 | + public function set_deleted($ATT_deleted = false) |
|
206 | + { |
|
207 | + $this->set('ATT_deleted', $ATT_deleted); |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + /** |
|
212 | + * Returns the value for the post_author id saved with the cpt |
|
213 | + * |
|
214 | + * @since 4.5.0 |
|
215 | + * @return int |
|
216 | + */ |
|
217 | + public function wp_user() |
|
218 | + { |
|
219 | + return $this->get('ATT_author'); |
|
220 | + } |
|
221 | + |
|
222 | + |
|
223 | + /** |
|
224 | + * get Attendee First Name |
|
225 | + * |
|
226 | + * @access public |
|
227 | + * @return string |
|
228 | + */ |
|
229 | + public function fname() |
|
230 | + { |
|
231 | + return $this->get('ATT_fname'); |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * echoes out the attendee's first name |
|
237 | + * |
|
238 | + * @return void |
|
239 | + */ |
|
240 | + public function e_full_name() |
|
241 | + { |
|
242 | + echo $this->full_name(); |
|
243 | + } |
|
244 | + |
|
245 | + |
|
246 | + /** |
|
247 | + * Returns the first and last name concatenated together with a space. |
|
248 | + * |
|
249 | + * @param bool $apply_html_entities |
|
250 | + * @return string |
|
251 | + */ |
|
252 | + public function full_name($apply_html_entities = false) |
|
253 | + { |
|
254 | + $full_name = array( |
|
255 | + $this->fname(), |
|
256 | + $this->lname() |
|
257 | + ); |
|
258 | + $full_name = array_filter($full_name); |
|
259 | + $full_name = implode(' ', $full_name); |
|
260 | + return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
261 | + } |
|
262 | + |
|
263 | + |
|
264 | + /** |
|
265 | + * This returns the value of the `ATT_full_name` field which is usually equivalent to calling `full_name()` unless |
|
266 | + * the post_title field has been directly modified in the db for the post (espresso_attendees post type) for this |
|
267 | + * attendee. |
|
268 | + * |
|
269 | + * @param bool $apply_html_entities |
|
270 | + * @return string |
|
271 | + */ |
|
272 | + public function ATT_full_name($apply_html_entities = false) |
|
273 | + { |
|
274 | + return $apply_html_entities |
|
275 | + ? htmlentities($this->get('ATT_full_name'), ENT_QUOTES, 'UTF-8') |
|
276 | + : $this->get('ATT_full_name'); |
|
277 | + } |
|
278 | + |
|
279 | + |
|
280 | + /** |
|
281 | + * get Attendee Last Name |
|
282 | + * |
|
283 | + * @access public |
|
284 | + * @return string |
|
285 | + */ |
|
286 | + public function lname() |
|
287 | + { |
|
288 | + return $this->get('ATT_lname'); |
|
289 | + } |
|
290 | + |
|
291 | + |
|
292 | + /** |
|
293 | + * Gets the attendee's full address as an array so client code can decide hwo to display it |
|
294 | + * |
|
295 | + * @return array numerically indexed, with each part of the address that is known. |
|
296 | + * Eg, if the user only responded to state and country, |
|
297 | + * it would be array(0=>'Alabama',1=>'USA') |
|
298 | + * @return array |
|
299 | + */ |
|
300 | + public function full_address_as_array() |
|
301 | + { |
|
302 | + $full_address_array = array(); |
|
303 | + $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
304 | + foreach ($initial_address_fields as $address_field_name) { |
|
305 | + $address_fields_value = $this->get($address_field_name); |
|
306 | + if (! empty($address_fields_value)) { |
|
307 | + $full_address_array[] = $address_fields_value; |
|
308 | + } |
|
309 | + } |
|
310 | + //now handle state and country |
|
311 | + $state_obj = $this->state_obj(); |
|
312 | + if (! empty($state_obj)) { |
|
313 | + $full_address_array[] = $state_obj->name(); |
|
314 | + } |
|
315 | + $country_obj = $this->country_obj(); |
|
316 | + if (! empty($country_obj)) { |
|
317 | + $full_address_array[] = $country_obj->name(); |
|
318 | + } |
|
319 | + //lastly get the xip |
|
320 | + $zip_value = $this->zip(); |
|
321 | + if (! empty($zip_value)) { |
|
322 | + $full_address_array[] = $zip_value; |
|
323 | + } |
|
324 | + return $full_address_array; |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * get Attendee Address |
|
330 | + * |
|
331 | + * @return string |
|
332 | + */ |
|
333 | + public function address() |
|
334 | + { |
|
335 | + return $this->get('ATT_address'); |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + /** |
|
340 | + * get Attendee Address2 |
|
341 | + * |
|
342 | + * @return string |
|
343 | + */ |
|
344 | + public function address2() |
|
345 | + { |
|
346 | + return $this->get('ATT_address2'); |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + /** |
|
351 | + * get Attendee City |
|
352 | + * |
|
353 | + * @return string |
|
354 | + */ |
|
355 | + public function city() |
|
356 | + { |
|
357 | + return $this->get('ATT_city'); |
|
358 | + } |
|
359 | + |
|
360 | + |
|
361 | + /** |
|
362 | + * get Attendee State ID |
|
363 | + * |
|
364 | + * @return string |
|
365 | + */ |
|
366 | + public function state_ID() |
|
367 | + { |
|
368 | + return $this->get('STA_ID'); |
|
369 | + } |
|
370 | + |
|
371 | + |
|
372 | + /** |
|
373 | + * @return string |
|
374 | + */ |
|
375 | + public function state_abbrev() |
|
376 | + { |
|
377 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : ''; |
|
378 | + } |
|
379 | + |
|
380 | + |
|
381 | + /** |
|
382 | + * Gets the state set to this attendee |
|
383 | + * |
|
384 | + * @return EE_State |
|
385 | + */ |
|
386 | + public function state_obj() |
|
387 | + { |
|
388 | + return $this->get_first_related('State'); |
|
389 | + } |
|
390 | + |
|
391 | + |
|
392 | + /** |
|
393 | + * Returns the state's name, otherwise 'Unknown' |
|
394 | + * |
|
395 | + * @return string |
|
396 | + */ |
|
397 | + public function state_name() |
|
398 | + { |
|
399 | + if ($this->state_obj()) { |
|
400 | + return $this->state_obj()->name(); |
|
401 | + } else { |
|
402 | + return ''; |
|
403 | + } |
|
404 | + } |
|
405 | + |
|
406 | + |
|
407 | + /** |
|
408 | + * either displays the state abbreviation or the state name, as determined |
|
409 | + * by the "FHEE__EEI_Address__state__use_abbreviation" filter. |
|
410 | + * defaults to abbreviation |
|
411 | + * |
|
412 | + * @return string |
|
413 | + */ |
|
414 | + public function state() |
|
415 | + { |
|
416 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
417 | + return $this->state_abbrev(); |
|
418 | + } else { |
|
419 | + return $this->state_name(); |
|
420 | + } |
|
421 | + } |
|
422 | + |
|
423 | + |
|
424 | + /** |
|
425 | + * get Attendee Country ISO Code |
|
426 | + * |
|
427 | + * @return string |
|
428 | + */ |
|
429 | + public function country_ID() |
|
430 | + { |
|
431 | + return $this->get('CNT_ISO'); |
|
432 | + } |
|
433 | + |
|
434 | + |
|
435 | + /** |
|
436 | + * Gets country set for this attendee |
|
437 | + * |
|
438 | + * @return EE_Country |
|
439 | + */ |
|
440 | + public function country_obj() |
|
441 | + { |
|
442 | + return $this->get_first_related('Country'); |
|
443 | + } |
|
444 | + |
|
445 | + |
|
446 | + /** |
|
447 | + * Returns the country's name if known, otherwise 'Unknown' |
|
448 | + * |
|
449 | + * @return string |
|
450 | + */ |
|
451 | + public function country_name() |
|
452 | + { |
|
453 | + if ($this->country_obj()) { |
|
454 | + return $this->country_obj()->name(); |
|
455 | + } else { |
|
456 | + return ''; |
|
457 | + } |
|
458 | + } |
|
459 | + |
|
460 | + |
|
461 | + /** |
|
462 | + * either displays the country ISO2 code or the country name, as determined |
|
463 | + * by the "FHEE__EEI_Address__country__use_abbreviation" filter. |
|
464 | + * defaults to abbreviation |
|
465 | + * |
|
466 | + * @return string |
|
467 | + */ |
|
468 | + public function country() |
|
469 | + { |
|
470 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
471 | + return $this->country_ID(); |
|
472 | + } else { |
|
473 | + return $this->country_name(); |
|
474 | + } |
|
475 | + } |
|
476 | + |
|
477 | + |
|
478 | + /** |
|
479 | + * get Attendee Zip/Postal Code |
|
480 | + * |
|
481 | + * @return string |
|
482 | + */ |
|
483 | + public function zip() |
|
484 | + { |
|
485 | + return $this->get('ATT_zip'); |
|
486 | + } |
|
487 | + |
|
488 | + |
|
489 | + /** |
|
490 | + * get Attendee Email Address |
|
491 | + * |
|
492 | + * @return string |
|
493 | + */ |
|
494 | + public function email() |
|
495 | + { |
|
496 | + return $this->get('ATT_email'); |
|
497 | + } |
|
498 | + |
|
499 | + |
|
500 | + /** |
|
501 | + * get Attendee Phone # |
|
502 | + * |
|
503 | + * @return string |
|
504 | + */ |
|
505 | + public function phone() |
|
506 | + { |
|
507 | + return $this->get('ATT_phone'); |
|
508 | + } |
|
509 | + |
|
510 | + |
|
511 | + /** |
|
512 | + * get deleted |
|
513 | + * |
|
514 | + * @return bool |
|
515 | + */ |
|
516 | + public function deleted() |
|
517 | + { |
|
518 | + return $this->get('ATT_deleted'); |
|
519 | + } |
|
520 | + |
|
521 | + |
|
522 | + /** |
|
523 | + * Gets registrations of this attendee |
|
524 | + * |
|
525 | + * @param array $query_params |
|
526 | + * @return EE_Registration[] |
|
527 | + */ |
|
528 | + public function get_registrations($query_params = array()) |
|
529 | + { |
|
530 | + return $this->get_many_related('Registration', $query_params); |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + /** |
|
535 | + * Gets the most recent registration of this attendee |
|
536 | + * |
|
537 | + * @return EE_Registration |
|
538 | + */ |
|
539 | + public function get_most_recent_registration() |
|
540 | + { |
|
541 | + return $this->get_first_related('Registration', |
|
542 | + array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
543 | + } |
|
544 | + |
|
545 | + |
|
546 | + /** |
|
547 | + * Gets the most recent registration for this attend at this event |
|
548 | + * |
|
549 | + * @param int $event_id |
|
550 | + * @return EE_Registration |
|
551 | + */ |
|
552 | + public function get_most_recent_registration_for_event($event_id) |
|
553 | + { |
|
554 | + return $this->get_first_related('Registration', |
|
555 | + array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
556 | + } |
|
557 | + |
|
558 | + |
|
559 | + /** |
|
560 | + * returns any events attached to this attendee ($_Event property); |
|
561 | + * |
|
562 | + * @return array |
|
563 | + */ |
|
564 | + public function events() |
|
565 | + { |
|
566 | + return $this->get_many_related('Event'); |
|
567 | + } |
|
568 | + |
|
569 | + |
|
570 | + /** |
|
571 | + * Gets the billing info array where keys match espresso_reg_page_billing_inputs(), |
|
572 | + * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was |
|
573 | + * used to save the billing info |
|
574 | + * |
|
575 | + * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
|
576 | + * @return EE_Form_Section_Proper|null |
|
577 | + */ |
|
578 | + public function billing_info_for_payment_method($payment_method) |
|
579 | + { |
|
580 | + $pm_type = $payment_method->type_obj(); |
|
581 | + if (! $pm_type instanceof EE_PMT_Base) { |
|
582 | + return null; |
|
583 | + } |
|
584 | + $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
585 | + if (! $billing_info) { |
|
586 | + return null; |
|
587 | + } |
|
588 | + $billing_form = $pm_type->billing_form(); |
|
589 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
590 | + $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), false); |
|
591 | + } |
|
592 | + return $billing_form; |
|
593 | + } |
|
594 | + |
|
595 | + |
|
596 | + /** |
|
597 | + * Gets the postmeta key that holds this attendee's billing info for the |
|
598 | + * specified payment method |
|
599 | + * |
|
600 | + * @param EE_Payment_Method $payment_method |
|
601 | + * @return string |
|
602 | + */ |
|
603 | + public function get_billing_info_postmeta_name($payment_method) |
|
604 | + { |
|
605 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
606 | + return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
607 | + } else { |
|
608 | + return null; |
|
609 | + } |
|
610 | + } |
|
611 | + |
|
612 | + |
|
613 | + /** |
|
614 | + * Saves the billing info to the attendee. @see EE_Attendee::billing_info_for_payment_method() which is used to |
|
615 | + * retrieve it |
|
616 | + * |
|
617 | + * @param EE_Billing_Attendee_Info_Form $billing_form |
|
618 | + * @param EE_Payment_Method $payment_method |
|
619 | + * @return boolean |
|
620 | + */ |
|
621 | + public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) |
|
622 | + { |
|
623 | + if (! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
624 | + EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
625 | + return false; |
|
626 | + } |
|
627 | + $billing_form->clean_sensitive_data(); |
|
628 | + return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), |
|
629 | + $billing_form->input_values(true)); |
|
630 | + } |
|
631 | + |
|
632 | + |
|
633 | + /** |
|
634 | + * Return the link to the admin details for the object. |
|
635 | + * |
|
636 | + * @return string |
|
637 | + */ |
|
638 | + public function get_admin_details_link() |
|
639 | + { |
|
640 | + return $this->get_admin_edit_link(); |
|
641 | + } |
|
642 | + |
|
643 | + |
|
644 | + /** |
|
645 | + * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
646 | + * |
|
647 | + * @return string |
|
648 | + */ |
|
649 | + public function get_admin_edit_link() |
|
650 | + { |
|
651 | + EE_Registry::instance()->load_helper('URL'); |
|
652 | + return EEH_URL::add_query_args_and_nonce( |
|
653 | + array( |
|
654 | + 'page' => 'espresso_registrations', |
|
655 | + 'action' => 'edit_attendee', |
|
656 | + 'post' => $this->ID(), |
|
657 | + ), |
|
658 | + admin_url('admin.php') |
|
659 | + ); |
|
660 | + } |
|
661 | + |
|
662 | + |
|
663 | + /** |
|
664 | + * Returns the link to a settings page for the object. |
|
665 | + * |
|
666 | + * @return string |
|
667 | + */ |
|
668 | + public function get_admin_settings_link() |
|
669 | + { |
|
670 | + return $this->get_admin_edit_link(); |
|
671 | + } |
|
672 | + |
|
673 | + |
|
674 | + /** |
|
675 | + * Returns the link to the "overview" for the object (typically the "list table" view). |
|
676 | + * |
|
677 | + * @return string |
|
678 | + */ |
|
679 | + public function get_admin_overview_link() |
|
680 | + { |
|
681 | + EE_Registry::instance()->load_helper('URL'); |
|
682 | + return EEH_URL::add_query_args_and_nonce( |
|
683 | + array( |
|
684 | + 'page' => 'espresso_registrations', |
|
685 | + 'action' => 'contact_list', |
|
686 | + ), |
|
687 | + admin_url('admin.php') |
|
688 | + ); |
|
689 | + } |
|
690 | 690 | |
691 | 691 | |
692 | 692 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | /** |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array()) |
35 | 35 | { |
36 | - if (! isset($fieldValues['ATT_full_name'])) { |
|
37 | - $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; |
|
36 | + if ( ! isset($fieldValues['ATT_full_name'])) { |
|
37 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : ''; |
|
38 | 38 | $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
39 | - $fieldValues['ATT_full_name'] = $fname . $lname; |
|
39 | + $fieldValues['ATT_full_name'] = $fname.$lname; |
|
40 | 40 | } |
41 | - if (! isset($fieldValues['ATT_slug'])) { |
|
41 | + if ( ! isset($fieldValues['ATT_slug'])) { |
|
42 | 42 | // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
43 | 43 | $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
44 | 44 | } |
45 | - if (! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
45 | + if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
46 | 46 | $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
47 | 47 | } |
48 | 48 | parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
304 | 304 | foreach ($initial_address_fields as $address_field_name) { |
305 | 305 | $address_fields_value = $this->get($address_field_name); |
306 | - if (! empty($address_fields_value)) { |
|
306 | + if ( ! empty($address_fields_value)) { |
|
307 | 307 | $full_address_array[] = $address_fields_value; |
308 | 308 | } |
309 | 309 | } |
310 | 310 | //now handle state and country |
311 | 311 | $state_obj = $this->state_obj(); |
312 | - if (! empty($state_obj)) { |
|
312 | + if ( ! empty($state_obj)) { |
|
313 | 313 | $full_address_array[] = $state_obj->name(); |
314 | 314 | } |
315 | 315 | $country_obj = $this->country_obj(); |
316 | - if (! empty($country_obj)) { |
|
316 | + if ( ! empty($country_obj)) { |
|
317 | 317 | $full_address_array[] = $country_obj->name(); |
318 | 318 | } |
319 | 319 | //lastly get the xip |
320 | 320 | $zip_value = $this->zip(); |
321 | - if (! empty($zip_value)) { |
|
321 | + if ( ! empty($zip_value)) { |
|
322 | 322 | $full_address_array[] = $zip_value; |
323 | 323 | } |
324 | 324 | return $full_address_array; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | public function get_most_recent_registration_for_event($event_id) |
553 | 553 | { |
554 | 554 | return $this->get_first_related('Registration', |
555 | - array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
555 | + array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' ); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
@@ -578,11 +578,11 @@ discard block |
||
578 | 578 | public function billing_info_for_payment_method($payment_method) |
579 | 579 | { |
580 | 580 | $pm_type = $payment_method->type_obj(); |
581 | - if (! $pm_type instanceof EE_PMT_Base) { |
|
581 | + if ( ! $pm_type instanceof EE_PMT_Base) { |
|
582 | 582 | return null; |
583 | 583 | } |
584 | 584 | $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
585 | - if (! $billing_info) { |
|
585 | + if ( ! $billing_info) { |
|
586 | 586 | return null; |
587 | 587 | } |
588 | 588 | $billing_form = $pm_type->billing_form(); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | public function get_billing_info_postmeta_name($payment_method) |
604 | 604 | { |
605 | 605 | if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
606 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
606 | + return 'billing_info_'.$payment_method->type_obj()->system_name(); |
|
607 | 607 | } else { |
608 | 608 | return null; |
609 | 609 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) |
622 | 622 | { |
623 | - if (! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
623 | + if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
624 | 624 | EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
625 | 625 | return false; |
626 | 626 | } |
@@ -1,36 +1,36 @@ |
||
1 | 1 | <div id="admin-primary-mbox-reg-details-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | - <?php do_action( 'AHEE__reg_admin_details_main_meta_box_reg_details__top', $REG_ID ); ?> |
|
3 | + <?php do_action('AHEE__reg_admin_details_main_meta_box_reg_details__top', $REG_ID); ?> |
|
4 | 4 | <?php echo $resend_registration_button; ?> |
5 | 5 | <?php echo $view_transaction_button; ?> |
6 | 6 | <br/> |
7 | 7 | |
8 | - <h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span><?php _e( 'Registration Items', 'event_espresso' );?></h3> |
|
8 | + <h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span><?php _e('Registration Items', 'event_espresso'); ?></h3> |
|
9 | 9 | |
10 | 10 | <?php echo $line_item_table; ?> |
11 | 11 | |
12 | 12 | <a id="display-additional-registration-session-info" class="display-the-hidden smaller-text" rel="additional-registration-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional registration session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional registration session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-registration-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-registration-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-registration-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional registration session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional registration session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Registration Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Registration Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-reg-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $reg_details as $key => $reg_detail ) : ?> |
|
27 | + <?php foreach ($reg_details as $key => $reg_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $reg_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $reg_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $reg_detail['value'];?> |
|
33 | + <?php echo $reg_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $reg_details?> |
@@ -105,41 +105,41 @@ discard block |
||
105 | 105 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
106 | 106 | * @return \EEM_Line_Item |
107 | 107 | */ |
108 | - protected function __construct( $timezone ) { |
|
109 | - $this->singular_item = __('Line Item','event_espresso'); |
|
110 | - $this->plural_item = __('Line Items','event_espresso'); |
|
108 | + protected function __construct($timezone) { |
|
109 | + $this->singular_item = __('Line Item', 'event_espresso'); |
|
110 | + $this->plural_item = __('Line Items', 'event_espresso'); |
|
111 | 111 | |
112 | 112 | $this->_tables = array( |
113 | - 'Line_Item'=>new EE_Primary_Table('esp_line_item','LIN_ID') |
|
113 | + 'Line_Item'=>new EE_Primary_Table('esp_line_item', 'LIN_ID') |
|
114 | 114 | ); |
115 | - $line_items_can_be_for = apply_filters( 'FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket','Price', 'Event' ) ); |
|
115 | + $line_items_can_be_for = apply_filters('FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket', 'Price', 'Event')); |
|
116 | 116 | $this->_fields = array( |
117 | 117 | 'Line_Item' => array( |
118 | - 'LIN_ID' => new EE_Primary_Key_Int_Field( 'LIN_ID', __( "ID", "event_espresso" ) ), |
|
119 | - 'LIN_code' => new EE_Slug_Field( 'LIN_code', __( "Code for index into Cart", "event_espresso" ), TRUE ), |
|
120 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( "Transaction ID", "event_espresso" ), TRUE, NULL, 'Transaction' ), |
|
121 | - 'LIN_name' => new EE_Full_HTML_Field( 'LIN_name', __( "Line Item Name", "event_espresso" ), FALSE, '' ), |
|
122 | - 'LIN_desc' => new EE_Full_HTML_Field( 'LIN_desc', __( "Line Item Description", "event_espresso" ), TRUE ), |
|
123 | - 'LIN_unit_price' => new EE_Money_Field( 'LIN_unit_price', __( "Unit Price", "event_espresso" ), FALSE, 0 ), |
|
124 | - 'LIN_percent' => new EE_Float_Field( 'LIN_percent', __( "Percent", "event_espresso" ), FALSE, 0 ), |
|
125 | - 'LIN_is_taxable' => new EE_Boolean_Field( 'LIN_is_taxable', __( "Taxable", "event_espresso" ), FALSE, FALSE ), |
|
126 | - 'LIN_order' => new EE_Integer_Field( 'LIN_order', __( "Order of Application towards total of parent", "event_espresso" ), FALSE, 1 ), |
|
127 | - 'LIN_total' => new EE_Money_Field( 'LIN_total', __( "Total (unit price x quantity)", "event_espresso" ), FALSE, 0 ), |
|
128 | - 'LIN_quantity' => new EE_Integer_Field( 'LIN_quantity', __( "Quantity", "event_espresso" ), TRUE, 1 ), |
|
129 | - 'LIN_parent' => new EE_Integer_Field( 'LIN_parent', __( "Parent ID (this item goes towards that Line Item's total)", "event_espresso" ), TRUE, NULL ), |
|
130 | - 'LIN_type' => new EE_Enum_Text_Field( 'LIN_type', __( "Type", "event_espresso" ), FALSE, 'line-item', array( |
|
118 | + 'LIN_ID' => new EE_Primary_Key_Int_Field('LIN_ID', __("ID", "event_espresso")), |
|
119 | + 'LIN_code' => new EE_Slug_Field('LIN_code', __("Code for index into Cart", "event_espresso"), TRUE), |
|
120 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __("Transaction ID", "event_espresso"), TRUE, NULL, 'Transaction'), |
|
121 | + 'LIN_name' => new EE_Full_HTML_Field('LIN_name', __("Line Item Name", "event_espresso"), FALSE, ''), |
|
122 | + 'LIN_desc' => new EE_Full_HTML_Field('LIN_desc', __("Line Item Description", "event_espresso"), TRUE), |
|
123 | + 'LIN_unit_price' => new EE_Money_Field('LIN_unit_price', __("Unit Price", "event_espresso"), FALSE, 0), |
|
124 | + 'LIN_percent' => new EE_Float_Field('LIN_percent', __("Percent", "event_espresso"), FALSE, 0), |
|
125 | + 'LIN_is_taxable' => new EE_Boolean_Field('LIN_is_taxable', __("Taxable", "event_espresso"), FALSE, FALSE), |
|
126 | + 'LIN_order' => new EE_Integer_Field('LIN_order', __("Order of Application towards total of parent", "event_espresso"), FALSE, 1), |
|
127 | + 'LIN_total' => new EE_Money_Field('LIN_total', __("Total (unit price x quantity)", "event_espresso"), FALSE, 0), |
|
128 | + 'LIN_quantity' => new EE_Integer_Field('LIN_quantity', __("Quantity", "event_espresso"), TRUE, 1), |
|
129 | + 'LIN_parent' => new EE_Integer_Field('LIN_parent', __("Parent ID (this item goes towards that Line Item's total)", "event_espresso"), TRUE, NULL), |
|
130 | + 'LIN_type' => new EE_Enum_Text_Field('LIN_type', __("Type", "event_espresso"), FALSE, 'line-item', array( |
|
131 | 131 | self::type_line_item => __("Line Item", "event_espresso"), |
132 | 132 | self::type_sub_line_item => __("Sub-Item", "event_espresso"), |
133 | 133 | self::type_sub_total => __("Subtotal", "event_espresso"), |
134 | 134 | self::type_tax_sub_total => __("Tax Subtotal", "event_espresso"), |
135 | 135 | self::type_tax => __("Tax", "event_espresso"), |
136 | 136 | self::type_total => __("Total", "event_espresso"), |
137 | - self::type_cancellation => __( 'Cancellation', 'event_espresso' ) |
|
137 | + self::type_cancellation => __('Cancellation', 'event_espresso') |
|
138 | 138 | ) |
139 | 139 | ), |
140 | - 'OBJ_ID' => new EE_Foreign_Key_Int_Field( 'OBJ_ID', __( 'ID of Item purchased.', 'event_espresso' ), TRUE, NULL, $line_items_can_be_for ), |
|
141 | - 'OBJ_type' =>new EE_Any_Foreign_Model_Name_Field( 'OBJ_type', __( "Model Name this Line Item is for", "event_espresso" ), TRUE, NULL, $line_items_can_be_for ), |
|
142 | - 'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created','event_espresso'), false, EE_Datetime_Field::now, $timezone ), |
|
140 | + 'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', __('ID of Item purchased.', 'event_espresso'), TRUE, NULL, $line_items_can_be_for), |
|
141 | + 'OBJ_type' =>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Model Name this Line Item is for", "event_espresso"), TRUE, NULL, $line_items_can_be_for), |
|
142 | + 'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created', 'event_espresso'), false, EE_Datetime_Field::now, $timezone), |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | $this->_model_relations = array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ); |
151 | 151 | $this->_model_chain_to_wp_user = 'Transaction.Registration.Event'; |
152 | 152 | $this->_caps_slug = 'transactions'; |
153 | - parent::__construct( $timezone ); |
|
153 | + parent::__construct($timezone); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | * @param EE_Transaction|int $transaction |
162 | 162 | * @return EE_Line_Item[] |
163 | 163 | */ |
164 | - public function get_all_of_type_for_transaction( $line_item_type, $transaction ){ |
|
165 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
166 | - return $this->get_all( array( array( |
|
164 | + public function get_all_of_type_for_transaction($line_item_type, $transaction) { |
|
165 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
166 | + return $this->get_all(array(array( |
|
167 | 167 | 'LIN_type' => $line_item_type, |
168 | 168 | 'TXN_ID' => $transaction |
169 | 169 | ))); |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | * @param EE_Transaction|int $transaction |
178 | 178 | * @return EE_Line_Item[] |
179 | 179 | */ |
180 | - public function get_all_non_ticket_line_items_for_transaction( $transaction ) { |
|
181 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
182 | - return $this->get_all( array( array( |
|
180 | + public function get_all_non_ticket_line_items_for_transaction($transaction) { |
|
181 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
182 | + return $this->get_all(array(array( |
|
183 | 183 | 'LIN_type' => self::type_line_item, |
184 | 184 | 'TXN_ID' => $transaction, |
185 | 185 | 'OR' => array( |
186 | - 'OBJ_type*notticket' => array( '!=', 'Ticket'), |
|
187 | - 'OBJ_type*null' => array( 'IS_NULL' )) |
|
186 | + 'OBJ_type*notticket' => array('!=', 'Ticket'), |
|
187 | + 'OBJ_type*null' => array('IS_NULL')) |
|
188 | 188 | ))); |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * because if there are spam bots afoot there will be LOTS of line items |
195 | 195 | * @return int count of how many deleted |
196 | 196 | */ |
197 | - public function delete_line_items_with_no_transaction(){ |
|
197 | + public function delete_line_items_with_no_transaction() { |
|
198 | 198 | /** @type WPDB $wpdb */ |
199 | 199 | global $wpdb; |
200 | 200 | $time_to_leave_alone = apply_filters( |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | ); |
203 | 203 | $query = $wpdb->prepare( |
204 | 204 | 'DELETE li |
205 | - FROM ' . $this->table() . ' li |
|
206 | - LEFT JOIN ' . EEM_Transaction::instance()->table(). ' t ON li.TXN_ID = t.TXN_ID |
|
205 | + FROM ' . $this->table().' li |
|
206 | + LEFT JOIN ' . EEM_Transaction::instance()->table().' t ON li.TXN_ID = t.TXN_ID |
|
207 | 207 | WHERE t.TXN_ID IS NULL AND li.LIN_timestamp < %s', |
208 | 208 | // use GMT time because that's what TXN_timestamps are in |
209 | - date( 'Y-m-d H:i:s', time() - $time_to_leave_alone ) |
|
209 | + date('Y-m-d H:i:s', time() - $time_to_leave_alone) |
|
210 | 210 | ); |
211 | - return $wpdb->query( $query ); |
|
211 | + return $wpdb->query($query); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * @param \EE_Base_Class $object |
222 | 222 | * @return EE_Line_Item[] |
223 | 223 | */ |
224 | - public function get_line_item_for_transaction_object( $TXN_ID, EE_Base_Class $object ){ |
|
225 | - return $this->get_all( array( array( |
|
224 | + public function get_line_item_for_transaction_object($TXN_ID, EE_Base_Class $object) { |
|
225 | + return $this->get_all(array(array( |
|
226 | 226 | 'TXN_ID' => $TXN_ID, |
227 | - 'OBJ_type' => str_replace( 'EE_', '', get_class( $object )), |
|
227 | + 'OBJ_type' => str_replace('EE_', '', get_class($object)), |
|
228 | 228 | 'OBJ_ID' => $object->ID() |
229 | 229 | ))); |
230 | 230 | } |
@@ -240,16 +240,16 @@ discard block |
||
240 | 240 | * @param array $OBJ_IDs |
241 | 241 | * @return EE_Line_Item[] |
242 | 242 | */ |
243 | - public function get_object_line_items_for_transaction( $TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array() ){ |
|
243 | + public function get_object_line_items_for_transaction($TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array()) { |
|
244 | 244 | $query_params = array( |
245 | 245 | 'OBJ_type' => $OBJ_type, |
246 | 246 | // if incoming $OBJ_IDs is an array, then make sure it is formatted correctly for the query |
247 | - 'OBJ_ID' => is_array( $OBJ_IDs ) && ! isset( $OBJ_IDs['IN'] ) ? array( 'IN', $OBJ_IDs ) : $OBJ_IDs |
|
247 | + 'OBJ_ID' => is_array($OBJ_IDs) && ! isset($OBJ_IDs['IN']) ? array('IN', $OBJ_IDs) : $OBJ_IDs |
|
248 | 248 | ); |
249 | - if ( $TXN_ID ) { |
|
249 | + if ($TXN_ID) { |
|
250 | 250 | $query_params['TXN_ID'] = $TXN_ID; |
251 | 251 | } |
252 | - return $this->get_all( array( $query_params )); |
|
252 | + return $this->get_all(array($query_params)); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return EE_Line_Item[] |
262 | 262 | */ |
263 | - public function get_all_ticket_line_items_for_transaction( EE_Transaction $transaction ) { |
|
264 | - return $this->get_all( array( |
|
263 | + public function get_all_ticket_line_items_for_transaction(EE_Transaction $transaction) { |
|
264 | + return $this->get_all(array( |
|
265 | 265 | array( |
266 | 266 | 'TXN_ID' => $transaction->ID(), |
267 | 267 | 'OBJ_type' => 'Ticket', |
268 | 268 | ) |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | * @param int $TKT_ID |
279 | 279 | * @return \EE_Line_Item |
280 | 280 | */ |
281 | - public function get_ticket_line_item_for_transaction( $TXN_ID, $TKT_ID ) { |
|
282 | - return $this->get_one( array( |
|
281 | + public function get_ticket_line_item_for_transaction($TXN_ID, $TKT_ID) { |
|
282 | + return $this->get_one(array( |
|
283 | 283 | array( |
284 | - 'TXN_ID' => EEM_Transaction::instance()->ensure_is_ID( $TXN_ID ), |
|
284 | + 'TXN_ID' => EEM_Transaction::instance()->ensure_is_ID($TXN_ID), |
|
285 | 285 | 'OBJ_ID' => $TKT_ID, |
286 | 286 | 'OBJ_type' => 'Ticket', |
287 | 287 | ) |
288 | - ) ); |
|
288 | + )); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | * @param EE_Promotion $promotion |
301 | 301 | * @return EE_Line_Item |
302 | 302 | */ |
303 | - public function get_existing_promotion_line_item( EE_Line_Item $parent_line_item, EE_Promotion $promotion ) { |
|
304 | - return $this->get_one( array( |
|
303 | + public function get_existing_promotion_line_item(EE_Line_Item $parent_line_item, EE_Promotion $promotion) { |
|
304 | + return $this->get_one(array( |
|
305 | 305 | array( |
306 | 306 | 'TXN_ID' => $parent_line_item->TXN_ID(), |
307 | 307 | 'LIN_parent' => $parent_line_item->ID(), |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @param EE_Line_Item $parent_line_item |
323 | 323 | * @return EE_Line_Item[] |
324 | 324 | */ |
325 | - public function get_all_promotion_line_items( EE_Line_Item $parent_line_item ) { |
|
326 | - return $this->get_all( array( |
|
325 | + public function get_all_promotion_line_items(EE_Line_Item $parent_line_item) { |
|
326 | + return $this->get_all(array( |
|
327 | 327 | array( |
328 | 328 | 'TXN_ID' => $parent_line_item->TXN_ID(), |
329 | 329 | 'LIN_parent' => $parent_line_item->ID(), |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param EE_Registration $registration |
341 | 341 | * @return EE_Line_ITem |
342 | 342 | */ |
343 | - public function get_line_item_for_registration( EE_Registration $registration ) { |
|
344 | - return $this->get_one( $this->line_item_for_registration_query_params( $registration )); |
|
343 | + public function get_line_item_for_registration(EE_Registration $registration) { |
|
344 | + return $this->get_one($this->line_item_for_registration_query_params($registration)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | * @param array $original_query_params any extra query params you'd like to be merged with |
351 | 351 | * @return array like EEM_Base::get_all()'s $query_params |
352 | 352 | */ |
353 | - public function line_item_for_registration_query_params( EE_Registration $registration, $original_query_params = array() ) { |
|
354 | - return array_replace_recursive( $original_query_params, array( |
|
353 | + public function line_item_for_registration_query_params(EE_Registration $registration, $original_query_params = array()) { |
|
354 | + return array_replace_recursive($original_query_params, array( |
|
355 | 355 | array( |
356 | 356 | 'OBJ_ID' => $registration->ticket_ID(), |
357 | 357 | 'OBJ_type' => 'Ticket', |
358 | 358 | 'TXN_ID' => $registration->transaction_ID() |
359 | 359 | ) |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -362,62 +362,62 @@ |
||
362 | 362 | |
363 | 363 | |
364 | 364 | |
365 | - /** |
|
366 | - * @return EE_Base_Class[]|EE_Line_Item[] |
|
367 | - * @throws \EE_Error |
|
368 | - */ |
|
369 | - public function get_total_line_items_with_no_transaction() |
|
370 | - { |
|
371 | - return $this->get_total_line_items_for_carts(); |
|
372 | - } |
|
373 | - |
|
374 | - |
|
375 | - |
|
376 | - /** |
|
377 | - * @return EE_Base_Class[]|EE_Line_Item[] |
|
378 | - * @throws \EE_Error |
|
379 | - */ |
|
380 | - public function get_total_line_items_for_active_carts() |
|
381 | - { |
|
382 | - return $this->get_total_line_items_for_carts(false); |
|
383 | - } |
|
384 | - |
|
385 | - |
|
386 | - |
|
387 | - /** |
|
388 | - * @return EE_Base_Class[]|EE_Line_Item[] |
|
389 | - * @throws \EE_Error |
|
390 | - */ |
|
391 | - public function get_total_line_items_for_expired_carts() |
|
392 | - { |
|
393 | - return $this->get_total_line_items_for_carts(true); |
|
394 | - } |
|
395 | - |
|
396 | - |
|
397 | - |
|
398 | - /** |
|
399 | - * Returns an array of grand total line items where the TXN_ID is 0. |
|
400 | - * If $expired is set to true, then only line items for expired sessions will be returned. |
|
401 | - * If $expired is set to false, then only line items for active sessions will be returned. |
|
402 | - * |
|
403 | - * @param bool|null $expired |
|
404 | - * @return EE_Base_Class[]|EE_Line_Item[] |
|
405 | - * @throws \EE_Error |
|
406 | - */ |
|
407 | - private function get_total_line_items_for_carts($expired = null) |
|
408 | - { |
|
409 | - $where_params = array( |
|
410 | - 'TXN_ID' => 0, |
|
411 | - 'LIN_type' => 'total', |
|
412 | - ); |
|
413 | - if ($expired !== null) { |
|
414 | - $where_params['LIN_timestamp'] = array( |
|
415 | - $expired ? '<=' : '>', |
|
416 | - time() - EE_Registry::instance()->SSN->lifespan(), |
|
417 | - ); |
|
418 | - } |
|
419 | - return $this->get_all(array($where_params)); |
|
420 | - } |
|
365 | + /** |
|
366 | + * @return EE_Base_Class[]|EE_Line_Item[] |
|
367 | + * @throws \EE_Error |
|
368 | + */ |
|
369 | + public function get_total_line_items_with_no_transaction() |
|
370 | + { |
|
371 | + return $this->get_total_line_items_for_carts(); |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + |
|
376 | + /** |
|
377 | + * @return EE_Base_Class[]|EE_Line_Item[] |
|
378 | + * @throws \EE_Error |
|
379 | + */ |
|
380 | + public function get_total_line_items_for_active_carts() |
|
381 | + { |
|
382 | + return $this->get_total_line_items_for_carts(false); |
|
383 | + } |
|
384 | + |
|
385 | + |
|
386 | + |
|
387 | + /** |
|
388 | + * @return EE_Base_Class[]|EE_Line_Item[] |
|
389 | + * @throws \EE_Error |
|
390 | + */ |
|
391 | + public function get_total_line_items_for_expired_carts() |
|
392 | + { |
|
393 | + return $this->get_total_line_items_for_carts(true); |
|
394 | + } |
|
395 | + |
|
396 | + |
|
397 | + |
|
398 | + /** |
|
399 | + * Returns an array of grand total line items where the TXN_ID is 0. |
|
400 | + * If $expired is set to true, then only line items for expired sessions will be returned. |
|
401 | + * If $expired is set to false, then only line items for active sessions will be returned. |
|
402 | + * |
|
403 | + * @param bool|null $expired |
|
404 | + * @return EE_Base_Class[]|EE_Line_Item[] |
|
405 | + * @throws \EE_Error |
|
406 | + */ |
|
407 | + private function get_total_line_items_for_carts($expired = null) |
|
408 | + { |
|
409 | + $where_params = array( |
|
410 | + 'TXN_ID' => 0, |
|
411 | + 'LIN_type' => 'total', |
|
412 | + ); |
|
413 | + if ($expired !== null) { |
|
414 | + $where_params['LIN_timestamp'] = array( |
|
415 | + $expired ? '<=' : '>', |
|
416 | + time() - EE_Registry::instance()->SSN->lifespan(), |
|
417 | + ); |
|
418 | + } |
|
419 | + return $this->get_all(array($where_params)); |
|
420 | + } |
|
421 | 421 | |
422 | 422 | |
423 | 423 |
@@ -418,7 +418,7 @@ |
||
418 | 418 | * In this case, we delete the temporary file |
419 | 419 | * |
420 | 420 | * @param JobParameters $job_parameters |
421 | - * @return boolean |
|
421 | + * @return JobStepResponse |
|
422 | 422 | */ |
423 | 423 | public function cleanup_job(JobParameters $job_parameters) |
424 | 424 | { |
@@ -174,7 +174,7 @@ |
||
174 | 174 | $job_parameters->extra_datum('query_params')); |
175 | 175 | \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
176 | 176 | $units_processed = count($csv_data); |
177 | - }else{ |
|
177 | + } else{ |
|
178 | 178 | $units_processed = 0; |
179 | 179 | } |
180 | 180 | $job_parameters->mark_processed($units_processed); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | array_diff_key( |
84 | 84 | $query_params, |
85 | 85 | array_flip( |
86 | - array( 'limit' ) |
|
86 | + array('limit') |
|
87 | 87 | ) |
88 | 88 | ) |
89 | 89 | ) |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | ); |
131 | 131 | } |
132 | 132 | $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping())); |
133 | - if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) { |
|
133 | + if (apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) { |
|
134 | 134 | $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL'); |
135 | 135 | } |
136 | - $question_query_params['group_by'] = array( 'QST_ID' ); |
|
137 | - return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) ); |
|
136 | + $question_query_params['group_by'] = array('QST_ID'); |
|
137 | + return array_unique(\EEM_Question::instance()->get_col($question_query_params, 'QST_admin_label')); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val); |
154 | 154 | } else { |
155 | 155 | //it's a normal where condition |
156 | - $question_where_params['Question_Group.Event.Registration.' . $key] = $val; |
|
156 | + $question_where_params['Question_Group.Event.Registration.'.$key] = $val; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | return $question_where_params; |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) |
173 | 173 | { |
174 | - if( $job_parameters->units_processed() < $job_parameters->job_size() ) { |
|
174 | + if ($job_parameters->units_processed() < $job_parameters->job_size()) { |
|
175 | 175 | $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'), |
176 | 176 | $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'), |
177 | 177 | $job_parameters->extra_datum('query_params')); |
178 | 178 | \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
179 | 179 | $units_processed = count($csv_data); |
180 | - }else{ |
|
180 | + } else { |
|
181 | 181 | $units_processed = 0; |
182 | 182 | } |
183 | 183 | $job_parameters->mark_processed($units_processed); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
18 | 18 | |
19 | 19 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
20 | - exit('No direct script access allowed'); |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -25,443 +25,442 @@ discard block |
||
25 | 25 | class RegistrationsReport extends JobHandlerFile |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Performs any necessary setup for starting the job. This is also a good |
|
30 | - * place to setup the $job_arguments which will be used for subsequent HTTP requests |
|
31 | - * when continue_job will be called |
|
32 | - * |
|
33 | - * @param JobParameters $job_parameters |
|
34 | - * @throws BatchRequestException |
|
35 | - * @return JobStepResponse |
|
36 | - */ |
|
37 | - public function create_job(JobParameters $job_parameters) |
|
38 | - { |
|
39 | - $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | - if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | - throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso')); |
|
42 | - } |
|
43 | - $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(), |
|
44 | - $this->get_filename($event_id)); |
|
45 | - $job_parameters->add_extra_data('filepath', $filepath); |
|
46 | - if ($job_parameters->request_datum('use_filters', false)) { |
|
47 | - $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array()))); |
|
48 | - } else { |
|
49 | - $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array( |
|
50 | - array( |
|
51 | - 'OR' => array( |
|
52 | - //don't include registrations from failed or abandoned transactions... |
|
53 | - 'Transaction.STS_ID' => array( |
|
54 | - 'NOT IN', |
|
55 | - array( |
|
56 | - \EEM_Transaction::failed_status_code, |
|
57 | - \EEM_Transaction::abandoned_status_code, |
|
58 | - ), |
|
59 | - ), |
|
60 | - //unless the registration is approved, in which case include it regardless of transaction status |
|
61 | - 'STS_ID' => \EEM_Registration::status_id_approved, |
|
62 | - ), |
|
63 | - 'Ticket.TKT_deleted' => array('IN', array(true, false)), |
|
64 | - ), |
|
65 | - 'order_by' => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'), |
|
66 | - 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
67 | - 'caps' => \EEM_Base::caps_read_admin, |
|
68 | - ), $event_id); |
|
69 | - if ($event_id) { |
|
70 | - $query_params[0]['EVT_ID'] = $event_id; |
|
71 | - } else { |
|
72 | - $query_params['force_join'][] = 'Event'; |
|
73 | - } |
|
74 | - } |
|
75 | - if ( ! isset($query_params['force_join'])) { |
|
76 | - $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee'); |
|
77 | - } |
|
78 | - $job_parameters->add_extra_data('query_params', $query_params); |
|
79 | - $question_labels = $this->_get_question_labels($query_params); |
|
80 | - $job_parameters->add_extra_data('question_labels', $question_labels); |
|
81 | - $job_parameters->set_job_size( |
|
82 | - \EEM_Registration::instance()->count( |
|
83 | - array_diff_key( |
|
84 | - $query_params, |
|
85 | - array_flip( |
|
86 | - array( 'limit' ) |
|
87 | - ) |
|
88 | - ) |
|
89 | - ) |
|
90 | - ); |
|
91 | - //we should also set the header columns |
|
92 | - $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'), |
|
93 | - $job_parameters->extra_datum('query_params')); |
|
94 | - \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
95 | - //if we actually processed a row there, record it |
|
96 | - if ($job_parameters->job_size()) { |
|
97 | - $job_parameters->mark_processed(1); |
|
98 | - } |
|
99 | - return new JobStepResponse($job_parameters, |
|
100 | - __('Registrations report started successfully...', 'event_espresso')); |
|
101 | - } |
|
28 | + /** |
|
29 | + * Performs any necessary setup for starting the job. This is also a good |
|
30 | + * place to setup the $job_arguments which will be used for subsequent HTTP requests |
|
31 | + * when continue_job will be called |
|
32 | + * |
|
33 | + * @param JobParameters $job_parameters |
|
34 | + * @throws BatchRequestException |
|
35 | + * @return JobStepResponse |
|
36 | + */ |
|
37 | + public function create_job(JobParameters $job_parameters) |
|
38 | + { |
|
39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | + throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso')); |
|
42 | + } |
|
43 | + $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(), |
|
44 | + $this->get_filename($event_id)); |
|
45 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
46 | + if ($job_parameters->request_datum('use_filters', false)) { |
|
47 | + $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array()))); |
|
48 | + } else { |
|
49 | + $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array( |
|
50 | + array( |
|
51 | + 'OR' => array( |
|
52 | + //don't include registrations from failed or abandoned transactions... |
|
53 | + 'Transaction.STS_ID' => array( |
|
54 | + 'NOT IN', |
|
55 | + array( |
|
56 | + \EEM_Transaction::failed_status_code, |
|
57 | + \EEM_Transaction::abandoned_status_code, |
|
58 | + ), |
|
59 | + ), |
|
60 | + //unless the registration is approved, in which case include it regardless of transaction status |
|
61 | + 'STS_ID' => \EEM_Registration::status_id_approved, |
|
62 | + ), |
|
63 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)), |
|
64 | + ), |
|
65 | + 'order_by' => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'), |
|
66 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
67 | + 'caps' => \EEM_Base::caps_read_admin, |
|
68 | + ), $event_id); |
|
69 | + if ($event_id) { |
|
70 | + $query_params[0]['EVT_ID'] = $event_id; |
|
71 | + } else { |
|
72 | + $query_params['force_join'][] = 'Event'; |
|
73 | + } |
|
74 | + } |
|
75 | + if ( ! isset($query_params['force_join'])) { |
|
76 | + $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee'); |
|
77 | + } |
|
78 | + $job_parameters->add_extra_data('query_params', $query_params); |
|
79 | + $question_labels = $this->_get_question_labels($query_params); |
|
80 | + $job_parameters->add_extra_data('question_labels', $question_labels); |
|
81 | + $job_parameters->set_job_size( |
|
82 | + \EEM_Registration::instance()->count( |
|
83 | + array_diff_key( |
|
84 | + $query_params, |
|
85 | + array_flip( |
|
86 | + array( 'limit' ) |
|
87 | + ) |
|
88 | + ) |
|
89 | + ) |
|
90 | + ); |
|
91 | + //we should also set the header columns |
|
92 | + $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'), |
|
93 | + $job_parameters->extra_datum('query_params')); |
|
94 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
95 | + //if we actually processed a row there, record it |
|
96 | + if ($job_parameters->job_size()) { |
|
97 | + $job_parameters->mark_processed(1); |
|
98 | + } |
|
99 | + return new JobStepResponse($job_parameters, |
|
100 | + __('Registrations report started successfully...', 'event_espresso')); |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | 104 | |
105 | - /** |
|
106 | - * Gets the filename |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - protected function get_filename() |
|
110 | - { |
|
111 | - return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql'))); |
|
112 | - } |
|
105 | + /** |
|
106 | + * Gets the filename |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + protected function get_filename() |
|
110 | + { |
|
111 | + return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql'))); |
|
112 | + } |
|
113 | 113 | |
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * Gets the questions which are to be used for this report, so they |
|
118 | - * can be remembered for later |
|
119 | - * |
|
120 | - * @param array $registration_query_params |
|
121 | - * @return array question admin labels to be used for this report |
|
122 | - */ |
|
123 | - protected function _get_question_labels($registration_query_params) |
|
124 | - { |
|
125 | - $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null; |
|
126 | - $question_query_params = array(); |
|
127 | - if ($where !== null) { |
|
128 | - $question_query_params = array( |
|
129 | - $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]), |
|
130 | - ); |
|
131 | - } |
|
132 | - $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping())); |
|
133 | - if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) { |
|
134 | - $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL'); |
|
135 | - } |
|
136 | - $question_query_params['group_by'] = array( 'QST_ID' ); |
|
137 | - return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) ); |
|
138 | - } |
|
116 | + /** |
|
117 | + * Gets the questions which are to be used for this report, so they |
|
118 | + * can be remembered for later |
|
119 | + * |
|
120 | + * @param array $registration_query_params |
|
121 | + * @return array question admin labels to be used for this report |
|
122 | + */ |
|
123 | + protected function _get_question_labels($registration_query_params) |
|
124 | + { |
|
125 | + $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null; |
|
126 | + $question_query_params = array(); |
|
127 | + if ($where !== null) { |
|
128 | + $question_query_params = array( |
|
129 | + $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]), |
|
130 | + ); |
|
131 | + } |
|
132 | + $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping())); |
|
133 | + if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) { |
|
134 | + $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL'); |
|
135 | + } |
|
136 | + $question_query_params['group_by'] = array( 'QST_ID' ); |
|
137 | + return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) ); |
|
138 | + } |
|
139 | 139 | |
140 | 140 | |
141 | 141 | |
142 | - /** |
|
143 | - * Takes where params meant for registrations and changes them to work for questions |
|
144 | - * |
|
145 | - * @param array $reg_where_params |
|
146 | - * @return array |
|
147 | - */ |
|
148 | - protected function _change_registration_where_params_to_question_where_params($reg_where_params) |
|
149 | - { |
|
150 | - $question_where_params = array(); |
|
151 | - foreach ($reg_where_params as $key => $val) { |
|
152 | - if (\EEM_Registration::instance()->is_logic_query_param_key($key)) { |
|
153 | - $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val); |
|
154 | - } else { |
|
155 | - //it's a normal where condition |
|
156 | - $question_where_params['Question_Group.Event.Registration.' . $key] = $val; |
|
157 | - } |
|
158 | - } |
|
159 | - return $question_where_params; |
|
160 | - } |
|
142 | + /** |
|
143 | + * Takes where params meant for registrations and changes them to work for questions |
|
144 | + * |
|
145 | + * @param array $reg_where_params |
|
146 | + * @return array |
|
147 | + */ |
|
148 | + protected function _change_registration_where_params_to_question_where_params($reg_where_params) |
|
149 | + { |
|
150 | + $question_where_params = array(); |
|
151 | + foreach ($reg_where_params as $key => $val) { |
|
152 | + if (\EEM_Registration::instance()->is_logic_query_param_key($key)) { |
|
153 | + $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val); |
|
154 | + } else { |
|
155 | + //it's a normal where condition |
|
156 | + $question_where_params['Question_Group.Event.Registration.' . $key] = $val; |
|
157 | + } |
|
158 | + } |
|
159 | + return $question_where_params; |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | 163 | |
164 | - /** |
|
165 | - * Performs another step of the job |
|
166 | - * |
|
167 | - * @param JobParameters $job_parameters |
|
168 | - * @param int $batch_size |
|
169 | - * @return JobStepResponse |
|
170 | - * @throws \EE_Error |
|
171 | - */ |
|
172 | - public function continue_job(JobParameters $job_parameters, $batch_size = 50) |
|
173 | - { |
|
174 | - if( $job_parameters->units_processed() < $job_parameters->job_size() ) { |
|
175 | - $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'), |
|
176 | - $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'), |
|
177 | - $job_parameters->extra_datum('query_params')); |
|
178 | - \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
179 | - $units_processed = count($csv_data); |
|
180 | - }else{ |
|
181 | - $units_processed = 0; |
|
182 | - } |
|
183 | - $job_parameters->mark_processed($units_processed); |
|
184 | - $extra_response_data = array( |
|
185 | - 'file_url' => '', |
|
186 | - ); |
|
187 | - if ($units_processed < $batch_size) { |
|
188 | - $job_parameters->set_status(JobParameters::status_complete); |
|
189 | - $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
190 | - } |
|
164 | + /** |
|
165 | + * Performs another step of the job |
|
166 | + * |
|
167 | + * @param JobParameters $job_parameters |
|
168 | + * @param int $batch_size |
|
169 | + * @return JobStepResponse |
|
170 | + * @throws \EE_Error |
|
171 | + */ |
|
172 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) |
|
173 | + { |
|
174 | + if( $job_parameters->units_processed() < $job_parameters->job_size() ) { |
|
175 | + $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'), |
|
176 | + $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'), |
|
177 | + $job_parameters->extra_datum('query_params')); |
|
178 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
179 | + $units_processed = count($csv_data); |
|
180 | + }else{ |
|
181 | + $units_processed = 0; |
|
182 | + } |
|
183 | + $job_parameters->mark_processed($units_processed); |
|
184 | + $extra_response_data = array( |
|
185 | + 'file_url' => '', |
|
186 | + ); |
|
187 | + if ($units_processed < $batch_size) { |
|
188 | + $job_parameters->set_status(JobParameters::status_complete); |
|
189 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
190 | + } |
|
191 | 191 | |
192 | - return new JobStepResponse($job_parameters, |
|
193 | - sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)), |
|
194 | - $extra_response_data); |
|
195 | - } |
|
192 | + return new JobStepResponse($job_parameters, |
|
193 | + sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)), |
|
194 | + $extra_response_data); |
|
195 | + } |
|
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * Gets the csv data for a batch of registrations |
|
201 | - |
|
202 | - * |
|
199 | + /** |
|
200 | + * Gets the csv data for a batch of registrations |
|
201 | + * |
|
203 | 202 | *@param int|null $event_id |
204 | - * @param int $offset |
|
205 | - * @param int $limit |
|
206 | - * @param array $question_labels the IDs for all the questions which were answered by someone in this selection |
|
207 | - * @param array $query_params for using where querying the model |
|
208 | - * @return array top-level keys are numeric, next-level keys are column headers |
|
209 | - */ |
|
210 | - function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params) |
|
211 | - { |
|
212 | - $reg_fields_to_include = array( |
|
213 | - 'TXN_ID', |
|
214 | - 'ATT_ID', |
|
215 | - 'REG_ID', |
|
216 | - 'REG_date', |
|
217 | - 'REG_code', |
|
218 | - 'REG_count', |
|
219 | - 'REG_final_price', |
|
220 | - ); |
|
221 | - $att_fields_to_include = array( |
|
222 | - 'ATT_fname', |
|
223 | - 'ATT_lname', |
|
224 | - 'ATT_email', |
|
225 | - 'ATT_address', |
|
226 | - 'ATT_address2', |
|
227 | - 'ATT_city', |
|
228 | - 'STA_ID', |
|
229 | - 'CNT_ISO', |
|
230 | - 'ATT_zip', |
|
231 | - 'ATT_phone', |
|
232 | - ); |
|
233 | - $registrations_csv_ready_array = array(); |
|
234 | - $reg_model = \EE_Registry::instance()->load_model('Registration'); |
|
235 | - $query_params['limit'] = array($offset, $limit); |
|
236 | - $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
237 | - $registration_ids = array(); |
|
238 | - foreach ($registration_rows as $reg_row) { |
|
239 | - $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
240 | - } |
|
241 | - foreach ($registration_rows as $reg_row) { |
|
242 | - if (is_array($reg_row)) { |
|
243 | - $reg_csv_array = array(); |
|
244 | - if ( ! $event_id) { |
|
245 | - //get the event's name and Id |
|
246 | - $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), |
|
247 | - \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', |
|
248 | - $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
249 | - } |
|
250 | - $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
251 | - /*@var $reg_row EE_Registration */ |
|
252 | - foreach ($reg_fields_to_include as $field_name) { |
|
253 | - $field = $reg_model->field_settings_for($field_name); |
|
254 | - if ($field_name == 'REG_final_price') { |
|
255 | - $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
256 | - $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
257 | - } elseif ($field_name == 'REG_count') { |
|
258 | - $value = sprintf(__('%s of %s', 'event_espresso'), |
|
259 | - \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', |
|
260 | - $reg_row['Registration.REG_count']), |
|
261 | - \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', |
|
262 | - $reg_row['Registration.REG_group_size'])); |
|
263 | - } elseif ($field_name == 'REG_date') { |
|
264 | - $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
265 | - $reg_row['Registration.REG_date'], 'no_html'); |
|
266 | - } else { |
|
267 | - $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
268 | - $reg_row[$field->get_qualified_column()]); |
|
269 | - } |
|
270 | - $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
|
271 | - if ($field_name == 'REG_final_price') { |
|
272 | - //add a column named Currency after the final price |
|
273 | - $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
|
274 | - } |
|
275 | - } |
|
276 | - //get pretty status |
|
277 | - $stati = \EEM_Status::instance()->localized_status(array( |
|
278 | - $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
279 | - $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'), |
|
280 | - ), false, 'sentence'); |
|
281 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
282 | - //get pretty transaction status |
|
283 | - $reg_csv_array[__("Transaction Status", |
|
284 | - 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
285 | - $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg |
|
286 | - ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', |
|
287 | - $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
288 | - $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg |
|
289 | - ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', |
|
290 | - $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
291 | - $payment_methods = array(); |
|
292 | - $gateway_txn_ids_etc = array(); |
|
293 | - $payment_times = array(); |
|
294 | - if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
295 | - $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array( |
|
296 | - array( |
|
297 | - 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
298 | - 'STS_ID' => \EEM_Payment::status_id_approved, |
|
299 | - ), |
|
300 | - 'force_join' => array('Payment_Method'), |
|
301 | - ), ARRAY_A, |
|
302 | - 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time'); |
|
303 | - foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
304 | - $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) |
|
305 | - ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
306 | - $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) |
|
307 | - ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
308 | - $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) |
|
309 | - ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
310 | - } |
|
311 | - } |
|
312 | - $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
313 | - $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
314 | - $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
315 | - //get whether or not the user has checked in |
|
316 | - $reg_csv_array[__("Check-Ins", |
|
317 | - "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
318 | - //get ticket of registration and its price |
|
319 | - $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
|
320 | - if ($reg_row['Ticket.TKT_ID']) { |
|
321 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', |
|
322 | - $reg_row['Ticket.TKT_name']); |
|
323 | - $datetimes_strings = array(); |
|
324 | - foreach ( |
|
325 | - \EEM_Datetime::instance()->get_all_wpdb_results(array( |
|
326 | - array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), |
|
327 | - 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
328 | - 'default_where_conditions' => 'none', |
|
329 | - )) as $datetime |
|
330 | - ) { |
|
331 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), |
|
332 | - 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
333 | - } |
|
334 | - } else { |
|
335 | - $ticket_name = __('Unknown', 'event_espresso'); |
|
336 | - $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
337 | - } |
|
338 | - $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
|
339 | - $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
|
340 | - //get datetime(s) of registration |
|
341 | - //add attendee columns |
|
342 | - foreach ($att_fields_to_include as $att_field_name) { |
|
343 | - $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
|
344 | - if ($reg_row['Attendee_CPT.ID']) { |
|
345 | - if ($att_field_name == 'STA_ID') { |
|
346 | - $value = \EEM_State::instance() |
|
347 | - ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), |
|
348 | - 'STA_name'); |
|
349 | - } elseif ($att_field_name == 'CNT_ISO') { |
|
350 | - $value = \EEM_Country::instance() |
|
351 | - ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), |
|
352 | - 'CNT_name'); |
|
353 | - } else { |
|
354 | - $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), |
|
355 | - $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
356 | - } |
|
357 | - } else { |
|
358 | - $value = ''; |
|
359 | - } |
|
360 | - $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
361 | - } |
|
362 | - //make sure each registration has the same questions in the same order |
|
363 | - foreach ($question_labels as $question_label) { |
|
364 | - if ( ! isset($reg_csv_array[$question_label])) { |
|
365 | - $reg_csv_array[$question_label] = null; |
|
366 | - } |
|
367 | - } |
|
368 | - $answers = \EEM_Answer::instance()->get_all_wpdb_results(array( |
|
369 | - array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
370 | - 'force_join' => array('Question'), |
|
371 | - )); |
|
372 | - //now fill out the questions THEY answered |
|
373 | - foreach ($answers as $answer_row) { |
|
374 | - if ($answer_row['Question.QST_ID']) { |
|
375 | - $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(), |
|
376 | - 'QST_admin_label', $answer_row['Question.QST_admin_label']); |
|
377 | - } else { |
|
378 | - $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
379 | - } |
|
380 | - if (isset($answer_row['Question.QST_type']) |
|
381 | - && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
382 | - ) { |
|
383 | - $reg_csv_array[$question_label] = \EEM_State::instance() |
|
384 | - ->get_state_name_by_ID($answer_row['Answer.ANS_value']); |
|
385 | - } else { |
|
386 | - //this isn't for html, so don't show html entities |
|
387 | - $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(), |
|
388 | - 'ANS_value', $answer_row['Answer.ANS_value'])); |
|
389 | - } |
|
390 | - } |
|
391 | - /** |
|
392 | - * Filter to change the contents of each row of the registrations report CSV file. |
|
393 | - * |
|
394 | - * This can be used to add or remote columns from the CSV file, or change their values. * |
|
395 | - * Note: it has this name because originally that's where this filter resided, |
|
396 | - * and we've left its name as-is for backward compatibility. |
|
397 | - * Note when using: all rows in the CSV should have the same columns. |
|
398 | - * |
|
399 | - * @param array $reg_csv_array keys are column-header names, and values are that columns' value |
|
400 | - * in this row |
|
401 | - * @param array $reg_row is the row from the database's wp_esp_registration table |
|
402 | - * |
|
403 | - */ |
|
404 | - $registrations_csv_ready_array[] = apply_filters( |
|
405 | - 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
406 | - $reg_csv_array, |
|
407 | - $reg_row |
|
408 | - ); |
|
409 | - } |
|
410 | - } |
|
411 | - //if we couldn't export anything, we want to at least show the column headers |
|
412 | - if (empty($registrations_csv_ready_array)) { |
|
413 | - $reg_csv_array = array(); |
|
414 | - $model_and_fields_to_include = array( |
|
415 | - 'Registration' => $reg_fields_to_include, |
|
416 | - 'Attendee' => $att_fields_to_include, |
|
417 | - ); |
|
418 | - foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
419 | - $model = \EE_Registry::instance()->load_model($model_name); |
|
420 | - foreach ($field_list as $field_name) { |
|
421 | - $field = $model->field_settings_for($field_name); |
|
422 | - $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
423 | - } |
|
424 | - } |
|
425 | - $registrations_csv_ready_array[] = $reg_csv_array; |
|
426 | - } |
|
427 | - return $registrations_csv_ready_array; |
|
428 | - } |
|
203 | + * @param int $offset |
|
204 | + * @param int $limit |
|
205 | + * @param array $question_labels the IDs for all the questions which were answered by someone in this selection |
|
206 | + * @param array $query_params for using where querying the model |
|
207 | + * @return array top-level keys are numeric, next-level keys are column headers |
|
208 | + */ |
|
209 | + function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params) |
|
210 | + { |
|
211 | + $reg_fields_to_include = array( |
|
212 | + 'TXN_ID', |
|
213 | + 'ATT_ID', |
|
214 | + 'REG_ID', |
|
215 | + 'REG_date', |
|
216 | + 'REG_code', |
|
217 | + 'REG_count', |
|
218 | + 'REG_final_price', |
|
219 | + ); |
|
220 | + $att_fields_to_include = array( |
|
221 | + 'ATT_fname', |
|
222 | + 'ATT_lname', |
|
223 | + 'ATT_email', |
|
224 | + 'ATT_address', |
|
225 | + 'ATT_address2', |
|
226 | + 'ATT_city', |
|
227 | + 'STA_ID', |
|
228 | + 'CNT_ISO', |
|
229 | + 'ATT_zip', |
|
230 | + 'ATT_phone', |
|
231 | + ); |
|
232 | + $registrations_csv_ready_array = array(); |
|
233 | + $reg_model = \EE_Registry::instance()->load_model('Registration'); |
|
234 | + $query_params['limit'] = array($offset, $limit); |
|
235 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
236 | + $registration_ids = array(); |
|
237 | + foreach ($registration_rows as $reg_row) { |
|
238 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
239 | + } |
|
240 | + foreach ($registration_rows as $reg_row) { |
|
241 | + if (is_array($reg_row)) { |
|
242 | + $reg_csv_array = array(); |
|
243 | + if ( ! $event_id) { |
|
244 | + //get the event's name and Id |
|
245 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), |
|
246 | + \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', |
|
247 | + $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
248 | + } |
|
249 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
250 | + /*@var $reg_row EE_Registration */ |
|
251 | + foreach ($reg_fields_to_include as $field_name) { |
|
252 | + $field = $reg_model->field_settings_for($field_name); |
|
253 | + if ($field_name == 'REG_final_price') { |
|
254 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
255 | + $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
256 | + } elseif ($field_name == 'REG_count') { |
|
257 | + $value = sprintf(__('%s of %s', 'event_espresso'), |
|
258 | + \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', |
|
259 | + $reg_row['Registration.REG_count']), |
|
260 | + \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', |
|
261 | + $reg_row['Registration.REG_group_size'])); |
|
262 | + } elseif ($field_name == 'REG_date') { |
|
263 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
264 | + $reg_row['Registration.REG_date'], 'no_html'); |
|
265 | + } else { |
|
266 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
267 | + $reg_row[$field->get_qualified_column()]); |
|
268 | + } |
|
269 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
|
270 | + if ($field_name == 'REG_final_price') { |
|
271 | + //add a column named Currency after the final price |
|
272 | + $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
|
273 | + } |
|
274 | + } |
|
275 | + //get pretty status |
|
276 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
277 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
278 | + $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'), |
|
279 | + ), false, 'sentence'); |
|
280 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
281 | + //get pretty transaction status |
|
282 | + $reg_csv_array[__("Transaction Status", |
|
283 | + 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
284 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg |
|
285 | + ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', |
|
286 | + $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
287 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg |
|
288 | + ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', |
|
289 | + $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
290 | + $payment_methods = array(); |
|
291 | + $gateway_txn_ids_etc = array(); |
|
292 | + $payment_times = array(); |
|
293 | + if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
294 | + $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array( |
|
295 | + array( |
|
296 | + 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
297 | + 'STS_ID' => \EEM_Payment::status_id_approved, |
|
298 | + ), |
|
299 | + 'force_join' => array('Payment_Method'), |
|
300 | + ), ARRAY_A, |
|
301 | + 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time'); |
|
302 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
303 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) |
|
304 | + ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
305 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) |
|
306 | + ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
307 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) |
|
308 | + ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
309 | + } |
|
310 | + } |
|
311 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
312 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
313 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
314 | + //get whether or not the user has checked in |
|
315 | + $reg_csv_array[__("Check-Ins", |
|
316 | + "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
317 | + //get ticket of registration and its price |
|
318 | + $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
|
319 | + if ($reg_row['Ticket.TKT_ID']) { |
|
320 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', |
|
321 | + $reg_row['Ticket.TKT_name']); |
|
322 | + $datetimes_strings = array(); |
|
323 | + foreach ( |
|
324 | + \EEM_Datetime::instance()->get_all_wpdb_results(array( |
|
325 | + array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), |
|
326 | + 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
327 | + 'default_where_conditions' => 'none', |
|
328 | + )) as $datetime |
|
329 | + ) { |
|
330 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), |
|
331 | + 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
332 | + } |
|
333 | + } else { |
|
334 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
335 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
336 | + } |
|
337 | + $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
|
338 | + $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
|
339 | + //get datetime(s) of registration |
|
340 | + //add attendee columns |
|
341 | + foreach ($att_fields_to_include as $att_field_name) { |
|
342 | + $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
|
343 | + if ($reg_row['Attendee_CPT.ID']) { |
|
344 | + if ($att_field_name == 'STA_ID') { |
|
345 | + $value = \EEM_State::instance() |
|
346 | + ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), |
|
347 | + 'STA_name'); |
|
348 | + } elseif ($att_field_name == 'CNT_ISO') { |
|
349 | + $value = \EEM_Country::instance() |
|
350 | + ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), |
|
351 | + 'CNT_name'); |
|
352 | + } else { |
|
353 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), |
|
354 | + $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
355 | + } |
|
356 | + } else { |
|
357 | + $value = ''; |
|
358 | + } |
|
359 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
360 | + } |
|
361 | + //make sure each registration has the same questions in the same order |
|
362 | + foreach ($question_labels as $question_label) { |
|
363 | + if ( ! isset($reg_csv_array[$question_label])) { |
|
364 | + $reg_csv_array[$question_label] = null; |
|
365 | + } |
|
366 | + } |
|
367 | + $answers = \EEM_Answer::instance()->get_all_wpdb_results(array( |
|
368 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
369 | + 'force_join' => array('Question'), |
|
370 | + )); |
|
371 | + //now fill out the questions THEY answered |
|
372 | + foreach ($answers as $answer_row) { |
|
373 | + if ($answer_row['Question.QST_ID']) { |
|
374 | + $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(), |
|
375 | + 'QST_admin_label', $answer_row['Question.QST_admin_label']); |
|
376 | + } else { |
|
377 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
378 | + } |
|
379 | + if (isset($answer_row['Question.QST_type']) |
|
380 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
381 | + ) { |
|
382 | + $reg_csv_array[$question_label] = \EEM_State::instance() |
|
383 | + ->get_state_name_by_ID($answer_row['Answer.ANS_value']); |
|
384 | + } else { |
|
385 | + //this isn't for html, so don't show html entities |
|
386 | + $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(), |
|
387 | + 'ANS_value', $answer_row['Answer.ANS_value'])); |
|
388 | + } |
|
389 | + } |
|
390 | + /** |
|
391 | + * Filter to change the contents of each row of the registrations report CSV file. |
|
392 | + * |
|
393 | + * This can be used to add or remote columns from the CSV file, or change their values. * |
|
394 | + * Note: it has this name because originally that's where this filter resided, |
|
395 | + * and we've left its name as-is for backward compatibility. |
|
396 | + * Note when using: all rows in the CSV should have the same columns. |
|
397 | + * |
|
398 | + * @param array $reg_csv_array keys are column-header names, and values are that columns' value |
|
399 | + * in this row |
|
400 | + * @param array $reg_row is the row from the database's wp_esp_registration table |
|
401 | + * |
|
402 | + */ |
|
403 | + $registrations_csv_ready_array[] = apply_filters( |
|
404 | + 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
405 | + $reg_csv_array, |
|
406 | + $reg_row |
|
407 | + ); |
|
408 | + } |
|
409 | + } |
|
410 | + //if we couldn't export anything, we want to at least show the column headers |
|
411 | + if (empty($registrations_csv_ready_array)) { |
|
412 | + $reg_csv_array = array(); |
|
413 | + $model_and_fields_to_include = array( |
|
414 | + 'Registration' => $reg_fields_to_include, |
|
415 | + 'Attendee' => $att_fields_to_include, |
|
416 | + ); |
|
417 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
418 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
419 | + foreach ($field_list as $field_name) { |
|
420 | + $field = $model->field_settings_for($field_name); |
|
421 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
422 | + } |
|
423 | + } |
|
424 | + $registrations_csv_ready_array[] = $reg_csv_array; |
|
425 | + } |
|
426 | + return $registrations_csv_ready_array; |
|
427 | + } |
|
429 | 428 | |
430 | 429 | |
431 | 430 | |
432 | - /** |
|
433 | - * Counts total unit to process |
|
434 | - * |
|
435 | - * @deprecated since 4.9.19 |
|
436 | - * @param int|array $event_id |
|
437 | - * @return int |
|
438 | - */ |
|
439 | - public function count_units_to_process($event_id) |
|
440 | - { |
|
441 | - //use the legacy filter |
|
442 | - if ($event_id) { |
|
443 | - $query_params[0]['EVT_ID'] = $event_id; |
|
444 | - } else { |
|
445 | - $query_params['force_join'][] = 'Event'; |
|
446 | - } |
|
447 | - return \EEM_Registration::instance()->count($query_params); |
|
448 | - } |
|
431 | + /** |
|
432 | + * Counts total unit to process |
|
433 | + * |
|
434 | + * @deprecated since 4.9.19 |
|
435 | + * @param int|array $event_id |
|
436 | + * @return int |
|
437 | + */ |
|
438 | + public function count_units_to_process($event_id) |
|
439 | + { |
|
440 | + //use the legacy filter |
|
441 | + if ($event_id) { |
|
442 | + $query_params[0]['EVT_ID'] = $event_id; |
|
443 | + } else { |
|
444 | + $query_params['force_join'][] = 'Event'; |
|
445 | + } |
|
446 | + return \EEM_Registration::instance()->count($query_params); |
|
447 | + } |
|
449 | 448 | |
450 | 449 | |
451 | 450 | |
452 | - /** |
|
453 | - * Performs any clean-up logic when we know the job is completed. |
|
454 | - * In this case, we delete the temporary file |
|
455 | - * |
|
456 | - * @param JobParameters $job_parameters |
|
457 | - * @return boolean |
|
458 | - */ |
|
459 | - public function cleanup_job(JobParameters $job_parameters) |
|
460 | - { |
|
461 | - $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
462 | - true, 'd'); |
|
463 | - return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
464 | - } |
|
451 | + /** |
|
452 | + * Performs any clean-up logic when we know the job is completed. |
|
453 | + * In this case, we delete the temporary file |
|
454 | + * |
|
455 | + * @param JobParameters $job_parameters |
|
456 | + * @return boolean |
|
457 | + */ |
|
458 | + public function cleanup_job(JobParameters $job_parameters) |
|
459 | + { |
|
460 | + $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
461 | + true, 'd'); |
|
462 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
463 | + } |
|
465 | 464 | } |
466 | 465 | |
467 | 466 |