@@ -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,33 +135,33 @@ discard block |
||
| 135 | 135 | $registration instanceof EE_Registration |
| 136 | 136 | && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
| 137 | 137 | ) { |
| 138 | - $attendee_reg_form = $this->_registrations_reg_form($registration); |
|
| 139 | - if ($attendee_reg_form instanceof EE_Form_Section_Proper) { |
|
| 140 | - $subsections[$registration->reg_url_link()] = $attendee_reg_form; |
|
| 141 | - if ( ! $this->checkout->admin_request) { |
|
| 142 | - $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
| 143 | - $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
| 144 | - $template_args['ticket_count'][$registration->ticket()->ID()] |
|
| 145 | - ) |
|
| 146 | - ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
| 147 | - : 1; |
|
| 148 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
| 149 | - $this->checkout->cart->get_grand_total(), |
|
| 150 | - 'Ticket', |
|
| 151 | - array($registration->ticket()->ID()) |
|
| 152 | - ); |
|
| 153 | - $ticket_line_item = is_array($ticket_line_item) |
|
| 154 | - ? reset($ticket_line_item) |
|
| 155 | - : $ticket_line_item; |
|
| 156 | - $template_args['ticket_line_item'][$registration->ticket() |
|
| 157 | - ->ID()] = $Line_Item_Display->display_line_item( |
|
| 158 | - $ticket_line_item |
|
| 159 | - ); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - if ($registration->is_primary_registrant()) { |
|
| 163 | - $primary_registrant = $registration->reg_url_link(); |
|
| 164 | - } |
|
| 138 | + $attendee_reg_form = $this->_registrations_reg_form($registration); |
|
| 139 | + if ($attendee_reg_form instanceof EE_Form_Section_Proper) { |
|
| 140 | + $subsections[$registration->reg_url_link()] = $attendee_reg_form; |
|
| 141 | + if ( ! $this->checkout->admin_request) { |
|
| 142 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
| 143 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
| 144 | + $template_args['ticket_count'][$registration->ticket()->ID()] |
|
| 145 | + ) |
|
| 146 | + ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
| 147 | + : 1; |
|
| 148 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
| 149 | + $this->checkout->cart->get_grand_total(), |
|
| 150 | + 'Ticket', |
|
| 151 | + array($registration->ticket()->ID()) |
|
| 152 | + ); |
|
| 153 | + $ticket_line_item = is_array($ticket_line_item) |
|
| 154 | + ? reset($ticket_line_item) |
|
| 155 | + : $ticket_line_item; |
|
| 156 | + $template_args['ticket_line_item'][$registration->ticket() |
|
| 157 | + ->ID()] = $Line_Item_Display->display_line_item( |
|
| 158 | + $ticket_line_item |
|
| 159 | + ); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + if ($registration->is_primary_registrant()) { |
|
| 163 | + $primary_registrant = $registration->reg_url_link(); |
|
| 164 | + } |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | // print_copy_info ? |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // generate hidden input |
| 174 | 174 | if ( |
| 175 | 175 | isset( $subsections[ $primary_registrant ] ) |
| 176 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
| 176 | + && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
| 177 | 177 | ) { |
| 178 | 178 | $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
| 179 | 179 | } |
@@ -208,35 +208,35 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | private function _registrations_reg_form( EE_Registration $registration ) { |
| 210 | 210 | static $attendee_nmbr = 1; |
| 211 | - $form_args = array(); |
|
| 211 | + $form_args = array(); |
|
| 212 | 212 | // verify that registration has valid event |
| 213 | 213 | if ( $registration->event() instanceof EE_Event ) { |
| 214 | 214 | $question_groups = $registration->event()->question_groups( |
| 215 | - array( |
|
| 216 | - array( |
|
| 217 | - 'Event.EVT_ID' => $registration->event()->ID(), |
|
| 218 | - 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
| 219 | - ), |
|
| 220 | - 'order_by' => array('QSG_order' => 'ASC') |
|
| 221 | - ) |
|
| 222 | - ); |
|
| 215 | + array( |
|
| 216 | + array( |
|
| 217 | + 'Event.EVT_ID' => $registration->event()->ID(), |
|
| 218 | + 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
| 219 | + ), |
|
| 220 | + 'order_by' => array('QSG_order' => 'ASC') |
|
| 221 | + ) |
|
| 222 | + ); |
|
| 223 | 223 | if ( $question_groups ) { |
| 224 | - // array of params to pass to parent constructor |
|
| 225 | - $form_args = array( |
|
| 226 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
| 227 | - 'html_class' => 'ee-reg-form-attendee-dv', |
|
| 228 | - 'html_style' => $this->checkout->admin_request |
|
| 229 | - ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
| 230 | - : '', |
|
| 231 | - 'subsections' => array(), |
|
| 232 | - 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
| 233 | - array( |
|
| 234 | - 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
| 235 | - 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
| 236 | - ) |
|
| 237 | - ) |
|
| 238 | - ); |
|
| 239 | - foreach ( $question_groups as $question_group ) { |
|
| 224 | + // array of params to pass to parent constructor |
|
| 225 | + $form_args = array( |
|
| 226 | + 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
| 227 | + 'html_class' => 'ee-reg-form-attendee-dv', |
|
| 228 | + 'html_style' => $this->checkout->admin_request |
|
| 229 | + ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
| 230 | + : '', |
|
| 231 | + 'subsections' => array(), |
|
| 232 | + 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
| 233 | + array( |
|
| 234 | + 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
| 235 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
| 236 | + ) |
|
| 237 | + ) |
|
| 238 | + ); |
|
| 239 | + foreach ( $question_groups as $question_group ) { |
|
| 240 | 240 | if ( $question_group instanceof EE_Question_Group ) { |
| 241 | 241 | $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
| 242 | 242 | $registration, |
@@ -244,19 +244,19 @@ discard block |
||
| 244 | 244 | ); |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | - // add hidden input |
|
| 248 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
| 249 | - $registration |
|
| 250 | - ); |
|
| 251 | - // if we have question groups for additional attendees, then display the copy options |
|
| 247 | + // add hidden input |
|
| 248 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
| 249 | + $registration |
|
| 250 | + ); |
|
| 251 | + // if we have question groups for additional attendees, then display the copy options |
|
| 252 | 252 | $this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info; |
| 253 | - if ($registration->is_primary_registrant()) { |
|
| 254 | - // generate hidden input |
|
| 255 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
| 256 | - } |
|
| 257 | - } |
|
| 253 | + if ($registration->is_primary_registrant()) { |
|
| 254 | + // generate hidden input |
|
| 255 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | 258 | } |
| 259 | - $attendee_nmbr++; |
|
| 259 | + $attendee_nmbr++; |
|
| 260 | 260 | return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : null; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | if ( isset( $valid_data[ $reg_url_link ] ) ) { |
| 890 | 890 | // do we need to copy basic info from primary attendee ? |
| 891 | 891 | $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
| 892 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
| 892 | + && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
| 893 | 893 | ? true |
| 894 | 894 | : false; |
| 895 | 895 | // filter form input data for this registration |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | ? $form_input |
| 1065 | 1065 | : $form_input . '-' . $registration->reg_url_link(); |
| 1066 | 1066 | $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
| 1067 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
| 1067 | + && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
| 1068 | 1068 | ? true |
| 1069 | 1069 | : false; |
| 1070 | 1070 | //rename form_inputs if they are EE_Attendee properties |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | // then attempt to copy them from the primary attendee |
| 1185 | 1185 | if ( |
| 1186 | 1186 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
| 1187 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
| 1187 | + && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
| 1188 | 1188 | ) { |
| 1189 | 1189 | return $this->checkout->primary_attendee_obj; |
| 1190 | 1190 | } |
@@ -1302,7 +1302,7 @@ discard block |
||
| 1302 | 1302 | } |
| 1303 | 1303 | foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
| 1304 | 1304 | if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
| 1305 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
| 1305 | + || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
| 1306 | 1306 | ) { |
| 1307 | 1307 | $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
| 1308 | 1308 | $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 | $attendee_reg_form = $this->_registrations_reg_form($registration); |
| 139 | 139 | if ($attendee_reg_form instanceof EE_Form_Section_Proper) { |
@@ -165,17 +165,17 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | // print_copy_info ? |
| 168 | - if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) { |
|
| 168 | + if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) { |
|
| 169 | 169 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
| 170 | 170 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info |
| 171 | 171 | ? $this->_copy_attendee_info_form() |
| 172 | 172 | : $this->_auto_copy_attendee_info(); |
| 173 | 173 | // generate hidden input |
| 174 | 174 | if ( |
| 175 | - isset( $subsections[ $primary_registrant ] ) |
|
| 176 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
| 175 | + isset($subsections[$primary_registrant]) |
|
| 176 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper |
|
| 177 | 177 | ) { |
| 178 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
| 178 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
@@ -187,8 +187,7 @@ discard block |
||
| 187 | 187 | 'html_id' => $this->reg_form_name(), |
| 188 | 188 | 'subsections' => $subsections, |
| 189 | 189 | 'layout_strategy' => $this->checkout->admin_request ? |
| 190 | - new EE_Div_Per_Section_Layout() : |
|
| 191 | - new EE_Template_Layout( |
|
| 190 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
| 192 | 191 | array( |
| 193 | 192 | 'layout_template_file' => $this->_template, // layout_template |
| 194 | 193 | 'template_args' => $template_args |
@@ -206,11 +205,11 @@ discard block |
||
| 206 | 205 | * @return EE_Form_Section_Proper |
| 207 | 206 | * @throws \EE_Error |
| 208 | 207 | */ |
| 209 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
| 208 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
| 210 | 209 | static $attendee_nmbr = 1; |
| 211 | 210 | $form_args = array(); |
| 212 | 211 | // verify that registration has valid event |
| 213 | - if ( $registration->event() instanceof EE_Event ) { |
|
| 212 | + if ($registration->event() instanceof EE_Event) { |
|
| 214 | 213 | $question_groups = $registration->event()->question_groups( |
| 215 | 214 | array( |
| 216 | 215 | array( |
@@ -220,10 +219,10 @@ discard block |
||
| 220 | 219 | 'order_by' => array('QSG_order' => 'ASC') |
| 221 | 220 | ) |
| 222 | 221 | ); |
| 223 | - if ( $question_groups ) { |
|
| 222 | + if ($question_groups) { |
|
| 224 | 223 | // array of params to pass to parent constructor |
| 225 | 224 | $form_args = array( |
| 226 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
| 225 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
| 227 | 226 | 'html_class' => 'ee-reg-form-attendee-dv', |
| 228 | 227 | 'html_style' => $this->checkout->admin_request |
| 229 | 228 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
@@ -236,9 +235,9 @@ discard block |
||
| 236 | 235 | ) |
| 237 | 236 | ) |
| 238 | 237 | ); |
| 239 | - foreach ( $question_groups as $question_group ) { |
|
| 240 | - if ( $question_group instanceof EE_Question_Group ) { |
|
| 241 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
|
| 238 | + foreach ($question_groups as $question_group) { |
|
| 239 | + if ($question_group instanceof EE_Question_Group) { |
|
| 240 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form( |
|
| 242 | 241 | $registration, |
| 243 | 242 | $question_group |
| 244 | 243 | ); |
@@ -257,7 +256,7 @@ discard block |
||
| 257 | 256 | } |
| 258 | 257 | } |
| 259 | 258 | $attendee_nmbr++; |
| 260 | - return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : null; |
|
| 259 | + return ! empty($form_args) ? new EE_Form_Section_Proper($form_args) : null; |
|
| 261 | 260 | } |
| 262 | 261 | |
| 263 | 262 | |
@@ -278,7 +277,7 @@ discard block |
||
| 278 | 277 | // generate hidden input |
| 279 | 278 | return new EE_Hidden_Input( |
| 280 | 279 | array( |
| 281 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
| 280 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
| 282 | 281 | 'default' => $additional_attendee_reg_info |
| 283 | 282 | ) |
| 284 | 283 | ); |
@@ -292,26 +291,26 @@ discard block |
||
| 292 | 291 | * @return EE_Form_Section_Proper |
| 293 | 292 | * @throws \EE_Error |
| 294 | 293 | */ |
| 295 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
| 294 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
| 296 | 295 | // array of params to pass to parent constructor |
| 297 | 296 | $form_args = array( |
| 298 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
| 297 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
| 299 | 298 | 'html_class' => $this->checkout->admin_request |
| 300 | 299 | ? 'form-table ee-reg-form-qstn-grp-dv' |
| 301 | 300 | : 'ee-reg-form-qstn-grp-dv', |
| 302 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
| 301 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
| 303 | 302 | 'subsections' => array( |
| 304 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
| 303 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
| 305 | 304 | ), |
| 306 | 305 | 'layout_strategy' => $this->checkout->admin_request |
| 307 | 306 | ? new EE_Admin_Two_Column_Layout() |
| 308 | 307 | : new EE_Div_Per_Section_Layout() |
| 309 | 308 | ); |
| 310 | 309 | // where params |
| 311 | - $query_params = array( 'QST_deleted' => 0 ); |
|
| 310 | + $query_params = array('QST_deleted' => 0); |
|
| 312 | 311 | // don't load admin only questions on the frontend |
| 313 | - if ( ! $this->checkout->admin_request ) { |
|
| 314 | - $query_params['QST_admin_only'] = array( '!=', true ); |
|
| 312 | + if ( ! $this->checkout->admin_request) { |
|
| 313 | + $query_params['QST_admin_only'] = array('!=', true); |
|
| 315 | 314 | } |
| 316 | 315 | $questions = $question_group->get_many_related( |
| 317 | 316 | 'Question', |
@@ -333,10 +332,10 @@ discard block |
||
| 333 | 332 | ) |
| 334 | 333 | ); |
| 335 | 334 | // loop thru questions |
| 336 | - foreach ( $questions as $question ) { |
|
| 337 | - if( $question instanceof EE_Question ){ |
|
| 335 | + foreach ($questions as $question) { |
|
| 336 | + if ($question instanceof EE_Question) { |
|
| 338 | 337 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
| 339 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
| 338 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
| 340 | 339 | } |
| 341 | 340 | } |
| 342 | 341 | $form_args['subsections'] = apply_filters( |
@@ -357,7 +356,7 @@ discard block |
||
| 357 | 356 | ) |
| 358 | 357 | ); |
| 359 | 358 | // d( $form_args ); |
| 360 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
| 359 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
| 361 | 360 | return apply_filters( |
| 362 | 361 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
| 363 | 362 | $question_group_reg_form, |
@@ -374,11 +373,11 @@ discard block |
||
| 374 | 373 | * @param EE_Question_Group $question_group |
| 375 | 374 | * @return EE_Form_Section_HTML |
| 376 | 375 | */ |
| 377 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
| 376 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
| 378 | 377 | $html = ''; |
| 379 | 378 | // group_name |
| 380 | - if ( $question_group->show_group_name() && $question_group->name() !== '' ) { |
|
| 381 | - if ( $this->checkout->admin_request ) { |
|
| 379 | + if ($question_group->show_group_name() && $question_group->name() !== '') { |
|
| 380 | + if ($this->checkout->admin_request) { |
|
| 382 | 381 | $html .= EEH_HTML::br(); |
| 383 | 382 | $html .= EEH_HTML::h3( |
| 384 | 383 | $question_group->name(), |
@@ -392,7 +391,7 @@ discard block |
||
| 392 | 391 | } |
| 393 | 392 | } |
| 394 | 393 | // group_desc |
| 395 | - if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) { |
|
| 394 | + if ($question_group->show_group_desc() && $question_group->desc() !== '') { |
|
| 396 | 395 | $html .= EEH_HTML::p( |
| 397 | 396 | $question_group->desc(), |
| 398 | 397 | '', |
@@ -402,7 +401,7 @@ discard block |
||
| 402 | 401 | ); |
| 403 | 402 | |
| 404 | 403 | } |
| 405 | - return new EE_Form_Section_HTML( $html ); |
|
| 404 | + return new EE_Form_Section_HTML($html); |
|
| 406 | 405 | } |
| 407 | 406 | |
| 408 | 407 | |
@@ -412,7 +411,7 @@ discard block |
||
| 412 | 411 | * @return EE_Form_Section_Proper |
| 413 | 412 | * @throws \EE_Error |
| 414 | 413 | */ |
| 415 | - private function _copy_attendee_info_form(){ |
|
| 414 | + private function _copy_attendee_info_form() { |
|
| 416 | 415 | // array of params to pass to parent constructor |
| 417 | 416 | return new EE_Form_Section_Proper( |
| 418 | 417 | array( |
@@ -441,7 +440,7 @@ discard block |
||
| 441 | 440 | private function _auto_copy_attendee_info() { |
| 442 | 441 | return new EE_Form_Section_HTML( |
| 443 | 442 | EEH_Template::locate_template( |
| 444 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
| 443 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
| 445 | 444 | apply_filters( |
| 446 | 445 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', |
| 447 | 446 | array() |
@@ -465,32 +464,32 @@ discard block |
||
| 465 | 464 | $copy_attendee_info_inputs = array(); |
| 466 | 465 | $prev_ticket = NULL; |
| 467 | 466 | // grab the saved registrations from the transaction |
| 468 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
| 469 | - foreach ( $registrations as $registration ) { |
|
| 467 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
| 468 | + foreach ($registrations as $registration) { |
|
| 470 | 469 | // for all attendees other than the primary attendee |
| 471 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
| 470 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
| 472 | 471 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
| 473 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
| 472 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
| 474 | 473 | $item_name = $registration->ticket()->name(); |
| 475 | 474 | $item_name .= $registration->ticket()->description() !== '' |
| 476 | - ? ' - ' . $registration->ticket()->description() |
|
| 475 | + ? ' - '.$registration->ticket()->description() |
|
| 477 | 476 | : ''; |
| 478 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
| 479 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
| 477 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
| 478 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
| 480 | 479 | ); |
| 481 | 480 | $prev_ticket = $registration->ticket()->ID(); |
| 482 | 481 | } |
| 483 | 482 | |
| 484 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
| 483 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
| 485 | 484 | EE_Checkbox_Multi_Input( |
| 486 | 485 | array( |
| 487 | 486 | $registration->ID() => sprintf( |
| 488 | - __( 'Attendee #%s', 'event_espresso' ), |
|
| 487 | + __('Attendee #%s', 'event_espresso'), |
|
| 489 | 488 | $registration->count() |
| 490 | 489 | ) |
| 491 | 490 | ), |
| 492 | 491 | array( |
| 493 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
| 492 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
| 494 | 493 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
| 495 | 494 | 'display_html_label_text' => false |
| 496 | 495 | ) |
@@ -510,7 +509,7 @@ discard block |
||
| 510 | 509 | * @return EE_Form_Input_Base |
| 511 | 510 | * @throws \EE_Error |
| 512 | 511 | */ |
| 513 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
| 512 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
| 514 | 513 | // generate hidden input |
| 515 | 514 | return new EE_Hidden_Input( |
| 516 | 515 | array( |
@@ -529,7 +528,7 @@ discard block |
||
| 529 | 528 | * @return EE_Form_Input_Base |
| 530 | 529 | * @throws \EE_Error |
| 531 | 530 | */ |
| 532 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
| 531 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
| 533 | 532 | |
| 534 | 533 | // if this question was for an attendee detail, then check for that answer |
| 535 | 534 | $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( |
@@ -538,32 +537,32 @@ discard block |
||
| 538 | 537 | ); |
| 539 | 538 | $answer = $answer_value === null |
| 540 | 539 | ? EEM_Answer::instance()->get_one( |
| 541 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
| 540 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
| 542 | 541 | ) |
| 543 | 542 | : null; |
| 544 | 543 | // if NOT returning to edit an existing registration |
| 545 | 544 | // OR if this question is for an attendee property |
| 546 | 545 | // OR we still don't have an EE_Answer object |
| 547 | - if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) { |
|
| 546 | + if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { |
|
| 548 | 547 | // create an EE_Answer object for storing everything in |
| 549 | - $answer = EE_Answer::new_instance ( array( |
|
| 548 | + $answer = EE_Answer::new_instance(array( |
|
| 550 | 549 | 'QST_ID'=> $question->ID(), |
| 551 | 550 | 'REG_ID'=> $registration->ID() |
| 552 | 551 | )); |
| 553 | 552 | } |
| 554 | 553 | // verify instance |
| 555 | - if( $answer instanceof EE_Answer ){ |
|
| 556 | - if ( ! empty( $answer_value )) { |
|
| 557 | - $answer->set( 'ANS_value', $answer_value ); |
|
| 554 | + if ($answer instanceof EE_Answer) { |
|
| 555 | + if ( ! empty($answer_value)) { |
|
| 556 | + $answer->set('ANS_value', $answer_value); |
|
| 558 | 557 | } |
| 559 | - $answer->cache( 'Question', $question ); |
|
| 558 | + $answer->cache('Question', $question); |
|
| 560 | 559 | //remember system ID had a bug where sometimes it could be null |
| 561 | - $answer_cache_id =$question->is_system_question() |
|
| 562 | - ? $question->system_ID() . '-' . $registration->reg_url_link() |
|
| 563 | - : $question->ID() . '-' . $registration->reg_url_link(); |
|
| 564 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
| 560 | + $answer_cache_id = $question->is_system_question() |
|
| 561 | + ? $question->system_ID().'-'.$registration->reg_url_link() |
|
| 562 | + : $question->ID().'-'.$registration->reg_url_link(); |
|
| 563 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
| 565 | 564 | } |
| 566 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
| 565 | + return $this->_generate_question_input($registration, $question, $answer); |
|
| 567 | 566 | |
| 568 | 567 | } |
| 569 | 568 | |
@@ -576,46 +575,46 @@ discard block |
||
| 576 | 575 | * @return EE_Form_Input_Base |
| 577 | 576 | * @throws \EE_Error |
| 578 | 577 | */ |
| 579 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
| 578 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
| 580 | 579 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
| 581 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
| 580 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
| 582 | 581 | add_filter( |
| 583 | 582 | 'FHEE__EE_Question__generate_form_input__country_options', |
| 584 | - array( $this, 'use_cached_countries_for_form_input' ), |
|
| 583 | + array($this, 'use_cached_countries_for_form_input'), |
|
| 585 | 584 | 10, |
| 586 | 585 | 4 |
| 587 | 586 | ); |
| 588 | 587 | add_filter( |
| 589 | 588 | 'FHEE__EE_Question__generate_form_input__state_options', |
| 590 | - array( $this, 'use_cached_states_for_form_input' ), |
|
| 589 | + array($this, 'use_cached_states_for_form_input'), |
|
| 591 | 590 | 10, |
| 592 | 591 | 4 |
| 593 | 592 | ); |
| 594 | 593 | $input_constructor_args = array( |
| 595 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
| 596 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
| 597 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
| 598 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
| 594 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
| 595 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
| 596 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
| 597 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
| 599 | 598 | 'html_label_class' => 'ee-reg-qstn', |
| 600 | 599 | ); |
| 601 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
| 602 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
| 603 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
| 604 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
| 605 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
| 600 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
| 601 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
| 602 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
| 603 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
| 604 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
| 606 | 605 | } |
| 607 | - $form_input = $question->generate_form_input( |
|
| 606 | + $form_input = $question->generate_form_input( |
|
| 608 | 607 | $registration, |
| 609 | 608 | $answer, |
| 610 | 609 | $input_constructor_args |
| 611 | 610 | ); |
| 612 | 611 | remove_filter( |
| 613 | 612 | 'FHEE__EE_Question__generate_form_input__country_options', |
| 614 | - array( $this, 'use_cached_countries_for_form_input' ) |
|
| 613 | + array($this, 'use_cached_countries_for_form_input') |
|
| 615 | 614 | ); |
| 616 | 615 | remove_filter( |
| 617 | 616 | 'FHEE__EE_Question__generate_form_input__state_options', |
| 618 | - array( $this, 'use_cached_states_for_form_input' ) |
|
| 617 | + array($this, 'use_cached_states_for_form_input') |
|
| 619 | 618 | ); |
| 620 | 619 | return $form_input; |
| 621 | 620 | } |
@@ -637,22 +636,22 @@ discard block |
||
| 637 | 636 | \EE_Registration $registration = null, |
| 638 | 637 | \EE_Answer $answer = null |
| 639 | 638 | ) { |
| 640 | - $country_options = array( '' => '' ); |
|
| 639 | + $country_options = array('' => ''); |
|
| 641 | 640 | // get possibly cached list of countries |
| 642 | 641 | $countries = $this->checkout->action === 'process_reg_step' |
| 643 | 642 | ? EEM_Country::instance()->get_all_countries() |
| 644 | 643 | : EEM_Country::instance()->get_all_active_countries(); |
| 645 | - if ( ! empty( $countries )) { |
|
| 646 | - foreach( $countries as $country ){ |
|
| 647 | - if ( $country instanceof EE_Country ) { |
|
| 648 | - $country_options[ $country->ID() ] = $country->name(); |
|
| 644 | + if ( ! empty($countries)) { |
|
| 645 | + foreach ($countries as $country) { |
|
| 646 | + if ($country instanceof EE_Country) { |
|
| 647 | + $country_options[$country->ID()] = $country->name(); |
|
| 649 | 648 | } |
| 650 | 649 | } |
| 651 | 650 | } |
| 652 | - if( $question instanceof EE_Question |
|
| 653 | - && $registration instanceof EE_Registration ) { |
|
| 651 | + if ($question instanceof EE_Question |
|
| 652 | + && $registration instanceof EE_Registration) { |
|
| 654 | 653 | $answer = EEM_Answer::instance()->get_one( |
| 655 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
| 654 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
| 656 | 655 | ); |
| 657 | 656 | } else { |
| 658 | 657 | $answer = EE_Answer::new_instance(); |
@@ -685,14 +684,14 @@ discard block |
||
| 685 | 684 | \EE_Registration $registration = null, |
| 686 | 685 | \EE_Answer $answer = null |
| 687 | 686 | ) { |
| 688 | - $state_options = array( '' => array( '' => '')); |
|
| 687 | + $state_options = array('' => array('' => '')); |
|
| 689 | 688 | $states = $this->checkout->action === 'process_reg_step' |
| 690 | 689 | ? EEM_State::instance()->get_all_states() |
| 691 | 690 | : EEM_State::instance()->get_all_active_states(); |
| 692 | - if ( ! empty( $states )) { |
|
| 693 | - foreach( $states as $state ){ |
|
| 694 | - if ( $state instanceof EE_State ) { |
|
| 695 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
| 691 | + if ( ! empty($states)) { |
|
| 692 | + foreach ($states as $state) { |
|
| 693 | + if ($state instanceof EE_State) { |
|
| 694 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
| 696 | 695 | } |
| 697 | 696 | } |
| 698 | 697 | } |
@@ -720,24 +719,24 @@ discard block |
||
| 720 | 719 | * @throws \EE_Error |
| 721 | 720 | */ |
| 722 | 721 | public function process_reg_step() { |
| 723 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 722 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 724 | 723 | // grab validated data from form |
| 725 | 724 | $valid_data = $this->checkout->current_step->valid_data(); |
| 726 | 725 | // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
| 727 | 726 | // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
| 728 | 727 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
| 729 | - if ( empty( $valid_data )) { |
|
| 728 | + if (empty($valid_data)) { |
|
| 730 | 729 | EE_Error::add_error( |
| 731 | - __( 'No valid question responses were received.', 'event_espresso' ), |
|
| 730 | + __('No valid question responses were received.', 'event_espresso'), |
|
| 732 | 731 | __FILE__, |
| 733 | 732 | __FUNCTION__, |
| 734 | 733 | __LINE__ |
| 735 | 734 | ); |
| 736 | 735 | return false; |
| 737 | 736 | } |
| 738 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
| 737 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
| 739 | 738 | EE_Error::add_error( |
| 740 | - __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), |
|
| 739 | + __('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), |
|
| 741 | 740 | __FILE__, |
| 742 | 741 | __FUNCTION__, |
| 743 | 742 | __LINE__ |
@@ -745,11 +744,11 @@ discard block |
||
| 745 | 744 | return false; |
| 746 | 745 | } |
| 747 | 746 | // get cached registrations |
| 748 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
| 747 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
| 749 | 748 | // verify we got the goods |
| 750 | - if ( empty( $registrations )) { |
|
| 749 | + if (empty($registrations)) { |
|
| 751 | 750 | EE_Error::add_error( |
| 752 | - __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), |
|
| 751 | + __('Your form data could not be applied to any valid registrations.', 'event_espresso'), |
|
| 753 | 752 | __FILE__, |
| 754 | 753 | __FUNCTION__, |
| 755 | 754 | __LINE__ |
@@ -757,15 +756,15 @@ discard block |
||
| 757 | 756 | return false; |
| 758 | 757 | } |
| 759 | 758 | // extract attendee info from form data and save to model objects |
| 760 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
| 759 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
| 761 | 760 | // if first pass thru SPCO, |
| 762 | 761 | // then let's check processed registrations against the total number of tickets in the cart |
| 763 | - if ( $registrations_processed === false ) { |
|
| 762 | + if ($registrations_processed === false) { |
|
| 764 | 763 | // but return immediately if the previous step exited early due to errors |
| 765 | 764 | return false; |
| 766 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
| 765 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
| 767 | 766 | // generate a correctly translated string for all possible singular/plural combinations |
| 768 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
| 767 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
| 769 | 768 | $error_msg = sprintf( |
| 770 | 769 | __( |
| 771 | 770 | 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', |
@@ -774,7 +773,7 @@ discard block |
||
| 774 | 773 | $this->checkout->total_ticket_count, |
| 775 | 774 | $registrations_processed |
| 776 | 775 | ); |
| 777 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
| 776 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
| 778 | 777 | $error_msg = sprintf( |
| 779 | 778 | __( |
| 780 | 779 | 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', |
@@ -793,17 +792,17 @@ discard block |
||
| 793 | 792 | $registrations_processed |
| 794 | 793 | ); |
| 795 | 794 | } |
| 796 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 795 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 797 | 796 | return false; |
| 798 | 797 | } |
| 799 | 798 | // mark this reg step as completed |
| 800 | 799 | $this->set_completed(); |
| 801 | 800 | $this->_set_success_message( |
| 802 | - __( 'The Attendee Information Step has been successfully completed.', 'event_espresso' ) |
|
| 801 | + __('The Attendee Information Step has been successfully completed.', 'event_espresso') |
|
| 803 | 802 | ); |
| 804 | 803 | //do action in case a plugin wants to do something with the data submitted in step 1. |
| 805 | 804 | //passes EE_Single_Page_Checkout, and it's posted data |
| 806 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
| 805 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
| 807 | 806 | return true; |
| 808 | 807 | } |
| 809 | 808 | |
@@ -817,9 +816,9 @@ discard block |
||
| 817 | 816 | * @return boolean | int |
| 818 | 817 | * @throws \EE_Error |
| 819 | 818 | */ |
| 820 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
| 819 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
| 821 | 820 | // load resources and set some defaults |
| 822 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
| 821 | + EE_Registry::instance()->load_model('Attendee'); |
|
| 823 | 822 | // holder for primary registrant attendee object |
| 824 | 823 | $this->checkout->primary_attendee_obj = NULL; |
| 825 | 824 | // array for tracking reg form data for the primary registrant |
@@ -836,9 +835,9 @@ discard block |
||
| 836 | 835 | // attendee counter |
| 837 | 836 | $att_nmbr = 0; |
| 838 | 837 | // grab the saved registrations from the transaction |
| 839 | - foreach ( $registrations as $registration ) { |
|
| 838 | + foreach ($registrations as $registration) { |
|
| 840 | 839 | // verify EE_Registration object |
| 841 | - if ( ! $registration instanceof EE_Registration ) { |
|
| 840 | + if ( ! $registration instanceof EE_Registration) { |
|
| 842 | 841 | EE_Error::add_error( |
| 843 | 842 | __( |
| 844 | 843 | 'An invalid Registration object was discovered when attempting to process your registration information.', |
@@ -853,12 +852,12 @@ discard block |
||
| 853 | 852 | /** @var string $reg_url_link */ |
| 854 | 853 | $reg_url_link = $registration->reg_url_link(); |
| 855 | 854 | // reg_url_link exists ? |
| 856 | - if ( ! empty( $reg_url_link ) ) { |
|
| 855 | + if ( ! empty($reg_url_link)) { |
|
| 857 | 856 | // should this registration be processed during this visit ? |
| 858 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
| 857 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
| 859 | 858 | // if NOT revisiting, then let's save the registration now, |
| 860 | 859 | // so that we have a REG_ID to use when generating other objects |
| 861 | - if ( ! $this->checkout->revisit ) { |
|
| 860 | + if ( ! $this->checkout->revisit) { |
|
| 862 | 861 | $registration->save(); |
| 863 | 862 | } |
| 864 | 863 | /** |
@@ -868,7 +867,7 @@ discard block |
||
| 868 | 867 | * @var bool if true is returned by the plugin then the |
| 869 | 868 | * registration processing is halted. |
| 870 | 869 | */ |
| 871 | - if ( apply_filters( |
|
| 870 | + if (apply_filters( |
|
| 872 | 871 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', |
| 873 | 872 | false, |
| 874 | 873 | $att_nmbr, |
@@ -876,38 +875,38 @@ discard block |
||
| 876 | 875 | $registrations, |
| 877 | 876 | $valid_data, |
| 878 | 877 | $this |
| 879 | - ) ) { |
|
| 878 | + )) { |
|
| 880 | 879 | return false; |
| 881 | 880 | } |
| 882 | 881 | |
| 883 | 882 | // Houston, we have a registration! |
| 884 | 883 | $att_nmbr++; |
| 885 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
| 884 | + $this->_attendee_data[$reg_url_link] = array(); |
|
| 886 | 885 | // grab any existing related answer objects |
| 887 | 886 | $this->_registration_answers = $registration->answers(); |
| 888 | 887 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
| 889 | - if ( isset( $valid_data[ $reg_url_link ] ) ) { |
|
| 888 | + if (isset($valid_data[$reg_url_link])) { |
|
| 890 | 889 | // do we need to copy basic info from primary attendee ? |
| 891 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
|
| 892 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
| 890 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) |
|
| 891 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 |
|
| 893 | 892 | ? true |
| 894 | 893 | : false; |
| 895 | 894 | // filter form input data for this registration |
| 896 | - $valid_data[ $reg_url_link ] = (array)apply_filters( |
|
| 895 | + $valid_data[$reg_url_link] = (array) apply_filters( |
|
| 897 | 896 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
| 898 | - $valid_data[ $reg_url_link ] |
|
| 897 | + $valid_data[$reg_url_link] |
|
| 899 | 898 | ); |
| 900 | 899 | // EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
| 901 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
| 902 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) |
|
| 900 | + if (isset($valid_data['primary_attendee'])) { |
|
| 901 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) |
|
| 903 | 902 | ? $valid_data['primary_attendee'] |
| 904 | 903 | : false; |
| 905 | - unset( $valid_data['primary_attendee'] ); |
|
| 904 | + unset($valid_data['primary_attendee']); |
|
| 906 | 905 | } |
| 907 | 906 | // now loop through our array of valid post data && process attendee reg forms |
| 908 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
| 909 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
| 910 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
| 907 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
| 908 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
| 909 | + foreach ($form_inputs as $form_input => $input_value) { |
|
| 911 | 910 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ ); |
| 912 | 911 | // check for critical inputs |
| 913 | 912 | if ( |
@@ -921,16 +920,16 @@ discard block |
||
| 921 | 920 | // store a bit of data about the primary attendee |
| 922 | 921 | if ( |
| 923 | 922 | $att_nmbr === 1 |
| 924 | - && ! empty( $input_value ) |
|
| 923 | + && ! empty($input_value) |
|
| 925 | 924 | && $reg_url_link === $primary_registrant['line_item_id'] |
| 926 | 925 | ) { |
| 927 | - $primary_registrant[ $form_input ] = $input_value; |
|
| 926 | + $primary_registrant[$form_input] = $input_value; |
|
| 928 | 927 | } else if ( |
| 929 | 928 | $copy_primary |
| 930 | 929 | && $input_value === null |
| 931 | - && isset( $primary_registrant[ $form_input ] ) |
|
| 930 | + && isset($primary_registrant[$form_input]) |
|
| 932 | 931 | ) { |
| 933 | - $input_value = $primary_registrant[ $form_input ]; |
|
| 932 | + $input_value = $primary_registrant[$form_input]; |
|
| 934 | 933 | } |
| 935 | 934 | // now attempt to save the input data |
| 936 | 935 | if ( |
@@ -972,55 +971,55 @@ discard block |
||
| 972 | 971 | // have we met before? |
| 973 | 972 | $attendee = $this->_find_existing_attendee( |
| 974 | 973 | $registration, |
| 975 | - $this->_attendee_data[ $reg_url_link ] |
|
| 974 | + $this->_attendee_data[$reg_url_link] |
|
| 976 | 975 | ); |
| 977 | 976 | // did we find an already existing record for this attendee ? |
| 978 | - if ( $attendee instanceof EE_Attendee ) { |
|
| 977 | + if ($attendee instanceof EE_Attendee) { |
|
| 979 | 978 | $attendee = $this->_update_existing_attendee_data( |
| 980 | 979 | $attendee, |
| 981 | - $this->_attendee_data[ $reg_url_link ] |
|
| 980 | + $this->_attendee_data[$reg_url_link] |
|
| 982 | 981 | ); |
| 983 | 982 | } else { |
| 984 | 983 | // ensure critical details are set for additional attendees |
| 985 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 |
|
| 984 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 |
|
| 986 | 985 | ? $this->_copy_critical_attendee_details_from_primary_registrant( |
| 987 | - $this->_attendee_data[ $reg_url_link ] |
|
| 986 | + $this->_attendee_data[$reg_url_link] |
|
| 988 | 987 | ) |
| 989 | - : $this->_attendee_data[ $reg_url_link ]; |
|
| 988 | + : $this->_attendee_data[$reg_url_link]; |
|
| 990 | 989 | $attendee = $this->_create_new_attendee( |
| 991 | 990 | $registration, |
| 992 | - $this->_attendee_data[ $reg_url_link ] |
|
| 991 | + $this->_attendee_data[$reg_url_link] |
|
| 993 | 992 | ); |
| 994 | 993 | } |
| 995 | 994 | // who's #1 ? |
| 996 | - if ( $att_nmbr === 1 ) { |
|
| 995 | + if ($att_nmbr === 1) { |
|
| 997 | 996 | $this->checkout->primary_attendee_obj = $attendee; |
| 998 | 997 | } |
| 999 | 998 | } |
| 1000 | 999 | // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
| 1001 | 1000 | // add relation to registration, set attendee ID, and cache attendee |
| 1002 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
| 1001 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
| 1003 | 1002 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ ); |
| 1004 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
| 1005 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1003 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
| 1004 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
| 1006 | 1005 | return false; |
| 1007 | 1006 | } |
| 1008 | 1007 | /** @type EE_Registration_Processor $registration_processor */ |
| 1009 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
| 1008 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 1010 | 1009 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
| 1011 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
| 1010 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, false); |
|
| 1012 | 1011 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
| 1013 | 1012 | $this->checkout->transaction->toggle_failed_transaction_status(); |
| 1014 | 1013 | // if we've gotten this far, then let's save what we have |
| 1015 | 1014 | $registration->save(); |
| 1016 | 1015 | // add relation between TXN and registration |
| 1017 | - $this->_associate_registration_with_transaction( $registration ); |
|
| 1016 | + $this->_associate_registration_with_transaction($registration); |
|
| 1018 | 1017 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
| 1019 | 1018 | |
| 1020 | - } else { |
|
| 1021 | - 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__ ); |
|
| 1019 | + } else { |
|
| 1020 | + 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 | 1021 | // remove malformed data |
| 1023 | - unset( $valid_data[ $reg_url_link ] ); |
|
| 1022 | + unset($valid_data[$reg_url_link]); |
|
| 1024 | 1023 | return false; |
| 1025 | 1024 | } |
| 1026 | 1025 | |
@@ -1049,26 +1048,26 @@ discard block |
||
| 1049 | 1048 | // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
| 1050 | 1049 | // allow for plugins to hook in and do their own processing of the form input. |
| 1051 | 1050 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
| 1052 | - if ( apply_filters( |
|
| 1051 | + if (apply_filters( |
|
| 1053 | 1052 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', |
| 1054 | 1053 | false, |
| 1055 | 1054 | $registration, |
| 1056 | 1055 | $form_input, |
| 1057 | 1056 | $input_value, |
| 1058 | 1057 | $this |
| 1059 | - ) ) { |
|
| 1058 | + )) { |
|
| 1060 | 1059 | return true; |
| 1061 | 1060 | } |
| 1062 | 1061 | // $answer_cache_id is the key used to find the EE_Answer we want |
| 1063 | 1062 | $answer_cache_id = $this->checkout->reg_url_link |
| 1064 | 1063 | ? $form_input |
| 1065 | - : $form_input . '-' . $registration->reg_url_link(); |
|
| 1066 | - $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
|
| 1067 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
| 1064 | + : $form_input.'-'.$registration->reg_url_link(); |
|
| 1065 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id]) |
|
| 1066 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer |
|
| 1068 | 1067 | ? true |
| 1069 | 1068 | : false; |
| 1070 | 1069 | //rename form_inputs if they are EE_Attendee properties |
| 1071 | - switch( (string)$form_input ) { |
|
| 1070 | + switch ((string) $form_input) { |
|
| 1072 | 1071 | |
| 1073 | 1072 | case 'state' : |
| 1074 | 1073 | case 'STA_ID' : |
@@ -1083,32 +1082,32 @@ discard block |
||
| 1083 | 1082 | break; |
| 1084 | 1083 | |
| 1085 | 1084 | default : |
| 1086 | - $ATT_input = 'ATT_' . $form_input; |
|
| 1085 | + $ATT_input = 'ATT_'.$form_input; |
|
| 1087 | 1086 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
| 1088 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false; |
|
| 1089 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
| 1087 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false; |
|
| 1088 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
| 1090 | 1089 | } |
| 1091 | 1090 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
| 1092 | 1091 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
| 1093 | 1092 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
| 1094 | 1093 | // if this form input has a corresponding attendee property |
| 1095 | - if ( $attendee_property ) { |
|
| 1096 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
| 1097 | - if ( $answer_is_obj ) { |
|
| 1094 | + if ($attendee_property) { |
|
| 1095 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
| 1096 | + if ($answer_is_obj) { |
|
| 1098 | 1097 | // and delete the corresponding answer since we won't be storing this data in that object |
| 1099 | - $registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' ); |
|
| 1100 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently(); |
|
| 1098 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer'); |
|
| 1099 | + $this->_registration_answers[$answer_cache_id]->delete_permanently(); |
|
| 1101 | 1100 | } |
| 1102 | 1101 | return true; |
| 1103 | - } elseif ( $answer_is_obj ) { |
|
| 1102 | + } elseif ($answer_is_obj) { |
|
| 1104 | 1103 | // save this data to the answer object |
| 1105 | - $this->_registration_answers[ $answer_cache_id ]->set_value( $input_value ); |
|
| 1106 | - $result = $this->_registration_answers[ $answer_cache_id ]->save(); |
|
| 1104 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value); |
|
| 1105 | + $result = $this->_registration_answers[$answer_cache_id]->save(); |
|
| 1107 | 1106 | return $result !== false ? true : false; |
| 1108 | 1107 | } else { |
| 1109 | - foreach ( $this->_registration_answers as $answer ) { |
|
| 1110 | - if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) { |
|
| 1111 | - $answer->set_value( $input_value ); |
|
| 1108 | + foreach ($this->_registration_answers as $answer) { |
|
| 1109 | + if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { |
|
| 1110 | + $answer->set_value($input_value); |
|
| 1112 | 1111 | $result = $answer->save(); |
| 1113 | 1112 | return $result !== false ? true : false; |
| 1114 | 1113 | } |
@@ -1130,15 +1129,15 @@ discard block |
||
| 1130 | 1129 | $form_input = '', |
| 1131 | 1130 | $input_value = '' |
| 1132 | 1131 | ) { |
| 1133 | - if ( empty( $input_value ) ) { |
|
| 1132 | + if (empty($input_value)) { |
|
| 1134 | 1133 | // if the form input isn't marked as being required, then just return |
| 1135 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
| 1134 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
| 1136 | 1135 | return true; |
| 1137 | 1136 | } |
| 1138 | - switch ( $form_input ) { |
|
| 1137 | + switch ($form_input) { |
|
| 1139 | 1138 | case 'fname' : |
| 1140 | 1139 | EE_Error::add_error( |
| 1141 | - __( 'First Name is a required value.', 'event_espresso' ), |
|
| 1140 | + __('First Name is a required value.', 'event_espresso'), |
|
| 1142 | 1141 | __FILE__, |
| 1143 | 1142 | __FUNCTION__, |
| 1144 | 1143 | __LINE__ |
@@ -1147,7 +1146,7 @@ discard block |
||
| 1147 | 1146 | break; |
| 1148 | 1147 | case 'lname' : |
| 1149 | 1148 | EE_Error::add_error( |
| 1150 | - __( 'Last Name is a required value.', 'event_espresso' ), |
|
| 1149 | + __('Last Name is a required value.', 'event_espresso'), |
|
| 1151 | 1150 | __FILE__, |
| 1152 | 1151 | __FUNCTION__, |
| 1153 | 1152 | __LINE__ |
@@ -1156,7 +1155,7 @@ discard block |
||
| 1156 | 1155 | break; |
| 1157 | 1156 | case 'email' : |
| 1158 | 1157 | EE_Error::add_error( |
| 1159 | - __( 'Please enter a valid email address.', 'event_espresso' ), |
|
| 1158 | + __('Please enter a valid email address.', 'event_espresso'), |
|
| 1160 | 1159 | __FILE__, |
| 1161 | 1160 | __FUNCTION__, |
| 1162 | 1161 | __LINE__ |
@@ -1178,30 +1177,30 @@ discard block |
||
| 1178 | 1177 | * @return boolean|EE_Attendee |
| 1179 | 1178 | * @throws \EE_Error |
| 1180 | 1179 | */ |
| 1181 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
| 1180 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
| 1182 | 1181 | $existing_attendee = null; |
| 1183 | 1182 | // if none of the critical properties are set in the incoming attendee data... |
| 1184 | 1183 | // then attempt to copy them from the primary attendee |
| 1185 | 1184 | if ( |
| 1186 | 1185 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
| 1187 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
| 1186 | + && ! isset($attendee_data['ATT_fname'], $attendee_data['ATT_email']) |
|
| 1188 | 1187 | ) { |
| 1189 | 1188 | return $this->checkout->primary_attendee_obj; |
| 1190 | 1189 | } |
| 1191 | 1190 | // does this attendee already exist in the db ? |
| 1192 | 1191 | // we're searching using a combination of first name, last name, AND email address |
| 1193 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) |
|
| 1192 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) |
|
| 1194 | 1193 | ? $attendee_data['ATT_fname'] |
| 1195 | 1194 | : ''; |
| 1196 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) |
|
| 1195 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) |
|
| 1197 | 1196 | ? $attendee_data['ATT_lname'] |
| 1198 | 1197 | : ''; |
| 1199 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) |
|
| 1198 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) |
|
| 1200 | 1199 | ? $attendee_data['ATT_email'] |
| 1201 | 1200 | : ''; |
| 1202 | 1201 | // but only if those have values |
| 1203 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
| 1204 | - $existing_attendee = EEM_Attendee::instance()->find_existing_attendee( array( |
|
| 1202 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
| 1203 | + $existing_attendee = EEM_Attendee::instance()->find_existing_attendee(array( |
|
| 1205 | 1204 | 'ATT_fname' => $ATT_fname, |
| 1206 | 1205 | 'ATT_lname' => $ATT_lname, |
| 1207 | 1206 | 'ATT_email' => $ATT_email |
@@ -1225,13 +1224,13 @@ discard block |
||
| 1225 | 1224 | * @return \EE_Attendee |
| 1226 | 1225 | * @throws \EE_Error |
| 1227 | 1226 | */ |
| 1228 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
| 1227 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
| 1229 | 1228 | // first remove fname, lname, and email from attendee data |
| 1230 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
| 1229 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
| 1231 | 1230 | // now loop thru what's left and add to attendee CPT |
| 1232 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
| 1233 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
| 1234 | - $existing_attendee->set( $property_name, $property_value ); |
|
| 1231 | + foreach ($attendee_data as $property_name => $property_value) { |
|
| 1232 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
| 1233 | + $existing_attendee->set($property_name, $property_value); |
|
| 1235 | 1234 | } |
| 1236 | 1235 | } |
| 1237 | 1236 | // better save that now |
@@ -1249,11 +1248,11 @@ discard block |
||
| 1249 | 1248 | * @return void |
| 1250 | 1249 | * @throws \EE_Error |
| 1251 | 1250 | */ |
| 1252 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
| 1251 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
| 1253 | 1252 | // add relation to attendee |
| 1254 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
| 1255 | - $registration->set_attendee_id( $attendee->ID() ); |
|
| 1256 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
| 1253 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
| 1254 | + $registration->set_attendee_id($attendee->ID()); |
|
| 1255 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
| 1257 | 1256 | } |
| 1258 | 1257 | |
| 1259 | 1258 | |
@@ -1265,10 +1264,10 @@ discard block |
||
| 1265 | 1264 | * @return void |
| 1266 | 1265 | * @throws \EE_Error |
| 1267 | 1266 | */ |
| 1268 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
| 1267 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
| 1269 | 1268 | // add relation to attendee |
| 1270 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
| 1271 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
| 1269 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
| 1270 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
| 1272 | 1271 | } |
| 1273 | 1272 | |
| 1274 | 1273 | |
@@ -1281,14 +1280,14 @@ discard block |
||
| 1281 | 1280 | * @return array |
| 1282 | 1281 | * @throws \EE_Error |
| 1283 | 1282 | */ |
| 1284 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
| 1283 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
| 1285 | 1284 | // bare minimum critical details include first name, last name, email address |
| 1286 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
| 1285 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
| 1287 | 1286 | // add address info to critical details? |
| 1288 | - if ( apply_filters( |
|
| 1287 | + if (apply_filters( |
|
| 1289 | 1288 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', |
| 1290 | 1289 | false |
| 1291 | - ) ) { |
|
| 1290 | + )) { |
|
| 1292 | 1291 | $address_details = array( |
| 1293 | 1292 | 'ATT_address', |
| 1294 | 1293 | 'ATT_address2', |
@@ -1298,13 +1297,13 @@ discard block |
||
| 1298 | 1297 | 'ATT_zip', |
| 1299 | 1298 | 'ATT_phone' |
| 1300 | 1299 | ); |
| 1301 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
| 1300 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
| 1302 | 1301 | } |
| 1303 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
| 1304 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
|
| 1305 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
| 1302 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
| 1303 | + if ( ! isset($attendee_data[$critical_attendee_detail]) |
|
| 1304 | + || empty($attendee_data[$critical_attendee_detail]) |
|
| 1306 | 1305 | ) { |
| 1307 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
|
| 1306 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get( |
|
| 1308 | 1307 | $critical_attendee_detail |
| 1309 | 1308 | ); |
| 1310 | 1309 | } |
@@ -1322,11 +1321,11 @@ discard block |
||
| 1322 | 1321 | * @return \EE_Attendee |
| 1323 | 1322 | * @throws \EE_Error |
| 1324 | 1323 | */ |
| 1325 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
| 1324 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
| 1326 | 1325 | // create new attendee object |
| 1327 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
| 1326 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
| 1328 | 1327 | // set author to event creator |
| 1329 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
| 1328 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
| 1330 | 1329 | $new_attendee->save(); |
| 1331 | 1330 | return $new_attendee; |
| 1332 | 1331 | } |
@@ -1343,7 +1342,7 @@ discard block |
||
| 1343 | 1342 | */ |
| 1344 | 1343 | public function update_reg_step() { |
| 1345 | 1344 | // save everything |
| 1346 | - if ( $this->process_reg_step() ) { |
|
| 1345 | + if ($this->process_reg_step()) { |
|
| 1347 | 1346 | $this->checkout->redirect = true; |
| 1348 | 1347 | $this->checkout->redirect_url = add_query_arg( |
| 1349 | 1348 | array( |
@@ -1352,7 +1351,7 @@ discard block |
||
| 1352 | 1351 | ), |
| 1353 | 1352 | $this->checkout->thank_you_page_url |
| 1354 | 1353 | ); |
| 1355 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
| 1354 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 1356 | 1355 | return true; |
| 1357 | 1356 | } |
| 1358 | 1357 | return false; |