Completed
Branch FET/variable-state-input-value... (5e0aa4)
by
unknown
73:20 queued 64:42
created
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 2 patches
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -14,168 +14,168 @@
 block discarded – undo
14 14
 class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form
15 15
 {
16 16
 
17
-    /**
18
-     *
19
-     * @param EE_Payment_Method $payment_method
20
-     * @param array $options_array @see EE_Form_Section_Proper::__construct()
21
-     */
22
-    public function __construct(EE_Payment_Method $payment_method, $options_array = array())
23
-    {
24
-        $options_array['subsections'] = array_merge(
25
-            array(
26
-                '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') )),
27
-                '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') )),
28
-                'email'             => new EE_Email_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso') )),
29
-                'address'           => new EE_Text_Input(array( 'html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
30
-                'address2'      => new EE_Text_Input(array( 'html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
31
-                'city'                  => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso') )),
32
-                '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') ))),
33
-                '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') ))),
34
-                'zip'                   => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso') )),
35
-                'phone'         => new EE_Text_Input(array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso') )),
36
-            ),
37
-            isset($options_array['subsections']) ? $options_array['subsections'] : array()
38
-        );
17
+	/**
18
+	 *
19
+	 * @param EE_Payment_Method $payment_method
20
+	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
21
+	 */
22
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array())
23
+	{
24
+		$options_array['subsections'] = array_merge(
25
+			array(
26
+				'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') )),
27
+				'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') )),
28
+				'email'             => new EE_Email_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso') )),
29
+				'address'           => new EE_Text_Input(array( 'html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
30
+				'address2'      => new EE_Text_Input(array( 'html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
31
+				'city'                  => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso') )),
32
+				'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') ))),
33
+				'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') ))),
34
+				'zip'                   => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso') )),
35
+				'phone'         => new EE_Text_Input(array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso') )),
36
+			),
37
+			isset($options_array['subsections']) ? $options_array['subsections'] : array()
38
+		);
39 39
 
40
-        parent::__construct($payment_method, $options_array);
41
-    }
40
+		parent::__construct($payment_method, $options_array);
41
+	}
42 42
 
43
-    /**
44
-     * Sets the defaults for the billing form according to the attendee's details
45
-     * @param EE_Attendee $attendee
46
-     */
47
-    public function populate_from_attendee($attendee)
48
-    {
49
-        $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
43
+	/**
44
+	 * Sets the defaults for the billing form according to the attendee's details
45
+	 * @param EE_Attendee $attendee
46
+	 */
47
+	public function populate_from_attendee($attendee)
48
+	{
49
+		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
50 50
 
51
-        /** @var $attendee EE_Attendee */
52
-        $this->populate_defaults(
53
-            apply_filters(
54
-                'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
55
-                array(
56
-                    'first_name'=>$attendee->fname(),
57
-                    'last_name'=>$attendee->lname(),
58
-                    'email'=>$attendee->email(),
59
-                    'address'=>$attendee->address(),
60
-                    'address2'=>$attendee->address2(),
61
-                    'city'=>$attendee->city(),
62
-                    'state'=> $this->getAttendeeStateValueForForm($attendee),
63
-                    'country'=> $attendee->country_ID(),
64
-                    'zip'=>$attendee->zip(),
65
-                    'phone'=>$attendee->phone(),
66
-                ),
67
-                $attendee,
68
-                $this
69
-            )
70
-        );
71
-    }
51
+		/** @var $attendee EE_Attendee */
52
+		$this->populate_defaults(
53
+			apply_filters(
54
+				'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
55
+				array(
56
+					'first_name'=>$attendee->fname(),
57
+					'last_name'=>$attendee->lname(),
58
+					'email'=>$attendee->email(),
59
+					'address'=>$attendee->address(),
60
+					'address2'=>$attendee->address2(),
61
+					'city'=>$attendee->city(),
62
+					'state'=> $this->getAttendeeStateValueForForm($attendee),
63
+					'country'=> $attendee->country_ID(),
64
+					'zip'=>$attendee->zip(),
65
+					'phone'=>$attendee->phone(),
66
+				),
67
+				$attendee,
68
+				$this
69
+			)
70
+		);
71
+	}
72 72
 
73
-    /**
74
-     * Gets the default value to use for the billing form's state value.
75
-     * @since $VID:$
76
-     * @param EE_Attendee $attendee
77
-     * @return string
78
-     * @throws EE_Error2
79
-     */
80
-    protected function getAttendeeStateValueForForm(EE_Attendee $attendee)
81
-    {
82
-        $state_input =  $this->get_input('state', false);
83
-        if ($state_input instanceof EE_State_Select_Input) {
84
-            $state_field_to_use =  $state_input->valueFieldName();
85
-        } else {
86
-            $state_field_to_use = 'STA_ID';
87
-        }
88
-        switch ($state_field_to_use) {
89
-            case 'STA_abbrev':
90
-                $state_value = $attendee->state_abbrev();
91
-                break;
92
-            case 'STA_name':
93
-                $state_value = $attendee->state_name();
94
-                break;
95
-            default:
96
-                $state_value = $attendee->state_ID();
97
-        }
98
-        return $state_value;
99
-    }
73
+	/**
74
+	 * Gets the default value to use for the billing form's state value.
75
+	 * @since $VID:$
76
+	 * @param EE_Attendee $attendee
77
+	 * @return string
78
+	 * @throws EE_Error2
79
+	 */
80
+	protected function getAttendeeStateValueForForm(EE_Attendee $attendee)
81
+	{
82
+		$state_input =  $this->get_input('state', false);
83
+		if ($state_input instanceof EE_State_Select_Input) {
84
+			$state_field_to_use =  $state_input->valueFieldName();
85
+		} else {
86
+			$state_field_to_use = 'STA_ID';
87
+		}
88
+		switch ($state_field_to_use) {
89
+			case 'STA_abbrev':
90
+				$state_value = $attendee->state_abbrev();
91
+				break;
92
+			case 'STA_name':
93
+				$state_value = $attendee->state_name();
94
+				break;
95
+			default:
96
+				$state_value = $attendee->state_ID();
97
+		}
98
+		return $state_value;
99
+	}
100 100
 
101 101
 
102 102
 
103
-    /**
104
-     * copy_billing_form_data_to_attendee
105
-     * copies info from the billing form to the attendee's details
106
-     * @param \EE_Attendee $attendee - the attendee object to copy details to
107
-     * @return \EE_Attendee
108
-     */
109
-    public function copy_billing_form_data_to_attendee(EE_Attendee $attendee)
110
-    {
111
-        // grab billing form data
112
-        $data = $this->valid_data();
113
-        // copy first_name
114
-        if (! empty($data['first_name'])) {
115
-            $attendee->set_fname($data['first_name']);
116
-        }
117
-        // copy last_name
118
-        if (! empty($data['last_name'])) {
119
-            $attendee->set_lname($data['last_name']);
120
-        }
121
-        // copy email
122
-        if (! empty($data['email'])) {
123
-            $attendee->set_email($data['email']);
124
-        }
125
-        // copy address
126
-        if (! empty($data['address'])) {
127
-            $attendee->set_address($data['address']);
128
-        }
129
-        // copy address2
130
-        if (! empty($data['address2'])) {
131
-            $attendee->set_address2($data['address2']);
132
-        }
133
-        // copy city
134
-        if (! empty($data['city'])) {
135
-            $attendee->set_city($data['city']);
136
-        }
137
-        // copy state
138
-        if (! empty($data['state'])) {
139
-            $attendee->set_state($data['state']);
140
-        }
141
-        // copy country
142
-        if (! empty($data['country'])) {
143
-            $attendee->set_country($data['country']);
144
-        }
145
-        // copy zip
146
-        if (! empty($data['zip'])) {
147
-            $attendee->set_zip($data['zip']);
148
-        }
149
-        // copy phone
150
-        if (! empty($data['phone'])) {
151
-            $attendee->set_phone($data['phone']);
152
-        }
153
-        return $attendee;
154
-    }
103
+	/**
104
+	 * copy_billing_form_data_to_attendee
105
+	 * copies info from the billing form to the attendee's details
106
+	 * @param \EE_Attendee $attendee - the attendee object to copy details to
107
+	 * @return \EE_Attendee
108
+	 */
109
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee)
110
+	{
111
+		// grab billing form data
112
+		$data = $this->valid_data();
113
+		// copy first_name
114
+		if (! empty($data['first_name'])) {
115
+			$attendee->set_fname($data['first_name']);
116
+		}
117
+		// copy last_name
118
+		if (! empty($data['last_name'])) {
119
+			$attendee->set_lname($data['last_name']);
120
+		}
121
+		// copy email
122
+		if (! empty($data['email'])) {
123
+			$attendee->set_email($data['email']);
124
+		}
125
+		// copy address
126
+		if (! empty($data['address'])) {
127
+			$attendee->set_address($data['address']);
128
+		}
129
+		// copy address2
130
+		if (! empty($data['address2'])) {
131
+			$attendee->set_address2($data['address2']);
132
+		}
133
+		// copy city
134
+		if (! empty($data['city'])) {
135
+			$attendee->set_city($data['city']);
136
+		}
137
+		// copy state
138
+		if (! empty($data['state'])) {
139
+			$attendee->set_state($data['state']);
140
+		}
141
+		// copy country
142
+		if (! empty($data['country'])) {
143
+			$attendee->set_country($data['country']);
144
+		}
145
+		// copy zip
146
+		if (! empty($data['zip'])) {
147
+			$attendee->set_zip($data['zip']);
148
+		}
149
+		// copy phone
150
+		if (! empty($data['phone'])) {
151
+			$attendee->set_phone($data['phone']);
152
+		}
153
+		return $attendee;
154
+	}
155 155
 
156 156
 
157
-    /**
158
-     * create_attendee_from_billing_form_data
159
-     * uses info from the billing form to create a new attendee
160
-     * @return \EE_Attendee
161
-     */
162
-    public function create_attendee_from_billing_form_data()
163
-    {
164
-        // grab billing form data
165
-        $data = $this->valid_data();
166
-        return EE_Attendee::new_instance(array(
167
-            'ATT_fname'         => ! empty($data['first_name']) ? $data['first_name'] : '',
168
-            'ATT_lname'         => ! empty($data['last_name']) ? $data['last_name'] : '',
169
-            'ATT_email'         => ! empty($data['email']) ? $data['email'] : '',
170
-            'ATT_address'       => ! empty($data['address']) ? $data['address'] : '',
171
-            'ATT_address2'  => ! empty($data['address2']) ? $data['address2'] : '',
172
-            'ATT_city'          => ! empty($data['city']) ? $data['city'] : '',
173
-            'STA_ID'                => ! empty($data['state']) ? $data['state'] : '',
174
-            'CNT_ISO'           => ! empty($data['country']) ? $data['country'] : '',
175
-            'ATT_zip'               => ! empty($data['zip']) ? $data['zip'] : '',
176
-            'ATT_phone'         => ! empty($data['phone']) ? $data['phone'] : '',
177
-        ));
178
-    }
157
+	/**
158
+	 * create_attendee_from_billing_form_data
159
+	 * uses info from the billing form to create a new attendee
160
+	 * @return \EE_Attendee
161
+	 */
162
+	public function create_attendee_from_billing_form_data()
163
+	{
164
+		// grab billing form data
165
+		$data = $this->valid_data();
166
+		return EE_Attendee::new_instance(array(
167
+			'ATT_fname'         => ! empty($data['first_name']) ? $data['first_name'] : '',
168
+			'ATT_lname'         => ! empty($data['last_name']) ? $data['last_name'] : '',
169
+			'ATT_email'         => ! empty($data['email']) ? $data['email'] : '',
170
+			'ATT_address'       => ! empty($data['address']) ? $data['address'] : '',
171
+			'ATT_address2'  => ! empty($data['address2']) ? $data['address2'] : '',
172
+			'ATT_city'          => ! empty($data['city']) ? $data['city'] : '',
173
+			'STA_ID'                => ! empty($data['state']) ? $data['state'] : '',
174
+			'CNT_ISO'           => ! empty($data['country']) ? $data['country'] : '',
175
+			'ATT_zip'               => ! empty($data['zip']) ? $data['zip'] : '',
176
+			'ATT_phone'         => ! empty($data['phone']) ? $data['phone'] : '',
177
+		));
178
+	}
179 179
 }
180 180
 
181 181
 // End of file EE_Billing_Attendee_Info_Form.form.php
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $options_array['subsections'] = array_merge(
25 25
             array(
26
-                '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') )),
27
-                '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') )),
28
-                'email'             => new EE_Email_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso') )),
29
-                'address'           => new EE_Text_Input(array( 'html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
30
-                'address2'      => new EE_Text_Input(array( 'html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
31
-                'city'                  => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso') )),
32
-                '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') ))),
33
-                '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') ))),
34
-                'zip'                   => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso') )),
35
-                'phone'         => new EE_Text_Input(array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso') )),
26
+                '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'))),
27
+                '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'))),
28
+                'email'             => new EE_Email_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))),
29
+                'address'           => new EE_Text_Input(array('html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')),
30
+                'address2'      => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')),
31
+                'city'                  => new EE_Text_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))),
32
+                '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')))),
33
+                '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')))),
34
+                'zip'                   => new EE_Text_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))),
35
+                'phone'         => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))),
36 36
             ),
37 37
             isset($options_array['subsections']) ? $options_array['subsections'] : array()
38 38
         );
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
      */
80 80
     protected function getAttendeeStateValueForForm(EE_Attendee $attendee)
81 81
     {
82
-        $state_input =  $this->get_input('state', false);
82
+        $state_input = $this->get_input('state', false);
83 83
         if ($state_input instanceof EE_State_Select_Input) {
84
-            $state_field_to_use =  $state_input->valueFieldName();
84
+            $state_field_to_use = $state_input->valueFieldName();
85 85
         } else {
86 86
             $state_field_to_use = 'STA_ID';
87 87
         }
@@ -111,43 +111,43 @@  discard block
 block discarded – undo
111 111
         // grab billing form data
112 112
         $data = $this->valid_data();
113 113
         // copy first_name
114
-        if (! empty($data['first_name'])) {
114
+        if ( ! empty($data['first_name'])) {
115 115
             $attendee->set_fname($data['first_name']);
116 116
         }
117 117
         // copy last_name
118
-        if (! empty($data['last_name'])) {
118
+        if ( ! empty($data['last_name'])) {
119 119
             $attendee->set_lname($data['last_name']);
120 120
         }
121 121
         // copy email
122
-        if (! empty($data['email'])) {
122
+        if ( ! empty($data['email'])) {
123 123
             $attendee->set_email($data['email']);
124 124
         }
125 125
         // copy address
126
-        if (! empty($data['address'])) {
126
+        if ( ! empty($data['address'])) {
127 127
             $attendee->set_address($data['address']);
128 128
         }
129 129
         // copy address2
130
-        if (! empty($data['address2'])) {
130
+        if ( ! empty($data['address2'])) {
131 131
             $attendee->set_address2($data['address2']);
132 132
         }
133 133
         // copy city
134
-        if (! empty($data['city'])) {
134
+        if ( ! empty($data['city'])) {
135 135
             $attendee->set_city($data['city']);
136 136
         }
137 137
         // copy state
138
-        if (! empty($data['state'])) {
138
+        if ( ! empty($data['state'])) {
139 139
             $attendee->set_state($data['state']);
140 140
         }
141 141
         // copy country
142
-        if (! empty($data['country'])) {
142
+        if ( ! empty($data['country'])) {
143 143
             $attendee->set_country($data['country']);
144 144
         }
145 145
         // copy zip
146
-        if (! empty($data['zip'])) {
146
+        if ( ! empty($data['zip'])) {
147 147
             $attendee->set_zip($data['zip']);
148 148
         }
149 149
         // copy phone
150
-        if (! empty($data['phone'])) {
150
+        if ( ! empty($data['phone'])) {
151 151
             $attendee->set_phone($data['phone']);
152 152
         }
153 153
         return $attendee;
Please login to merge, or discard this patch.