@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Registration_Confirmation |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'registration_confirmation'; |
25 | 25 | $this->_name = __('Registration Confirmation', 'event_espresso'); |
26 | - $this->_template = SPCO_TEMPLATES_PATH . 'registration_page_confirmation.template.php'; |
|
26 | + $this->_template = SPCO_TEMPLATES_PATH.'registration_page_confirmation.template.php'; |
|
27 | 27 | $this->checkout = $checkout; |
28 | 28 | } |
29 | 29 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return string |
50 | 50 | */ |
51 | 51 | public function generate_reg_form() { |
52 | - EE_Registry::instance()->REQ->add_output( 'generate_reg_form' ); |
|
52 | + EE_Registry::instance()->REQ->add_output('generate_reg_form'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Registration_Confirmation |
|
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_Registration_Confirmation |
|
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_Registration_Confirmation extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - * @return boolean |
|
45 | + * @return boolean|null |
|
46 | 46 | */ |
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | /** |
172 | - * @return boolean |
|
172 | + * @return boolean|null |
|
173 | 173 | */ |
174 | 174 | public function update_reg_step() { |
175 | 175 | EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
@@ -1,16 +1,16 @@ |
||
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 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | case EEM_Question::QST_type_text : |
508 | 508 | if( $identifier == 'email' ){ |
509 | 509 | return new EE_Email_Input( $input_constructor_args ); |
510 | - }else{ |
|
510 | + } else{ |
|
511 | 511 | return new EE_Text_Input( $input_constructor_args ); |
512 | 512 | } |
513 | 513 | break; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 794 | |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | 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__ ); |
797 | 797 | // remove malformed data |
798 | 798 | unset( $valid_data[ $reg_url_link ] ); |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | EEH_Autoloader::register_line_item_display_autoloaders(); |
85 | 85 | $Line_Item_Display = new EE_Line_Item_Display(); |
86 | 86 | // calculate taxes |
87 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
87 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
88 | 88 | EE_Registry::instance()->load_helper('Line_Item'); |
89 | 89 | /** @var $subsections EE_Form_Section_Proper[] */ |
90 | 90 | $subsections = array( |
@@ -96,33 +96,33 @@ discard block |
||
96 | 96 | 'ticket_count' => array() |
97 | 97 | ); |
98 | 98 | // grab the saved registrations from the transaction |
99 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
100 | - if ( $registrations ) { |
|
101 | - foreach ( $registrations as $registration ) { |
|
102 | - if ( $registration instanceof EE_Registration ) { |
|
99 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
100 | + if ($registrations) { |
|
101 | + foreach ($registrations as $registration) { |
|
102 | + if ($registration instanceof EE_Registration) { |
|
103 | 103 | // can this registration be processed during this visit ? |
104 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
105 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
106 | - if ( ! $this->checkout->admin_request ) { |
|
107 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
108 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
109 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
110 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
111 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
104 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
105 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
106 | + if ( ! $this->checkout->admin_request) { |
|
107 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
108 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
109 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
110 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
111 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
112 | 112 | } |
113 | - if ( $registration->is_primary_registrant() ) { |
|
113 | + if ($registration->is_primary_registrant()) { |
|
114 | 114 | $primary_registrant = $registration->reg_url_link(); |
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | // print_copy_info ? |
120 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
120 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
121 | 121 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
122 | 122 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
123 | 123 | // generate hidden input |
124 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
125 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
124 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
125 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | 'html_id' => $this->reg_form_name(), |
135 | 135 | 'subsections' => $subsections, |
136 | 136 | 'layout_strategy' => $this->checkout->admin_request ? |
137 | - new EE_Div_Per_Section_Layout() : |
|
138 | - new EE_Template_Layout( |
|
137 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
139 | 138 | array( |
140 | 139 | 'layout_template_file' => $this->_template, // layout_template |
141 | 140 | 'template_args' => $template_args |
@@ -152,61 +151,61 @@ discard block |
||
152 | 151 | * @param EE_Registration $registration |
153 | 152 | * @return EE_Form_Section_Proper |
154 | 153 | */ |
155 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
156 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
154 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
155 | + EE_Registry::instance()->load_helper('Template'); |
|
157 | 156 | static $attendee_nmbr = 1; |
158 | 157 | // array of params to pass to parent constructor |
159 | 158 | $form_args = array( |
160 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
159 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
161 | 160 | 'html_class' => 'ee-reg-form-attendee-dv', |
162 | 161 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
163 | 162 | 'subsections' => array(), |
164 | 163 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
165 | 164 | array( |
166 | 165 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
167 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
166 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
168 | 167 | ) |
169 | 168 | ) |
170 | 169 | ); |
171 | 170 | // verify that registration has valid event |
172 | - if ( $registration->event() instanceof EE_Event ) { |
|
171 | + if ($registration->event() instanceof EE_Event) { |
|
173 | 172 | $query_params = array( |
174 | 173 | array( |
175 | 174 | 'Event.EVT_ID' => $registration->event()->ID(), |
176 | 175 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
177 | 176 | ), |
178 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
177 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
179 | 178 | ); |
180 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
181 | - if ( $question_groups ) { |
|
182 | - foreach ( $question_groups as $question_group ) { |
|
183 | - if ( $question_group instanceof EE_Question_Group ) { |
|
184 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
179 | + $question_groups = $registration->event()->question_groups($query_params); |
|
180 | + if ($question_groups) { |
|
181 | + foreach ($question_groups as $question_group) { |
|
182 | + if ($question_group instanceof EE_Question_Group) { |
|
183 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
185 | 184 | // add hidden input |
186 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
185 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
187 | 186 | } |
188 | 187 | } |
189 | 188 | // if we have question groups for additional attendees, then display the copy options |
190 | 189 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
191 | 190 | } else { |
192 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
191 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
193 | 192 | EEH_Template::locate_template( |
194 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
195 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
193 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
194 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
196 | 195 | TRUE, |
197 | 196 | TRUE |
198 | 197 | ) |
199 | 198 | ); |
200 | 199 | // add hidden input |
201 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
200 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
202 | 201 | } |
203 | 202 | } |
204 | - if ( $registration->is_primary_registrant() ) { |
|
203 | + if ($registration->is_primary_registrant()) { |
|
205 | 204 | // generate hidden input |
206 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
205 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
207 | 206 | } |
208 | 207 | $attendee_nmbr++; |
209 | - return new EE_Form_Section_Proper( $form_args ); |
|
208 | + return new EE_Form_Section_Proper($form_args); |
|
210 | 209 | } |
211 | 210 | |
212 | 211 | |
@@ -219,11 +218,11 @@ discard block |
||
219 | 218 | * @param bool $additional_attendee_reg_info |
220 | 219 | * @return EE_Form_Input_Base |
221 | 220 | */ |
222 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
221 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
223 | 222 | // generate hidden input |
224 | 223 | return new EE_Hidden_Input( |
225 | 224 | array( |
226 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
225 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
227 | 226 | 'default' => $additional_attendee_reg_info |
228 | 227 | ) |
229 | 228 | ); |
@@ -236,22 +235,22 @@ discard block |
||
236 | 235 | * @param EE_Question_Group $question_group |
237 | 236 | * @return EE_Form_Section_Proper |
238 | 237 | */ |
239 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
238 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
240 | 239 | // array of params to pass to parent constructor |
241 | 240 | $form_args = array( |
242 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
241 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
243 | 242 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
244 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
243 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
245 | 244 | 'subsections' => array( |
246 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
245 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
247 | 246 | ), |
248 | 247 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
249 | 248 | ); |
250 | 249 | // where params |
251 | - $query_params = array( 'QST_deleted' => 0 ); |
|
250 | + $query_params = array('QST_deleted' => 0); |
|
252 | 251 | // don't load admin only questions on the frontend |
253 | - if ( ! $this->checkout->admin_request ) { |
|
254 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
252 | + if ( ! $this->checkout->admin_request) { |
|
253 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
255 | 254 | } |
256 | 255 | $questions = $question_group->get_many_related( |
257 | 256 | 'Question', |
@@ -263,21 +262,21 @@ discard block |
||
263 | 262 | ) |
264 | 263 | ); |
265 | 264 | // filter for additional content before questions |
266 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
265 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
267 | 266 | // loop thru questions |
268 | - foreach ( $questions as $question ) { |
|
269 | - if( $question instanceof EE_Question ){ |
|
267 | + foreach ($questions as $question) { |
|
268 | + if ($question instanceof EE_Question) { |
|
270 | 269 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
271 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
270 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
272 | 271 | } |
273 | 272 | } |
274 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
273 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
275 | 274 | |
276 | 275 | // filter for additional content after questions |
277 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
276 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
278 | 277 | // d( $form_args ); |
279 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
280 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
278 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
279 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
281 | 280 | } |
282 | 281 | |
283 | 282 | |
@@ -287,12 +286,12 @@ discard block |
||
287 | 286 | * @param EE_Question_Group $question_group |
288 | 287 | * @return EE_Form_Section_HTML |
289 | 288 | */ |
290 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
289 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
291 | 290 | $html = ''; |
292 | 291 | // group_name |
293 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
292 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
294 | 293 | EE_Registry::instance()->load_helper('HTML'); |
295 | - if ( $this->checkout->admin_request ) { |
|
294 | + if ($this->checkout->admin_request) { |
|
296 | 295 | $html .= EEH_HTML::br(); |
297 | 296 | $html .= EEH_HTML::h3( |
298 | 297 | $question_group->name(), |
@@ -306,7 +305,7 @@ discard block |
||
306 | 305 | } |
307 | 306 | } |
308 | 307 | // group_desc |
309 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
308 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
310 | 309 | $html .= EEH_HTML::p( |
311 | 310 | $question_group->desc(), |
312 | 311 | '', |
@@ -314,7 +313,7 @@ discard block |
||
314 | 313 | ); |
315 | 314 | |
316 | 315 | } |
317 | - return new EE_Form_Section_HTML( $html ); |
|
316 | + return new EE_Form_Section_HTML($html); |
|
318 | 317 | } |
319 | 318 | |
320 | 319 | |
@@ -323,14 +322,14 @@ discard block |
||
323 | 322 | * @access public |
324 | 323 | * @return EE_Form_Section_Proper |
325 | 324 | */ |
326 | - private function _copy_attendee_info_form(){ |
|
325 | + private function _copy_attendee_info_form() { |
|
327 | 326 | // array of params to pass to parent constructor |
328 | 327 | return new EE_Form_Section_Proper( |
329 | 328 | array( |
330 | 329 | 'subsections' => $this->_copy_attendee_info_inputs(), |
331 | 330 | 'layout_strategy' => new EE_Template_Layout( |
332 | 331 | array( |
333 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
332 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
334 | 333 | 'begin_template_file' => NULL, |
335 | 334 | 'input_template_file' => NULL, |
336 | 335 | 'subsection_template_file' => NULL, |
@@ -352,8 +351,8 @@ discard block |
||
352 | 351 | private function _auto_copy_attendee_info() { |
353 | 352 | return new EE_Form_Section_HTML( |
354 | 353 | EEH_Template::locate_template( |
355 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
356 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
354 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
355 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
357 | 356 | TRUE, |
358 | 357 | TRUE |
359 | 358 | ) |
@@ -372,25 +371,25 @@ discard block |
||
372 | 371 | $copy_attendee_info_inputs = array(); |
373 | 372 | $prev_ticket = NULL; |
374 | 373 | // grab the saved registrations from the transaction |
375 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
376 | - foreach ( $registrations as $registration ) { |
|
374 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
375 | + foreach ($registrations as $registration) { |
|
377 | 376 | // for all attendees other than the primary attendee |
378 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
377 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
379 | 378 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
380 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
379 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
381 | 380 | $item_name = $registration->ticket()->name(); |
382 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
383 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
384 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
381 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
382 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
383 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
385 | 384 | ); |
386 | 385 | $prev_ticket = $registration->ticket()->ID(); |
387 | 386 | } |
388 | 387 | |
389 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
388 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
390 | 389 | EE_Checkbox_Multi_Input( |
391 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
390 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
392 | 391 | array( |
393 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
392 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
394 | 393 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
395 | 394 | 'display_html_label_text' => FALSE |
396 | 395 | ) |
@@ -409,7 +408,7 @@ discard block |
||
409 | 408 | * @param EE_Registration $registration |
410 | 409 | * @return EE_Form_Input_Base |
411 | 410 | */ |
412 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
411 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
413 | 412 | // generate hidden input |
414 | 413 | return new EE_Hidden_Input( |
415 | 414 | array( |
@@ -427,31 +426,31 @@ discard block |
||
427 | 426 | * @param EE_Question $question |
428 | 427 | * @return EE_Form_Input_Base |
429 | 428 | */ |
430 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
429 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
431 | 430 | |
432 | 431 | // if this question was for an attendee detail, then check for that answer |
433 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
432 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
434 | 433 | $answer = $answer_value === null |
435 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
434 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
436 | 435 | : null; |
437 | 436 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
438 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
437 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
439 | 438 | // create an EE_Answer object for storing everything in |
440 | - $answer = EE_Answer::new_instance ( array( |
|
439 | + $answer = EE_Answer::new_instance(array( |
|
441 | 440 | 'QST_ID'=> $question->ID(), |
442 | 441 | 'REG_ID'=> $registration->ID() |
443 | 442 | )); |
444 | 443 | } |
445 | 444 | // verify instance |
446 | - if( $answer instanceof EE_Answer ){ |
|
447 | - if ( ! empty( $answer_value )) { |
|
448 | - $answer->set( 'ANS_value', $answer_value ); |
|
445 | + if ($answer instanceof EE_Answer) { |
|
446 | + if ( ! empty($answer_value)) { |
|
447 | + $answer->set('ANS_value', $answer_value); |
|
449 | 448 | } |
450 | - $answer->cache( 'Question', $question ); |
|
451 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
452 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
449 | + $answer->cache('Question', $question); |
|
450 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
451 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
453 | 452 | } |
454 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
453 | + return $this->_generate_question_input($registration, $question, $answer); |
|
455 | 454 | |
456 | 455 | } |
457 | 456 | |
@@ -463,7 +462,7 @@ discard block |
||
463 | 462 | * @param mixed EE_Answer|NULL $answer |
464 | 463 | * @return EE_Form_Input_Base |
465 | 464 | */ |
466 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
465 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
467 | 466 | // d( $registration ); |
468 | 467 | // d( $question ); |
469 | 468 | // d( $answer ); |
@@ -486,103 +485,103 @@ discard block |
||
486 | 485 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
487 | 486 | |
488 | 487 | $input_constructor_args = array( |
489 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
490 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
491 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
488 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
489 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
490 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
492 | 491 | 'required' => $question->required() ? TRUE : FALSE, |
493 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
492 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
494 | 493 | 'html_label_class' => 'ee-reg-qstn', |
495 | 494 | 'html_label_text' => $question->display_text(), |
496 | 495 | 'required_validation_error_message' => $question->required_text() |
497 | 496 | ); |
498 | 497 | // has this question been answered ? |
499 | - if ( $answer instanceof EE_Answer ) { |
|
500 | - if ( $answer->ID() ) { |
|
501 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
502 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
503 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
498 | + if ($answer instanceof EE_Answer) { |
|
499 | + if ($answer->ID()) { |
|
500 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
501 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
502 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
504 | 503 | } |
505 | 504 | $input_constructor_args['default'] = $answer->value(); |
506 | 505 | } |
507 | 506 | //add "-lbl" to the end of the label id |
508 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
509 | - $input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
507 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
508 | + $input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
510 | 509 | $input_constructor_args, |
511 | 510 | $registration, |
512 | 511 | $question, |
513 | 512 | $answer |
514 | 513 | ); |
515 | 514 | |
516 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
515 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
517 | 516 | |
518 | - switch ( $question->type() ) { |
|
517 | + switch ($question->type()) { |
|
519 | 518 | // Text |
520 | 519 | case EEM_Question::QST_type_text : |
521 | - if( $identifier == 'email' ){ |
|
522 | - return new EE_Email_Input( $input_constructor_args ); |
|
523 | - }else{ |
|
524 | - return new EE_Text_Input( $input_constructor_args ); |
|
520 | + if ($identifier == 'email') { |
|
521 | + return new EE_Email_Input($input_constructor_args); |
|
522 | + } else { |
|
523 | + return new EE_Text_Input($input_constructor_args); |
|
525 | 524 | } |
526 | 525 | break; |
527 | 526 | // Textarea |
528 | 527 | case EEM_Question::QST_type_textarea : |
529 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
528 | + return new EE_Text_Area_Input($input_constructor_args); |
|
530 | 529 | break; |
531 | 530 | // Radio Buttons |
532 | 531 | case EEM_Question::QST_type_radio : |
533 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
532 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
534 | 533 | break; |
535 | 534 | // Dropdown |
536 | 535 | case EEM_Question::QST_type_dropdown : |
537 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
536 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
538 | 537 | break; |
539 | 538 | // State Dropdown |
540 | 539 | case EEM_Question::QST_type_state : |
541 | - $state_options = array( '' => array( '' => '')); |
|
540 | + $state_options = array('' => array('' => '')); |
|
542 | 541 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
543 | - if ( ! empty( $states )) { |
|
544 | - foreach( $states as $state ){ |
|
545 | - if ( $state instanceof EE_State ) { |
|
546 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
542 | + if ( ! empty($states)) { |
|
543 | + foreach ($states as $state) { |
|
544 | + if ($state instanceof EE_State) { |
|
545 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
547 | 546 | } |
548 | 547 | } |
549 | 548 | } |
550 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
551 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
549 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
550 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
552 | 551 | break; |
553 | 552 | // Country Dropdown |
554 | 553 | case EEM_Question::QST_type_country : |
555 | - $country_options = array( '' => '' ); |
|
554 | + $country_options = array('' => ''); |
|
556 | 555 | // get possibly cached list of countries |
557 | 556 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
558 | - if ( ! empty( $countries )) { |
|
559 | - foreach( $countries as $country ){ |
|
560 | - if ( $country instanceof EE_Country ) { |
|
561 | - $country_options[ $country->ID() ] = $country->name(); |
|
557 | + if ( ! empty($countries)) { |
|
558 | + foreach ($countries as $country) { |
|
559 | + if ($country instanceof EE_Country) { |
|
560 | + $country_options[$country->ID()] = $country->name(); |
|
562 | 561 | } |
563 | 562 | } |
564 | 563 | } |
565 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
566 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
564 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
565 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
567 | 566 | break; |
568 | 567 | // Checkboxes |
569 | 568 | case EEM_Question::QST_type_checkbox : |
570 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
569 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
571 | 570 | break; |
572 | 571 | // Date |
573 | 572 | case EEM_Question::QST_type_date : |
574 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
573 | + return new EE_Datepicker_Input($input_constructor_args); |
|
575 | 574 | break; |
576 | 575 | case EEM_Question::QST_type_html_textarea : |
577 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
578 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
579 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
576 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
577 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
578 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
580 | 579 | return $input; |
581 | 580 | // fallback |
582 | 581 | default : |
583 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
584 | - if( ! $default_input ){ |
|
585 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
582 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
583 | + if ( ! $default_input) { |
|
584 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
586 | 585 | } |
587 | 586 | return $default_input; |
588 | 587 | } |
@@ -607,65 +606,65 @@ discard block |
||
607 | 606 | */ |
608 | 607 | public function process_reg_step() { |
609 | 608 | |
610 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
609 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
611 | 610 | // grab validated data from form |
612 | 611 | $valid_data = $this->checkout->current_step->valid_data(); |
613 | 612 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
614 | 613 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
615 | 614 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
616 | - if ( empty( $valid_data )) { |
|
617 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
615 | + if (empty($valid_data)) { |
|
616 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
618 | 617 | return FALSE; |
619 | 618 | } |
620 | 619 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
621 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
622 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
620 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
621 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
623 | 622 | return FALSE; |
624 | 623 | } |
625 | 624 | // get cached registrations |
626 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
625 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
627 | 626 | // verify we got the goods |
628 | - if ( empty( $registrations )) { |
|
629 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
627 | + if (empty($registrations)) { |
|
628 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
630 | 629 | return FALSE; |
631 | 630 | } |
632 | 631 | // extract attendee info from form data and save to model objects |
633 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
632 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
634 | 633 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
635 | - if ( $registrations_processed === FALSE ) { |
|
634 | + if ($registrations_processed === FALSE) { |
|
636 | 635 | // but return immediately if the previous step exited early due to errors |
637 | 636 | return FALSE; |
638 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
637 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
639 | 638 | // generate a correctly translated string for all possible singular/plural combinations |
640 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
639 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
641 | 640 | $error_msg = sprintf( |
642 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
641 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
643 | 642 | $this->checkout->total_ticket_count, |
644 | 643 | $registrations_processed |
645 | 644 | ); |
646 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
645 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
647 | 646 | $error_msg = sprintf( |
648 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
647 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
649 | 648 | $this->checkout->total_ticket_count, |
650 | 649 | $registrations_processed |
651 | 650 | ); |
652 | 651 | } else { |
653 | 652 | $error_msg = sprintf( |
654 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
653 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
655 | 654 | $this->checkout->total_ticket_count, |
656 | 655 | $registrations_processed |
657 | 656 | ); |
658 | 657 | |
659 | 658 | } |
660 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
659 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
661 | 660 | return FALSE; |
662 | 661 | } |
663 | 662 | // mark this reg step as completed |
664 | 663 | $this->checkout->current_step->set_completed(); |
665 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
664 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
666 | 665 | //do action in case a plugin wants to do something with the data submitted in step 1. |
667 | 666 | //passes EE_Single_Page_Checkout, and it's posted data |
668 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
667 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
669 | 668 | return TRUE; |
670 | 669 | |
671 | 670 | } |
@@ -679,9 +678,9 @@ discard block |
||
679 | 678 | * @param array $valid_data |
680 | 679 | * @return boolean | int |
681 | 680 | */ |
682 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
681 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
683 | 682 | // load resources and set some defaults |
684 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
683 | + EE_Registry::instance()->load_model('Attendee'); |
|
685 | 684 | // holder for primary registrant attendee object |
686 | 685 | $this->checkout->primary_attendee_obj = NULL; |
687 | 686 | // array for tracking reg form data for the primary registrant |
@@ -698,19 +697,19 @@ discard block |
||
698 | 697 | // attendee counter |
699 | 698 | $att_nmbr = 0; |
700 | 699 | // grab the saved registrations from the transaction |
701 | - foreach ( $registrations as $registration ) { |
|
700 | + foreach ($registrations as $registration) { |
|
702 | 701 | // verify EE_Registration object |
703 | - if ( ! $registration instanceof EE_Registration ) { |
|
704 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
702 | + if ( ! $registration instanceof EE_Registration) { |
|
703 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
705 | 704 | return FALSE; |
706 | 705 | } |
707 | 706 | $reg_url_link = $registration->reg_url_link(); |
708 | 707 | // reg_url_link exists ? |
709 | - if ( $reg_url_link ) { |
|
708 | + if ($reg_url_link) { |
|
710 | 709 | // should this registration be processed during this visit ? |
711 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
710 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
712 | 711 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
713 | - if ( ! $this->checkout->revisit ) { |
|
712 | + if ( ! $this->checkout->revisit) { |
|
714 | 713 | $registration->save(); |
715 | 714 | } |
716 | 715 | |
@@ -721,41 +720,41 @@ discard block |
||
721 | 720 | * @var bool if TRUE is returned by the plugin then the |
722 | 721 | * registration processing is halted. |
723 | 722 | */ |
724 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
723 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
725 | 724 | return FALSE; |
726 | 725 | } |
727 | 726 | |
728 | 727 | // Houston, we have a registration! |
729 | 728 | $att_nmbr++; |
730 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
729 | + $this->_attendee_data[$reg_url_link] = array(); |
|
731 | 730 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
732 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
731 | + if (isset($valid_data[$reg_url_link])) { |
|
733 | 732 | // do we need to copy basic info from primary attendee ? |
734 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
733 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
735 | 734 | // filter form input data for this registration |
736 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
735 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
737 | 736 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
738 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
739 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
740 | - unset( $valid_data['primary_attendee'] ); |
|
737 | + if (isset($valid_data['primary_attendee'])) { |
|
738 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
739 | + unset($valid_data['primary_attendee']); |
|
741 | 740 | } |
742 | 741 | // now loop through our array of valid post data && process attendee reg forms |
743 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
744 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
745 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
742 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
743 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
744 | + foreach ($form_inputs as $form_input => $input_value) { |
|
746 | 745 | // check for critical inputs |
747 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
746 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
748 | 747 | return FALSE; |
749 | 748 | } |
750 | 749 | // store a bit of data about the primary attendee |
751 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
752 | - $primary_registrant[ $form_input ] = $input_value; |
|
753 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
754 | - $input_value = $primary_registrant[ $form_input ]; |
|
750 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
751 | + $primary_registrant[$form_input] = $input_value; |
|
752 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
753 | + $input_value = $primary_registrant[$form_input]; |
|
755 | 754 | } |
756 | 755 | // now attempt to save the input data |
757 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
758 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
756 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
757 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
759 | 758 | return FALSE; |
760 | 759 | } |
761 | 760 | } |
@@ -764,51 +763,51 @@ discard block |
||
764 | 763 | } |
765 | 764 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
766 | 765 | // this registration does not require additional attendee information ? |
767 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
766 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
768 | 767 | // just copy the primary registrant |
769 | 768 | $attendee = $this->checkout->primary_attendee_obj; |
770 | 769 | } else { |
771 | 770 | // have we met before? |
772 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
771 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
773 | 772 | // did we find an already existing record for this attendee ? |
774 | - if ( $attendee instanceof EE_Attendee ) { |
|
775 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
773 | + if ($attendee instanceof EE_Attendee) { |
|
774 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
776 | 775 | } else { |
777 | 776 | // ensure critical details are set for additional attendees |
778 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
779 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
777 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
778 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
780 | 779 | } |
781 | 780 | // who's #1 ? |
782 | - if ( $att_nmbr == 1 ) { |
|
781 | + if ($att_nmbr == 1) { |
|
783 | 782 | $this->checkout->primary_attendee_obj = $attendee; |
784 | 783 | } |
785 | 784 | } |
786 | 785 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
787 | 786 | // add relation to registration, set attendee ID, and cache attendee |
788 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
789 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
790 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
787 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
788 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
789 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
791 | 790 | return FALSE; |
792 | 791 | } |
793 | 792 | /** @type EE_Registration_Processor $registration_processor */ |
794 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
793 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
795 | 794 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
796 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
795 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
797 | 796 | /** @type EE_Transaction_Processor $transaction_processor */ |
798 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
797 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
799 | 798 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
800 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
799 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
801 | 800 | // if we've gotten this far, then let's save what we have |
802 | 801 | $registration->save(); |
803 | 802 | // add relation between TXN and registration |
804 | - $this->_associate_registration_with_transaction( $registration ); |
|
803 | + $this->_associate_registration_with_transaction($registration); |
|
805 | 804 | |
806 | 805 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
807 | 806 | |
808 | - } else { |
|
809 | - 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__ ); |
|
807 | + } else { |
|
808 | + 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__); |
|
810 | 809 | // remove malformed data |
811 | - unset( $valid_data[ $reg_url_link ] ); |
|
810 | + unset($valid_data[$reg_url_link]); |
|
812 | 811 | return FALSE; |
813 | 812 | } |
814 | 813 | |
@@ -826,22 +825,22 @@ discard block |
||
826 | 825 | * @param string $input_value |
827 | 826 | * @return boolean |
828 | 827 | */ |
829 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
828 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
830 | 829 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
831 | 830 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
832 | 831 | // allow for plugins to hook in and do their own processing of the form input. |
833 | 832 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
834 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
833 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
835 | 834 | return TRUE; |
836 | 835 | } |
837 | 836 | |
838 | 837 | // grab related answer objects |
839 | 838 | $answers = $registration->answers(); |
840 | 839 | // $answer_cache_id is the key used to find the EE_Answer we want |
841 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
842 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
840 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
841 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
843 | 842 | //rename form_inputs if they are EE_Attendee properties |
844 | - switch( (string)$form_input ) { |
|
843 | + switch ((string) $form_input) { |
|
845 | 844 | |
846 | 845 | case 'state' : |
847 | 846 | case 'STA_ID' : |
@@ -856,33 +855,33 @@ discard block |
||
856 | 855 | break; |
857 | 856 | |
858 | 857 | default : |
859 | - $ATT_input = 'ATT_' . $form_input; |
|
858 | + $ATT_input = 'ATT_'.$form_input; |
|
860 | 859 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
861 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
862 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
860 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
861 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
863 | 862 | } |
864 | 863 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
865 | 864 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
866 | 865 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
867 | 866 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
868 | 867 | // if this form input has a corresponding attendee property |
869 | - if ( $attendee_property ) { |
|
870 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
871 | - if ( $answer_is_obj ) { |
|
868 | + if ($attendee_property) { |
|
869 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
870 | + if ($answer_is_obj) { |
|
872 | 871 | // and delete the corresponding answer since we won't be storing this data in that object |
873 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
874 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
872 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
873 | + $answers[$answer_cache_id]->delete_permanently(); |
|
875 | 874 | } |
876 | 875 | return TRUE; |
877 | - } elseif ( $answer_is_obj ) { |
|
876 | + } elseif ($answer_is_obj) { |
|
878 | 877 | // save this data to the answer object |
879 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
880 | - $result = $answers[ $answer_cache_id ]->save(); |
|
878 | + $answers[$answer_cache_id]->set_value($input_value); |
|
879 | + $result = $answers[$answer_cache_id]->save(); |
|
881 | 880 | return $result !== false ? true : false; |
882 | 881 | } else { |
883 | - foreach ( $answers as $answer ) { |
|
884 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
885 | - $answer->set_value( $input_value ); |
|
882 | + foreach ($answers as $answer) { |
|
883 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
884 | + $answer->set_value($input_value); |
|
886 | 885 | $result = $answer->save(); |
887 | 886 | return $result !== false ? true : false; |
888 | 887 | } |
@@ -900,33 +899,33 @@ discard block |
||
900 | 899 | * @param string $input_value |
901 | 900 | * @return boolean |
902 | 901 | */ |
903 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
904 | - if ( empty( $input_value )) { |
|
902 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
903 | + if (empty($input_value)) { |
|
905 | 904 | // if the form input isn't marked as being required, then just return |
906 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
905 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
907 | 906 | return true; |
908 | 907 | } |
909 | - switch( $form_input ) { |
|
908 | + switch ($form_input) { |
|
910 | 909 | case 'fname' : |
911 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
910 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
912 | 911 | return FALSE; |
913 | 912 | break; |
914 | 913 | case 'lname' : |
915 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
914 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
916 | 915 | return FALSE; |
917 | 916 | break; |
918 | 917 | case 'email' : |
919 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
918 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
920 | 919 | return FALSE; |
921 | 920 | break; |
922 | 921 | } |
923 | - } else if ( $form_input === 'email' ) { |
|
922 | + } else if ($form_input === 'email') { |
|
924 | 923 | // clean the email address |
925 | - $valid_email = sanitize_email( $input_value ); |
|
924 | + $valid_email = sanitize_email($input_value); |
|
926 | 925 | // check if it matches |
927 | - if ( $input_value != $valid_email ) { |
|
926 | + if ($input_value != $valid_email) { |
|
928 | 927 | // whoops!!! |
929 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
928 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
930 | 929 | return FALSE; |
931 | 930 | } |
932 | 931 | } |
@@ -954,14 +953,14 @@ discard block |
||
954 | 953 | * @param array $attendee_data |
955 | 954 | * @return boolean |
956 | 955 | */ |
957 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
956 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
958 | 957 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
959 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
960 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
961 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
958 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
959 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
960 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
962 | 961 | // but only if those have values |
963 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
964 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
962 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
963 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
965 | 964 | 'ATT_fname' => $ATT_fname, |
966 | 965 | 'ATT_lname' => $ATT_lname, |
967 | 966 | 'ATT_email' => $ATT_email |
@@ -969,7 +968,7 @@ discard block |
||
969 | 968 | } else { |
970 | 969 | $existing_attendee = NULL; |
971 | 970 | } |
972 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
971 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
973 | 972 | } |
974 | 973 | |
975 | 974 | |
@@ -981,13 +980,13 @@ discard block |
||
981 | 980 | * @param array $attendee_data |
982 | 981 | * @return \EE_Attendee |
983 | 982 | */ |
984 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
983 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
985 | 984 | // first remove fname, lname, and email from attendee data |
986 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
985 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
987 | 986 | // now loop thru what's left and add to attendee CPT |
988 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
989 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
990 | - $existing_attendee->set( $property_name, $property_value ); |
|
987 | + foreach ($attendee_data as $property_name => $property_value) { |
|
988 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
989 | + $existing_attendee->set($property_name, $property_value); |
|
991 | 990 | } |
992 | 991 | } |
993 | 992 | // better save that now |
@@ -1004,11 +1003,11 @@ discard block |
||
1004 | 1003 | * @param EE_Attendee $attendee |
1005 | 1004 | * @return void |
1006 | 1005 | */ |
1007 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1006 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1008 | 1007 | // add relation to attendee |
1009 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1010 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1011 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1008 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1009 | + $registration->set_attendee_id($attendee->ID()); |
|
1010 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1012 | 1011 | } |
1013 | 1012 | |
1014 | 1013 | |
@@ -1019,10 +1018,10 @@ discard block |
||
1019 | 1018 | * @param EE_Registration $registration |
1020 | 1019 | * @return void |
1021 | 1020 | */ |
1022 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1021 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1023 | 1022 | // add relation to attendee |
1024 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1025 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1023 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1024 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1026 | 1025 | } |
1027 | 1026 | |
1028 | 1027 | |
@@ -1034,17 +1033,17 @@ discard block |
||
1034 | 1033 | * @param array $attendee_data |
1035 | 1034 | * @return array |
1036 | 1035 | */ |
1037 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1036 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1038 | 1037 | // bare minimum critical details include first name, last name, email address |
1039 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1038 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1040 | 1039 | // add address info to critical details? |
1041 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1042 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1043 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1040 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1041 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1042 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1044 | 1043 | } |
1045 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1046 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1047 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1044 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1045 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1046 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1048 | 1047 | } |
1049 | 1048 | } |
1050 | 1049 | return $attendee_data; |
@@ -1059,11 +1058,11 @@ discard block |
||
1059 | 1058 | * @param array $attendee_data |
1060 | 1059 | * @return \EE_Attendee |
1061 | 1060 | */ |
1062 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1061 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1063 | 1062 | // create new attendee object |
1064 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1063 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1065 | 1064 | // set author to event creator |
1066 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1065 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1067 | 1066 | $new_attendee->save(); |
1068 | 1067 | return $new_attendee; |
1069 | 1068 | } |
@@ -1079,7 +1078,7 @@ discard block |
||
1079 | 1078 | */ |
1080 | 1079 | public function update_reg_step() { |
1081 | 1080 | // save everything |
1082 | - if ( $this->process_reg_step() ) { |
|
1081 | + if ($this->process_reg_step()) { |
|
1083 | 1082 | $this->checkout->redirect = TRUE; |
1084 | 1083 | $this->checkout->redirect_url = add_query_arg( |
1085 | 1084 | array( |
@@ -1088,7 +1087,7 @@ discard block |
||
1088 | 1087 | ), |
1089 | 1088 | $this->checkout->thank_you_page_url |
1090 | 1089 | ); |
1091 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1090 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1092 | 1091 | return TRUE; |
1093 | 1092 | } |
1094 | 1093 | return FALSE; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * _auto_copy_attendee_info |
349 | 349 | * |
350 | 350 | * @access public |
351 | - * @return EE_Form_Section_Proper |
|
351 | + * @return EE_Form_Section_HTML |
|
352 | 352 | */ |
353 | 353 | private function _auto_copy_attendee_info() { |
354 | 354 | return new EE_Form_Section_HTML( |
@@ -462,6 +462,7 @@ discard block |
||
462 | 462 | * @param EE_Registration $registration |
463 | 463 | * @param EE_Question $question |
464 | 464 | * @param mixed EE_Answer|NULL $answer |
465 | + * @param EE_Answer $answer |
|
465 | 466 | * @return EE_Form_Input_Base |
466 | 467 | */ |
467 | 468 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <p class="spco-attendee-info-not-required-pg smaller-text lt-grey-text"> |
2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __( 'This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso' ));?> |
|
2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_info_not_required_pg', __('This ticket type does not require any information for additional attendees, so attendee #1\'s information will be used for its registration purposes.', 'event_espresso')); ?> |
|
3 | 3 | </p> |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text"> |
2 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso' ));?> |
|
2 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__auto_copy_attendee_pg', __('The above information will be used for any additional tickets/attendees.', 'event_espresso')); ?> |
|
3 | 3 | </p> |
4 | 4 | \ No newline at end of file |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <div id="spco-copy-attendee-dv" class="hide-if-no-js"> |
2 | 2 | |
3 | 3 | <p class="spco-copy-all-attendee-pg"> |
4 | - <label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso');?> |
|
4 | + <label class="ee-checkbox-label-before ee-checkbox-label-wide"><?php _e('Use Attendee #1\'s information for ALL attendees', 'event_espresso'); ?> |
|
5 | 5 | <input id="spco-copy-all-attendee-chk" class="spco-copy-all-attendee-chk ee-do-not-validate" type="checkbox" value="copy-all"> |
6 | 6 | </label> |
7 | 7 | </p> |
8 | 8 | |
9 | - <p class="spco-copy-attendee-pg"><?php echo apply_filters( 'FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf( __('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>' )); ?></p> |
|
9 | + <p class="spco-copy-attendee-pg"><?php echo apply_filters('FHEE__registration_page_attendee_information__copy_attendee_pg', sprintf(__('This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.', 'event_espresso'), '<strong>', '</strong>')); ?></p> |
|
10 | 10 | |
11 | - <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php _e('advanced copy options', 'event_espresso');?></a> |
|
12 | - <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso');?></a> |
|
11 | + <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right" rel="more-attendee-copy-options" ><span class="dashicons dashicons-arrow-right"></span><?php _e('advanced copy options', 'event_espresso'); ?></a> |
|
12 | + <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right" rel="more-attendee-copy-options" style="display: none;"><span class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso'); ?></a> |
|
13 | 13 | |
14 | 14 | <div id="more-attendee-copy-options-dv" class="" style="display: none;"> |
15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <?php _e('Only copy the above information to the following selected additional attendees.', 'event_espresso'); ?> |
18 | 18 | </p> |
19 | 19 | |
20 | - <?php foreach ( $spco_copy_attendee_chk as $spco_copy_chk ) { echo $spco_copy_chk; } ?> |
|
20 | + <?php foreach ($spco_copy_attendee_chk as $spco_copy_chk) { echo $spco_copy_chk; } ?> |
|
21 | 21 | |
22 | 22 | </div> |
23 | 23 | <div class="clear-float"></div> |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
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_Finalize_Registration |
|
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_Finalize_Registration extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param EE_Checkout $checkout |
21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
22 | 22 | */ |
23 | - public function __construct( EE_Checkout $checkout ) { |
|
23 | + public function __construct(EE_Checkout $checkout) { |
|
24 | 24 | $this->_slug = 'finalize_registration'; |
25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function initialize_reg_step() { |
48 | 48 | |
49 | 49 | // there's actually no reg form to process if this is the final step |
50 | - if ( $this->is_current_step() ) { |
|
50 | + if ($this->is_current_step()) { |
|
51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
52 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
53 | 53 | $this->checkout->generate_reg_form = false; |
54 | 54 | } |
55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function process_reg_step() { |
74 | 74 | // ensure all data gets refreshed from the db |
75 | - $this->checkout->refresh_all_entities( true ); |
|
75 | + $this->checkout->refresh_all_entities(true); |
|
76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
78 | 78 | // DEBUG LOG |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | // ) |
87 | 87 | //); |
88 | 88 | // set a hook point |
89 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
89 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
90 | 90 | // check if transaction has a primary registrant and that it has a related Attendee object |
91 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
91 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
92 | 92 | // setup URL for redirect |
93 | 93 | $this->checkout->redirect_url = add_query_arg( |
94 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
94 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
95 | 95 | $this->checkout->thank_you_page_url |
96 | 96 | ); |
97 | 97 | } else { |
98 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
99 | 99 | $this->checkout->redirect = false; |
100 | 100 | $this->checkout->continue_reg = false; |
101 | 101 | return false; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | // you don't have to go home but you can't stay here ! |
104 | 104 | $this->checkout->redirect = true; |
105 | 105 | $this->checkout->continue_reg = true; |
106 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
107 | - if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) { |
|
106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | + if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) { |
|
108 | 108 | // mark this reg step as completed |
109 | 109 | $this->checkout->current_step->set_completed(); |
110 | 110 | } |
@@ -121,43 +121,43 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _finalize_transaction() { |
123 | 123 | /** @type EE_Transaction_Processor $transaction_processor */ |
124 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
124 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
125 | 125 | //set revisit flag in txn processor |
126 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
126 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
127 | 127 | // at this point we'll consider a TXN to not have been abandoned |
128 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
129 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
128 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
129 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
130 | 130 | // save TXN data to the cart |
131 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
131 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
132 | 132 | } |
133 | 133 | /** @type EE_Transaction_Payments $transaction_payments */ |
134 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
134 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
135 | 135 | // maybe update status, but don't save transaction just yet |
136 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
136 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
137 | 137 | // If the selected method of payment used an off-site gateway... |
138 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
139 | - $is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ); |
|
140 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
141 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
142 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
138 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
139 | + $is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN); |
|
140 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
141 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
142 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
143 | 143 | // do NOT trigger notifications because it was already done during the IPN |
144 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
145 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
146 | - } else if ( ! $is_revisit ) { |
|
147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
144 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
145 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
146 | + } else if ( ! $is_revisit) { |
|
147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
148 | 148 | } |
149 | 149 | } else if ( |
150 | 150 | // if SPCO revisit and TXN status has changed due to a payment |
151 | - $is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() ) |
|
151 | + $is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated()) |
|
152 | 152 | ) { |
153 | 153 | // send out notifications |
154 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
155 | - } else if ( ! $is_revisit ) { |
|
156 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
154 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
155 | + } else if ( ! $is_revisit) { |
|
156 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | // this will result in the base session properties getting saved to the TXN_Session_data field |
160 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
160 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
161 | 161 | |
162 | 162 | // update the TXN if payment conditions have changed |
163 | 163 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return boolean |
175 | 175 | */ |
176 | 176 | public function update_reg_step() { |
177 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
177 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Applies all teh individual item validation strategies on each item in the array |
29 | 29 | * @param array $normalized_value |
30 | - * @return boolean |
|
30 | + * @return boolean|null |
|
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | 33 | if( is_array($normalized_value)){ |
@@ -1,12 +1,12 @@ |
||
1 | 1 | |
2 | - <h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso');?></span></h4> |
|
2 | + <h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso'); ?></span></h4> |
|
3 | 3 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
4 | 4 | <?php echo $events_requiring_pre_approval_msg; ?> |
5 | 5 | </p> |
6 | 6 | <ul id="spco-pre-approval-events-ul"><?php echo $events_requiring_pre_approval; ?></ul> |
7 | 7 | |
8 | - <?php echo $default_hidden_inputs; ?> |
|
9 | - <?php echo $extra_hidden_inputs; ?> |
|
8 | + <?php echo $default_hidden_inputs; ?> |
|
9 | + <?php echo $extra_hidden_inputs; ?> |
|
10 | 10 | |
11 | 11 | <!-- <input id="reg-page-selected-method-of-payment" type="hidden" value="payments_closed" name="selected_method_of_payment">--> |
12 | 12 | <!-- <input type="hidden" id="reg-page-no-payment-required-payment_options" name="_reg-page-no-payment-required" value="1" />--> |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | -if( is_array( $registrations_for_free_events ) && ! empty( $registrations_for_free_events ) ) { |
|
2 | +if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) { |
|
3 | 3 | echo apply_filters( |
4 | 4 | 'FHEE__registration_page_payment_options__no_payment_required_hdr', |
5 | 5 | sprintf( |
6 | - __( '%1$sNo Payment Required%2$s', 'event_espresso' ), |
|
6 | + __('%1$sNo Payment Required%2$s', 'event_espresso'), |
|
7 | 7 | '<h6>', |
8 | 8 | '</h6>' |
9 | 9 | ) |
10 | 10 | ); |
11 | - foreach ( $registrations_for_free_events as $registration_for_free_event ) { |
|
12 | - if ( $registration_for_free_event instanceof EE_Registration && $registration_for_free_event->ticket()->is_free() ) { |
|
13 | - if ( $registration_for_free_event->event() instanceof EE_Event ) { |
|
11 | + foreach ($registrations_for_free_events as $registration_for_free_event) { |
|
12 | + if ($registration_for_free_event instanceof EE_Registration && $registration_for_free_event->ticket()->is_free()) { |
|
13 | + if ($registration_for_free_event->event() instanceof EE_Event) { |
|
14 | 14 | ?> |
15 | 15 | <p> |
16 | 16 | <?php echo apply_filters( |
17 | 17 | 'FHEE__registration_page_payment_options__no_payment_required_pg', |
18 | 18 | sprintf( |
19 | - __( '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', 'event_espresso' ), |
|
19 | + __('"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', 'event_espresso'), |
|
20 | 20 | $registration_for_free_event->ticket()->name(), |
21 | 21 | $registration_for_free_event->event()->name() |
22 | 22 | ) |
@@ -1,10 +1,10 @@ |
||
1 | 1 | |
2 | - <h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
2 | + <h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
3 | 3 | <ul id="spco-sold-out-events-ul"><?php echo $sold_out_events; ?></ul> |
4 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
4 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
5 | 5 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
6 | 6 | <?php echo $sold_out_events_msg; ?> |
7 | 7 | </p> |
8 | 8 | |
9 | - <?php echo $default_hidden_inputs; ?> |
|
10 | - <?php echo $extra_hidden_inputs; ?> |
|
9 | + <?php echo $default_hidden_inputs; ?> |
|
10 | + <?php echo $extra_hidden_inputs; ?> |