|
@@ -1,6 +1,6 @@ discard block |
|
|
block discarded – undo |
|
1
|
1
|
<?php |
|
2
|
|
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3
|
|
- exit( 'No direct script access allowed' ); |
|
|
2
|
+if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
|
3
|
+ exit('No direct script access allowed'); |
|
4
|
4
|
} |
|
5
|
5
|
|
|
6
|
6
|
/** |
|
@@ -14,31 +14,31 @@ discard block |
|
|
block discarded – undo |
|
14
|
14
|
* @author Mike Nelson |
|
15
|
15
|
* |
|
16
|
16
|
*/ |
|
17
|
|
-class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{ |
|
|
17
|
+class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form { |
|
18
|
18
|
|
|
19
|
19
|
/** |
|
20
|
20
|
* |
|
21
|
21
|
* @param EE_Payment_Method $payment_method |
|
22
|
22
|
* @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
23
|
23
|
*/ |
|
24
|
|
- public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
|
24
|
+ public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
25
|
25
|
$options_array['subsections'] = array_merge( |
|
26
|
26
|
array( |
|
27
|
|
- 'first_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ), |
|
28
|
|
- 'last_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ), |
|
29
|
|
- 'email' => new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ), |
|
30
|
|
- 'address' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )), |
|
31
|
|
- 'address2' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )), |
|
32
|
|
- 'city' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ), |
|
33
|
|
- 'state' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ), |
|
34
|
|
- 'country' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ), |
|
35
|
|
- 'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ), |
|
36
|
|
- 'phone' => new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )), |
|
|
27
|
+ 'first_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))), |
|
|
28
|
+ 'last_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))), |
|
|
29
|
+ 'email' => new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))), |
|
|
30
|
+ 'address' => new EE_Text_Input(array('html_label_text'=> __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')), |
|
|
31
|
+ 'address2' => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')), |
|
|
32
|
+ 'city' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))), |
|
|
33
|
+ 'state' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))), |
|
|
34
|
+ 'country' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))), |
|
|
35
|
+ 'zip' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))), |
|
|
36
|
+ 'phone' => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))), |
|
37
|
37
|
), |
|
38
|
|
- isset( $options_array['subsections'] ) ? $options_array['subsections'] : array() |
|
|
38
|
+ isset($options_array['subsections']) ? $options_array['subsections'] : array() |
|
39
|
39
|
); |
|
40
|
40
|
|
|
41
|
|
- parent::__construct( $payment_method, $options_array ); |
|
|
41
|
+ parent::__construct($payment_method, $options_array); |
|
42
|
42
|
|
|
43
|
43
|
} |
|
44
|
44
|
|
|
@@ -46,11 +46,11 @@ discard block |
|
|
block discarded – undo |
|
46
|
46
|
* Sets the defaults for the billing form according to the attendee's details |
|
47
|
47
|
* @param EE_Attendee $attendee |
|
48
|
48
|
*/ |
|
49
|
|
- public function populate_from_attendee( $attendee ){ |
|
|
49
|
+ public function populate_from_attendee($attendee) { |
|
50
|
50
|
$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
|
51
|
51
|
/** @var $attendee EE_Attendee */ |
|
52
|
52
|
$this->populate_defaults( |
|
53
|
|
- apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
|
53
|
+ apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
54
|
54
|
array( |
|
55
|
55
|
'first_name'=>$attendee->fname(), |
|
56
|
56
|
'last_name'=>$attendee->lname(), |
|
@@ -78,48 +78,48 @@ discard block |
|
|
block discarded – undo |
|
78
|
78
|
* @param \EE_Attendee $attendee - the attendee object to copy details to |
|
79
|
79
|
* @return \EE_Attendee |
|
80
|
80
|
*/ |
|
81
|
|
- public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){ |
|
|
81
|
+ public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) { |
|
82
|
82
|
// grab billing form data |
|
83
|
83
|
$data = $this->valid_data(); |
|
84
|
84
|
// copy first_name |
|
85
|
|
- if ( ! empty( $data['first_name'] )) { |
|
86
|
|
- $attendee->set_fname( $data['first_name'] ); |
|
|
85
|
+ if ( ! empty($data['first_name'])) { |
|
|
86
|
+ $attendee->set_fname($data['first_name']); |
|
87
|
87
|
} |
|
88
|
88
|
// copy last_name |
|
89
|
|
- if ( ! empty( $data['last_name'] )) { |
|
90
|
|
- $attendee->set_lname( $data['last_name'] ); |
|
|
89
|
+ if ( ! empty($data['last_name'])) { |
|
|
90
|
+ $attendee->set_lname($data['last_name']); |
|
91
|
91
|
} |
|
92
|
92
|
// copy email |
|
93
|
|
- if ( ! empty( $data['email'] )) { |
|
94
|
|
- $attendee->set_email( $data['email'] ); |
|
|
93
|
+ if ( ! empty($data['email'])) { |
|
|
94
|
+ $attendee->set_email($data['email']); |
|
95
|
95
|
} |
|
96
|
96
|
// copy address |
|
97
|
|
- if ( ! empty( $data['address'] )) { |
|
98
|
|
- $attendee->set_address( $data['address'] ); |
|
|
97
|
+ if ( ! empty($data['address'])) { |
|
|
98
|
+ $attendee->set_address($data['address']); |
|
99
|
99
|
} |
|
100
|
100
|
// copy address2 |
|
101
|
|
- if ( ! empty( $data['address2'] )) { |
|
102
|
|
- $attendee->set_address2( $data['address2'] ); |
|
|
101
|
+ if ( ! empty($data['address2'])) { |
|
|
102
|
+ $attendee->set_address2($data['address2']); |
|
103
|
103
|
} |
|
104
|
104
|
// copy city |
|
105
|
|
- if ( ! empty( $data['city'] )) { |
|
106
|
|
- $attendee->set_city( $data['city'] ); |
|
|
105
|
+ if ( ! empty($data['city'])) { |
|
|
106
|
+ $attendee->set_city($data['city']); |
|
107
|
107
|
} |
|
108
|
108
|
// copy state |
|
109
|
|
- if ( ! empty( $data['state'] )) { |
|
110
|
|
- $attendee->set_state( $data['state'] ); |
|
|
109
|
+ if ( ! empty($data['state'])) { |
|
|
110
|
+ $attendee->set_state($data['state']); |
|
111
|
111
|
} |
|
112
|
112
|
// copy country |
|
113
|
|
- if ( ! empty( $data['country'] )) { |
|
114
|
|
- $attendee->set_country( $data['country'] ); |
|
|
113
|
+ if ( ! empty($data['country'])) { |
|
|
114
|
+ $attendee->set_country($data['country']); |
|
115
|
115
|
} |
|
116
|
116
|
// copy zip |
|
117
|
|
- if ( ! empty( $data['zip'] )) { |
|
118
|
|
- $attendee->set_zip( $data['zip'] ); |
|
|
117
|
+ if ( ! empty($data['zip'])) { |
|
|
118
|
+ $attendee->set_zip($data['zip']); |
|
119
|
119
|
} |
|
120
|
120
|
// copy phone |
|
121
|
|
- if ( ! empty( $data['phone'] )) { |
|
122
|
|
- $attendee->set_phone( $data['phone'] ); |
|
|
121
|
+ if ( ! empty($data['phone'])) { |
|
|
122
|
+ $attendee->set_phone($data['phone']); |
|
123
|
123
|
} |
|
124
|
124
|
return $attendee; |
|
125
|
125
|
} |
|
@@ -130,20 +130,20 @@ discard block |
|
|
block discarded – undo |
|
130
|
130
|
* uses info from the billing form to create a new attendee |
|
131
|
131
|
* @return \EE_Attendee |
|
132
|
132
|
*/ |
|
133
|
|
- public function create_attendee_from_billing_form_data(){ |
|
|
133
|
+ public function create_attendee_from_billing_form_data() { |
|
134
|
134
|
// grab billing form data |
|
135
|
135
|
$data = $this->valid_data(); |
|
136
|
|
- return EE_Attendee::new_instance( array( |
|
137
|
|
- 'ATT_fname' => ! empty( $data['first_name'] ) ? $data['first_name'] : '', |
|
138
|
|
- 'ATT_lname' => ! empty( $data['last_name'] ) ? $data['last_name'] : '', |
|
139
|
|
- 'ATT_email' => ! empty( $data['email'] ) ? $data['email'] : '', |
|
140
|
|
- 'ATT_address' => ! empty( $data['address'] ) ? $data['address'] : '', |
|
141
|
|
- 'ATT_address2' => ! empty( $data['address2'] ) ? $data['address2'] : '', |
|
142
|
|
- 'ATT_city' => ! empty( $data['city'] ) ? $data['city'] : '', |
|
143
|
|
- 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : '', |
|
144
|
|
- 'CNT_ISO' => ! empty( $data['country'] ) ? $data['country'] : '', |
|
145
|
|
- 'ATT_zip' => ! empty( $data['zip'] ) ? $data['zip'] : '', |
|
146
|
|
- 'ATT_phone' => ! empty( $data['phone'] ) ? $data['phone'] : '', |
|
|
136
|
+ return EE_Attendee::new_instance(array( |
|
|
137
|
+ 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
|
138
|
+ 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
|
139
|
+ 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
|
140
|
+ 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
|
141
|
+ 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
|
142
|
+ 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
|
143
|
+ 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
|
144
|
+ 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
|
145
|
+ 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
|
146
|
+ 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
147
|
147
|
)); |
|
148
|
148
|
} |
|
149
|
149
|
} |