@@ -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', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
|
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', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
|
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, |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | KEY ATT_email (ATT_email), |
120 | 120 | KEY ATT_lname (ATT_lname), |
121 | 121 | KEY ATT_fname (ATT_fname)"; |
122 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
123 | - $table_name = 'esp_country'; |
|
124 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
122 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
123 | + $table_name = 'esp_country'; |
|
124 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
125 | 125 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
126 | 126 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
127 | 127 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -137,25 +137,25 @@ discard block |
||
137 | 137 | CNT_is_EU tinyint(1) DEFAULT '0', |
138 | 138 | CNT_active tinyint(1) DEFAULT '0', |
139 | 139 | PRIMARY KEY (CNT_ISO)"; |
140 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
141 | - $table_name = 'esp_currency'; |
|
142 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
140 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
141 | + $table_name = 'esp_currency'; |
|
142 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
143 | 143 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
144 | 144 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
145 | 145 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
146 | 146 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
147 | 147 | CUR_active tinyint(1) DEFAULT '0', |
148 | 148 | PRIMARY KEY (CUR_code)"; |
149 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
150 | - $table_name = 'esp_currency_payment_method'; |
|
151 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
149 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
150 | + $table_name = 'esp_currency_payment_method'; |
|
151 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
152 | 152 | CUR_code varchar(6) collate utf8_bin NOT NULL, |
153 | 153 | PMD_ID int(11) NOT NULL, |
154 | 154 | PRIMARY KEY (CPM_ID), |
155 | 155 | KEY PMD_ID (PMD_ID)"; |
156 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
157 | - $table_name = 'esp_datetime'; |
|
158 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
156 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
157 | + $table_name = 'esp_datetime'; |
|
158 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
159 | 159 | EVT_ID bigint(20) unsigned NOT NULL, |
160 | 160 | DTT_name varchar(255) NOT NULL DEFAULT '', |
161 | 161 | DTT_description text NOT NULL, |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | KEY DTT_EVT_start (DTT_EVT_start), |
172 | 172 | KEY EVT_ID (EVT_ID), |
173 | 173 | KEY DTT_is_primary (DTT_is_primary)"; |
174 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | - $table_name = 'esp_event_meta'; |
|
176 | - $sql = " |
|
174 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | + $table_name = 'esp_event_meta'; |
|
176 | + $sql = " |
|
177 | 177 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
178 | 178 | EVT_ID bigint(20) unsigned NOT NULL, |
179 | 179 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -189,34 +189,34 @@ discard block |
||
189 | 189 | EVT_donations tinyint(1) NULL, |
190 | 190 | PRIMARY KEY (EVTM_ID), |
191 | 191 | KEY EVT_ID (EVT_ID)"; |
192 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
193 | - $table_name = 'esp_event_question_group'; |
|
194 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
192 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
193 | + $table_name = 'esp_event_question_group'; |
|
194 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
195 | 195 | EVT_ID bigint(20) unsigned NOT NULL, |
196 | 196 | QSG_ID int(10) unsigned NOT NULL, |
197 | 197 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
198 | 198 | PRIMARY KEY (EQG_ID), |
199 | 199 | KEY EVT_ID (EVT_ID), |
200 | 200 | KEY QSG_ID (QSG_ID)"; |
201 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | - $table_name = 'esp_event_venue'; |
|
203 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
201 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $table_name = 'esp_event_venue'; |
|
203 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
204 | 204 | EVT_ID bigint(20) unsigned NOT NULL, |
205 | 205 | VNU_ID bigint(20) unsigned NOT NULL, |
206 | 206 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
207 | 207 | PRIMARY KEY (EVV_ID)"; |
208 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | - $table_name = 'esp_extra_meta'; |
|
210 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
208 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | + $table_name = 'esp_extra_meta'; |
|
210 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
211 | 211 | OBJ_ID int(11) DEFAULT NULL, |
212 | 212 | EXM_type varchar(45) DEFAULT NULL, |
213 | 213 | EXM_key varchar(45) DEFAULT NULL, |
214 | 214 | EXM_value text, |
215 | 215 | PRIMARY KEY (EXM_ID), |
216 | 216 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
217 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | - $table_name = 'esp_extra_join'; |
|
219 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
217 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | + $table_name = 'esp_extra_join'; |
|
219 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
220 | 220 | EXJ_first_model_id varchar(6) NOT NULL, |
221 | 221 | EXJ_first_model_name varchar(20) NOT NULL, |
222 | 222 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | PRIMARY KEY (EXJ_ID), |
225 | 225 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
226 | 226 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
227 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
228 | - $table_name = 'esp_line_item'; |
|
229 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
227 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
228 | + $table_name = 'esp_line_item'; |
|
229 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | LIN_code varchar(245) NOT NULL DEFAULT '', |
231 | 231 | TXN_ID int(11) DEFAULT NULL, |
232 | 232 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | PRIMARY KEY (LIN_ID), |
246 | 246 | KEY LIN_code (LIN_code(191)), |
247 | 247 | KEY TXN_ID (TXN_ID)"; |
248 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | - $table_name = 'esp_log'; |
|
250 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
248 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | + $table_name = 'esp_log'; |
|
250 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
251 | 251 | LOG_time datetime DEFAULT NULL, |
252 | 252 | OBJ_ID varchar(45) DEFAULT NULL, |
253 | 253 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -258,18 +258,18 @@ discard block |
||
258 | 258 | KEY LOG_time (LOG_time), |
259 | 259 | KEY OBJ (OBJ_type,OBJ_ID), |
260 | 260 | KEY LOG_type (LOG_type)"; |
261 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | - $table_name = 'esp_message_template'; |
|
263 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
261 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | + $table_name = 'esp_message_template'; |
|
263 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
264 | 264 | GRP_ID int(10) unsigned NOT NULL, |
265 | 265 | MTP_context varchar(50) NOT NULL, |
266 | 266 | MTP_template_field varchar(30) NOT NULL, |
267 | 267 | MTP_content text NOT NULL, |
268 | 268 | PRIMARY KEY (MTP_ID), |
269 | 269 | KEY GRP_ID (GRP_ID)"; |
270 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
271 | - $table_name = 'esp_message_template_group'; |
|
272 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
270 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
271 | + $table_name = 'esp_message_template_group'; |
|
272 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
273 | 273 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
274 | 274 | MTP_name varchar(245) NOT NULL DEFAULT '', |
275 | 275 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -281,17 +281,17 @@ discard block |
||
281 | 281 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
282 | 282 | PRIMARY KEY (GRP_ID), |
283 | 283 | KEY MTP_user_id (MTP_user_id)"; |
284 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | - $table_name = 'esp_event_message_template'; |
|
286 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $table_name = 'esp_event_message_template'; |
|
286 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
287 | 287 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
288 | 288 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
289 | 289 | PRIMARY KEY (EMT_ID), |
290 | 290 | KEY EVT_ID (EVT_ID), |
291 | 291 | KEY GRP_ID (GRP_ID)"; |
292 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
293 | - $table_name = 'esp_payment'; |
|
294 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
292 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
293 | + $table_name = 'esp_payment'; |
|
294 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
295 | 295 | TXN_ID int(10) unsigned DEFAULT NULL, |
296 | 296 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
297 | 297 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | PRIMARY KEY (PAY_ID), |
309 | 309 | KEY PAY_timestamp (PAY_timestamp), |
310 | 310 | KEY TXN_ID (TXN_ID)"; |
311 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
312 | - $table_name = 'esp_payment_method'; |
|
313 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
311 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
312 | + $table_name = 'esp_payment_method'; |
|
313 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
314 | 314 | PMD_type varchar(124) DEFAULT NULL, |
315 | 315 | PMD_name varchar(255) DEFAULT NULL, |
316 | 316 | PMD_desc text, |
@@ -326,32 +326,32 @@ discard block |
||
326 | 326 | PRIMARY KEY (PMD_ID), |
327 | 327 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
328 | 328 | KEY PMD_type (PMD_type)"; |
329 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
330 | - $table_name = "esp_ticket_price"; |
|
331 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
329 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
330 | + $table_name = "esp_ticket_price"; |
|
331 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
332 | 332 | TKT_ID int(10) unsigned NOT NULL, |
333 | 333 | PRC_ID int(10) unsigned NOT NULL, |
334 | 334 | PRIMARY KEY (TKP_ID), |
335 | 335 | KEY TKT_ID (TKT_ID), |
336 | 336 | KEY PRC_ID (PRC_ID)"; |
337 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
338 | - $table_name = "esp_datetime_ticket"; |
|
339 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
337 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
338 | + $table_name = "esp_datetime_ticket"; |
|
339 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
340 | 340 | DTT_ID int(10) unsigned NOT NULL, |
341 | 341 | TKT_ID int(10) unsigned NOT NULL, |
342 | 342 | PRIMARY KEY (DTK_ID), |
343 | 343 | KEY DTT_ID (DTT_ID), |
344 | 344 | KEY TKT_ID (TKT_ID)"; |
345 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
346 | - $table_name = "esp_ticket_template"; |
|
347 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
345 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
346 | + $table_name = "esp_ticket_template"; |
|
347 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
348 | 348 | TTM_name varchar(45) NOT NULL, |
349 | 349 | TTM_description text, |
350 | 350 | TTM_file varchar(45), |
351 | 351 | PRIMARY KEY (TTM_ID)"; |
352 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
353 | - $table_name = 'esp_question'; |
|
354 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
352 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
353 | + $table_name = 'esp_question'; |
|
354 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
355 | 355 | QST_display_text text NOT NULL, |
356 | 356 | QST_admin_label varchar(255) NOT NULL, |
357 | 357 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -365,18 +365,18 @@ discard block |
||
365 | 365 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
366 | 366 | PRIMARY KEY (QST_ID), |
367 | 367 | KEY QST_order (QST_order)'; |
368 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
369 | - $table_name = 'esp_question_group_question'; |
|
370 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
368 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
369 | + $table_name = 'esp_question_group_question'; |
|
370 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
371 | 371 | QSG_ID int(10) unsigned NOT NULL, |
372 | 372 | QST_ID int(10) unsigned NOT NULL, |
373 | 373 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
374 | 374 | PRIMARY KEY (QGQ_ID), |
375 | 375 | KEY QST_ID (QST_ID), |
376 | 376 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
377 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | - $table_name = 'esp_question_option'; |
|
379 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
377 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | + $table_name = 'esp_question_option'; |
|
379 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
380 | 380 | QSO_value varchar(255) NOT NULL, |
381 | 381 | QSO_desc text NOT NULL, |
382 | 382 | QST_ID int(10) unsigned NOT NULL, |
@@ -386,9 +386,9 @@ discard block |
||
386 | 386 | PRIMARY KEY (QSO_ID), |
387 | 387 | KEY QST_ID (QST_ID), |
388 | 388 | KEY QSO_order (QSO_order)"; |
389 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
390 | - $table_name = 'esp_registration'; |
|
391 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
389 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
390 | + $table_name = 'esp_registration'; |
|
391 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | 392 | EVT_ID bigint(20) unsigned NOT NULL, |
393 | 393 | ATT_ID bigint(20) unsigned NOT NULL, |
394 | 394 | TXN_ID int(10) unsigned NOT NULL, |
@@ -412,18 +412,18 @@ discard block |
||
412 | 412 | KEY TKT_ID (TKT_ID), |
413 | 413 | KEY EVT_ID (EVT_ID), |
414 | 414 | KEY STS_ID (STS_ID)"; |
415 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
416 | - $table_name = 'esp_registration_payment'; |
|
417 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
416 | + $table_name = 'esp_registration_payment'; |
|
417 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
418 | 418 | REG_ID int(10) unsigned NOT NULL, |
419 | 419 | PAY_ID int(10) unsigned NULL, |
420 | 420 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
421 | 421 | PRIMARY KEY (RPY_ID), |
422 | 422 | KEY REG_ID (REG_ID), |
423 | 423 | KEY PAY_ID (PAY_ID)"; |
424 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
425 | - $table_name = 'esp_checkin'; |
|
426 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
424 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
425 | + $table_name = 'esp_checkin'; |
|
426 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
427 | 427 | REG_ID int(10) unsigned NOT NULL, |
428 | 428 | DTT_ID int(10) unsigned NOT NULL, |
429 | 429 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -431,9 +431,9 @@ discard block |
||
431 | 431 | PRIMARY KEY (CHK_ID), |
432 | 432 | KEY REG_ID (REG_ID), |
433 | 433 | KEY DTT_ID (DTT_ID)"; |
434 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
435 | - $table_name = 'esp_state'; |
|
436 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
434 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
435 | + $table_name = 'esp_state'; |
|
436 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
437 | 437 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
438 | 438 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
439 | 439 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | PRIMARY KEY (STA_ID), |
442 | 442 | KEY STA_abbrev (STA_abbrev), |
443 | 443 | KEY CNT_ISO (CNT_ISO)"; |
444 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
445 | - $table_name = 'esp_status'; |
|
446 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
444 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
445 | + $table_name = 'esp_status'; |
|
446 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
447 | 447 | STS_code varchar(45) NOT NULL, |
448 | 448 | STS_type varchar(45) NOT NULL, |
449 | 449 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
452 | 452 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
453 | 453 | KEY STS_type (STS_type)"; |
454 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
455 | - $table_name = 'esp_transaction'; |
|
456 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
454 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
455 | + $table_name = 'esp_transaction'; |
|
456 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
457 | 457 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
458 | 458 | TXN_total decimal(10,3) DEFAULT '0.00', |
459 | 459 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | PRIMARY KEY (TXN_ID), |
466 | 466 | KEY TXN_timestamp (TXN_timestamp), |
467 | 467 | KEY STS_ID (STS_ID)"; |
468 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
469 | - $table_name = 'esp_venue_meta'; |
|
470 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
468 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
469 | + $table_name = 'esp_venue_meta'; |
|
470 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
471 | 471 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
472 | 472 | VNU_address varchar(255) DEFAULT NULL, |
473 | 473 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -486,10 +486,10 @@ discard block |
||
486 | 486 | KEY VNU_ID (VNU_ID), |
487 | 487 | KEY STA_ID (STA_ID), |
488 | 488 | KEY CNT_ISO (CNT_ISO)"; |
489 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
490 | - // modified tables |
|
491 | - $table_name = "esp_price"; |
|
492 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
489 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
490 | + // modified tables |
|
491 | + $table_name = "esp_price"; |
|
492 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
493 | 493 | PRT_ID tinyint(3) unsigned NOT NULL, |
494 | 494 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
495 | 495 | PRC_name varchar(245) NOT NULL, |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | PRC_parent int(10) unsigned DEFAULT 0, |
503 | 503 | PRIMARY KEY (PRC_ID), |
504 | 504 | KEY PRT_ID (PRT_ID)"; |
505 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
506 | - $table_name = "esp_price_type"; |
|
507 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
505 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
506 | + $table_name = "esp_price_type"; |
|
507 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
508 | 508 | PRT_name varchar(45) NOT NULL, |
509 | 509 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
510 | 510 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
514 | 514 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
515 | 515 | PRIMARY KEY (PRT_ID)"; |
516 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
517 | - $table_name = "esp_ticket"; |
|
518 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
516 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
517 | + $table_name = "esp_ticket"; |
|
518 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
519 | 519 | TTM_ID int(10) unsigned NOT NULL, |
520 | 520 | TKT_name varchar(245) NOT NULL DEFAULT '', |
521 | 521 | TKT_description text NOT NULL, |
@@ -537,9 +537,9 @@ discard block |
||
537 | 537 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
538 | 538 | PRIMARY KEY (TKT_ID), |
539 | 539 | KEY TKT_start_date (TKT_start_date)"; |
540 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
541 | - $table_name = 'esp_question_group'; |
|
542 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
540 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
541 | + $table_name = 'esp_question_group'; |
|
542 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
543 | 543 | QSG_name varchar(255) NOT NULL, |
544 | 544 | QSG_identifier varchar(100) NOT NULL, |
545 | 545 | QSG_desc text NULL, |
@@ -552,223 +552,223 @@ discard block |
||
552 | 552 | PRIMARY KEY (QSG_ID), |
553 | 553 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
554 | 554 | KEY QSG_order (QSG_order)'; |
555 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
556 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
557 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
558 | - // (because many need to convert old string states to foreign keys into the states table) |
|
559 | - $script_4_1_defaults->insert_default_states(); |
|
560 | - $script_4_1_defaults->insert_default_countries(); |
|
561 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
562 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
563 | - $script_4_5_defaults->insert_default_price_types(); |
|
564 | - $script_4_5_defaults->insert_default_prices(); |
|
565 | - $script_4_5_defaults->insert_default_tickets(); |
|
566 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
567 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
568 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
569 | - $script_4_6_defaults->insert_default_currencies(); |
|
570 | - $this->verify_new_countries(); |
|
571 | - $this->verify_new_currencies(); |
|
572 | - return true; |
|
573 | - } |
|
555 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
556 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
557 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
558 | + // (because many need to convert old string states to foreign keys into the states table) |
|
559 | + $script_4_1_defaults->insert_default_states(); |
|
560 | + $script_4_1_defaults->insert_default_countries(); |
|
561 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
562 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
563 | + $script_4_5_defaults->insert_default_price_types(); |
|
564 | + $script_4_5_defaults->insert_default_prices(); |
|
565 | + $script_4_5_defaults->insert_default_tickets(); |
|
566 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
567 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
568 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
569 | + $script_4_6_defaults->insert_default_currencies(); |
|
570 | + $this->verify_new_countries(); |
|
571 | + $this->verify_new_currencies(); |
|
572 | + return true; |
|
573 | + } |
|
574 | 574 | |
575 | 575 | |
576 | 576 | |
577 | - /** |
|
578 | - * @return boolean |
|
579 | - */ |
|
580 | - public function schema_changes_after_migration() |
|
581 | - { |
|
582 | - $this->fix_non_default_taxes(); |
|
583 | - // this is actually the same as the last DMS |
|
584 | - /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
585 | - $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
586 | - return $script_4_7_defaults->schema_changes_after_migration(); |
|
587 | - } |
|
577 | + /** |
|
578 | + * @return boolean |
|
579 | + */ |
|
580 | + public function schema_changes_after_migration() |
|
581 | + { |
|
582 | + $this->fix_non_default_taxes(); |
|
583 | + // this is actually the same as the last DMS |
|
584 | + /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
585 | + $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
586 | + return $script_4_7_defaults->schema_changes_after_migration(); |
|
587 | + } |
|
588 | 588 | |
589 | 589 | |
590 | 590 | |
591 | - public function migration_page_hooks() |
|
592 | - { |
|
593 | - } |
|
591 | + public function migration_page_hooks() |
|
592 | + { |
|
593 | + } |
|
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | - /** |
|
598 | - * verifies each of the new countries exists that somehow we missed in 4.1 |
|
599 | - */ |
|
600 | - public function verify_new_countries() |
|
601 | - { |
|
602 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
603 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
604 | - // currency symbols: http://www.xe.com/symbols.php |
|
605 | - // 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 |
|
606 | - // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
607 | - $newer_countries = array( |
|
608 | - array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
609 | - array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
610 | - array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
611 | - array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
612 | - array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
613 | - array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
614 | - array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
615 | - array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
616 | - array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
617 | - array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
618 | - array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
619 | - array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
620 | - array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
621 | - array( |
|
622 | - 'BQ', |
|
623 | - 'BES', |
|
624 | - 0, |
|
625 | - 'Bonaire, Saint Eustatius and Saba', |
|
626 | - 'USD', |
|
627 | - 'Dollar', |
|
628 | - 'Dollars', |
|
629 | - '$', |
|
630 | - 1, |
|
631 | - 2, |
|
632 | - '+599', |
|
633 | - 0, |
|
634 | - 0, |
|
635 | - ), |
|
636 | - array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
637 | - array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
638 | - array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
639 | - array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
640 | - array( |
|
641 | - 'HM', |
|
642 | - 'HMD', |
|
643 | - 0, |
|
644 | - 'Heard Island and McDonald Islands', |
|
645 | - 'AUD', |
|
646 | - 'Dollar', |
|
647 | - 'Dollars', |
|
648 | - '$', |
|
649 | - 1, |
|
650 | - 2, |
|
651 | - '+891', |
|
652 | - 0, |
|
653 | - 0, |
|
654 | - ), |
|
655 | - array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
656 | - array( |
|
657 | - 'GS', |
|
658 | - 'SGS', |
|
659 | - 0, |
|
660 | - 'South Georgia and the South Sandwich Islands', |
|
661 | - 'GBP', |
|
662 | - 'Pound', |
|
663 | - 'Pounds', |
|
664 | - '£', |
|
665 | - 1, |
|
666 | - 2, |
|
667 | - '+500', |
|
668 | - 0, |
|
669 | - 0, |
|
670 | - ), |
|
671 | - array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
672 | - array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
673 | - array( |
|
674 | - 'UM', |
|
675 | - 'UMI', |
|
676 | - 0, |
|
677 | - 'United States Minor Outlying Islands', |
|
678 | - 'USD', |
|
679 | - 'Dollar', |
|
680 | - 'Dollars', |
|
681 | - '$', |
|
682 | - 1, |
|
683 | - 2, |
|
684 | - '+1', |
|
685 | - 0, |
|
686 | - 0, |
|
687 | - ), |
|
688 | - ); |
|
689 | - global $wpdb; |
|
690 | - $country_table = $wpdb->prefix . "esp_country"; |
|
691 | - $country_format = array( |
|
692 | - "CNT_ISO" => '%s', |
|
693 | - "CNT_ISO3" => '%s', |
|
694 | - "RGN_ID" => '%d', |
|
695 | - "CNT_name" => '%s', |
|
696 | - "CNT_cur_code" => '%s', |
|
697 | - "CNT_cur_single" => '%s', |
|
698 | - "CNT_cur_plural" => '%s', |
|
699 | - "CNT_cur_sign" => '%s', |
|
700 | - "CNT_cur_sign_b4" => '%d', |
|
701 | - "CNT_cur_dec_plc" => '%d', |
|
702 | - "CNT_tel_code" => '%s', |
|
703 | - "CNT_is_EU" => '%d', |
|
704 | - "CNT_active" => '%d', |
|
705 | - ); |
|
706 | - if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
707 | - foreach ($newer_countries as $country) { |
|
708 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
709 | - $countries = $wpdb->get_var($SQL); |
|
710 | - if (! $countries) { |
|
711 | - $wpdb->insert( |
|
712 | - $country_table, |
|
713 | - array_combine(array_keys($country_format), $country), |
|
714 | - $country_format |
|
715 | - ); |
|
716 | - } |
|
717 | - } |
|
718 | - } |
|
719 | - } |
|
597 | + /** |
|
598 | + * verifies each of the new countries exists that somehow we missed in 4.1 |
|
599 | + */ |
|
600 | + public function verify_new_countries() |
|
601 | + { |
|
602 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
603 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
604 | + // currency symbols: http://www.xe.com/symbols.php |
|
605 | + // 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 |
|
606 | + // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
607 | + $newer_countries = array( |
|
608 | + array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
609 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
610 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
611 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
612 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
613 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
614 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
615 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
616 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
617 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
618 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
619 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
620 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
621 | + array( |
|
622 | + 'BQ', |
|
623 | + 'BES', |
|
624 | + 0, |
|
625 | + 'Bonaire, Saint Eustatius and Saba', |
|
626 | + 'USD', |
|
627 | + 'Dollar', |
|
628 | + 'Dollars', |
|
629 | + '$', |
|
630 | + 1, |
|
631 | + 2, |
|
632 | + '+599', |
|
633 | + 0, |
|
634 | + 0, |
|
635 | + ), |
|
636 | + array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
637 | + array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
638 | + array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
639 | + array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
640 | + array( |
|
641 | + 'HM', |
|
642 | + 'HMD', |
|
643 | + 0, |
|
644 | + 'Heard Island and McDonald Islands', |
|
645 | + 'AUD', |
|
646 | + 'Dollar', |
|
647 | + 'Dollars', |
|
648 | + '$', |
|
649 | + 1, |
|
650 | + 2, |
|
651 | + '+891', |
|
652 | + 0, |
|
653 | + 0, |
|
654 | + ), |
|
655 | + array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
656 | + array( |
|
657 | + 'GS', |
|
658 | + 'SGS', |
|
659 | + 0, |
|
660 | + 'South Georgia and the South Sandwich Islands', |
|
661 | + 'GBP', |
|
662 | + 'Pound', |
|
663 | + 'Pounds', |
|
664 | + '£', |
|
665 | + 1, |
|
666 | + 2, |
|
667 | + '+500', |
|
668 | + 0, |
|
669 | + 0, |
|
670 | + ), |
|
671 | + array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
672 | + array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
673 | + array( |
|
674 | + 'UM', |
|
675 | + 'UMI', |
|
676 | + 0, |
|
677 | + 'United States Minor Outlying Islands', |
|
678 | + 'USD', |
|
679 | + 'Dollar', |
|
680 | + 'Dollars', |
|
681 | + '$', |
|
682 | + 1, |
|
683 | + 2, |
|
684 | + '+1', |
|
685 | + 0, |
|
686 | + 0, |
|
687 | + ), |
|
688 | + ); |
|
689 | + global $wpdb; |
|
690 | + $country_table = $wpdb->prefix . "esp_country"; |
|
691 | + $country_format = array( |
|
692 | + "CNT_ISO" => '%s', |
|
693 | + "CNT_ISO3" => '%s', |
|
694 | + "RGN_ID" => '%d', |
|
695 | + "CNT_name" => '%s', |
|
696 | + "CNT_cur_code" => '%s', |
|
697 | + "CNT_cur_single" => '%s', |
|
698 | + "CNT_cur_plural" => '%s', |
|
699 | + "CNT_cur_sign" => '%s', |
|
700 | + "CNT_cur_sign_b4" => '%d', |
|
701 | + "CNT_cur_dec_plc" => '%d', |
|
702 | + "CNT_tel_code" => '%s', |
|
703 | + "CNT_is_EU" => '%d', |
|
704 | + "CNT_active" => '%d', |
|
705 | + ); |
|
706 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
707 | + foreach ($newer_countries as $country) { |
|
708 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
709 | + $countries = $wpdb->get_var($SQL); |
|
710 | + if (! $countries) { |
|
711 | + $wpdb->insert( |
|
712 | + $country_table, |
|
713 | + array_combine(array_keys($country_format), $country), |
|
714 | + $country_format |
|
715 | + ); |
|
716 | + } |
|
717 | + } |
|
718 | + } |
|
719 | + } |
|
720 | 720 | |
721 | 721 | |
722 | 722 | |
723 | - /** |
|
724 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
725 | - */ |
|
726 | - public function verify_new_currencies() |
|
727 | - { |
|
728 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
729 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
730 | - // currency symbols: http://www.xe.com/symbols.php |
|
731 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
732 | - // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
733 | - $newer_currencies = array( |
|
734 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
735 | - ); |
|
736 | - global $wpdb; |
|
737 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
738 | - $currency_format = array( |
|
739 | - "CUR_code" => '%s', |
|
740 | - "CUR_single" => '%s', |
|
741 | - "CUR_plural" => '%s', |
|
742 | - "CUR_sign" => '%s', |
|
743 | - "CUR_dec_plc" => '%d', |
|
744 | - "CUR_active" => '%d', |
|
745 | - ); |
|
746 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
747 | - foreach ($newer_currencies as $currency) { |
|
748 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
749 | - $countries = $wpdb->get_var($SQL); |
|
750 | - if (! $countries) { |
|
751 | - $wpdb->insert( |
|
752 | - $currency_table, |
|
753 | - array_combine(array_keys($currency_format), $currency), |
|
754 | - $currency_format |
|
755 | - ); |
|
756 | - } |
|
757 | - } |
|
758 | - } |
|
759 | - } |
|
723 | + /** |
|
724 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
725 | + */ |
|
726 | + public function verify_new_currencies() |
|
727 | + { |
|
728 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
729 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
730 | + // currency symbols: http://www.xe.com/symbols.php |
|
731 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
732 | + // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
733 | + $newer_currencies = array( |
|
734 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
735 | + ); |
|
736 | + global $wpdb; |
|
737 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
738 | + $currency_format = array( |
|
739 | + "CUR_code" => '%s', |
|
740 | + "CUR_single" => '%s', |
|
741 | + "CUR_plural" => '%s', |
|
742 | + "CUR_sign" => '%s', |
|
743 | + "CUR_dec_plc" => '%d', |
|
744 | + "CUR_active" => '%d', |
|
745 | + ); |
|
746 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
747 | + foreach ($newer_currencies as $currency) { |
|
748 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
749 | + $countries = $wpdb->get_var($SQL); |
|
750 | + if (! $countries) { |
|
751 | + $wpdb->insert( |
|
752 | + $currency_table, |
|
753 | + array_combine(array_keys($currency_format), $currency), |
|
754 | + $currency_format |
|
755 | + ); |
|
756 | + } |
|
757 | + } |
|
758 | + } |
|
759 | + } |
|
760 | 760 | |
761 | 761 | |
762 | 762 | |
763 | - /** |
|
764 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
765 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
766 | - * we should be able to stop doing this in 4.9 |
|
767 | - */ |
|
768 | - public function fix_non_default_taxes() |
|
769 | - { |
|
770 | - global $wpdb; |
|
771 | - $query = $wpdb->prepare("UPDATE |
|
763 | + /** |
|
764 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
765 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
766 | + * we should be able to stop doing this in 4.9 |
|
767 | + */ |
|
768 | + public function fix_non_default_taxes() |
|
769 | + { |
|
770 | + global $wpdb; |
|
771 | + $query = $wpdb->prepare("UPDATE |
|
772 | 772 | {$wpdb->prefix}esp_price p INNER JOIN |
773 | 773 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
774 | 774 | SET |
@@ -777,6 +777,6 @@ discard block |
||
777 | 777 | p.PRC_is_default = 0 AND |
778 | 778 | pt.PBT_ID = %d |
779 | 779 | ", EEM_Price_Type::base_type_tax); |
780 | - $wpdb->query($query); |
|
781 | - } |
|
780 | + $wpdb->query($query); |
|
781 | + } |
|
782 | 782 | } |
@@ -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', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
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, |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | ), |
688 | 688 | ); |
689 | 689 | global $wpdb; |
690 | - $country_table = $wpdb->prefix . "esp_country"; |
|
690 | + $country_table = $wpdb->prefix."esp_country"; |
|
691 | 691 | $country_format = array( |
692 | 692 | "CNT_ISO" => '%s', |
693 | 693 | "CNT_ISO3" => '%s', |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | foreach ($newer_countries as $country) { |
708 | 708 | $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
709 | 709 | $countries = $wpdb->get_var($SQL); |
710 | - if (! $countries) { |
|
710 | + if ( ! $countries) { |
|
711 | 711 | $wpdb->insert( |
712 | 712 | $country_table, |
713 | 713 | array_combine(array_keys($country_format), $country), |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
735 | 735 | ); |
736 | 736 | global $wpdb; |
737 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
737 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
738 | 738 | $currency_format = array( |
739 | 739 | "CUR_code" => '%s', |
740 | 740 | "CUR_single" => '%s', |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | foreach ($newer_currencies as $currency) { |
748 | 748 | $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
749 | 749 | $countries = $wpdb->get_var($SQL); |
750 | - if (! $countries) { |
|
750 | + if ( ! $countries) { |
|
751 | 751 | $wpdb->insert( |
752 | 752 | $currency_table, |
753 | 753 | array_combine(array_keys($currency_format), $currency), |
@@ -8,53 +8,53 @@ |
||
8 | 8 | */ |
9 | 9 | class EE_DMS_4_1_0_category_details extends EE_Data_Migration_Script_Stage |
10 | 10 | { |
11 | - private $_old_table; |
|
12 | - private $_new_table; |
|
13 | - private $_new_term_table; |
|
14 | - public function _migration_step($num_items = 50) |
|
15 | - { |
|
16 | - global $wpdb; |
|
17 | - $start_at_record = $this->count_records_migrated(); |
|
18 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
19 | - $items_actually_migrated = 0; |
|
20 | - foreach ($rows as $category_detail_row) { |
|
21 | - $term_and_taxonomy_ids = wp_insert_term( |
|
22 | - stripslashes($category_detail_row['category_name']), |
|
23 | - 'espresso_event_categories', |
|
24 | - array( |
|
25 | - 'description'=> stripslashes($category_detail_row['category_desc']), |
|
26 | - 'slug'=>$category_detail_row['category_identifier'] |
|
27 | - ) |
|
28 | - ); |
|
29 | - if ($term_and_taxonomy_ids instanceof WP_Error) { |
|
30 | - $this->add_error(sprintf(__("Could not create WP Term_Taxonomy from old category: %s. The Error was: %s", "event_espresso"), $this->_json_encode($category_detail_row), $term_and_taxonomy_ids->get_error_message())); |
|
31 | - $items_actually_migrated++; |
|
32 | - continue; |
|
33 | - } |
|
34 | - $term_id = $term_and_taxonomy_ids['term_id']; |
|
35 | - $term_taxonomy_id = $term_and_taxonomy_ids['term_taxonomy_id']; |
|
36 | - $this->get_migration_script()->set_mapping($this->_old_table, $category_detail_row['id'], $this->_new_term_table, $term_id); |
|
37 | - $this->get_migration_script()->set_mapping($this->_old_table, $category_detail_row['id'], $this->_new_table, $term_taxonomy_id); |
|
38 | - $items_actually_migrated++; |
|
39 | - } |
|
40 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
41 | - $this->set_completed(); |
|
42 | - } |
|
43 | - return $items_actually_migrated; |
|
44 | - } |
|
45 | - public function _count_records_to_migrate() |
|
46 | - { |
|
47 | - global $wpdb; |
|
48 | - $count = $wpdb->get_var("SELECT COUNT(id) FROM $this->_old_table"); |
|
49 | - return $count; |
|
50 | - } |
|
51 | - public function __construct() |
|
52 | - { |
|
53 | - $this->_pretty_name = __("Category Details", "event_espresso"); |
|
54 | - global $wpdb; |
|
55 | - $this->_old_table = $wpdb->prefix."events_category_detail"; |
|
56 | - $this->_new_table = $wpdb->prefix."term_taxonomy"; |
|
57 | - $this->_new_term_table = $wpdb->prefix."terms"; |
|
58 | - parent::__construct(); |
|
59 | - } |
|
11 | + private $_old_table; |
|
12 | + private $_new_table; |
|
13 | + private $_new_term_table; |
|
14 | + public function _migration_step($num_items = 50) |
|
15 | + { |
|
16 | + global $wpdb; |
|
17 | + $start_at_record = $this->count_records_migrated(); |
|
18 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
19 | + $items_actually_migrated = 0; |
|
20 | + foreach ($rows as $category_detail_row) { |
|
21 | + $term_and_taxonomy_ids = wp_insert_term( |
|
22 | + stripslashes($category_detail_row['category_name']), |
|
23 | + 'espresso_event_categories', |
|
24 | + array( |
|
25 | + 'description'=> stripslashes($category_detail_row['category_desc']), |
|
26 | + 'slug'=>$category_detail_row['category_identifier'] |
|
27 | + ) |
|
28 | + ); |
|
29 | + if ($term_and_taxonomy_ids instanceof WP_Error) { |
|
30 | + $this->add_error(sprintf(__("Could not create WP Term_Taxonomy from old category: %s. The Error was: %s", "event_espresso"), $this->_json_encode($category_detail_row), $term_and_taxonomy_ids->get_error_message())); |
|
31 | + $items_actually_migrated++; |
|
32 | + continue; |
|
33 | + } |
|
34 | + $term_id = $term_and_taxonomy_ids['term_id']; |
|
35 | + $term_taxonomy_id = $term_and_taxonomy_ids['term_taxonomy_id']; |
|
36 | + $this->get_migration_script()->set_mapping($this->_old_table, $category_detail_row['id'], $this->_new_term_table, $term_id); |
|
37 | + $this->get_migration_script()->set_mapping($this->_old_table, $category_detail_row['id'], $this->_new_table, $term_taxonomy_id); |
|
38 | + $items_actually_migrated++; |
|
39 | + } |
|
40 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
41 | + $this->set_completed(); |
|
42 | + } |
|
43 | + return $items_actually_migrated; |
|
44 | + } |
|
45 | + public function _count_records_to_migrate() |
|
46 | + { |
|
47 | + global $wpdb; |
|
48 | + $count = $wpdb->get_var("SELECT COUNT(id) FROM $this->_old_table"); |
|
49 | + return $count; |
|
50 | + } |
|
51 | + public function __construct() |
|
52 | + { |
|
53 | + $this->_pretty_name = __("Category Details", "event_espresso"); |
|
54 | + global $wpdb; |
|
55 | + $this->_old_table = $wpdb->prefix."events_category_detail"; |
|
56 | + $this->_new_table = $wpdb->prefix."term_taxonomy"; |
|
57 | + $this->_new_term_table = $wpdb->prefix."terms"; |
|
58 | + parent::__construct(); |
|
59 | + } |
|
60 | 60 | } |
@@ -24,87 +24,85 @@ |
||
24 | 24 | 'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'), |
25 | 25 | 'term_order'=>new EE_Integer_Field('term_order', __('Term Order','event_espresso'), false, 0) |
26 | 26 | )); |
27 | - |
|
28 | - |
|
29 | 27 | * |
30 | 28 | */ |
31 | 29 | class EE_DMS_4_1_0_event_category extends EE_Data_Migration_Script_Stage |
32 | 30 | { |
33 | - private $_old_table; |
|
34 | - private $_new_table; |
|
35 | - public function _migration_step($num_items = 50) |
|
36 | - { |
|
37 | - global $wpdb; |
|
38 | - $start_at_record = $this->count_records_migrated(); |
|
39 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
40 | - $items_actually_migrated = 0; |
|
41 | - foreach ($rows as $event_venue_rel) { |
|
42 | - $term_relation_id = $this->_add_relation_from_event_to_term_taxonomy($event_venue_rel); |
|
43 | - if ($term_relation_id) { |
|
44 | - $this->get_migration_script()->set_mapping($this->_old_table, $event_venue_rel['id'], $this->_new_table, $term_relation_id); |
|
45 | - } |
|
46 | - $items_actually_migrated++; |
|
47 | - } |
|
48 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
49 | - $this->set_completed(); |
|
50 | - } |
|
51 | - return $items_actually_migrated; |
|
52 | - } |
|
53 | - public function _count_records_to_migrate() |
|
54 | - { |
|
55 | - global $wpdb; |
|
56 | - $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
57 | - return $count; |
|
58 | - } |
|
59 | - public function __construct() |
|
60 | - { |
|
61 | - global $wpdb; |
|
62 | - $this->_old_table = $wpdb->prefix."events_category_rel"; |
|
63 | - $this->_new_table = $wpdb->prefix."term_relationships"; |
|
64 | - $this->_pretty_name = __("Event to Category (4.1 Term Relationships)", "event_espresso"); |
|
65 | - parent::__construct(); |
|
66 | - } |
|
31 | + private $_old_table; |
|
32 | + private $_new_table; |
|
33 | + public function _migration_step($num_items = 50) |
|
34 | + { |
|
35 | + global $wpdb; |
|
36 | + $start_at_record = $this->count_records_migrated(); |
|
37 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
38 | + $items_actually_migrated = 0; |
|
39 | + foreach ($rows as $event_venue_rel) { |
|
40 | + $term_relation_id = $this->_add_relation_from_event_to_term_taxonomy($event_venue_rel); |
|
41 | + if ($term_relation_id) { |
|
42 | + $this->get_migration_script()->set_mapping($this->_old_table, $event_venue_rel['id'], $this->_new_table, $term_relation_id); |
|
43 | + } |
|
44 | + $items_actually_migrated++; |
|
45 | + } |
|
46 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
47 | + $this->set_completed(); |
|
48 | + } |
|
49 | + return $items_actually_migrated; |
|
50 | + } |
|
51 | + public function _count_records_to_migrate() |
|
52 | + { |
|
53 | + global $wpdb; |
|
54 | + $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
55 | + return $count; |
|
56 | + } |
|
57 | + public function __construct() |
|
58 | + { |
|
59 | + global $wpdb; |
|
60 | + $this->_old_table = $wpdb->prefix."events_category_rel"; |
|
61 | + $this->_new_table = $wpdb->prefix."term_relationships"; |
|
62 | + $this->_pretty_name = __("Event to Category (4.1 Term Relationships)", "event_espresso"); |
|
63 | + parent::__construct(); |
|
64 | + } |
|
67 | 65 | |
68 | - /** |
|
69 | - * Attempts to insert a new question group inthe new format given an old one |
|
70 | - * @global type $wpdb |
|
71 | - * @param array $old_event_cat_relation |
|
72 | - * @return int |
|
73 | - */ |
|
74 | - private function _add_relation_from_event_to_term_taxonomy($old_event_cat_relation) |
|
75 | - { |
|
76 | - global $wpdb; |
|
77 | - $new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", intval($old_event_cat_relation['event_id']), $wpdb->prefix."posts"); |
|
78 | - $new_term_taxonomy_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_category_detail", intval($old_event_cat_relation['cat_id']), $wpdb->prefix."term_taxonomy"); |
|
79 | - if (! $new_event_id) { |
|
80 | - $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_cat_relation['event_id'])); |
|
81 | - return 0; |
|
82 | - } |
|
83 | - if (! $new_term_taxonomy_id) { |
|
84 | - $this->add_error(sprintf(__("Could not find 4.1 term-taxonomy id for 3.1 category #%d.", "event_espresso"), $old_event_cat_relation['cat_id'])); |
|
85 | - return 0; |
|
86 | - } |
|
87 | - $cols_n_values = array( |
|
88 | - 'object_id'=>$new_event_id, |
|
89 | - 'term_taxonomy_id'=>$new_term_taxonomy_id, |
|
90 | - 'term_order'=>0 |
|
91 | - ); |
|
92 | - $datatypes = array( |
|
93 | - '%d',// object_id |
|
94 | - '%d',// term_taxonomy_id |
|
95 | - '%d',// term_order |
|
96 | - ); |
|
97 | - $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
98 | - if (! $success) { |
|
99 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_cat_relation, $this->_new_table, $cols_n_values, $datatypes)); |
|
100 | - return 0; |
|
101 | - } else { |
|
102 | - // increment the term-taxonomie's count |
|
103 | - $success = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->term_taxonomy} SET count = count +1 WHERE term_taxonomy_id=%d", $new_term_taxonomy_id)); |
|
104 | - if (! $success) { |
|
105 | - $this->add_error(sprintf(__('Could not increment term_taxonomy\'s count because %s', 'event_espresso'), $wpdb->last_error)); |
|
106 | - } |
|
107 | - } |
|
108 | - return $wpdb->insert_id; |
|
109 | - } |
|
66 | + /** |
|
67 | + * Attempts to insert a new question group inthe new format given an old one |
|
68 | + * @global type $wpdb |
|
69 | + * @param array $old_event_cat_relation |
|
70 | + * @return int |
|
71 | + */ |
|
72 | + private function _add_relation_from_event_to_term_taxonomy($old_event_cat_relation) |
|
73 | + { |
|
74 | + global $wpdb; |
|
75 | + $new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", intval($old_event_cat_relation['event_id']), $wpdb->prefix."posts"); |
|
76 | + $new_term_taxonomy_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_category_detail", intval($old_event_cat_relation['cat_id']), $wpdb->prefix."term_taxonomy"); |
|
77 | + if (! $new_event_id) { |
|
78 | + $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_cat_relation['event_id'])); |
|
79 | + return 0; |
|
80 | + } |
|
81 | + if (! $new_term_taxonomy_id) { |
|
82 | + $this->add_error(sprintf(__("Could not find 4.1 term-taxonomy id for 3.1 category #%d.", "event_espresso"), $old_event_cat_relation['cat_id'])); |
|
83 | + return 0; |
|
84 | + } |
|
85 | + $cols_n_values = array( |
|
86 | + 'object_id'=>$new_event_id, |
|
87 | + 'term_taxonomy_id'=>$new_term_taxonomy_id, |
|
88 | + 'term_order'=>0 |
|
89 | + ); |
|
90 | + $datatypes = array( |
|
91 | + '%d',// object_id |
|
92 | + '%d',// term_taxonomy_id |
|
93 | + '%d',// term_order |
|
94 | + ); |
|
95 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
96 | + if (! $success) { |
|
97 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_cat_relation, $this->_new_table, $cols_n_values, $datatypes)); |
|
98 | + return 0; |
|
99 | + } else { |
|
100 | + // increment the term-taxonomie's count |
|
101 | + $success = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->term_taxonomy} SET count = count +1 WHERE term_taxonomy_id=%d", $new_term_taxonomy_id)); |
|
102 | + if (! $success) { |
|
103 | + $this->add_error(sprintf(__('Could not increment term_taxonomy\'s count because %s', 'event_espresso'), $wpdb->last_error)); |
|
104 | + } |
|
105 | + } |
|
106 | + return $wpdb->insert_id; |
|
107 | + } |
|
110 | 108 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | global $wpdb; |
77 | 77 | $new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", intval($old_event_cat_relation['event_id']), $wpdb->prefix."posts"); |
78 | 78 | $new_term_taxonomy_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_category_detail", intval($old_event_cat_relation['cat_id']), $wpdb->prefix."term_taxonomy"); |
79 | - if (! $new_event_id) { |
|
79 | + if ( ! $new_event_id) { |
|
80 | 80 | $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_cat_relation['event_id'])); |
81 | 81 | return 0; |
82 | 82 | } |
83 | - if (! $new_term_taxonomy_id) { |
|
83 | + if ( ! $new_term_taxonomy_id) { |
|
84 | 84 | $this->add_error(sprintf(__("Could not find 4.1 term-taxonomy id for 3.1 category #%d.", "event_espresso"), $old_event_cat_relation['cat_id'])); |
85 | 85 | return 0; |
86 | 86 | } |
@@ -90,18 +90,18 @@ discard block |
||
90 | 90 | 'term_order'=>0 |
91 | 91 | ); |
92 | 92 | $datatypes = array( |
93 | - '%d',// object_id |
|
94 | - '%d',// term_taxonomy_id |
|
95 | - '%d',// term_order |
|
93 | + '%d', // object_id |
|
94 | + '%d', // term_taxonomy_id |
|
95 | + '%d', // term_order |
|
96 | 96 | ); |
97 | 97 | $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
98 | - if (! $success) { |
|
98 | + if ( ! $success) { |
|
99 | 99 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_cat_relation, $this->_new_table, $cols_n_values, $datatypes)); |
100 | 100 | return 0; |
101 | 101 | } else { |
102 | 102 | // increment the term-taxonomie's count |
103 | 103 | $success = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->term_taxonomy} SET count = count +1 WHERE term_taxonomy_id=%d", $new_term_taxonomy_id)); |
104 | - if (! $success) { |
|
104 | + if ( ! $success) { |
|
105 | 105 | $this->add_error(sprintf(__('Could not increment term_taxonomy\'s count because %s', 'event_espresso'), $wpdb->last_error)); |
106 | 106 | } |
107 | 107 | } |
@@ -38,168 +38,168 @@ |
||
38 | 38 | */ |
39 | 39 | class EE_DMS_4_1_0_line_items extends EE_Data_Migration_Script_Stage_Table |
40 | 40 | { |
41 | - private $_new_line_table; |
|
42 | - private $_new_transaction_table; |
|
43 | - private $_new_reg_table; |
|
44 | - public function __construct() |
|
45 | - { |
|
46 | - global $wpdb; |
|
47 | - $this->_pretty_name = __("Line Items", "event_espresso"); |
|
48 | - $this->_old_table = $wpdb->prefix."events_attendee"; |
|
49 | - $this->_new_transaction_table = $wpdb->prefix."esp_transaction"; |
|
50 | - $this->_new_line_table = $wpdb->prefix."esp_line_item"; |
|
51 | - $this->_new_reg_table = $wpdb->prefix."esp_registration"; |
|
52 | - parent::__construct(); |
|
53 | - } |
|
41 | + private $_new_line_table; |
|
42 | + private $_new_transaction_table; |
|
43 | + private $_new_reg_table; |
|
44 | + public function __construct() |
|
45 | + { |
|
46 | + global $wpdb; |
|
47 | + $this->_pretty_name = __("Line Items", "event_espresso"); |
|
48 | + $this->_old_table = $wpdb->prefix."events_attendee"; |
|
49 | + $this->_new_transaction_table = $wpdb->prefix."esp_transaction"; |
|
50 | + $this->_new_line_table = $wpdb->prefix."esp_line_item"; |
|
51 | + $this->_new_reg_table = $wpdb->prefix."esp_registration"; |
|
52 | + parent::__construct(); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function _migrate_old_row($old_row) |
|
56 | - { |
|
57 | - // insert line items if its a primary id |
|
58 | - if (intval($old_row['is_primary'])) { |
|
59 | - $txn_id = $this->get_migration_script()->get_mapping_new_pk($this->_old_table, $old_row['id'], $this->_new_transaction_table); |
|
60 | - if (! $txn_id) { |
|
61 | - $this->add_error(sprintf(__("Could not find the transaction for the 3.1 attendee %d from row %s", "event_espresso"), $old_row['id'], $this->_json_encode($old_row))); |
|
62 | - return; |
|
63 | - } |
|
64 | - $txn = $this->_get_txn($txn_id); |
|
65 | - $new_line_items = $this->_insert_new_line_items($txn, $old_row); |
|
66 | - $this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_line_table, $new_line_items); |
|
67 | - } |
|
68 | - } |
|
55 | + protected function _migrate_old_row($old_row) |
|
56 | + { |
|
57 | + // insert line items if its a primary id |
|
58 | + if (intval($old_row['is_primary'])) { |
|
59 | + $txn_id = $this->get_migration_script()->get_mapping_new_pk($this->_old_table, $old_row['id'], $this->_new_transaction_table); |
|
60 | + if (! $txn_id) { |
|
61 | + $this->add_error(sprintf(__("Could not find the transaction for the 3.1 attendee %d from row %s", "event_espresso"), $old_row['id'], $this->_json_encode($old_row))); |
|
62 | + return; |
|
63 | + } |
|
64 | + $txn = $this->_get_txn($txn_id); |
|
65 | + $new_line_items = $this->_insert_new_line_items($txn, $old_row); |
|
66 | + $this->get_migration_script()->set_mapping($this->_old_table, $old_row['id'], $this->_new_line_table, $new_line_items); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - private function _get_txn($txn_id) |
|
71 | - { |
|
72 | - global $wpdb; |
|
73 | - $txn = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->_new_transaction_table WHERE TXN_ID=%d", $txn_id), ARRAY_A); |
|
74 | - return $txn; |
|
75 | - } |
|
70 | + private function _get_txn($txn_id) |
|
71 | + { |
|
72 | + global $wpdb; |
|
73 | + $txn = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->_new_transaction_table WHERE TXN_ID=%d", $txn_id), ARRAY_A); |
|
74 | + return $txn; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * In 4.1, we'd normally need more info than just the registrations to make the line items. Ie, we'd need |
|
79 | - * the transaction, and tax prices at the time of registration. (And probably promotions and other price factors). |
|
80 | - * But seeing how these are REGs created from 3.1 attendee data, which have |
|
81 | - * @param array $transaction |
|
82 | - * @return array new line item ids |
|
83 | - */ |
|
84 | - private function _insert_new_line_items($transaction, $old_attendee) |
|
85 | - { |
|
86 | - global $wpdb; |
|
87 | - $regs_on_this_transaction = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$this->_new_reg_table." WHERE TXN_ID=%d", $transaction['TXN_ID']), ARRAY_A); |
|
88 | - $new_line_item_ids = array(); |
|
89 | - // create a totla line item |
|
90 | - $total_line_item_id = $this->_insert_new_line_item(array( |
|
91 | - 'LIN_code'=>'total', |
|
92 | - 'TXN_ID'=>$transaction['TXN_ID'], |
|
93 | - 'LIN_name'=> __("Total", "event_espresso"), |
|
94 | - 'LIN_total'=>$transaction['TXN_total'], |
|
95 | - 'LIN_type'=>'total', |
|
96 | - 'OBJ_ID'=>$transaction['TXN_ID'], |
|
97 | - 'OBJ_type'=>'Transaction' |
|
98 | - ), $old_attendee); |
|
99 | - $new_line_item_ids[] = $total_line_item_id; |
|
100 | - // create a subtotal line item |
|
101 | - $reg_total = 0; |
|
102 | - foreach ($regs_on_this_transaction as $new_reg) { |
|
103 | - $reg_total += floatval($new_reg['REG_final_price']); |
|
104 | - } |
|
105 | - $subtotal_line_item_id = $this->_insert_new_line_item(array( |
|
106 | - 'LIN_code'=>'sub-total', |
|
107 | - 'TXN_ID'=>$transaction['TXN_ID'], |
|
108 | - 'LIN_name'=> __("Subtotal", "event_espresso"), |
|
109 | - 'LIN_total'=>$reg_total, |
|
110 | - 'LIN_parent'=>$total_line_item_id, |
|
111 | - 'LIN_type'=>'sub-total', |
|
112 | - ), $old_attendee); |
|
113 | - $new_line_item_ids[] = $subtotal_line_item_id; |
|
114 | - // group REGs by TKT_ID |
|
115 | - $regs_by_tkt = array(); |
|
116 | - foreach ($regs_on_this_transaction as $new_reg) { |
|
117 | - $regs_by_tkt[ $new_reg['TKT_ID'] ][] = $new_reg; |
|
118 | - } |
|
77 | + /** |
|
78 | + * In 4.1, we'd normally need more info than just the registrations to make the line items. Ie, we'd need |
|
79 | + * the transaction, and tax prices at the time of registration. (And probably promotions and other price factors). |
|
80 | + * But seeing how these are REGs created from 3.1 attendee data, which have |
|
81 | + * @param array $transaction |
|
82 | + * @return array new line item ids |
|
83 | + */ |
|
84 | + private function _insert_new_line_items($transaction, $old_attendee) |
|
85 | + { |
|
86 | + global $wpdb; |
|
87 | + $regs_on_this_transaction = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$this->_new_reg_table." WHERE TXN_ID=%d", $transaction['TXN_ID']), ARRAY_A); |
|
88 | + $new_line_item_ids = array(); |
|
89 | + // create a totla line item |
|
90 | + $total_line_item_id = $this->_insert_new_line_item(array( |
|
91 | + 'LIN_code'=>'total', |
|
92 | + 'TXN_ID'=>$transaction['TXN_ID'], |
|
93 | + 'LIN_name'=> __("Total", "event_espresso"), |
|
94 | + 'LIN_total'=>$transaction['TXN_total'], |
|
95 | + 'LIN_type'=>'total', |
|
96 | + 'OBJ_ID'=>$transaction['TXN_ID'], |
|
97 | + 'OBJ_type'=>'Transaction' |
|
98 | + ), $old_attendee); |
|
99 | + $new_line_item_ids[] = $total_line_item_id; |
|
100 | + // create a subtotal line item |
|
101 | + $reg_total = 0; |
|
102 | + foreach ($regs_on_this_transaction as $new_reg) { |
|
103 | + $reg_total += floatval($new_reg['REG_final_price']); |
|
104 | + } |
|
105 | + $subtotal_line_item_id = $this->_insert_new_line_item(array( |
|
106 | + 'LIN_code'=>'sub-total', |
|
107 | + 'TXN_ID'=>$transaction['TXN_ID'], |
|
108 | + 'LIN_name'=> __("Subtotal", "event_espresso"), |
|
109 | + 'LIN_total'=>$reg_total, |
|
110 | + 'LIN_parent'=>$total_line_item_id, |
|
111 | + 'LIN_type'=>'sub-total', |
|
112 | + ), $old_attendee); |
|
113 | + $new_line_item_ids[] = $subtotal_line_item_id; |
|
114 | + // group REGs by TKT_ID |
|
115 | + $regs_by_tkt = array(); |
|
116 | + foreach ($regs_on_this_transaction as $new_reg) { |
|
117 | + $regs_by_tkt[ $new_reg['TKT_ID'] ][] = $new_reg; |
|
118 | + } |
|
119 | 119 | |
120 | - // create individual line items |
|
120 | + // create individual line items |
|
121 | 121 | |
122 | - foreach ($regs_by_tkt as $ticket_id => $regs) { |
|
123 | - $count = count($regs); |
|
124 | - $line_total = 0; |
|
125 | - foreach ($regs as $new_reg) { |
|
126 | - $line_total += $new_reg['REG_final_price']; |
|
127 | - } |
|
128 | - $a_reg = reset($regs); |
|
129 | - $new_ticket = $this->_get_new_ticket_row($a_reg['TKT_ID']); |
|
130 | - $reg_line_item_id = $this->_insert_new_line_item(array( |
|
131 | - 'LIN_code'=> md5('Ticket' . $ticket_id . time()), |
|
132 | - 'TXN_ID'=>$transaction['TXN_ID'], |
|
133 | - 'LIN_name'=>$new_ticket['TKT_name'], |
|
134 | - 'LIN_unit_price'=>$a_reg['REG_final_price'], |
|
135 | - 'LIN_is_taxable'=>false, |
|
136 | - 'LIN_total'=>$line_total, |
|
137 | - 'LIN_quantity'=>$count, |
|
138 | - 'LIN_parent'=>$subtotal_line_item_id, |
|
139 | - 'OBJ_ID'=>$ticket_id, |
|
140 | - 'OBJ_type'=>'Ticket' |
|
141 | - ), $old_attendee); |
|
142 | - $new_line_item_ids[] = $reg_line_item_id; |
|
143 | - } |
|
122 | + foreach ($regs_by_tkt as $ticket_id => $regs) { |
|
123 | + $count = count($regs); |
|
124 | + $line_total = 0; |
|
125 | + foreach ($regs as $new_reg) { |
|
126 | + $line_total += $new_reg['REG_final_price']; |
|
127 | + } |
|
128 | + $a_reg = reset($regs); |
|
129 | + $new_ticket = $this->_get_new_ticket_row($a_reg['TKT_ID']); |
|
130 | + $reg_line_item_id = $this->_insert_new_line_item(array( |
|
131 | + 'LIN_code'=> md5('Ticket' . $ticket_id . time()), |
|
132 | + 'TXN_ID'=>$transaction['TXN_ID'], |
|
133 | + 'LIN_name'=>$new_ticket['TKT_name'], |
|
134 | + 'LIN_unit_price'=>$a_reg['REG_final_price'], |
|
135 | + 'LIN_is_taxable'=>false, |
|
136 | + 'LIN_total'=>$line_total, |
|
137 | + 'LIN_quantity'=>$count, |
|
138 | + 'LIN_parent'=>$subtotal_line_item_id, |
|
139 | + 'OBJ_ID'=>$ticket_id, |
|
140 | + 'OBJ_type'=>'Ticket' |
|
141 | + ), $old_attendee); |
|
142 | + $new_line_item_ids[] = $reg_line_item_id; |
|
143 | + } |
|
144 | 144 | |
145 | 145 | |
146 | 146 | |
147 | - return $new_line_item_ids; |
|
148 | - } |
|
149 | - /** |
|
150 | - * Gets the full ticket by ID |
|
151 | - * @global type $wpdb |
|
152 | - * @param type $new_ticket_id |
|
153 | - * @return array |
|
154 | - */ |
|
155 | - private function _get_new_ticket_row($new_ticket_id) |
|
156 | - { |
|
157 | - global $wpdb; |
|
158 | - $ticket_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."esp_ticket WHERE TKT_ID=%d", $new_ticket_id), ARRAY_A); |
|
159 | - return $ticket_row; |
|
160 | - } |
|
147 | + return $new_line_item_ids; |
|
148 | + } |
|
149 | + /** |
|
150 | + * Gets the full ticket by ID |
|
151 | + * @global type $wpdb |
|
152 | + * @param type $new_ticket_id |
|
153 | + * @return array |
|
154 | + */ |
|
155 | + private function _get_new_ticket_row($new_ticket_id) |
|
156 | + { |
|
157 | + global $wpdb; |
|
158 | + $ticket_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."esp_ticket WHERE TKT_ID=%d", $new_ticket_id), ARRAY_A); |
|
159 | + return $ticket_row; |
|
160 | + } |
|
161 | 161 | |
162 | - private function _insert_new_line_item($cols_n_values, $old_attendee) |
|
163 | - { |
|
164 | - global $wpdb; |
|
165 | - $default_cols_n_values = array( |
|
166 | - 'LIN_code'=>'', |
|
167 | - 'TXN_ID'=>0, |
|
168 | - 'LIN_name'=>'', |
|
169 | - 'LIN_desc'=>'', |
|
170 | - 'LIN_unit_price'=>0, |
|
171 | - 'LIN_percent'=>0, |
|
172 | - 'LIN_is_taxable'=>false, |
|
173 | - 'LIN_order'=>0, |
|
174 | - 'LIN_total'=>0, |
|
175 | - 'LIN_quantity'=>null, |
|
176 | - 'LIN_parent'=>0, |
|
177 | - 'LIN_type'=>'line-item', |
|
178 | - 'OBJ_ID'=>null, |
|
179 | - 'OBJ_type'=>null |
|
180 | - ); |
|
181 | - $cols_n_values = array_merge($default_cols_n_values, $cols_n_values); |
|
182 | - $datatypes = array( |
|
183 | - '%s',// LIN_code |
|
184 | - '%d',// TXN_ID |
|
185 | - '%s',// LIN_name |
|
186 | - '%s',// LIN_desc |
|
187 | - '%f',// LIN_unit_price |
|
188 | - '%f',// LIN_percent |
|
189 | - '%d',// LIN_is_taxable |
|
190 | - '%d',// LIN_order |
|
191 | - '%f',// LIN_total |
|
192 | - '%d',// LIN_quantity |
|
193 | - '%d',// LIN_parent |
|
194 | - '%s',// LIN_type |
|
195 | - '%d',// OBJ_ID |
|
196 | - '%s',// OBJ_type |
|
197 | - ); |
|
198 | - $success = $wpdb->insert($this->_new_line_table, $cols_n_values, $datatypes); |
|
199 | - if (! $success) { |
|
200 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_reg_table, $cols_n_values, $datatypes)); |
|
201 | - return 0; |
|
202 | - } |
|
203 | - return $wpdb->insert_id; |
|
204 | - } |
|
162 | + private function _insert_new_line_item($cols_n_values, $old_attendee) |
|
163 | + { |
|
164 | + global $wpdb; |
|
165 | + $default_cols_n_values = array( |
|
166 | + 'LIN_code'=>'', |
|
167 | + 'TXN_ID'=>0, |
|
168 | + 'LIN_name'=>'', |
|
169 | + 'LIN_desc'=>'', |
|
170 | + 'LIN_unit_price'=>0, |
|
171 | + 'LIN_percent'=>0, |
|
172 | + 'LIN_is_taxable'=>false, |
|
173 | + 'LIN_order'=>0, |
|
174 | + 'LIN_total'=>0, |
|
175 | + 'LIN_quantity'=>null, |
|
176 | + 'LIN_parent'=>0, |
|
177 | + 'LIN_type'=>'line-item', |
|
178 | + 'OBJ_ID'=>null, |
|
179 | + 'OBJ_type'=>null |
|
180 | + ); |
|
181 | + $cols_n_values = array_merge($default_cols_n_values, $cols_n_values); |
|
182 | + $datatypes = array( |
|
183 | + '%s',// LIN_code |
|
184 | + '%d',// TXN_ID |
|
185 | + '%s',// LIN_name |
|
186 | + '%s',// LIN_desc |
|
187 | + '%f',// LIN_unit_price |
|
188 | + '%f',// LIN_percent |
|
189 | + '%d',// LIN_is_taxable |
|
190 | + '%d',// LIN_order |
|
191 | + '%f',// LIN_total |
|
192 | + '%d',// LIN_quantity |
|
193 | + '%d',// LIN_parent |
|
194 | + '%s',// LIN_type |
|
195 | + '%d',// OBJ_ID |
|
196 | + '%s',// OBJ_type |
|
197 | + ); |
|
198 | + $success = $wpdb->insert($this->_new_line_table, $cols_n_values, $datatypes); |
|
199 | + if (! $success) { |
|
200 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_reg_table, $cols_n_values, $datatypes)); |
|
201 | + return 0; |
|
202 | + } |
|
203 | + return $wpdb->insert_id; |
|
204 | + } |
|
205 | 205 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // insert line items if its a primary id |
58 | 58 | if (intval($old_row['is_primary'])) { |
59 | 59 | $txn_id = $this->get_migration_script()->get_mapping_new_pk($this->_old_table, $old_row['id'], $this->_new_transaction_table); |
60 | - if (! $txn_id) { |
|
60 | + if ( ! $txn_id) { |
|
61 | 61 | $this->add_error(sprintf(__("Could not find the transaction for the 3.1 attendee %d from row %s", "event_espresso"), $old_row['id'], $this->_json_encode($old_row))); |
62 | 62 | return; |
63 | 63 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // group REGs by TKT_ID |
115 | 115 | $regs_by_tkt = array(); |
116 | 116 | foreach ($regs_on_this_transaction as $new_reg) { |
117 | - $regs_by_tkt[ $new_reg['TKT_ID'] ][] = $new_reg; |
|
117 | + $regs_by_tkt[$new_reg['TKT_ID']][] = $new_reg; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // create individual line items |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $a_reg = reset($regs); |
129 | 129 | $new_ticket = $this->_get_new_ticket_row($a_reg['TKT_ID']); |
130 | 130 | $reg_line_item_id = $this->_insert_new_line_item(array( |
131 | - 'LIN_code'=> md5('Ticket' . $ticket_id . time()), |
|
131 | + 'LIN_code'=> md5('Ticket'.$ticket_id.time()), |
|
132 | 132 | 'TXN_ID'=>$transaction['TXN_ID'], |
133 | 133 | 'LIN_name'=>$new_ticket['TKT_name'], |
134 | 134 | 'LIN_unit_price'=>$a_reg['REG_final_price'], |
@@ -180,23 +180,23 @@ discard block |
||
180 | 180 | ); |
181 | 181 | $cols_n_values = array_merge($default_cols_n_values, $cols_n_values); |
182 | 182 | $datatypes = array( |
183 | - '%s',// LIN_code |
|
184 | - '%d',// TXN_ID |
|
185 | - '%s',// LIN_name |
|
186 | - '%s',// LIN_desc |
|
187 | - '%f',// LIN_unit_price |
|
188 | - '%f',// LIN_percent |
|
189 | - '%d',// LIN_is_taxable |
|
190 | - '%d',// LIN_order |
|
191 | - '%f',// LIN_total |
|
192 | - '%d',// LIN_quantity |
|
193 | - '%d',// LIN_parent |
|
194 | - '%s',// LIN_type |
|
195 | - '%d',// OBJ_ID |
|
196 | - '%s',// OBJ_type |
|
183 | + '%s', // LIN_code |
|
184 | + '%d', // TXN_ID |
|
185 | + '%s', // LIN_name |
|
186 | + '%s', // LIN_desc |
|
187 | + '%f', // LIN_unit_price |
|
188 | + '%f', // LIN_percent |
|
189 | + '%d', // LIN_is_taxable |
|
190 | + '%d', // LIN_order |
|
191 | + '%f', // LIN_total |
|
192 | + '%d', // LIN_quantity |
|
193 | + '%d', // LIN_parent |
|
194 | + '%s', // LIN_type |
|
195 | + '%d', // OBJ_ID |
|
196 | + '%s', // OBJ_type |
|
197 | 197 | ); |
198 | 198 | $success = $wpdb->insert($this->_new_line_table, $cols_n_values, $datatypes); |
199 | - if (! $success) { |
|
199 | + if ( ! $success) { |
|
200 | 200 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_attendee, $this->_new_reg_table, $cols_n_values, $datatypes)); |
201 | 201 | return 0; |
202 | 202 | } |
@@ -25,92 +25,89 @@ |
||
25 | 25 | |
26 | 26 | ) |
27 | 27 | ); |
28 | - |
|
29 | - |
|
30 | - |
|
31 | 28 | * |
32 | 29 | */ |
33 | 30 | class EE_DMS_4_1_0_event_venue extends EE_Data_Migration_Script_Stage |
34 | 31 | { |
35 | - private $_old_table; |
|
36 | - private $_new_table; |
|
37 | - public function _migration_step($num_items = 50) |
|
38 | - { |
|
32 | + private $_old_table; |
|
33 | + private $_new_table; |
|
34 | + public function _migration_step($num_items = 50) |
|
35 | + { |
|
39 | 36 | |
40 | - global $wpdb; |
|
41 | - $start_at_record = $this->count_records_migrated(); |
|
42 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
43 | - $items_actually_migrated = 0; |
|
44 | - foreach ($rows as $event_venue_rel) { |
|
45 | - $this->_insert_new_event_to_venue_rel($event_venue_rel); |
|
46 | - $items_actually_migrated++; |
|
47 | - } |
|
48 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
49 | - $this->set_completed(); |
|
50 | - } |
|
51 | - return $items_actually_migrated; |
|
52 | - } |
|
53 | - public function _count_records_to_migrate() |
|
54 | - { |
|
55 | - global $wpdb; |
|
56 | - $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
57 | - return $count; |
|
58 | - } |
|
59 | - public function __construct() |
|
60 | - { |
|
61 | - global $wpdb; |
|
62 | - $this->_old_table = $wpdb->prefix."events_venue_rel"; |
|
63 | - $this->_new_table = $wpdb->prefix."esp_event_venue"; |
|
64 | - $this->_pretty_name = __("Event to Venue Relations", "event_espresso"); |
|
65 | - parent::__construct(); |
|
66 | - } |
|
37 | + global $wpdb; |
|
38 | + $start_at_record = $this->count_records_migrated(); |
|
39 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
40 | + $items_actually_migrated = 0; |
|
41 | + foreach ($rows as $event_venue_rel) { |
|
42 | + $this->_insert_new_event_to_venue_rel($event_venue_rel); |
|
43 | + $items_actually_migrated++; |
|
44 | + } |
|
45 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
46 | + $this->set_completed(); |
|
47 | + } |
|
48 | + return $items_actually_migrated; |
|
49 | + } |
|
50 | + public function _count_records_to_migrate() |
|
51 | + { |
|
52 | + global $wpdb; |
|
53 | + $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
54 | + return $count; |
|
55 | + } |
|
56 | + public function __construct() |
|
57 | + { |
|
58 | + global $wpdb; |
|
59 | + $this->_old_table = $wpdb->prefix."events_venue_rel"; |
|
60 | + $this->_new_table = $wpdb->prefix."esp_event_venue"; |
|
61 | + $this->_pretty_name = __("Event to Venue Relations", "event_espresso"); |
|
62 | + parent::__construct(); |
|
63 | + } |
|
67 | 64 | |
68 | - /** |
|
69 | - * Attempts to insert a new question group inthe new format given an old one |
|
70 | - * @global type $wpdb |
|
71 | - * @param array $old_event_venue_rel |
|
72 | - * @return int |
|
73 | - */ |
|
74 | - private function _insert_new_event_to_venue_rel($old_event_venue_rel) |
|
75 | - { |
|
76 | - global $wpdb; |
|
77 | - $new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", $old_event_venue_rel['event_id'], $wpdb->prefix."posts"); |
|
78 | - $new_venue_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_venue", $old_event_venue_rel['venue_id'], $wpdb->prefix."posts"); |
|
79 | - if (! $new_event_id) { |
|
80 | - $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_venue_rel['event_id'])); |
|
81 | - return 0; |
|
82 | - } |
|
83 | - if (! $new_venue_id) { |
|
84 | - $this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $old_event_venue_rel['venue_id'])); |
|
85 | - return 0; |
|
86 | - } |
|
87 | - // first ensure there are no other relation entries for this event |
|
88 | - // because although EE4 supports it, EE3 didn't really |
|
89 | - $wpdb->delete( |
|
90 | - $this->_new_table, |
|
91 | - array( |
|
92 | - 'EVT_ID' => $new_event_id, |
|
93 | - ), |
|
94 | - array( |
|
95 | - '%d',// EVT_ID |
|
96 | - ) |
|
97 | - ); |
|
65 | + /** |
|
66 | + * Attempts to insert a new question group inthe new format given an old one |
|
67 | + * @global type $wpdb |
|
68 | + * @param array $old_event_venue_rel |
|
69 | + * @return int |
|
70 | + */ |
|
71 | + private function _insert_new_event_to_venue_rel($old_event_venue_rel) |
|
72 | + { |
|
73 | + global $wpdb; |
|
74 | + $new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", $old_event_venue_rel['event_id'], $wpdb->prefix."posts"); |
|
75 | + $new_venue_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_venue", $old_event_venue_rel['venue_id'], $wpdb->prefix."posts"); |
|
76 | + if (! $new_event_id) { |
|
77 | + $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_venue_rel['event_id'])); |
|
78 | + return 0; |
|
79 | + } |
|
80 | + if (! $new_venue_id) { |
|
81 | + $this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $old_event_venue_rel['venue_id'])); |
|
82 | + return 0; |
|
83 | + } |
|
84 | + // first ensure there are no other relation entries for this event |
|
85 | + // because although EE4 supports it, EE3 didn't really |
|
86 | + $wpdb->delete( |
|
87 | + $this->_new_table, |
|
88 | + array( |
|
89 | + 'EVT_ID' => $new_event_id, |
|
90 | + ), |
|
91 | + array( |
|
92 | + '%d',// EVT_ID |
|
93 | + ) |
|
94 | + ); |
|
98 | 95 | // echo "last query". $wpdb->last_query;die; |
99 | - $cols_n_values = array( |
|
100 | - 'EVT_ID'=>$new_event_id, |
|
101 | - 'VNU_ID'=>$new_venue_id, |
|
102 | - 'EVV_primary'=>true |
|
103 | - ); |
|
104 | - $datatypes = array( |
|
105 | - '%d',// EVT_ID |
|
106 | - '%d',// VNU_ID |
|
107 | - '%d',// EVT_primary |
|
108 | - ); |
|
109 | - $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
110 | - if (! $success) { |
|
111 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_venue_rel, $this->_new_table, $cols_n_values, $datatypes)); |
|
112 | - return 0; |
|
113 | - } |
|
114 | - return $wpdb->insert_id; |
|
115 | - } |
|
96 | + $cols_n_values = array( |
|
97 | + 'EVT_ID'=>$new_event_id, |
|
98 | + 'VNU_ID'=>$new_venue_id, |
|
99 | + 'EVV_primary'=>true |
|
100 | + ); |
|
101 | + $datatypes = array( |
|
102 | + '%d',// EVT_ID |
|
103 | + '%d',// VNU_ID |
|
104 | + '%d',// EVT_primary |
|
105 | + ); |
|
106 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
107 | + if (! $success) { |
|
108 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_venue_rel, $this->_new_table, $cols_n_values, $datatypes)); |
|
109 | + return 0; |
|
110 | + } |
|
111 | + return $wpdb->insert_id; |
|
112 | + } |
|
116 | 113 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | global $wpdb; |
77 | 77 | $new_event_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_detail", $old_event_venue_rel['event_id'], $wpdb->prefix."posts"); |
78 | 78 | $new_venue_id = $this->get_migration_script()->get_mapping_new_pk($wpdb->prefix."events_venue", $old_event_venue_rel['venue_id'], $wpdb->prefix."posts"); |
79 | - if (! $new_event_id) { |
|
79 | + if ( ! $new_event_id) { |
|
80 | 80 | $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $old_event_venue_rel['event_id'])); |
81 | 81 | return 0; |
82 | 82 | } |
83 | - if (! $new_venue_id) { |
|
83 | + if ( ! $new_venue_id) { |
|
84 | 84 | $this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $old_event_venue_rel['venue_id'])); |
85 | 85 | return 0; |
86 | 86 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'EVT_ID' => $new_event_id, |
93 | 93 | ), |
94 | 94 | array( |
95 | - '%d',// EVT_ID |
|
95 | + '%d', // EVT_ID |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | // echo "last query". $wpdb->last_query;die; |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | 'EVV_primary'=>true |
103 | 103 | ); |
104 | 104 | $datatypes = array( |
105 | - '%d',// EVT_ID |
|
106 | - '%d',// VNU_ID |
|
107 | - '%d',// EVT_primary |
|
105 | + '%d', // EVT_ID |
|
106 | + '%d', // VNU_ID |
|
107 | + '%d', // EVT_primary |
|
108 | 108 | ); |
109 | 109 | $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
110 | - if (! $success) { |
|
110 | + if ( ! $success) { |
|
111 | 111 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_venue_rel, $this->_new_table, $cols_n_values, $datatypes)); |
112 | 112 | return 0; |
113 | 113 | } |
@@ -40,119 +40,119 @@ |
||
40 | 40 | */ |
41 | 41 | class EE_DMS_4_1_0_question_groups extends EE_Data_Migration_Script_Stage |
42 | 42 | { |
43 | - private $_old_table; |
|
44 | - private $_new_table; |
|
45 | - /** |
|
46 | - * Keeps track of whether or not we've already added a system question group, |
|
47 | - * in order to avoid adding more than 1 (basically, in 3.1 this would happen |
|
48 | - * with the Roles & Permissions addon, because each user had their own set of |
|
49 | - * question groups and questions), |
|
50 | - * @var boolean |
|
51 | - */ |
|
52 | - private $_already_got_system_question_group_1 = false; |
|
53 | - public function _migration_step($num_items = 50) |
|
54 | - { |
|
43 | + private $_old_table; |
|
44 | + private $_new_table; |
|
45 | + /** |
|
46 | + * Keeps track of whether or not we've already added a system question group, |
|
47 | + * in order to avoid adding more than 1 (basically, in 3.1 this would happen |
|
48 | + * with the Roles & Permissions addon, because each user had their own set of |
|
49 | + * question groups and questions), |
|
50 | + * @var boolean |
|
51 | + */ |
|
52 | + private $_already_got_system_question_group_1 = false; |
|
53 | + public function _migration_step($num_items = 50) |
|
54 | + { |
|
55 | 55 | |
56 | - global $wpdb; |
|
57 | - $start_at_record = $this->count_records_migrated(); |
|
58 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
59 | - $items_actually_migrated = 0; |
|
60 | - foreach ($rows as $question_group) { |
|
61 | - $new_id = $this->_insert_new_question_group($question_group); |
|
56 | + global $wpdb; |
|
57 | + $start_at_record = $this->count_records_migrated(); |
|
58 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
59 | + $items_actually_migrated = 0; |
|
60 | + foreach ($rows as $question_group) { |
|
61 | + $new_id = $this->_insert_new_question_group($question_group); |
|
62 | 62 | |
63 | - $this->get_migration_script()->set_mapping($this->_old_table, $question_group['id'], $this->_new_table, $new_id); |
|
64 | - $items_actually_migrated++; |
|
65 | - } |
|
66 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
67 | - $this->set_completed(); |
|
68 | - } |
|
69 | - return $items_actually_migrated; |
|
70 | - } |
|
71 | - public function _count_records_to_migrate() |
|
72 | - { |
|
73 | - global $wpdb; |
|
74 | - $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
75 | - return $count; |
|
76 | - } |
|
77 | - public function __construct() |
|
78 | - { |
|
79 | - global $wpdb; |
|
80 | - $this->_old_table = $wpdb->prefix."events_qst_group"; |
|
81 | - $this->_new_table = $wpdb->prefix."esp_question_group"; |
|
82 | - $this->_pretty_name = __("Question Groups", "event_espresso"); |
|
83 | - parent::__construct(); |
|
84 | - } |
|
63 | + $this->get_migration_script()->set_mapping($this->_old_table, $question_group['id'], $this->_new_table, $new_id); |
|
64 | + $items_actually_migrated++; |
|
65 | + } |
|
66 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
67 | + $this->set_completed(); |
|
68 | + } |
|
69 | + return $items_actually_migrated; |
|
70 | + } |
|
71 | + public function _count_records_to_migrate() |
|
72 | + { |
|
73 | + global $wpdb; |
|
74 | + $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
75 | + return $count; |
|
76 | + } |
|
77 | + public function __construct() |
|
78 | + { |
|
79 | + global $wpdb; |
|
80 | + $this->_old_table = $wpdb->prefix."events_qst_group"; |
|
81 | + $this->_new_table = $wpdb->prefix."esp_question_group"; |
|
82 | + $this->_pretty_name = __("Question Groups", "event_espresso"); |
|
83 | + parent::__construct(); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Attempts to insert a new question group inthe new format given an old one |
|
88 | - * @global type $wpdb |
|
89 | - * @param array $old_question_group |
|
90 | - * @return int |
|
91 | - */ |
|
92 | - private function _insert_new_question_group($old_question_group) |
|
93 | - { |
|
94 | - global $wpdb; |
|
95 | - // try to guess what the QST_system int should be... finding the Personal info system |
|
96 | - // question group is quite easy. But in 3.1 address info WASN'T a system group, it just exitsed by default but |
|
97 | - // could be easily removed. |
|
98 | - if ($old_question_group['system_group'] && ! $this->_already_got_system_question_group_1()) { |
|
99 | - $guess_at_system_number = 1; |
|
100 | - } elseif ($old_question_group['id'] == '2' && strpos($old_question_group['group_name'], 'Address')!==false) { |
|
101 | - $guess_at_system_number = 2; |
|
102 | - } else { |
|
103 | - $guess_at_system_number = 0; |
|
104 | - } |
|
105 | - // if the question group wasn't made by the normal admin, |
|
106 | - // we'd like to keep track of who made it |
|
107 | - if (intval($old_question_group['wp_user'])!=1) { |
|
108 | - $username = $wpdb->get_var($wpdb->prepare("SELECT user_nicename FROM ".$wpdb->users." WHERE ID = %d", $old_question_group['wp_user'])); |
|
109 | - $identifier = $old_question_group['group_identifier']."-by-".$username; |
|
110 | - } else { |
|
111 | - $identifier = $old_question_group['group_identifier']; |
|
112 | - } |
|
113 | - $cols_n_values = array( |
|
114 | - 'QSG_name'=>stripslashes($old_question_group['group_name']), |
|
115 | - 'QSG_identifier'=>$identifier, |
|
116 | - 'QSG_desc'=>stripslashes($old_question_group['group_description']), |
|
117 | - 'QSG_order'=>$old_question_group['group_order'], |
|
118 | - 'QSG_show_group_name'=>$old_question_group['show_group_name'], |
|
119 | - 'QSG_show_group_desc'=>$old_question_group['show_group_description'], |
|
120 | - 'QSG_system'=>$guess_at_system_number, |
|
121 | - 'QSG_deleted'=>false |
|
122 | - ); |
|
123 | - $datatypes = array( |
|
124 | - '%s',// QSG_name |
|
125 | - '%s',// QSG_identifier |
|
126 | - '%s',// QSG_desc |
|
127 | - '%d',// QSG_order |
|
128 | - '%d',// QSG_show_group_name |
|
129 | - '%d',// QSG_show_group_desc |
|
130 | - '%d',// QSG_system |
|
131 | - '%d',// QSG_deleted |
|
132 | - ); |
|
133 | - $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
134 | - if (! $success) { |
|
135 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question_group, $this->_new_table, $cols_n_values, $datatypes)); |
|
136 | - return 0; |
|
137 | - } |
|
138 | - return $wpdb->insert_id; |
|
139 | - } |
|
86 | + /** |
|
87 | + * Attempts to insert a new question group inthe new format given an old one |
|
88 | + * @global type $wpdb |
|
89 | + * @param array $old_question_group |
|
90 | + * @return int |
|
91 | + */ |
|
92 | + private function _insert_new_question_group($old_question_group) |
|
93 | + { |
|
94 | + global $wpdb; |
|
95 | + // try to guess what the QST_system int should be... finding the Personal info system |
|
96 | + // question group is quite easy. But in 3.1 address info WASN'T a system group, it just exitsed by default but |
|
97 | + // could be easily removed. |
|
98 | + if ($old_question_group['system_group'] && ! $this->_already_got_system_question_group_1()) { |
|
99 | + $guess_at_system_number = 1; |
|
100 | + } elseif ($old_question_group['id'] == '2' && strpos($old_question_group['group_name'], 'Address')!==false) { |
|
101 | + $guess_at_system_number = 2; |
|
102 | + } else { |
|
103 | + $guess_at_system_number = 0; |
|
104 | + } |
|
105 | + // if the question group wasn't made by the normal admin, |
|
106 | + // we'd like to keep track of who made it |
|
107 | + if (intval($old_question_group['wp_user'])!=1) { |
|
108 | + $username = $wpdb->get_var($wpdb->prepare("SELECT user_nicename FROM ".$wpdb->users." WHERE ID = %d", $old_question_group['wp_user'])); |
|
109 | + $identifier = $old_question_group['group_identifier']."-by-".$username; |
|
110 | + } else { |
|
111 | + $identifier = $old_question_group['group_identifier']; |
|
112 | + } |
|
113 | + $cols_n_values = array( |
|
114 | + 'QSG_name'=>stripslashes($old_question_group['group_name']), |
|
115 | + 'QSG_identifier'=>$identifier, |
|
116 | + 'QSG_desc'=>stripslashes($old_question_group['group_description']), |
|
117 | + 'QSG_order'=>$old_question_group['group_order'], |
|
118 | + 'QSG_show_group_name'=>$old_question_group['show_group_name'], |
|
119 | + 'QSG_show_group_desc'=>$old_question_group['show_group_description'], |
|
120 | + 'QSG_system'=>$guess_at_system_number, |
|
121 | + 'QSG_deleted'=>false |
|
122 | + ); |
|
123 | + $datatypes = array( |
|
124 | + '%s',// QSG_name |
|
125 | + '%s',// QSG_identifier |
|
126 | + '%s',// QSG_desc |
|
127 | + '%d',// QSG_order |
|
128 | + '%d',// QSG_show_group_name |
|
129 | + '%d',// QSG_show_group_desc |
|
130 | + '%d',// QSG_system |
|
131 | + '%d',// QSG_deleted |
|
132 | + ); |
|
133 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
134 | + if (! $success) { |
|
135 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question_group, $this->_new_table, $cols_n_values, $datatypes)); |
|
136 | + return 0; |
|
137 | + } |
|
138 | + return $wpdb->insert_id; |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * Checks if we've already added a system question 1 to the new question groups table |
|
143 | - * @global type $wpdb |
|
144 | - * @return boolean |
|
145 | - */ |
|
146 | - private function _already_got_system_question_group_1() |
|
147 | - { |
|
148 | - if (! $this->_already_got_system_question_group_1) { |
|
149 | - // check the db |
|
150 | - global $wpdb; |
|
151 | - $exists = $wpdb->get_var("SELECT COUNT(*) FROM {$this->_new_table} WHERE QSG_system=1"); |
|
152 | - if (intval($exists)>0) { |
|
153 | - $this->_already_got_system_question_group_1 = true; |
|
154 | - } |
|
155 | - } |
|
156 | - return $this->_already_got_system_question_group_1; |
|
157 | - } |
|
141 | + /** |
|
142 | + * Checks if we've already added a system question 1 to the new question groups table |
|
143 | + * @global type $wpdb |
|
144 | + * @return boolean |
|
145 | + */ |
|
146 | + private function _already_got_system_question_group_1() |
|
147 | + { |
|
148 | + if (! $this->_already_got_system_question_group_1) { |
|
149 | + // check the db |
|
150 | + global $wpdb; |
|
151 | + $exists = $wpdb->get_var("SELECT COUNT(*) FROM {$this->_new_table} WHERE QSG_system=1"); |
|
152 | + if (intval($exists)>0) { |
|
153 | + $this->_already_got_system_question_group_1 = true; |
|
154 | + } |
|
155 | + } |
|
156 | + return $this->_already_got_system_question_group_1; |
|
157 | + } |
|
158 | 158 | } |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | // could be easily removed. |
98 | 98 | if ($old_question_group['system_group'] && ! $this->_already_got_system_question_group_1()) { |
99 | 99 | $guess_at_system_number = 1; |
100 | - } elseif ($old_question_group['id'] == '2' && strpos($old_question_group['group_name'], 'Address')!==false) { |
|
100 | + } elseif ($old_question_group['id'] == '2' && strpos($old_question_group['group_name'], 'Address') !== false) { |
|
101 | 101 | $guess_at_system_number = 2; |
102 | 102 | } else { |
103 | 103 | $guess_at_system_number = 0; |
104 | 104 | } |
105 | 105 | // if the question group wasn't made by the normal admin, |
106 | 106 | // we'd like to keep track of who made it |
107 | - if (intval($old_question_group['wp_user'])!=1) { |
|
107 | + if (intval($old_question_group['wp_user']) != 1) { |
|
108 | 108 | $username = $wpdb->get_var($wpdb->prepare("SELECT user_nicename FROM ".$wpdb->users." WHERE ID = %d", $old_question_group['wp_user'])); |
109 | 109 | $identifier = $old_question_group['group_identifier']."-by-".$username; |
110 | 110 | } else { |
@@ -121,17 +121,17 @@ discard block |
||
121 | 121 | 'QSG_deleted'=>false |
122 | 122 | ); |
123 | 123 | $datatypes = array( |
124 | - '%s',// QSG_name |
|
125 | - '%s',// QSG_identifier |
|
126 | - '%s',// QSG_desc |
|
127 | - '%d',// QSG_order |
|
128 | - '%d',// QSG_show_group_name |
|
129 | - '%d',// QSG_show_group_desc |
|
130 | - '%d',// QSG_system |
|
131 | - '%d',// QSG_deleted |
|
124 | + '%s', // QSG_name |
|
125 | + '%s', // QSG_identifier |
|
126 | + '%s', // QSG_desc |
|
127 | + '%d', // QSG_order |
|
128 | + '%d', // QSG_show_group_name |
|
129 | + '%d', // QSG_show_group_desc |
|
130 | + '%d', // QSG_system |
|
131 | + '%d', // QSG_deleted |
|
132 | 132 | ); |
133 | 133 | $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
134 | - if (! $success) { |
|
134 | + if ( ! $success) { |
|
135 | 135 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question_group, $this->_new_table, $cols_n_values, $datatypes)); |
136 | 136 | return 0; |
137 | 137 | } |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | */ |
146 | 146 | private function _already_got_system_question_group_1() |
147 | 147 | { |
148 | - if (! $this->_already_got_system_question_group_1) { |
|
148 | + if ( ! $this->_already_got_system_question_group_1) { |
|
149 | 149 | // check the db |
150 | 150 | global $wpdb; |
151 | 151 | $exists = $wpdb->get_var("SELECT COUNT(*) FROM {$this->_new_table} WHERE QSG_system=1"); |
152 | - if (intval($exists)>0) { |
|
152 | + if (intval($exists) > 0) { |
|
153 | 153 | $this->_already_got_system_question_group_1 = true; |
154 | 154 | } |
155 | 155 | } |
@@ -2,58 +2,57 @@ |
||
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Goes through all the posts and pages, and converts old shortcodes to new ones |
5 | - |
|
6 | -*/ |
|
5 | + */ |
|
7 | 6 | |
8 | 7 | class EE_DMS_4_1_0_shortcodes extends EE_Data_Migration_Script_Stage |
9 | 8 | { |
10 | - public function __construct() |
|
11 | - { |
|
12 | - global $wpdb; |
|
13 | - $this->_pretty_name = __("Shortcodes", "event_espresso"); |
|
14 | - $this->_old_table = $wpdb->posts; |
|
15 | - parent::__construct(); |
|
16 | - } |
|
17 | - protected function _migrate_old_row($old_row) |
|
18 | - { |
|
19 | - $new_post_content = $this->_change_event_list_shortcode($old_row['post_content']); |
|
20 | - global $wpdb; |
|
21 | - $wpdb->query($wpdb->prepare("UPDATE ".$this->_old_table." SET post_content=%s WHERE ID=%d", $new_post_content, $old_row['ID'])); |
|
22 | - } |
|
9 | + public function __construct() |
|
10 | + { |
|
11 | + global $wpdb; |
|
12 | + $this->_pretty_name = __("Shortcodes", "event_espresso"); |
|
13 | + $this->_old_table = $wpdb->posts; |
|
14 | + parent::__construct(); |
|
15 | + } |
|
16 | + protected function _migrate_old_row($old_row) |
|
17 | + { |
|
18 | + $new_post_content = $this->_change_event_list_shortcode($old_row['post_content']); |
|
19 | + global $wpdb; |
|
20 | + $wpdb->query($wpdb->prepare("UPDATE ".$this->_old_table." SET post_content=%s WHERE ID=%d", $new_post_content, $old_row['ID'])); |
|
21 | + } |
|
23 | 22 | |
24 | - /** |
|
25 | - * replaces [EVENT_LIST... with [ESPRESSO_EVENTS...] |
|
26 | - * @param string $old_content |
|
27 | - */ |
|
28 | - private function _change_event_list_shortcode($old_content) |
|
29 | - { |
|
30 | - return str_replace("[EVENT_LIST", "[ESPRESSO_EVENTS", $old_content); |
|
31 | - } |
|
23 | + /** |
|
24 | + * replaces [EVENT_LIST... with [ESPRESSO_EVENTS...] |
|
25 | + * @param string $old_content |
|
26 | + */ |
|
27 | + private function _change_event_list_shortcode($old_content) |
|
28 | + { |
|
29 | + return str_replace("[EVENT_LIST", "[ESPRESSO_EVENTS", $old_content); |
|
30 | + } |
|
32 | 31 | |
33 | - public function _migration_step($num_items = 50) |
|
34 | - { |
|
35 | - global $wpdb; |
|
36 | - $start_at_record = $this->count_records_migrated(); |
|
37 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table {$this->_sql_to_only_select_non_drafts()} LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
38 | - $items_actually_migrated = 0; |
|
39 | - foreach ($rows as $old_row) { |
|
40 | - $this->_migrate_old_row($old_row); |
|
41 | - $items_actually_migrated++; |
|
42 | - } |
|
43 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
44 | - $this->set_completed(); |
|
45 | - } |
|
46 | - return $items_actually_migrated; |
|
47 | - } |
|
48 | - public function _count_records_to_migrate() |
|
49 | - { |
|
50 | - global $wpdb; |
|
51 | - $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table.$this->_sql_to_only_select_non_drafts()); |
|
52 | - return $count; |
|
53 | - } |
|
32 | + public function _migration_step($num_items = 50) |
|
33 | + { |
|
34 | + global $wpdb; |
|
35 | + $start_at_record = $this->count_records_migrated(); |
|
36 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table {$this->_sql_to_only_select_non_drafts()} LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
37 | + $items_actually_migrated = 0; |
|
38 | + foreach ($rows as $old_row) { |
|
39 | + $this->_migrate_old_row($old_row); |
|
40 | + $items_actually_migrated++; |
|
41 | + } |
|
42 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
43 | + $this->set_completed(); |
|
44 | + } |
|
45 | + return $items_actually_migrated; |
|
46 | + } |
|
47 | + public function _count_records_to_migrate() |
|
48 | + { |
|
49 | + global $wpdb; |
|
50 | + $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table.$this->_sql_to_only_select_non_drafts()); |
|
51 | + return $count; |
|
52 | + } |
|
54 | 53 | |
55 | - private function _sql_to_only_select_non_drafts() |
|
56 | - { |
|
57 | - return " WHERE post_type NOT IN ('revision','auto-draft') "; |
|
58 | - } |
|
54 | + private function _sql_to_only_select_non_drafts() |
|
55 | + { |
|
56 | + return " WHERE post_type NOT IN ('revision','auto-draft') "; |
|
57 | + } |
|
59 | 58 | } |
@@ -57,119 +57,119 @@ |
||
57 | 57 | */ |
58 | 58 | class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage |
59 | 59 | { |
60 | - private $_old_table; |
|
61 | - private $_new_table; |
|
62 | - private $_option_table; |
|
63 | - public function _migration_step($num_items = 50) |
|
64 | - { |
|
65 | - global $wpdb; |
|
66 | - $start_at_record = $this->count_records_migrated(); |
|
67 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
68 | - $items_actually_migrated = 0; |
|
69 | - foreach ($rows as $question_row) { |
|
70 | - $new_id = $this->_insert_new_question($question_row); |
|
71 | - $this->get_migration_script()->set_mapping($this->_old_table, $question_row['id'], $this->_new_table, $new_id); |
|
72 | - $items_actually_migrated++; |
|
73 | - } |
|
74 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
75 | - $this->set_completed(); |
|
76 | - } |
|
77 | - return $items_actually_migrated; |
|
78 | - } |
|
79 | - public function _count_records_to_migrate() |
|
80 | - { |
|
81 | - global $wpdb; |
|
82 | - $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
83 | - return $count; |
|
84 | - } |
|
85 | - public function __construct() |
|
86 | - { |
|
87 | - global $wpdb; |
|
88 | - $this->_pretty_name = __("Questions", "event_espresso"); |
|
89 | - $this->_old_table = $wpdb->prefix."events_question"; |
|
90 | - $this->_new_table = $wpdb->prefix."esp_question"; |
|
91 | - $this->_option_table = $wpdb->prefix."esp_question_option"; |
|
92 | - parent::__construct(); |
|
93 | - } |
|
94 | - private function _insert_new_question($old_question) |
|
95 | - { |
|
96 | - global $wpdb; |
|
97 | - // if this pretends to be a 'system' question, check if we already have a |
|
98 | - // system question for that string. If so, pretend THAT new question |
|
99 | - // is what we just isnerted |
|
100 | - if ($old_question['system_name']) { |
|
101 | - $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s", $old_question['system_name']))); |
|
102 | - if ($id_of_new_system_question) { |
|
103 | - return $id_of_new_system_question; |
|
104 | - } |
|
105 | - // ok so this must be the first one. Carry on. |
|
106 | - } |
|
60 | + private $_old_table; |
|
61 | + private $_new_table; |
|
62 | + private $_option_table; |
|
63 | + public function _migration_step($num_items = 50) |
|
64 | + { |
|
65 | + global $wpdb; |
|
66 | + $start_at_record = $this->count_records_migrated(); |
|
67 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
68 | + $items_actually_migrated = 0; |
|
69 | + foreach ($rows as $question_row) { |
|
70 | + $new_id = $this->_insert_new_question($question_row); |
|
71 | + $this->get_migration_script()->set_mapping($this->_old_table, $question_row['id'], $this->_new_table, $new_id); |
|
72 | + $items_actually_migrated++; |
|
73 | + } |
|
74 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
75 | + $this->set_completed(); |
|
76 | + } |
|
77 | + return $items_actually_migrated; |
|
78 | + } |
|
79 | + public function _count_records_to_migrate() |
|
80 | + { |
|
81 | + global $wpdb; |
|
82 | + $count = $wpdb->get_var("SELECT COUNT(id) FROM ".$this->_old_table); |
|
83 | + return $count; |
|
84 | + } |
|
85 | + public function __construct() |
|
86 | + { |
|
87 | + global $wpdb; |
|
88 | + $this->_pretty_name = __("Questions", "event_espresso"); |
|
89 | + $this->_old_table = $wpdb->prefix."events_question"; |
|
90 | + $this->_new_table = $wpdb->prefix."esp_question"; |
|
91 | + $this->_option_table = $wpdb->prefix."esp_question_option"; |
|
92 | + parent::__construct(); |
|
93 | + } |
|
94 | + private function _insert_new_question($old_question) |
|
95 | + { |
|
96 | + global $wpdb; |
|
97 | + // if this pretends to be a 'system' question, check if we already have a |
|
98 | + // system question for that string. If so, pretend THAT new question |
|
99 | + // is what we just isnerted |
|
100 | + if ($old_question['system_name']) { |
|
101 | + $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s", $old_question['system_name']))); |
|
102 | + if ($id_of_new_system_question) { |
|
103 | + return $id_of_new_system_question; |
|
104 | + } |
|
105 | + // ok so this must be the first one. Carry on. |
|
106 | + } |
|
107 | 107 | |
108 | - $cols_n_values = array( |
|
109 | - 'QST_display_text'=>stripslashes($old_question['question']), |
|
110 | - 'QST_admin_label'=> $old_question['system_name'] ? $old_question['system_name'] : sanitize_title($old_question['question']), |
|
111 | - 'QST_system'=>$old_question['system_name'], |
|
112 | - 'QST_type'=>$old_question['question_type'], |
|
113 | - 'QST_required'=> 'Y' == $old_question['required'], |
|
114 | - 'QST_required_text'=>stripslashes($old_question['required_text']), |
|
115 | - 'QST_order'=>$old_question['sequence'], |
|
116 | - 'QST_admin_only'=> 'Y' == $old_question['admin_only'], |
|
117 | - 'QST_wp_user'=>$old_question['wp_user'], |
|
118 | - 'QST_deleted'=>false |
|
119 | - ); |
|
120 | - $datatypes = array( |
|
121 | - '%s',// QST_display_text |
|
122 | - '%s',// QST-admin_label |
|
123 | - '%s',// QST_system |
|
124 | - '%s',// QST_type |
|
125 | - '%d',// QST_required |
|
126 | - '%s',// QST_required_text |
|
127 | - '%d',// QST_order |
|
128 | - '%d',// QST_admin_only |
|
129 | - '%d',// QST_wp_user |
|
130 | - '%d',// QST_deleted |
|
131 | - ); |
|
132 | - $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
133 | - if (! $success) { |
|
134 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes)); |
|
135 | - return 0; |
|
136 | - } |
|
137 | - $new_id = $wpdb->insert_id; |
|
138 | - // now take care of posisbly adding question options |
|
139 | - if (in_array($old_question['question_type'], array('DROPDOWN','SINGLE','MULTIPLE'))) { |
|
140 | - $options = explode(",", $old_question['response']); |
|
141 | - foreach ($options as $option) { |
|
142 | - $this->_insert_question_option($option, $new_id); |
|
143 | - } |
|
144 | - } |
|
145 | - return $new_id; |
|
146 | - } |
|
147 | - /** |
|
148 | - * Adds a question option to the db |
|
149 | - * @global type $wpdb |
|
150 | - * @param string $option |
|
151 | - * @param int $question_id |
|
152 | - * @return int |
|
153 | - */ |
|
154 | - private function _insert_question_option($option, $question_id) |
|
155 | - { |
|
156 | - $option = trim($option); |
|
157 | - global $wpdb; |
|
158 | - $cols_n_values = array( |
|
159 | - 'QST_ID'=>$question_id, |
|
160 | - 'QSO_value'=>$option, |
|
161 | - 'QSO_deleted'=>false |
|
162 | - ); |
|
163 | - $datatypes= array( |
|
164 | - '%d',// QST_ID |
|
165 | - '%s',// QSO_value |
|
166 | - '%d',// QSO_deleted |
|
167 | - ); |
|
168 | - $success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes); |
|
169 | - if (! $success) { |
|
170 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
171 | - return 0; |
|
172 | - } |
|
173 | - return $wpdb->insert_id; |
|
174 | - } |
|
108 | + $cols_n_values = array( |
|
109 | + 'QST_display_text'=>stripslashes($old_question['question']), |
|
110 | + 'QST_admin_label'=> $old_question['system_name'] ? $old_question['system_name'] : sanitize_title($old_question['question']), |
|
111 | + 'QST_system'=>$old_question['system_name'], |
|
112 | + 'QST_type'=>$old_question['question_type'], |
|
113 | + 'QST_required'=> 'Y' == $old_question['required'], |
|
114 | + 'QST_required_text'=>stripslashes($old_question['required_text']), |
|
115 | + 'QST_order'=>$old_question['sequence'], |
|
116 | + 'QST_admin_only'=> 'Y' == $old_question['admin_only'], |
|
117 | + 'QST_wp_user'=>$old_question['wp_user'], |
|
118 | + 'QST_deleted'=>false |
|
119 | + ); |
|
120 | + $datatypes = array( |
|
121 | + '%s',// QST_display_text |
|
122 | + '%s',// QST-admin_label |
|
123 | + '%s',// QST_system |
|
124 | + '%s',// QST_type |
|
125 | + '%d',// QST_required |
|
126 | + '%s',// QST_required_text |
|
127 | + '%d',// QST_order |
|
128 | + '%d',// QST_admin_only |
|
129 | + '%d',// QST_wp_user |
|
130 | + '%d',// QST_deleted |
|
131 | + ); |
|
132 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
133 | + if (! $success) { |
|
134 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes)); |
|
135 | + return 0; |
|
136 | + } |
|
137 | + $new_id = $wpdb->insert_id; |
|
138 | + // now take care of posisbly adding question options |
|
139 | + if (in_array($old_question['question_type'], array('DROPDOWN','SINGLE','MULTIPLE'))) { |
|
140 | + $options = explode(",", $old_question['response']); |
|
141 | + foreach ($options as $option) { |
|
142 | + $this->_insert_question_option($option, $new_id); |
|
143 | + } |
|
144 | + } |
|
145 | + return $new_id; |
|
146 | + } |
|
147 | + /** |
|
148 | + * Adds a question option to the db |
|
149 | + * @global type $wpdb |
|
150 | + * @param string $option |
|
151 | + * @param int $question_id |
|
152 | + * @return int |
|
153 | + */ |
|
154 | + private function _insert_question_option($option, $question_id) |
|
155 | + { |
|
156 | + $option = trim($option); |
|
157 | + global $wpdb; |
|
158 | + $cols_n_values = array( |
|
159 | + 'QST_ID'=>$question_id, |
|
160 | + 'QSO_value'=>$option, |
|
161 | + 'QSO_deleted'=>false |
|
162 | + ); |
|
163 | + $datatypes= array( |
|
164 | + '%d',// QST_ID |
|
165 | + '%s',// QSO_value |
|
166 | + '%d',// QSO_deleted |
|
167 | + ); |
|
168 | + $success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes); |
|
169 | + if (! $success) { |
|
170 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
171 | + return 0; |
|
172 | + } |
|
173 | + return $wpdb->insert_id; |
|
174 | + } |
|
175 | 175 | } |
@@ -118,25 +118,25 @@ discard block |
||
118 | 118 | 'QST_deleted'=>false |
119 | 119 | ); |
120 | 120 | $datatypes = array( |
121 | - '%s',// QST_display_text |
|
122 | - '%s',// QST-admin_label |
|
123 | - '%s',// QST_system |
|
124 | - '%s',// QST_type |
|
125 | - '%d',// QST_required |
|
126 | - '%s',// QST_required_text |
|
127 | - '%d',// QST_order |
|
128 | - '%d',// QST_admin_only |
|
129 | - '%d',// QST_wp_user |
|
130 | - '%d',// QST_deleted |
|
121 | + '%s', // QST_display_text |
|
122 | + '%s', // QST-admin_label |
|
123 | + '%s', // QST_system |
|
124 | + '%s', // QST_type |
|
125 | + '%d', // QST_required |
|
126 | + '%s', // QST_required_text |
|
127 | + '%d', // QST_order |
|
128 | + '%d', // QST_admin_only |
|
129 | + '%d', // QST_wp_user |
|
130 | + '%d', // QST_deleted |
|
131 | 131 | ); |
132 | 132 | $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
133 | - if (! $success) { |
|
133 | + if ( ! $success) { |
|
134 | 134 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes)); |
135 | 135 | return 0; |
136 | 136 | } |
137 | 137 | $new_id = $wpdb->insert_id; |
138 | 138 | // now take care of posisbly adding question options |
139 | - if (in_array($old_question['question_type'], array('DROPDOWN','SINGLE','MULTIPLE'))) { |
|
139 | + if (in_array($old_question['question_type'], array('DROPDOWN', 'SINGLE', 'MULTIPLE'))) { |
|
140 | 140 | $options = explode(",", $old_question['response']); |
141 | 141 | foreach ($options as $option) { |
142 | 142 | $this->_insert_question_option($option, $new_id); |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | 'QSO_value'=>$option, |
161 | 161 | 'QSO_deleted'=>false |
162 | 162 | ); |
163 | - $datatypes= array( |
|
164 | - '%d',// QST_ID |
|
165 | - '%s',// QSO_value |
|
166 | - '%d',// QSO_deleted |
|
163 | + $datatypes = array( |
|
164 | + '%d', // QST_ID |
|
165 | + '%s', // QSO_value |
|
166 | + '%d', // QSO_deleted |
|
167 | 167 | ); |
168 | 168 | $success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes); |
169 | - if (! $success) { |
|
170 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
169 | + if ( ! $success) { |
|
170 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option, 'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
171 | 171 | return 0; |
172 | 172 | } |
173 | 173 | return $wpdb->insert_id; |
@@ -11,77 +11,77 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table |
13 | 13 | { |
14 | - public function __construct() |
|
15 | - { |
|
16 | - global $wpdb; |
|
17 | - $this->_old_table = $wpdb->prefix . 'esp_line_item'; |
|
18 | - $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"'; |
|
19 | - $this->_pretty_name = __('Event Sub-total line items', 'event_espresso'); |
|
20 | - parent::__construct(); |
|
21 | - } |
|
22 | - protected function _migrate_old_row($line_item_row) |
|
23 | - { |
|
24 | - global $wpdb; |
|
25 | - // what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID |
|
26 | - $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
27 | - $new_line_item_data = array( |
|
28 | - 'LIN_code' => 'event-' . $event_id, |
|
29 | - 'TXN_ID' => $line_item_row['TXN_ID'], |
|
30 | - 'LIN_name' => __('Event', 'event_espresso'), |
|
31 | - 'LIN_desc' => $line_item_row['LIN_desc'], |
|
32 | - 'LIN_unit_price' => $line_item_row['LIN_unit_price'], |
|
33 | - 'LIN_percent' => $line_item_row['LIN_percent'], |
|
34 | - 'LIN_is_taxable' => $line_item_row['LIN_is_taxable'], |
|
35 | - 'LIN_order' => $line_item_row['LIN_order'], |
|
36 | - 'LIN_total' => $line_item_row['LIN_total'], |
|
37 | - 'LIN_quantity' => $line_item_row['LIN_quantity'], |
|
38 | - 'LIN_parent' => $line_item_row['LIN_ID'], |
|
39 | - 'LIN_type' => 'sub-total', |
|
40 | - 'OBJ_type' => 'Event', |
|
41 | - 'OBJ_ID' => $event_id, |
|
42 | - ); |
|
43 | - $new_line_item_datatypes = array( |
|
44 | - '%s',// LIN_code |
|
45 | - '%d',// TXN_ID |
|
46 | - '%s',// LIN_name |
|
47 | - '%s',// LIN_desc |
|
48 | - '%f',// LIN_unit_price |
|
49 | - '%f',// LIN_percent |
|
50 | - '%d',// LIN_is_taxable |
|
51 | - '%d',// LIN_order |
|
52 | - '%f',// LIN_total |
|
53 | - '%d',// LIN_quantity |
|
54 | - '%d',// LIN_parent |
|
55 | - '%s',// LIN_type |
|
56 | - '%s',// OBJ_type |
|
57 | - '%d',// OBJ_ID |
|
58 | - ); |
|
59 | - // insert the new event subtotal line item, pointing to this line item |
|
60 | - $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes); |
|
61 | - if (! $success) { |
|
62 | - $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes)); |
|
63 | - } |
|
64 | - $new_line_item_id = $wpdb->insert_id; |
|
65 | - $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id); |
|
66 | - $query = $wpdb->prepare( |
|
67 | - "UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100", |
|
68 | - $new_line_item_id, |
|
69 | - $line_item_row['LIN_ID'], |
|
70 | - $new_line_item_id |
|
71 | - ); |
|
72 | - $success = $wpdb->query($query); |
|
73 | - if ($success === false) { |
|
74 | - $this->add_error( |
|
75 | - sprintf( |
|
76 | - __('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'), |
|
77 | - $new_line_item_id, |
|
78 | - $line_item_row['LIN_ID'], |
|
79 | - $wpdb->last_error, |
|
80 | - $query, |
|
81 | - $success |
|
82 | - ) |
|
83 | - ); |
|
84 | - } |
|
85 | - return 1; |
|
86 | - } |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + global $wpdb; |
|
17 | + $this->_old_table = $wpdb->prefix . 'esp_line_item'; |
|
18 | + $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"'; |
|
19 | + $this->_pretty_name = __('Event Sub-total line items', 'event_espresso'); |
|
20 | + parent::__construct(); |
|
21 | + } |
|
22 | + protected function _migrate_old_row($line_item_row) |
|
23 | + { |
|
24 | + global $wpdb; |
|
25 | + // what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID |
|
26 | + $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
27 | + $new_line_item_data = array( |
|
28 | + 'LIN_code' => 'event-' . $event_id, |
|
29 | + 'TXN_ID' => $line_item_row['TXN_ID'], |
|
30 | + 'LIN_name' => __('Event', 'event_espresso'), |
|
31 | + 'LIN_desc' => $line_item_row['LIN_desc'], |
|
32 | + 'LIN_unit_price' => $line_item_row['LIN_unit_price'], |
|
33 | + 'LIN_percent' => $line_item_row['LIN_percent'], |
|
34 | + 'LIN_is_taxable' => $line_item_row['LIN_is_taxable'], |
|
35 | + 'LIN_order' => $line_item_row['LIN_order'], |
|
36 | + 'LIN_total' => $line_item_row['LIN_total'], |
|
37 | + 'LIN_quantity' => $line_item_row['LIN_quantity'], |
|
38 | + 'LIN_parent' => $line_item_row['LIN_ID'], |
|
39 | + 'LIN_type' => 'sub-total', |
|
40 | + 'OBJ_type' => 'Event', |
|
41 | + 'OBJ_ID' => $event_id, |
|
42 | + ); |
|
43 | + $new_line_item_datatypes = array( |
|
44 | + '%s',// LIN_code |
|
45 | + '%d',// TXN_ID |
|
46 | + '%s',// LIN_name |
|
47 | + '%s',// LIN_desc |
|
48 | + '%f',// LIN_unit_price |
|
49 | + '%f',// LIN_percent |
|
50 | + '%d',// LIN_is_taxable |
|
51 | + '%d',// LIN_order |
|
52 | + '%f',// LIN_total |
|
53 | + '%d',// LIN_quantity |
|
54 | + '%d',// LIN_parent |
|
55 | + '%s',// LIN_type |
|
56 | + '%s',// OBJ_type |
|
57 | + '%d',// OBJ_ID |
|
58 | + ); |
|
59 | + // insert the new event subtotal line item, pointing to this line item |
|
60 | + $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes); |
|
61 | + if (! $success) { |
|
62 | + $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes)); |
|
63 | + } |
|
64 | + $new_line_item_id = $wpdb->insert_id; |
|
65 | + $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id); |
|
66 | + $query = $wpdb->prepare( |
|
67 | + "UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100", |
|
68 | + $new_line_item_id, |
|
69 | + $line_item_row['LIN_ID'], |
|
70 | + $new_line_item_id |
|
71 | + ); |
|
72 | + $success = $wpdb->query($query); |
|
73 | + if ($success === false) { |
|
74 | + $this->add_error( |
|
75 | + sprintf( |
|
76 | + __('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'), |
|
77 | + $new_line_item_id, |
|
78 | + $line_item_row['LIN_ID'], |
|
79 | + $wpdb->last_error, |
|
80 | + $query, |
|
81 | + $success |
|
82 | + ) |
|
83 | + ); |
|
84 | + } |
|
85 | + return 1; |
|
86 | + } |
|
87 | 87 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function __construct() |
15 | 15 | { |
16 | 16 | global $wpdb; |
17 | - $this->_old_table = $wpdb->prefix . 'esp_line_item'; |
|
17 | + $this->_old_table = $wpdb->prefix.'esp_line_item'; |
|
18 | 18 | $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"'; |
19 | 19 | $this->_pretty_name = __('Event Sub-total line items', 'event_espresso'); |
20 | 20 | parent::__construct(); |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | { |
24 | 24 | global $wpdb; |
25 | 25 | // what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID |
26 | - $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
26 | + $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM '.$wpdb->prefix.'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
27 | 27 | $new_line_item_data = array( |
28 | - 'LIN_code' => 'event-' . $event_id, |
|
28 | + 'LIN_code' => 'event-'.$event_id, |
|
29 | 29 | 'TXN_ID' => $line_item_row['TXN_ID'], |
30 | 30 | 'LIN_name' => __('Event', 'event_espresso'), |
31 | 31 | 'LIN_desc' => $line_item_row['LIN_desc'], |
@@ -41,24 +41,24 @@ discard block |
||
41 | 41 | 'OBJ_ID' => $event_id, |
42 | 42 | ); |
43 | 43 | $new_line_item_datatypes = array( |
44 | - '%s',// LIN_code |
|
45 | - '%d',// TXN_ID |
|
46 | - '%s',// LIN_name |
|
47 | - '%s',// LIN_desc |
|
48 | - '%f',// LIN_unit_price |
|
49 | - '%f',// LIN_percent |
|
50 | - '%d',// LIN_is_taxable |
|
51 | - '%d',// LIN_order |
|
52 | - '%f',// LIN_total |
|
53 | - '%d',// LIN_quantity |
|
54 | - '%d',// LIN_parent |
|
55 | - '%s',// LIN_type |
|
56 | - '%s',// OBJ_type |
|
57 | - '%d',// OBJ_ID |
|
44 | + '%s', // LIN_code |
|
45 | + '%d', // TXN_ID |
|
46 | + '%s', // LIN_name |
|
47 | + '%s', // LIN_desc |
|
48 | + '%f', // LIN_unit_price |
|
49 | + '%f', // LIN_percent |
|
50 | + '%d', // LIN_is_taxable |
|
51 | + '%d', // LIN_order |
|
52 | + '%f', // LIN_total |
|
53 | + '%d', // LIN_quantity |
|
54 | + '%d', // LIN_parent |
|
55 | + '%s', // LIN_type |
|
56 | + '%s', // OBJ_type |
|
57 | + '%d', // OBJ_ID |
|
58 | 58 | ); |
59 | 59 | // insert the new event subtotal line item, pointing to this line item |
60 | 60 | $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes); |
61 | - if (! $success) { |
|
61 | + if ( ! $success) { |
|
62 | 62 | $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes)); |
63 | 63 | } |
64 | 64 | $new_line_item_id = $wpdb->insert_id; |