@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | $registration instanceof EE_Registration |
136 | 136 | && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
137 | 137 | ) { |
138 | - $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
139 | - if ( ! $this->checkout->admin_request) { |
|
140 | - $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
141 | - $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
142 | - $template_args['ticket_count'][$registration->ticket()->ID()] |
|
143 | - ) |
|
144 | - ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
145 | - : 1; |
|
146 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
147 | - $this->checkout->cart->get_grand_total(), |
|
148 | - 'Ticket', |
|
149 | - array($registration->ticket()->ID()) |
|
150 | - ); |
|
151 | - $ticket_line_item = is_array($ticket_line_item) |
|
152 | - ? reset($ticket_line_item) |
|
153 | - : $ticket_line_item; |
|
154 | - $template_args['ticket_line_item'][$registration->ticket()->ID()] = |
|
155 | - $Line_Item_Display->display_line_item($ticket_line_item); |
|
156 | - } |
|
157 | - if ($registration->is_primary_registrant()) { |
|
158 | - $primary_registrant = $registration->reg_url_link(); |
|
159 | - } |
|
138 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
139 | + if ( ! $this->checkout->admin_request) { |
|
140 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
141 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
142 | + $template_args['ticket_count'][$registration->ticket()->ID()] |
|
143 | + ) |
|
144 | + ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
145 | + : 1; |
|
146 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
147 | + $this->checkout->cart->get_grand_total(), |
|
148 | + 'Ticket', |
|
149 | + array($registration->ticket()->ID()) |
|
150 | + ); |
|
151 | + $ticket_line_item = is_array($ticket_line_item) |
|
152 | + ? reset($ticket_line_item) |
|
153 | + : $ticket_line_item; |
|
154 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = |
|
155 | + $Line_Item_Display->display_line_item($ticket_line_item); |
|
156 | + } |
|
157 | + if ($registration->is_primary_registrant()) { |
|
158 | + $primary_registrant = $registration->reg_url_link(); |
|
159 | + } |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | // print_copy_info ? |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // generate hidden input |
169 | 169 | if ( |
170 | 170 | isset( $subsections[ $primary_registrant ] ) |
171 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
171 | + && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
172 | 172 | ) { |
173 | 173 | $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
174 | 174 | } |
@@ -196,42 +196,42 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - /** |
|
199 | + /** |
|
200 | 200 | * @param EE_Registration $registration |
201 | 201 | * @return EE_Form_Section_Base |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | 204 | private function _registrations_reg_form( EE_Registration $registration ) { |
205 | 205 | static $attendee_nmbr = 1; |
206 | - $form_args = array(); |
|
206 | + $form_args = array(); |
|
207 | 207 | // verify that registration has valid event |
208 | 208 | if ( $registration->event() instanceof EE_Event ) { |
209 | 209 | $question_groups = $registration->event()->question_groups( |
210 | - array( |
|
211 | - array( |
|
212 | - 'Event.EVT_ID' => $registration->event()->ID(), |
|
213 | - 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
214 | - ), |
|
215 | - 'order_by' => array('QSG_order' => 'ASC') |
|
216 | - ) |
|
217 | - ); |
|
210 | + array( |
|
211 | + array( |
|
212 | + 'Event.EVT_ID' => $registration->event()->ID(), |
|
213 | + 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
214 | + ), |
|
215 | + 'order_by' => array('QSG_order' => 'ASC') |
|
216 | + ) |
|
217 | + ); |
|
218 | 218 | if ( $question_groups ) { |
219 | - // array of params to pass to parent constructor |
|
220 | - $form_args = array( |
|
221 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
222 | - 'html_class' => 'ee-reg-form-attendee-dv', |
|
223 | - 'html_style' => $this->checkout->admin_request |
|
224 | - ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
225 | - : '', |
|
226 | - 'subsections' => array(), |
|
227 | - 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
228 | - array( |
|
229 | - 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
230 | - 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
231 | - ) |
|
232 | - ) |
|
233 | - ); |
|
234 | - foreach ( $question_groups as $question_group ) { |
|
219 | + // array of params to pass to parent constructor |
|
220 | + $form_args = array( |
|
221 | + 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
222 | + 'html_class' => 'ee-reg-form-attendee-dv', |
|
223 | + 'html_style' => $this->checkout->admin_request |
|
224 | + ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
225 | + : '', |
|
226 | + 'subsections' => array(), |
|
227 | + 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
228 | + array( |
|
229 | + 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
230 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
231 | + ) |
|
232 | + ) |
|
233 | + ); |
|
234 | + foreach ( $question_groups as $question_group ) { |
|
235 | 235 | if ( $question_group instanceof EE_Question_Group ) { |
236 | 236 | $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
237 | 237 | $registration, |
@@ -239,19 +239,19 @@ discard block |
||
239 | 239 | ); |
240 | 240 | } |
241 | 241 | } |
242 | - // add hidden input |
|
243 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
244 | - $registration |
|
245 | - ); |
|
246 | - // if we have question groups for additional attendees, then display the copy options |
|
242 | + // add hidden input |
|
243 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
244 | + $registration |
|
245 | + ); |
|
246 | + // if we have question groups for additional attendees, then display the copy options |
|
247 | 247 | $this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info; |
248 | - if ($registration->is_primary_registrant()) { |
|
249 | - // generate hidden input |
|
250 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
251 | - } |
|
252 | - } |
|
248 | + if ($registration->is_primary_registrant()) { |
|
249 | + // generate hidden input |
|
250 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
251 | + } |
|
252 | + } |
|
253 | 253 | } |
254 | - $attendee_nmbr++; |
|
254 | + $attendee_nmbr++; |
|
255 | 255 | return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : new EE_Form_Section_HTML(); |
256 | 256 | } |
257 | 257 | |
@@ -743,16 +743,16 @@ discard block |
||
743 | 743 | $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
744 | 744 | // verify we got the goods |
745 | 745 | if ( empty( $registrations )) { |
746 | - //combine the old translated string with a new one, in order to not break translations |
|
747 | - $error_message = esc_html__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ) |
|
748 | - . sprintf( |
|
749 | - esc_html__('%3$sThis can sometimes happen if too much time has been taken to complete the registration process.%3$sPlease return to the %1$sEvent List%2$s and reselect your tickets. If the problem continues, please contact the site administrator.', 'event_espresso'), |
|
750 | - '<a href="' . get_post_type_archive_link('espresso_events') . '" >', |
|
751 | - '</a>', |
|
752 | - '<br />' |
|
753 | - ); |
|
746 | + //combine the old translated string with a new one, in order to not break translations |
|
747 | + $error_message = esc_html__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ) |
|
748 | + . sprintf( |
|
749 | + esc_html__('%3$sThis can sometimes happen if too much time has been taken to complete the registration process.%3$sPlease return to the %1$sEvent List%2$s and reselect your tickets. If the problem continues, please contact the site administrator.', 'event_espresso'), |
|
750 | + '<a href="' . get_post_type_archive_link('espresso_events') . '" >', |
|
751 | + '</a>', |
|
752 | + '<br />' |
|
753 | + ); |
|
754 | 754 | EE_Error::add_error( |
755 | - $error_message, |
|
755 | + $error_message, |
|
756 | 756 | __FILE__, |
757 | 757 | __FUNCTION__, |
758 | 758 | __LINE__ |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | if ( isset( $valid_data[ $reg_url_link ] ) ) { |
893 | 893 | // do we need to copy basic info from primary attendee ? |
894 | 894 | $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
895 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
895 | + && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
896 | 896 | ? true |
897 | 897 | : false; |
898 | 898 | // filter form input data for this registration |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | ) ) { |
1063 | 1063 | return true; |
1064 | 1064 | } |
1065 | - /* |
|
1065 | + /* |
|
1066 | 1066 | * $answer_cache_id is the key used to find the EE_Answer we want |
1067 | 1067 | * @see https://events.codebasehq.com/projects/event-espresso/tickets/10477 |
1068 | 1068 | */ |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | ? $form_input . '-' . $registration->reg_url_link() |
1071 | 1071 | : $form_input; |
1072 | 1072 | $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
1073 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1073 | + && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1074 | 1074 | ? true |
1075 | 1075 | : false; |
1076 | 1076 | //rename form_inputs if they are EE_Attendee properties |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | // then attempt to copy them from the primary attendee |
1191 | 1191 | if ( |
1192 | 1192 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1193 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1193 | + && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1194 | 1194 | ) { |
1195 | 1195 | return $this->checkout->primary_attendee_obj; |
1196 | 1196 | } |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | } |
1309 | 1309 | foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
1310 | 1310 | if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
1311 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1311 | + || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1312 | 1312 | ) { |
1313 | 1313 | $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
1314 | 1314 | $critical_attendee_detail |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @param EE_Checkout $checkout |
43 | 43 | */ |
44 | - public function __construct( EE_Checkout $checkout ) { |
|
44 | + public function __construct(EE_Checkout $checkout) { |
|
45 | 45 | $this->_slug = 'attendee_information'; |
46 | 46 | $this->_name = __('Attendee Information', 'event_espresso'); |
47 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
47 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
48 | 48 | $this->checkout = $checkout; |
49 | 49 | $this->_reset_success_message(); |
50 | 50 | $this->set_instructions( |
51 | - __( 'Please answer the following registration questions before proceeding.', 'event_espresso' ) |
|
51 | + __('Please answer the following registration questions before proceeding.', 'event_espresso') |
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | 57 | public function translate_js_strings() { |
58 | - EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' ); |
|
58 | + EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
|
59 | 59 | EE_Registry::$i18n_js_strings['required_multi_field'] = __( |
60 | 60 | ' is a required question. Please enter a value for at least one of the options.', |
61 | 61 | 'event_espresso' |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // calculate taxes |
116 | 116 | $Line_Item_Display->display_line_item( |
117 | 117 | $this->checkout->cart->get_grand_total(), |
118 | - array( 'set_tax_rate' => true ) |
|
118 | + array('set_tax_rate' => true) |
|
119 | 119 | ); |
120 | 120 | /** @var $subsections EE_Form_Section_Proper[] */ |
121 | 121 | $subsections = array( |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | 'ticket_count' => array() |
128 | 128 | ); |
129 | 129 | // grab the saved registrations from the transaction |
130 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
131 | - if ( $registrations ) { |
|
132 | - foreach ( $registrations as $registration ) { |
|
130 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
131 | + if ($registrations) { |
|
132 | + foreach ($registrations as $registration) { |
|
133 | 133 | // can this registration be processed during this visit ? |
134 | 134 | if ( |
135 | 135 | $registration instanceof EE_Registration |
136 | - && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
|
136 | + && $this->checkout->visit_allows_processing_of_this_registration($registration) |
|
137 | 137 | ) { |
138 | 138 | $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
139 | 139 | if ( ! $this->checkout->admin_request) { |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | // print_copy_info ? |
163 | - if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) { |
|
163 | + if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) { |
|
164 | 164 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
165 | 165 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info |
166 | 166 | ? $this->_copy_attendee_info_form() |
167 | 167 | : $this->_auto_copy_attendee_info(); |
168 | 168 | // generate hidden input |
169 | 169 | if ( |
170 | - isset( $subsections[ $primary_registrant ] ) |
|
171 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
170 | + isset($subsections[$primary_registrant]) |
|
171 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper |
|
172 | 172 | ) { |
173 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
173 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -182,8 +182,7 @@ discard block |
||
182 | 182 | 'html_id' => $this->reg_form_name(), |
183 | 183 | 'subsections' => $subsections, |
184 | 184 | 'layout_strategy' => $this->checkout->admin_request ? |
185 | - new EE_Div_Per_Section_Layout() : |
|
186 | - new EE_Template_Layout( |
|
185 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
187 | 186 | array( |
188 | 187 | 'layout_template_file' => $this->_template, // layout_template |
189 | 188 | 'template_args' => $template_args |
@@ -201,11 +200,11 @@ discard block |
||
201 | 200 | * @return EE_Form_Section_Base |
202 | 201 | * @throws \EE_Error |
203 | 202 | */ |
204 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
203 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
205 | 204 | static $attendee_nmbr = 1; |
206 | 205 | $form_args = array(); |
207 | 206 | // verify that registration has valid event |
208 | - if ( $registration->event() instanceof EE_Event ) { |
|
207 | + if ($registration->event() instanceof EE_Event) { |
|
209 | 208 | $question_groups = $registration->event()->question_groups( |
210 | 209 | array( |
211 | 210 | array( |
@@ -215,10 +214,10 @@ discard block |
||
215 | 214 | 'order_by' => array('QSG_order' => 'ASC') |
216 | 215 | ) |
217 | 216 | ); |
218 | - if ( $question_groups ) { |
|
217 | + if ($question_groups) { |
|
219 | 218 | // array of params to pass to parent constructor |
220 | 219 | $form_args = array( |
221 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
220 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
222 | 221 | 'html_class' => 'ee-reg-form-attendee-dv', |
223 | 222 | 'html_style' => $this->checkout->admin_request |
224 | 223 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
@@ -231,9 +230,9 @@ discard block |
||
231 | 230 | ) |
232 | 231 | ) |
233 | 232 | ); |
234 | - foreach ( $question_groups as $question_group ) { |
|
235 | - if ( $question_group instanceof EE_Question_Group ) { |
|
236 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
|
233 | + foreach ($question_groups as $question_group) { |
|
234 | + if ($question_group instanceof EE_Question_Group) { |
|
235 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form( |
|
237 | 236 | $registration, |
238 | 237 | $question_group |
239 | 238 | ); |
@@ -252,7 +251,7 @@ discard block |
||
252 | 251 | } |
253 | 252 | } |
254 | 253 | $attendee_nmbr++; |
255 | - return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : new EE_Form_Section_HTML(); |
|
254 | + return ! empty($form_args) ? new EE_Form_Section_Proper($form_args) : new EE_Form_Section_HTML(); |
|
256 | 255 | } |
257 | 256 | |
258 | 257 | |
@@ -273,7 +272,7 @@ discard block |
||
273 | 272 | // generate hidden input |
274 | 273 | return new EE_Hidden_Input( |
275 | 274 | array( |
276 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
275 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
277 | 276 | 'default' => $additional_attendee_reg_info |
278 | 277 | ) |
279 | 278 | ); |
@@ -287,26 +286,26 @@ discard block |
||
287 | 286 | * @return EE_Form_Section_Proper |
288 | 287 | * @throws \EE_Error |
289 | 288 | */ |
290 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
289 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
291 | 290 | // array of params to pass to parent constructor |
292 | 291 | $form_args = array( |
293 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
292 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
294 | 293 | 'html_class' => $this->checkout->admin_request |
295 | 294 | ? 'form-table ee-reg-form-qstn-grp-dv' |
296 | 295 | : 'ee-reg-form-qstn-grp-dv', |
297 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
296 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
298 | 297 | 'subsections' => array( |
299 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
298 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
300 | 299 | ), |
301 | 300 | 'layout_strategy' => $this->checkout->admin_request |
302 | 301 | ? new EE_Admin_Two_Column_Layout() |
303 | 302 | : new EE_Div_Per_Section_Layout() |
304 | 303 | ); |
305 | 304 | // where params |
306 | - $query_params = array( 'QST_deleted' => 0 ); |
|
305 | + $query_params = array('QST_deleted' => 0); |
|
307 | 306 | // don't load admin only questions on the frontend |
308 | - if ( ! $this->checkout->admin_request ) { |
|
309 | - $query_params['QST_admin_only'] = array( '!=', true ); |
|
307 | + if ( ! $this->checkout->admin_request) { |
|
308 | + $query_params['QST_admin_only'] = array('!=', true); |
|
310 | 309 | } |
311 | 310 | $questions = $question_group->get_many_related( |
312 | 311 | 'Question', |
@@ -328,10 +327,10 @@ discard block |
||
328 | 327 | ) |
329 | 328 | ); |
330 | 329 | // loop thru questions |
331 | - foreach ( $questions as $question ) { |
|
332 | - if( $question instanceof EE_Question ){ |
|
330 | + foreach ($questions as $question) { |
|
331 | + if ($question instanceof EE_Question) { |
|
333 | 332 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
334 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
333 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
335 | 334 | } |
336 | 335 | } |
337 | 336 | $form_args['subsections'] = apply_filters( |
@@ -352,7 +351,7 @@ discard block |
||
352 | 351 | ) |
353 | 352 | ); |
354 | 353 | // d( $form_args ); |
355 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
354 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
356 | 355 | return apply_filters( |
357 | 356 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
358 | 357 | $question_group_reg_form, |
@@ -369,11 +368,11 @@ discard block |
||
369 | 368 | * @param EE_Question_Group $question_group |
370 | 369 | * @return EE_Form_Section_HTML |
371 | 370 | */ |
372 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
371 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
373 | 372 | $html = ''; |
374 | 373 | // group_name |
375 | - if ( $question_group->show_group_name() && $question_group->name() !== '' ) { |
|
376 | - if ( $this->checkout->admin_request ) { |
|
374 | + if ($question_group->show_group_name() && $question_group->name() !== '') { |
|
375 | + if ($this->checkout->admin_request) { |
|
377 | 376 | $html .= EEH_HTML::br(); |
378 | 377 | $html .= EEH_HTML::h3( |
379 | 378 | $question_group->name(), |
@@ -387,7 +386,7 @@ discard block |
||
387 | 386 | } |
388 | 387 | } |
389 | 388 | // group_desc |
390 | - if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) { |
|
389 | + if ($question_group->show_group_desc() && $question_group->desc() !== '') { |
|
391 | 390 | $html .= EEH_HTML::p( |
392 | 391 | $question_group->desc(), |
393 | 392 | '', |
@@ -397,7 +396,7 @@ discard block |
||
397 | 396 | ); |
398 | 397 | |
399 | 398 | } |
400 | - return new EE_Form_Section_HTML( $html ); |
|
399 | + return new EE_Form_Section_HTML($html); |
|
401 | 400 | } |
402 | 401 | |
403 | 402 | |
@@ -407,7 +406,7 @@ discard block |
||
407 | 406 | * @return EE_Form_Section_Proper |
408 | 407 | * @throws \EE_Error |
409 | 408 | */ |
410 | - private function _copy_attendee_info_form(){ |
|
409 | + private function _copy_attendee_info_form() { |
|
411 | 410 | // array of params to pass to parent constructor |
412 | 411 | return new EE_Form_Section_Proper( |
413 | 412 | array( |
@@ -436,7 +435,7 @@ discard block |
||
436 | 435 | private function _auto_copy_attendee_info() { |
437 | 436 | return new EE_Form_Section_HTML( |
438 | 437 | EEH_Template::locate_template( |
439 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
438 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
440 | 439 | apply_filters( |
441 | 440 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', |
442 | 441 | array() |
@@ -460,32 +459,32 @@ discard block |
||
460 | 459 | $copy_attendee_info_inputs = array(); |
461 | 460 | $prev_ticket = NULL; |
462 | 461 | // grab the saved registrations from the transaction |
463 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
464 | - foreach ( $registrations as $registration ) { |
|
462 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
463 | + foreach ($registrations as $registration) { |
|
465 | 464 | // for all attendees other than the primary attendee |
466 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
465 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
467 | 466 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
468 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
467 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
469 | 468 | $item_name = $registration->ticket()->name(); |
470 | 469 | $item_name .= $registration->ticket()->description() !== '' |
471 | - ? ' - ' . $registration->ticket()->description() |
|
470 | + ? ' - '.$registration->ticket()->description() |
|
472 | 471 | : ''; |
473 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
474 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
472 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
473 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
475 | 474 | ); |
476 | 475 | $prev_ticket = $registration->ticket()->ID(); |
477 | 476 | } |
478 | 477 | |
479 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
478 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
480 | 479 | EE_Checkbox_Multi_Input( |
481 | 480 | array( |
482 | 481 | $registration->ID() => sprintf( |
483 | - __( 'Attendee #%s', 'event_espresso' ), |
|
482 | + __('Attendee #%s', 'event_espresso'), |
|
484 | 483 | $registration->count() |
485 | 484 | ) |
486 | 485 | ), |
487 | 486 | array( |
488 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
487 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
489 | 488 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
490 | 489 | 'display_html_label_text' => false |
491 | 490 | ) |
@@ -505,7 +504,7 @@ discard block |
||
505 | 504 | * @return EE_Form_Input_Base |
506 | 505 | * @throws \EE_Error |
507 | 506 | */ |
508 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
507 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
509 | 508 | // generate hidden input |
510 | 509 | return new EE_Hidden_Input( |
511 | 510 | array( |
@@ -524,7 +523,7 @@ discard block |
||
524 | 523 | * @return EE_Form_Input_Base |
525 | 524 | * @throws \EE_Error |
526 | 525 | */ |
527 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
526 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
528 | 527 | |
529 | 528 | // if this question was for an attendee detail, then check for that answer |
530 | 529 | $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( |
@@ -533,32 +532,32 @@ discard block |
||
533 | 532 | ); |
534 | 533 | $answer = $answer_value === null |
535 | 534 | ? EEM_Answer::instance()->get_one( |
536 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
535 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
537 | 536 | ) |
538 | 537 | : null; |
539 | 538 | // if NOT returning to edit an existing registration |
540 | 539 | // OR if this question is for an attendee property |
541 | 540 | // OR we still don't have an EE_Answer object |
542 | - if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) { |
|
541 | + if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { |
|
543 | 542 | // create an EE_Answer object for storing everything in |
544 | - $answer = EE_Answer::new_instance ( array( |
|
543 | + $answer = EE_Answer::new_instance(array( |
|
545 | 544 | 'QST_ID'=> $question->ID(), |
546 | 545 | 'REG_ID'=> $registration->ID() |
547 | 546 | )); |
548 | 547 | } |
549 | 548 | // verify instance |
550 | - if( $answer instanceof EE_Answer ){ |
|
551 | - if ( ! empty( $answer_value )) { |
|
552 | - $answer->set( 'ANS_value', $answer_value ); |
|
549 | + if ($answer instanceof EE_Answer) { |
|
550 | + if ( ! empty($answer_value)) { |
|
551 | + $answer->set('ANS_value', $answer_value); |
|
553 | 552 | } |
554 | - $answer->cache( 'Question', $question ); |
|
553 | + $answer->cache('Question', $question); |
|
555 | 554 | //remember system ID had a bug where sometimes it could be null |
556 | - $answer_cache_id =$question->is_system_question() |
|
557 | - ? $question->system_ID() . '-' . $registration->reg_url_link() |
|
558 | - : $question->ID() . '-' . $registration->reg_url_link(); |
|
559 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
555 | + $answer_cache_id = $question->is_system_question() |
|
556 | + ? $question->system_ID().'-'.$registration->reg_url_link() |
|
557 | + : $question->ID().'-'.$registration->reg_url_link(); |
|
558 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
560 | 559 | } |
561 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
560 | + return $this->_generate_question_input($registration, $question, $answer); |
|
562 | 561 | |
563 | 562 | } |
564 | 563 | |
@@ -571,46 +570,46 @@ discard block |
||
571 | 570 | * @return EE_Form_Input_Base |
572 | 571 | * @throws \EE_Error |
573 | 572 | */ |
574 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
573 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
575 | 574 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
576 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
575 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
577 | 576 | add_filter( |
578 | 577 | 'FHEE__EE_Question__generate_form_input__country_options', |
579 | - array( $this, 'use_cached_countries_for_form_input' ), |
|
578 | + array($this, 'use_cached_countries_for_form_input'), |
|
580 | 579 | 10, |
581 | 580 | 4 |
582 | 581 | ); |
583 | 582 | add_filter( |
584 | 583 | 'FHEE__EE_Question__generate_form_input__state_options', |
585 | - array( $this, 'use_cached_states_for_form_input' ), |
|
584 | + array($this, 'use_cached_states_for_form_input'), |
|
586 | 585 | 10, |
587 | 586 | 4 |
588 | 587 | ); |
589 | 588 | $input_constructor_args = array( |
590 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
591 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
592 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
593 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
589 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
590 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
591 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
592 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
594 | 593 | 'html_label_class' => 'ee-reg-qstn', |
595 | 594 | ); |
596 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
597 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
598 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
599 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
600 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
595 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
596 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
597 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
598 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
599 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
601 | 600 | } |
602 | - $form_input = $question->generate_form_input( |
|
601 | + $form_input = $question->generate_form_input( |
|
603 | 602 | $registration, |
604 | 603 | $answer, |
605 | 604 | $input_constructor_args |
606 | 605 | ); |
607 | 606 | remove_filter( |
608 | 607 | 'FHEE__EE_Question__generate_form_input__country_options', |
609 | - array( $this, 'use_cached_countries_for_form_input' ) |
|
608 | + array($this, 'use_cached_countries_for_form_input') |
|
610 | 609 | ); |
611 | 610 | remove_filter( |
612 | 611 | 'FHEE__EE_Question__generate_form_input__state_options', |
613 | - array( $this, 'use_cached_states_for_form_input' ) |
|
612 | + array($this, 'use_cached_states_for_form_input') |
|
614 | 613 | ); |
615 | 614 | return $form_input; |
616 | 615 | } |
@@ -632,22 +631,22 @@ discard block |
||
632 | 631 | \EE_Registration $registration = null, |
633 | 632 | \EE_Answer $answer = null |
634 | 633 | ) { |
635 | - $country_options = array( '' => '' ); |
|
634 | + $country_options = array('' => ''); |
|
636 | 635 | // get possibly cached list of countries |
637 | 636 | $countries = $this->checkout->action === 'process_reg_step' |
638 | 637 | ? EEM_Country::instance()->get_all_countries() |
639 | 638 | : EEM_Country::instance()->get_all_active_countries(); |
640 | - if ( ! empty( $countries )) { |
|
641 | - foreach( $countries as $country ){ |
|
642 | - if ( $country instanceof EE_Country ) { |
|
643 | - $country_options[ $country->ID() ] = $country->name(); |
|
639 | + if ( ! empty($countries)) { |
|
640 | + foreach ($countries as $country) { |
|
641 | + if ($country instanceof EE_Country) { |
|
642 | + $country_options[$country->ID()] = $country->name(); |
|
644 | 643 | } |
645 | 644 | } |
646 | 645 | } |
647 | - if( $question instanceof EE_Question |
|
648 | - && $registration instanceof EE_Registration ) { |
|
646 | + if ($question instanceof EE_Question |
|
647 | + && $registration instanceof EE_Registration) { |
|
649 | 648 | $answer = EEM_Answer::instance()->get_one( |
650 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
649 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
651 | 650 | ); |
652 | 651 | } else { |
653 | 652 | $answer = EE_Answer::new_instance(); |
@@ -680,14 +679,14 @@ discard block |
||
680 | 679 | \EE_Registration $registration = null, |
681 | 680 | \EE_Answer $answer = null |
682 | 681 | ) { |
683 | - $state_options = array( '' => array( '' => '')); |
|
682 | + $state_options = array('' => array('' => '')); |
|
684 | 683 | $states = $this->checkout->action === 'process_reg_step' |
685 | 684 | ? EEM_State::instance()->get_all_states() |
686 | 685 | : EEM_State::instance()->get_all_active_states(); |
687 | - if ( ! empty( $states )) { |
|
688 | - foreach( $states as $state ){ |
|
689 | - if ( $state instanceof EE_State ) { |
|
690 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
686 | + if ( ! empty($states)) { |
|
687 | + foreach ($states as $state) { |
|
688 | + if ($state instanceof EE_State) { |
|
689 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
691 | 690 | } |
692 | 691 | } |
693 | 692 | } |
@@ -715,24 +714,24 @@ discard block |
||
715 | 714 | * @throws \EE_Error |
716 | 715 | */ |
717 | 716 | public function process_reg_step() { |
718 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
717 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
719 | 718 | // grab validated data from form |
720 | 719 | $valid_data = $this->checkout->current_step->valid_data(); |
721 | 720 | // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
722 | 721 | // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
723 | 722 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
724 | - if ( empty( $valid_data )) { |
|
723 | + if (empty($valid_data)) { |
|
725 | 724 | EE_Error::add_error( |
726 | - __( 'No valid question responses were received.', 'event_espresso' ), |
|
725 | + __('No valid question responses were received.', 'event_espresso'), |
|
727 | 726 | __FILE__, |
728 | 727 | __FUNCTION__, |
729 | 728 | __LINE__ |
730 | 729 | ); |
731 | 730 | return false; |
732 | 731 | } |
733 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
732 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
734 | 733 | EE_Error::add_error( |
735 | - __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), |
|
734 | + __('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), |
|
736 | 735 | __FILE__, |
737 | 736 | __FUNCTION__, |
738 | 737 | __LINE__ |
@@ -740,14 +739,14 @@ discard block |
||
740 | 739 | return false; |
741 | 740 | } |
742 | 741 | // get cached registrations |
743 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
742 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
744 | 743 | // verify we got the goods |
745 | - if ( empty( $registrations )) { |
|
744 | + if (empty($registrations)) { |
|
746 | 745 | //combine the old translated string with a new one, in order to not break translations |
747 | - $error_message = esc_html__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ) |
|
746 | + $error_message = esc_html__('Your form data could not be applied to any valid registrations.', 'event_espresso') |
|
748 | 747 | . sprintf( |
749 | 748 | esc_html__('%3$sThis can sometimes happen if too much time has been taken to complete the registration process.%3$sPlease return to the %1$sEvent List%2$s and reselect your tickets. If the problem continues, please contact the site administrator.', 'event_espresso'), |
750 | - '<a href="' . get_post_type_archive_link('espresso_events') . '" >', |
|
749 | + '<a href="'.get_post_type_archive_link('espresso_events').'" >', |
|
751 | 750 | '</a>', |
752 | 751 | '<br />' |
753 | 752 | ); |
@@ -760,15 +759,15 @@ discard block |
||
760 | 759 | return false; |
761 | 760 | } |
762 | 761 | // extract attendee info from form data and save to model objects |
763 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
762 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
764 | 763 | // if first pass thru SPCO, |
765 | 764 | // then let's check processed registrations against the total number of tickets in the cart |
766 | - if ( $registrations_processed === false ) { |
|
765 | + if ($registrations_processed === false) { |
|
767 | 766 | // but return immediately if the previous step exited early due to errors |
768 | 767 | return false; |
769 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
768 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
770 | 769 | // generate a correctly translated string for all possible singular/plural combinations |
771 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
770 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
772 | 771 | $error_msg = sprintf( |
773 | 772 | __( |
774 | 773 | 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', |
@@ -777,7 +776,7 @@ discard block |
||
777 | 776 | $this->checkout->total_ticket_count, |
778 | 777 | $registrations_processed |
779 | 778 | ); |
780 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
779 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
781 | 780 | $error_msg = sprintf( |
782 | 781 | __( |
783 | 782 | 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', |
@@ -796,17 +795,17 @@ discard block |
||
796 | 795 | $registrations_processed |
797 | 796 | ); |
798 | 797 | } |
799 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
798 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
800 | 799 | return false; |
801 | 800 | } |
802 | 801 | // mark this reg step as completed |
803 | 802 | $this->set_completed(); |
804 | 803 | $this->_set_success_message( |
805 | - __( 'The Attendee Information Step has been successfully completed.', 'event_espresso' ) |
|
804 | + __('The Attendee Information Step has been successfully completed.', 'event_espresso') |
|
806 | 805 | ); |
807 | 806 | //do action in case a plugin wants to do something with the data submitted in step 1. |
808 | 807 | //passes EE_Single_Page_Checkout, and it's posted data |
809 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
808 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
810 | 809 | return true; |
811 | 810 | } |
812 | 811 | |
@@ -820,9 +819,9 @@ discard block |
||
820 | 819 | * @return boolean | int |
821 | 820 | * @throws \EE_Error |
822 | 821 | */ |
823 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
822 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
824 | 823 | // load resources and set some defaults |
825 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
824 | + EE_Registry::instance()->load_model('Attendee'); |
|
826 | 825 | // holder for primary registrant attendee object |
827 | 826 | $this->checkout->primary_attendee_obj = NULL; |
828 | 827 | // array for tracking reg form data for the primary registrant |
@@ -839,9 +838,9 @@ discard block |
||
839 | 838 | // attendee counter |
840 | 839 | $att_nmbr = 0; |
841 | 840 | // grab the saved registrations from the transaction |
842 | - foreach ( $registrations as $registration ) { |
|
841 | + foreach ($registrations as $registration) { |
|
843 | 842 | // verify EE_Registration object |
844 | - if ( ! $registration instanceof EE_Registration ) { |
|
843 | + if ( ! $registration instanceof EE_Registration) { |
|
845 | 844 | EE_Error::add_error( |
846 | 845 | __( |
847 | 846 | 'An invalid Registration object was discovered when attempting to process your registration information.', |
@@ -856,12 +855,12 @@ discard block |
||
856 | 855 | /** @var string $reg_url_link */ |
857 | 856 | $reg_url_link = $registration->reg_url_link(); |
858 | 857 | // reg_url_link exists ? |
859 | - if ( ! empty( $reg_url_link ) ) { |
|
858 | + if ( ! empty($reg_url_link)) { |
|
860 | 859 | // should this registration be processed during this visit ? |
861 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
860 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
862 | 861 | // if NOT revisiting, then let's save the registration now, |
863 | 862 | // so that we have a REG_ID to use when generating other objects |
864 | - if ( ! $this->checkout->revisit ) { |
|
863 | + if ( ! $this->checkout->revisit) { |
|
865 | 864 | $registration->save(); |
866 | 865 | } |
867 | 866 | /** |
@@ -871,7 +870,7 @@ discard block |
||
871 | 870 | * @var bool if true is returned by the plugin then the |
872 | 871 | * registration processing is halted. |
873 | 872 | */ |
874 | - if ( apply_filters( |
|
873 | + if (apply_filters( |
|
875 | 874 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', |
876 | 875 | false, |
877 | 876 | $att_nmbr, |
@@ -879,38 +878,38 @@ discard block |
||
879 | 878 | $registrations, |
880 | 879 | $valid_data, |
881 | 880 | $this |
882 | - ) ) { |
|
881 | + )) { |
|
883 | 882 | return false; |
884 | 883 | } |
885 | 884 | |
886 | 885 | // Houston, we have a registration! |
887 | 886 | $att_nmbr++; |
888 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
887 | + $this->_attendee_data[$reg_url_link] = array(); |
|
889 | 888 | // grab any existing related answer objects |
890 | 889 | $this->_registration_answers = $registration->answers(); |
891 | 890 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
892 | - if ( isset( $valid_data[ $reg_url_link ] ) ) { |
|
891 | + if (isset($valid_data[$reg_url_link])) { |
|
893 | 892 | // do we need to copy basic info from primary attendee ? |
894 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
|
895 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
893 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) |
|
894 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 |
|
896 | 895 | ? true |
897 | 896 | : false; |
898 | 897 | // filter form input data for this registration |
899 | - $valid_data[ $reg_url_link ] = (array)apply_filters( |
|
898 | + $valid_data[$reg_url_link] = (array) apply_filters( |
|
900 | 899 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
901 | - $valid_data[ $reg_url_link ] |
|
900 | + $valid_data[$reg_url_link] |
|
902 | 901 | ); |
903 | 902 | // EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
904 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
905 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) |
|
903 | + if (isset($valid_data['primary_attendee'])) { |
|
904 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) |
|
906 | 905 | ? $valid_data['primary_attendee'] |
907 | 906 | : false; |
908 | - unset( $valid_data['primary_attendee'] ); |
|
907 | + unset($valid_data['primary_attendee']); |
|
909 | 908 | } |
910 | 909 | // now loop through our array of valid post data && process attendee reg forms |
911 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
912 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
913 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
910 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
911 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
912 | + foreach ($form_inputs as $form_input => $input_value) { |
|
914 | 913 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ ); |
915 | 914 | // check for critical inputs |
916 | 915 | if ( |
@@ -924,16 +923,16 @@ discard block |
||
924 | 923 | // store a bit of data about the primary attendee |
925 | 924 | if ( |
926 | 925 | $att_nmbr === 1 |
927 | - && ! empty( $input_value ) |
|
926 | + && ! empty($input_value) |
|
928 | 927 | && $reg_url_link === $primary_registrant['line_item_id'] |
929 | 928 | ) { |
930 | - $primary_registrant[ $form_input ] = $input_value; |
|
929 | + $primary_registrant[$form_input] = $input_value; |
|
931 | 930 | } else if ( |
932 | 931 | $copy_primary |
933 | 932 | && $input_value === null |
934 | - && isset( $primary_registrant[ $form_input ] ) |
|
933 | + && isset($primary_registrant[$form_input]) |
|
935 | 934 | ) { |
936 | - $input_value = $primary_registrant[ $form_input ]; |
|
935 | + $input_value = $primary_registrant[$form_input]; |
|
937 | 936 | } |
938 | 937 | // now attempt to save the input data |
939 | 938 | if ( |
@@ -975,55 +974,55 @@ discard block |
||
975 | 974 | // have we met before? |
976 | 975 | $attendee = $this->_find_existing_attendee( |
977 | 976 | $registration, |
978 | - $this->_attendee_data[ $reg_url_link ] |
|
977 | + $this->_attendee_data[$reg_url_link] |
|
979 | 978 | ); |
980 | 979 | // did we find an already existing record for this attendee ? |
981 | - if ( $attendee instanceof EE_Attendee ) { |
|
980 | + if ($attendee instanceof EE_Attendee) { |
|
982 | 981 | $attendee = $this->_update_existing_attendee_data( |
983 | 982 | $attendee, |
984 | - $this->_attendee_data[ $reg_url_link ] |
|
983 | + $this->_attendee_data[$reg_url_link] |
|
985 | 984 | ); |
986 | 985 | } else { |
987 | 986 | // ensure critical details are set for additional attendees |
988 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 |
|
987 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 |
|
989 | 988 | ? $this->_copy_critical_attendee_details_from_primary_registrant( |
990 | - $this->_attendee_data[ $reg_url_link ] |
|
989 | + $this->_attendee_data[$reg_url_link] |
|
991 | 990 | ) |
992 | - : $this->_attendee_data[ $reg_url_link ]; |
|
991 | + : $this->_attendee_data[$reg_url_link]; |
|
993 | 992 | $attendee = $this->_create_new_attendee( |
994 | 993 | $registration, |
995 | - $this->_attendee_data[ $reg_url_link ] |
|
994 | + $this->_attendee_data[$reg_url_link] |
|
996 | 995 | ); |
997 | 996 | } |
998 | 997 | // who's #1 ? |
999 | - if ( $att_nmbr === 1 ) { |
|
998 | + if ($att_nmbr === 1) { |
|
1000 | 999 | $this->checkout->primary_attendee_obj = $attendee; |
1001 | 1000 | } |
1002 | 1001 | } |
1003 | 1002 | // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
1004 | 1003 | // add relation to registration, set attendee ID, and cache attendee |
1005 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
1004 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
1006 | 1005 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ ); |
1007 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
1008 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1006 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
1007 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
1009 | 1008 | return false; |
1010 | 1009 | } |
1011 | 1010 | /** @type EE_Registration_Processor $registration_processor */ |
1012 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1011 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1013 | 1012 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1014 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
1013 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, false); |
|
1015 | 1014 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1016 | 1015 | $this->checkout->transaction->toggle_failed_transaction_status(); |
1017 | 1016 | // if we've gotten this far, then let's save what we have |
1018 | 1017 | $registration->save(); |
1019 | 1018 | // add relation between TXN and registration |
1020 | - $this->_associate_registration_with_transaction( $registration ); |
|
1019 | + $this->_associate_registration_with_transaction($registration); |
|
1021 | 1020 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
1022 | 1021 | |
1023 | - } else { |
|
1024 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1022 | + } else { |
|
1023 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1025 | 1024 | // remove malformed data |
1026 | - unset( $valid_data[ $reg_url_link ] ); |
|
1025 | + unset($valid_data[$reg_url_link]); |
|
1027 | 1026 | return false; |
1028 | 1027 | } |
1029 | 1028 | |
@@ -1052,14 +1051,14 @@ discard block |
||
1052 | 1051 | // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
1053 | 1052 | // allow for plugins to hook in and do their own processing of the form input. |
1054 | 1053 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
1055 | - if ( apply_filters( |
|
1054 | + if (apply_filters( |
|
1056 | 1055 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', |
1057 | 1056 | false, |
1058 | 1057 | $registration, |
1059 | 1058 | $form_input, |
1060 | 1059 | $input_value, |
1061 | 1060 | $this |
1062 | - ) ) { |
|
1061 | + )) { |
|
1063 | 1062 | return true; |
1064 | 1063 | } |
1065 | 1064 | /* |
@@ -1067,14 +1066,14 @@ discard block |
||
1067 | 1066 | * @see https://events.codebasehq.com/projects/event-espresso/tickets/10477 |
1068 | 1067 | */ |
1069 | 1068 | $answer_cache_id = $this->checkout->reg_url_link |
1070 | - ? $form_input . '-' . $registration->reg_url_link() |
|
1069 | + ? $form_input.'-'.$registration->reg_url_link() |
|
1071 | 1070 | : $form_input; |
1072 | - $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
|
1073 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1071 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id]) |
|
1072 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer |
|
1074 | 1073 | ? true |
1075 | 1074 | : false; |
1076 | 1075 | //rename form_inputs if they are EE_Attendee properties |
1077 | - switch( (string)$form_input ) { |
|
1076 | + switch ((string) $form_input) { |
|
1078 | 1077 | |
1079 | 1078 | case 'state' : |
1080 | 1079 | case 'STA_ID' : |
@@ -1089,32 +1088,32 @@ discard block |
||
1089 | 1088 | break; |
1090 | 1089 | |
1091 | 1090 | default : |
1092 | - $ATT_input = 'ATT_' . $form_input; |
|
1091 | + $ATT_input = 'ATT_'.$form_input; |
|
1093 | 1092 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
1094 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false; |
|
1095 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
1093 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false; |
|
1094 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
1096 | 1095 | } |
1097 | 1096 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
1098 | 1097 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
1099 | 1098 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
1100 | 1099 | // if this form input has a corresponding attendee property |
1101 | - if ( $attendee_property ) { |
|
1102 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
1103 | - if ( $answer_is_obj ) { |
|
1100 | + if ($attendee_property) { |
|
1101 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
1102 | + if ($answer_is_obj) { |
|
1104 | 1103 | // and delete the corresponding answer since we won't be storing this data in that object |
1105 | - $registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' ); |
|
1106 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently(); |
|
1104 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer'); |
|
1105 | + $this->_registration_answers[$answer_cache_id]->delete_permanently(); |
|
1107 | 1106 | } |
1108 | 1107 | return true; |
1109 | - } elseif ( $answer_is_obj ) { |
|
1108 | + } elseif ($answer_is_obj) { |
|
1110 | 1109 | // save this data to the answer object |
1111 | - $this->_registration_answers[ $answer_cache_id ]->set_value( $input_value ); |
|
1112 | - $result = $this->_registration_answers[ $answer_cache_id ]->save(); |
|
1110 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value); |
|
1111 | + $result = $this->_registration_answers[$answer_cache_id]->save(); |
|
1113 | 1112 | return $result !== false ? true : false; |
1114 | 1113 | } else { |
1115 | - foreach ( $this->_registration_answers as $answer ) { |
|
1116 | - if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) { |
|
1117 | - $answer->set_value( $input_value ); |
|
1114 | + foreach ($this->_registration_answers as $answer) { |
|
1115 | + if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { |
|
1116 | + $answer->set_value($input_value); |
|
1118 | 1117 | $result = $answer->save(); |
1119 | 1118 | return $result !== false ? true : false; |
1120 | 1119 | } |
@@ -1136,15 +1135,15 @@ discard block |
||
1136 | 1135 | $form_input = '', |
1137 | 1136 | $input_value = '' |
1138 | 1137 | ) { |
1139 | - if ( empty( $input_value ) ) { |
|
1138 | + if (empty($input_value)) { |
|
1140 | 1139 | // if the form input isn't marked as being required, then just return |
1141 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
1140 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
1142 | 1141 | return true; |
1143 | 1142 | } |
1144 | - switch ( $form_input ) { |
|
1143 | + switch ($form_input) { |
|
1145 | 1144 | case 'fname' : |
1146 | 1145 | EE_Error::add_error( |
1147 | - __( 'First Name is a required value.', 'event_espresso' ), |
|
1146 | + __('First Name is a required value.', 'event_espresso'), |
|
1148 | 1147 | __FILE__, |
1149 | 1148 | __FUNCTION__, |
1150 | 1149 | __LINE__ |
@@ -1153,7 +1152,7 @@ discard block |
||
1153 | 1152 | break; |
1154 | 1153 | case 'lname' : |
1155 | 1154 | EE_Error::add_error( |
1156 | - __( 'Last Name is a required value.', 'event_espresso' ), |
|
1155 | + __('Last Name is a required value.', 'event_espresso'), |
|
1157 | 1156 | __FILE__, |
1158 | 1157 | __FUNCTION__, |
1159 | 1158 | __LINE__ |
@@ -1162,7 +1161,7 @@ discard block |
||
1162 | 1161 | break; |
1163 | 1162 | case 'email' : |
1164 | 1163 | EE_Error::add_error( |
1165 | - __( 'Please enter a valid email address.', 'event_espresso' ), |
|
1164 | + __('Please enter a valid email address.', 'event_espresso'), |
|
1166 | 1165 | __FILE__, |
1167 | 1166 | __FUNCTION__, |
1168 | 1167 | __LINE__ |
@@ -1184,30 +1183,30 @@ discard block |
||
1184 | 1183 | * @return boolean|EE_Attendee |
1185 | 1184 | * @throws \EE_Error |
1186 | 1185 | */ |
1187 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1186 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1188 | 1187 | $existing_attendee = null; |
1189 | 1188 | // if none of the critical properties are set in the incoming attendee data... |
1190 | 1189 | // then attempt to copy them from the primary attendee |
1191 | 1190 | if ( |
1192 | 1191 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1193 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1192 | + && ! isset($attendee_data['ATT_fname'], $attendee_data['ATT_email']) |
|
1194 | 1193 | ) { |
1195 | 1194 | return $this->checkout->primary_attendee_obj; |
1196 | 1195 | } |
1197 | 1196 | // does this attendee already exist in the db ? |
1198 | 1197 | // we're searching using a combination of first name, last name, AND email address |
1199 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) |
|
1198 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) |
|
1200 | 1199 | ? $attendee_data['ATT_fname'] |
1201 | 1200 | : ''; |
1202 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) |
|
1201 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) |
|
1203 | 1202 | ? $attendee_data['ATT_lname'] |
1204 | 1203 | : ''; |
1205 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) |
|
1204 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) |
|
1206 | 1205 | ? $attendee_data['ATT_email'] |
1207 | 1206 | : ''; |
1208 | 1207 | // but only if those have values |
1209 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
1210 | - $existing_attendee = EEM_Attendee::instance()->find_existing_attendee( array( |
|
1208 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
1209 | + $existing_attendee = EEM_Attendee::instance()->find_existing_attendee(array( |
|
1211 | 1210 | 'ATT_fname' => $ATT_fname, |
1212 | 1211 | 'ATT_lname' => $ATT_lname, |
1213 | 1212 | 'ATT_email' => $ATT_email |
@@ -1231,13 +1230,13 @@ discard block |
||
1231 | 1230 | * @return \EE_Attendee |
1232 | 1231 | * @throws \EE_Error |
1233 | 1232 | */ |
1234 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
1233 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
1235 | 1234 | // first remove fname, lname, and email from attendee data |
1236 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1235 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1237 | 1236 | // now loop thru what's left and add to attendee CPT |
1238 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1239 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1240 | - $existing_attendee->set( $property_name, $property_value ); |
|
1237 | + foreach ($attendee_data as $property_name => $property_value) { |
|
1238 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1239 | + $existing_attendee->set($property_name, $property_value); |
|
1241 | 1240 | } |
1242 | 1241 | } |
1243 | 1242 | // better save that now |
@@ -1255,11 +1254,11 @@ discard block |
||
1255 | 1254 | * @return void |
1256 | 1255 | * @throws \EE_Error |
1257 | 1256 | */ |
1258 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1257 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1259 | 1258 | // add relation to attendee |
1260 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1261 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1262 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1259 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1260 | + $registration->set_attendee_id($attendee->ID()); |
|
1261 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1263 | 1262 | } |
1264 | 1263 | |
1265 | 1264 | |
@@ -1271,10 +1270,10 @@ discard block |
||
1271 | 1270 | * @return void |
1272 | 1271 | * @throws \EE_Error |
1273 | 1272 | */ |
1274 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1273 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1275 | 1274 | // add relation to attendee |
1276 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1277 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1275 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1276 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1278 | 1277 | } |
1279 | 1278 | |
1280 | 1279 | |
@@ -1287,14 +1286,14 @@ discard block |
||
1287 | 1286 | * @return array |
1288 | 1287 | * @throws \EE_Error |
1289 | 1288 | */ |
1290 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1289 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1291 | 1290 | // bare minimum critical details include first name, last name, email address |
1292 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1291 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1293 | 1292 | // add address info to critical details? |
1294 | - if ( apply_filters( |
|
1293 | + if (apply_filters( |
|
1295 | 1294 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', |
1296 | 1295 | false |
1297 | - ) ) { |
|
1296 | + )) { |
|
1298 | 1297 | $address_details = array( |
1299 | 1298 | 'ATT_address', |
1300 | 1299 | 'ATT_address2', |
@@ -1304,13 +1303,13 @@ discard block |
||
1304 | 1303 | 'ATT_zip', |
1305 | 1304 | 'ATT_phone' |
1306 | 1305 | ); |
1307 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1306 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1308 | 1307 | } |
1309 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1310 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
|
1311 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1308 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1309 | + if ( ! isset($attendee_data[$critical_attendee_detail]) |
|
1310 | + || empty($attendee_data[$critical_attendee_detail]) |
|
1312 | 1311 | ) { |
1313 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
|
1312 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get( |
|
1314 | 1313 | $critical_attendee_detail |
1315 | 1314 | ); |
1316 | 1315 | } |
@@ -1328,11 +1327,11 @@ discard block |
||
1328 | 1327 | * @return \EE_Attendee |
1329 | 1328 | * @throws \EE_Error |
1330 | 1329 | */ |
1331 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1330 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1332 | 1331 | // create new attendee object |
1333 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1332 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1334 | 1333 | // set author to event creator |
1335 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1334 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1336 | 1335 | $new_attendee->save(); |
1337 | 1336 | return $new_attendee; |
1338 | 1337 | } |
@@ -1349,7 +1348,7 @@ discard block |
||
1349 | 1348 | */ |
1350 | 1349 | public function update_reg_step() { |
1351 | 1350 | // save everything |
1352 | - if ( $this->process_reg_step() ) { |
|
1351 | + if ($this->process_reg_step()) { |
|
1353 | 1352 | $this->checkout->redirect = true; |
1354 | 1353 | $this->checkout->redirect_url = add_query_arg( |
1355 | 1354 | array( |
@@ -1358,7 +1357,7 @@ discard block |
||
1358 | 1357 | ), |
1359 | 1358 | $this->checkout->thank_you_page_url |
1360 | 1359 | ); |
1361 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1360 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1362 | 1361 | return true; |
1363 | 1362 | } |
1364 | 1363 | return false; |