@@ -10,331 +10,331 @@ |
||
10 | 10 | class EEM_Ticket extends EEM_Soft_Delete_Base |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * private instance of the EEM_Ticket object |
|
15 | - * |
|
16 | - * @var EEM_Ticket $_instance |
|
17 | - */ |
|
18 | - protected static $_instance; |
|
13 | + /** |
|
14 | + * private instance of the EEM_Ticket object |
|
15 | + * |
|
16 | + * @var EEM_Ticket $_instance |
|
17 | + */ |
|
18 | + protected static $_instance; |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * private constructor to prevent direct creation |
|
23 | - * |
|
24 | - * @Constructor |
|
25 | - * @access private |
|
26 | - * @param string $timezone string representing the timezone we want to set for returned Date Time Strings |
|
27 | - * (and any incoming timezone data that gets saved). |
|
28 | - * Note this just sends the timezone info to the date time model field objects. |
|
29 | - * Default is NULL |
|
30 | - * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
31 | - * @throws EE_Error |
|
32 | - */ |
|
33 | - protected function __construct($timezone) |
|
34 | - { |
|
35 | - $this->singular_item = esc_html__('Ticket', 'event_espresso'); |
|
36 | - $this->plural_item = esc_html__('Tickets', 'event_espresso'); |
|
37 | - $this->_tables = array( |
|
38 | - 'Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID'), |
|
39 | - ); |
|
40 | - $this->_fields = array( |
|
41 | - 'Ticket' => array( |
|
42 | - 'TKT_ID' => new EE_Primary_Key_Int_Field( |
|
43 | - 'TKT_ID', |
|
44 | - esc_html__('Ticket ID', 'event_espresso') |
|
45 | - ), |
|
46 | - 'TTM_ID' => new EE_Foreign_Key_Int_Field( |
|
47 | - 'TTM_ID', |
|
48 | - esc_html__('Ticket Template ID', 'event_espresso'), |
|
49 | - false, |
|
50 | - 0, |
|
51 | - 'Ticket_Template' |
|
52 | - ), |
|
53 | - 'TKT_name' => new EE_Plain_Text_Field( |
|
54 | - 'TKT_name', |
|
55 | - esc_html__('Ticket Name', 'event_espresso'), |
|
56 | - false, |
|
57 | - '' |
|
58 | - ), |
|
59 | - 'TKT_description' => new EE_Post_Content_Field( |
|
60 | - 'TKT_description', |
|
61 | - esc_html__('Description of Ticket', 'event_espresso'), |
|
62 | - false, |
|
63 | - '' |
|
64 | - ), |
|
65 | - 'TKT_start_date' => new EE_Datetime_Field( |
|
66 | - 'TKT_start_date', |
|
67 | - esc_html__('Start time/date of Ticket', 'event_espresso'), |
|
68 | - false, |
|
69 | - EE_Datetime_Field::now, |
|
70 | - $timezone |
|
71 | - ), |
|
72 | - 'TKT_end_date' => new EE_Datetime_Field( |
|
73 | - 'TKT_end_date', |
|
74 | - esc_html__('End time/date of Ticket', 'event_espresso'), |
|
75 | - false, |
|
76 | - EE_Datetime_Field::now, |
|
77 | - $timezone |
|
78 | - ), |
|
79 | - 'TKT_min' => new EE_Integer_Field( |
|
80 | - 'TKT_min', |
|
81 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
|
82 | - false, |
|
83 | - 0 |
|
84 | - ), |
|
85 | - 'TKT_max' => new EE_Infinite_Integer_Field( |
|
86 | - 'TKT_max', |
|
87 | - esc_html__( |
|
88 | - 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
89 | - 'event_espresso' |
|
90 | - ), |
|
91 | - false, |
|
92 | - EE_INF |
|
93 | - ), |
|
94 | - 'TKT_price' => new EE_Money_Field( |
|
95 | - 'TKT_price', |
|
96 | - esc_html__('Final calculated price for ticket', 'event_espresso'), |
|
97 | - false, |
|
98 | - 0 |
|
99 | - ), |
|
100 | - 'TKT_sold' => new EE_Integer_Field( |
|
101 | - 'TKT_sold', |
|
102 | - esc_html__('Number of this ticket sold', 'event_espresso'), |
|
103 | - false, |
|
104 | - 0 |
|
105 | - ), |
|
106 | - 'TKT_qty' => new EE_Infinite_Integer_Field( |
|
107 | - 'TKT_qty', |
|
108 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
109 | - false, |
|
110 | - EE_INF |
|
111 | - ), |
|
112 | - 'TKT_reserved' => new EE_Integer_Field( |
|
113 | - 'TKT_reserved', |
|
114 | - esc_html__( |
|
115 | - 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
116 | - 'event_espresso' |
|
117 | - ), |
|
118 | - false, |
|
119 | - 0 |
|
120 | - ), |
|
121 | - 'TKT_uses' => new EE_Infinite_Integer_Field( |
|
122 | - 'TKT_uses', |
|
123 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
124 | - false, |
|
125 | - EE_INF |
|
126 | - ), |
|
127 | - 'TKT_required' => new EE_Boolean_Field( |
|
128 | - 'TKT_required', |
|
129 | - esc_html__( |
|
130 | - 'Flag indicating whether this ticket must be purchased with a transaction', |
|
131 | - 'event_espresso' |
|
132 | - ), |
|
133 | - false, |
|
134 | - false |
|
135 | - ), |
|
136 | - 'TKT_taxable' => new EE_Boolean_Field( |
|
137 | - 'TKT_taxable', |
|
138 | - esc_html__( |
|
139 | - 'Flag indicating whether there is tax applied on this ticket', |
|
140 | - 'event_espresso' |
|
141 | - ), |
|
142 | - false, |
|
143 | - false |
|
144 | - ), |
|
145 | - 'TKT_is_default' => new EE_Boolean_Field( |
|
146 | - 'TKT_is_default', |
|
147 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
|
148 | - false, |
|
149 | - false |
|
150 | - ), |
|
151 | - 'TKT_order' => new EE_Integer_Field( |
|
152 | - 'TKT_order', |
|
153 | - esc_html__( |
|
154 | - 'The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', |
|
155 | - 'event_espresso' |
|
156 | - ), |
|
157 | - false, |
|
158 | - 0 |
|
159 | - ), |
|
160 | - 'TKT_row' => new EE_Integer_Field( |
|
161 | - 'TKT_row', |
|
162 | - esc_html__('How tickets are displayed in the ui', 'event_espresso'), |
|
163 | - false, |
|
164 | - 0 |
|
165 | - ), |
|
166 | - 'TKT_deleted' => new EE_Trashed_Flag_Field( |
|
167 | - 'TKT_deleted', |
|
168 | - esc_html__('Flag indicating if this has been archived or not', 'event_espresso'), |
|
169 | - false, |
|
170 | - false |
|
171 | - ), |
|
172 | - 'TKT_wp_user' => new EE_WP_User_Field( |
|
173 | - 'TKT_wp_user', |
|
174 | - esc_html__('Ticket Creator ID', 'event_espresso'), |
|
175 | - false |
|
176 | - ), |
|
177 | - 'TKT_parent' => new EE_Integer_Field( |
|
178 | - 'TKT_parent', |
|
179 | - esc_html__( |
|
180 | - 'Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)', |
|
181 | - 'event_espresso' |
|
182 | - ), |
|
183 | - true, |
|
184 | - 0 |
|
185 | - ), |
|
186 | - 'TKT_reverse_calculate' => new EE_Boolean_Field( |
|
187 | - 'TKT_reverse_calculate', |
|
188 | - esc_html__( |
|
189 | - 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
190 | - 'event_espresso' |
|
191 | - ), |
|
192 | - false, |
|
193 | - false |
|
194 | - ), |
|
195 | - ), |
|
196 | - ); |
|
197 | - $this->_model_relations = array( |
|
198 | - 'Datetime' => new EE_HABTM_Relation('Datetime_Ticket'), |
|
199 | - 'Datetime_Ticket' => new EE_Has_Many_Relation(), |
|
200 | - 'Price' => new EE_HABTM_Relation('Ticket_Price'), |
|
201 | - 'Ticket_Template' => new EE_Belongs_To_Relation(), |
|
202 | - 'Registration' => new EE_Has_Many_Relation(), |
|
203 | - 'WP_User' => new EE_Belongs_To_Relation(), |
|
204 | - ); |
|
205 | - // this model is generally available for reading |
|
206 | - $path_to_event = 'Datetime.Event'; |
|
207 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public( |
|
208 | - 'TKT_is_default', |
|
209 | - $path_to_event |
|
210 | - ); |
|
211 | - // account for default tickets in the caps |
|
212 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( |
|
213 | - 'TKT_is_default', |
|
214 | - $path_to_event |
|
215 | - ); |
|
216 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( |
|
217 | - 'TKT_is_default', |
|
218 | - $path_to_event |
|
219 | - ); |
|
220 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( |
|
221 | - 'TKT_is_default', |
|
222 | - $path_to_event |
|
223 | - ); |
|
224 | - $this->model_chain_to_password = $path_to_event; |
|
225 | - parent::__construct($timezone); |
|
226 | - } |
|
21 | + /** |
|
22 | + * private constructor to prevent direct creation |
|
23 | + * |
|
24 | + * @Constructor |
|
25 | + * @access private |
|
26 | + * @param string $timezone string representing the timezone we want to set for returned Date Time Strings |
|
27 | + * (and any incoming timezone data that gets saved). |
|
28 | + * Note this just sends the timezone info to the date time model field objects. |
|
29 | + * Default is NULL |
|
30 | + * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
31 | + * @throws EE_Error |
|
32 | + */ |
|
33 | + protected function __construct($timezone) |
|
34 | + { |
|
35 | + $this->singular_item = esc_html__('Ticket', 'event_espresso'); |
|
36 | + $this->plural_item = esc_html__('Tickets', 'event_espresso'); |
|
37 | + $this->_tables = array( |
|
38 | + 'Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID'), |
|
39 | + ); |
|
40 | + $this->_fields = array( |
|
41 | + 'Ticket' => array( |
|
42 | + 'TKT_ID' => new EE_Primary_Key_Int_Field( |
|
43 | + 'TKT_ID', |
|
44 | + esc_html__('Ticket ID', 'event_espresso') |
|
45 | + ), |
|
46 | + 'TTM_ID' => new EE_Foreign_Key_Int_Field( |
|
47 | + 'TTM_ID', |
|
48 | + esc_html__('Ticket Template ID', 'event_espresso'), |
|
49 | + false, |
|
50 | + 0, |
|
51 | + 'Ticket_Template' |
|
52 | + ), |
|
53 | + 'TKT_name' => new EE_Plain_Text_Field( |
|
54 | + 'TKT_name', |
|
55 | + esc_html__('Ticket Name', 'event_espresso'), |
|
56 | + false, |
|
57 | + '' |
|
58 | + ), |
|
59 | + 'TKT_description' => new EE_Post_Content_Field( |
|
60 | + 'TKT_description', |
|
61 | + esc_html__('Description of Ticket', 'event_espresso'), |
|
62 | + false, |
|
63 | + '' |
|
64 | + ), |
|
65 | + 'TKT_start_date' => new EE_Datetime_Field( |
|
66 | + 'TKT_start_date', |
|
67 | + esc_html__('Start time/date of Ticket', 'event_espresso'), |
|
68 | + false, |
|
69 | + EE_Datetime_Field::now, |
|
70 | + $timezone |
|
71 | + ), |
|
72 | + 'TKT_end_date' => new EE_Datetime_Field( |
|
73 | + 'TKT_end_date', |
|
74 | + esc_html__('End time/date of Ticket', 'event_espresso'), |
|
75 | + false, |
|
76 | + EE_Datetime_Field::now, |
|
77 | + $timezone |
|
78 | + ), |
|
79 | + 'TKT_min' => new EE_Integer_Field( |
|
80 | + 'TKT_min', |
|
81 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
|
82 | + false, |
|
83 | + 0 |
|
84 | + ), |
|
85 | + 'TKT_max' => new EE_Infinite_Integer_Field( |
|
86 | + 'TKT_max', |
|
87 | + esc_html__( |
|
88 | + 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
89 | + 'event_espresso' |
|
90 | + ), |
|
91 | + false, |
|
92 | + EE_INF |
|
93 | + ), |
|
94 | + 'TKT_price' => new EE_Money_Field( |
|
95 | + 'TKT_price', |
|
96 | + esc_html__('Final calculated price for ticket', 'event_espresso'), |
|
97 | + false, |
|
98 | + 0 |
|
99 | + ), |
|
100 | + 'TKT_sold' => new EE_Integer_Field( |
|
101 | + 'TKT_sold', |
|
102 | + esc_html__('Number of this ticket sold', 'event_espresso'), |
|
103 | + false, |
|
104 | + 0 |
|
105 | + ), |
|
106 | + 'TKT_qty' => new EE_Infinite_Integer_Field( |
|
107 | + 'TKT_qty', |
|
108 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
109 | + false, |
|
110 | + EE_INF |
|
111 | + ), |
|
112 | + 'TKT_reserved' => new EE_Integer_Field( |
|
113 | + 'TKT_reserved', |
|
114 | + esc_html__( |
|
115 | + 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
116 | + 'event_espresso' |
|
117 | + ), |
|
118 | + false, |
|
119 | + 0 |
|
120 | + ), |
|
121 | + 'TKT_uses' => new EE_Infinite_Integer_Field( |
|
122 | + 'TKT_uses', |
|
123 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
124 | + false, |
|
125 | + EE_INF |
|
126 | + ), |
|
127 | + 'TKT_required' => new EE_Boolean_Field( |
|
128 | + 'TKT_required', |
|
129 | + esc_html__( |
|
130 | + 'Flag indicating whether this ticket must be purchased with a transaction', |
|
131 | + 'event_espresso' |
|
132 | + ), |
|
133 | + false, |
|
134 | + false |
|
135 | + ), |
|
136 | + 'TKT_taxable' => new EE_Boolean_Field( |
|
137 | + 'TKT_taxable', |
|
138 | + esc_html__( |
|
139 | + 'Flag indicating whether there is tax applied on this ticket', |
|
140 | + 'event_espresso' |
|
141 | + ), |
|
142 | + false, |
|
143 | + false |
|
144 | + ), |
|
145 | + 'TKT_is_default' => new EE_Boolean_Field( |
|
146 | + 'TKT_is_default', |
|
147 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
|
148 | + false, |
|
149 | + false |
|
150 | + ), |
|
151 | + 'TKT_order' => new EE_Integer_Field( |
|
152 | + 'TKT_order', |
|
153 | + esc_html__( |
|
154 | + 'The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', |
|
155 | + 'event_espresso' |
|
156 | + ), |
|
157 | + false, |
|
158 | + 0 |
|
159 | + ), |
|
160 | + 'TKT_row' => new EE_Integer_Field( |
|
161 | + 'TKT_row', |
|
162 | + esc_html__('How tickets are displayed in the ui', 'event_espresso'), |
|
163 | + false, |
|
164 | + 0 |
|
165 | + ), |
|
166 | + 'TKT_deleted' => new EE_Trashed_Flag_Field( |
|
167 | + 'TKT_deleted', |
|
168 | + esc_html__('Flag indicating if this has been archived or not', 'event_espresso'), |
|
169 | + false, |
|
170 | + false |
|
171 | + ), |
|
172 | + 'TKT_wp_user' => new EE_WP_User_Field( |
|
173 | + 'TKT_wp_user', |
|
174 | + esc_html__('Ticket Creator ID', 'event_espresso'), |
|
175 | + false |
|
176 | + ), |
|
177 | + 'TKT_parent' => new EE_Integer_Field( |
|
178 | + 'TKT_parent', |
|
179 | + esc_html__( |
|
180 | + 'Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)', |
|
181 | + 'event_espresso' |
|
182 | + ), |
|
183 | + true, |
|
184 | + 0 |
|
185 | + ), |
|
186 | + 'TKT_reverse_calculate' => new EE_Boolean_Field( |
|
187 | + 'TKT_reverse_calculate', |
|
188 | + esc_html__( |
|
189 | + 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
190 | + 'event_espresso' |
|
191 | + ), |
|
192 | + false, |
|
193 | + false |
|
194 | + ), |
|
195 | + ), |
|
196 | + ); |
|
197 | + $this->_model_relations = array( |
|
198 | + 'Datetime' => new EE_HABTM_Relation('Datetime_Ticket'), |
|
199 | + 'Datetime_Ticket' => new EE_Has_Many_Relation(), |
|
200 | + 'Price' => new EE_HABTM_Relation('Ticket_Price'), |
|
201 | + 'Ticket_Template' => new EE_Belongs_To_Relation(), |
|
202 | + 'Registration' => new EE_Has_Many_Relation(), |
|
203 | + 'WP_User' => new EE_Belongs_To_Relation(), |
|
204 | + ); |
|
205 | + // this model is generally available for reading |
|
206 | + $path_to_event = 'Datetime.Event'; |
|
207 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public( |
|
208 | + 'TKT_is_default', |
|
209 | + $path_to_event |
|
210 | + ); |
|
211 | + // account for default tickets in the caps |
|
212 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( |
|
213 | + 'TKT_is_default', |
|
214 | + $path_to_event |
|
215 | + ); |
|
216 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( |
|
217 | + 'TKT_is_default', |
|
218 | + $path_to_event |
|
219 | + ); |
|
220 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( |
|
221 | + 'TKT_is_default', |
|
222 | + $path_to_event |
|
223 | + ); |
|
224 | + $this->model_chain_to_password = $path_to_event; |
|
225 | + parent::__construct($timezone); |
|
226 | + } |
|
227 | 227 | |
228 | 228 | |
229 | - /** |
|
230 | - * This returns all tickets that are defaults from the db |
|
231 | - * |
|
232 | - * @return EE_Ticket[] |
|
233 | - * @throws EE_Error |
|
234 | - */ |
|
235 | - public function get_all_default_tickets() |
|
236 | - { |
|
237 | - /** @type EE_Ticket[] $tickets */ |
|
238 | - $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
239 | - // we need to set the start date and end date to today's date and the start of the default dtt |
|
240 | - return $this->_set_default_dates($tickets); |
|
241 | - } |
|
229 | + /** |
|
230 | + * This returns all tickets that are defaults from the db |
|
231 | + * |
|
232 | + * @return EE_Ticket[] |
|
233 | + * @throws EE_Error |
|
234 | + */ |
|
235 | + public function get_all_default_tickets() |
|
236 | + { |
|
237 | + /** @type EE_Ticket[] $tickets */ |
|
238 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
239 | + // we need to set the start date and end date to today's date and the start of the default dtt |
|
240 | + return $this->_set_default_dates($tickets); |
|
241 | + } |
|
242 | 242 | |
243 | 243 | |
244 | - /** |
|
245 | - * sets up relevant start and end date for EE_Ticket (s) |
|
246 | - * |
|
247 | - * @param EE_Ticket[] $tickets |
|
248 | - * @return EE_Ticket[] |
|
249 | - * @throws EE_Error |
|
250 | - */ |
|
251 | - private function _set_default_dates($tickets) |
|
252 | - { |
|
253 | - foreach ($tickets as $ticket) { |
|
254 | - $ticket->set( |
|
255 | - 'TKT_start_date', |
|
256 | - (int) $this->current_time_for_query('TKT_start_date', true) |
|
257 | - ); |
|
258 | - $ticket->set( |
|
259 | - 'TKT_end_date', |
|
260 | - (int) $this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS |
|
261 | - ); |
|
262 | - $ticket->set_end_time( |
|
263 | - $this->convert_datetime_for_query( |
|
264 | - 'TKT_end_date', |
|
265 | - '11:59 pm', |
|
266 | - 'g:i a', |
|
267 | - $this->_timezone |
|
268 | - ) |
|
269 | - ); |
|
270 | - } |
|
271 | - return $tickets; |
|
272 | - } |
|
244 | + /** |
|
245 | + * sets up relevant start and end date for EE_Ticket (s) |
|
246 | + * |
|
247 | + * @param EE_Ticket[] $tickets |
|
248 | + * @return EE_Ticket[] |
|
249 | + * @throws EE_Error |
|
250 | + */ |
|
251 | + private function _set_default_dates($tickets) |
|
252 | + { |
|
253 | + foreach ($tickets as $ticket) { |
|
254 | + $ticket->set( |
|
255 | + 'TKT_start_date', |
|
256 | + (int) $this->current_time_for_query('TKT_start_date', true) |
|
257 | + ); |
|
258 | + $ticket->set( |
|
259 | + 'TKT_end_date', |
|
260 | + (int) $this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS |
|
261 | + ); |
|
262 | + $ticket->set_end_time( |
|
263 | + $this->convert_datetime_for_query( |
|
264 | + 'TKT_end_date', |
|
265 | + '11:59 pm', |
|
266 | + 'g:i a', |
|
267 | + $this->_timezone |
|
268 | + ) |
|
269 | + ); |
|
270 | + } |
|
271 | + return $tickets; |
|
272 | + } |
|
273 | 273 | |
274 | 274 | |
275 | - /** |
|
276 | - * Gets the total number of tickets available at a particular datetime (does |
|
277 | - * NOT take int account the datetime's spaces available) |
|
278 | - * |
|
279 | - * @param int $DTT_ID |
|
280 | - * @param array $query_params |
|
281 | - * @return int |
|
282 | - */ |
|
283 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) |
|
284 | - { |
|
285 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
286 | - } |
|
275 | + /** |
|
276 | + * Gets the total number of tickets available at a particular datetime (does |
|
277 | + * NOT take int account the datetime's spaces available) |
|
278 | + * |
|
279 | + * @param int $DTT_ID |
|
280 | + * @param array $query_params |
|
281 | + * @return int |
|
282 | + */ |
|
283 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) |
|
284 | + { |
|
285 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
286 | + } |
|
287 | 287 | |
288 | 288 | |
289 | - /** |
|
290 | - * Updates the TKT_sold quantity on all the tickets matching $query_params |
|
291 | - * |
|
292 | - * @param EE_Ticket[] $tickets |
|
293 | - * @return void |
|
294 | - * @throws EE_Error |
|
295 | - */ |
|
296 | - public function update_tickets_sold($tickets) |
|
297 | - { |
|
298 | - foreach ($tickets as $ticket) { |
|
299 | - /* @var $ticket EE_Ticket */ |
|
300 | - $ticket->update_tickets_sold(); |
|
301 | - } |
|
302 | - } |
|
289 | + /** |
|
290 | + * Updates the TKT_sold quantity on all the tickets matching $query_params |
|
291 | + * |
|
292 | + * @param EE_Ticket[] $tickets |
|
293 | + * @return void |
|
294 | + * @throws EE_Error |
|
295 | + */ |
|
296 | + public function update_tickets_sold($tickets) |
|
297 | + { |
|
298 | + foreach ($tickets as $ticket) { |
|
299 | + /* @var $ticket EE_Ticket */ |
|
300 | + $ticket->update_tickets_sold(); |
|
301 | + } |
|
302 | + } |
|
303 | 303 | |
304 | 304 | |
305 | - /** |
|
306 | - * returns an array of EE_Ticket objects with a non-zero value for TKT_reserved |
|
307 | - * |
|
308 | - * @return EE_Base_Class[]|EE_Ticket[] |
|
309 | - * @throws EE_Error |
|
310 | - */ |
|
311 | - public function get_tickets_with_reservations() |
|
312 | - { |
|
313 | - return $this->get_all( |
|
314 | - array( |
|
315 | - array( |
|
316 | - 'TKT_reserved' => array('>', 0), |
|
317 | - ), |
|
318 | - ) |
|
319 | - ); |
|
320 | - } |
|
305 | + /** |
|
306 | + * returns an array of EE_Ticket objects with a non-zero value for TKT_reserved |
|
307 | + * |
|
308 | + * @return EE_Base_Class[]|EE_Ticket[] |
|
309 | + * @throws EE_Error |
|
310 | + */ |
|
311 | + public function get_tickets_with_reservations() |
|
312 | + { |
|
313 | + return $this->get_all( |
|
314 | + array( |
|
315 | + array( |
|
316 | + 'TKT_reserved' => array('>', 0), |
|
317 | + ), |
|
318 | + ) |
|
319 | + ); |
|
320 | + } |
|
321 | 321 | |
322 | 322 | |
323 | - /** |
|
324 | - * returns an array of EE_Ticket objects matching the supplied list of IDs |
|
325 | - * |
|
326 | - * @param array $ticket_IDs |
|
327 | - * @return EE_Base_Class[]|EE_Ticket[] |
|
328 | - * @throws EE_Error |
|
329 | - */ |
|
330 | - public function get_tickets_with_IDs(array $ticket_IDs) |
|
331 | - { |
|
332 | - return $this->get_all( |
|
333 | - array( |
|
334 | - array( |
|
335 | - 'TKT_ID' => array('IN', $ticket_IDs), |
|
336 | - ), |
|
337 | - ) |
|
338 | - ); |
|
339 | - } |
|
323 | + /** |
|
324 | + * returns an array of EE_Ticket objects matching the supplied list of IDs |
|
325 | + * |
|
326 | + * @param array $ticket_IDs |
|
327 | + * @return EE_Base_Class[]|EE_Ticket[] |
|
328 | + * @throws EE_Error |
|
329 | + */ |
|
330 | + public function get_tickets_with_IDs(array $ticket_IDs) |
|
331 | + { |
|
332 | + return $this->get_all( |
|
333 | + array( |
|
334 | + array( |
|
335 | + 'TKT_ID' => array('IN', $ticket_IDs), |
|
336 | + ), |
|
337 | + ) |
|
338 | + ); |
|
339 | + } |
|
340 | 340 | } |
@@ -16,230 +16,230 @@ discard block |
||
16 | 16 | class EEM_Transaction extends EEM_Base |
17 | 17 | { |
18 | 18 | |
19 | - // private instance of the Transaction object |
|
20 | - protected static $_instance; |
|
21 | - |
|
22 | - /** |
|
23 | - * Status ID(STS_ID on esp_status table) to indicate the transaction is complete, |
|
24 | - * but payment is pending. This is the state for transactions where payment is promised |
|
25 | - * from an offline gateway. |
|
26 | - */ |
|
27 | - // const open_status_code = 'TPN'; |
|
28 | - |
|
29 | - /** |
|
30 | - * Status ID(STS_ID on esp_status table) to indicate the transaction failed, |
|
31 | - * either due to a technical reason (server or computer crash during registration), |
|
32 | - * or some other reason that prevent the collection of any useful contact information from any of the registrants |
|
33 | - */ |
|
34 | - const failed_status_code = 'TFL'; |
|
35 | - |
|
36 | - /** |
|
37 | - * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned, |
|
38 | - * either due to a technical reason (server or computer crash during registration), |
|
39 | - * or due to an abandoned cart after registrant chose not to complete the registration process |
|
40 | - * HOWEVER... |
|
41 | - * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one |
|
42 | - * registrant |
|
43 | - */ |
|
44 | - const abandoned_status_code = 'TAB'; |
|
45 | - |
|
46 | - /** |
|
47 | - * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction, |
|
48 | - * meaning that monies are still owing: TXN_paid < TXN_total |
|
49 | - */ |
|
50 | - const incomplete_status_code = 'TIN'; |
|
51 | - |
|
52 | - /** |
|
53 | - * Status ID (STS_ID on esp_status table) to indicate a complete transaction. |
|
54 | - * meaning that NO monies are owing: TXN_paid == TXN_total |
|
55 | - */ |
|
56 | - const complete_status_code = 'TCM'; |
|
57 | - |
|
58 | - /** |
|
59 | - * Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid. |
|
60 | - * This is the same as complete, but site admins actually owe clients the moneys! TXN_paid > TXN_total |
|
61 | - */ |
|
62 | - const overpaid_status_code = 'TOP'; |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * private constructor to prevent direct creation |
|
67 | - * |
|
68 | - * @Constructor |
|
69 | - * @access protected |
|
70 | - * |
|
71 | - * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any |
|
72 | - * incoming timezone data that gets saved). Note this just sends the timezone info to the |
|
73 | - * date time model field objects. Default is NULL (and will be assumed using the set |
|
74 | - * timezone in the 'timezone_string' wp option) |
|
75 | - * |
|
76 | - * @return EEM_Transaction |
|
77 | - * @throws \EE_Error |
|
78 | - */ |
|
79 | - protected function __construct($timezone) |
|
80 | - { |
|
81 | - $this->singular_item = __('Transaction', 'event_espresso'); |
|
82 | - $this->plural_item = __('Transactions', 'event_espresso'); |
|
83 | - |
|
84 | - $this->_tables = array( |
|
85 | - 'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
86 | - ); |
|
87 | - $this->_fields = array( |
|
88 | - 'TransactionTable' => array( |
|
89 | - 'TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
90 | - 'TXN_timestamp' => new EE_Datetime_Field( |
|
91 | - 'TXN_timestamp', |
|
92 | - __('date when transaction was created', 'event_espresso'), |
|
93 | - false, |
|
94 | - EE_Datetime_Field::now, |
|
95 | - $timezone |
|
96 | - ), |
|
97 | - 'TXN_total' => new EE_Money_Field( |
|
98 | - 'TXN_total', |
|
99 | - __('Total value of Transaction', 'event_espresso'), |
|
100 | - false, |
|
101 | - 0 |
|
102 | - ), |
|
103 | - 'TXN_paid' => new EE_Money_Field( |
|
104 | - 'TXN_paid', |
|
105 | - __('Amount paid towards transaction to date', 'event_espresso'), |
|
106 | - false, |
|
107 | - 0 |
|
108 | - ), |
|
109 | - 'STS_ID' => new EE_Foreign_Key_String_Field( |
|
110 | - 'STS_ID', |
|
111 | - __('Status ID', 'event_espresso'), |
|
112 | - false, |
|
113 | - EEM_Transaction::failed_status_code, |
|
114 | - 'Status' |
|
115 | - ), |
|
116 | - 'TXN_session_data' => new EE_Serialized_Text_Field( |
|
117 | - 'TXN_session_data', |
|
118 | - __('Serialized session data', 'event_espresso'), |
|
119 | - true, |
|
120 | - '' |
|
121 | - ), |
|
122 | - 'TXN_hash_salt' => new EE_Plain_Text_Field( |
|
123 | - 'TXN_hash_salt', |
|
124 | - __('Transaction Hash Salt', 'event_espresso'), |
|
125 | - true, |
|
126 | - '' |
|
127 | - ), |
|
128 | - 'PMD_ID' => new EE_Foreign_Key_Int_Field( |
|
129 | - 'PMD_ID', |
|
130 | - __("Last Used Payment Method", 'event_espresso'), |
|
131 | - true, |
|
132 | - null, |
|
133 | - 'Payment_Method' |
|
134 | - ), |
|
135 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field( |
|
136 | - 'TXN_reg_steps', |
|
137 | - __('Registration Steps', 'event_espresso'), |
|
138 | - false, |
|
139 | - array() |
|
140 | - ), |
|
141 | - ) |
|
142 | - ); |
|
143 | - $this->_model_relations = array( |
|
144 | - 'Registration' => new EE_Has_Many_Relation(), |
|
145 | - 'Payment' => new EE_Has_Many_Relation(), |
|
146 | - 'Status' => new EE_Belongs_To_Relation(), |
|
147 | - 'Line_Item' => new EE_Has_Many_Relation(false), |
|
148 | - // you can delete a transaction without needing to delete its line items |
|
149 | - 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
150 | - 'Message' => new EE_Has_Many_Relation() |
|
151 | - ); |
|
152 | - $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
153 | - parent::__construct($timezone); |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * txn_status_array |
|
159 | - * get list of transaction statuses |
|
160 | - * |
|
161 | - * @access public |
|
162 | - * @return array |
|
163 | - */ |
|
164 | - public static function txn_status_array() |
|
165 | - { |
|
166 | - return apply_filters( |
|
167 | - 'FHEE__EEM_Transaction__txn_status_array', |
|
168 | - array( |
|
169 | - EEM_Transaction::overpaid_status_code, |
|
170 | - EEM_Transaction::complete_status_code, |
|
171 | - EEM_Transaction::incomplete_status_code, |
|
172 | - EEM_Transaction::abandoned_status_code, |
|
173 | - EEM_Transaction::failed_status_code, |
|
174 | - ) |
|
175 | - ); |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * get the revenue per day for the Transaction Admin page Reports Tab |
|
180 | - * |
|
181 | - * @access public |
|
182 | - * |
|
183 | - * @param string $period |
|
184 | - * |
|
185 | - * @return \stdClass[] |
|
186 | - */ |
|
187 | - public function get_revenue_per_day_report($period = '-1 month') |
|
188 | - { |
|
189 | - $sql_date = $this->convert_datetime_for_query( |
|
190 | - 'TXN_timestamp', |
|
191 | - date('Y-m-d H:i:s', strtotime($period)), |
|
192 | - 'Y-m-d H:i:s', |
|
193 | - 'UTC' |
|
194 | - ); |
|
195 | - |
|
196 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
197 | - |
|
198 | - return $this->_get_all_wpdb_results( |
|
199 | - array( |
|
200 | - array( |
|
201 | - 'TXN_timestamp' => array('>=', $sql_date) |
|
202 | - ), |
|
203 | - 'group_by' => 'txnDate', |
|
204 | - 'order_by' => array('TXN_timestamp' => 'ASC') |
|
205 | - ), |
|
206 | - OBJECT, |
|
207 | - array( |
|
208 | - 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
209 | - 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
210 | - ) |
|
211 | - ); |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - /** |
|
216 | - * get the revenue per event for the Transaction Admin page Reports Tab |
|
217 | - * |
|
218 | - * @access public |
|
219 | - * |
|
220 | - * @param string $period |
|
221 | - * |
|
222 | - * @throws \EE_Error |
|
223 | - * @return mixed |
|
224 | - */ |
|
225 | - public function get_revenue_per_event_report($period = '-1 month') |
|
226 | - { |
|
227 | - global $wpdb; |
|
228 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
229 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
230 | - $registration_payment_table = $wpdb->prefix . 'esp_registration_payment'; |
|
231 | - $event_table = $wpdb->posts; |
|
232 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
233 | - $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
234 | - $approved_payment_status = EEM_Payment::status_id_approved; |
|
235 | - $extra_event_on_join = ''; |
|
236 | - // exclude events not authored by user if permissions in effect |
|
237 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
238 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
239 | - } |
|
240 | - |
|
241 | - return $wpdb->get_results( |
|
242 | - "SELECT |
|
19 | + // private instance of the Transaction object |
|
20 | + protected static $_instance; |
|
21 | + |
|
22 | + /** |
|
23 | + * Status ID(STS_ID on esp_status table) to indicate the transaction is complete, |
|
24 | + * but payment is pending. This is the state for transactions where payment is promised |
|
25 | + * from an offline gateway. |
|
26 | + */ |
|
27 | + // const open_status_code = 'TPN'; |
|
28 | + |
|
29 | + /** |
|
30 | + * Status ID(STS_ID on esp_status table) to indicate the transaction failed, |
|
31 | + * either due to a technical reason (server or computer crash during registration), |
|
32 | + * or some other reason that prevent the collection of any useful contact information from any of the registrants |
|
33 | + */ |
|
34 | + const failed_status_code = 'TFL'; |
|
35 | + |
|
36 | + /** |
|
37 | + * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned, |
|
38 | + * either due to a technical reason (server or computer crash during registration), |
|
39 | + * or due to an abandoned cart after registrant chose not to complete the registration process |
|
40 | + * HOWEVER... |
|
41 | + * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one |
|
42 | + * registrant |
|
43 | + */ |
|
44 | + const abandoned_status_code = 'TAB'; |
|
45 | + |
|
46 | + /** |
|
47 | + * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction, |
|
48 | + * meaning that monies are still owing: TXN_paid < TXN_total |
|
49 | + */ |
|
50 | + const incomplete_status_code = 'TIN'; |
|
51 | + |
|
52 | + /** |
|
53 | + * Status ID (STS_ID on esp_status table) to indicate a complete transaction. |
|
54 | + * meaning that NO monies are owing: TXN_paid == TXN_total |
|
55 | + */ |
|
56 | + const complete_status_code = 'TCM'; |
|
57 | + |
|
58 | + /** |
|
59 | + * Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid. |
|
60 | + * This is the same as complete, but site admins actually owe clients the moneys! TXN_paid > TXN_total |
|
61 | + */ |
|
62 | + const overpaid_status_code = 'TOP'; |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * private constructor to prevent direct creation |
|
67 | + * |
|
68 | + * @Constructor |
|
69 | + * @access protected |
|
70 | + * |
|
71 | + * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any |
|
72 | + * incoming timezone data that gets saved). Note this just sends the timezone info to the |
|
73 | + * date time model field objects. Default is NULL (and will be assumed using the set |
|
74 | + * timezone in the 'timezone_string' wp option) |
|
75 | + * |
|
76 | + * @return EEM_Transaction |
|
77 | + * @throws \EE_Error |
|
78 | + */ |
|
79 | + protected function __construct($timezone) |
|
80 | + { |
|
81 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
82 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
83 | + |
|
84 | + $this->_tables = array( |
|
85 | + 'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
86 | + ); |
|
87 | + $this->_fields = array( |
|
88 | + 'TransactionTable' => array( |
|
89 | + 'TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
90 | + 'TXN_timestamp' => new EE_Datetime_Field( |
|
91 | + 'TXN_timestamp', |
|
92 | + __('date when transaction was created', 'event_espresso'), |
|
93 | + false, |
|
94 | + EE_Datetime_Field::now, |
|
95 | + $timezone |
|
96 | + ), |
|
97 | + 'TXN_total' => new EE_Money_Field( |
|
98 | + 'TXN_total', |
|
99 | + __('Total value of Transaction', 'event_espresso'), |
|
100 | + false, |
|
101 | + 0 |
|
102 | + ), |
|
103 | + 'TXN_paid' => new EE_Money_Field( |
|
104 | + 'TXN_paid', |
|
105 | + __('Amount paid towards transaction to date', 'event_espresso'), |
|
106 | + false, |
|
107 | + 0 |
|
108 | + ), |
|
109 | + 'STS_ID' => new EE_Foreign_Key_String_Field( |
|
110 | + 'STS_ID', |
|
111 | + __('Status ID', 'event_espresso'), |
|
112 | + false, |
|
113 | + EEM_Transaction::failed_status_code, |
|
114 | + 'Status' |
|
115 | + ), |
|
116 | + 'TXN_session_data' => new EE_Serialized_Text_Field( |
|
117 | + 'TXN_session_data', |
|
118 | + __('Serialized session data', 'event_espresso'), |
|
119 | + true, |
|
120 | + '' |
|
121 | + ), |
|
122 | + 'TXN_hash_salt' => new EE_Plain_Text_Field( |
|
123 | + 'TXN_hash_salt', |
|
124 | + __('Transaction Hash Salt', 'event_espresso'), |
|
125 | + true, |
|
126 | + '' |
|
127 | + ), |
|
128 | + 'PMD_ID' => new EE_Foreign_Key_Int_Field( |
|
129 | + 'PMD_ID', |
|
130 | + __("Last Used Payment Method", 'event_espresso'), |
|
131 | + true, |
|
132 | + null, |
|
133 | + 'Payment_Method' |
|
134 | + ), |
|
135 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field( |
|
136 | + 'TXN_reg_steps', |
|
137 | + __('Registration Steps', 'event_espresso'), |
|
138 | + false, |
|
139 | + array() |
|
140 | + ), |
|
141 | + ) |
|
142 | + ); |
|
143 | + $this->_model_relations = array( |
|
144 | + 'Registration' => new EE_Has_Many_Relation(), |
|
145 | + 'Payment' => new EE_Has_Many_Relation(), |
|
146 | + 'Status' => new EE_Belongs_To_Relation(), |
|
147 | + 'Line_Item' => new EE_Has_Many_Relation(false), |
|
148 | + // you can delete a transaction without needing to delete its line items |
|
149 | + 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
150 | + 'Message' => new EE_Has_Many_Relation() |
|
151 | + ); |
|
152 | + $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
153 | + parent::__construct($timezone); |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * txn_status_array |
|
159 | + * get list of transaction statuses |
|
160 | + * |
|
161 | + * @access public |
|
162 | + * @return array |
|
163 | + */ |
|
164 | + public static function txn_status_array() |
|
165 | + { |
|
166 | + return apply_filters( |
|
167 | + 'FHEE__EEM_Transaction__txn_status_array', |
|
168 | + array( |
|
169 | + EEM_Transaction::overpaid_status_code, |
|
170 | + EEM_Transaction::complete_status_code, |
|
171 | + EEM_Transaction::incomplete_status_code, |
|
172 | + EEM_Transaction::abandoned_status_code, |
|
173 | + EEM_Transaction::failed_status_code, |
|
174 | + ) |
|
175 | + ); |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * get the revenue per day for the Transaction Admin page Reports Tab |
|
180 | + * |
|
181 | + * @access public |
|
182 | + * |
|
183 | + * @param string $period |
|
184 | + * |
|
185 | + * @return \stdClass[] |
|
186 | + */ |
|
187 | + public function get_revenue_per_day_report($period = '-1 month') |
|
188 | + { |
|
189 | + $sql_date = $this->convert_datetime_for_query( |
|
190 | + 'TXN_timestamp', |
|
191 | + date('Y-m-d H:i:s', strtotime($period)), |
|
192 | + 'Y-m-d H:i:s', |
|
193 | + 'UTC' |
|
194 | + ); |
|
195 | + |
|
196 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
197 | + |
|
198 | + return $this->_get_all_wpdb_results( |
|
199 | + array( |
|
200 | + array( |
|
201 | + 'TXN_timestamp' => array('>=', $sql_date) |
|
202 | + ), |
|
203 | + 'group_by' => 'txnDate', |
|
204 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
205 | + ), |
|
206 | + OBJECT, |
|
207 | + array( |
|
208 | + 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
209 | + 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
210 | + ) |
|
211 | + ); |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + /** |
|
216 | + * get the revenue per event for the Transaction Admin page Reports Tab |
|
217 | + * |
|
218 | + * @access public |
|
219 | + * |
|
220 | + * @param string $period |
|
221 | + * |
|
222 | + * @throws \EE_Error |
|
223 | + * @return mixed |
|
224 | + */ |
|
225 | + public function get_revenue_per_event_report($period = '-1 month') |
|
226 | + { |
|
227 | + global $wpdb; |
|
228 | + $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
229 | + $registration_table = $wpdb->prefix . 'esp_registration'; |
|
230 | + $registration_payment_table = $wpdb->prefix . 'esp_registration_payment'; |
|
231 | + $event_table = $wpdb->posts; |
|
232 | + $payment_table = $wpdb->prefix . 'esp_payment'; |
|
233 | + $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
234 | + $approved_payment_status = EEM_Payment::status_id_approved; |
|
235 | + $extra_event_on_join = ''; |
|
236 | + // exclude events not authored by user if permissions in effect |
|
237 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
238 | + $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
239 | + } |
|
240 | + |
|
241 | + return $wpdb->get_results( |
|
242 | + "SELECT |
|
243 | 243 | Transaction_Event.event_name AS event_name, |
244 | 244 | SUM(Transaction_Event.paid) AS revenue |
245 | 245 | FROM |
@@ -267,231 +267,231 @@ discard block |
||
267 | 267 | $extra_event_on_join |
268 | 268 | ) AS Transaction_Event |
269 | 269 | GROUP BY event_name", |
270 | - OBJECT |
|
271 | - ); |
|
272 | - } |
|
273 | - |
|
274 | - |
|
275 | - /** |
|
276 | - * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the |
|
277 | - * $_REQUEST global variable. Either way, tries to find the current transaction (through |
|
278 | - * the registration pointed to by reg_url_link), if not returns null |
|
279 | - * |
|
280 | - * @param string $reg_url_link |
|
281 | - * |
|
282 | - * @return EE_Transaction |
|
283 | - */ |
|
284 | - public function get_transaction_from_reg_url_link($reg_url_link = '') |
|
285 | - { |
|
286 | - return $this->get_one(array( |
|
287 | - array( |
|
288 | - 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get( |
|
289 | - 'e_reg_url_link', |
|
290 | - '' |
|
291 | - ) |
|
292 | - ) |
|
293 | - )); |
|
294 | - } |
|
295 | - |
|
296 | - |
|
297 | - /** |
|
298 | - * Updates the provided EE_Transaction with all the applicable payments |
|
299 | - * (or fetch the EE_Transaction from its ID) |
|
300 | - * |
|
301 | - * @deprecated |
|
302 | - * |
|
303 | - * @param EE_Transaction|int $transaction_obj_or_id |
|
304 | - * @param boolean $save_txn whether or not to save the transaction during this function call |
|
305 | - * |
|
306 | - * @return boolean |
|
307 | - * @throws \EE_Error |
|
308 | - */ |
|
309 | - public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
|
310 | - { |
|
311 | - EE_Error::doing_it_wrong( |
|
312 | - __CLASS__ . '::' . __FUNCTION__, |
|
313 | - sprintf( |
|
314 | - __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
315 | - 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' |
|
316 | - ), |
|
317 | - '4.6.0' |
|
318 | - ); |
|
319 | - /** @type EE_Transaction_Processor $transaction_processor */ |
|
320 | - $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
321 | - |
|
322 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
323 | - $this->ensure_is_obj($transaction_obj_or_id) |
|
324 | - ); |
|
325 | - } |
|
326 | - |
|
327 | - /** |
|
328 | - * Deletes "junk" transactions that were probably added by bots. There might be TONS |
|
329 | - * of these, so we are very careful to NOT select (which the models do even when deleting), |
|
330 | - * and so we only use wpdb directly and only do minimal joins. |
|
331 | - * Transactions are considered "junk" if they're failed for longer than a week. |
|
332 | - * Also, there is an extra check for payments related to the transaction, because if a transaction has a payment on |
|
333 | - * it, it's probably not junk (regardless of what status it has). |
|
334 | - * The downside to this approach is that is addons are listening for object deletions |
|
335 | - * on EEM_Base::delete() they won't be notified of this. However, there is an action that plugins can hook into |
|
336 | - * to catch these types of deletions. |
|
337 | - * |
|
338 | - * @global WPDB $wpdb |
|
339 | - * @return mixed |
|
340 | - */ |
|
341 | - public function delete_junk_transactions() |
|
342 | - { |
|
343 | - /** @type WPDB $wpdb */ |
|
344 | - global $wpdb; |
|
345 | - $deleted = false; |
|
346 | - $time_to_leave_alone = apply_filters( |
|
347 | - 'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone', |
|
348 | - WEEK_IN_SECONDS |
|
349 | - ); |
|
350 | - |
|
351 | - |
|
352 | - /** |
|
353 | - * This allows code to filter the query arguments used for retrieving the transaction IDs to delete. |
|
354 | - * Useful for plugins that want to exclude transactions matching certain query parameters. |
|
355 | - * The query parameters should be in the format accepted by the EEM_Base model queries. |
|
356 | - */ |
|
357 | - $ids_query = apply_filters( |
|
358 | - 'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', |
|
359 | - array( |
|
360 | - 0 => array( |
|
361 | - 'STS_ID' => EEM_Transaction::failed_status_code, |
|
362 | - 'Payment.PAY_ID' => array( 'IS NULL' ), |
|
363 | - 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
364 | - ) |
|
365 | - ), |
|
366 | - $time_to_leave_alone |
|
367 | - ); |
|
368 | - |
|
369 | - |
|
370 | - /** |
|
371 | - * This filter is for when code needs to filter the list of transaction ids that represent transactions |
|
372 | - * about to be deleted based on some other criteria that isn't easily done via the query args filter. |
|
373 | - */ |
|
374 | - $txn_ids = apply_filters( |
|
375 | - 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
|
376 | - EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
377 | - $time_to_leave_alone |
|
378 | - ); |
|
379 | - // now that we have the ids to delete |
|
380 | - if (! empty($txn_ids) && is_array($txn_ids)) { |
|
381 | - // first, make sure these TXN's are removed the "ee_locked_transactions" array |
|
382 | - EEM_Transaction::unset_locked_transactions($txn_ids); |
|
383 | - |
|
384 | - // Create IDs placeholder. |
|
385 | - $placeholders = array_fill(0, count($txn_ids), '%d'); |
|
270 | + OBJECT |
|
271 | + ); |
|
272 | + } |
|
273 | + |
|
274 | + |
|
275 | + /** |
|
276 | + * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the |
|
277 | + * $_REQUEST global variable. Either way, tries to find the current transaction (through |
|
278 | + * the registration pointed to by reg_url_link), if not returns null |
|
279 | + * |
|
280 | + * @param string $reg_url_link |
|
281 | + * |
|
282 | + * @return EE_Transaction |
|
283 | + */ |
|
284 | + public function get_transaction_from_reg_url_link($reg_url_link = '') |
|
285 | + { |
|
286 | + return $this->get_one(array( |
|
287 | + array( |
|
288 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get( |
|
289 | + 'e_reg_url_link', |
|
290 | + '' |
|
291 | + ) |
|
292 | + ) |
|
293 | + )); |
|
294 | + } |
|
295 | + |
|
296 | + |
|
297 | + /** |
|
298 | + * Updates the provided EE_Transaction with all the applicable payments |
|
299 | + * (or fetch the EE_Transaction from its ID) |
|
300 | + * |
|
301 | + * @deprecated |
|
302 | + * |
|
303 | + * @param EE_Transaction|int $transaction_obj_or_id |
|
304 | + * @param boolean $save_txn whether or not to save the transaction during this function call |
|
305 | + * |
|
306 | + * @return boolean |
|
307 | + * @throws \EE_Error |
|
308 | + */ |
|
309 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
|
310 | + { |
|
311 | + EE_Error::doing_it_wrong( |
|
312 | + __CLASS__ . '::' . __FUNCTION__, |
|
313 | + sprintf( |
|
314 | + __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
315 | + 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' |
|
316 | + ), |
|
317 | + '4.6.0' |
|
318 | + ); |
|
319 | + /** @type EE_Transaction_Processor $transaction_processor */ |
|
320 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
321 | + |
|
322 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
323 | + $this->ensure_is_obj($transaction_obj_or_id) |
|
324 | + ); |
|
325 | + } |
|
326 | + |
|
327 | + /** |
|
328 | + * Deletes "junk" transactions that were probably added by bots. There might be TONS |
|
329 | + * of these, so we are very careful to NOT select (which the models do even when deleting), |
|
330 | + * and so we only use wpdb directly and only do minimal joins. |
|
331 | + * Transactions are considered "junk" if they're failed for longer than a week. |
|
332 | + * Also, there is an extra check for payments related to the transaction, because if a transaction has a payment on |
|
333 | + * it, it's probably not junk (regardless of what status it has). |
|
334 | + * The downside to this approach is that is addons are listening for object deletions |
|
335 | + * on EEM_Base::delete() they won't be notified of this. However, there is an action that plugins can hook into |
|
336 | + * to catch these types of deletions. |
|
337 | + * |
|
338 | + * @global WPDB $wpdb |
|
339 | + * @return mixed |
|
340 | + */ |
|
341 | + public function delete_junk_transactions() |
|
342 | + { |
|
343 | + /** @type WPDB $wpdb */ |
|
344 | + global $wpdb; |
|
345 | + $deleted = false; |
|
346 | + $time_to_leave_alone = apply_filters( |
|
347 | + 'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone', |
|
348 | + WEEK_IN_SECONDS |
|
349 | + ); |
|
350 | + |
|
351 | + |
|
352 | + /** |
|
353 | + * This allows code to filter the query arguments used for retrieving the transaction IDs to delete. |
|
354 | + * Useful for plugins that want to exclude transactions matching certain query parameters. |
|
355 | + * The query parameters should be in the format accepted by the EEM_Base model queries. |
|
356 | + */ |
|
357 | + $ids_query = apply_filters( |
|
358 | + 'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', |
|
359 | + array( |
|
360 | + 0 => array( |
|
361 | + 'STS_ID' => EEM_Transaction::failed_status_code, |
|
362 | + 'Payment.PAY_ID' => array( 'IS NULL' ), |
|
363 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
364 | + ) |
|
365 | + ), |
|
366 | + $time_to_leave_alone |
|
367 | + ); |
|
368 | + |
|
369 | + |
|
370 | + /** |
|
371 | + * This filter is for when code needs to filter the list of transaction ids that represent transactions |
|
372 | + * about to be deleted based on some other criteria that isn't easily done via the query args filter. |
|
373 | + */ |
|
374 | + $txn_ids = apply_filters( |
|
375 | + 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
|
376 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
377 | + $time_to_leave_alone |
|
378 | + ); |
|
379 | + // now that we have the ids to delete |
|
380 | + if (! empty($txn_ids) && is_array($txn_ids)) { |
|
381 | + // first, make sure these TXN's are removed the "ee_locked_transactions" array |
|
382 | + EEM_Transaction::unset_locked_transactions($txn_ids); |
|
383 | + |
|
384 | + // Create IDs placeholder. |
|
385 | + $placeholders = array_fill(0, count($txn_ids), '%d'); |
|
386 | 386 | |
387 | - // Glue it together to use inside $wpdb->prepare. |
|
388 | - $format = implode(', ', $placeholders); |
|
389 | - |
|
390 | - // let's get deletin'... |
|
391 | - // We got the ids from the original query to get them FROM |
|
392 | - // the db (which is sanitized) so no need to prepare them again. |
|
393 | - $query = $wpdb->prepare("DELETE FROM " . $this->table() . " WHERE TXN_ID IN ( $format )", $txn_ids); |
|
394 | - $deleted = $wpdb->query($query); |
|
395 | - } |
|
396 | - if ($deleted) { |
|
397 | - /** |
|
398 | - * Allows code to do something after the transactions have been deleted. |
|
399 | - */ |
|
400 | - do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
401 | - } |
|
402 | - |
|
403 | - return $deleted; |
|
404 | - } |
|
405 | - |
|
406 | - |
|
407 | - /** |
|
408 | - * @param array $transaction_IDs |
|
409 | - * |
|
410 | - * @return bool |
|
411 | - */ |
|
412 | - public static function unset_locked_transactions(array $transaction_IDs) |
|
413 | - { |
|
414 | - $locked_transactions = get_option('ee_locked_transactions', array()); |
|
415 | - $update = false; |
|
416 | - foreach ($transaction_IDs as $TXN_ID) { |
|
417 | - if (isset($locked_transactions[ $TXN_ID ])) { |
|
418 | - unset($locked_transactions[ $TXN_ID ]); |
|
419 | - $update = true; |
|
420 | - } |
|
421 | - } |
|
422 | - if ($update) { |
|
423 | - update_option('ee_locked_transactions', $locked_transactions); |
|
424 | - } |
|
425 | - |
|
426 | - return $update; |
|
427 | - } |
|
428 | - |
|
429 | - |
|
430 | - |
|
431 | - /** |
|
432 | - * returns an array of EE_Transaction objects whose timestamp is greater than |
|
433 | - * the current time minus the session lifespan, which defaults to 60 minutes |
|
434 | - * |
|
435 | - * @return EE_Base_Class[]|EE_Transaction[] |
|
436 | - * @throws EE_Error |
|
437 | - * @throws InvalidArgumentException |
|
438 | - * @throws InvalidDataTypeException |
|
439 | - * @throws InvalidInterfaceException |
|
440 | - */ |
|
441 | - public function get_transactions_in_progress() |
|
442 | - { |
|
443 | - return $this->_get_transactions_in_progress(); |
|
444 | - } |
|
445 | - |
|
446 | - |
|
447 | - |
|
448 | - /** |
|
449 | - * returns an array of EE_Transaction objects whose timestamp is less than |
|
450 | - * the current time minus the session lifespan, which defaults to 60 minutes |
|
451 | - * |
|
452 | - * @return EE_Base_Class[]|EE_Transaction[] |
|
453 | - * @throws EE_Error |
|
454 | - * @throws InvalidArgumentException |
|
455 | - * @throws InvalidDataTypeException |
|
456 | - * @throws InvalidInterfaceException |
|
457 | - */ |
|
458 | - public function get_transactions_not_in_progress() |
|
459 | - { |
|
460 | - return $this->_get_transactions_in_progress('<='); |
|
461 | - } |
|
462 | - |
|
463 | - |
|
464 | - |
|
465 | - /** |
|
466 | - * @param string $comparison |
|
467 | - * @return EE_Base_Class[]|EE_Transaction[] |
|
468 | - * @throws EE_Error |
|
469 | - * @throws InvalidArgumentException |
|
470 | - * @throws InvalidDataTypeException |
|
471 | - * @throws InvalidInterfaceException |
|
472 | - */ |
|
473 | - private function _get_transactions_in_progress($comparison = '>=') |
|
474 | - { |
|
475 | - $comparison = $comparison === '>=' || $comparison === '<=' |
|
476 | - ? $comparison |
|
477 | - : '>='; |
|
478 | - /** @var EventEspresso\core\domain\values\session\SessionLifespan $session_lifespan */ |
|
479 | - $session_lifespan = LoaderFactory::getLoader()->getShared( |
|
480 | - 'EventEspresso\core\domain\values\session\SessionLifespan' |
|
481 | - ); |
|
482 | - return $this->get_all( |
|
483 | - array( |
|
484 | - array( |
|
485 | - 'TXN_timestamp' => array( |
|
486 | - $comparison, |
|
487 | - $session_lifespan->expiration() |
|
488 | - ), |
|
489 | - 'STS_ID' => array( |
|
490 | - '!=', |
|
491 | - EEM_Transaction::complete_status_code |
|
492 | - ), |
|
493 | - ) |
|
494 | - ) |
|
495 | - ); |
|
496 | - } |
|
387 | + // Glue it together to use inside $wpdb->prepare. |
|
388 | + $format = implode(', ', $placeholders); |
|
389 | + |
|
390 | + // let's get deletin'... |
|
391 | + // We got the ids from the original query to get them FROM |
|
392 | + // the db (which is sanitized) so no need to prepare them again. |
|
393 | + $query = $wpdb->prepare("DELETE FROM " . $this->table() . " WHERE TXN_ID IN ( $format )", $txn_ids); |
|
394 | + $deleted = $wpdb->query($query); |
|
395 | + } |
|
396 | + if ($deleted) { |
|
397 | + /** |
|
398 | + * Allows code to do something after the transactions have been deleted. |
|
399 | + */ |
|
400 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
401 | + } |
|
402 | + |
|
403 | + return $deleted; |
|
404 | + } |
|
405 | + |
|
406 | + |
|
407 | + /** |
|
408 | + * @param array $transaction_IDs |
|
409 | + * |
|
410 | + * @return bool |
|
411 | + */ |
|
412 | + public static function unset_locked_transactions(array $transaction_IDs) |
|
413 | + { |
|
414 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
415 | + $update = false; |
|
416 | + foreach ($transaction_IDs as $TXN_ID) { |
|
417 | + if (isset($locked_transactions[ $TXN_ID ])) { |
|
418 | + unset($locked_transactions[ $TXN_ID ]); |
|
419 | + $update = true; |
|
420 | + } |
|
421 | + } |
|
422 | + if ($update) { |
|
423 | + update_option('ee_locked_transactions', $locked_transactions); |
|
424 | + } |
|
425 | + |
|
426 | + return $update; |
|
427 | + } |
|
428 | + |
|
429 | + |
|
430 | + |
|
431 | + /** |
|
432 | + * returns an array of EE_Transaction objects whose timestamp is greater than |
|
433 | + * the current time minus the session lifespan, which defaults to 60 minutes |
|
434 | + * |
|
435 | + * @return EE_Base_Class[]|EE_Transaction[] |
|
436 | + * @throws EE_Error |
|
437 | + * @throws InvalidArgumentException |
|
438 | + * @throws InvalidDataTypeException |
|
439 | + * @throws InvalidInterfaceException |
|
440 | + */ |
|
441 | + public function get_transactions_in_progress() |
|
442 | + { |
|
443 | + return $this->_get_transactions_in_progress(); |
|
444 | + } |
|
445 | + |
|
446 | + |
|
447 | + |
|
448 | + /** |
|
449 | + * returns an array of EE_Transaction objects whose timestamp is less than |
|
450 | + * the current time minus the session lifespan, which defaults to 60 minutes |
|
451 | + * |
|
452 | + * @return EE_Base_Class[]|EE_Transaction[] |
|
453 | + * @throws EE_Error |
|
454 | + * @throws InvalidArgumentException |
|
455 | + * @throws InvalidDataTypeException |
|
456 | + * @throws InvalidInterfaceException |
|
457 | + */ |
|
458 | + public function get_transactions_not_in_progress() |
|
459 | + { |
|
460 | + return $this->_get_transactions_in_progress('<='); |
|
461 | + } |
|
462 | + |
|
463 | + |
|
464 | + |
|
465 | + /** |
|
466 | + * @param string $comparison |
|
467 | + * @return EE_Base_Class[]|EE_Transaction[] |
|
468 | + * @throws EE_Error |
|
469 | + * @throws InvalidArgumentException |
|
470 | + * @throws InvalidDataTypeException |
|
471 | + * @throws InvalidInterfaceException |
|
472 | + */ |
|
473 | + private function _get_transactions_in_progress($comparison = '>=') |
|
474 | + { |
|
475 | + $comparison = $comparison === '>=' || $comparison === '<=' |
|
476 | + ? $comparison |
|
477 | + : '>='; |
|
478 | + /** @var EventEspresso\core\domain\values\session\SessionLifespan $session_lifespan */ |
|
479 | + $session_lifespan = LoaderFactory::getLoader()->getShared( |
|
480 | + 'EventEspresso\core\domain\values\session\SessionLifespan' |
|
481 | + ); |
|
482 | + return $this->get_all( |
|
483 | + array( |
|
484 | + array( |
|
485 | + 'TXN_timestamp' => array( |
|
486 | + $comparison, |
|
487 | + $session_lifespan->expiration() |
|
488 | + ), |
|
489 | + 'STS_ID' => array( |
|
490 | + '!=', |
|
491 | + EEM_Transaction::complete_status_code |
|
492 | + ), |
|
493 | + ) |
|
494 | + ) |
|
495 | + ); |
|
496 | + } |
|
497 | 497 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ), |
141 | 141 | ) |
142 | 142 | ); |
143 | - $this->_model_relations = array( |
|
143 | + $this->_model_relations = array( |
|
144 | 144 | 'Registration' => new EE_Has_Many_Relation(), |
145 | 145 | 'Payment' => new EE_Has_Many_Relation(), |
146 | 146 | 'Status' => new EE_Belongs_To_Relation(), |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ), |
206 | 206 | OBJECT, |
207 | 207 | array( |
208 | - 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
208 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
209 | 209 | 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
210 | 210 | ) |
211 | 211 | ); |
@@ -225,17 +225,17 @@ discard block |
||
225 | 225 | public function get_revenue_per_event_report($period = '-1 month') |
226 | 226 | { |
227 | 227 | global $wpdb; |
228 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
229 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
230 | - $registration_payment_table = $wpdb->prefix . 'esp_registration_payment'; |
|
228 | + $transaction_table = $wpdb->prefix.'esp_transaction'; |
|
229 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
230 | + $registration_payment_table = $wpdb->prefix.'esp_registration_payment'; |
|
231 | 231 | $event_table = $wpdb->posts; |
232 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
232 | + $payment_table = $wpdb->prefix.'esp_payment'; |
|
233 | 233 | $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
234 | 234 | $approved_payment_status = EEM_Payment::status_id_approved; |
235 | 235 | $extra_event_on_join = ''; |
236 | 236 | // exclude events not authored by user if permissions in effect |
237 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
238 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
237 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
238 | + $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id(); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | return $wpdb->get_results( |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
310 | 310 | { |
311 | 311 | EE_Error::doing_it_wrong( |
312 | - __CLASS__ . '::' . __FUNCTION__, |
|
312 | + __CLASS__.'::'.__FUNCTION__, |
|
313 | 313 | sprintf( |
314 | 314 | __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
315 | 315 | 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | array( |
360 | 360 | 0 => array( |
361 | 361 | 'STS_ID' => EEM_Transaction::failed_status_code, |
362 | - 'Payment.PAY_ID' => array( 'IS NULL' ), |
|
362 | + 'Payment.PAY_ID' => array('IS NULL'), |
|
363 | 363 | 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
364 | 364 | ) |
365 | 365 | ), |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $time_to_leave_alone |
378 | 378 | ); |
379 | 379 | // now that we have the ids to delete |
380 | - if (! empty($txn_ids) && is_array($txn_ids)) { |
|
380 | + if ( ! empty($txn_ids) && is_array($txn_ids)) { |
|
381 | 381 | // first, make sure these TXN's are removed the "ee_locked_transactions" array |
382 | 382 | EEM_Transaction::unset_locked_transactions($txn_ids); |
383 | 383 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | // let's get deletin'... |
391 | 391 | // We got the ids from the original query to get them FROM |
392 | 392 | // the db (which is sanitized) so no need to prepare them again. |
393 | - $query = $wpdb->prepare("DELETE FROM " . $this->table() . " WHERE TXN_ID IN ( $format )", $txn_ids); |
|
393 | + $query = $wpdb->prepare("DELETE FROM ".$this->table()." WHERE TXN_ID IN ( $format )", $txn_ids); |
|
394 | 394 | $deleted = $wpdb->query($query); |
395 | 395 | } |
396 | 396 | if ($deleted) { |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | $locked_transactions = get_option('ee_locked_transactions', array()); |
415 | 415 | $update = false; |
416 | 416 | foreach ($transaction_IDs as $TXN_ID) { |
417 | - if (isset($locked_transactions[ $TXN_ID ])) { |
|
418 | - unset($locked_transactions[ $TXN_ID ]); |
|
417 | + if (isset($locked_transactions[$TXN_ID])) { |
|
418 | + unset($locked_transactions[$TXN_ID]); |
|
419 | 419 | $update = true; |
420 | 420 | } |
421 | 421 | } |
@@ -17,196 +17,196 @@ |
||
17 | 17 | class EE_Log |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - private $_log = ''; |
|
24 | - |
|
25 | - /** |
|
26 | - * Used for remote logging |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - private $_remote_logging_url = ''; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - private $_remote_log = ''; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var EE_Log |
|
39 | - */ |
|
40 | - private static $_instance; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @return EE_Log |
|
45 | - */ |
|
46 | - public static function instance() |
|
47 | - { |
|
48 | - if (! self::$_instance instanceof EE_Log) { |
|
49 | - self::$_instance = new self(); |
|
50 | - } |
|
51 | - return self::$_instance; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @access private |
|
56 | - * @return EE_Log |
|
57 | - */ |
|
58 | - private function __construct() |
|
59 | - { |
|
60 | - |
|
61 | - if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | - return; |
|
63 | - } |
|
64 | - |
|
65 | - $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
|
66 | - $this->_remote_log = ''; |
|
67 | - |
|
68 | - if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
69 | - add_action('shutdown', array($this, 'send_log'), 9999); |
|
70 | - } |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * verify_filesystem |
|
76 | - * tests that the required files and folders exist and are writable |
|
77 | - * |
|
78 | - */ |
|
79 | - public function verify_filesystem() |
|
80 | - { |
|
81 | - $msg = esc_html__( |
|
82 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - EE_Error::doing_it_wrong( |
|
86 | - __METHOD__, |
|
87 | - $msg, |
|
88 | - '$VID:$' |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * _format_message |
|
95 | - * makes yer log entries look all purdy |
|
96 | - * |
|
97 | - * @param string $file |
|
98 | - * @param string $function |
|
99 | - * @param string $message |
|
100 | - * @param string $type |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - private function _format_message($file = '', $function = '', $message = '', $type = '') |
|
104 | - { |
|
105 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | - $msg .= '[' . current_time('mysql') . '] '; |
|
107 | - $msg .= ! empty($file) ? basename($file) : ''; |
|
108 | - $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
109 | - $msg .= ! empty($function) ? $function . '()' : ''; |
|
110 | - $msg .= PHP_EOL; |
|
111 | - $type = ! empty($type) ? $type : 'log message'; |
|
112 | - $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
113 | - return $msg; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * log |
|
119 | - * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the |
|
120 | - * EE_Log::write_log() callback |
|
121 | - * |
|
122 | - * @param string $file |
|
123 | - * @param string $function |
|
124 | - * @param string $message |
|
125 | - * @param string $type |
|
126 | - */ |
|
127 | - public function log($file = '', $function = '', $message = '', $type = '') |
|
128 | - { |
|
129 | - $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * write_log |
|
135 | - * appends the results of the 'AHEE_log' filter to the espresso log file |
|
136 | - */ |
|
137 | - public function write_log() |
|
138 | - { |
|
139 | - $msg = esc_html__( |
|
140 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
141 | - 'event_espresso' |
|
142 | - ); |
|
143 | - EE_Error::doing_it_wrong( |
|
144 | - __METHOD__, |
|
145 | - $msg, |
|
146 | - '$VID:$' |
|
147 | - ); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * send_log |
|
153 | - * sends the espresso log to a remote URL via a PHP cURL request |
|
154 | - */ |
|
155 | - public function send_log() |
|
156 | - { |
|
157 | - |
|
158 | - if (empty($this->_remote_logging_url)) { |
|
159 | - return; |
|
160 | - } |
|
161 | - |
|
162 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | - $data .= '&time=' . time(); |
|
166 | - $data .= '&remote_log=' . $this->_log; |
|
167 | - $data .= '&request_array=' . json_encode($_REQUEST); |
|
168 | - $data .= '&action=save'; |
|
169 | - |
|
170 | - if (defined('EELOGGING_PASS')) { |
|
171 | - $data .= '&pass=' . EELOGGING_PASS; |
|
172 | - } |
|
173 | - if (defined('EELOGGING_KEY')) { |
|
174 | - $data .= '&key=' . EELOGGING_KEY; |
|
175 | - } |
|
176 | - |
|
177 | - $c = curl_init($this->_remote_logging_url); |
|
178 | - curl_setopt($c, CURLOPT_POST, true); |
|
179 | - curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
180 | - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
181 | - curl_exec($c); |
|
182 | - curl_close($c); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * write_debug |
|
188 | - * writes the contents of the current request's $_GET and $_POST arrays to a log file. |
|
189 | - * previous entries are overwritten |
|
190 | - */ |
|
191 | - public function write_debug() |
|
192 | - { |
|
193 | - $msg = esc_html__( |
|
194 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
195 | - 'event_espresso' |
|
196 | - ); |
|
197 | - EE_Error::doing_it_wrong( |
|
198 | - __METHOD__, |
|
199 | - $msg, |
|
200 | - '$VID:$' |
|
201 | - ); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * __clone |
|
207 | - */ |
|
208 | - public function __clone() |
|
209 | - { |
|
210 | - trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
211 | - } |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + private $_log = ''; |
|
24 | + |
|
25 | + /** |
|
26 | + * Used for remote logging |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + private $_remote_logging_url = ''; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + private $_remote_log = ''; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var EE_Log |
|
39 | + */ |
|
40 | + private static $_instance; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @return EE_Log |
|
45 | + */ |
|
46 | + public static function instance() |
|
47 | + { |
|
48 | + if (! self::$_instance instanceof EE_Log) { |
|
49 | + self::$_instance = new self(); |
|
50 | + } |
|
51 | + return self::$_instance; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @access private |
|
56 | + * @return EE_Log |
|
57 | + */ |
|
58 | + private function __construct() |
|
59 | + { |
|
60 | + |
|
61 | + if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | + return; |
|
63 | + } |
|
64 | + |
|
65 | + $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
|
66 | + $this->_remote_log = ''; |
|
67 | + |
|
68 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
69 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
70 | + } |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * verify_filesystem |
|
76 | + * tests that the required files and folders exist and are writable |
|
77 | + * |
|
78 | + */ |
|
79 | + public function verify_filesystem() |
|
80 | + { |
|
81 | + $msg = esc_html__( |
|
82 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + EE_Error::doing_it_wrong( |
|
86 | + __METHOD__, |
|
87 | + $msg, |
|
88 | + '$VID:$' |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * _format_message |
|
95 | + * makes yer log entries look all purdy |
|
96 | + * |
|
97 | + * @param string $file |
|
98 | + * @param string $function |
|
99 | + * @param string $message |
|
100 | + * @param string $type |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + private function _format_message($file = '', $function = '', $message = '', $type = '') |
|
104 | + { |
|
105 | + $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | + $msg .= '[' . current_time('mysql') . '] '; |
|
107 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
108 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
109 | + $msg .= ! empty($function) ? $function . '()' : ''; |
|
110 | + $msg .= PHP_EOL; |
|
111 | + $type = ! empty($type) ? $type : 'log message'; |
|
112 | + $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
113 | + return $msg; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * log |
|
119 | + * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the |
|
120 | + * EE_Log::write_log() callback |
|
121 | + * |
|
122 | + * @param string $file |
|
123 | + * @param string $function |
|
124 | + * @param string $message |
|
125 | + * @param string $type |
|
126 | + */ |
|
127 | + public function log($file = '', $function = '', $message = '', $type = '') |
|
128 | + { |
|
129 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * write_log |
|
135 | + * appends the results of the 'AHEE_log' filter to the espresso log file |
|
136 | + */ |
|
137 | + public function write_log() |
|
138 | + { |
|
139 | + $msg = esc_html__( |
|
140 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
141 | + 'event_espresso' |
|
142 | + ); |
|
143 | + EE_Error::doing_it_wrong( |
|
144 | + __METHOD__, |
|
145 | + $msg, |
|
146 | + '$VID:$' |
|
147 | + ); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * send_log |
|
153 | + * sends the espresso log to a remote URL via a PHP cURL request |
|
154 | + */ |
|
155 | + public function send_log() |
|
156 | + { |
|
157 | + |
|
158 | + if (empty($this->_remote_logging_url)) { |
|
159 | + return; |
|
160 | + } |
|
161 | + |
|
162 | + $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | + $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | + $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | + $data .= '&time=' . time(); |
|
166 | + $data .= '&remote_log=' . $this->_log; |
|
167 | + $data .= '&request_array=' . json_encode($_REQUEST); |
|
168 | + $data .= '&action=save'; |
|
169 | + |
|
170 | + if (defined('EELOGGING_PASS')) { |
|
171 | + $data .= '&pass=' . EELOGGING_PASS; |
|
172 | + } |
|
173 | + if (defined('EELOGGING_KEY')) { |
|
174 | + $data .= '&key=' . EELOGGING_KEY; |
|
175 | + } |
|
176 | + |
|
177 | + $c = curl_init($this->_remote_logging_url); |
|
178 | + curl_setopt($c, CURLOPT_POST, true); |
|
179 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
180 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
181 | + curl_exec($c); |
|
182 | + curl_close($c); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * write_debug |
|
188 | + * writes the contents of the current request's $_GET and $_POST arrays to a log file. |
|
189 | + * previous entries are overwritten |
|
190 | + */ |
|
191 | + public function write_debug() |
|
192 | + { |
|
193 | + $msg = esc_html__( |
|
194 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
195 | + 'event_espresso' |
|
196 | + ); |
|
197 | + EE_Error::doing_it_wrong( |
|
198 | + __METHOD__, |
|
199 | + $msg, |
|
200 | + '$VID:$' |
|
201 | + ); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * __clone |
|
207 | + */ |
|
208 | + public function __clone() |
|
209 | + { |
|
210 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
211 | + } |
|
212 | 212 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function instance() |
47 | 47 | { |
48 | - if (! self::$_instance instanceof EE_Log) { |
|
48 | + if ( ! self::$_instance instanceof EE_Log) { |
|
49 | 49 | self::$_instance = new self(); |
50 | 50 | } |
51 | 51 | return self::$_instance; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | private function __construct() |
59 | 59 | { |
60 | 60 | |
61 | - if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
61 | + if ( ! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | */ |
103 | 103 | private function _format_message($file = '', $function = '', $message = '', $type = '') |
104 | 104 | { |
105 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | - $msg .= '[' . current_time('mysql') . '] '; |
|
105 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
106 | + $msg .= '['.current_time('mysql').'] '; |
|
107 | 107 | $msg .= ! empty($file) ? basename($file) : ''; |
108 | 108 | $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
109 | - $msg .= ! empty($function) ? $function . '()' : ''; |
|
109 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
110 | 110 | $msg .= PHP_EOL; |
111 | 111 | $type = ! empty($type) ? $type : 'log message'; |
112 | - $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
112 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
113 | 113 | return $msg; |
114 | 114 | } |
115 | 115 | |
@@ -159,19 +159,19 @@ discard block |
||
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | - $data .= '&time=' . time(); |
|
166 | - $data .= '&remote_log=' . $this->_log; |
|
167 | - $data .= '&request_array=' . json_encode($_REQUEST); |
|
162 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
163 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
164 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
165 | + $data .= '&time='.time(); |
|
166 | + $data .= '&remote_log='.$this->_log; |
|
167 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
168 | 168 | $data .= '&action=save'; |
169 | 169 | |
170 | 170 | if (defined('EELOGGING_PASS')) { |
171 | - $data .= '&pass=' . EELOGGING_PASS; |
|
171 | + $data .= '&pass='.EELOGGING_PASS; |
|
172 | 172 | } |
173 | 173 | if (defined('EELOGGING_KEY')) { |
174 | - $data .= '&key=' . EELOGGING_KEY; |
|
174 | + $data .= '&key='.EELOGGING_KEY; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $c = curl_init($this->_remote_logging_url); |
@@ -103,286 +103,286 @@ |
||
103 | 103 | class EE_DMS_4_1_0_org_options extends EE_Data_Migration_Script_Stage |
104 | 104 | { |
105 | 105 | |
106 | - public function _migration_step($num_items = 50) |
|
107 | - { |
|
106 | + public function _migration_step($num_items = 50) |
|
107 | + { |
|
108 | 108 | |
109 | - $items_actually_migrated = 0; |
|
110 | - $old_org_options = get_option('events_organization_settings'); |
|
111 | - foreach ($this->_org_options_we_know_how_to_migrate as $option_name) { |
|
112 | - // only bother migrating if there's a setting to migrate. Otherwise we'll just use the default |
|
113 | - if (isset($old_org_options[ $option_name ])) { |
|
114 | - $this->_handle_org_option($option_name, $old_org_options[ $option_name ]); |
|
115 | - } |
|
116 | - if ($option_name=='surcharge') { |
|
117 | - $this->_insert_new_global_surcharge_price($old_org_options); |
|
118 | - } |
|
119 | - $items_actually_migrated++; |
|
120 | - } |
|
109 | + $items_actually_migrated = 0; |
|
110 | + $old_org_options = get_option('events_organization_settings'); |
|
111 | + foreach ($this->_org_options_we_know_how_to_migrate as $option_name) { |
|
112 | + // only bother migrating if there's a setting to migrate. Otherwise we'll just use the default |
|
113 | + if (isset($old_org_options[ $option_name ])) { |
|
114 | + $this->_handle_org_option($option_name, $old_org_options[ $option_name ]); |
|
115 | + } |
|
116 | + if ($option_name=='surcharge') { |
|
117 | + $this->_insert_new_global_surcharge_price($old_org_options); |
|
118 | + } |
|
119 | + $items_actually_migrated++; |
|
120 | + } |
|
121 | 121 | |
122 | - $success = EE_Config::instance()->update_espresso_config(false, true); |
|
123 | - if (! $success) { |
|
124 | - $this->add_error(sprintf(__('Could not save EE Config during org options stage. Reason: %s', 'event_espresso'), EE_Error::get_notices(false))); |
|
125 | - EE_Error::overwrite_errors(); |
|
126 | - } |
|
127 | - EE_Network_Config::instance()->update_config(false, false); |
|
128 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
129 | - // we may have added new pages and this might be necessary |
|
130 | - flush_rewrite_rules(); |
|
131 | - $this->set_completed(); |
|
132 | - } |
|
133 | - return $items_actually_migrated; |
|
134 | - } |
|
135 | - public function _count_records_to_migrate() |
|
136 | - { |
|
137 | - $count_of_options_to_migrate = count($this->_org_options_we_know_how_to_migrate); |
|
138 | - return $count_of_options_to_migrate; |
|
139 | - } |
|
140 | - public function __construct() |
|
141 | - { |
|
142 | - $this->_pretty_name = __("Organization Options/Config", "event_espresso"); |
|
143 | - $this->_org_options_we_know_how_to_migrate = apply_filters('FHEE__EE_DMS_4_1_0_org_options__org_options_we_know_how_to_migrate', $this->_org_options_we_know_how_to_migrate); |
|
144 | - parent::__construct(); |
|
145 | - } |
|
122 | + $success = EE_Config::instance()->update_espresso_config(false, true); |
|
123 | + if (! $success) { |
|
124 | + $this->add_error(sprintf(__('Could not save EE Config during org options stage. Reason: %s', 'event_espresso'), EE_Error::get_notices(false))); |
|
125 | + EE_Error::overwrite_errors(); |
|
126 | + } |
|
127 | + EE_Network_Config::instance()->update_config(false, false); |
|
128 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
129 | + // we may have added new pages and this might be necessary |
|
130 | + flush_rewrite_rules(); |
|
131 | + $this->set_completed(); |
|
132 | + } |
|
133 | + return $items_actually_migrated; |
|
134 | + } |
|
135 | + public function _count_records_to_migrate() |
|
136 | + { |
|
137 | + $count_of_options_to_migrate = count($this->_org_options_we_know_how_to_migrate); |
|
138 | + return $count_of_options_to_migrate; |
|
139 | + } |
|
140 | + public function __construct() |
|
141 | + { |
|
142 | + $this->_pretty_name = __("Organization Options/Config", "event_espresso"); |
|
143 | + $this->_org_options_we_know_how_to_migrate = apply_filters('FHEE__EE_DMS_4_1_0_org_options__org_options_we_know_how_to_migrate', $this->_org_options_we_know_how_to_migrate); |
|
144 | + parent::__construct(); |
|
145 | + } |
|
146 | 146 | |
147 | - private function _handle_org_option($option_name, $value) |
|
148 | - { |
|
149 | - $c = EE_Config::instance(); |
|
150 | - $cn = EE_Network_Config::instance(); |
|
151 | - switch ($option_name) { |
|
152 | - case 'organization': |
|
153 | - $c->organization->name = $value; |
|
154 | - break; |
|
155 | - case 'organization_street1': |
|
156 | - $c->organization->address_1 = $value; |
|
157 | - break; |
|
158 | - case 'organization_street2': |
|
159 | - $c->organization->address_2 = $value; |
|
160 | - break; |
|
161 | - case 'organization_city': |
|
162 | - $c->organization->city = $value; |
|
163 | - break; |
|
164 | - case 'organization_state': |
|
165 | - try { |
|
166 | - $state = $this->get_migration_script()->get_or_create_state($value); |
|
167 | - $state_id = $state['STA_ID']; |
|
168 | - $c->organization->STA_ID = $state_id; |
|
169 | - } catch (EE_Error $e) { |
|
170 | - } |
|
171 | - break; |
|
172 | - case 'organization_zip': |
|
173 | - $c->organization->zip = $value; |
|
174 | - break; |
|
175 | - case 'contact_email': |
|
176 | - $c->organization->email = $value; |
|
177 | - break; |
|
178 | - case 'default_payment_status': |
|
179 | - $c->registration->default_STS_ID = $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value); |
|
180 | - break; |
|
181 | - case 'organization_country': |
|
182 | - $iso =$this->get_migration_script()->get_iso_from_3_1_country_id($value); |
|
183 | - $c->organization->CNT_ISO = $iso; |
|
184 | - $country_row = $this->get_migration_script()->get_or_create_country($iso); |
|
185 | - if (! $country_row) { |
|
186 | - $this->add_error(sprintf(__("Could not set country's currency config because no country exists for ISO %s", "event_espresso"), $iso)); |
|
187 | - } |
|
188 | - // can't use EE_Currency_Config's handy constructor because the models are off-limits right now (and it uses them) |
|
189 | - $c->currency->code = $country_row['CNT_cur_code']; // currency code: USD, CAD, EUR |
|
190 | - $c->currency->name = $country_row['CNT_cur_single']; // Dollar |
|
191 | - $c->currency->plural = $country_row['CNT_cur_plural']; // Dollars |
|
192 | - $c->currency->sign = $country_row['CNT_cur_sign']; // currency sign: $ |
|
193 | - $c->currency->sign_b4 = filter_var($country_row['CNT_cur_sign_b4'], FILTER_VALIDATE_BOOLEAN); // currency sign before or after: $TRUE or FALSE$ |
|
194 | - $c->currency->dec_plc = (int) $country_row['CNT_cur_dec_plc']; // decimal places: 2 = 0.00 3 = 0.000 |
|
195 | - $c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk']; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
196 | - $c->currency->thsnds = $country_row['CNT_cur_thsnds']; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
147 | + private function _handle_org_option($option_name, $value) |
|
148 | + { |
|
149 | + $c = EE_Config::instance(); |
|
150 | + $cn = EE_Network_Config::instance(); |
|
151 | + switch ($option_name) { |
|
152 | + case 'organization': |
|
153 | + $c->organization->name = $value; |
|
154 | + break; |
|
155 | + case 'organization_street1': |
|
156 | + $c->organization->address_1 = $value; |
|
157 | + break; |
|
158 | + case 'organization_street2': |
|
159 | + $c->organization->address_2 = $value; |
|
160 | + break; |
|
161 | + case 'organization_city': |
|
162 | + $c->organization->city = $value; |
|
163 | + break; |
|
164 | + case 'organization_state': |
|
165 | + try { |
|
166 | + $state = $this->get_migration_script()->get_or_create_state($value); |
|
167 | + $state_id = $state['STA_ID']; |
|
168 | + $c->organization->STA_ID = $state_id; |
|
169 | + } catch (EE_Error $e) { |
|
170 | + } |
|
171 | + break; |
|
172 | + case 'organization_zip': |
|
173 | + $c->organization->zip = $value; |
|
174 | + break; |
|
175 | + case 'contact_email': |
|
176 | + $c->organization->email = $value; |
|
177 | + break; |
|
178 | + case 'default_payment_status': |
|
179 | + $c->registration->default_STS_ID = $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value); |
|
180 | + break; |
|
181 | + case 'organization_country': |
|
182 | + $iso =$this->get_migration_script()->get_iso_from_3_1_country_id($value); |
|
183 | + $c->organization->CNT_ISO = $iso; |
|
184 | + $country_row = $this->get_migration_script()->get_or_create_country($iso); |
|
185 | + if (! $country_row) { |
|
186 | + $this->add_error(sprintf(__("Could not set country's currency config because no country exists for ISO %s", "event_espresso"), $iso)); |
|
187 | + } |
|
188 | + // can't use EE_Currency_Config's handy constructor because the models are off-limits right now (and it uses them) |
|
189 | + $c->currency->code = $country_row['CNT_cur_code']; // currency code: USD, CAD, EUR |
|
190 | + $c->currency->name = $country_row['CNT_cur_single']; // Dollar |
|
191 | + $c->currency->plural = $country_row['CNT_cur_plural']; // Dollars |
|
192 | + $c->currency->sign = $country_row['CNT_cur_sign']; // currency sign: $ |
|
193 | + $c->currency->sign_b4 = filter_var($country_row['CNT_cur_sign_b4'], FILTER_VALIDATE_BOOLEAN); // currency sign before or after: $TRUE or FALSE$ |
|
194 | + $c->currency->dec_plc = (int) $country_row['CNT_cur_dec_plc']; // decimal places: 2 = 0.00 3 = 0.000 |
|
195 | + $c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk']; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
196 | + $c->currency->thsnds = $country_row['CNT_cur_thsnds']; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
197 | 197 | // $c->currency = new EE_Currency_Config($c->organization->CNT_ISO);break; |
198 | 198 | // case 'currency_symbol': ignore the currency symbol. we'll just go by their country. |
199 | 199 | // $c->currency->sign = $value;break; |
200 | - case 'show_pending_payment_options': |
|
201 | - $c->registration->show_pending_payment_options = ($value == 'Y'); |
|
202 | - break; |
|
203 | - case 'display_address_in_regform': |
|
204 | - $c->template_settings->display_address_in_regform = ($value == 'Y'); |
|
205 | - break; |
|
206 | - case 'default_logo_url': |
|
207 | - $c->organization->logo_url = $value; |
|
208 | - break; |
|
209 | - case 'event_page_id': |
|
210 | - // also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS |
|
211 | - // to ESPRESSO_THANK_YOU |
|
212 | - $reg_page_post = get_post($value); |
|
213 | - $reg_page_post->post_content = str_replace("[ESPRESSO_EVENTS]", "[ESPRESSO_CHECKOUT]", $reg_page_post->post_content); |
|
214 | - wp_update_post($reg_page_post); |
|
215 | - $c->core->reg_page_id = $value; |
|
216 | - break; |
|
217 | - case 'return_url': |
|
218 | - // also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS |
|
219 | - // to ESPRESSO_THANK_YOU |
|
220 | - $thank_you_page_post = get_post($value); |
|
221 | - $thank_you_page_post->post_content = str_replace("[ESPRESSO_PAYMENTS]", "[ESPRESSO_THANK_YOU]", $thank_you_page_post->post_content); |
|
222 | - wp_update_post($thank_you_page_post); |
|
223 | - $c->core->thank_you_page_id = $value; |
|
224 | - break; |
|
225 | - case 'cancel_return': |
|
226 | - $c->core->cancel_page_id = $value; |
|
200 | + case 'show_pending_payment_options': |
|
201 | + $c->registration->show_pending_payment_options = ($value == 'Y'); |
|
202 | + break; |
|
203 | + case 'display_address_in_regform': |
|
204 | + $c->template_settings->display_address_in_regform = ($value == 'Y'); |
|
205 | + break; |
|
206 | + case 'default_logo_url': |
|
207 | + $c->organization->logo_url = $value; |
|
208 | + break; |
|
209 | + case 'event_page_id': |
|
210 | + // also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS |
|
211 | + // to ESPRESSO_THANK_YOU |
|
212 | + $reg_page_post = get_post($value); |
|
213 | + $reg_page_post->post_content = str_replace("[ESPRESSO_EVENTS]", "[ESPRESSO_CHECKOUT]", $reg_page_post->post_content); |
|
214 | + wp_update_post($reg_page_post); |
|
215 | + $c->core->reg_page_id = $value; |
|
216 | + break; |
|
217 | + case 'return_url': |
|
218 | + // also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS |
|
219 | + // to ESPRESSO_THANK_YOU |
|
220 | + $thank_you_page_post = get_post($value); |
|
221 | + $thank_you_page_post->post_content = str_replace("[ESPRESSO_PAYMENTS]", "[ESPRESSO_THANK_YOU]", $thank_you_page_post->post_content); |
|
222 | + wp_update_post($thank_you_page_post); |
|
223 | + $c->core->thank_you_page_id = $value; |
|
224 | + break; |
|
225 | + case 'cancel_return': |
|
226 | + $c->core->cancel_page_id = $value; |
|
227 | 227 | |
228 | - break; |
|
229 | - case 'notify_url': |
|
230 | - $c->core->txn_page_id = $value; |
|
231 | - break; |
|
232 | - case 'use_captcha': |
|
233 | - $c->registration->use_captcha = ($value == 'Y'); |
|
234 | - break; |
|
235 | - case 'recaptcha_publickey': |
|
236 | - $c->registration->recaptcha_publickey = $value; |
|
237 | - break; |
|
238 | - case 'recaptcha_privatekey': |
|
239 | - $c->registration->recaptcha_privatekey = $value; |
|
240 | - break; |
|
241 | - case 'recaptcha_theme': |
|
242 | - $c->registration->recaptcha_theme = $value; |
|
243 | - break; |
|
244 | - case 'recaptcha_width': |
|
245 | - $c->registration->recaptcha_width = $value; |
|
246 | - break; |
|
247 | - case 'recaptcha_language': |
|
248 | - $c->registration->recaptcha_language = $value; |
|
249 | - break; |
|
250 | - case 'espresso_dashboard_widget': |
|
251 | - $c->admin->use_dashboard_widget = ($value == 'Y'); |
|
252 | - break; |
|
253 | - case 'use_personnel_manager': |
|
254 | - $c->admin->use_personnel_manager = ($value == 'Y'); |
|
255 | - break; |
|
256 | - case 'use_event_timezones': |
|
257 | - $c->admin->use_event_timezones = ($value == 'Y'); |
|
258 | - break; |
|
259 | - case 'affiliate_id': |
|
260 | - $c->admin->affiliate_id = $value; |
|
261 | - break; |
|
262 | - case 'site_license_key': |
|
263 | - $cn->core->site_license_key = $value; |
|
264 | - break; |
|
265 | - default: |
|
266 | - do_action('AHEE__EE_DMS_4_1_0__handle_org_option', $option_name, $value); |
|
267 | - } |
|
268 | - } |
|
228 | + break; |
|
229 | + case 'notify_url': |
|
230 | + $c->core->txn_page_id = $value; |
|
231 | + break; |
|
232 | + case 'use_captcha': |
|
233 | + $c->registration->use_captcha = ($value == 'Y'); |
|
234 | + break; |
|
235 | + case 'recaptcha_publickey': |
|
236 | + $c->registration->recaptcha_publickey = $value; |
|
237 | + break; |
|
238 | + case 'recaptcha_privatekey': |
|
239 | + $c->registration->recaptcha_privatekey = $value; |
|
240 | + break; |
|
241 | + case 'recaptcha_theme': |
|
242 | + $c->registration->recaptcha_theme = $value; |
|
243 | + break; |
|
244 | + case 'recaptcha_width': |
|
245 | + $c->registration->recaptcha_width = $value; |
|
246 | + break; |
|
247 | + case 'recaptcha_language': |
|
248 | + $c->registration->recaptcha_language = $value; |
|
249 | + break; |
|
250 | + case 'espresso_dashboard_widget': |
|
251 | + $c->admin->use_dashboard_widget = ($value == 'Y'); |
|
252 | + break; |
|
253 | + case 'use_personnel_manager': |
|
254 | + $c->admin->use_personnel_manager = ($value == 'Y'); |
|
255 | + break; |
|
256 | + case 'use_event_timezones': |
|
257 | + $c->admin->use_event_timezones = ($value == 'Y'); |
|
258 | + break; |
|
259 | + case 'affiliate_id': |
|
260 | + $c->admin->affiliate_id = $value; |
|
261 | + break; |
|
262 | + case 'site_license_key': |
|
263 | + $cn->core->site_license_key = $value; |
|
264 | + break; |
|
265 | + default: |
|
266 | + do_action('AHEE__EE_DMS_4_1_0__handle_org_option', $option_name, $value); |
|
267 | + } |
|
268 | + } |
|
269 | 269 | |
270 | - /** |
|
271 | - * Creates a 4.1 member price discount |
|
272 | - * @global type $wpdb |
|
273 | - * @param type $old_price |
|
274 | - * @return int |
|
275 | - */ |
|
276 | - private function _insert_new_global_surcharge_price($org_options) |
|
277 | - { |
|
278 | - $amount = floatval($org_options['surcharge']); |
|
279 | - // dont createa a price if the surcharge is 0 |
|
280 | - if ($amount <=.01) { |
|
281 | - return 0; |
|
282 | - } |
|
283 | - if ($org_options['surcharge_type'] == 'flat_rate') { |
|
284 | - $price_type = EE_DMS_4_1_0_prices::price_type_flat_surcharge; |
|
285 | - } else { |
|
286 | - $price_type = EE_DMS_4_1_0_prices::price_type_percent_surcharge; |
|
287 | - } |
|
288 | - global $wpdb; |
|
289 | - $cols_n_values = array( |
|
290 | - 'PRT_ID'=>$price_type, |
|
291 | - 'PRC_amount'=>$amount, |
|
292 | - 'PRC_name'=> $org_options['surcharge_text'], |
|
293 | - 'PRC_is_default'=>true, |
|
294 | - 'PRC_overrides'=>false, |
|
295 | - 'PRC_order'=>100, |
|
296 | - 'PRC_deleted'=>false, |
|
297 | - 'PRC_parent'=>null |
|
270 | + /** |
|
271 | + * Creates a 4.1 member price discount |
|
272 | + * @global type $wpdb |
|
273 | + * @param type $old_price |
|
274 | + * @return int |
|
275 | + */ |
|
276 | + private function _insert_new_global_surcharge_price($org_options) |
|
277 | + { |
|
278 | + $amount = floatval($org_options['surcharge']); |
|
279 | + // dont createa a price if the surcharge is 0 |
|
280 | + if ($amount <=.01) { |
|
281 | + return 0; |
|
282 | + } |
|
283 | + if ($org_options['surcharge_type'] == 'flat_rate') { |
|
284 | + $price_type = EE_DMS_4_1_0_prices::price_type_flat_surcharge; |
|
285 | + } else { |
|
286 | + $price_type = EE_DMS_4_1_0_prices::price_type_percent_surcharge; |
|
287 | + } |
|
288 | + global $wpdb; |
|
289 | + $cols_n_values = array( |
|
290 | + 'PRT_ID'=>$price_type, |
|
291 | + 'PRC_amount'=>$amount, |
|
292 | + 'PRC_name'=> $org_options['surcharge_text'], |
|
293 | + 'PRC_is_default'=>true, |
|
294 | + 'PRC_overrides'=>false, |
|
295 | + 'PRC_order'=>100, |
|
296 | + 'PRC_deleted'=>false, |
|
297 | + 'PRC_parent'=>null |
|
298 | 298 | |
299 | - ); |
|
300 | - $datatypes = array( |
|
301 | - '%d',// PRT_ID |
|
302 | - '%f',// PRT_amount |
|
303 | - '%s',// PRC_name |
|
304 | - '%d',// PRC_is_default |
|
305 | - '%d',// PRC_overrides |
|
306 | - '%d',// PRC_order |
|
307 | - '%d',// PRC_deleted |
|
308 | - '%d',// PRC_parent |
|
309 | - ); |
|
310 | - $price_table = $wpdb->prefix."esp_price"; |
|
311 | - $success = $wpdb->insert($price_table, $cols_n_values, $datatypes); |
|
312 | - if (! $success) { |
|
313 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion( |
|
314 | - 'org_options', |
|
315 | - array( |
|
316 | - 'surcharge'=>$org_options['surcharge'], |
|
317 | - 'surcharge_type'=>$org_options['surcharge_type'], |
|
318 | - 'surcharge_text'=>$org_options['surcharge_text']), |
|
319 | - $price_table, |
|
320 | - $cols_n_values, |
|
321 | - $datatypes |
|
322 | - )); |
|
323 | - return 0; |
|
324 | - } |
|
325 | - $new_id = $wpdb->insert_id; |
|
326 | - return $new_id; |
|
327 | - } |
|
299 | + ); |
|
300 | + $datatypes = array( |
|
301 | + '%d',// PRT_ID |
|
302 | + '%f',// PRT_amount |
|
303 | + '%s',// PRC_name |
|
304 | + '%d',// PRC_is_default |
|
305 | + '%d',// PRC_overrides |
|
306 | + '%d',// PRC_order |
|
307 | + '%d',// PRC_deleted |
|
308 | + '%d',// PRC_parent |
|
309 | + ); |
|
310 | + $price_table = $wpdb->prefix."esp_price"; |
|
311 | + $success = $wpdb->insert($price_table, $cols_n_values, $datatypes); |
|
312 | + if (! $success) { |
|
313 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion( |
|
314 | + 'org_options', |
|
315 | + array( |
|
316 | + 'surcharge'=>$org_options['surcharge'], |
|
317 | + 'surcharge_type'=>$org_options['surcharge_type'], |
|
318 | + 'surcharge_text'=>$org_options['surcharge_text']), |
|
319 | + $price_table, |
|
320 | + $cols_n_values, |
|
321 | + $datatypes |
|
322 | + )); |
|
323 | + return 0; |
|
324 | + } |
|
325 | + $new_id = $wpdb->insert_id; |
|
326 | + return $new_id; |
|
327 | + } |
|
328 | 328 | |
329 | - protected $_org_options_we_know_how_to_migrate = array( |
|
330 | - 'organization', |
|
331 | - 'organization_street1', |
|
332 | - 'organization_street2', |
|
333 | - 'organization_city', |
|
334 | - 'organization_state', |
|
335 | - 'organization_zip', |
|
336 | - 'contact_email', |
|
337 | - 'default_mail', |
|
338 | - 'payment_subject', |
|
339 | - 'payment_message', |
|
340 | - 'message', |
|
341 | - 'default_payment_status', |
|
342 | - 'surcharge',// unused? |
|
343 | - 'country_id',// unused? |
|
344 | - 'organization_country', |
|
329 | + protected $_org_options_we_know_how_to_migrate = array( |
|
330 | + 'organization', |
|
331 | + 'organization_street1', |
|
332 | + 'organization_street2', |
|
333 | + 'organization_city', |
|
334 | + 'organization_state', |
|
335 | + 'organization_zip', |
|
336 | + 'contact_email', |
|
337 | + 'default_mail', |
|
338 | + 'payment_subject', |
|
339 | + 'payment_message', |
|
340 | + 'message', |
|
341 | + 'default_payment_status', |
|
342 | + 'surcharge',// unused? |
|
343 | + 'country_id',// unused? |
|
344 | + 'organization_country', |
|
345 | 345 | // 'currency_symbol', |
346 | - 'expire_on_registration_end', |
|
347 | - 'email_before_payment', |
|
348 | - 'email_fancy_headers', |
|
349 | - 'enable_default_style', |
|
350 | - 'event_ssl_active', |
|
351 | - 'selected_style', |
|
352 | - 'show_pending_payment_options', |
|
353 | - 'show_reg_footer', |
|
354 | - 'skip_confirmation_page', |
|
355 | - 'allow_mer_discounts',// no equiv |
|
356 | - 'allow_mer_vouchers',// no equiv |
|
357 | - 'display_short_description_in_event_list', |
|
358 | - 'display_description_on_multi_reg_page', |
|
359 | - 'display_address_in_event_list', |
|
360 | - 'display_address_in_regform', |
|
361 | - 'use_custom_post_types',// no equiv |
|
362 | - 'display_ical_download', |
|
363 | - 'display_featured_image', |
|
364 | - 'themeroller', |
|
365 | - 'default_logo_url', |
|
366 | - 'event_page_id', |
|
367 | - 'return_url', |
|
368 | - 'cancel_return', |
|
369 | - 'notify_url', |
|
370 | - 'events_in_dashboard', |
|
371 | - 'use_captcha', |
|
372 | - 'recaptcha_publickey', |
|
373 | - 'recaptcha_privatekey', |
|
374 | - 'recaptcha_theme', |
|
375 | - 'recaptcha_width', |
|
376 | - 'recaptcha_language', |
|
377 | - 'espresso_dashboard_widget', |
|
378 | - 'time_reg_limit', |
|
346 | + 'expire_on_registration_end', |
|
347 | + 'email_before_payment', |
|
348 | + 'email_fancy_headers', |
|
349 | + 'enable_default_style', |
|
350 | + 'event_ssl_active', |
|
351 | + 'selected_style', |
|
352 | + 'show_pending_payment_options', |
|
353 | + 'show_reg_footer', |
|
354 | + 'skip_confirmation_page', |
|
355 | + 'allow_mer_discounts',// no equiv |
|
356 | + 'allow_mer_vouchers',// no equiv |
|
357 | + 'display_short_description_in_event_list', |
|
358 | + 'display_description_on_multi_reg_page', |
|
359 | + 'display_address_in_event_list', |
|
360 | + 'display_address_in_regform', |
|
361 | + 'use_custom_post_types',// no equiv |
|
362 | + 'display_ical_download', |
|
363 | + 'display_featured_image', |
|
364 | + 'themeroller', |
|
365 | + 'default_logo_url', |
|
366 | + 'event_page_id', |
|
367 | + 'return_url', |
|
368 | + 'cancel_return', |
|
369 | + 'notify_url', |
|
370 | + 'events_in_dashboard', |
|
371 | + 'use_captcha', |
|
372 | + 'recaptcha_publickey', |
|
373 | + 'recaptcha_privatekey', |
|
374 | + 'recaptcha_theme', |
|
375 | + 'recaptcha_width', |
|
376 | + 'recaptcha_language', |
|
377 | + 'espresso_dashboard_widget', |
|
378 | + 'time_reg_limit', |
|
379 | 379 | // 'use_attendee_pre_approval', removed in 4.1- instead this is factored into the default reg status |
380 | - 'use_personnel_manager',// no equiv |
|
381 | - 'use_event_timezones', |
|
382 | - 'full_logging', |
|
383 | - 'surcharge_type',// unused |
|
384 | - 'surcharge_text',// unused |
|
385 | - 'affiliate_id', |
|
386 | - 'site_license_key', |
|
387 | - ); |
|
380 | + 'use_personnel_manager',// no equiv |
|
381 | + 'use_event_timezones', |
|
382 | + 'full_logging', |
|
383 | + 'surcharge_type',// unused |
|
384 | + 'surcharge_text',// unused |
|
385 | + 'affiliate_id', |
|
386 | + 'site_license_key', |
|
387 | + ); |
|
388 | 388 | } |
@@ -18,68 +18,68 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - public function __construct($routing = true) |
|
22 | - { |
|
23 | - parent::__construct($routing); |
|
24 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
25 | - } |
|
21 | + public function __construct($routing = true) |
|
22 | + { |
|
23 | + parent::__construct($routing); |
|
24 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - protected function _extend_page_config() |
|
29 | - { |
|
28 | + protected function _extend_page_config() |
|
29 | + { |
|
30 | 30 | |
31 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
31 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
32 | 32 | |
33 | - // filters and action hooks here |
|
34 | - add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
35 | - add_filter( |
|
36 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
37 | - array($this, 'update_debug_logging_options'), |
|
38 | - 10, |
|
39 | - 1 |
|
40 | - ); |
|
41 | - } |
|
33 | + // filters and action hooks here |
|
34 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
35 | + add_filter( |
|
36 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
37 | + array($this, 'update_debug_logging_options'), |
|
38 | + 10, |
|
39 | + 1 |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /************* Logging Settings *************/ |
|
45 | + /************* Logging Settings *************/ |
|
46 | 46 | |
47 | - /** |
|
48 | - * debug_logging_options |
|
49 | - * |
|
50 | - * @param array $template_args |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function debug_logging_options($template_args = array()) |
|
55 | - { |
|
56 | - $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint( |
|
57 | - EE_Registry::instance()->CFG->admin->use_remote_logging |
|
58 | - ) : false; |
|
59 | - $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) |
|
60 | - && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) |
|
61 | - ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
62 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
63 | - EEH_Template::display_template($template, $template_args); |
|
64 | - } |
|
47 | + /** |
|
48 | + * debug_logging_options |
|
49 | + * |
|
50 | + * @param array $template_args |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function debug_logging_options($template_args = array()) |
|
55 | + { |
|
56 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint( |
|
57 | + EE_Registry::instance()->CFG->admin->use_remote_logging |
|
58 | + ) : false; |
|
59 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) |
|
60 | + && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) |
|
61 | + ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
62 | + $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
63 | + EEH_Template::display_template($template, $template_args); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * update_debug_logging_options |
|
69 | - * |
|
70 | - * @param array $admin_options |
|
71 | - * |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function update_debug_logging_options($admin_options = array()) |
|
75 | - { |
|
76 | - $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint( |
|
77 | - $this->_req_data['use_remote_logging'] |
|
78 | - ) : $admin_options->use_remote_logging; |
|
79 | - $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw( |
|
80 | - $this->_req_data['remote_logging_url'] |
|
81 | - ) : $admin_options->remote_logging_url; |
|
67 | + /** |
|
68 | + * update_debug_logging_options |
|
69 | + * |
|
70 | + * @param array $admin_options |
|
71 | + * |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function update_debug_logging_options($admin_options = array()) |
|
75 | + { |
|
76 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint( |
|
77 | + $this->_req_data['use_remote_logging'] |
|
78 | + ) : $admin_options->use_remote_logging; |
|
79 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw( |
|
80 | + $this->_req_data['remote_logging_url'] |
|
81 | + ) : $admin_options->remote_logging_url; |
|
82 | 82 | |
83 | - return $admin_options; |
|
84 | - } |
|
83 | + return $admin_options; |
|
84 | + } |
|
85 | 85 | } |
@@ -15,81 +15,81 @@ |
||
15 | 15 | class Admin_Options_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Admin Options Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'admin-options-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Admin Options Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'admin-options-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 30 => array( |
|
31 | - 'id' => 'use_remote_logging', |
|
32 | - 'content' => $this->_use_remote_logging_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'right', |
|
35 | - 'tipAdjustmentY' => -50, |
|
36 | - 'tipAdjustmentX' => 15, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 40 => array( |
|
40 | - 'id' => 'affiliate_info', |
|
41 | - 'content' => $this->_show_reg_footer_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'right', |
|
44 | - 'tipAdjustmentY' => -50, |
|
45 | - 'tipAdjustmentX' => 15, |
|
46 | - ), |
|
47 | - ), |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 30 => array( |
|
31 | + 'id' => 'use_remote_logging', |
|
32 | + 'content' => $this->_use_remote_logging_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'right', |
|
35 | + 'tipAdjustmentY' => -50, |
|
36 | + 'tipAdjustmentX' => 15, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 40 => array( |
|
40 | + 'id' => 'affiliate_info', |
|
41 | + 'content' => $this->_show_reg_footer_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'right', |
|
44 | + 'tipAdjustmentY' => -50, |
|
45 | + 'tipAdjustmentX' => 15, |
|
46 | + ), |
|
47 | + ), |
|
48 | 48 | |
49 | - 60 => array( |
|
50 | - 'id' => 'help_tour_activation', |
|
51 | - 'content' => $this->_help_tour_activation_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'right', |
|
54 | - 'tipAdjustmentY' => -50, |
|
55 | - 'tipAdjustmentX' => 15, |
|
56 | - ), |
|
57 | - ), |
|
58 | - ); |
|
59 | - } |
|
49 | + 60 => array( |
|
50 | + 'id' => 'help_tour_activation', |
|
51 | + 'content' => $this->_help_tour_activation_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'right', |
|
54 | + 'tipAdjustmentY' => -50, |
|
55 | + 'tipAdjustmentX' => 15, |
|
56 | + ), |
|
57 | + ), |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - protected function _start() |
|
63 | - { |
|
64 | - $content = '<h3>' . __('Admin Options', 'event_espresso') . '</h3>'; |
|
65 | - $content .= '<p>' |
|
66 | - . __( |
|
67 | - 'This tour of the Admin Options page will go over different areas of the screen to help you understand what they are used for.', |
|
68 | - 'event_espresso' |
|
69 | - ) . '</p>'; |
|
70 | - return $content; |
|
71 | - } |
|
62 | + protected function _start() |
|
63 | + { |
|
64 | + $content = '<h3>' . __('Admin Options', 'event_espresso') . '</h3>'; |
|
65 | + $content .= '<p>' |
|
66 | + . __( |
|
67 | + 'This tour of the Admin Options page will go over different areas of the screen to help you understand what they are used for.', |
|
68 | + 'event_espresso' |
|
69 | + ) . '</p>'; |
|
70 | + return $content; |
|
71 | + } |
|
72 | 72 | |
73 | - protected function _use_remote_logging_stop() |
|
74 | - { |
|
75 | - return '<p>' |
|
76 | - . __( |
|
77 | - ' This option sends all Event Espresso debugging data and get / post variables to the specified URL below.', |
|
78 | - 'event_espresso' |
|
79 | - ) . '</p>'; |
|
80 | - } |
|
73 | + protected function _use_remote_logging_stop() |
|
74 | + { |
|
75 | + return '<p>' |
|
76 | + . __( |
|
77 | + ' This option sends all Event Espresso debugging data and get / post variables to the specified URL below.', |
|
78 | + 'event_espresso' |
|
79 | + ) . '</p>'; |
|
80 | + } |
|
81 | 81 | |
82 | - protected function _show_reg_footer_stop() |
|
83 | - { |
|
84 | - return '<p>' |
|
85 | - . __( |
|
86 | - 'Support us by adding a small link to Event Espresso in your event pages. You can even earn money for yourself by adding your affiliate link there!', |
|
87 | - 'event_espresso' |
|
88 | - ) . '</p>'; |
|
89 | - } |
|
82 | + protected function _show_reg_footer_stop() |
|
83 | + { |
|
84 | + return '<p>' |
|
85 | + . __( |
|
86 | + 'Support us by adding a small link to Event Espresso in your event pages. You can even earn money for yourself by adding your affiliate link there!', |
|
87 | + 'event_espresso' |
|
88 | + ) . '</p>'; |
|
89 | + } |
|
90 | 90 | |
91 | - protected function _help_tour_activation_stop() |
|
92 | - { |
|
93 | - return '<p>' . __('Turn these help tours on / off for Event Espresso pages.', 'event_espresso') . '</p>'; |
|
94 | - } |
|
91 | + protected function _help_tour_activation_stop() |
|
92 | + { |
|
93 | + return '<p>' . __('Turn these help tours on / off for Event Espresso pages.', 'event_espresso') . '</p>'; |
|
94 | + } |
|
95 | 95 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | protected function _start() |
63 | 63 | { |
64 | - $content = '<h3>' . __('Admin Options', 'event_espresso') . '</h3>'; |
|
64 | + $content = '<h3>'.__('Admin Options', 'event_espresso').'</h3>'; |
|
65 | 65 | $content .= '<p>' |
66 | 66 | . __( |
67 | 67 | 'This tour of the Admin Options page will go over different areas of the screen to help you understand what they are used for.', |
68 | 68 | 'event_espresso' |
69 | - ) . '</p>'; |
|
69 | + ).'</p>'; |
|
70 | 70 | return $content; |
71 | 71 | } |
72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | . __( |
77 | 77 | ' This option sends all Event Espresso debugging data and get / post variables to the specified URL below.', |
78 | 78 | 'event_espresso' |
79 | - ) . '</p>'; |
|
79 | + ).'</p>'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | protected function _show_reg_footer_stop() |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | . __( |
86 | 86 | 'Support us by adding a small link to Event Espresso in your event pages. You can even earn money for yourself by adding your affiliate link there!', |
87 | 87 | 'event_espresso' |
88 | - ) . '</p>'; |
|
88 | + ).'</p>'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function _help_tour_activation_stop() |
92 | 92 | { |
93 | - return '<p>' . __('Turn these help tours on / off for Event Espresso pages.', 'event_espresso') . '</p>'; |
|
93 | + return '<p>'.__('Turn these help tours on / off for Event Espresso pages.', 'event_espresso').'</p>'; |
|
94 | 94 | } |
95 | 95 | } |
@@ -32,12 +32,12 @@ |
||
32 | 32 | <li> |
33 | 33 | <strong><?php esc_html_e('Event Espresso Affiliate ID', 'event_espresso'); ?></strong><br /> |
34 | 34 | <?php printf( |
35 | - esc_html__( |
|
36 | - 'You can also monetize this link by signing up to our %1$saffiliate program%2$s and adding in your affiliate ID here.', |
|
37 | - 'event_espresso' |
|
38 | - ), |
|
39 | - '<a href="https://eventespresso.com/affiliates/">', |
|
40 | - '</a>' |
|
35 | + esc_html__( |
|
36 | + 'You can also monetize this link by signing up to our %1$saffiliate program%2$s and adding in your affiliate ID here.', |
|
37 | + 'event_espresso' |
|
38 | + ), |
|
39 | + '<a href="https://eventespresso.com/affiliates/">', |
|
40 | + '</a>' |
|
41 | 41 | ); ?> |
42 | 42 | </li> |
43 | 43 | </ul> |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | - $matches = array(); |
|
21 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
20 | + $matches = array(); |
|
21 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -38,71 +38,71 @@ discard block |
||
38 | 38 | class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base |
39 | 39 | { |
40 | 40 | |
41 | - /** |
|
42 | - * return EE_DMS_Core_4_8_0 |
|
43 | - * |
|
44 | - * @param TableManager $table_manager |
|
45 | - * @param TableAnalysis $table_analysis |
|
46 | - */ |
|
47 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | - { |
|
49 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
50 | - $this->_priority = 10; |
|
51 | - $this->_migration_stages = array( |
|
52 | - new EE_DMS_4_8_0_pretax_totals(), |
|
53 | - new EE_DMS_4_8_0_event_subtotals(), |
|
54 | - ); |
|
55 | - parent::__construct($table_manager, $table_analysis); |
|
56 | - } |
|
41 | + /** |
|
42 | + * return EE_DMS_Core_4_8_0 |
|
43 | + * |
|
44 | + * @param TableManager $table_manager |
|
45 | + * @param TableAnalysis $table_analysis |
|
46 | + */ |
|
47 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | + { |
|
49 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_8_0_pretax_totals(), |
|
53 | + new EE_DMS_4_8_0_event_subtotals(), |
|
54 | + ); |
|
55 | + parent::__construct($table_manager, $table_analysis); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * Because this is being done at basically the same time as the MER-ready branch |
|
62 | - * of core, it's possible people might have installed MEr-ready branch first, |
|
63 | - * and then this one, in which case we still want to perform this migration, |
|
64 | - * even though the version might not have increased |
|
65 | - * |
|
66 | - * @param array $version_array |
|
67 | - * @return bool |
|
68 | - */ |
|
69 | - public function can_migrate_from_version($version_array) |
|
70 | - { |
|
71 | - $version_string = $version_array['Core']; |
|
72 | - if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
60 | + /** |
|
61 | + * Because this is being done at basically the same time as the MER-ready branch |
|
62 | + * of core, it's possible people might have installed MEr-ready branch first, |
|
63 | + * and then this one, in which case we still want to perform this migration, |
|
64 | + * even though the version might not have increased |
|
65 | + * |
|
66 | + * @param array $version_array |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | + public function can_migrate_from_version($version_array) |
|
70 | + { |
|
71 | + $version_string = $version_array['Core']; |
|
72 | + if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
73 | 73 | // echo "$version_string can be migrated from"; |
74 | - return true; |
|
75 | - } elseif (! $version_string) { |
|
74 | + return true; |
|
75 | + } elseif (! $version_string) { |
|
76 | 76 | // echo "no version string provided: $version_string"; |
77 | - // no version string provided... this must be pre 4.3 |
|
78 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | - } else { |
|
77 | + // no version string provided... this must be pre 4.3 |
|
78 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | + } else { |
|
80 | 80 | // echo "$version_string doesnt apply"; |
81 | - return false; |
|
82 | - } |
|
83 | - } |
|
81 | + return false; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @return bool |
|
89 | - */ |
|
90 | - public function schema_changes_before_migration() |
|
91 | - { |
|
92 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
93 | - $now_in_mysql = current_time('mysql', true); |
|
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | - $table_name = 'esp_answer'; |
|
96 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
87 | + /** |
|
88 | + * @return bool |
|
89 | + */ |
|
90 | + public function schema_changes_before_migration() |
|
91 | + { |
|
92 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
93 | + $now_in_mysql = current_time('mysql', true); |
|
94 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID int(10) unsigned NOT NULL, |
98 | 98 | QST_ID int(10) unsigned NOT NULL, |
99 | 99 | ANS_value text NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID), |
101 | 101 | KEY REG_ID (REG_ID), |
102 | 102 | KEY QST_ID (QST_ID)"; |
103 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | - $table_name = 'esp_attendee_meta'; |
|
105 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
103 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | + $table_name = 'esp_attendee_meta'; |
|
105 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
106 | 106 | ATT_ID bigint(20) unsigned NOT NULL, |
107 | 107 | ATT_fname varchar(45) NOT NULL, |
108 | 108 | ATT_lname varchar(45) NOT NULL, |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | PRIMARY KEY (ATTM_ID), |
118 | 118 | KEY ATT_ID (ATT_ID), |
119 | 119 | KEY ATT_email (ATT_email(191))"; |
120 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
121 | - $table_name = 'esp_country'; |
|
122 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
120 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
121 | + $table_name = 'esp_country'; |
|
122 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
123 | 123 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
124 | 124 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
125 | 125 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | CNT_is_EU tinyint(1) DEFAULT '0', |
136 | 136 | CNT_active tinyint(1) DEFAULT '0', |
137 | 137 | PRIMARY KEY (CNT_ISO)"; |
138 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
139 | - $table_name = 'esp_currency'; |
|
140 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
138 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
139 | + $table_name = 'esp_currency'; |
|
140 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
141 | 141 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
142 | 142 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
143 | 143 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
144 | 144 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
145 | 145 | CUR_active tinyint(1) DEFAULT '0', |
146 | 146 | PRIMARY KEY (CUR_code)"; |
147 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
148 | - $table_name = 'esp_currency_payment_method'; |
|
149 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
147 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
148 | + $table_name = 'esp_currency_payment_method'; |
|
149 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
150 | 150 | CUR_code varchar(6) collate utf8_bin NOT NULL, |
151 | 151 | PMD_ID int(11) NOT NULL, |
152 | 152 | PRIMARY KEY (CPM_ID), |
153 | 153 | KEY PMD_ID (PMD_ID)"; |
154 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
155 | - $table_name = 'esp_datetime'; |
|
156 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
155 | + $table_name = 'esp_datetime'; |
|
156 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
157 | 157 | EVT_ID bigint(20) unsigned NOT NULL, |
158 | 158 | DTT_name varchar(255) NOT NULL DEFAULT '', |
159 | 159 | DTT_description text NOT NULL, |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | KEY DTT_EVT_start (DTT_EVT_start), |
170 | 170 | KEY EVT_ID (EVT_ID), |
171 | 171 | KEY DTT_is_primary (DTT_is_primary)"; |
172 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
173 | - $table_name = 'esp_event_meta'; |
|
174 | - $sql = " |
|
172 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
173 | + $table_name = 'esp_event_meta'; |
|
174 | + $sql = " |
|
175 | 175 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
176 | 176 | EVT_ID bigint(20) unsigned NOT NULL, |
177 | 177 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -187,34 +187,34 @@ discard block |
||
187 | 187 | EVT_donations tinyint(1) NULL, |
188 | 188 | PRIMARY KEY (EVTM_ID), |
189 | 189 | KEY EVT_ID (EVT_ID)"; |
190 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | - $table_name = 'esp_event_question_group'; |
|
192 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
190 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | + $table_name = 'esp_event_question_group'; |
|
192 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
193 | 193 | EVT_ID bigint(20) unsigned NOT NULL, |
194 | 194 | QSG_ID int(10) unsigned NOT NULL, |
195 | 195 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
196 | 196 | PRIMARY KEY (EQG_ID), |
197 | 197 | KEY EVT_ID (EVT_ID), |
198 | 198 | KEY QSG_ID (QSG_ID)"; |
199 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
200 | - $table_name = 'esp_event_venue'; |
|
201 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
199 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
200 | + $table_name = 'esp_event_venue'; |
|
201 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
202 | 202 | EVT_ID bigint(20) unsigned NOT NULL, |
203 | 203 | VNU_ID bigint(20) unsigned NOT NULL, |
204 | 204 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
205 | 205 | PRIMARY KEY (EVV_ID)"; |
206 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
207 | - $table_name = 'esp_extra_meta'; |
|
208 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
206 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
207 | + $table_name = 'esp_extra_meta'; |
|
208 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
209 | 209 | OBJ_ID int(11) DEFAULT NULL, |
210 | 210 | EXM_type varchar(45) DEFAULT NULL, |
211 | 211 | EXM_key varchar(45) DEFAULT NULL, |
212 | 212 | EXM_value text, |
213 | 213 | PRIMARY KEY (EXM_ID), |
214 | 214 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
215 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | - $table_name = 'esp_extra_join'; |
|
217 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
215 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | + $table_name = 'esp_extra_join'; |
|
217 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
218 | 218 | EXJ_first_model_id varchar(6) NOT NULL, |
219 | 219 | EXJ_first_model_name varchar(20) NOT NULL, |
220 | 220 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | PRIMARY KEY (EXJ_ID), |
223 | 223 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
224 | 224 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
225 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
226 | - $table_name = 'esp_line_item'; |
|
227 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
225 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
226 | + $table_name = 'esp_line_item'; |
|
227 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
228 | 228 | LIN_code varchar(245) NOT NULL DEFAULT '', |
229 | 229 | TXN_ID int(11) DEFAULT NULL, |
230 | 230 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | PRIMARY KEY (LIN_ID), |
244 | 244 | KEY LIN_code (LIN_code(191)), |
245 | 245 | KEY TXN_ID (TXN_ID)"; |
246 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
247 | - $table_name = 'esp_log'; |
|
248 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
246 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
247 | + $table_name = 'esp_log'; |
|
248 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
249 | 249 | LOG_time datetime DEFAULT NULL, |
250 | 250 | OBJ_ID varchar(45) DEFAULT NULL, |
251 | 251 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -256,18 +256,18 @@ discard block |
||
256 | 256 | KEY LOG_time (LOG_time), |
257 | 257 | KEY OBJ (OBJ_type,OBJ_ID), |
258 | 258 | KEY LOG_type (LOG_type)"; |
259 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
260 | - $table_name = 'esp_message_template'; |
|
261 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
259 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
260 | + $table_name = 'esp_message_template'; |
|
261 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
262 | 262 | GRP_ID int(10) unsigned NOT NULL, |
263 | 263 | MTP_context varchar(50) NOT NULL, |
264 | 264 | MTP_template_field varchar(30) NOT NULL, |
265 | 265 | MTP_content text NOT NULL, |
266 | 266 | PRIMARY KEY (MTP_ID), |
267 | 267 | KEY GRP_ID (GRP_ID)"; |
268 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | - $table_name = 'esp_message_template_group'; |
|
270 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
268 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | + $table_name = 'esp_message_template_group'; |
|
270 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
271 | 271 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
272 | 272 | MTP_name varchar(245) NOT NULL DEFAULT '', |
273 | 273 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
280 | 280 | PRIMARY KEY (GRP_ID), |
281 | 281 | KEY MTP_user_id (MTP_user_id)"; |
282 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
283 | - $table_name = 'esp_event_message_template'; |
|
284 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
282 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
283 | + $table_name = 'esp_event_message_template'; |
|
284 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
285 | 285 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
286 | 286 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
287 | 287 | PRIMARY KEY (EMT_ID), |
288 | 288 | KEY EVT_ID (EVT_ID), |
289 | 289 | KEY GRP_ID (GRP_ID)"; |
290 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | - $table_name = 'esp_payment'; |
|
292 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
290 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | + $table_name = 'esp_payment'; |
|
292 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
293 | 293 | TXN_ID int(10) unsigned DEFAULT NULL, |
294 | 294 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
295 | 295 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | PRIMARY KEY (PAY_ID), |
307 | 307 | KEY PAY_timestamp (PAY_timestamp), |
308 | 308 | KEY TXN_ID (TXN_ID)"; |
309 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
310 | - $table_name = 'esp_payment_method'; |
|
311 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
309 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
310 | + $table_name = 'esp_payment_method'; |
|
311 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
312 | 312 | PMD_type varchar(124) DEFAULT NULL, |
313 | 313 | PMD_name varchar(255) DEFAULT NULL, |
314 | 314 | PMD_desc text, |
@@ -324,32 +324,32 @@ discard block |
||
324 | 324 | PRIMARY KEY (PMD_ID), |
325 | 325 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
326 | 326 | KEY PMD_type (PMD_type)"; |
327 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
328 | - $table_name = "esp_ticket_price"; |
|
329 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
327 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
328 | + $table_name = "esp_ticket_price"; |
|
329 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
330 | 330 | TKT_ID int(10) unsigned NOT NULL, |
331 | 331 | PRC_ID int(10) unsigned NOT NULL, |
332 | 332 | PRIMARY KEY (TKP_ID), |
333 | 333 | KEY TKT_ID (TKT_ID), |
334 | 334 | KEY PRC_ID (PRC_ID)"; |
335 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | - $table_name = "esp_datetime_ticket"; |
|
337 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
335 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | + $table_name = "esp_datetime_ticket"; |
|
337 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
338 | 338 | DTT_ID int(10) unsigned NOT NULL, |
339 | 339 | TKT_ID int(10) unsigned NOT NULL, |
340 | 340 | PRIMARY KEY (DTK_ID), |
341 | 341 | KEY DTT_ID (DTT_ID), |
342 | 342 | KEY TKT_ID (TKT_ID)"; |
343 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | - $table_name = "esp_ticket_template"; |
|
345 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
343 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | + $table_name = "esp_ticket_template"; |
|
345 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
346 | 346 | TTM_name varchar(45) NOT NULL, |
347 | 347 | TTM_description text, |
348 | 348 | TTM_file varchar(45), |
349 | 349 | PRIMARY KEY (TTM_ID)"; |
350 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | - $table_name = 'esp_question'; |
|
352 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
350 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | + $table_name = 'esp_question'; |
|
352 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
353 | 353 | QST_display_text text NOT NULL, |
354 | 354 | QST_admin_label varchar(255) NOT NULL, |
355 | 355 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
364 | 364 | PRIMARY KEY (QST_ID), |
365 | 365 | KEY QST_order (QST_order)'; |
366 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | - $table_name = 'esp_question_group_question'; |
|
368 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
366 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | + $table_name = 'esp_question_group_question'; |
|
368 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
369 | 369 | QSG_ID int(10) unsigned NOT NULL, |
370 | 370 | QST_ID int(10) unsigned NOT NULL, |
371 | 371 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
372 | 372 | PRIMARY KEY (QGQ_ID), |
373 | 373 | KEY QST_ID (QST_ID), |
374 | 374 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
375 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | - $table_name = 'esp_question_option'; |
|
377 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
375 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | + $table_name = 'esp_question_option'; |
|
377 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
378 | 378 | QSO_value varchar(255) NOT NULL, |
379 | 379 | QSO_desc text NOT NULL, |
380 | 380 | QST_ID int(10) unsigned NOT NULL, |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | PRIMARY KEY (QSO_ID), |
385 | 385 | KEY QST_ID (QST_ID), |
386 | 386 | KEY QSO_order (QSO_order)"; |
387 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | - $table_name = 'esp_registration'; |
|
389 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
387 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | + $table_name = 'esp_registration'; |
|
389 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
390 | 390 | EVT_ID bigint(20) unsigned NOT NULL, |
391 | 391 | ATT_ID bigint(20) unsigned NOT NULL, |
392 | 392 | TXN_ID int(10) unsigned NOT NULL, |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | KEY TKT_ID (TKT_ID), |
411 | 411 | KEY EVT_ID (EVT_ID), |
412 | 412 | KEY STS_ID (STS_ID)"; |
413 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
414 | - $table_name = 'esp_registration_payment'; |
|
415 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
413 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
414 | + $table_name = 'esp_registration_payment'; |
|
415 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
416 | 416 | REG_ID int(10) unsigned NOT NULL, |
417 | 417 | PAY_ID int(10) unsigned NULL, |
418 | 418 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
419 | 419 | PRIMARY KEY (RPY_ID), |
420 | 420 | KEY REG_ID (REG_ID), |
421 | 421 | KEY PAY_ID (PAY_ID)"; |
422 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
423 | - $table_name = 'esp_checkin'; |
|
424 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
422 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
423 | + $table_name = 'esp_checkin'; |
|
424 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
425 | 425 | REG_ID int(10) unsigned NOT NULL, |
426 | 426 | DTT_ID int(10) unsigned NOT NULL, |
427 | 427 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | PRIMARY KEY (CHK_ID), |
430 | 430 | KEY REG_ID (REG_ID), |
431 | 431 | KEY DTT_ID (DTT_ID)"; |
432 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | - $table_name = 'esp_state'; |
|
434 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | + $table_name = 'esp_state'; |
|
434 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
435 | 435 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
436 | 436 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
437 | 437 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | PRIMARY KEY (STA_ID), |
440 | 440 | KEY STA_abbrev (STA_abbrev), |
441 | 441 | KEY CNT_ISO (CNT_ISO)"; |
442 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | - $table_name = 'esp_status'; |
|
444 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
442 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | + $table_name = 'esp_status'; |
|
444 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
445 | 445 | STS_code varchar(45) NOT NULL, |
446 | 446 | STS_type varchar(45) NOT NULL, |
447 | 447 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
450 | 450 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
451 | 451 | KEY STS_type (STS_type)"; |
452 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
453 | - $table_name = 'esp_transaction'; |
|
454 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
452 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
453 | + $table_name = 'esp_transaction'; |
|
454 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
455 | 455 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
456 | 456 | TXN_total decimal(10,3) DEFAULT '0.00', |
457 | 457 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -463,9 +463,9 @@ discard block |
||
463 | 463 | PRIMARY KEY (TXN_ID), |
464 | 464 | KEY TXN_timestamp (TXN_timestamp), |
465 | 465 | KEY STS_ID (STS_ID)"; |
466 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
467 | - $table_name = 'esp_venue_meta'; |
|
468 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
466 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
467 | + $table_name = 'esp_venue_meta'; |
|
468 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
469 | 469 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
470 | 470 | VNU_address varchar(255) DEFAULT NULL, |
471 | 471 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -484,10 +484,10 @@ discard block |
||
484 | 484 | KEY VNU_ID (VNU_ID), |
485 | 485 | KEY STA_ID (STA_ID), |
486 | 486 | KEY CNT_ISO (CNT_ISO)"; |
487 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | - // modified tables |
|
489 | - $table_name = "esp_price"; |
|
490 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
487 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | + // modified tables |
|
489 | + $table_name = "esp_price"; |
|
490 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
491 | 491 | PRT_ID tinyint(3) unsigned NOT NULL, |
492 | 492 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
493 | 493 | PRC_name varchar(245) NOT NULL, |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | PRC_parent int(10) unsigned DEFAULT 0, |
501 | 501 | PRIMARY KEY (PRC_ID), |
502 | 502 | KEY PRT_ID (PRT_ID)"; |
503 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
504 | - $table_name = "esp_price_type"; |
|
505 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
503 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
504 | + $table_name = "esp_price_type"; |
|
505 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
506 | 506 | PRT_name varchar(45) NOT NULL, |
507 | 507 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
508 | 508 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
512 | 512 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
513 | 513 | PRIMARY KEY (PRT_ID)"; |
514 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
515 | - $table_name = "esp_ticket"; |
|
516 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
514 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
515 | + $table_name = "esp_ticket"; |
|
516 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
517 | 517 | TTM_ID int(10) unsigned NOT NULL, |
518 | 518 | TKT_name varchar(245) NOT NULL DEFAULT '', |
519 | 519 | TKT_description text NOT NULL, |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
536 | 536 | PRIMARY KEY (TKT_ID), |
537 | 537 | KEY TKT_start_date (TKT_start_date)"; |
538 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | - $table_name = 'esp_question_group'; |
|
540 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
538 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | + $table_name = 'esp_question_group'; |
|
540 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
541 | 541 | QSG_name varchar(255) NOT NULL, |
542 | 542 | QSG_identifier varchar(100) NOT NULL, |
543 | 543 | QSG_desc text NULL, |
@@ -550,223 +550,223 @@ discard block |
||
550 | 550 | PRIMARY KEY (QSG_ID), |
551 | 551 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
552 | 552 | KEY QSG_order (QSG_order)'; |
553 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
554 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
555 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
556 | - // (because many need to convert old string states to foreign keys into the states table) |
|
557 | - $script_4_1_defaults->insert_default_states(); |
|
558 | - $script_4_1_defaults->insert_default_countries(); |
|
559 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
560 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
561 | - $script_4_5_defaults->insert_default_price_types(); |
|
562 | - $script_4_5_defaults->insert_default_prices(); |
|
563 | - $script_4_5_defaults->insert_default_tickets(); |
|
564 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
565 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
566 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
567 | - $script_4_6_defaults->insert_default_currencies(); |
|
568 | - $this->verify_new_countries(); |
|
569 | - $this->verify_new_currencies(); |
|
570 | - return true; |
|
571 | - } |
|
553 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
554 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
555 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
556 | + // (because many need to convert old string states to foreign keys into the states table) |
|
557 | + $script_4_1_defaults->insert_default_states(); |
|
558 | + $script_4_1_defaults->insert_default_countries(); |
|
559 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
560 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
561 | + $script_4_5_defaults->insert_default_price_types(); |
|
562 | + $script_4_5_defaults->insert_default_prices(); |
|
563 | + $script_4_5_defaults->insert_default_tickets(); |
|
564 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
565 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
566 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
567 | + $script_4_6_defaults->insert_default_currencies(); |
|
568 | + $this->verify_new_countries(); |
|
569 | + $this->verify_new_currencies(); |
|
570 | + return true; |
|
571 | + } |
|
572 | 572 | |
573 | 573 | |
574 | 574 | |
575 | - /** |
|
576 | - * @return boolean |
|
577 | - */ |
|
578 | - public function schema_changes_after_migration() |
|
579 | - { |
|
580 | - $this->fix_non_default_taxes(); |
|
581 | - // this is actually the same as the last DMS |
|
582 | - /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
583 | - $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
584 | - return $script_4_7_defaults->schema_changes_after_migration(); |
|
585 | - } |
|
575 | + /** |
|
576 | + * @return boolean |
|
577 | + */ |
|
578 | + public function schema_changes_after_migration() |
|
579 | + { |
|
580 | + $this->fix_non_default_taxes(); |
|
581 | + // this is actually the same as the last DMS |
|
582 | + /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
583 | + $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
584 | + return $script_4_7_defaults->schema_changes_after_migration(); |
|
585 | + } |
|
586 | 586 | |
587 | 587 | |
588 | 588 | |
589 | - public function migration_page_hooks() |
|
590 | - { |
|
591 | - } |
|
589 | + public function migration_page_hooks() |
|
590 | + { |
|
591 | + } |
|
592 | 592 | |
593 | 593 | |
594 | 594 | |
595 | - /** |
|
596 | - * verifies each of the new countries exists that somehow we missed in 4.1 |
|
597 | - */ |
|
598 | - public function verify_new_countries() |
|
599 | - { |
|
600 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
601 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
602 | - // currency symbols: http://www.xe.com/symbols.php |
|
603 | - // CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
604 | - // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
605 | - $newer_countries = array( |
|
606 | - array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
607 | - array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
608 | - array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
609 | - array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
610 | - array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
611 | - array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
612 | - array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
613 | - array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
614 | - array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
615 | - array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
616 | - array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
617 | - array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
618 | - array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
619 | - array( |
|
620 | - 'BQ', |
|
621 | - 'BES', |
|
622 | - 0, |
|
623 | - 'Bonaire, Saint Eustatius and Saba', |
|
624 | - 'USD', |
|
625 | - 'Dollar', |
|
626 | - 'Dollars', |
|
627 | - '$', |
|
628 | - 1, |
|
629 | - 2, |
|
630 | - '+599', |
|
631 | - 0, |
|
632 | - 0, |
|
633 | - ), |
|
634 | - array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
635 | - array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
636 | - array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
637 | - array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
638 | - array( |
|
639 | - 'HM', |
|
640 | - 'HMD', |
|
641 | - 0, |
|
642 | - 'Heard Island and McDonald Islands', |
|
643 | - 'AUD', |
|
644 | - 'Dollar', |
|
645 | - 'Dollars', |
|
646 | - '$', |
|
647 | - 1, |
|
648 | - 2, |
|
649 | - '+891', |
|
650 | - 0, |
|
651 | - 0, |
|
652 | - ), |
|
653 | - array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
654 | - array( |
|
655 | - 'GS', |
|
656 | - 'SGS', |
|
657 | - 0, |
|
658 | - 'South Georgia and the South Sandwich Islands', |
|
659 | - 'GBP', |
|
660 | - 'Pound', |
|
661 | - 'Pounds', |
|
662 | - '£', |
|
663 | - 1, |
|
664 | - 2, |
|
665 | - '+500', |
|
666 | - 0, |
|
667 | - 0, |
|
668 | - ), |
|
669 | - array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
670 | - array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
671 | - array( |
|
672 | - 'UM', |
|
673 | - 'UMI', |
|
674 | - 0, |
|
675 | - 'United States Minor Outlying Islands', |
|
676 | - 'USD', |
|
677 | - 'Dollar', |
|
678 | - 'Dollars', |
|
679 | - '$', |
|
680 | - 1, |
|
681 | - 2, |
|
682 | - '+1', |
|
683 | - 0, |
|
684 | - 0, |
|
685 | - ), |
|
686 | - ); |
|
687 | - global $wpdb; |
|
688 | - $country_table = $wpdb->prefix . "esp_country"; |
|
689 | - $country_format = array( |
|
690 | - "CNT_ISO" => '%s', |
|
691 | - "CNT_ISO3" => '%s', |
|
692 | - "RGN_ID" => '%d', |
|
693 | - "CNT_name" => '%s', |
|
694 | - "CNT_cur_code" => '%s', |
|
695 | - "CNT_cur_single" => '%s', |
|
696 | - "CNT_cur_plural" => '%s', |
|
697 | - "CNT_cur_sign" => '%s', |
|
698 | - "CNT_cur_sign_b4" => '%d', |
|
699 | - "CNT_cur_dec_plc" => '%d', |
|
700 | - "CNT_tel_code" => '%s', |
|
701 | - "CNT_is_EU" => '%d', |
|
702 | - "CNT_active" => '%d', |
|
703 | - ); |
|
704 | - if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
705 | - foreach ($newer_countries as $country) { |
|
706 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
707 | - $countries = $wpdb->get_var($SQL); |
|
708 | - if (! $countries) { |
|
709 | - $wpdb->insert( |
|
710 | - $country_table, |
|
711 | - array_combine(array_keys($country_format), $country), |
|
712 | - $country_format |
|
713 | - ); |
|
714 | - } |
|
715 | - } |
|
716 | - } |
|
717 | - } |
|
595 | + /** |
|
596 | + * verifies each of the new countries exists that somehow we missed in 4.1 |
|
597 | + */ |
|
598 | + public function verify_new_countries() |
|
599 | + { |
|
600 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
601 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
602 | + // currency symbols: http://www.xe.com/symbols.php |
|
603 | + // CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
604 | + // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
605 | + $newer_countries = array( |
|
606 | + array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
607 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
608 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
609 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
610 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
611 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
612 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
613 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
614 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
615 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
616 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
617 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
618 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
619 | + array( |
|
620 | + 'BQ', |
|
621 | + 'BES', |
|
622 | + 0, |
|
623 | + 'Bonaire, Saint Eustatius and Saba', |
|
624 | + 'USD', |
|
625 | + 'Dollar', |
|
626 | + 'Dollars', |
|
627 | + '$', |
|
628 | + 1, |
|
629 | + 2, |
|
630 | + '+599', |
|
631 | + 0, |
|
632 | + 0, |
|
633 | + ), |
|
634 | + array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
635 | + array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
636 | + array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
637 | + array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
638 | + array( |
|
639 | + 'HM', |
|
640 | + 'HMD', |
|
641 | + 0, |
|
642 | + 'Heard Island and McDonald Islands', |
|
643 | + 'AUD', |
|
644 | + 'Dollar', |
|
645 | + 'Dollars', |
|
646 | + '$', |
|
647 | + 1, |
|
648 | + 2, |
|
649 | + '+891', |
|
650 | + 0, |
|
651 | + 0, |
|
652 | + ), |
|
653 | + array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
654 | + array( |
|
655 | + 'GS', |
|
656 | + 'SGS', |
|
657 | + 0, |
|
658 | + 'South Georgia and the South Sandwich Islands', |
|
659 | + 'GBP', |
|
660 | + 'Pound', |
|
661 | + 'Pounds', |
|
662 | + '£', |
|
663 | + 1, |
|
664 | + 2, |
|
665 | + '+500', |
|
666 | + 0, |
|
667 | + 0, |
|
668 | + ), |
|
669 | + array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
670 | + array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
671 | + array( |
|
672 | + 'UM', |
|
673 | + 'UMI', |
|
674 | + 0, |
|
675 | + 'United States Minor Outlying Islands', |
|
676 | + 'USD', |
|
677 | + 'Dollar', |
|
678 | + 'Dollars', |
|
679 | + '$', |
|
680 | + 1, |
|
681 | + 2, |
|
682 | + '+1', |
|
683 | + 0, |
|
684 | + 0, |
|
685 | + ), |
|
686 | + ); |
|
687 | + global $wpdb; |
|
688 | + $country_table = $wpdb->prefix . "esp_country"; |
|
689 | + $country_format = array( |
|
690 | + "CNT_ISO" => '%s', |
|
691 | + "CNT_ISO3" => '%s', |
|
692 | + "RGN_ID" => '%d', |
|
693 | + "CNT_name" => '%s', |
|
694 | + "CNT_cur_code" => '%s', |
|
695 | + "CNT_cur_single" => '%s', |
|
696 | + "CNT_cur_plural" => '%s', |
|
697 | + "CNT_cur_sign" => '%s', |
|
698 | + "CNT_cur_sign_b4" => '%d', |
|
699 | + "CNT_cur_dec_plc" => '%d', |
|
700 | + "CNT_tel_code" => '%s', |
|
701 | + "CNT_is_EU" => '%d', |
|
702 | + "CNT_active" => '%d', |
|
703 | + ); |
|
704 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
705 | + foreach ($newer_countries as $country) { |
|
706 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
707 | + $countries = $wpdb->get_var($SQL); |
|
708 | + if (! $countries) { |
|
709 | + $wpdb->insert( |
|
710 | + $country_table, |
|
711 | + array_combine(array_keys($country_format), $country), |
|
712 | + $country_format |
|
713 | + ); |
|
714 | + } |
|
715 | + } |
|
716 | + } |
|
717 | + } |
|
718 | 718 | |
719 | 719 | |
720 | 720 | |
721 | - /** |
|
722 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
723 | - */ |
|
724 | - public function verify_new_currencies() |
|
725 | - { |
|
726 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
727 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
728 | - // currency symbols: http://www.xe.com/symbols.php |
|
729 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
730 | - // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
731 | - $newer_currencies = array( |
|
732 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
733 | - ); |
|
734 | - global $wpdb; |
|
735 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
736 | - $currency_format = array( |
|
737 | - "CUR_code" => '%s', |
|
738 | - "CUR_single" => '%s', |
|
739 | - "CUR_plural" => '%s', |
|
740 | - "CUR_sign" => '%s', |
|
741 | - "CUR_dec_plc" => '%d', |
|
742 | - "CUR_active" => '%d', |
|
743 | - ); |
|
744 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
745 | - foreach ($newer_currencies as $currency) { |
|
746 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
747 | - $countries = $wpdb->get_var($SQL); |
|
748 | - if (! $countries) { |
|
749 | - $wpdb->insert( |
|
750 | - $currency_table, |
|
751 | - array_combine(array_keys($currency_format), $currency), |
|
752 | - $currency_format |
|
753 | - ); |
|
754 | - } |
|
755 | - } |
|
756 | - } |
|
757 | - } |
|
721 | + /** |
|
722 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
723 | + */ |
|
724 | + public function verify_new_currencies() |
|
725 | + { |
|
726 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
727 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
728 | + // currency symbols: http://www.xe.com/symbols.php |
|
729 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
730 | + // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
731 | + $newer_currencies = array( |
|
732 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
733 | + ); |
|
734 | + global $wpdb; |
|
735 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
736 | + $currency_format = array( |
|
737 | + "CUR_code" => '%s', |
|
738 | + "CUR_single" => '%s', |
|
739 | + "CUR_plural" => '%s', |
|
740 | + "CUR_sign" => '%s', |
|
741 | + "CUR_dec_plc" => '%d', |
|
742 | + "CUR_active" => '%d', |
|
743 | + ); |
|
744 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
745 | + foreach ($newer_currencies as $currency) { |
|
746 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
747 | + $countries = $wpdb->get_var($SQL); |
|
748 | + if (! $countries) { |
|
749 | + $wpdb->insert( |
|
750 | + $currency_table, |
|
751 | + array_combine(array_keys($currency_format), $currency), |
|
752 | + $currency_format |
|
753 | + ); |
|
754 | + } |
|
755 | + } |
|
756 | + } |
|
757 | + } |
|
758 | 758 | |
759 | 759 | |
760 | 760 | |
761 | - /** |
|
762 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
763 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
764 | - * we should be able to stop doing this in 4.9 |
|
765 | - */ |
|
766 | - public function fix_non_default_taxes() |
|
767 | - { |
|
768 | - global $wpdb; |
|
769 | - $query = $wpdb->prepare("UPDATE |
|
761 | + /** |
|
762 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
763 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
764 | + * we should be able to stop doing this in 4.9 |
|
765 | + */ |
|
766 | + public function fix_non_default_taxes() |
|
767 | + { |
|
768 | + global $wpdb; |
|
769 | + $query = $wpdb->prepare("UPDATE |
|
770 | 770 | {$wpdb->prefix}esp_price p INNER JOIN |
771 | 771 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
772 | 772 | SET |
@@ -775,6 +775,6 @@ discard block |
||
775 | 775 | p.PRC_is_default = 0 AND |
776 | 776 | pt.PBT_ID = %d |
777 | 777 | ", EEM_Price_Type::base_type_tax); |
778 | - $wpdb->query($query); |
|
779 | - } |
|
778 | + $wpdb->query($query); |
|
779 | + } |
|
780 | 780 | } |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | // unfortunately, this needs to be done upon INCLUSION of this file, |
15 | 15 | // instead of construction, because it only gets constructed on first page load |
16 | 16 | // (all other times it gets resurrected from a wordpress option) |
17 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
|
17 | +$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
|
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | 20 | $matches = array(); |
21 | 21 | preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | + $class_to_filepath[$matches[1]] = $filepath; |
|
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
73 | 73 | // echo "$version_string can be migrated from"; |
74 | 74 | return true; |
75 | - } elseif (! $version_string) { |
|
75 | + } elseif ( ! $version_string) { |
|
76 | 76 | // echo "no version string provided: $version_string"; |
77 | 77 | // no version string provided... this must be pre 4.3 |
78 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | 79 | } else { |
80 | 80 | // echo "$version_string doesnt apply"; |
81 | 81 | return false; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function schema_changes_before_migration() |
91 | 91 | { |
92 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
93 | 93 | $now_in_mysql = current_time('mysql', true); |
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | 95 | $table_name = 'esp_answer'; |
96 | 96 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
97 | 97 | REG_ID int(10) unsigned NOT NULL, |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ), |
686 | 686 | ); |
687 | 687 | global $wpdb; |
688 | - $country_table = $wpdb->prefix . "esp_country"; |
|
688 | + $country_table = $wpdb->prefix."esp_country"; |
|
689 | 689 | $country_format = array( |
690 | 690 | "CNT_ISO" => '%s', |
691 | 691 | "CNT_ISO3" => '%s', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | foreach ($newer_countries as $country) { |
706 | 706 | $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
707 | 707 | $countries = $wpdb->get_var($SQL); |
708 | - if (! $countries) { |
|
708 | + if ( ! $countries) { |
|
709 | 709 | $wpdb->insert( |
710 | 710 | $country_table, |
711 | 711 | array_combine(array_keys($country_format), $country), |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
733 | 733 | ); |
734 | 734 | global $wpdb; |
735 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
735 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
736 | 736 | $currency_format = array( |
737 | 737 | "CUR_code" => '%s', |
738 | 738 | "CUR_single" => '%s', |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | foreach ($newer_currencies as $currency) { |
746 | 746 | $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
747 | 747 | $countries = $wpdb->get_var($SQL); |
748 | - if (! $countries) { |
|
748 | + if ( ! $countries) { |
|
749 | 749 | $wpdb->insert( |
750 | 750 | $currency_table, |
751 | 751 | array_combine(array_keys($currency_format), $currency), |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | - $matches = array(); |
|
20 | - preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
19 | + $matches = array(); |
|
20 | + preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | 22 | } |
23 | 23 | // give addons a chance to autoload their stages too |
24 | 24 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -31,59 +31,59 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * EE_DMS_Core_4_5_0 constructor. |
|
36 | - * |
|
37 | - * @param TableManager $table_manager |
|
38 | - * @param TableAnalysis $table_analysis |
|
39 | - */ |
|
40 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | - { |
|
42 | - $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | - $this->_priority = 10; |
|
44 | - $this->_migration_stages = array( |
|
45 | - new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | - new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | - new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | - new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | - new EE_DMS_4_5_0_invoice_settings(), |
|
50 | - ); |
|
51 | - parent::__construct($table_manager, $table_analysis); |
|
52 | - } |
|
34 | + /** |
|
35 | + * EE_DMS_Core_4_5_0 constructor. |
|
36 | + * |
|
37 | + * @param TableManager $table_manager |
|
38 | + * @param TableAnalysis $table_analysis |
|
39 | + */ |
|
40 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | + { |
|
42 | + $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | + $this->_priority = 10; |
|
44 | + $this->_migration_stages = array( |
|
45 | + new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | + new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | + new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | + new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | + new EE_DMS_4_5_0_invoice_settings(), |
|
50 | + ); |
|
51 | + parent::__construct($table_manager, $table_analysis); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - public function can_migrate_from_version($version_array) |
|
57 | - { |
|
58 | - $version_string = $version_array['Core']; |
|
59 | - if (version_compare($version_string, '4.5.0.decaf', '<') && version_compare($version_string, '4.3.0.decaf', '>=')) { |
|
56 | + public function can_migrate_from_version($version_array) |
|
57 | + { |
|
58 | + $version_string = $version_array['Core']; |
|
59 | + if (version_compare($version_string, '4.5.0.decaf', '<') && version_compare($version_string, '4.3.0.decaf', '>=')) { |
|
60 | 60 | // echo "$version_string can be migrated from"; |
61 | - return true; |
|
62 | - } elseif (! $version_string) { |
|
61 | + return true; |
|
62 | + } elseif (! $version_string) { |
|
63 | 63 | // echo "no version string provided: $version_string"; |
64 | - // no version string provided... this must be pre 4.3 |
|
65 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | - } else { |
|
64 | + // no version string provided... this must be pre 4.3 |
|
65 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | + } else { |
|
67 | 67 | // echo "$version_string doesnt apply"; |
68 | - return false; |
|
69 | - } |
|
70 | - } |
|
68 | + return false; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | - public function schema_changes_before_migration() |
|
75 | - { |
|
76 | - // relies on 4.1's EEH_Activation::create_table |
|
77 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
78 | - $table_name = 'esp_answer'; |
|
79 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
74 | + public function schema_changes_before_migration() |
|
75 | + { |
|
76 | + // relies on 4.1's EEH_Activation::create_table |
|
77 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
78 | + $table_name = 'esp_answer'; |
|
79 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
80 | 80 | REG_ID int(10) unsigned NOT NULL, |
81 | 81 | QST_ID int(10) unsigned NOT NULL, |
82 | 82 | ANS_value text NOT NULL, |
83 | 83 | PRIMARY KEY (ANS_ID)"; |
84 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
85 | - $table_name = 'esp_attendee_meta'; |
|
86 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
84 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
85 | + $table_name = 'esp_attendee_meta'; |
|
86 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
87 | 87 | ATT_ID bigint(20) unsigned NOT NULL, |
88 | 88 | ATT_fname varchar(45) NOT NULL, |
89 | 89 | ATT_lname varchar(45) NOT NULL, |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | KEY ATT_fname (ATT_fname), |
100 | 100 | KEY ATT_lname (ATT_lname), |
101 | 101 | KEY ATT_email (ATT_email(191))"; |
102 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
103 | - $table_name = 'esp_country'; |
|
104 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
102 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
103 | + $table_name = 'esp_country'; |
|
104 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
105 | 105 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
106 | 106 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
107 | 107 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | CNT_is_EU tinyint(1) DEFAULT '0', |
118 | 118 | CNT_active tinyint(1) DEFAULT '0', |
119 | 119 | PRIMARY KEY (CNT_ISO)"; |
120 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
121 | - $table_name = 'esp_datetime'; |
|
122 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
120 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
121 | + $table_name = 'esp_datetime'; |
|
122 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
123 | 123 | EVT_ID bigint(20) unsigned NOT NULL, |
124 | 124 | DTT_name varchar(255) NOT NULL DEFAULT '', |
125 | 125 | DTT_description text NOT NULL, |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | PRIMARY KEY (DTT_ID), |
135 | 135 | KEY EVT_ID (EVT_ID), |
136 | 136 | KEY DTT_is_primary (DTT_is_primary)"; |
137 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
138 | - $table_name = 'esp_event_meta'; |
|
139 | - $sql = " |
|
137 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
138 | + $table_name = 'esp_event_meta'; |
|
139 | + $sql = " |
|
140 | 140 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
141 | 141 | EVT_ID bigint(20) unsigned NOT NULL, |
142 | 142 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -151,31 +151,31 @@ discard block |
||
151 | 151 | EVT_external_URL varchar(200) NULL, |
152 | 152 | EVT_donations tinyint(1) NULL, |
153 | 153 | PRIMARY KEY (EVTM_ID)"; |
154 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | - $table_name = 'esp_event_question_group'; |
|
156 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | + $table_name = 'esp_event_question_group'; |
|
156 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
157 | 157 | EVT_ID bigint(20) unsigned NOT NULL, |
158 | 158 | QSG_ID int(10) unsigned NOT NULL, |
159 | 159 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
160 | 160 | PRIMARY KEY (EQG_ID)"; |
161 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | - $table_name = 'esp_event_venue'; |
|
163 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
161 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | + $table_name = 'esp_event_venue'; |
|
163 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
164 | 164 | EVT_ID bigint(20) unsigned NOT NULL, |
165 | 165 | VNU_ID bigint(20) unsigned NOT NULL, |
166 | 166 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
167 | 167 | PRIMARY KEY (EVV_ID)"; |
168 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | - $table_name = 'esp_extra_meta'; |
|
170 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
168 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | + $table_name = 'esp_extra_meta'; |
|
170 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
171 | 171 | OBJ_ID int(11) DEFAULT NULL, |
172 | 172 | EXM_type varchar(45) DEFAULT NULL, |
173 | 173 | EXM_key varchar(45) DEFAULT NULL, |
174 | 174 | EXM_value text, |
175 | 175 | PRIMARY KEY (EXM_ID)"; |
176 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | - $table_name = 'esp_line_item'; |
|
178 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
176 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | + $table_name = 'esp_line_item'; |
|
178 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
179 | 179 | LIN_code varchar(245) NOT NULL DEFAULT '', |
180 | 180 | TXN_ID int(11) DEFAULT NULL, |
181 | 181 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -191,19 +191,19 @@ discard block |
||
191 | 191 | OBJ_ID int(11) DEFAULT NULL, |
192 | 192 | OBJ_type varchar(45)DEFAULT NULL, |
193 | 193 | PRIMARY KEY (LIN_ID)"; |
194 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | - $table_name = 'esp_message_template'; |
|
196 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
194 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | + $table_name = 'esp_message_template'; |
|
196 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
197 | 197 | GRP_ID int(10) unsigned NOT NULL, |
198 | 198 | MTP_context varchar(50) NOT NULL, |
199 | 199 | MTP_template_field varchar(30) NOT NULL, |
200 | 200 | MTP_content text NOT NULL, |
201 | 201 | PRIMARY KEY (MTP_ID), |
202 | 202 | KEY GRP_ID (GRP_ID)"; |
203 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
205 | - $table_name = 'esp_message_template_group'; |
|
206 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
203 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
205 | + $table_name = 'esp_message_template_group'; |
|
206 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
207 | 207 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
208 | 208 | MTP_name varchar(245) NOT NULL DEFAULT '', |
209 | 209 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
216 | 216 | PRIMARY KEY (GRP_ID), |
217 | 217 | KEY MTP_user_id (MTP_user_id)"; |
218 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | - $table_name = 'esp_event_message_template'; |
|
220 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
218 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | + $table_name = 'esp_event_message_template'; |
|
220 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
221 | 221 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
222 | 222 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EMT_ID), |
224 | 224 | KEY EVT_ID (EVT_ID), |
225 | 225 | KEY GRP_ID (GRP_ID)"; |
226 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | - $table_name = 'esp_payment'; |
|
228 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
226 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | + $table_name = 'esp_payment'; |
|
228 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
229 | 229 | TXN_ID int(10) unsigned DEFAULT NULL, |
230 | 230 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
231 | 231 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | PRIMARY KEY (PAY_ID), |
242 | 242 | KEY TXN_ID (TXN_ID), |
243 | 243 | KEY PAY_timestamp (PAY_timestamp)"; |
244 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
245 | - $table_name = "esp_ticket_price"; |
|
246 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
244 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
245 | + $table_name = "esp_ticket_price"; |
|
246 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
247 | 247 | TKT_ID int(10) unsigned NOT NULL, |
248 | 248 | PRC_ID int(10) unsigned NOT NULL, |
249 | 249 | PRIMARY KEY (TKP_ID)"; |
250 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | - $table_name = "esp_datetime_ticket"; |
|
252 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
250 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | + $table_name = "esp_datetime_ticket"; |
|
252 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
253 | 253 | DTT_ID int(10) unsigned NOT NULL, |
254 | 254 | TKT_ID int(10) unsigned NOT NULL, |
255 | 255 | PRIMARY KEY (DTK_ID)"; |
256 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | - $table_name = "esp_ticket_template"; |
|
258 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
256 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | + $table_name = "esp_ticket_template"; |
|
258 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
259 | 259 | TTM_name varchar(45) NOT NULL, |
260 | 260 | TTM_description text, |
261 | 261 | TTM_file varchar(45), |
262 | 262 | PRIMARY KEY (TTM_ID)"; |
263 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | - $table_name = 'esp_question'; |
|
265 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
263 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | + $table_name = 'esp_question'; |
|
265 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
266 | 266 | QST_display_text text NOT NULL, |
267 | 267 | QST_admin_label varchar(255) NOT NULL, |
268 | 268 | QST_system varchar(25) DEFAULT NULL, |
@@ -274,25 +274,25 @@ discard block |
||
274 | 274 | QST_wp_user bigint(20) unsigned NULL, |
275 | 275 | QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
276 | 276 | PRIMARY KEY (QST_ID)'; |
277 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | - $table_name = 'esp_question_group_question'; |
|
279 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
277 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | + $table_name = 'esp_question_group_question'; |
|
279 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
280 | 280 | QSG_ID int(10) unsigned NOT NULL, |
281 | 281 | QST_ID int(10) unsigned NOT NULL, |
282 | 282 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
283 | 283 | PRIMARY KEY (QGQ_ID) "; |
284 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | - $table_name = 'esp_question_option'; |
|
286 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $table_name = 'esp_question_option'; |
|
286 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
287 | 287 | QSO_value varchar(255) NOT NULL, |
288 | 288 | QSO_desc text NOT NULL, |
289 | 289 | QST_ID int(10) unsigned NOT NULL, |
290 | 290 | QSO_order int(10) unsigned NOT NULL DEFAULT 0, |
291 | 291 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
292 | 292 | PRIMARY KEY (QSO_ID)"; |
293 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | - $table_name = 'esp_registration'; |
|
295 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
293 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | + $table_name = 'esp_registration'; |
|
295 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
296 | 296 | EVT_ID bigint(20) unsigned NOT NULL, |
297 | 297 | ATT_ID bigint(20) unsigned NOT NULL, |
298 | 298 | TXN_ID int(10) unsigned NOT NULL, |
@@ -315,25 +315,25 @@ discard block |
||
315 | 315 | KEY STS_ID (STS_ID), |
316 | 316 | KEY REG_url_link (REG_url_link), |
317 | 317 | KEY REG_code (REG_code)"; |
318 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | - $table_name = 'esp_checkin'; |
|
320 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
318 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | + $table_name = 'esp_checkin'; |
|
320 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
321 | 321 | REG_ID int(10) unsigned NOT NULL, |
322 | 322 | DTT_ID int(10) unsigned NOT NULL, |
323 | 323 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
324 | 324 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
325 | 325 | PRIMARY KEY (CHK_ID)"; |
326 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | - $table_name = 'esp_state'; |
|
328 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
326 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | + $table_name = 'esp_state'; |
|
328 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
329 | 329 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
330 | 330 | STA_abbrev varchar(6) COLLATE utf8_bin NOT NULL, |
331 | 331 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
332 | 332 | STA_active tinyint(1) DEFAULT '1', |
333 | 333 | PRIMARY KEY (STA_ID)"; |
334 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | - $table_name = 'esp_status'; |
|
336 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
334 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | + $table_name = 'esp_status'; |
|
336 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
337 | 337 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
338 | 338 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
339 | 339 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
342 | 342 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
343 | 343 | KEY STS_type (STS_type)"; |
344 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | - $table_name = 'esp_transaction'; |
|
346 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
344 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | + $table_name = 'esp_transaction'; |
|
346 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
347 | 347 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
348 | 348 | TXN_total decimal(10,3) DEFAULT '0.00', |
349 | 349 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | PRIMARY KEY (TXN_ID), |
355 | 355 | KEY TXN_timestamp (TXN_timestamp), |
356 | 356 | KEY STS_ID (STS_ID)"; |
357 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | - $table_name = 'esp_venue_meta'; |
|
359 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
357 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | + $table_name = 'esp_venue_meta'; |
|
359 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
360 | 360 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
361 | 361 | VNU_address varchar(255) DEFAULT NULL, |
362 | 362 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | PRIMARY KEY (VNUM_ID), |
375 | 375 | KEY STA_ID (STA_ID), |
376 | 376 | KEY CNT_ISO (CNT_ISO)"; |
377 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | - // modified tables |
|
379 | - $table_name = "esp_price"; |
|
380 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
377 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | + // modified tables |
|
379 | + $table_name = "esp_price"; |
|
380 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
381 | 381 | PRT_ID tinyint(3) unsigned NOT NULL, |
382 | 382 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
383 | 383 | PRC_name varchar(245) NOT NULL, |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | PRC_wp_user bigint(20) unsigned NULL, |
390 | 390 | PRC_parent int(10) unsigned DEFAULT 0, |
391 | 391 | PRIMARY KEY (PRC_ID)"; |
392 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | - $table_name = "esp_price_type"; |
|
394 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | + $table_name = "esp_price_type"; |
|
394 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
395 | 395 | PRT_name varchar(45) NOT NULL, |
396 | 396 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
397 | 397 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
401 | 401 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
402 | 402 | PRIMARY KEY (PRT_ID)"; |
403 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | - $table_name = "esp_ticket"; |
|
405 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
403 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | + $table_name = "esp_ticket"; |
|
405 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
406 | 406 | TTM_ID int(10) unsigned NOT NULL, |
407 | 407 | TKT_name varchar(245) NOT NULL DEFAULT '', |
408 | 408 | TKT_description text NOT NULL, |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | TKT_parent int(10) unsigned DEFAULT '0', |
424 | 424 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
425 | 425 | PRIMARY KEY (TKT_ID)"; |
426 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
428 | - $table_name = 'esp_question_group'; |
|
429 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
426 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
428 | + $table_name = 'esp_question_group'; |
|
429 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
430 | 430 | QSG_name varchar(255) NOT NULL, |
431 | 431 | QSG_identifier varchar(100) NOT NULL, |
432 | 432 | QSG_desc text NULL, |
@@ -438,133 +438,133 @@ discard block |
||
438 | 438 | QSG_wp_user bigint(20) unsigned NULL, |
439 | 439 | PRIMARY KEY (QSG_ID), |
440 | 440 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
441 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
443 | - // (because many need to convert old string states to foreign keys into the states table) |
|
444 | - $script_4_1_defaults->insert_default_states(); |
|
445 | - $script_4_1_defaults->insert_default_countries(); |
|
446 | - // schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
447 | - $this->insert_default_price_types(); |
|
448 | - $this->insert_default_prices(); |
|
449 | - $this->insert_default_tickets(); |
|
450 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
451 | - EE_Config::instance()->update_espresso_config(false, true); |
|
452 | - return true; |
|
453 | - } |
|
441 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
443 | + // (because many need to convert old string states to foreign keys into the states table) |
|
444 | + $script_4_1_defaults->insert_default_states(); |
|
445 | + $script_4_1_defaults->insert_default_countries(); |
|
446 | + // schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
447 | + $this->insert_default_price_types(); |
|
448 | + $this->insert_default_prices(); |
|
449 | + $this->insert_default_tickets(); |
|
450 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
451 | + EE_Config::instance()->update_espresso_config(false, true); |
|
452 | + return true; |
|
453 | + } |
|
454 | 454 | |
455 | 455 | |
456 | 456 | |
457 | - /** |
|
458 | - * @return boolean |
|
459 | - */ |
|
460 | - public function schema_changes_after_migration() |
|
461 | - { |
|
462 | - return true; |
|
463 | - } |
|
457 | + /** |
|
458 | + * @return boolean |
|
459 | + */ |
|
460 | + public function schema_changes_after_migration() |
|
461 | + { |
|
462 | + return true; |
|
463 | + } |
|
464 | 464 | |
465 | 465 | |
466 | 466 | |
467 | - public function migration_page_hooks() |
|
468 | - { |
|
469 | - } |
|
467 | + public function migration_page_hooks() |
|
468 | + { |
|
469 | + } |
|
470 | 470 | |
471 | 471 | |
472 | 472 | |
473 | - /** |
|
474 | - * insert_default_price_types |
|
475 | - * |
|
476 | - * @since 4.5.0 |
|
477 | - * @return void |
|
478 | - */ |
|
479 | - public function insert_default_price_types() |
|
480 | - { |
|
481 | - global $wpdb; |
|
482 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
483 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
484 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
485 | - $price_types_exist = $wpdb->get_var($SQL); |
|
486 | - if (! $price_types_exist) { |
|
487 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
488 | - $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
473 | + /** |
|
474 | + * insert_default_price_types |
|
475 | + * |
|
476 | + * @since 4.5.0 |
|
477 | + * @return void |
|
478 | + */ |
|
479 | + public function insert_default_price_types() |
|
480 | + { |
|
481 | + global $wpdb; |
|
482 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
483 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
484 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
485 | + $price_types_exist = $wpdb->get_var($SQL); |
|
486 | + if (! $price_types_exist) { |
|
487 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
488 | + $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
489 | 489 | (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
490 | 490 | (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
491 | 491 | (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
492 | 492 | (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
493 | 493 | (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
494 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
495 | - $wpdb->query($SQL); |
|
496 | - } |
|
497 | - } |
|
498 | - } |
|
494 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
495 | + $wpdb->query($SQL); |
|
496 | + } |
|
497 | + } |
|
498 | + } |
|
499 | 499 | |
500 | 500 | |
501 | 501 | |
502 | - /** |
|
503 | - * insert DEFAULT prices. |
|
504 | - * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
505 | - * when EEH_Activaion's initialize_db_content is called via ahook in |
|
506 | - * EE_Brewing_regular |
|
507 | - * |
|
508 | - * @since 4.5.0 |
|
509 | - * @return void |
|
510 | - */ |
|
511 | - public function insert_default_prices() |
|
512 | - { |
|
513 | - global $wpdb; |
|
514 | - $price_table = $wpdb->prefix . "esp_price"; |
|
515 | - if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
516 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
517 | - $prices_exist = $wpdb->get_var($SQL); |
|
518 | - if (! $prices_exist) { |
|
519 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
520 | - $SQL = "INSERT INTO $price_table |
|
502 | + /** |
|
503 | + * insert DEFAULT prices. |
|
504 | + * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
505 | + * when EEH_Activaion's initialize_db_content is called via ahook in |
|
506 | + * EE_Brewing_regular |
|
507 | + * |
|
508 | + * @since 4.5.0 |
|
509 | + * @return void |
|
510 | + */ |
|
511 | + public function insert_default_prices() |
|
512 | + { |
|
513 | + global $wpdb; |
|
514 | + $price_table = $wpdb->prefix . "esp_price"; |
|
515 | + if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
516 | + $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
517 | + $prices_exist = $wpdb->get_var($SQL); |
|
518 | + if (! $prices_exist) { |
|
519 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
520 | + $SQL = "INSERT INTO $price_table |
|
521 | 521 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
522 | 522 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);"; |
523 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
524 | - $wpdb->query($SQL); |
|
525 | - } |
|
526 | - } |
|
527 | - } |
|
523 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
524 | + $wpdb->query($SQL); |
|
525 | + } |
|
526 | + } |
|
527 | + } |
|
528 | 528 | |
529 | 529 | |
530 | 530 | |
531 | - /** |
|
532 | - * insert DEFAULT ticket |
|
533 | - * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
534 | - * |
|
535 | - * @since 4.5.0 |
|
536 | - * @return void |
|
537 | - */ |
|
538 | - public function insert_default_tickets() |
|
539 | - { |
|
540 | - global $wpdb; |
|
541 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
542 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
543 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
544 | - $tickets_exist = $wpdb->get_var($SQL); |
|
545 | - if (! $tickets_exist) { |
|
546 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
547 | - $SQL = "INSERT INTO $ticket_table |
|
531 | + /** |
|
532 | + * insert DEFAULT ticket |
|
533 | + * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
534 | + * |
|
535 | + * @since 4.5.0 |
|
536 | + * @return void |
|
537 | + */ |
|
538 | + public function insert_default_tickets() |
|
539 | + { |
|
540 | + global $wpdb; |
|
541 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
542 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
543 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
544 | + $tickets_exist = $wpdb->get_var($SQL); |
|
545 | + if (! $tickets_exist) { |
|
546 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
547 | + $SQL = "INSERT INTO $ticket_table |
|
548 | 548 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
549 | 549 | ( 1, 0, '" |
550 | - . __("Free Ticket", "event_espresso") |
|
551 | - . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
552 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
553 | - $wpdb->query($SQL); |
|
554 | - } |
|
555 | - } |
|
556 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
557 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
558 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
559 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
560 | - if (! $ticket_prc_exist) { |
|
561 | - $SQL = "INSERT INTO $ticket_price_table |
|
550 | + . __("Free Ticket", "event_espresso") |
|
551 | + . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
552 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
553 | + $wpdb->query($SQL); |
|
554 | + } |
|
555 | + } |
|
556 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
557 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
558 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
559 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
560 | + if (! $ticket_prc_exist) { |
|
561 | + $SQL = "INSERT INTO $ticket_price_table |
|
562 | 562 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
563 | 563 | ( 1, 1, 1 ) |
564 | 564 | "; |
565 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
566 | - $wpdb->query($SQL); |
|
567 | - } |
|
568 | - } |
|
569 | - } |
|
565 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
566 | + $wpdb->query($SQL); |
|
567 | + } |
|
568 | + } |
|
569 | + } |
|
570 | 570 | } |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | // unfortunately, this needs to be done upon INCLUSION of this file, |
14 | 14 | // instead of construction, because it only gets constructed on first page load |
15 | 15 | // (all other times it gets resurrected from a wordpress option) |
16 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
|
16 | +$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*'); |
|
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | 19 | $matches = array(); |
20 | 20 | preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
21 | + $class_to_filepath[$matches[1]] = $filepath; |
|
22 | 22 | } |
23 | 23 | // give addons a chance to autoload their stages too |
24 | 24 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | if (version_compare($version_string, '4.5.0.decaf', '<') && version_compare($version_string, '4.3.0.decaf', '>=')) { |
60 | 60 | // echo "$version_string can be migrated from"; |
61 | 61 | return true; |
62 | - } elseif (! $version_string) { |
|
62 | + } elseif ( ! $version_string) { |
|
63 | 63 | // echo "no version string provided: $version_string"; |
64 | 64 | // no version string provided... this must be pre 4.3 |
65 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | 66 | } else { |
67 | 67 | // echo "$version_string doesnt apply"; |
68 | 68 | return false; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function schema_changes_before_migration() |
75 | 75 | { |
76 | 76 | // relies on 4.1's EEH_Activation::create_table |
77 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
77 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
78 | 78 | $table_name = 'esp_answer'; |
79 | 79 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
80 | 80 | REG_ID int(10) unsigned NOT NULL, |
@@ -479,18 +479,18 @@ discard block |
||
479 | 479 | public function insert_default_price_types() |
480 | 480 | { |
481 | 481 | global $wpdb; |
482 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
482 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
483 | 483 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
484 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
484 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
485 | 485 | $price_types_exist = $wpdb->get_var($SQL); |
486 | - if (! $price_types_exist) { |
|
486 | + if ( ! $price_types_exist) { |
|
487 | 487 | $user_id = EEH_Activation::get_default_creator_id(); |
488 | 488 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
489 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
|
490 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
|
491 | - (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
|
492 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
|
493 | - (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
|
489 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, $user_id, 0), |
|
490 | + (2, '".__('Percent Discount', 'event_espresso')."', 2, 1, 20, $user_id, 0), |
|
491 | + (3, '".__('Dollar Discount', 'event_espresso')."', 2, 0, 30, $user_id, 0), |
|
492 | + (4, '".__('Percent Surcharge', 'event_espresso')."', 3, 1, 40, $user_id, 0), |
|
493 | + (5, '".__('Dollar Surcharge', 'event_espresso')."', 3, 0, 50, $user_id, 0);"; |
|
494 | 494 | $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
495 | 495 | $wpdb->query($SQL); |
496 | 496 | } |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | public function insert_default_prices() |
512 | 512 | { |
513 | 513 | global $wpdb; |
514 | - $price_table = $wpdb->prefix . "esp_price"; |
|
514 | + $price_table = $wpdb->prefix."esp_price"; |
|
515 | 515 | if ($this->_get_table_analysis()->tableExists($price_table)) { |
516 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
516 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
517 | 517 | $prices_exist = $wpdb->get_var($SQL); |
518 | - if (! $prices_exist) { |
|
518 | + if ( ! $prices_exist) { |
|
519 | 519 | $user_id = EEH_Activation::get_default_creator_id(); |
520 | 520 | $SQL = "INSERT INTO $price_table |
521 | 521 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | public function insert_default_tickets() |
539 | 539 | { |
540 | 540 | global $wpdb; |
541 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
541 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
542 | 542 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
543 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
543 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
544 | 544 | $tickets_exist = $wpdb->get_var($SQL); |
545 | - if (! $tickets_exist) { |
|
545 | + if ( ! $tickets_exist) { |
|
546 | 546 | $user_id = EEH_Activation::get_default_creator_id(); |
547 | 547 | $SQL = "INSERT INTO $ticket_table |
548 | 548 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | $wpdb->query($SQL); |
554 | 554 | } |
555 | 555 | } |
556 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
556 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
557 | 557 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
558 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
558 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
559 | 559 | $ticket_prc_exist = $wpdb->get_var($SQL); |
560 | - if (! $ticket_prc_exist) { |
|
560 | + if ( ! $ticket_prc_exist) { |
|
561 | 561 | $SQL = "INSERT INTO $ticket_price_table |
562 | 562 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
563 | 563 | ( 1, 1, 1 ) |