@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | //unfortunately, this needs to be done upon INCLUSION of this file, |
12 | 12 | //instead of construction, because it only gets constructed on first page load |
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
|
14 | +$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*'); |
|
15 | 15 | $class_to_filepath = array(); |
16 | 16 | foreach ($stages as $filepath) { |
17 | 17 | $matches = array(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } elseif ( ! $version_string) { |
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | 78 | } else { |
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function schema_changes_before_migration() |
100 | 100 | { |
101 | 101 | //relies on 4.1's EEH_Activation::create_table |
102 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
102 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
103 | 103 | $table_name = 'esp_answer'; |
104 | 104 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
105 | 105 | REG_ID INT UNSIGNED NOT NULL, |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | public function add_default_admin_only_payments() |
547 | 547 | { |
548 | 548 | global $wpdb; |
549 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
549 | + $table_name = $wpdb->prefix."esp_payment_method"; |
|
550 | 550 | $user_id = EEH_Activation::get_default_creator_id(); |
551 | 551 | if ($this->_get_table_analysis()->tableExists($table_name)) { |
552 | 552 | $SQL = "SELECT COUNT( * ) FROM $table_name"; |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | $table_name, |
586 | 586 | $values, |
587 | 587 | array( |
588 | - '%s',//PMD_type |
|
589 | - '%s',//PMD_name |
|
590 | - '%s',//PMD_admin_name |
|
591 | - '%s',//PMD_admin_desc |
|
592 | - '%s',//PMD_slug |
|
593 | - '%d',//PMD_wp_user |
|
594 | - '%s',//PMD_scope |
|
588 | + '%s', //PMD_type |
|
589 | + '%s', //PMD_name |
|
590 | + '%s', //PMD_admin_name |
|
591 | + '%s', //PMD_admin_desc |
|
592 | + '%s', //PMD_slug |
|
593 | + '%d', //PMD_wp_user |
|
594 | + '%s', //PMD_scope |
|
595 | 595 | ) |
596 | 596 | ); |
597 | 597 | if ( ! $success) { |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | public function insert_default_currencies() |
615 | 615 | { |
616 | 616 | global $wpdb; |
617 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
617 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
618 | 618 | if ($this->_get_table_analysis()->tableExists($currency_table)) { |
619 | 619 | $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
620 | 620 | $countries = $wpdb->get_var($SQL); |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | 16 | foreach ($stages as $filepath) { |
17 | - $matches = array(); |
|
18 | - preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | - $class_to_filepath[$matches[1]] = $filepath; |
|
17 | + $matches = array(); |
|
18 | + preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | + $class_to_filepath[$matches[1]] = $filepath; |
|
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | 22 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
@@ -35,69 +35,69 @@ discard block |
||
35 | 35 | class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base |
36 | 36 | { |
37 | 37 | |
38 | - /** |
|
39 | - * return EE_DMS_Core_4_6_0 |
|
40 | - * |
|
41 | - * @param TableManager $table_manager |
|
42 | - * @param TableAnalysis $table_analysis |
|
43 | - */ |
|
44 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
45 | - { |
|
46 | - $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso"); |
|
47 | - $this->_priority = 10; |
|
48 | - $this->_migration_stages = array( |
|
49 | - new EE_DMS_4_6_0_gateways(), |
|
50 | - new EE_DMS_4_6_0_question_types(), |
|
51 | - new EE_DMS_4_6_0_country_system_question(), |
|
52 | - new EE_DMS_4_6_0_state_system_question(), |
|
53 | - new EE_DMS_4_6_0_billing_info(), |
|
54 | - new EE_DMS_4_6_0_transactions(), |
|
55 | - new EE_DMS_4_6_0_payments(), |
|
56 | - new EE_DMS_4_6_0_invoice_settings(), |
|
57 | - ); |
|
58 | - parent::__construct($table_manager, $table_analysis); |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * @param array $version_array |
|
65 | - * @return bool |
|
66 | - */ |
|
67 | - public function can_migrate_from_version($version_array) |
|
68 | - { |
|
69 | - $version_string = $version_array['Core']; |
|
70 | - if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) { |
|
38 | + /** |
|
39 | + * return EE_DMS_Core_4_6_0 |
|
40 | + * |
|
41 | + * @param TableManager $table_manager |
|
42 | + * @param TableAnalysis $table_analysis |
|
43 | + */ |
|
44 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
45 | + { |
|
46 | + $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso"); |
|
47 | + $this->_priority = 10; |
|
48 | + $this->_migration_stages = array( |
|
49 | + new EE_DMS_4_6_0_gateways(), |
|
50 | + new EE_DMS_4_6_0_question_types(), |
|
51 | + new EE_DMS_4_6_0_country_system_question(), |
|
52 | + new EE_DMS_4_6_0_state_system_question(), |
|
53 | + new EE_DMS_4_6_0_billing_info(), |
|
54 | + new EE_DMS_4_6_0_transactions(), |
|
55 | + new EE_DMS_4_6_0_payments(), |
|
56 | + new EE_DMS_4_6_0_invoice_settings(), |
|
57 | + ); |
|
58 | + parent::__construct($table_manager, $table_analysis); |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * @param array $version_array |
|
65 | + * @return bool |
|
66 | + */ |
|
67 | + public function can_migrate_from_version($version_array) |
|
68 | + { |
|
69 | + $version_string = $version_array['Core']; |
|
70 | + if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) { |
|
71 | 71 | // echo "$version_string can be migrated from"; |
72 | - return true; |
|
73 | - } elseif ( ! $version_string) { |
|
72 | + return true; |
|
73 | + } elseif ( ! $version_string) { |
|
74 | 74 | // echo "no version string provided: $version_string"; |
75 | - //no version string provided... this must be pre 4.3 |
|
76 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | - } else { |
|
75 | + //no version string provided... this must be pre 4.3 |
|
76 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | + } else { |
|
78 | 78 | // echo "$version_string doesnt apply"; |
79 | - return false; |
|
80 | - } |
|
81 | - } |
|
79 | + return false; |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * @return bool |
|
87 | - */ |
|
88 | - public function schema_changes_before_migration() |
|
89 | - { |
|
90 | - //relies on 4.1's EEH_Activation::create_table |
|
91 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | - $table_name = 'esp_answer'; |
|
93 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
85 | + /** |
|
86 | + * @return bool |
|
87 | + */ |
|
88 | + public function schema_changes_before_migration() |
|
89 | + { |
|
90 | + //relies on 4.1's EEH_Activation::create_table |
|
91 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | + $table_name = 'esp_answer'; |
|
93 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | 94 | REG_ID INT UNSIGNED NOT NULL, |
95 | 95 | QST_ID INT UNSIGNED NOT NULL, |
96 | 96 | ANS_value TEXT NOT NULL, |
97 | 97 | PRIMARY KEY (ANS_ID)"; |
98 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
99 | - $table_name = 'esp_attendee_meta'; |
|
100 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
98 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
99 | + $table_name = 'esp_attendee_meta'; |
|
100 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
101 | 101 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
102 | 102 | ATT_fname VARCHAR(45) NOT NULL, |
103 | 103 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | KEY ATT_fname (ATT_fname), |
114 | 114 | KEY ATT_lname (ATT_lname), |
115 | 115 | KEY ATT_email (ATT_email)"; |
116 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
117 | - $table_name = 'esp_country'; |
|
118 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
116 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
117 | + $table_name = 'esp_country'; |
|
118 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
119 | 119 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
120 | 120 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
121 | 121 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | CNT_is_EU TINYINT(1) DEFAULT '0', |
132 | 132 | CNT_active TINYINT(1) DEFAULT '0', |
133 | 133 | PRIMARY KEY (CNT_ISO)"; |
134 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
135 | - $table_name = 'esp_currency'; |
|
136 | - $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
134 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
135 | + $table_name = 'esp_currency'; |
|
136 | + $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
137 | 137 | CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar', |
138 | 138 | CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars', |
139 | 139 | CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$', |
140 | 140 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
141 | 141 | CUR_active TINYINT(1) DEFAULT '0', |
142 | 142 | PRIMARY KEY (CUR_code)"; |
143 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | - $table_name = 'esp_currency_payment_method'; |
|
145 | - $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
143 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | + $table_name = 'esp_currency_payment_method'; |
|
145 | + $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
146 | 146 | CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
147 | 147 | PMD_ID INT(11) NOT NULL, |
148 | 148 | PRIMARY KEY (CPM_ID)"; |
149 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
150 | - $table_name = 'esp_datetime'; |
|
151 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
149 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
150 | + $table_name = 'esp_datetime'; |
|
151 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
152 | 152 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
153 | 153 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
154 | 154 | DTT_description TEXT NOT NULL, |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | PRIMARY KEY (DTT_ID), |
164 | 164 | KEY EVT_ID (EVT_ID), |
165 | 165 | KEY DTT_is_primary (DTT_is_primary)"; |
166 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | - $table_name = 'esp_event_meta'; |
|
168 | - $sql = " |
|
166 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | + $table_name = 'esp_event_meta'; |
|
168 | + $sql = " |
|
169 | 169 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
170 | 170 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
171 | 171 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -180,31 +180,31 @@ discard block |
||
180 | 180 | EVT_external_URL VARCHAR(200) NULL, |
181 | 181 | EVT_donations TINYINT(1) NULL, |
182 | 182 | PRIMARY KEY (EVTM_ID)"; |
183 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | - $table_name = 'esp_event_question_group'; |
|
185 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
183 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | + $table_name = 'esp_event_question_group'; |
|
185 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
186 | 186 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
187 | 187 | QSG_ID INT UNSIGNED NOT NULL, |
188 | 188 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
189 | 189 | PRIMARY KEY (EQG_ID)"; |
190 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | - $table_name = 'esp_event_venue'; |
|
192 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
190 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | + $table_name = 'esp_event_venue'; |
|
192 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
193 | 193 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
194 | 194 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
195 | 195 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
196 | 196 | PRIMARY KEY (EVV_ID)"; |
197 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | - $table_name = 'esp_extra_meta'; |
|
199 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
197 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | + $table_name = 'esp_extra_meta'; |
|
199 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
200 | 200 | OBJ_ID INT(11) DEFAULT NULL, |
201 | 201 | EXM_type VARCHAR(45) DEFAULT NULL, |
202 | 202 | EXM_key VARCHAR(45) DEFAULT NULL, |
203 | 203 | EXM_value TEXT, |
204 | 204 | PRIMARY KEY (EXM_ID)"; |
205 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
206 | - $table_name = 'esp_line_item'; |
|
207 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
205 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
206 | + $table_name = 'esp_line_item'; |
|
207 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
208 | 208 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
209 | 209 | TXN_ID INT(11) DEFAULT NULL, |
210 | 210 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | OBJ_ID INT(11) DEFAULT NULL, |
221 | 221 | OBJ_type VARCHAR(45)DEFAULT NULL, |
222 | 222 | PRIMARY KEY (LIN_ID)"; |
223 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | - $table_name = 'esp_log'; |
|
225 | - $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
223 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | + $table_name = 'esp_log'; |
|
225 | + $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
226 | 226 | LOG_time DATETIME DEFAULT NULL, |
227 | 227 | OBJ_ID VARCHAR(45) DEFAULT NULL, |
228 | 228 | OBJ_type VARCHAR(45) DEFAULT NULL, |
@@ -230,19 +230,19 @@ discard block |
||
230 | 230 | LOG_message TEXT, |
231 | 231 | LOG_wp_user INT(11) DEFAULT NULL, |
232 | 232 | PRIMARY KEY (LOG_ID)"; |
233 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | - $table_name = 'esp_message_template'; |
|
235 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
233 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | + $table_name = 'esp_message_template'; |
|
235 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
236 | 236 | GRP_ID INT(10) UNSIGNED NOT NULL, |
237 | 237 | MTP_context VARCHAR(50) NOT NULL, |
238 | 238 | MTP_template_field VARCHAR(30) NOT NULL, |
239 | 239 | MTP_content TEXT NOT NULL, |
240 | 240 | PRIMARY KEY (MTP_ID), |
241 | 241 | KEY GRP_ID (GRP_ID)"; |
242 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
243 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
244 | - $table_name = 'esp_message_template_group'; |
|
245 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
242 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
243 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
244 | + $table_name = 'esp_message_template_group'; |
|
245 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
246 | 246 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
247 | 247 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
248 | 248 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
255 | 255 | PRIMARY KEY (GRP_ID), |
256 | 256 | KEY MTP_user_id (MTP_user_id)"; |
257 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | - $table_name = 'esp_event_message_template'; |
|
259 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
257 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | + $table_name = 'esp_event_message_template'; |
|
259 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
260 | 260 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
261 | 261 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
262 | 262 | PRIMARY KEY (EMT_ID), |
263 | 263 | KEY EVT_ID (EVT_ID), |
264 | 264 | KEY GRP_ID (GRP_ID)"; |
265 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
266 | - $table_name = 'esp_payment'; |
|
267 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
265 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
266 | + $table_name = 'esp_payment'; |
|
267 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
268 | 268 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
269 | 269 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
270 | 270 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | PRIMARY KEY (PAY_ID), |
282 | 282 | KEY TXN_ID (TXN_ID), |
283 | 283 | KEY PAY_timestamp (PAY_timestamp)"; |
284 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
285 | - $table_name = 'esp_payment_method'; |
|
286 | - $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
285 | + $table_name = 'esp_payment_method'; |
|
286 | + $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
287 | 287 | PMD_type VARCHAR(124) DEFAULT NULL, |
288 | 288 | PMD_name VARCHAR(255) DEFAULT NULL, |
289 | 289 | PMD_desc TEXT, |
@@ -298,28 +298,28 @@ discard block |
||
298 | 298 | PMD_scope VARCHAR(255) NULL DEFAULT 'frontend', |
299 | 299 | PRIMARY KEY (PMD_ID), |
300 | 300 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)"; |
301 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
302 | - $table_name = "esp_ticket_price"; |
|
303 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
301 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
302 | + $table_name = "esp_ticket_price"; |
|
303 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
304 | 304 | TKT_ID INT(10) UNSIGNED NOT NULL, |
305 | 305 | PRC_ID INT(10) UNSIGNED NOT NULL, |
306 | 306 | PRIMARY KEY (TKP_ID)"; |
307 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
308 | - $table_name = "esp_datetime_ticket"; |
|
309 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
307 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
308 | + $table_name = "esp_datetime_ticket"; |
|
309 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
310 | 310 | DTT_ID INT(10) UNSIGNED NOT NULL, |
311 | 311 | TKT_ID INT(10) UNSIGNED NOT NULL, |
312 | 312 | PRIMARY KEY (DTK_ID)"; |
313 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
314 | - $table_name = "esp_ticket_template"; |
|
315 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
313 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
314 | + $table_name = "esp_ticket_template"; |
|
315 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
316 | 316 | TTM_name VARCHAR(45) NOT NULL, |
317 | 317 | TTM_description TEXT, |
318 | 318 | TTM_file VARCHAR(45), |
319 | 319 | PRIMARY KEY (TTM_ID)"; |
320 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | - $table_name = 'esp_question'; |
|
322 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
320 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | + $table_name = 'esp_question'; |
|
322 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
323 | 323 | QST_display_text TEXT NOT NULL, |
324 | 324 | QST_admin_label VARCHAR(255) NOT NULL, |
325 | 325 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -331,25 +331,25 @@ discard block |
||
331 | 331 | QST_wp_user BIGINT UNSIGNED NULL, |
332 | 332 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
333 | 333 | PRIMARY KEY (QST_ID)'; |
334 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | - $table_name = 'esp_question_group_question'; |
|
336 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
334 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | + $table_name = 'esp_question_group_question'; |
|
336 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
337 | 337 | QSG_ID INT UNSIGNED NOT NULL, |
338 | 338 | QST_ID INT UNSIGNED NOT NULL, |
339 | 339 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
340 | 340 | PRIMARY KEY (QGQ_ID) "; |
341 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | - $table_name = 'esp_question_option'; |
|
343 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
341 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | + $table_name = 'esp_question_option'; |
|
343 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
344 | 344 | QSO_value VARCHAR(255) NOT NULL, |
345 | 345 | QSO_desc TEXT NOT NULL, |
346 | 346 | QST_ID INT UNSIGNED NOT NULL, |
347 | 347 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
348 | 348 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
349 | 349 | PRIMARY KEY (QSO_ID)"; |
350 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | - $table_name = 'esp_registration'; |
|
352 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
350 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | + $table_name = 'esp_registration'; |
|
352 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
353 | 353 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
354 | 354 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
355 | 355 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -372,25 +372,25 @@ discard block |
||
372 | 372 | KEY STS_ID (STS_ID), |
373 | 373 | KEY REG_url_link (REG_url_link), |
374 | 374 | KEY REG_code (REG_code)"; |
375 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
376 | - $table_name = 'esp_checkin'; |
|
377 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
375 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
376 | + $table_name = 'esp_checkin'; |
|
377 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
378 | 378 | REG_ID INT(10) UNSIGNED NOT NULL, |
379 | 379 | DTT_ID INT(10) UNSIGNED NOT NULL, |
380 | 380 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
381 | 381 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
382 | 382 | PRIMARY KEY (CHK_ID)"; |
383 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | - $table_name = 'esp_state'; |
|
385 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
383 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | + $table_name = 'esp_state'; |
|
385 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
386 | 386 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
387 | 387 | STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL, |
388 | 388 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
389 | 389 | STA_active TINYINT(1) DEFAULT '1', |
390 | 390 | PRIMARY KEY (STA_ID)"; |
391 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | - $table_name = 'esp_status'; |
|
393 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
391 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | + $table_name = 'esp_status'; |
|
393 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
394 | 394 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
395 | 395 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
396 | 396 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
399 | 399 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
400 | 400 | KEY STS_type (STS_type)"; |
401 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
402 | - $table_name = 'esp_transaction'; |
|
403 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
401 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
402 | + $table_name = 'esp_transaction'; |
|
403 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
404 | 404 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
405 | 405 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
406 | 406 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | PRIMARY KEY (TXN_ID), |
413 | 413 | KEY TXN_timestamp (TXN_timestamp), |
414 | 414 | KEY STS_ID (STS_ID)"; |
415 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
416 | - $table_name = 'esp_venue_meta'; |
|
417 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
415 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
416 | + $table_name = 'esp_venue_meta'; |
|
417 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
418 | 418 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
419 | 419 | VNU_address VARCHAR(255) DEFAULT NULL, |
420 | 420 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | PRIMARY KEY (VNUM_ID), |
433 | 433 | KEY STA_ID (STA_ID), |
434 | 434 | KEY CNT_ISO (CNT_ISO)"; |
435 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
436 | - //modified tables |
|
437 | - $table_name = "esp_price"; |
|
438 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
435 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
436 | + //modified tables |
|
437 | + $table_name = "esp_price"; |
|
438 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
439 | 439 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
440 | 440 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
441 | 441 | PRC_name VARCHAR(245) NOT NULL, |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | PRC_wp_user BIGINT UNSIGNED NULL, |
448 | 448 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
449 | 449 | PRIMARY KEY (PRC_ID)"; |
450 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
451 | - $table_name = "esp_price_type"; |
|
452 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
450 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
451 | + $table_name = "esp_price_type"; |
|
452 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
453 | 453 | PRT_name VARCHAR(45) NOT NULL, |
454 | 454 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
455 | 455 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
459 | 459 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
460 | 460 | PRIMARY KEY (PRT_ID)"; |
461 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
462 | - $table_name = "esp_ticket"; |
|
463 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
461 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
462 | + $table_name = "esp_ticket"; |
|
463 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
464 | 464 | TTM_ID INT(10) UNSIGNED NOT NULL, |
465 | 465 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
466 | 466 | TKT_description TEXT NOT NULL, |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
482 | 482 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
483 | 483 | PRIMARY KEY (TKT_ID)"; |
484 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
485 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
486 | - $table_name = 'esp_question_group'; |
|
487 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
484 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
485 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
486 | + $table_name = 'esp_question_group'; |
|
487 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
488 | 488 | QSG_name VARCHAR(255) NOT NULL, |
489 | 489 | QSG_identifier VARCHAR(100) NOT NULL, |
490 | 490 | QSG_desc TEXT NULL, |
@@ -496,119 +496,119 @@ discard block |
||
496 | 496 | QSG_wp_user BIGINT UNSIGNED NULL, |
497 | 497 | PRIMARY KEY (QSG_ID), |
498 | 498 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
499 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
501 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
502 | - //(because many need to convert old string states to foreign keys into the states table) |
|
503 | - $script_4_1_defaults->insert_default_states(); |
|
504 | - $script_4_1_defaults->insert_default_countries(); |
|
505 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
506 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
507 | - $script_4_5_defaults->insert_default_price_types(); |
|
508 | - $script_4_5_defaults->insert_default_prices(); |
|
509 | - $script_4_5_defaults->insert_default_tickets(); |
|
510 | - //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
511 | - EE_Config::instance()->update_espresso_config(false, true); |
|
512 | - $this->add_default_admin_only_payments(); |
|
513 | - $this->insert_default_currencies(); |
|
514 | - return true; |
|
515 | - } |
|
516 | - |
|
517 | - |
|
518 | - |
|
519 | - /** |
|
520 | - * @return boolean |
|
521 | - */ |
|
522 | - public function schema_changes_after_migration() |
|
523 | - { |
|
524 | - return true; |
|
525 | - } |
|
526 | - |
|
527 | - |
|
528 | - |
|
529 | - public function migration_page_hooks() |
|
530 | - { |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - |
|
535 | - public function add_default_admin_only_payments() |
|
536 | - { |
|
537 | - global $wpdb; |
|
538 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
539 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
540 | - if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
541 | - $SQL = "SELECT COUNT( * ) FROM $table_name"; |
|
542 | - $existing_payment_methods = $wpdb->get_var($SQL); |
|
543 | - $default_admin_only_payment_methods = apply_filters( |
|
544 | - 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
545 | - array( |
|
546 | - __("Bank", 'event_espresso') => __("Bank Draft", 'event_espresso'), |
|
547 | - __("Cash", 'event_espresso') => __("Cash Delivered Physically", 'event_espresso'), |
|
548 | - __("Check", 'event_espresso') => __("Paper Check", 'event_espresso'), |
|
549 | - __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'), |
|
550 | - __("Debit Card", 'event_espresso') => __("Offline Debit Payment", 'event_espresso'), |
|
551 | - __("Invoice", 'event_espresso') => __("Invoice received with monies included", |
|
552 | - 'event_espresso'), |
|
553 | - __("Money Order", 'event_espresso') => '', |
|
554 | - __("Paypal", 'event_espresso') => __("Paypal eCheck, Invoice, etc", 'event_espresso'), |
|
555 | - __('Other', 'event_espresso') => __('Other method of payment', 'event_espresso'), |
|
556 | - )); |
|
557 | - //make sure we hae payment method records for the following |
|
558 | - //so admins can record payments for them from the admin page |
|
559 | - foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
560 | - $slug = sanitize_key($nicename); |
|
561 | - //check that such a payment method exists |
|
562 | - $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
563 | - if ( ! $exists) { |
|
564 | - $values = array( |
|
565 | - 'PMD_type' => 'Admin_Only', |
|
566 | - 'PMD_name' => $nicename, |
|
567 | - 'PMD_admin_name' => $nicename, |
|
568 | - 'PMD_admin_desc' => $description, |
|
569 | - 'PMD_slug' => $slug, |
|
570 | - 'PMD_wp_user' => $user_id, |
|
571 | - 'PMD_scope' => serialize(array('ADMIN')), |
|
572 | - ); |
|
573 | - $success = $wpdb->insert( |
|
574 | - $table_name, |
|
575 | - $values, |
|
576 | - array( |
|
577 | - '%s',//PMD_type |
|
578 | - '%s',//PMD_name |
|
579 | - '%s',//PMD_admin_name |
|
580 | - '%s',//PMD_admin_desc |
|
581 | - '%s',//PMD_slug |
|
582 | - '%d',//PMD_wp_user |
|
583 | - '%s',//PMD_scope |
|
584 | - ) |
|
585 | - ); |
|
586 | - if ( ! $success) { |
|
587 | - $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", |
|
588 | - "event_espresso"), $this->_json_encode($values))); |
|
589 | - } |
|
590 | - } |
|
591 | - } |
|
592 | - } |
|
593 | - } |
|
594 | - |
|
595 | - |
|
596 | - |
|
597 | - /** |
|
598 | - * insert_default_countries |
|
599 | - * |
|
600 | - * @static |
|
601 | - * @return void |
|
602 | - */ |
|
603 | - public function insert_default_currencies() |
|
604 | - { |
|
605 | - global $wpdb; |
|
606 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
607 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
608 | - $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
609 | - $countries = $wpdb->get_var($SQL); |
|
610 | - if ( ! $countries) { |
|
611 | - $SQL = "INSERT INTO $currency_table |
|
499 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
501 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
502 | + //(because many need to convert old string states to foreign keys into the states table) |
|
503 | + $script_4_1_defaults->insert_default_states(); |
|
504 | + $script_4_1_defaults->insert_default_countries(); |
|
505 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
506 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
507 | + $script_4_5_defaults->insert_default_price_types(); |
|
508 | + $script_4_5_defaults->insert_default_prices(); |
|
509 | + $script_4_5_defaults->insert_default_tickets(); |
|
510 | + //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
511 | + EE_Config::instance()->update_espresso_config(false, true); |
|
512 | + $this->add_default_admin_only_payments(); |
|
513 | + $this->insert_default_currencies(); |
|
514 | + return true; |
|
515 | + } |
|
516 | + |
|
517 | + |
|
518 | + |
|
519 | + /** |
|
520 | + * @return boolean |
|
521 | + */ |
|
522 | + public function schema_changes_after_migration() |
|
523 | + { |
|
524 | + return true; |
|
525 | + } |
|
526 | + |
|
527 | + |
|
528 | + |
|
529 | + public function migration_page_hooks() |
|
530 | + { |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + |
|
535 | + public function add_default_admin_only_payments() |
|
536 | + { |
|
537 | + global $wpdb; |
|
538 | + $table_name = $wpdb->prefix . "esp_payment_method"; |
|
539 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
540 | + if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
541 | + $SQL = "SELECT COUNT( * ) FROM $table_name"; |
|
542 | + $existing_payment_methods = $wpdb->get_var($SQL); |
|
543 | + $default_admin_only_payment_methods = apply_filters( |
|
544 | + 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
545 | + array( |
|
546 | + __("Bank", 'event_espresso') => __("Bank Draft", 'event_espresso'), |
|
547 | + __("Cash", 'event_espresso') => __("Cash Delivered Physically", 'event_espresso'), |
|
548 | + __("Check", 'event_espresso') => __("Paper Check", 'event_espresso'), |
|
549 | + __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'), |
|
550 | + __("Debit Card", 'event_espresso') => __("Offline Debit Payment", 'event_espresso'), |
|
551 | + __("Invoice", 'event_espresso') => __("Invoice received with monies included", |
|
552 | + 'event_espresso'), |
|
553 | + __("Money Order", 'event_espresso') => '', |
|
554 | + __("Paypal", 'event_espresso') => __("Paypal eCheck, Invoice, etc", 'event_espresso'), |
|
555 | + __('Other', 'event_espresso') => __('Other method of payment', 'event_espresso'), |
|
556 | + )); |
|
557 | + //make sure we hae payment method records for the following |
|
558 | + //so admins can record payments for them from the admin page |
|
559 | + foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
560 | + $slug = sanitize_key($nicename); |
|
561 | + //check that such a payment method exists |
|
562 | + $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
563 | + if ( ! $exists) { |
|
564 | + $values = array( |
|
565 | + 'PMD_type' => 'Admin_Only', |
|
566 | + 'PMD_name' => $nicename, |
|
567 | + 'PMD_admin_name' => $nicename, |
|
568 | + 'PMD_admin_desc' => $description, |
|
569 | + 'PMD_slug' => $slug, |
|
570 | + 'PMD_wp_user' => $user_id, |
|
571 | + 'PMD_scope' => serialize(array('ADMIN')), |
|
572 | + ); |
|
573 | + $success = $wpdb->insert( |
|
574 | + $table_name, |
|
575 | + $values, |
|
576 | + array( |
|
577 | + '%s',//PMD_type |
|
578 | + '%s',//PMD_name |
|
579 | + '%s',//PMD_admin_name |
|
580 | + '%s',//PMD_admin_desc |
|
581 | + '%s',//PMD_slug |
|
582 | + '%d',//PMD_wp_user |
|
583 | + '%s',//PMD_scope |
|
584 | + ) |
|
585 | + ); |
|
586 | + if ( ! $success) { |
|
587 | + $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", |
|
588 | + "event_espresso"), $this->_json_encode($values))); |
|
589 | + } |
|
590 | + } |
|
591 | + } |
|
592 | + } |
|
593 | + } |
|
594 | + |
|
595 | + |
|
596 | + |
|
597 | + /** |
|
598 | + * insert_default_countries |
|
599 | + * |
|
600 | + * @static |
|
601 | + * @return void |
|
602 | + */ |
|
603 | + public function insert_default_currencies() |
|
604 | + { |
|
605 | + global $wpdb; |
|
606 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
607 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
608 | + $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
609 | + $countries = $wpdb->get_var($SQL); |
|
610 | + if ( ! $countries) { |
|
611 | + $SQL = "INSERT INTO $currency_table |
|
612 | 612 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
613 | 613 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
614 | 614 | ( 'AED', 'Dirham', 'Dirhams', 'د.إ',2,1), |
@@ -762,10 +762,10 @@ discard block |
||
762 | 762 | ( 'ZAR', 'Rand', 'Rands', 'R', 2,1), |
763 | 763 | ( 'ZMK', 'Kwacha', 'Kwachas', '', 2,1), |
764 | 764 | ( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);"; |
765 | - $wpdb->query($SQL); |
|
766 | - } |
|
767 | - } |
|
768 | - } |
|
765 | + $wpdb->query($SQL); |
|
766 | + } |
|
767 | + } |
|
768 | + } |
|
769 | 769 | |
770 | 770 | } |
771 | 771 |
@@ -14,7 +14,7 @@ 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(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 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; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function schema_changes_before_migration() |
101 | 101 | { |
102 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
102 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
103 | 103 | $now_in_mysql = current_time('mysql', true); |
104 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
104 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
105 | 105 | $table_name = 'esp_answer'; |
106 | 106 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
107 | 107 | REG_ID int(10) unsigned NOT NULL, |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ), |
698 | 698 | ); |
699 | 699 | global $wpdb; |
700 | - $country_table = $wpdb->prefix . "esp_country"; |
|
700 | + $country_table = $wpdb->prefix."esp_country"; |
|
701 | 701 | $country_format = array( |
702 | 702 | "CNT_ISO" => '%s', |
703 | 703 | "CNT_ISO3" => '%s', |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
744 | 744 | ); |
745 | 745 | global $wpdb; |
746 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
746 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
747 | 747 | $currency_format = array( |
748 | 748 | "CUR_code" => '%s', |
749 | 749 | "CUR_single" => '%s', |
@@ -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,221 +552,221 @@ 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($country_table, |
|
712 | - array_combine(array_keys($country_format), $country), |
|
713 | - $country_format |
|
714 | - ); |
|
715 | - } |
|
716 | - } |
|
717 | - } |
|
718 | - } |
|
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($country_table, |
|
712 | + array_combine(array_keys($country_format), $country), |
|
713 | + $country_format |
|
714 | + ); |
|
715 | + } |
|
716 | + } |
|
717 | + } |
|
718 | + } |
|
719 | 719 | |
720 | 720 | |
721 | 721 | |
722 | - /** |
|
723 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
724 | - */ |
|
725 | - public function verify_new_currencies() |
|
726 | - { |
|
727 | - //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
728 | - //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
729 | - //currency symbols: http://www.xe.com/symbols.php |
|
730 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
731 | - //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
732 | - $newer_currencies = array( |
|
733 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
734 | - ); |
|
735 | - global $wpdb; |
|
736 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
737 | - $currency_format = array( |
|
738 | - "CUR_code" => '%s', |
|
739 | - "CUR_single" => '%s', |
|
740 | - "CUR_plural" => '%s', |
|
741 | - "CUR_sign" => '%s', |
|
742 | - "CUR_dec_plc" => '%d', |
|
743 | - "CUR_active" => '%d', |
|
744 | - ); |
|
745 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
746 | - foreach ($newer_currencies as $currency) { |
|
747 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
748 | - $countries = $wpdb->get_var($SQL); |
|
749 | - if ( ! $countries) { |
|
750 | - $wpdb->insert($currency_table, |
|
751 | - array_combine(array_keys($currency_format), $currency), |
|
752 | - $currency_format |
|
753 | - ); |
|
754 | - } |
|
755 | - } |
|
756 | - } |
|
757 | - } |
|
722 | + /** |
|
723 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
724 | + */ |
|
725 | + public function verify_new_currencies() |
|
726 | + { |
|
727 | + //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
728 | + //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
729 | + //currency symbols: http://www.xe.com/symbols.php |
|
730 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
731 | + //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
732 | + $newer_currencies = array( |
|
733 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
734 | + ); |
|
735 | + global $wpdb; |
|
736 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
737 | + $currency_format = array( |
|
738 | + "CUR_code" => '%s', |
|
739 | + "CUR_single" => '%s', |
|
740 | + "CUR_plural" => '%s', |
|
741 | + "CUR_sign" => '%s', |
|
742 | + "CUR_dec_plc" => '%d', |
|
743 | + "CUR_active" => '%d', |
|
744 | + ); |
|
745 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
746 | + foreach ($newer_currencies as $currency) { |
|
747 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
748 | + $countries = $wpdb->get_var($SQL); |
|
749 | + if ( ! $countries) { |
|
750 | + $wpdb->insert($currency_table, |
|
751 | + array_combine(array_keys($currency_format), $currency), |
|
752 | + $currency_format |
|
753 | + ); |
|
754 | + } |
|
755 | + } |
|
756 | + } |
|
757 | + } |
|
758 | 758 | |
759 | 759 | |
760 | 760 | |
761 | - /** |
|
762 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
763 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
764 | - * we should be able to stop doing this in 4.9 |
|
765 | - */ |
|
766 | - public function fix_non_default_taxes() |
|
767 | - { |
|
768 | - global $wpdb; |
|
769 | - $query = $wpdb->prepare("UPDATE |
|
761 | + /** |
|
762 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
763 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
764 | + * we should be able to stop doing this in 4.9 |
|
765 | + */ |
|
766 | + public function fix_non_default_taxes() |
|
767 | + { |
|
768 | + global $wpdb; |
|
769 | + $query = $wpdb->prepare("UPDATE |
|
770 | 770 | {$wpdb->prefix}esp_price p INNER JOIN |
771 | 771 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
772 | 772 | SET |
@@ -775,6 +775,6 @@ discard block |
||
775 | 775 | p.PRC_is_default = 0 AND |
776 | 776 | pt.PBT_ID = %d |
777 | 777 | ", EEM_Price_Type::base_type_tax); |
778 | - $wpdb->query($query); |
|
779 | - } |
|
778 | + $wpdb->query($query); |
|
779 | + } |
|
780 | 780 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | //unfortunately, this needs to be done upon INCLUSION of this file, |
14 | 14 | //instead of construction, because it only gets constructed on first page load |
15 | 15 | //(all other times it gets resurrected from a wordpress option) |
16 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
|
16 | +$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*'); |
|
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | 19 | $matches = array(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } elseif ( ! $version_string) { |
63 | 63 | // echo "no version string provided: $version_string"; |
64 | 64 | //no version string provided... this must be pre 4.3 |
65 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | 66 | } else { |
67 | 67 | // echo "$version_string doesnt apply"; |
68 | 68 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function schema_changes_before_migration() |
82 | 82 | { |
83 | 83 | //relies on 4.1's EEH_Activation::create_table |
84 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
84 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
85 | 85 | $table_name = 'esp_answer'; |
86 | 86 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
87 | 87 | REG_ID INT UNSIGNED NOT NULL, |
@@ -486,18 +486,18 @@ discard block |
||
486 | 486 | public function insert_default_price_types() |
487 | 487 | { |
488 | 488 | global $wpdb; |
489 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
489 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
490 | 490 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
491 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
491 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
492 | 492 | $price_types_exist = $wpdb->get_var($SQL); |
493 | 493 | if ( ! $price_types_exist) { |
494 | 494 | $user_id = EEH_Activation::get_default_creator_id(); |
495 | 495 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
496 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
|
497 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
|
498 | - (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
|
499 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
|
500 | - (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
|
496 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, $user_id, 0), |
|
497 | + (2, '".__('Percent Discount', 'event_espresso')."', 2, 1, 20, $user_id, 0), |
|
498 | + (3, '".__('Dollar Discount', 'event_espresso')."', 2, 0, 30, $user_id, 0), |
|
499 | + (4, '".__('Percent Surcharge', 'event_espresso')."', 3, 1, 40, $user_id, 0), |
|
500 | + (5, '".__('Dollar Surcharge', 'event_espresso')."', 3, 0, 50, $user_id, 0);"; |
|
501 | 501 | $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
502 | 502 | $wpdb->query($SQL); |
503 | 503 | } |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | public function insert_default_prices() |
519 | 519 | { |
520 | 520 | global $wpdb; |
521 | - $price_table = $wpdb->prefix . "esp_price"; |
|
521 | + $price_table = $wpdb->prefix."esp_price"; |
|
522 | 522 | if ($this->_get_table_analysis()->tableExists($price_table)) { |
523 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
523 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
524 | 524 | $prices_exist = $wpdb->get_var($SQL); |
525 | 525 | if ( ! $prices_exist) { |
526 | 526 | $user_id = EEH_Activation::get_default_creator_id(); |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | public function insert_default_tickets() |
546 | 546 | { |
547 | 547 | global $wpdb; |
548 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
548 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
549 | 549 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
550 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
550 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
551 | 551 | $tickets_exist = $wpdb->get_var($SQL); |
552 | 552 | if ( ! $tickets_exist) { |
553 | 553 | $user_id = EEH_Activation::get_default_creator_id(); |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | $wpdb->query($SQL); |
561 | 561 | } |
562 | 562 | } |
563 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
563 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
564 | 564 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
565 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
565 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
566 | 566 | $ticket_prc_exist = $wpdb->get_var($SQL); |
567 | 567 | if ( ! $ticket_prc_exist) { |
568 | 568 | $SQL = "INSERT INTO $ticket_price_table |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | - $matches = array(); |
|
20 | - preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | - $class_to_filepath[$matches[1]] = $filepath; |
|
19 | + $matches = array(); |
|
20 | + preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | + $class_to_filepath[$matches[1]] = $filepath; |
|
22 | 22 | } |
23 | 23 | //give addons a chance to autoload their stages too |
24 | 24 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -31,59 +31,59 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * EE_DMS_Core_4_5_0 constructor. |
|
36 | - * |
|
37 | - * @param TableManager $table_manager |
|
38 | - * @param TableAnalysis $table_analysis |
|
39 | - */ |
|
40 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | - { |
|
42 | - $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | - $this->_priority = 10; |
|
44 | - $this->_migration_stages = array( |
|
45 | - new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | - new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | - new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | - new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | - new EE_DMS_4_5_0_invoice_settings(), |
|
50 | - ); |
|
51 | - parent::__construct($table_manager, $table_analysis); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - |
|
56 | - public function can_migrate_from_version($version_array) |
|
57 | - { |
|
58 | - $version_string = $version_array['Core']; |
|
59 | - if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
|
34 | + /** |
|
35 | + * EE_DMS_Core_4_5_0 constructor. |
|
36 | + * |
|
37 | + * @param TableManager $table_manager |
|
38 | + * @param TableAnalysis $table_analysis |
|
39 | + */ |
|
40 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | + { |
|
42 | + $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | + $this->_priority = 10; |
|
44 | + $this->_migration_stages = array( |
|
45 | + new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | + new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | + new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | + new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | + new EE_DMS_4_5_0_invoice_settings(), |
|
50 | + ); |
|
51 | + parent::__construct($table_manager, $table_analysis); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + |
|
56 | + public function can_migrate_from_version($version_array) |
|
57 | + { |
|
58 | + $version_string = $version_array['Core']; |
|
59 | + if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
|
60 | 60 | // echo "$version_string can be migrated from"; |
61 | - return true; |
|
62 | - } elseif ( ! $version_string) { |
|
61 | + return true; |
|
62 | + } elseif ( ! $version_string) { |
|
63 | 63 | // echo "no version string provided: $version_string"; |
64 | - //no version string provided... this must be pre 4.3 |
|
65 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | - } else { |
|
64 | + //no version string provided... this must be pre 4.3 |
|
65 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | + } else { |
|
67 | 67 | // echo "$version_string doesnt apply"; |
68 | - return false; |
|
69 | - } |
|
70 | - } |
|
68 | + return false; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | - public function schema_changes_before_migration() |
|
75 | - { |
|
76 | - //relies on 4.1's EEH_Activation::create_table |
|
77 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
78 | - $table_name = 'esp_answer'; |
|
79 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
74 | + public function schema_changes_before_migration() |
|
75 | + { |
|
76 | + //relies on 4.1's EEH_Activation::create_table |
|
77 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
78 | + $table_name = 'esp_answer'; |
|
79 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
80 | 80 | REG_ID INT UNSIGNED NOT NULL, |
81 | 81 | QST_ID INT UNSIGNED NOT NULL, |
82 | 82 | ANS_value TEXT NOT NULL, |
83 | 83 | PRIMARY KEY (ANS_ID)"; |
84 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
85 | - $table_name = 'esp_attendee_meta'; |
|
86 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
84 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
85 | + $table_name = 'esp_attendee_meta'; |
|
86 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
87 | 87 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
88 | 88 | ATT_fname VARCHAR(45) NOT NULL, |
89 | 89 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | KEY ATT_fname (ATT_fname), |
100 | 100 | KEY ATT_lname (ATT_lname), |
101 | 101 | KEY ATT_email (ATT_email)"; |
102 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
103 | - $table_name = 'esp_country'; |
|
104 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
102 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
103 | + $table_name = 'esp_country'; |
|
104 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
105 | 105 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
106 | 106 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
107 | 107 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | CNT_is_EU TINYINT(1) DEFAULT '0', |
118 | 118 | CNT_active TINYINT(1) DEFAULT '0', |
119 | 119 | PRIMARY KEY (CNT_ISO)"; |
120 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
121 | - $table_name = 'esp_datetime'; |
|
122 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
120 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
121 | + $table_name = 'esp_datetime'; |
|
122 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
123 | 123 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
124 | 124 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
125 | 125 | DTT_description TEXT NOT NULL, |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | PRIMARY KEY (DTT_ID), |
135 | 135 | KEY EVT_ID (EVT_ID), |
136 | 136 | KEY DTT_is_primary (DTT_is_primary)"; |
137 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
138 | - $table_name = 'esp_event_meta'; |
|
139 | - $sql = " |
|
137 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
138 | + $table_name = 'esp_event_meta'; |
|
139 | + $sql = " |
|
140 | 140 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
141 | 141 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
142 | 142 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -151,31 +151,31 @@ discard block |
||
151 | 151 | EVT_external_URL VARCHAR(200) NULL, |
152 | 152 | EVT_donations TINYINT(1) NULL, |
153 | 153 | PRIMARY KEY (EVTM_ID)"; |
154 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | - $table_name = 'esp_event_question_group'; |
|
156 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | + $table_name = 'esp_event_question_group'; |
|
156 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
157 | 157 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
158 | 158 | QSG_ID INT UNSIGNED NOT NULL, |
159 | 159 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
160 | 160 | PRIMARY KEY (EQG_ID)"; |
161 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | - $table_name = 'esp_event_venue'; |
|
163 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
161 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | + $table_name = 'esp_event_venue'; |
|
163 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
164 | 164 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
165 | 165 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
166 | 166 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
167 | 167 | PRIMARY KEY (EVV_ID)"; |
168 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | - $table_name = 'esp_extra_meta'; |
|
170 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
168 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | + $table_name = 'esp_extra_meta'; |
|
170 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
171 | 171 | OBJ_ID INT(11) DEFAULT NULL, |
172 | 172 | EXM_type VARCHAR(45) DEFAULT NULL, |
173 | 173 | EXM_key VARCHAR(45) DEFAULT NULL, |
174 | 174 | EXM_value TEXT, |
175 | 175 | PRIMARY KEY (EXM_ID)"; |
176 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | - $table_name = 'esp_line_item'; |
|
178 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
176 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | + $table_name = 'esp_line_item'; |
|
178 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
179 | 179 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
180 | 180 | TXN_ID INT(11) DEFAULT NULL, |
181 | 181 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -191,19 +191,19 @@ discard block |
||
191 | 191 | OBJ_ID INT(11) DEFAULT NULL, |
192 | 192 | OBJ_type VARCHAR(45)DEFAULT NULL, |
193 | 193 | PRIMARY KEY (LIN_ID)"; |
194 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | - $table_name = 'esp_message_template'; |
|
196 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
194 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | + $table_name = 'esp_message_template'; |
|
196 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
197 | 197 | GRP_ID INT(10) UNSIGNED NOT NULL, |
198 | 198 | MTP_context VARCHAR(50) NOT NULL, |
199 | 199 | MTP_template_field VARCHAR(30) NOT NULL, |
200 | 200 | MTP_content TEXT NOT NULL, |
201 | 201 | PRIMARY KEY (MTP_ID), |
202 | 202 | KEY GRP_ID (GRP_ID)"; |
203 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
205 | - $table_name = 'esp_message_template_group'; |
|
206 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
205 | + $table_name = 'esp_message_template_group'; |
|
206 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | 207 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
208 | 208 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
209 | 209 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
216 | 216 | PRIMARY KEY (GRP_ID), |
217 | 217 | KEY MTP_user_id (MTP_user_id)"; |
218 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | - $table_name = 'esp_event_message_template'; |
|
220 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
218 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | + $table_name = 'esp_event_message_template'; |
|
220 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
221 | 221 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
222 | 222 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EMT_ID), |
224 | 224 | KEY EVT_ID (EVT_ID), |
225 | 225 | KEY GRP_ID (GRP_ID)"; |
226 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | - $table_name = 'esp_payment'; |
|
228 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
226 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | + $table_name = 'esp_payment'; |
|
228 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
229 | 229 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
230 | 230 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
231 | 231 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | PRIMARY KEY (PAY_ID), |
242 | 242 | KEY TXN_ID (TXN_ID), |
243 | 243 | KEY PAY_timestamp (PAY_timestamp)"; |
244 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
245 | - $table_name = "esp_ticket_price"; |
|
246 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
244 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
245 | + $table_name = "esp_ticket_price"; |
|
246 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
247 | 247 | TKT_ID INT(10) UNSIGNED NOT NULL, |
248 | 248 | PRC_ID INT(10) UNSIGNED NOT NULL, |
249 | 249 | PRIMARY KEY (TKP_ID)"; |
250 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | - $table_name = "esp_datetime_ticket"; |
|
252 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
250 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | + $table_name = "esp_datetime_ticket"; |
|
252 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
253 | 253 | DTT_ID INT(10) UNSIGNED NOT NULL, |
254 | 254 | TKT_ID INT(10) UNSIGNED NOT NULL, |
255 | 255 | PRIMARY KEY (DTK_ID)"; |
256 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | - $table_name = "esp_ticket_template"; |
|
258 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
256 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | + $table_name = "esp_ticket_template"; |
|
258 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
259 | 259 | TTM_name VARCHAR(45) NOT NULL, |
260 | 260 | TTM_description TEXT, |
261 | 261 | TTM_file VARCHAR(45), |
262 | 262 | PRIMARY KEY (TTM_ID)"; |
263 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | - $table_name = 'esp_question'; |
|
265 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
263 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | + $table_name = 'esp_question'; |
|
265 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
266 | 266 | QST_display_text TEXT NOT NULL, |
267 | 267 | QST_admin_label VARCHAR(255) NOT NULL, |
268 | 268 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -274,25 +274,25 @@ discard block |
||
274 | 274 | QST_wp_user BIGINT UNSIGNED NULL, |
275 | 275 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
276 | 276 | PRIMARY KEY (QST_ID)'; |
277 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | - $table_name = 'esp_question_group_question'; |
|
279 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
277 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | + $table_name = 'esp_question_group_question'; |
|
279 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
280 | 280 | QSG_ID INT UNSIGNED NOT NULL, |
281 | 281 | QST_ID INT UNSIGNED NOT NULL, |
282 | 282 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
283 | 283 | PRIMARY KEY (QGQ_ID) "; |
284 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | - $table_name = 'esp_question_option'; |
|
286 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $table_name = 'esp_question_option'; |
|
286 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
287 | 287 | QSO_value VARCHAR(255) NOT NULL, |
288 | 288 | QSO_desc TEXT NOT NULL, |
289 | 289 | QST_ID INT UNSIGNED NOT NULL, |
290 | 290 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
291 | 291 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
292 | 292 | PRIMARY KEY (QSO_ID)"; |
293 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | - $table_name = 'esp_registration'; |
|
295 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
293 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | + $table_name = 'esp_registration'; |
|
295 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
296 | 296 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
297 | 297 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
298 | 298 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -315,25 +315,25 @@ discard block |
||
315 | 315 | KEY STS_ID (STS_ID), |
316 | 316 | KEY REG_url_link (REG_url_link), |
317 | 317 | KEY REG_code (REG_code)"; |
318 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | - $table_name = 'esp_checkin'; |
|
320 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
318 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | + $table_name = 'esp_checkin'; |
|
320 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
321 | 321 | REG_ID INT(10) UNSIGNED NOT NULL, |
322 | 322 | DTT_ID INT(10) UNSIGNED NOT NULL, |
323 | 323 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
324 | 324 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
325 | 325 | PRIMARY KEY (CHK_ID)"; |
326 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | - $table_name = 'esp_state'; |
|
328 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
326 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | + $table_name = 'esp_state'; |
|
328 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
329 | 329 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
330 | 330 | STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL, |
331 | 331 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
332 | 332 | STA_active TINYINT(1) DEFAULT '1', |
333 | 333 | PRIMARY KEY (STA_ID)"; |
334 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | - $table_name = 'esp_status'; |
|
336 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
334 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | + $table_name = 'esp_status'; |
|
336 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
337 | 337 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
338 | 338 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
339 | 339 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
342 | 342 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
343 | 343 | KEY STS_type (STS_type)"; |
344 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | - $table_name = 'esp_transaction'; |
|
346 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
344 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | + $table_name = 'esp_transaction'; |
|
346 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
347 | 347 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
348 | 348 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
349 | 349 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | PRIMARY KEY (TXN_ID), |
355 | 355 | KEY TXN_timestamp (TXN_timestamp), |
356 | 356 | KEY STS_ID (STS_ID)"; |
357 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | - $table_name = 'esp_venue_meta'; |
|
359 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
357 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | + $table_name = 'esp_venue_meta'; |
|
359 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
360 | 360 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
361 | 361 | VNU_address VARCHAR(255) DEFAULT NULL, |
362 | 362 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | PRIMARY KEY (VNUM_ID), |
375 | 375 | KEY STA_ID (STA_ID), |
376 | 376 | KEY CNT_ISO (CNT_ISO)"; |
377 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | - //modified tables |
|
379 | - $table_name = "esp_price"; |
|
380 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
377 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | + //modified tables |
|
379 | + $table_name = "esp_price"; |
|
380 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 381 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
382 | 382 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
383 | 383 | PRC_name VARCHAR(245) NOT NULL, |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | PRC_wp_user BIGINT UNSIGNED NULL, |
390 | 390 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
391 | 391 | PRIMARY KEY (PRC_ID)"; |
392 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | - $table_name = "esp_price_type"; |
|
394 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
392 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | + $table_name = "esp_price_type"; |
|
394 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | 395 | PRT_name VARCHAR(45) NOT NULL, |
396 | 396 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
397 | 397 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
401 | 401 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
402 | 402 | PRIMARY KEY (PRT_ID)"; |
403 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | - $table_name = "esp_ticket"; |
|
405 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
403 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | + $table_name = "esp_ticket"; |
|
405 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
406 | 406 | TTM_ID INT(10) UNSIGNED NOT NULL, |
407 | 407 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
408 | 408 | TKT_description TEXT NOT NULL, |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
424 | 424 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
425 | 425 | PRIMARY KEY (TKT_ID)"; |
426 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
428 | - $table_name = 'esp_question_group'; |
|
429 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
426 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
428 | + $table_name = 'esp_question_group'; |
|
429 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
430 | 430 | QSG_name VARCHAR(255) NOT NULL, |
431 | 431 | QSG_identifier VARCHAR(100) NOT NULL, |
432 | 432 | QSG_desc TEXT NULL, |
@@ -438,135 +438,135 @@ discard block |
||
438 | 438 | QSG_wp_user BIGINT UNSIGNED NULL, |
439 | 439 | PRIMARY KEY (QSG_ID), |
440 | 440 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
441 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
443 | - //(because many need to convert old string states to foreign keys into the states table) |
|
444 | - $script_4_1_defaults->insert_default_states(); |
|
445 | - $script_4_1_defaults->insert_default_countries(); |
|
446 | - //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
447 | - $this->insert_default_price_types(); |
|
448 | - $this->insert_default_prices(); |
|
449 | - $this->insert_default_tickets(); |
|
450 | - //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
451 | - EE_Config::instance()->update_espresso_config(false, true); |
|
452 | - return true; |
|
453 | - } |
|
454 | - |
|
455 | - |
|
456 | - |
|
457 | - /** |
|
458 | - * @return boolean |
|
459 | - */ |
|
460 | - public function schema_changes_after_migration() |
|
461 | - { |
|
462 | - return true; |
|
463 | - } |
|
464 | - |
|
465 | - |
|
466 | - |
|
467 | - public function migration_page_hooks() |
|
468 | - { |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - |
|
473 | - /** |
|
474 | - * insert_default_price_types |
|
475 | - * |
|
476 | - * @since 4.5.0 |
|
477 | - * @return void |
|
478 | - */ |
|
479 | - public function insert_default_price_types() |
|
480 | - { |
|
481 | - global $wpdb; |
|
482 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
483 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
484 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
485 | - $price_types_exist = $wpdb->get_var($SQL); |
|
486 | - if ( ! $price_types_exist) { |
|
487 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
488 | - $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
441 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
443 | + //(because many need to convert old string states to foreign keys into the states table) |
|
444 | + $script_4_1_defaults->insert_default_states(); |
|
445 | + $script_4_1_defaults->insert_default_countries(); |
|
446 | + //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
447 | + $this->insert_default_price_types(); |
|
448 | + $this->insert_default_prices(); |
|
449 | + $this->insert_default_tickets(); |
|
450 | + //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
451 | + EE_Config::instance()->update_espresso_config(false, true); |
|
452 | + return true; |
|
453 | + } |
|
454 | + |
|
455 | + |
|
456 | + |
|
457 | + /** |
|
458 | + * @return boolean |
|
459 | + */ |
|
460 | + public function schema_changes_after_migration() |
|
461 | + { |
|
462 | + return true; |
|
463 | + } |
|
464 | + |
|
465 | + |
|
466 | + |
|
467 | + public function migration_page_hooks() |
|
468 | + { |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + |
|
473 | + /** |
|
474 | + * insert_default_price_types |
|
475 | + * |
|
476 | + * @since 4.5.0 |
|
477 | + * @return void |
|
478 | + */ |
|
479 | + public function insert_default_price_types() |
|
480 | + { |
|
481 | + global $wpdb; |
|
482 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
483 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
484 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
485 | + $price_types_exist = $wpdb->get_var($SQL); |
|
486 | + if ( ! $price_types_exist) { |
|
487 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
488 | + $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
489 | 489 | (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
490 | 490 | (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
491 | 491 | (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
492 | 492 | (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
493 | 493 | (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
494 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
495 | - $wpdb->query($SQL); |
|
496 | - } |
|
497 | - } |
|
498 | - } |
|
499 | - |
|
500 | - |
|
501 | - |
|
502 | - /** |
|
503 | - * insert DEFAULT prices. |
|
504 | - * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
505 | - * when EEH_Activaion's initialize_db_content is called via ahook in |
|
506 | - * EE_Brewing_regular |
|
507 | - * |
|
508 | - * @since 4.5.0 |
|
509 | - * @return void |
|
510 | - */ |
|
511 | - public function insert_default_prices() |
|
512 | - { |
|
513 | - global $wpdb; |
|
514 | - $price_table = $wpdb->prefix . "esp_price"; |
|
515 | - if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
516 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
517 | - $prices_exist = $wpdb->get_var($SQL); |
|
518 | - if ( ! $prices_exist) { |
|
519 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
520 | - $SQL = "INSERT INTO $price_table |
|
494 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
495 | + $wpdb->query($SQL); |
|
496 | + } |
|
497 | + } |
|
498 | + } |
|
499 | + |
|
500 | + |
|
501 | + |
|
502 | + /** |
|
503 | + * insert DEFAULT prices. |
|
504 | + * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
505 | + * when EEH_Activaion's initialize_db_content is called via ahook in |
|
506 | + * EE_Brewing_regular |
|
507 | + * |
|
508 | + * @since 4.5.0 |
|
509 | + * @return void |
|
510 | + */ |
|
511 | + public function insert_default_prices() |
|
512 | + { |
|
513 | + global $wpdb; |
|
514 | + $price_table = $wpdb->prefix . "esp_price"; |
|
515 | + if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
516 | + $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
517 | + $prices_exist = $wpdb->get_var($SQL); |
|
518 | + if ( ! $prices_exist) { |
|
519 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
520 | + $SQL = "INSERT INTO $price_table |
|
521 | 521 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
522 | 522 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);"; |
523 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
524 | - $wpdb->query($SQL); |
|
525 | - } |
|
526 | - } |
|
527 | - } |
|
528 | - |
|
529 | - |
|
530 | - |
|
531 | - /** |
|
532 | - * insert DEFAULT ticket |
|
533 | - * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
534 | - * |
|
535 | - * @since 4.5.0 |
|
536 | - * @return void |
|
537 | - */ |
|
538 | - public function insert_default_tickets() |
|
539 | - { |
|
540 | - global $wpdb; |
|
541 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
542 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
543 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
544 | - $tickets_exist = $wpdb->get_var($SQL); |
|
545 | - if ( ! $tickets_exist) { |
|
546 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
547 | - $SQL = "INSERT INTO $ticket_table |
|
523 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
524 | + $wpdb->query($SQL); |
|
525 | + } |
|
526 | + } |
|
527 | + } |
|
528 | + |
|
529 | + |
|
530 | + |
|
531 | + /** |
|
532 | + * insert DEFAULT ticket |
|
533 | + * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
534 | + * |
|
535 | + * @since 4.5.0 |
|
536 | + * @return void |
|
537 | + */ |
|
538 | + public function insert_default_tickets() |
|
539 | + { |
|
540 | + global $wpdb; |
|
541 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
542 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
543 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
544 | + $tickets_exist = $wpdb->get_var($SQL); |
|
545 | + if ( ! $tickets_exist) { |
|
546 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
547 | + $SQL = "INSERT INTO $ticket_table |
|
548 | 548 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
549 | 549 | ( 1, 0, '" |
550 | - . __("Free Ticket", "event_espresso") |
|
551 | - . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
552 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
553 | - $wpdb->query($SQL); |
|
554 | - } |
|
555 | - } |
|
556 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
557 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
558 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
559 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
560 | - if ( ! $ticket_prc_exist) { |
|
561 | - $SQL = "INSERT INTO $ticket_price_table |
|
550 | + . __("Free Ticket", "event_espresso") |
|
551 | + . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
552 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
553 | + $wpdb->query($SQL); |
|
554 | + } |
|
555 | + } |
|
556 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
557 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
558 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
559 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
560 | + if ( ! $ticket_prc_exist) { |
|
561 | + $SQL = "INSERT INTO $ticket_price_table |
|
562 | 562 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
563 | 563 | ( 1, 1, 1 ) |
564 | 564 | "; |
565 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
566 | - $wpdb->query($SQL); |
|
567 | - } |
|
568 | - } |
|
569 | - } |
|
565 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
566 | + $wpdb->query($SQL); |
|
567 | + } |
|
568 | + } |
|
569 | + } |
|
570 | 570 | |
571 | 571 | } |
572 | 572 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // unfortunately, this needs to be done upon INCLUSION of this file, |
16 | 16 | // instead of construction, because it only gets constructed on first page load |
17 | 17 | // (all other times it gets resurrected from a wordpress option) |
18 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
|
18 | +$stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
|
19 | 19 | $class_to_filepath = array(); |
20 | 20 | foreach ($stages as $filepath) { |
21 | 21 | $matches = array(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return true; |
80 | 80 | } elseif ( ! $version_string) { |
81 | 81 | //no version string provided... this must be pre 4.3 |
82 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
83 | 83 | } else { |
84 | 84 | return false; |
85 | 85 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function schema_changes_before_migration() |
104 | 104 | { |
105 | 105 | //relies on 4.1's EEH_Activation::create_table |
106 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
106 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
107 | 107 | $table_name = 'esp_answer'; |
108 | 108 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
109 | 109 | REG_ID INT UNSIGNED NOT NULL, |
@@ -9,7 +9,6 @@ discard block |
||
9 | 9 | * and recalculates esp_registration.REG_final_price to actually be the final price |
10 | 10 | * for that registration (before this it was just the ticket's price, NOT including |
11 | 11 | * taxes or other price modifiers) |
12 | - |
|
13 | 12 | */ |
14 | 13 | // make sure we have all the stages loaded too |
15 | 14 | // unfortunately, this needs to be done upon INCLUSION of this file, |
@@ -18,9 +17,9 @@ discard block |
||
18 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
19 | 18 | $class_to_filepath = array(); |
20 | 19 | foreach ($stages as $filepath) { |
21 | - $matches = array(); |
|
22 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
23 | - $class_to_filepath[$matches[1]] = $filepath; |
|
20 | + $matches = array(); |
|
21 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | + $class_to_filepath[$matches[1]] = $filepath; |
|
24 | 23 | } |
25 | 24 | //give addons a chance to autoload their stages too |
26 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
@@ -39,72 +38,72 @@ discard block |
||
39 | 38 | class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base |
40 | 39 | { |
41 | 40 | |
42 | - /** |
|
43 | - * return EE_DMS_Core_4_7_0 |
|
44 | - * |
|
45 | - * @param TableManager $table_manager |
|
46 | - * @param TableAnalysis $table_analysis |
|
47 | - */ |
|
48 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
49 | - { |
|
50 | - $this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso"); |
|
51 | - $this->_priority = 10; |
|
52 | - $this->_migration_stages = array( |
|
53 | - new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
54 | - new EE_DMS_4_7_0_Registration_Payments(), |
|
55 | - ); |
|
56 | - parent::__construct($table_manager, $table_analysis); |
|
57 | - } |
|
41 | + /** |
|
42 | + * return EE_DMS_Core_4_7_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 = __("Data Update to Event Espresso 4.7.0", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
53 | + new EE_DMS_4_7_0_Registration_Payments(), |
|
54 | + ); |
|
55 | + parent::__construct($table_manager, $table_analysis); |
|
56 | + } |
|
58 | 57 | |
59 | 58 | |
60 | 59 | |
61 | - /** |
|
62 | - * @param array $version_array |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - public function can_migrate_from_version($version_array) |
|
66 | - { |
|
67 | - $version_string = $version_array['Core']; |
|
68 | - if ( |
|
69 | - ( |
|
70 | - version_compare($version_string, '4.7.0', '<=') |
|
71 | - && version_compare($version_string, '4.6.0', '>=') |
|
72 | - ) |
|
73 | - || ( |
|
74 | - version_compare($version_string, '4.7.0', '>=') |
|
75 | - && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
76 | - && $this->_get_table_analysis()->tableExists('esp_registration') |
|
77 | - ) |
|
78 | - ) { |
|
79 | - return true; |
|
80 | - } elseif ( ! $version_string) { |
|
81 | - //no version string provided... this must be pre 4.3 |
|
82 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
83 | - } else { |
|
84 | - return false; |
|
85 | - } |
|
86 | - } |
|
60 | + /** |
|
61 | + * @param array $version_array |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | + public function can_migrate_from_version($version_array) |
|
65 | + { |
|
66 | + $version_string = $version_array['Core']; |
|
67 | + if ( |
|
68 | + ( |
|
69 | + version_compare($version_string, '4.7.0', '<=') |
|
70 | + && version_compare($version_string, '4.6.0', '>=') |
|
71 | + ) |
|
72 | + || ( |
|
73 | + version_compare($version_string, '4.7.0', '>=') |
|
74 | + && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
75 | + && $this->_get_table_analysis()->tableExists('esp_registration') |
|
76 | + ) |
|
77 | + ) { |
|
78 | + return true; |
|
79 | + } elseif ( ! $version_string) { |
|
80 | + //no version string provided... this must be pre 4.3 |
|
81 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | + } else { |
|
83 | + return false; |
|
84 | + } |
|
85 | + } |
|
87 | 86 | |
88 | 87 | |
89 | 88 | |
90 | - /** |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - public function schema_changes_before_migration() |
|
94 | - { |
|
95 | - //relies on 4.1's EEH_Activation::create_table |
|
96 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
97 | - $table_name = 'esp_answer'; |
|
98 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
89 | + /** |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function schema_changes_before_migration() |
|
93 | + { |
|
94 | + //relies on 4.1's EEH_Activation::create_table |
|
95 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
96 | + $table_name = 'esp_answer'; |
|
97 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
99 | 98 | REG_ID INT UNSIGNED NOT NULL, |
100 | 99 | QST_ID INT UNSIGNED NOT NULL, |
101 | 100 | ANS_value TEXT NOT NULL, |
102 | 101 | PRIMARY KEY (ANS_ID), |
103 | 102 | KEY REG_ID (REG_ID), |
104 | 103 | KEY QST_ID (QST_ID)"; |
105 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
106 | - $table_name = 'esp_attendee_meta'; |
|
107 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
104 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
105 | + $table_name = 'esp_attendee_meta'; |
|
106 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
108 | 107 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
109 | 108 | ATT_fname VARCHAR(45) NOT NULL, |
110 | 109 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -121,9 +120,9 @@ discard block |
||
121 | 120 | KEY ATT_email (ATT_email), |
122 | 121 | KEY ATT_lname (ATT_lname), |
123 | 122 | KEY ATT_fname (ATT_fname)"; |
124 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
125 | - $table_name = 'esp_country'; |
|
126 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
123 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
124 | + $table_name = 'esp_country'; |
|
125 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
127 | 126 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
128 | 127 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
129 | 128 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -139,25 +138,25 @@ discard block |
||
139 | 138 | CNT_is_EU TINYINT(1) DEFAULT '0', |
140 | 139 | CNT_active TINYINT(1) DEFAULT '0', |
141 | 140 | PRIMARY KEY (CNT_ISO)"; |
142 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | - $table_name = 'esp_currency'; |
|
144 | - $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
141 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
142 | + $table_name = 'esp_currency'; |
|
143 | + $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
145 | 144 | CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar', |
146 | 145 | CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars', |
147 | 146 | CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$', |
148 | 147 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
149 | 148 | CUR_active TINYINT(1) DEFAULT '0', |
150 | 149 | PRIMARY KEY (CUR_code)"; |
151 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | - $table_name = 'esp_currency_payment_method'; |
|
153 | - $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
150 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | + $table_name = 'esp_currency_payment_method'; |
|
152 | + $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
154 | 153 | CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
155 | 154 | PMD_ID INT(11) NOT NULL, |
156 | 155 | PRIMARY KEY (CPM_ID), |
157 | 156 | KEY PMD_ID (PMD_ID)"; |
158 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
159 | - $table_name = 'esp_datetime'; |
|
160 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
157 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
158 | + $table_name = 'esp_datetime'; |
|
159 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
161 | 160 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
162 | 161 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
163 | 162 | DTT_description TEXT NOT NULL, |
@@ -173,9 +172,9 @@ discard block |
||
173 | 172 | KEY DTT_EVT_start (DTT_EVT_start), |
174 | 173 | KEY EVT_ID (EVT_ID), |
175 | 174 | KEY DTT_is_primary (DTT_is_primary)"; |
176 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | - $table_name = 'esp_event_meta'; |
|
178 | - $sql = " |
|
175 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
176 | + $table_name = 'esp_event_meta'; |
|
177 | + $sql = " |
|
179 | 178 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
180 | 179 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
181 | 180 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -191,34 +190,34 @@ discard block |
||
191 | 190 | EVT_donations TINYINT(1) NULL, |
192 | 191 | PRIMARY KEY (EVTM_ID), |
193 | 192 | KEY EVT_ID (EVT_ID)"; |
194 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | - $table_name = 'esp_event_question_group'; |
|
196 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
193 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | + $table_name = 'esp_event_question_group'; |
|
195 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
197 | 196 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
198 | 197 | QSG_ID INT UNSIGNED NOT NULL, |
199 | 198 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
200 | 199 | PRIMARY KEY (EQG_ID), |
201 | 200 | KEY EVT_ID (EVT_ID), |
202 | 201 | KEY QSG_ID (QSG_ID)"; |
203 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | - $table_name = 'esp_event_venue'; |
|
205 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
202 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | + $table_name = 'esp_event_venue'; |
|
204 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
206 | 205 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
207 | 206 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
208 | 207 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
209 | 208 | PRIMARY KEY (EVV_ID)"; |
210 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | - $table_name = 'esp_extra_meta'; |
|
212 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
209 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
210 | + $table_name = 'esp_extra_meta'; |
|
211 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
213 | 212 | OBJ_ID INT(11) DEFAULT NULL, |
214 | 213 | EXM_type VARCHAR(45) DEFAULT NULL, |
215 | 214 | EXM_key VARCHAR(45) DEFAULT NULL, |
216 | 215 | EXM_value TEXT, |
217 | 216 | PRIMARY KEY (EXM_ID), |
218 | 217 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
219 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | - $table_name = 'esp_line_item'; |
|
221 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | + $table_name = 'esp_line_item'; |
|
220 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
222 | 221 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
223 | 222 | TXN_ID INT(11) DEFAULT NULL, |
224 | 223 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -236,9 +235,9 @@ discard block |
||
236 | 235 | PRIMARY KEY (LIN_ID), |
237 | 236 | KEY LIN_code (LIN_code(191)), |
238 | 237 | KEY TXN_ID (TXN_ID)"; |
239 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
240 | - $table_name = 'esp_log'; |
|
241 | - $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
238 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | + $table_name = 'esp_log'; |
|
240 | + $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
242 | 241 | LOG_time DATETIME DEFAULT NULL, |
243 | 242 | OBJ_ID VARCHAR(45) DEFAULT NULL, |
244 | 243 | OBJ_type VARCHAR(45) DEFAULT NULL, |
@@ -249,18 +248,18 @@ discard block |
||
249 | 248 | KEY LOG_time (LOG_time), |
250 | 249 | KEY OBJ (OBJ_type,OBJ_ID), |
251 | 250 | KEY LOG_type (LOG_type)"; |
252 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
253 | - $table_name = 'esp_message_template'; |
|
254 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
251 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
252 | + $table_name = 'esp_message_template'; |
|
253 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
255 | 254 | GRP_ID INT(10) UNSIGNED NOT NULL, |
256 | 255 | MTP_context VARCHAR(50) NOT NULL, |
257 | 256 | MTP_template_field VARCHAR(30) NOT NULL, |
258 | 257 | MTP_content TEXT NOT NULL, |
259 | 258 | PRIMARY KEY (MTP_ID), |
260 | 259 | KEY GRP_ID (GRP_ID)"; |
261 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | - $table_name = 'esp_message_template_group'; |
|
263 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
260 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
261 | + $table_name = 'esp_message_template_group'; |
|
262 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
264 | 263 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
265 | 264 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
266 | 265 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -272,17 +271,17 @@ discard block |
||
272 | 271 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
273 | 272 | PRIMARY KEY (GRP_ID), |
274 | 273 | KEY MTP_user_id (MTP_user_id)"; |
275 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
276 | - $table_name = 'esp_event_message_template'; |
|
277 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
274 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | + $table_name = 'esp_event_message_template'; |
|
276 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
278 | 277 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
279 | 278 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
280 | 279 | PRIMARY KEY (EMT_ID), |
281 | 280 | KEY EVT_ID (EVT_ID), |
282 | 281 | KEY GRP_ID (GRP_ID)"; |
283 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
284 | - $table_name = 'esp_payment'; |
|
285 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
282 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
283 | + $table_name = 'esp_payment'; |
|
284 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
286 | 285 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
287 | 286 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
288 | 287 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -299,9 +298,9 @@ discard block |
||
299 | 298 | PRIMARY KEY (PAY_ID), |
300 | 299 | KEY PAY_timestamp (PAY_timestamp), |
301 | 300 | KEY TXN_ID (TXN_ID)"; |
302 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
303 | - $table_name = 'esp_payment_method'; |
|
304 | - $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
301 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
302 | + $table_name = 'esp_payment_method'; |
|
303 | + $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
305 | 304 | PMD_type VARCHAR(124) DEFAULT NULL, |
306 | 305 | PMD_name VARCHAR(255) DEFAULT NULL, |
307 | 306 | PMD_desc TEXT, |
@@ -317,32 +316,32 @@ discard block |
||
317 | 316 | PRIMARY KEY (PMD_ID), |
318 | 317 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
319 | 318 | KEY PMD_type (PMD_type)"; |
320 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
321 | - $table_name = "esp_ticket_price"; |
|
322 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
319 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
320 | + $table_name = "esp_ticket_price"; |
|
321 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
323 | 322 | TKT_ID INT(10) UNSIGNED NOT NULL, |
324 | 323 | PRC_ID INT(10) UNSIGNED NOT NULL, |
325 | 324 | PRIMARY KEY (TKP_ID), |
326 | 325 | KEY TKT_ID (TKT_ID), |
327 | 326 | KEY PRC_ID (PRC_ID)"; |
328 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
329 | - $table_name = "esp_datetime_ticket"; |
|
330 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
327 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
328 | + $table_name = "esp_datetime_ticket"; |
|
329 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
331 | 330 | DTT_ID INT(10) UNSIGNED NOT NULL, |
332 | 331 | TKT_ID INT(10) UNSIGNED NOT NULL, |
333 | 332 | PRIMARY KEY (DTK_ID), |
334 | 333 | KEY DTT_ID (DTT_ID), |
335 | 334 | KEY TKT_ID (TKT_ID)"; |
336 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
337 | - $table_name = "esp_ticket_template"; |
|
338 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
335 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | + $table_name = "esp_ticket_template"; |
|
337 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
339 | 338 | TTM_name VARCHAR(45) NOT NULL, |
340 | 339 | TTM_description TEXT, |
341 | 340 | TTM_file VARCHAR(45), |
342 | 341 | PRIMARY KEY (TTM_ID)"; |
343 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | - $table_name = 'esp_question'; |
|
345 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
342 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
343 | + $table_name = 'esp_question'; |
|
344 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
346 | 345 | QST_display_text TEXT NOT NULL, |
347 | 346 | QST_admin_label VARCHAR(255) NOT NULL, |
348 | 347 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -355,18 +354,18 @@ discard block |
||
355 | 354 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
356 | 355 | PRIMARY KEY (QST_ID), |
357 | 356 | KEY QST_order (QST_order)'; |
358 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
359 | - $table_name = 'esp_question_group_question'; |
|
360 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
357 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | + $table_name = 'esp_question_group_question'; |
|
359 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
361 | 360 | QSG_ID INT UNSIGNED NOT NULL, |
362 | 361 | QST_ID INT UNSIGNED NOT NULL, |
363 | 362 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
364 | 363 | PRIMARY KEY (QGQ_ID), |
365 | 364 | KEY QST_ID (QST_ID), |
366 | 365 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
367 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
368 | - $table_name = 'esp_question_option'; |
|
369 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
366 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | + $table_name = 'esp_question_option'; |
|
368 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
370 | 369 | QSO_value VARCHAR(255) NOT NULL, |
371 | 370 | QSO_desc TEXT NOT NULL, |
372 | 371 | QST_ID INT UNSIGNED NOT NULL, |
@@ -375,9 +374,9 @@ discard block |
||
375 | 374 | PRIMARY KEY (QSO_ID), |
376 | 375 | KEY QST_ID (QST_ID), |
377 | 376 | KEY QSO_order (QSO_order)"; |
378 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
379 | - $table_name = 'esp_registration'; |
|
380 | - $sql = "REG_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_registration'; |
|
379 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 380 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
382 | 381 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
383 | 382 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -401,18 +400,18 @@ discard block |
||
401 | 400 | KEY TKT_ID (TKT_ID), |
402 | 401 | KEY EVT_ID (EVT_ID), |
403 | 402 | KEY STS_ID (STS_ID)"; |
404 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
405 | - $table_name = 'esp_registration_payment'; |
|
406 | - $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
403 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | + $table_name = 'esp_registration_payment'; |
|
405 | + $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
407 | 406 | REG_ID INT(10) UNSIGNED NOT NULL, |
408 | 407 | PAY_ID INT(10) UNSIGNED NULL, |
409 | 408 | RPY_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
410 | 409 | PRIMARY KEY (RPY_ID), |
411 | 410 | KEY REG_ID (REG_ID), |
412 | 411 | KEY PAY_ID (PAY_ID)"; |
413 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
414 | - $table_name = 'esp_checkin'; |
|
415 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
412 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
413 | + $table_name = 'esp_checkin'; |
|
414 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
416 | 415 | REG_ID INT(10) UNSIGNED NOT NULL, |
417 | 416 | DTT_ID INT(10) UNSIGNED NOT NULL, |
418 | 417 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -420,9 +419,9 @@ discard block |
||
420 | 419 | PRIMARY KEY (CHK_ID), |
421 | 420 | KEY REG_ID (REG_ID), |
422 | 421 | KEY DTT_ID (DTT_ID)"; |
423 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
424 | - $table_name = 'esp_state'; |
|
425 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
422 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
423 | + $table_name = 'esp_state'; |
|
424 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
426 | 425 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
427 | 426 | STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL, |
428 | 427 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
@@ -430,9 +429,9 @@ discard block |
||
430 | 429 | PRIMARY KEY (STA_ID), |
431 | 430 | KEY STA_abbrev (STA_abbrev), |
432 | 431 | KEY CNT_ISO (CNT_ISO)"; |
433 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
434 | - $table_name = 'esp_status'; |
|
435 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | + $table_name = 'esp_status'; |
|
434 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
436 | 435 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
437 | 436 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
438 | 437 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -440,9 +439,9 @@ discard block |
||
440 | 439 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
441 | 440 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
442 | 441 | KEY STS_type (STS_type)"; |
443 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
444 | - $table_name = 'esp_transaction'; |
|
445 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
442 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | + $table_name = 'esp_transaction'; |
|
444 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
446 | 445 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
447 | 446 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
448 | 447 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -454,9 +453,9 @@ discard block |
||
454 | 453 | PRIMARY KEY (TXN_ID), |
455 | 454 | KEY TXN_timestamp (TXN_timestamp), |
456 | 455 | KEY STS_ID (STS_ID)"; |
457 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
458 | - $table_name = 'esp_venue_meta'; |
|
459 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
456 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
457 | + $table_name = 'esp_venue_meta'; |
|
458 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
460 | 459 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
461 | 460 | VNU_address VARCHAR(255) DEFAULT NULL, |
462 | 461 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -475,10 +474,10 @@ discard block |
||
475 | 474 | KEY VNU_ID (VNU_ID), |
476 | 475 | KEY STA_ID (STA_ID), |
477 | 476 | KEY CNT_ISO (CNT_ISO)"; |
478 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
479 | - //modified tables |
|
480 | - $table_name = "esp_price"; |
|
481 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
477 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
478 | + //modified tables |
|
479 | + $table_name = "esp_price"; |
|
480 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
482 | 481 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
483 | 482 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
484 | 483 | PRC_name VARCHAR(245) NOT NULL, |
@@ -491,9 +490,9 @@ discard block |
||
491 | 490 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
492 | 491 | PRIMARY KEY (PRC_ID), |
493 | 492 | KEY PRT_ID (PRT_ID)"; |
494 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
495 | - $table_name = "esp_price_type"; |
|
496 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
493 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
494 | + $table_name = "esp_price_type"; |
|
495 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
497 | 496 | PRT_name VARCHAR(45) NOT NULL, |
498 | 497 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
499 | 498 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -502,9 +501,9 @@ discard block |
||
502 | 501 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
503 | 502 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
504 | 503 | PRIMARY KEY (PRT_ID)"; |
505 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
506 | - $table_name = "esp_ticket"; |
|
507 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
504 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
505 | + $table_name = "esp_ticket"; |
|
506 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
508 | 507 | TTM_ID INT(10) UNSIGNED NOT NULL, |
509 | 508 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
510 | 509 | TKT_description TEXT NOT NULL, |
@@ -526,9 +525,9 @@ discard block |
||
526 | 525 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
527 | 526 | PRIMARY KEY (TKT_ID), |
528 | 527 | KEY TKT_start_date (TKT_start_date)"; |
529 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
530 | - $table_name = 'esp_question_group'; |
|
531 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
528 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
529 | + $table_name = 'esp_question_group'; |
|
530 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
532 | 531 | QSG_name VARCHAR(255) NOT NULL, |
533 | 532 | QSG_identifier VARCHAR(100) NOT NULL, |
534 | 533 | QSG_desc TEXT NULL, |
@@ -541,38 +540,38 @@ discard block |
||
541 | 540 | PRIMARY KEY (QSG_ID), |
542 | 541 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
543 | 542 | KEY QSG_order (QSG_order)'; |
544 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
545 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
546 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
547 | - //(because many need to convert old string states to foreign keys into the states table) |
|
548 | - $script_4_1_defaults->insert_default_states(); |
|
549 | - $script_4_1_defaults->insert_default_countries(); |
|
550 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
551 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
552 | - $script_4_5_defaults->insert_default_price_types(); |
|
553 | - $script_4_5_defaults->insert_default_prices(); |
|
554 | - $script_4_5_defaults->insert_default_tickets(); |
|
555 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
556 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
557 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
558 | - $script_4_6_defaults->insert_default_currencies(); |
|
559 | - return true; |
|
560 | - } |
|
543 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
544 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
545 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
546 | + //(because many need to convert old string states to foreign keys into the states table) |
|
547 | + $script_4_1_defaults->insert_default_states(); |
|
548 | + $script_4_1_defaults->insert_default_countries(); |
|
549 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
550 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
551 | + $script_4_5_defaults->insert_default_price_types(); |
|
552 | + $script_4_5_defaults->insert_default_prices(); |
|
553 | + $script_4_5_defaults->insert_default_tickets(); |
|
554 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
555 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
556 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
557 | + $script_4_6_defaults->insert_default_currencies(); |
|
558 | + return true; |
|
559 | + } |
|
561 | 560 | |
562 | 561 | |
563 | 562 | |
564 | - /** |
|
565 | - * @return boolean |
|
566 | - */ |
|
567 | - public function schema_changes_after_migration() |
|
568 | - { |
|
569 | - return true; |
|
570 | - } |
|
563 | + /** |
|
564 | + * @return boolean |
|
565 | + */ |
|
566 | + public function schema_changes_after_migration() |
|
567 | + { |
|
568 | + return true; |
|
569 | + } |
|
571 | 570 | |
572 | 571 | |
573 | 572 | |
574 | - public function migration_page_hooks() |
|
575 | - { |
|
576 | - } |
|
573 | + public function migration_page_hooks() |
|
574 | + { |
|
575 | + } |
|
577 | 576 | } |
578 | 577 | // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php |
579 | 578 | \ No newline at end of file |
@@ -5,39 +5,39 @@ discard block |
||
5 | 5 | /** @type string $reset_db_action_url */ |
6 | 6 | /** @type EE_Data_Migration_Script_Base $most_recent_migration */ |
7 | 7 | ?> |
8 | -<?php if ( $success ) { ?> |
|
9 | - <h1><?php _e( "Database Update Crash Report Sent", "event_espresso" ); ?></h1> |
|
10 | - <p><?php _e( "A crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso" ); ?></p> |
|
8 | +<?php if ($success) { ?> |
|
9 | + <h1><?php _e("Database Update Crash Report Sent", "event_espresso"); ?></h1> |
|
10 | + <p><?php _e("A crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso"); ?></p> |
|
11 | 11 | <?php } else {//didn't send email properly ?> |
12 | - <h1><?php _e( "Migration Report not sent", "event_espresso" ); ?></h1> |
|
13 | - <p><?php _e( "An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso" ); ?></p> |
|
14 | - <p><?php printf( esc_html__( "Please copy-and-paste the system information below to %s", "event_espresso" ), '<a href="mailto:' . EE_SUPPORT_EMAIL . '">' .EE_SUPPORT_EMAIL . "</a>" ); ?></p> |
|
12 | + <h1><?php _e("Migration Report not sent", "event_espresso"); ?></h1> |
|
13 | + <p><?php _e("An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso"); ?></p> |
|
14 | + <p><?php printf(esc_html__("Please copy-and-paste the system information below to %s", "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">'.EE_SUPPORT_EMAIL."</a>"); ?></p> |
|
15 | 15 | <label> |
16 | - <?php _e( "system status info", "event_espresso" ); ?> |
|
17 | - <textarea name="system_status_info" class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati() ); ?></textarea> |
|
16 | + <?php _e("system status info", "event_espresso"); ?> |
|
17 | + <textarea name="system_status_info" class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati()); ?></textarea> |
|
18 | 18 | </label> |
19 | 19 | <?php } ?> |
20 | 20 | |
21 | 21 | |
22 | -<h1><?php _e( "What's next?", 'event_espresso' ); ?></h1> |
|
23 | -<p><?php _e( "Well, it depends on your situation:", 'event_espresso' ); ?></p> |
|
22 | +<h1><?php _e("What's next?", 'event_espresso'); ?></h1> |
|
23 | +<p><?php _e("Well, it depends on your situation:", 'event_espresso'); ?></p> |
|
24 | 24 | <div class='ee-table-wrap'> |
25 | 25 | <table> |
26 | 26 | <thead> |
27 | 27 | <tr> |
28 | - <th><?php _e( "Your Situation", 'event_espresso' ); ?></th> |
|
29 | - <th><?php _e( "Suggested Action", 'event_espresso' ); ?></th> |
|
28 | + <th><?php _e("Your Situation", 'event_espresso'); ?></th> |
|
29 | + <th><?php _e("Suggested Action", 'event_espresso'); ?></th> |
|
30 | 30 | </tr> |
31 | 31 | </thead> |
32 | 32 | <tbody> |
33 | 33 | <tr> |
34 | - <td><p class='big-text'><?php _e( "I want to retry migrating my data", 'event_espresso' ); ?></p></td> |
|
34 | + <td><p class='big-text'><?php _e("I want to retry migrating my data", 'event_espresso'); ?></p></td> |
|
35 | 35 | <td> |
36 | 36 | <p> |
37 | 37 | <?php |
38 | 38 | printf( |
39 | - esc_html__( 'First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.', 'event_espresso' ), |
|
40 | - "<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>", |
|
39 | + esc_html__('First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.', 'event_espresso'), |
|
40 | + "<a href='".EE_SUPPORT_EMAIL."' target='_blank'>", |
|
41 | 41 | '</a>', |
42 | 42 | '<pre lang="php">define( EE_MIGRATION_STEP_SIZE, 10 );</pre>', |
43 | 43 | '<b>', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | <p> |
50 | 50 | <?php |
51 | 51 | printf( |
52 | - esc_html__( 'To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso' ), |
|
52 | + esc_html__('To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso'), |
|
53 | 53 | "<a href='$reset_db_page_url'>", |
54 | 54 | "</a>", |
55 | 55 | "<a class='button-primary' href='$reattempt_action_url'>" |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | </tr> |
61 | 61 | <tr> |
62 | 62 | <td> |
63 | - <p class='big-text'><?php _e( "I want to hear from Support before proceeding", 'event_espresso' ); ?></p> |
|
63 | + <p class='big-text'><?php _e("I want to hear from Support before proceeding", 'event_espresso'); ?></p> |
|
64 | 64 | </td> |
65 | 65 | <td> |
66 | 66 | <?php |
67 | 67 | printf( |
68 | - esc_html__( 'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso' ), |
|
69 | - "<a href='" . EE_SUPPORT_EMAIL . "'>", |
|
68 | + esc_html__('Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso'), |
|
69 | + "<a href='".EE_SUPPORT_EMAIL."'>", |
|
70 | 70 | "</a>" |
71 | 71 | ); |
72 | 72 | ?> |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | </tr> |
75 | 75 | <tr> |
76 | 76 | <td> |
77 | - <p class='big-text'><?php printf( esc_html__( 'I don\'t need my old EE %s data', 'event_espresso' ), $most_recent_migration->slug() ); ?></p> |
|
77 | + <p class='big-text'><?php printf(esc_html__('I don\'t need my old EE %s data', 'event_espresso'), $most_recent_migration->slug()); ?></p> |
|
78 | 78 | </td> |
79 | 79 | <td> |
80 | 80 | <?php |
81 | 81 | printf( |
82 | - esc_html__( 'If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s', 'event_espresso' ), |
|
82 | + esc_html__('If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s', 'event_espresso'), |
|
83 | 83 | $most_recent_migration->slug(), |
84 | 84 | "<a id='do-not-migrate' class='do-not-migrate button-primary' href='$reset_db_action_url'>", |
85 | 85 | "</a>" |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | </tr> |
90 | 90 | <tr> |
91 | 91 | <td> |
92 | - <p class='big-text'><?php printf( esc_html__( 'I want to go back to my old version of EE %1$s', 'event_espresso' ), $most_recent_migration->slug() ); ?> |
|
92 | + <p class='big-text'><?php printf(esc_html__('I want to go back to my old version of EE %1$s', 'event_espresso'), $most_recent_migration->slug()); ?> |
|
93 | 93 | </td> |
94 | 94 | <td> |
95 | 95 | <p> |
96 | 96 | <?php |
97 | 97 | printf( |
98 | - esc_html__( 'Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso' ), |
|
98 | + esc_html__('Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso'), |
|
99 | 99 | "<a href='$reset_db_page_url'>", |
100 | 100 | "</a>", |
101 | 101 | $most_recent_migration->slug() |
102 | 102 | ); |
103 | 103 | ?> |
104 | 104 | </p> |
105 | - <p><?php _e( "If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso' ); ?></p> |
|
105 | + <p><?php _e("If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso'); ?></p> |
|
106 | 106 | </td> |
107 | 107 | </tr> |
108 | 108 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | ?> |
4 | -<h1><?php esc_html_e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso");?></h1> |
|
5 | -<p><?php printf(esc_html__("Please %s visit the plugins page%s and update all Event Espresso addon plugins before updating your database.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>","</a>");?></p> |
|
6 | -<p><?php esc_html_e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso");?></p> |
|
7 | 4 | \ No newline at end of file |
5 | +<h1><?php esc_html_e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso"); ?></h1> |
|
6 | +<p><?php printf(esc_html__("Please %s visit the plugins page%s and update all Event Espresso addon plugins before updating your database.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>", "</a>"); ?></p> |
|
7 | +<p><?php esc_html_e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso"); ?></p> |
|
8 | 8 | \ No newline at end of file |
@@ -28,29 +28,29 @@ discard block |
||
28 | 28 | <h3 class="espresso-header"> |
29 | 29 | <span class="dashicons dashicons-flag ee-icon-size-22"></span> |
30 | 30 | <?php |
31 | - echo apply_filters( |
|
32 | - 'FHEE__ee_migration_page__header', |
|
33 | - sprintf( |
|
34 | - esc_html__("Your Event Espresso data needs to be updated.", "event_espresso"), |
|
35 | - $current_db_state, |
|
36 | - $next_db_state |
|
37 | - ), |
|
38 | - $current_db_state, |
|
39 | - $next_db_state |
|
40 | - ); |
|
41 | - ?> |
|
31 | + echo apply_filters( |
|
32 | + 'FHEE__ee_migration_page__header', |
|
33 | + sprintf( |
|
34 | + esc_html__("Your Event Espresso data needs to be updated.", "event_espresso"), |
|
35 | + $current_db_state, |
|
36 | + $next_db_state |
|
37 | + ), |
|
38 | + $current_db_state, |
|
39 | + $next_db_state |
|
40 | + ); |
|
41 | + ?> |
|
42 | 42 | </h3> |
43 | 43 | <?php } elseif ($show_most_recent_migration) { ?> |
44 | 44 | <h3 class="espresso-header"> |
45 | 45 | <span class="dashicons dashicons-awards ee-icon-size-22"></span> |
46 | 46 | <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header', |
47 | - sprintf(esc_html__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', |
|
48 | - "event_espresso"), $ultimate_db_state)); ?> |
|
47 | + sprintf(esc_html__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', |
|
48 | + "event_espresso"), $ultimate_db_state)); ?> |
|
49 | 49 | </h3> |
50 | 50 | <p> |
51 | 51 | <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header', |
52 | - sprintf(esc_html__("Time to find out about all the great new features %s has to offer.", |
|
53 | - "event_espresso"), $ultimate_db_state)); ?> |
|
52 | + sprintf(esc_html__("Time to find out about all the great new features %s has to offer.", |
|
53 | + "event_espresso"), $ultimate_db_state)); ?> |
|
54 | 54 | <b><a id="get-started-after-migrate" class="button-primary" |
55 | 55 | href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>"> |
56 | 56 | <?php esc_html_e("Let's Get Started", "event_espresso"); ?> <span |
@@ -61,34 +61,34 @@ discard block |
||
61 | 61 | |
62 | 62 | |
63 | 63 | <?php if ($show_backup_db_text) { |
64 | - echo $migration_options_html; |
|
65 | - } ?> |
|
64 | + echo $migration_options_html; |
|
65 | + } ?> |
|
66 | 66 | |
67 | 67 | <?php |
68 | - if ($show_most_recent_migration) { |
|
69 | - if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) { |
|
70 | - if ($most_recent_migration->can_continue()) { |
|
71 | - //tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?> |
|
68 | + if ($show_most_recent_migration) { |
|
69 | + if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) { |
|
70 | + if ($most_recent_migration->can_continue()) { |
|
71 | + //tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?> |
|
72 | 72 | <h3 class="espresso-header"> |
73 | 73 | <span class="dashicons dashicons-star-half ee-icon-size-22"></span> |
74 | 74 | <?php printf(esc_html__("It appears that your previous Database Update (%s) is incomplete, and should be resumed", |
75 | - "event_espresso"), $most_recent_migration->pretty_name()); ?> |
|
75 | + "event_espresso"), $most_recent_migration->pretty_name()); ?> |
|
76 | 76 | </h3> |
77 | 77 | <?php } elseif ($most_recent_migration->is_broken()) { |
78 | - //tell the user the migration failed and they should notify EE?> |
|
78 | + //tell the user the migration failed and they should notify EE?> |
|
79 | 79 | <h3 class="espresso-header"> |
80 | 80 | <span class="dashicons dashicons-no ee-icon-size-22"></span> |
81 | 81 | <?php echo $most_recent_migration->get_feedback_message() ?> |
82 | 82 | </h3> |
83 | 83 | <?php } |
84 | - //display errors or not of the most recent migration ran |
|
85 | - if ($most_recent_migration->get_errors()) { ?> |
|
84 | + //display errors or not of the most recent migration ran |
|
85 | + if ($most_recent_migration->get_errors()) { ?> |
|
86 | 86 | <div class="ee-attention"> |
87 | 87 | <strong><?php printf(esc_html__("Warnings occurred during your last Database Update (%s):", |
88 | - 'event_espresso'), |
|
89 | - $most_recent_migration->pretty_name()) ?></strong> |
|
88 | + 'event_espresso'), |
|
89 | + $most_recent_migration->pretty_name()) ?></strong> |
|
90 | 90 | <a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Warnings", |
91 | - 'event_espresso'); ?></a> |
|
91 | + 'event_espresso'); ?></a> |
|
92 | 92 | <ul class="migration-warnings" style="display:none"> |
93 | 93 | <?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
94 | 94 | <li><?php echo htmlentities($error) ?></li> |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | </ul> |
97 | 97 | </div> |
98 | 98 | <?php } else { |
99 | - //there were no errors during the last migration, just say so?> |
|
99 | + //there were no errors during the last migration, just say so?> |
|
100 | 100 | <h2><?php printf(esc_html__("The last Database Update (%s) ran successfully without errors.", |
101 | - "event_espresso"), $most_recent_migration->pretty_name()) ?></h2> |
|
101 | + "event_espresso"), $most_recent_migration->pretty_name()) ?></h2> |
|
102 | 102 | <?php } |
103 | - } else { |
|
104 | - } |
|
105 | - } |
|
106 | - // end of: if ( $show_most_recent_migration ) |
|
107 | - ?> |
|
103 | + } else { |
|
104 | + } |
|
105 | + } |
|
106 | + // end of: if ( $show_most_recent_migration ) |
|
107 | + ?> |
|
108 | 108 | |
109 | 109 | </div> |
110 | 110 | <!--end of #migration-prep--> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | <div id='progress-area'> |
125 | 125 | <h3 class="espresso-header"> |
126 | 126 | <?php |
127 | - echo sprintf(_n( |
|
128 | - "The following task needs to be performed:", |
|
129 | - "The following %s tasks need to be performed:", |
|
130 | - count($script_names), |
|
131 | - "event_espresso" |
|
132 | - ), count($script_names)); ?> |
|
127 | + echo sprintf(_n( |
|
128 | + "The following task needs to be performed:", |
|
129 | + "The following %s tasks need to be performed:", |
|
130 | + count($script_names), |
|
131 | + "event_espresso" |
|
132 | + ), count($script_names)); ?> |
|
133 | 133 | </h3> |
134 | 134 | <ul style="list-style: inside;"> |
135 | 135 | <?php foreach ($script_names as $script_name) { ?> |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | <br/> |
140 | 140 | <?php if (count($script_names) > 1) { ?> |
141 | 141 | <p><?php esc_html_e("Please note: after each task is completed you will need to continue the Database Update, or report an error to Event Espresso.", |
142 | - "event_espresso"); ?></p> |
|
142 | + "event_espresso"); ?></p> |
|
143 | 143 | <?php } ?> |
144 | 144 | |
145 | 145 | <div class="ee-attention"> |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | </span> |
150 | 150 | <br/> |
151 | 151 | <?php esc_html_e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", |
152 | - "event_espresso"); ?> |
|
152 | + "event_espresso"); ?> |
|
153 | 153 | </p> |
154 | 154 | <p> |
155 | 155 | <?php printf(esc_html__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", |
156 | - "event_espresso"), '<strong>', '</strong>'); ?> |
|
156 | + "event_espresso"), '<strong>', '</strong>'); ?> |
|
157 | 157 | </p> |
158 | 158 | <p> |
159 | 159 | <?php esc_html_e("Click the button below to begin the migration process.", "event_espresso") ?> |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | |
170 | 170 | <button id='start-migration' class='button-primary'> |
171 | 171 | <?php echo $show_continue_current_migration_script ? esc_html__("Continue Database Update", |
172 | - "event_espresso") |
|
173 | - : esc_html__("Begin Database Update", "event_espresso"); ?> |
|
172 | + "event_espresso") |
|
173 | + : esc_html__("Begin Database Update", "event_espresso"); ?> |
|
174 | 174 | </button> |
175 | 175 | <br class="clear"/> |
176 | 176 | |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | </div> |
187 | 187 | |
188 | 188 | <?php } |
189 | - if ($show_maintenance_switch) { |
|
190 | - ?> |
|
189 | + if ($show_maintenance_switch) { |
|
190 | + ?> |
|
191 | 191 | <h2><span class="dashicons dashicons-admin-tools"></span><?php esc_html_e('Set Event Espresso Maintenance Mode', |
192 | - 'event_espresso'); ?></h2> |
|
192 | + 'event_espresso'); ?></h2> |
|
193 | 193 | <form method='post' action='<?php echo $update_migration_script_page_link ?>'> |
194 | 194 | <div class="ee-table-wrap"> |
195 | 195 | <table> |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | <td width="40px" align="center"> |
198 | 198 | <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level" |
199 | 199 | value="0" <?php echo EE_Maintenance_Mode::instance()->level() |
200 | - == EE_Maintenance_Mode::level_0_not_in_maintenance |
|
201 | - ? 'checked="checked"' : '' ?>> |
|
200 | + == EE_Maintenance_Mode::level_0_not_in_maintenance |
|
201 | + ? 'checked="checked"' : '' ?>> |
|
202 | 202 | </td> |
203 | 203 | <th align="left"> |
204 | 204 | <label for="maintenance_mode_level_off"><?php esc_html_e('Maintenance Mode OFF', |
205 | - 'event_espresso'); ?></label> |
|
205 | + 'event_espresso'); ?></label> |
|
206 | 206 | <p class='description' style="font-weight: normal;"> |
207 | 207 | <?php esc_html_e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", |
208 | - "event_espresso"); ?> |
|
208 | + "event_espresso"); ?> |
|
209 | 209 | </p> |
210 | 210 | </th> |
211 | 211 | </tr> |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | <td width="40px" align="center"> |
214 | 214 | <input type="radio" id="maintenance_mode_level_on" name="maintenance_mode_level" |
215 | 215 | value="1" <?php echo EE_Maintenance_Mode::instance()->level() |
216 | - == EE_Maintenance_Mode::level_1_frontend_only_maintenance |
|
217 | - ? 'checked="checked"' : '' ?>> |
|
216 | + == EE_Maintenance_Mode::level_1_frontend_only_maintenance |
|
217 | + ? 'checked="checked"' : '' ?>> |
|
218 | 218 | </td> |
219 | 219 | <th align="left"> |
220 | 220 | <label for="maintenance_mode_level_on"> |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | </label> |
223 | 223 | <p class='description' style="font-weight: normal;"> |
224 | 224 | <?php esc_html_e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", |
225 | - "event_espresso"); ?> |
|
225 | + "event_espresso"); ?> |
|
226 | 226 | </p> |
227 | 227 | </th> |
228 | 228 | </tr> |
@@ -234,6 +234,6 @@ discard block |
||
234 | 234 | </p> |
235 | 235 | </form> |
236 | 236 | <?php |
237 | - } ?> |
|
237 | + } ?> |
|
238 | 238 | |
239 | 239 | </div> |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | ?> |
4 | -<h1><?php esc_html_e("Data Migration Error", "event_espresso");?></h1> |
|
5 | -<p class='error'><?php printf(esc_html__("Your last Database Update had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"),"<b>","</b>");?></p> |
|
6 | -<a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Errors", 'event_espresso');?></a> |
|
4 | +<h1><?php esc_html_e("Data Migration Error", "event_espresso"); ?></h1> |
|
5 | +<p class='error'><?php printf(esc_html__("Your last Database Update had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"), "<b>", "</b>"); ?></p> |
|
6 | +<a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Errors", 'event_espresso'); ?></a> |
|
7 | 7 | <ul class="migration-warnings" style="display:none"> |
8 | -<?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
8 | +<?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
9 | 9 | <li style="overflow-y:auto;max-height:100px"><?php echo esc_html($error)?></li> |
10 | 10 | <?php }?> |
11 | 11 | </ul> |
12 | -<h2><?php esc_html_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");?></h2> |
|
13 | -<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);?>' method='post'> |
|
12 | +<h2><?php esc_html_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso"); ?></h2> |
|
13 | +<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL); ?>' method='post'> |
|
14 | 14 | <table class='widefat'> |
15 | - <tr><td><label for='from'><?php esc_html_e("From/Reply-To:", "event_espresso");?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email','display'); ?>'></td></tr> |
|
16 | - <tr><td><label for='from_name'><?php esc_html_e("Your Name", "event_espresso");?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(esc_html__("Admin of %s", "event_espresso"),get_bloginfo('name','display'));?>'></td></tr> |
|
17 | - <tr><td><label for='body'><?php esc_html_e("Comments", "event_espresso");?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php esc_html_e("Enter any comments about why you think the error may have occurred", "event_espresso");?></textarea> |
|
18 | - <p class='description'><?php esc_html_e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso");?></p></td></tr> |
|
19 | - <tr><td colspan="2"><input type="submit" value="<?php esc_html_e("Mail Crash Report to Event Espresso", "event_espresso");?>"/></td></tr> |
|
15 | + <tr><td><label for='from'><?php esc_html_e("From/Reply-To:", "event_espresso"); ?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email', 'display'); ?>'></td></tr> |
|
16 | + <tr><td><label for='from_name'><?php esc_html_e("Your Name", "event_espresso"); ?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(esc_html__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display')); ?>'></td></tr> |
|
17 | + <tr><td><label for='body'><?php esc_html_e("Comments", "event_espresso"); ?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php esc_html_e("Enter any comments about why you think the error may have occurred", "event_espresso"); ?></textarea> |
|
18 | + <p class='description'><?php esc_html_e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso"); ?></p></td></tr> |
|
19 | + <tr><td colspan="2"><input type="submit" value="<?php esc_html_e("Mail Crash Report to Event Espresso", "event_espresso"); ?>"/></td></tr> |
|
20 | 20 | </table> |
21 | 21 | </form> |
22 | 22 | <br> |
23 | -<p><?php printf(esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),'<a href="mailto:'.EE_SUPPORT_EMAIL.'">',EE_SUPPORT_EMAIL,"</a>");?></p> |
|
24 | -<textarea class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati())?></textarea> |
|
25 | -<p><?php printf( esc_html__( '%1$sNext Step%2$s', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p> |
|
26 | -<p><?php printf( esc_html__( '...or %1$sDON\'T send crash report%2$s.', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p> |
|
23 | +<p><?php printf(esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">', EE_SUPPORT_EMAIL, "</a>"); ?></p> |
|
24 | +<textarea class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati())?></textarea> |
|
25 | +<p><?php printf(esc_html__('%1$sNext Step%2$s', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p> |
|
26 | +<p><?php printf(esc_html__('...or %1$sDON\'T send crash report%2$s.', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p> |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * _get_transaction_and_cart_for_previous_visit |
782 | 782 | * |
783 | 783 | * @access private |
784 | - * @return mixed EE_Transaction|NULL |
|
784 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
785 | 785 | */ |
786 | 786 | private function _get_transaction_and_cart_for_previous_visit() |
787 | 787 | { |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
864 | 864 | * |
865 | 865 | * @access private |
866 | - * @return mixed EE_Transaction|NULL |
|
866 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
867 | 867 | */ |
868 | 868 | private function _initialize_transaction() |
869 | 869 | { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
7 | 7 | |
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
9 | - exit('No direct script access allowed'); |
|
9 | + exit('No direct script access allowed'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | |
@@ -21,1841 +21,1841 @@ discard block |
||
21 | 21 | class EED_Single_Page_Checkout extends EED_Module |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * $_initialized - has the SPCO controller already been initialized ? |
|
26 | - * |
|
27 | - * @access private |
|
28 | - * @var bool $_initialized |
|
29 | - */ |
|
30 | - private static $_initialized = false; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * $_checkout_verified - is the EE_Checkout verified as correct for this request ? |
|
35 | - * |
|
36 | - * @access private |
|
37 | - * @var bool $_valid_checkout |
|
38 | - */ |
|
39 | - private static $_checkout_verified = true; |
|
40 | - |
|
41 | - /** |
|
42 | - * $_reg_steps_array - holds initial array of reg steps |
|
43 | - * |
|
44 | - * @access private |
|
45 | - * @var array $_reg_steps_array |
|
46 | - */ |
|
47 | - private static $_reg_steps_array = array(); |
|
48 | - |
|
49 | - /** |
|
50 | - * $checkout - EE_Checkout object for handling the properties of the current checkout process |
|
51 | - * |
|
52 | - * @access public |
|
53 | - * @var EE_Checkout $checkout |
|
54 | - */ |
|
55 | - public $checkout; |
|
56 | - |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * @return EED_Module|EED_Single_Page_Checkout |
|
61 | - */ |
|
62 | - public static function instance() |
|
63 | - { |
|
64 | - add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
65 | - return parent::get_instance(__CLASS__); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * @return EE_CART |
|
72 | - */ |
|
73 | - public function cart() |
|
74 | - { |
|
75 | - return $this->checkout->cart; |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @return EE_Transaction |
|
82 | - */ |
|
83 | - public function transaction() |
|
84 | - { |
|
85 | - return $this->checkout->transaction; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
92 | - * |
|
93 | - * @access public |
|
94 | - * @return void |
|
95 | - * @throws EE_Error |
|
96 | - */ |
|
97 | - public static function set_hooks() |
|
98 | - { |
|
99 | - EED_Single_Page_Checkout::set_definitions(); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
106 | - * |
|
107 | - * @access public |
|
108 | - * @return void |
|
109 | - * @throws EE_Error |
|
110 | - */ |
|
111 | - public static function set_hooks_admin() |
|
112 | - { |
|
113 | - EED_Single_Page_Checkout::set_definitions(); |
|
114 | - if ( ! (defined('DOING_AJAX') && DOING_AJAX)) { |
|
115 | - return; |
|
116 | - } |
|
117 | - // going to start an output buffer in case anything gets accidentally output |
|
118 | - // that might disrupt our JSON response |
|
119 | - ob_start(); |
|
120 | - EED_Single_Page_Checkout::load_request_handler(); |
|
121 | - EED_Single_Page_Checkout::load_reg_steps(); |
|
122 | - // set ajax hooks |
|
123 | - add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
124 | - add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
125 | - add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
126 | - add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
127 | - add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
128 | - add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
129 | - } |
|
130 | - |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * process ajax request |
|
135 | - * |
|
136 | - * @param string $ajax_action |
|
137 | - * @throws EE_Error |
|
138 | - */ |
|
139 | - public static function process_ajax_request($ajax_action) |
|
140 | - { |
|
141 | - EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
142 | - EED_Single_Page_Checkout::instance()->_initialize(); |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * ajax display registration step |
|
149 | - * |
|
150 | - * @throws EE_Error |
|
151 | - */ |
|
152 | - public static function display_reg_step() |
|
153 | - { |
|
154 | - EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * ajax process registration step |
|
161 | - * |
|
162 | - * @throws EE_Error |
|
163 | - */ |
|
164 | - public static function process_reg_step() |
|
165 | - { |
|
166 | - EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * ajax process registration step |
|
173 | - * |
|
174 | - * @throws EE_Error |
|
175 | - */ |
|
176 | - public static function update_reg_step() |
|
177 | - { |
|
178 | - EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * update_checkout |
|
185 | - * |
|
186 | - * @access public |
|
187 | - * @return void |
|
188 | - * @throws EE_Error |
|
189 | - */ |
|
190 | - public static function update_checkout() |
|
191 | - { |
|
192 | - EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
193 | - } |
|
194 | - |
|
195 | - |
|
196 | - |
|
197 | - /** |
|
198 | - * load_request_handler |
|
199 | - * |
|
200 | - * @access public |
|
201 | - * @return void |
|
202 | - */ |
|
203 | - public static function load_request_handler() |
|
204 | - { |
|
205 | - // load core Request_Handler class |
|
206 | - if (EE_Registry::instance()->REQ !== null) { |
|
207 | - EE_Registry::instance()->load_core('Request_Handler'); |
|
208 | - } |
|
209 | - } |
|
210 | - |
|
211 | - |
|
212 | - |
|
213 | - /** |
|
214 | - * set_definitions |
|
215 | - * |
|
216 | - * @access public |
|
217 | - * @return void |
|
218 | - * @throws EE_Error |
|
219 | - */ |
|
220 | - public static function set_definitions() |
|
221 | - { |
|
222 | - if(defined('SPCO_BASE_PATH')) { |
|
223 | - return; |
|
224 | - } |
|
225 | - define( |
|
226 | - 'SPCO_BASE_PATH', |
|
227 | - rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS |
|
228 | - ); |
|
229 | - define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS); |
|
230 | - define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS); |
|
231 | - define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS); |
|
232 | - define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS); |
|
233 | - define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS); |
|
234 | - define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS); |
|
235 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true); |
|
236 | - EE_Registry::$i18n_js_strings['registration_expiration_notice'] = EED_Single_Page_Checkout::getRegistrationExpirationNotice(); |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - |
|
241 | - /** |
|
242 | - * load_reg_steps |
|
243 | - * loads and instantiates each reg step based on the EE_Registry::instance()->CFG->registration->reg_steps array |
|
244 | - * |
|
245 | - * @access private |
|
246 | - * @throws EE_Error |
|
247 | - */ |
|
248 | - public static function load_reg_steps() |
|
249 | - { |
|
250 | - static $reg_steps_loaded = false; |
|
251 | - if ($reg_steps_loaded) { |
|
252 | - return; |
|
253 | - } |
|
254 | - // filter list of reg_steps |
|
255 | - $reg_steps_to_load = (array)apply_filters( |
|
256 | - 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', |
|
257 | - EED_Single_Page_Checkout::get_reg_steps() |
|
258 | - ); |
|
259 | - // sort by key (order) |
|
260 | - ksort($reg_steps_to_load); |
|
261 | - // loop through folders |
|
262 | - foreach ($reg_steps_to_load as $order => $reg_step) { |
|
263 | - // we need a |
|
264 | - if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
265 | - // copy over to the reg_steps_array |
|
266 | - EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
267 | - // register custom key route for each reg step |
|
268 | - // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
|
269 | - EE_Config::register_route( |
|
270 | - $reg_step['slug'], |
|
271 | - 'EED_Single_Page_Checkout', |
|
272 | - 'run', |
|
273 | - 'step' |
|
274 | - ); |
|
275 | - // add AJAX or other hooks |
|
276 | - if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
277 | - // setup autoloaders if necessary |
|
278 | - if ( ! class_exists($reg_step['class_name'])) { |
|
279 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( |
|
280 | - $reg_step['file_path'], |
|
281 | - true |
|
282 | - ); |
|
283 | - } |
|
284 | - if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
285 | - call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
286 | - } |
|
287 | - } |
|
288 | - } |
|
289 | - } |
|
290 | - $reg_steps_loaded = true; |
|
291 | - } |
|
292 | - |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * get_reg_steps |
|
297 | - * |
|
298 | - * @access public |
|
299 | - * @return array |
|
300 | - */ |
|
301 | - public static function get_reg_steps() |
|
302 | - { |
|
303 | - $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
|
304 | - if (empty($reg_steps)) { |
|
305 | - $reg_steps = array( |
|
306 | - 10 => array( |
|
307 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
308 | - 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
|
309 | - 'slug' => 'attendee_information', |
|
310 | - 'has_hooks' => false, |
|
311 | - ), |
|
312 | - 30 => array( |
|
313 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
314 | - 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
|
315 | - 'slug' => 'payment_options', |
|
316 | - 'has_hooks' => true, |
|
317 | - ), |
|
318 | - 999 => array( |
|
319 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
320 | - 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
|
321 | - 'slug' => 'finalize_registration', |
|
322 | - 'has_hooks' => false, |
|
323 | - ), |
|
324 | - ); |
|
325 | - } |
|
326 | - return $reg_steps; |
|
327 | - } |
|
328 | - |
|
329 | - |
|
330 | - |
|
331 | - /** |
|
332 | - * registration_checkout_for_admin |
|
333 | - * |
|
334 | - * @access public |
|
335 | - * @return string |
|
336 | - * @throws EE_Error |
|
337 | - */ |
|
338 | - public static function registration_checkout_for_admin() |
|
339 | - { |
|
340 | - EED_Single_Page_Checkout::load_request_handler(); |
|
341 | - EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
342 | - EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
343 | - EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
344 | - EED_Single_Page_Checkout::instance()->_initialize(); |
|
345 | - EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
|
346 | - return EE_Registry::instance()->REQ->get_output(); |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - |
|
351 | - /** |
|
352 | - * process_registration_from_admin |
|
353 | - * |
|
354 | - * @access public |
|
355 | - * @return \EE_Transaction |
|
356 | - * @throws EE_Error |
|
357 | - */ |
|
358 | - public static function process_registration_from_admin() |
|
359 | - { |
|
360 | - EED_Single_Page_Checkout::load_request_handler(); |
|
361 | - EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
362 | - EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
363 | - EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
364 | - EED_Single_Page_Checkout::instance()->_initialize(); |
|
365 | - if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
366 | - $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
367 | - if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
368 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
369 | - if ($final_reg_step->process_reg_step()) { |
|
370 | - $final_reg_step->set_completed(); |
|
371 | - EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
|
372 | - return EED_Single_Page_Checkout::instance()->checkout->transaction; |
|
373 | - } |
|
374 | - } |
|
375 | - } |
|
376 | - return null; |
|
377 | - } |
|
378 | - |
|
379 | - |
|
380 | - |
|
381 | - /** |
|
382 | - * run |
|
383 | - * |
|
384 | - * @access public |
|
385 | - * @param WP_Query $WP_Query |
|
386 | - * @return void |
|
387 | - * @throws EE_Error |
|
388 | - */ |
|
389 | - public function run($WP_Query) |
|
390 | - { |
|
391 | - if ( |
|
392 | - $WP_Query instanceof WP_Query |
|
393 | - && $WP_Query->is_main_query() |
|
394 | - && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
395 | - && $this->_is_reg_checkout() |
|
396 | - ) { |
|
397 | - $this->_initialize(); |
|
398 | - } |
|
399 | - } |
|
400 | - |
|
401 | - |
|
402 | - |
|
403 | - /** |
|
404 | - * determines whether current url matches reg page url |
|
405 | - * |
|
406 | - * @return bool |
|
407 | - */ |
|
408 | - protected function _is_reg_checkout() |
|
409 | - { |
|
410 | - // get current permalink for reg page without any extra query args |
|
411 | - $reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id); |
|
412 | - // get request URI for current request, but without the scheme or host |
|
413 | - $current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI'); |
|
414 | - $current_request_uri = html_entity_decode($current_request_uri); |
|
415 | - // get array of query args from the current request URI |
|
416 | - $query_args = \EEH_URL::get_query_string($current_request_uri); |
|
417 | - // grab page id if it is set |
|
418 | - $page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0; |
|
419 | - // and remove the page id from the query args (we will re-add it later) |
|
420 | - unset($query_args['page_id']); |
|
421 | - // now strip all query args from current request URI |
|
422 | - $current_request_uri = remove_query_arg(array_keys($query_args), $current_request_uri); |
|
423 | - // and re-add the page id if it was set |
|
424 | - if ($page_id) { |
|
425 | - $current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri); |
|
426 | - } |
|
427 | - // remove slashes and ? |
|
428 | - $current_request_uri = trim($current_request_uri, '?/'); |
|
429 | - // is current request URI part of the known full reg page URL ? |
|
430 | - return ! empty($current_request_uri) && strpos($reg_page_url, $current_request_uri) !== false; |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - |
|
435 | - /** |
|
436 | - * @param WP_Query $wp_query |
|
437 | - * @return void |
|
438 | - * @throws EE_Error |
|
439 | - */ |
|
440 | - public static function init($wp_query) |
|
441 | - { |
|
442 | - EED_Single_Page_Checkout::instance()->run($wp_query); |
|
443 | - } |
|
444 | - |
|
445 | - |
|
446 | - |
|
447 | - /** |
|
448 | - * _initialize - initial module setup |
|
449 | - * |
|
450 | - * @access private |
|
451 | - * @throws EE_Error |
|
452 | - * @return void |
|
453 | - */ |
|
454 | - private function _initialize() |
|
455 | - { |
|
456 | - // ensure SPCO doesn't run twice |
|
457 | - if (EED_Single_Page_Checkout::$_initialized) { |
|
458 | - return; |
|
459 | - } |
|
460 | - try { |
|
461 | - EED_Single_Page_Checkout::load_reg_steps(); |
|
462 | - $this->_verify_session(); |
|
463 | - // setup the EE_Checkout object |
|
464 | - $this->checkout = $this->_initialize_checkout(); |
|
465 | - // filter checkout |
|
466 | - $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
467 | - // get the $_GET |
|
468 | - $this->_get_request_vars(); |
|
469 | - if ($this->_block_bots()) { |
|
470 | - return; |
|
471 | - } |
|
472 | - // filter continue_reg |
|
473 | - $this->checkout->continue_reg = apply_filters( |
|
474 | - 'FHEE__EED_Single_Page_Checkout__init___continue_reg', |
|
475 | - true, |
|
476 | - $this->checkout |
|
477 | - ); |
|
478 | - // load the reg steps array |
|
479 | - if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
480 | - EED_Single_Page_Checkout::$_initialized = true; |
|
481 | - return; |
|
482 | - } |
|
483 | - // set the current step |
|
484 | - $this->checkout->set_current_step($this->checkout->step); |
|
485 | - // and the next step |
|
486 | - $this->checkout->set_next_step(); |
|
487 | - // verify that everything has been setup correctly |
|
488 | - if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
489 | - EED_Single_Page_Checkout::$_initialized = true; |
|
490 | - return; |
|
491 | - } |
|
492 | - // lock the transaction |
|
493 | - $this->checkout->transaction->lock(); |
|
494 | - // make sure all of our cached objects are added to their respective model entity mappers |
|
495 | - $this->checkout->refresh_all_entities(); |
|
496 | - // set amount owing |
|
497 | - $this->checkout->amount_owing = $this->checkout->transaction->remaining(); |
|
498 | - // initialize each reg step, which gives them the chance to potentially alter the process |
|
499 | - $this->_initialize_reg_steps(); |
|
500 | - // DEBUG LOG |
|
501 | - //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
|
502 | - // get reg form |
|
503 | - if( ! $this->_check_form_submission()) { |
|
504 | - EED_Single_Page_Checkout::$_initialized = true; |
|
505 | - return; |
|
506 | - } |
|
507 | - // checkout the action!!! |
|
508 | - $this->_process_form_action(); |
|
509 | - // add some style and make it dance |
|
510 | - $this->add_styles_and_scripts(); |
|
511 | - // kk... SPCO has successfully run |
|
512 | - EED_Single_Page_Checkout::$_initialized = true; |
|
513 | - // set no cache headers and constants |
|
514 | - EE_System::do_not_cache(); |
|
515 | - // add anchor |
|
516 | - add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
517 | - // remove transaction lock |
|
518 | - add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
519 | - } catch (Exception $e) { |
|
520 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
521 | - } |
|
522 | - } |
|
523 | - |
|
524 | - |
|
525 | - |
|
526 | - /** |
|
527 | - * _verify_session |
|
528 | - * checks that the session is valid and not expired |
|
529 | - * |
|
530 | - * @access private |
|
531 | - * @throws EE_Error |
|
532 | - */ |
|
533 | - private function _verify_session() |
|
534 | - { |
|
535 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
536 | - throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
537 | - } |
|
538 | - $clear_session_requested = filter_var( |
|
539 | - EE_Registry::instance()->REQ->get('clear_session', false), |
|
540 | - FILTER_VALIDATE_BOOLEAN |
|
541 | - ); |
|
542 | - // is session still valid ? |
|
543 | - if ($clear_session_requested |
|
544 | - || ( EE_Registry::instance()->SSN->expired() |
|
545 | - && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '' |
|
546 | - ) |
|
547 | - ) { |
|
548 | - $this->checkout = new EE_Checkout(); |
|
549 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
550 | - // EE_Registry::instance()->SSN->reset_cart(); |
|
551 | - // EE_Registry::instance()->SSN->reset_checkout(); |
|
552 | - // EE_Registry::instance()->SSN->reset_transaction(); |
|
553 | - if (! $clear_session_requested) { |
|
554 | - EE_Error::add_attention( |
|
555 | - EE_Registry::$i18n_js_strings['registration_expiration_notice'], |
|
556 | - __FILE__, __FUNCTION__, __LINE__ |
|
557 | - ); |
|
558 | - } |
|
559 | - // EE_Registry::instance()->SSN->reset_expired(); |
|
560 | - } |
|
561 | - } |
|
562 | - |
|
563 | - |
|
564 | - |
|
565 | - /** |
|
566 | - * _initialize_checkout |
|
567 | - * loads and instantiates EE_Checkout |
|
568 | - * |
|
569 | - * @access private |
|
570 | - * @throws EE_Error |
|
571 | - * @return EE_Checkout |
|
572 | - */ |
|
573 | - private function _initialize_checkout() |
|
574 | - { |
|
575 | - // look in session for existing checkout |
|
576 | - /** @type EE_Checkout $checkout */ |
|
577 | - $checkout = EE_Registry::instance()->SSN->checkout(); |
|
578 | - // verify |
|
579 | - if ( ! $checkout instanceof EE_Checkout) { |
|
580 | - // instantiate EE_Checkout object for handling the properties of the current checkout process |
|
581 | - $checkout = EE_Registry::instance()->load_file( |
|
582 | - SPCO_INC_PATH, |
|
583 | - 'EE_Checkout', |
|
584 | - 'class', array(), |
|
585 | - false |
|
586 | - ); |
|
587 | - } else { |
|
588 | - if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
589 | - $this->unlock_transaction(); |
|
590 | - wp_safe_redirect($checkout->redirect_url); |
|
591 | - exit(); |
|
592 | - } |
|
593 | - } |
|
594 | - $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
595 | - // verify again |
|
596 | - if ( ! $checkout instanceof EE_Checkout) { |
|
597 | - throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
598 | - } |
|
599 | - // reset anything that needs a clean slate for each request |
|
600 | - $checkout->reset_for_current_request(); |
|
601 | - return $checkout; |
|
602 | - } |
|
603 | - |
|
604 | - |
|
605 | - |
|
606 | - /** |
|
607 | - * _get_request_vars |
|
608 | - * |
|
609 | - * @access private |
|
610 | - * @return void |
|
611 | - * @throws EE_Error |
|
612 | - */ |
|
613 | - private function _get_request_vars() |
|
614 | - { |
|
615 | - // load classes |
|
616 | - EED_Single_Page_Checkout::load_request_handler(); |
|
617 | - //make sure this request is marked as belonging to EE |
|
618 | - EE_Registry::instance()->REQ->set_espresso_page(true); |
|
619 | - // which step is being requested ? |
|
620 | - $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
621 | - // which step is being edited ? |
|
622 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
623 | - // and what we're doing on the current step |
|
624 | - $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
625 | - // timestamp |
|
626 | - $this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0); |
|
627 | - // returning to edit ? |
|
628 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
629 | - // add reg url link to registration query params |
|
630 | - if ($this->checkout->reg_url_link && strpos($this->checkout->reg_url_link, '1-') !== 0) { |
|
631 | - $this->checkout->reg_cache_where_params[0]['REG_url_link'] = $this->checkout->reg_url_link; |
|
632 | - } |
|
633 | - // or some other kind of revisit ? |
|
634 | - $this->checkout->revisit = filter_var( |
|
635 | - EE_Registry::instance()->REQ->get('revisit', false), |
|
636 | - FILTER_VALIDATE_BOOLEAN |
|
637 | - ); |
|
638 | - // and whether or not to generate a reg form for this request |
|
639 | - $this->checkout->generate_reg_form = filter_var( |
|
640 | - EE_Registry::instance()->REQ->get('generate_reg_form', true), |
|
641 | - FILTER_VALIDATE_BOOLEAN |
|
642 | - ); |
|
643 | - // and whether or not to process a reg form submission for this request |
|
644 | - $this->checkout->process_form_submission = filter_var( |
|
645 | - EE_Registry::instance()->REQ->get( |
|
646 | - 'process_form_submission', |
|
647 | - $this->checkout->action === 'process_reg_step' |
|
648 | - ), |
|
649 | - FILTER_VALIDATE_BOOLEAN |
|
650 | - ); |
|
651 | - $this->checkout->process_form_submission = filter_var( |
|
652 | - $this->checkout->action !== 'display_spco_reg_step' |
|
653 | - ? $this->checkout->process_form_submission |
|
654 | - : false, |
|
655 | - FILTER_VALIDATE_BOOLEAN |
|
656 | - ); |
|
657 | - // $this->_display_request_vars(); |
|
658 | - } |
|
659 | - |
|
660 | - |
|
661 | - |
|
662 | - /** |
|
663 | - * _display_request_vars |
|
664 | - * |
|
665 | - * @access protected |
|
666 | - * @return void |
|
667 | - */ |
|
668 | - protected function _display_request_vars() |
|
669 | - { |
|
670 | - if ( ! WP_DEBUG) { |
|
671 | - return; |
|
672 | - } |
|
673 | - EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
674 | - EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
675 | - EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
676 | - EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
677 | - EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
678 | - EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
679 | - EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
680 | - EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
681 | - } |
|
682 | - |
|
683 | - |
|
684 | - |
|
685 | - /** |
|
686 | - * _block_bots |
|
687 | - * checks that the incoming request has either of the following set: |
|
688 | - * a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector |
|
689 | - * a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN |
|
690 | - * so if you're not coming from the Ticket Selector nor returning for a valid IP... |
|
691 | - * then where you coming from man? |
|
692 | - * |
|
693 | - * @return boolean |
|
694 | - */ |
|
695 | - private function _block_bots() |
|
696 | - { |
|
697 | - $invalid_checkout_access = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
698 | - if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) { |
|
699 | - return true; |
|
700 | - } |
|
701 | - return false; |
|
702 | - } |
|
703 | - |
|
704 | - |
|
705 | - |
|
706 | - /** |
|
707 | - * _get_first_step |
|
708 | - * gets slug for first step in $_reg_steps_array |
|
709 | - * |
|
710 | - * @access private |
|
711 | - * @throws EE_Error |
|
712 | - * @return string |
|
713 | - */ |
|
714 | - private function _get_first_step() |
|
715 | - { |
|
716 | - $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
717 | - return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
718 | - } |
|
719 | - |
|
720 | - |
|
721 | - /** |
|
722 | - * instantiates each reg step based on the loaded reg_steps array |
|
723 | - * |
|
724 | - * @return bool |
|
725 | - * @throws EE_Error |
|
726 | - * @throws InvalidArgumentException |
|
727 | - * @throws InvalidDataTypeException |
|
728 | - * @throws InvalidInterfaceException |
|
729 | - */ |
|
730 | - private function _load_and_instantiate_reg_steps() |
|
731 | - { |
|
732 | - do_action('AHEE__Single_Page_Checkout___load_and_instantiate_reg_steps__start', $this->checkout); |
|
733 | - // have reg_steps already been instantiated ? |
|
734 | - if ( |
|
735 | - empty($this->checkout->reg_steps) |
|
736 | - || apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
737 | - ) { |
|
738 | - // if not, then loop through raw reg steps array |
|
739 | - foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
740 | - if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
741 | - return false; |
|
742 | - } |
|
743 | - } |
|
744 | - if(isset($this->checkout->reg_steps['registration_confirmation'])){ |
|
745 | - // skip the registration_confirmation page ? |
|
746 | - if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
747 | - // just remove it from the reg steps array |
|
748 | - $this->checkout->remove_reg_step('registration_confirmation', false); |
|
749 | - } elseif (EE_Registry::instance()->CFG->registration->reg_confirmation_last |
|
750 | - ) { |
|
751 | - // set the order to something big like 100 |
|
752 | - $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
753 | - } |
|
754 | - } |
|
755 | - // filter the array for good luck |
|
756 | - $this->checkout->reg_steps = apply_filters( |
|
757 | - 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', |
|
758 | - $this->checkout->reg_steps |
|
759 | - ); |
|
760 | - // finally re-sort based on the reg step class order properties |
|
761 | - $this->checkout->sort_reg_steps(); |
|
762 | - } else { |
|
763 | - foreach ($this->checkout->reg_steps as $reg_step) { |
|
764 | - // set all current step stati to FALSE |
|
765 | - $reg_step->set_is_current_step(false); |
|
766 | - } |
|
767 | - } |
|
768 | - if (empty($this->checkout->reg_steps)) { |
|
769 | - EE_Error::add_error( |
|
770 | - __('No Reg Steps were loaded..', 'event_espresso'), |
|
771 | - __FILE__, __FUNCTION__, __LINE__ |
|
772 | - ); |
|
773 | - return false; |
|
774 | - } |
|
775 | - // make reg step details available to JS |
|
776 | - $this->checkout->set_reg_step_JSON_info(); |
|
777 | - return true; |
|
778 | - } |
|
779 | - |
|
780 | - |
|
781 | - |
|
782 | - /** |
|
783 | - * _load_and_instantiate_reg_step |
|
784 | - * |
|
785 | - * @access private |
|
786 | - * @param array $reg_step |
|
787 | - * @param int $order |
|
788 | - * @return bool |
|
789 | - */ |
|
790 | - private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) |
|
791 | - { |
|
792 | - // we need a file_path, class_name, and slug to add a reg step |
|
793 | - if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
794 | - // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
|
795 | - if ( |
|
796 | - $this->checkout->reg_url_link |
|
797 | - && $this->checkout->step !== $reg_step['slug'] |
|
798 | - && $reg_step['slug'] !== 'finalize_registration' |
|
799 | - // normally at this point we would NOT load the reg step, but this filter can change that |
|
800 | - && apply_filters( |
|
801 | - 'FHEE__Single_Page_Checkout___load_and_instantiate_reg_step__bypass_reg_step', |
|
802 | - true, |
|
803 | - $reg_step, |
|
804 | - $this->checkout |
|
805 | - ) |
|
806 | - ) { |
|
807 | - return true; |
|
808 | - } |
|
809 | - // instantiate step class using file path and class name |
|
810 | - $reg_step_obj = EE_Registry::instance()->load_file( |
|
811 | - $reg_step['file_path'], |
|
812 | - $reg_step['class_name'], |
|
813 | - 'class', |
|
814 | - $this->checkout, |
|
815 | - false |
|
816 | - ); |
|
817 | - // did we gets the goods ? |
|
818 | - if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
819 | - // set reg step order based on config |
|
820 | - $reg_step_obj->set_order($order); |
|
821 | - // add instantiated reg step object to the master reg steps array |
|
822 | - $this->checkout->add_reg_step($reg_step_obj); |
|
823 | - } else { |
|
824 | - EE_Error::add_error( |
|
825 | - __('The current step could not be set.', 'event_espresso'), |
|
826 | - __FILE__, __FUNCTION__, __LINE__ |
|
827 | - ); |
|
828 | - return false; |
|
829 | - } |
|
830 | - } else { |
|
831 | - if (WP_DEBUG) { |
|
832 | - EE_Error::add_error( |
|
833 | - sprintf( |
|
834 | - __( |
|
835 | - 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', |
|
836 | - 'event_espresso' |
|
837 | - ), |
|
838 | - isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
839 | - isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
840 | - isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
841 | - '<ul>', |
|
842 | - '<li>', |
|
843 | - '</li>', |
|
844 | - '</ul>' |
|
845 | - ), |
|
846 | - __FILE__, __FUNCTION__, __LINE__ |
|
847 | - ); |
|
848 | - } |
|
849 | - return false; |
|
850 | - } |
|
851 | - return true; |
|
852 | - } |
|
853 | - |
|
854 | - |
|
855 | - /** |
|
856 | - * _verify_transaction_and_get_registrations |
|
857 | - * |
|
858 | - * @access private |
|
859 | - * @return bool |
|
860 | - * @throws InvalidDataTypeException |
|
861 | - * @throws InvalidEntityException |
|
862 | - * @throws EE_Error |
|
863 | - */ |
|
864 | - private function _verify_transaction_and_get_registrations() |
|
865 | - { |
|
866 | - // was there already a valid transaction in the checkout from the session ? |
|
867 | - if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
868 | - // get transaction from db or session |
|
869 | - $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
|
870 | - ? $this->_get_transaction_and_cart_for_previous_visit() |
|
871 | - : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
|
872 | - if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
873 | - EE_Error::add_error( |
|
874 | - __('Your Registration and Transaction information could not be retrieved from the db.', |
|
875 | - 'event_espresso'), |
|
876 | - __FILE__, __FUNCTION__, __LINE__ |
|
877 | - ); |
|
878 | - $this->checkout->transaction = EE_Transaction::new_instance(); |
|
879 | - // add some style and make it dance |
|
880 | - $this->add_styles_and_scripts(); |
|
881 | - EED_Single_Page_Checkout::$_initialized = true; |
|
882 | - return false; |
|
883 | - } |
|
884 | - // and the registrations for the transaction |
|
885 | - $this->_get_registrations($this->checkout->transaction); |
|
886 | - } |
|
887 | - return true; |
|
888 | - } |
|
889 | - |
|
890 | - |
|
891 | - |
|
892 | - /** |
|
893 | - * _get_transaction_and_cart_for_previous_visit |
|
894 | - * |
|
895 | - * @access private |
|
896 | - * @return mixed EE_Transaction|NULL |
|
897 | - */ |
|
898 | - private function _get_transaction_and_cart_for_previous_visit() |
|
899 | - { |
|
900 | - /** @var $TXN_model EEM_Transaction */ |
|
901 | - $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
902 | - // because the reg_url_link is present in the request, |
|
903 | - // this is a return visit to SPCO, so we'll get the transaction data from the db |
|
904 | - $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
905 | - // verify transaction |
|
906 | - if ($transaction instanceof EE_Transaction) { |
|
907 | - // and get the cart that was used for that transaction |
|
908 | - $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
909 | - return $transaction; |
|
910 | - } |
|
911 | - EE_Error::add_error( |
|
912 | - __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
913 | - __FILE__, __FUNCTION__, __LINE__ |
|
914 | - ); |
|
915 | - return null; |
|
916 | - |
|
917 | - } |
|
918 | - |
|
919 | - |
|
920 | - |
|
921 | - /** |
|
922 | - * _get_cart_for_transaction |
|
923 | - * |
|
924 | - * @access private |
|
925 | - * @param EE_Transaction $transaction |
|
926 | - * @return EE_Cart |
|
927 | - */ |
|
928 | - private function _get_cart_for_transaction($transaction) |
|
929 | - { |
|
930 | - return $this->checkout->get_cart_for_transaction($transaction); |
|
931 | - } |
|
932 | - |
|
933 | - |
|
934 | - |
|
935 | - /** |
|
936 | - * get_cart_for_transaction |
|
937 | - * |
|
938 | - * @access public |
|
939 | - * @param EE_Transaction $transaction |
|
940 | - * @return EE_Cart |
|
941 | - */ |
|
942 | - public function get_cart_for_transaction(EE_Transaction $transaction) |
|
943 | - { |
|
944 | - return $this->checkout->get_cart_for_transaction($transaction); |
|
945 | - } |
|
946 | - |
|
947 | - |
|
948 | - |
|
949 | - /** |
|
950 | - * _get_transaction_and_cart_for_current_session |
|
951 | - * generates a new EE_Transaction object and adds it to the $_transaction property. |
|
952 | - * |
|
953 | - * @access private |
|
954 | - * @return EE_Transaction |
|
955 | - * @throws EE_Error |
|
956 | - */ |
|
957 | - private function _get_cart_for_current_session_and_setup_new_transaction() |
|
958 | - { |
|
959 | - // if there's no transaction, then this is the FIRST visit to SPCO |
|
960 | - // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
|
961 | - $this->checkout->cart = $this->_get_cart_for_transaction(null); |
|
962 | - // and then create a new transaction |
|
963 | - $transaction = $this->_initialize_transaction(); |
|
964 | - // verify transaction |
|
965 | - if ($transaction instanceof EE_Transaction) { |
|
966 | - // save it so that we have an ID for other objects to use |
|
967 | - $transaction->save(); |
|
968 | - // and save TXN data to the cart |
|
969 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
970 | - } else { |
|
971 | - EE_Error::add_error( |
|
972 | - __('A Valid Transaction could not be initialized.', 'event_espresso'), |
|
973 | - __FILE__, __FUNCTION__, __LINE__ |
|
974 | - ); |
|
975 | - } |
|
976 | - return $transaction; |
|
977 | - } |
|
978 | - |
|
979 | - |
|
980 | - |
|
981 | - /** |
|
982 | - * generates a new EE_Transaction object and adds it to the $_transaction property. |
|
983 | - * |
|
984 | - * @access private |
|
985 | - * @return mixed EE_Transaction|NULL |
|
986 | - */ |
|
987 | - private function _initialize_transaction() |
|
988 | - { |
|
989 | - try { |
|
990 | - // ensure cart totals have been calculated |
|
991 | - $this->checkout->cart->get_grand_total()->recalculate_total_including_taxes(); |
|
992 | - // grab the cart grand total |
|
993 | - $cart_total = $this->checkout->cart->get_cart_grand_total(); |
|
994 | - // create new TXN |
|
995 | - $transaction = EE_Transaction::new_instance( |
|
996 | - array( |
|
997 | - 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
|
998 | - 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
|
999 | - 'TXN_paid' => 0, |
|
1000 | - 'STS_ID' => EEM_Transaction::failed_status_code, |
|
1001 | - ) |
|
1002 | - ); |
|
1003 | - // save it so that we have an ID for other objects to use |
|
1004 | - $transaction->save(); |
|
1005 | - // set cron job for following up on TXNs after their session has expired |
|
1006 | - EE_Cron_Tasks::schedule_expired_transaction_check( |
|
1007 | - EE_Registry::instance()->SSN->expiration() + 1, |
|
1008 | - $transaction->ID() |
|
1009 | - ); |
|
1010 | - return $transaction; |
|
1011 | - } catch (Exception $e) { |
|
1012 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1013 | - } |
|
1014 | - return null; |
|
1015 | - } |
|
1016 | - |
|
1017 | - |
|
1018 | - /** |
|
1019 | - * _get_registrations |
|
1020 | - * |
|
1021 | - * @access private |
|
1022 | - * @param EE_Transaction $transaction |
|
1023 | - * @return void |
|
1024 | - * @throws InvalidDataTypeException |
|
1025 | - * @throws InvalidEntityException |
|
1026 | - * @throws EE_Error |
|
1027 | - */ |
|
1028 | - private function _get_registrations(EE_Transaction $transaction) |
|
1029 | - { |
|
1030 | - // first step: grab the registrants { : o |
|
1031 | - $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
1032 | - $this->checkout->total_ticket_count = count($registrations); |
|
1033 | - // verify registrations have been set |
|
1034 | - if (empty($registrations)) { |
|
1035 | - // if no cached registrations, then check the db |
|
1036 | - $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
1037 | - // still nothing ? well as long as this isn't a revisit |
|
1038 | - if (empty($registrations) && ! $this->checkout->revisit) { |
|
1039 | - // generate new registrations from scratch |
|
1040 | - $registrations = $this->_initialize_registrations($transaction); |
|
1041 | - } |
|
1042 | - } |
|
1043 | - // sort by their original registration order |
|
1044 | - usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
1045 | - // then loop thru the array |
|
1046 | - foreach ($registrations as $registration) { |
|
1047 | - // verify each registration |
|
1048 | - if ($registration instanceof EE_Registration) { |
|
1049 | - // we display all attendee info for the primary registrant |
|
1050 | - if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
1051 | - && $registration->is_primary_registrant() |
|
1052 | - ) { |
|
1053 | - $this->checkout->primary_revisit = true; |
|
1054 | - break; |
|
1055 | - } |
|
1056 | - if ($this->checkout->revisit && $this->checkout->reg_url_link !== $registration->reg_url_link()) { |
|
1057 | - // but hide info if it doesn't belong to you |
|
1058 | - $transaction->clear_cache('Registration', $registration->ID()); |
|
1059 | - $this->checkout->total_ticket_count--; |
|
1060 | - } |
|
1061 | - $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
1062 | - } |
|
1063 | - } |
|
1064 | - } |
|
1065 | - |
|
1066 | - |
|
1067 | - /** |
|
1068 | - * adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object |
|
1069 | - * |
|
1070 | - * @access private |
|
1071 | - * @param EE_Transaction $transaction |
|
1072 | - * @return array |
|
1073 | - * @throws InvalidDataTypeException |
|
1074 | - * @throws InvalidEntityException |
|
1075 | - * @throws EE_Error |
|
1076 | - */ |
|
1077 | - private function _initialize_registrations(EE_Transaction $transaction) |
|
1078 | - { |
|
1079 | - $att_nmbr = 0; |
|
1080 | - $registrations = array(); |
|
1081 | - if ($transaction instanceof EE_Transaction) { |
|
1082 | - /** @type EE_Registration_Processor $registration_processor */ |
|
1083 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1084 | - $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
|
1085 | - // now let's add the cart items to the $transaction |
|
1086 | - foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
1087 | - //do the following for each ticket of this type they selected |
|
1088 | - for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
1089 | - $att_nmbr++; |
|
1090 | - /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
1091 | - $CreateRegistrationCommand = EE_Registry::instance()->create( |
|
1092 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
1093 | - array( |
|
1094 | - $transaction, |
|
1095 | - $line_item, |
|
1096 | - $att_nmbr, |
|
1097 | - $this->checkout->total_ticket_count, |
|
1098 | - ) |
|
1099 | - ); |
|
1100 | - // override capabilities for frontend registrations |
|
1101 | - if ( ! is_admin()) { |
|
1102 | - $CreateRegistrationCommand->setCapCheck( |
|
1103 | - new PublicCapabilities('', 'create_new_registration') |
|
1104 | - ); |
|
1105 | - } |
|
1106 | - $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
1107 | - if ( ! $registration instanceof EE_Registration) { |
|
1108 | - throw new InvalidEntityException($registration, 'EE_Registration'); |
|
1109 | - } |
|
1110 | - $registrations[ $registration->ID() ] = $registration; |
|
1111 | - } |
|
1112 | - } |
|
1113 | - $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
1114 | - } |
|
1115 | - return $registrations; |
|
1116 | - } |
|
1117 | - |
|
1118 | - |
|
1119 | - |
|
1120 | - /** |
|
1121 | - * sorts registrations by REG_count |
|
1122 | - * |
|
1123 | - * @access public |
|
1124 | - * @param EE_Registration $reg_A |
|
1125 | - * @param EE_Registration $reg_B |
|
1126 | - * @return int |
|
1127 | - */ |
|
1128 | - public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) |
|
1129 | - { |
|
1130 | - // this shouldn't ever happen within the same TXN, but oh well |
|
1131 | - if ($reg_A->count() === $reg_B->count()) { |
|
1132 | - return 0; |
|
1133 | - } |
|
1134 | - return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
1135 | - } |
|
1136 | - |
|
1137 | - |
|
1138 | - |
|
1139 | - /** |
|
1140 | - * _final_verifications |
|
1141 | - * just makes sure that everything is set up correctly before proceeding |
|
1142 | - * |
|
1143 | - * @access private |
|
1144 | - * @return bool |
|
1145 | - * @throws EE_Error |
|
1146 | - */ |
|
1147 | - private function _final_verifications() |
|
1148 | - { |
|
1149 | - // filter checkout |
|
1150 | - $this->checkout = apply_filters( |
|
1151 | - 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', |
|
1152 | - $this->checkout |
|
1153 | - ); |
|
1154 | - //verify that current step is still set correctly |
|
1155 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
1156 | - EE_Error::add_error( |
|
1157 | - __('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), |
|
1158 | - __FILE__, |
|
1159 | - __FUNCTION__, |
|
1160 | - __LINE__ |
|
1161 | - ); |
|
1162 | - return false; |
|
1163 | - } |
|
1164 | - // if returning to SPCO, then verify that primary registrant is set |
|
1165 | - if ( ! empty($this->checkout->reg_url_link)) { |
|
1166 | - $valid_registrant = $this->checkout->transaction->primary_registration(); |
|
1167 | - if ( ! $valid_registrant instanceof EE_Registration) { |
|
1168 | - EE_Error::add_error( |
|
1169 | - __('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), |
|
1170 | - __FILE__, |
|
1171 | - __FUNCTION__, |
|
1172 | - __LINE__ |
|
1173 | - ); |
|
1174 | - return false; |
|
1175 | - } |
|
1176 | - $valid_registrant = null; |
|
1177 | - foreach ( |
|
1178 | - $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration |
|
1179 | - ) { |
|
1180 | - if ( |
|
1181 | - $registration instanceof EE_Registration |
|
1182 | - && $registration->reg_url_link() === $this->checkout->reg_url_link |
|
1183 | - ) { |
|
1184 | - $valid_registrant = $registration; |
|
1185 | - } |
|
1186 | - } |
|
1187 | - if ( ! $valid_registrant instanceof EE_Registration) { |
|
1188 | - // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
|
1189 | - if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
1190 | - // clear the session, mark the checkout as unverified, and try again |
|
1191 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1192 | - EED_Single_Page_Checkout::$_initialized = false; |
|
1193 | - EED_Single_Page_Checkout::$_checkout_verified = false; |
|
1194 | - $this->_initialize(); |
|
1195 | - EE_Error::reset_notices(); |
|
1196 | - return false; |
|
1197 | - } |
|
1198 | - EE_Error::add_error( |
|
1199 | - __( |
|
1200 | - 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', |
|
1201 | - 'event_espresso' |
|
1202 | - ), |
|
1203 | - __FILE__, |
|
1204 | - __FUNCTION__, |
|
1205 | - __LINE__ |
|
1206 | - ); |
|
1207 | - return false; |
|
1208 | - } |
|
1209 | - } |
|
1210 | - // now that things have been kinda sufficiently verified, |
|
1211 | - // let's add the checkout to the session so that it's available to other systems |
|
1212 | - EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
1213 | - return true; |
|
1214 | - } |
|
1215 | - |
|
1216 | - |
|
1217 | - |
|
1218 | - /** |
|
1219 | - * _initialize_reg_steps |
|
1220 | - * first makes sure that EE_Transaction_Processor::set_reg_step_initiated() is called as required |
|
1221 | - * then loops thru all of the active reg steps and calls the initialize_reg_step() method |
|
1222 | - * |
|
1223 | - * @access private |
|
1224 | - * @param bool $reinitializing |
|
1225 | - * @throws EE_Error |
|
1226 | - */ |
|
1227 | - private function _initialize_reg_steps($reinitializing = false) |
|
1228 | - { |
|
1229 | - $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
1230 | - // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
|
1231 | - foreach ($this->checkout->reg_steps as $reg_step) { |
|
1232 | - if ( ! $reg_step->initialize_reg_step()) { |
|
1233 | - // if not initialized then maybe this step is being removed... |
|
1234 | - if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
1235 | - // if it was the current step, then we need to start over here |
|
1236 | - $this->_initialize_reg_steps(true); |
|
1237 | - return; |
|
1238 | - } |
|
1239 | - continue; |
|
1240 | - } |
|
1241 | - // add css and JS for current step |
|
1242 | - $reg_step->enqueue_styles_and_scripts(); |
|
1243 | - // i18n |
|
1244 | - $reg_step->translate_js_strings(); |
|
1245 | - if ($reg_step->is_current_step()) { |
|
1246 | - // the text that appears on the reg step form submit button |
|
1247 | - $reg_step->set_submit_button_text(); |
|
1248 | - } |
|
1249 | - } |
|
1250 | - // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
|
1251 | - do_action( |
|
1252 | - "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", |
|
1253 | - $this->checkout->current_step |
|
1254 | - ); |
|
1255 | - } |
|
1256 | - |
|
1257 | - |
|
1258 | - |
|
1259 | - /** |
|
1260 | - * _check_form_submission |
|
1261 | - * |
|
1262 | - * @access private |
|
1263 | - * @return boolean |
|
1264 | - */ |
|
1265 | - private function _check_form_submission() |
|
1266 | - { |
|
1267 | - //does this request require the reg form to be generated ? |
|
1268 | - if ($this->checkout->generate_reg_form) { |
|
1269 | - // ever heard that song by Blue Rodeo ? |
|
1270 | - try { |
|
1271 | - $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
|
1272 | - // if not displaying a form, then check for form submission |
|
1273 | - if ( |
|
1274 | - $this->checkout->process_form_submission |
|
1275 | - && $this->checkout->current_step->reg_form->was_submitted() |
|
1276 | - ) { |
|
1277 | - // clear out any old data in case this step is being run again |
|
1278 | - $this->checkout->current_step->set_valid_data(array()); |
|
1279 | - // capture submitted form data |
|
1280 | - $this->checkout->current_step->reg_form->receive_form_submission( |
|
1281 | - apply_filters( |
|
1282 | - 'FHEE__Single_Page_Checkout___check_form_submission__request_params', |
|
1283 | - EE_Registry::instance()->REQ->params(), |
|
1284 | - $this->checkout |
|
1285 | - ) |
|
1286 | - ); |
|
1287 | - // validate submitted form data |
|
1288 | - if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1289 | - // thou shall not pass !!! |
|
1290 | - $this->checkout->continue_reg = false; |
|
1291 | - // any form validation errors? |
|
1292 | - if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1293 | - EE_Error::add_error( |
|
1294 | - $this->checkout->current_step->reg_form->submission_error_message(), |
|
1295 | - __FILE__, __FUNCTION__, __LINE__ |
|
1296 | - ); |
|
1297 | - } |
|
1298 | - // well not really... what will happen is |
|
1299 | - // we'll just get redirected back to redo the current step |
|
1300 | - $this->go_to_next_step(); |
|
1301 | - return false; |
|
1302 | - } |
|
1303 | - } |
|
1304 | - } catch (EE_Error $e) { |
|
1305 | - $e->get_error(); |
|
1306 | - } |
|
1307 | - } |
|
1308 | - return true; |
|
1309 | - } |
|
1310 | - |
|
1311 | - |
|
1312 | - |
|
1313 | - /** |
|
1314 | - * _process_action |
|
1315 | - * |
|
1316 | - * @access private |
|
1317 | - * @return void |
|
1318 | - * @throws EE_Error |
|
1319 | - */ |
|
1320 | - private function _process_form_action() |
|
1321 | - { |
|
1322 | - // what cha wanna do? |
|
1323 | - switch ($this->checkout->action) { |
|
1324 | - // AJAX next step reg form |
|
1325 | - case 'display_spco_reg_step' : |
|
1326 | - $this->checkout->redirect = false; |
|
1327 | - if (EE_Registry::instance()->REQ->ajax) { |
|
1328 | - $this->checkout->json_response->set_reg_step_html( |
|
1329 | - $this->checkout->current_step->display_reg_form() |
|
1330 | - ); |
|
1331 | - } |
|
1332 | - break; |
|
1333 | - default : |
|
1334 | - // meh... do one of those other steps first |
|
1335 | - if ( |
|
1336 | - ! empty($this->checkout->action) |
|
1337 | - && is_callable(array($this->checkout->current_step, $this->checkout->action)) |
|
1338 | - ) { |
|
1339 | - // dynamically creates hook point like: |
|
1340 | - // AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
|
1341 | - do_action( |
|
1342 | - "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", |
|
1343 | - $this->checkout->current_step |
|
1344 | - ); |
|
1345 | - // call action on current step |
|
1346 | - if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1347 | - // good registrant, you get to proceed |
|
1348 | - if ( |
|
1349 | - $this->checkout->current_step->success_message() !== '' |
|
1350 | - && apply_filters( |
|
1351 | - 'FHEE__Single_Page_Checkout___process_form_action__display_success', |
|
1352 | - false |
|
1353 | - ) |
|
1354 | - ) { |
|
1355 | - EE_Error::add_success( |
|
1356 | - $this->checkout->current_step->success_message() |
|
1357 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1358 | - ); |
|
1359 | - } |
|
1360 | - // pack it up, pack it in... |
|
1361 | - $this->_setup_redirect(); |
|
1362 | - } |
|
1363 | - // dynamically creates hook point like: |
|
1364 | - // AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
|
1365 | - do_action( |
|
1366 | - "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", |
|
1367 | - $this->checkout->current_step |
|
1368 | - ); |
|
1369 | - } else { |
|
1370 | - EE_Error::add_error( |
|
1371 | - sprintf( |
|
1372 | - __( |
|
1373 | - 'The requested form action "%s" does not exist for the current "%s" registration step.', |
|
1374 | - 'event_espresso' |
|
1375 | - ), |
|
1376 | - $this->checkout->action, |
|
1377 | - $this->checkout->current_step->name() |
|
1378 | - ), |
|
1379 | - __FILE__, |
|
1380 | - __FUNCTION__, |
|
1381 | - __LINE__ |
|
1382 | - ); |
|
1383 | - } |
|
1384 | - // end default |
|
1385 | - } |
|
1386 | - // store our progress so far |
|
1387 | - $this->checkout->stash_transaction_and_checkout(); |
|
1388 | - // advance to the next step! If you pass GO, collect $200 |
|
1389 | - $this->go_to_next_step(); |
|
1390 | - } |
|
1391 | - |
|
1392 | - |
|
1393 | - |
|
1394 | - /** |
|
1395 | - * add_styles_and_scripts |
|
1396 | - * |
|
1397 | - * @access public |
|
1398 | - * @return void |
|
1399 | - */ |
|
1400 | - public function add_styles_and_scripts() |
|
1401 | - { |
|
1402 | - // i18n |
|
1403 | - $this->translate_js_strings(); |
|
1404 | - if ($this->checkout->admin_request) { |
|
1405 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1406 | - } else { |
|
1407 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1408 | - } |
|
1409 | - } |
|
1410 | - |
|
1411 | - |
|
1412 | - |
|
1413 | - /** |
|
1414 | - * translate_js_strings |
|
1415 | - * |
|
1416 | - * @access public |
|
1417 | - * @return void |
|
1418 | - */ |
|
1419 | - public function translate_js_strings() |
|
1420 | - { |
|
1421 | - EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
|
1422 | - EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
|
1423 | - EE_Registry::$i18n_js_strings['server_error'] = __( |
|
1424 | - 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', |
|
1425 | - 'event_espresso' |
|
1426 | - ); |
|
1427 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( |
|
1428 | - 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', |
|
1429 | - 'event_espresso' |
|
1430 | - ); |
|
1431 | - EE_Registry::$i18n_js_strings['validation_error'] = __( |
|
1432 | - 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', |
|
1433 | - 'event_espresso' |
|
1434 | - ); |
|
1435 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( |
|
1436 | - 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', |
|
1437 | - 'event_espresso' |
|
1438 | - ); |
|
1439 | - EE_Registry::$i18n_js_strings['reg_step_error'] = __( |
|
1440 | - 'This registration step could not be completed. Please refresh the page and try again.', |
|
1441 | - 'event_espresso' |
|
1442 | - ); |
|
1443 | - EE_Registry::$i18n_js_strings['invalid_coupon'] = __( |
|
1444 | - 'We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', |
|
1445 | - 'event_espresso' |
|
1446 | - ); |
|
1447 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
|
1448 | - __( |
|
1449 | - 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', |
|
1450 | - 'event_espresso' |
|
1451 | - ), |
|
1452 | - '<br/>', |
|
1453 | - '<br/>' |
|
1454 | - ); |
|
1455 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1456 | - EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
|
1457 | - EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
|
1458 | - EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
|
1459 | - EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1460 | - EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1461 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1462 | - EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1463 | - EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1464 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1465 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1466 | - EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1467 | - EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1468 | - EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1469 | - EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1470 | - EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1471 | - EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1472 | - EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1473 | - EE_Registry::$i18n_js_strings['registration_expiration_notice'] = EED_Single_Page_Checkout::getRegistrationExpirationNotice(); |
|
1474 | - EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters( |
|
1475 | - 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
|
1476 | - true |
|
1477 | - ); |
|
1478 | - EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1479 | - apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1480 | - ); |
|
1481 | - EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1482 | - 'M d, Y H:i:s', |
|
1483 | - EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1484 | - ); |
|
1485 | - } |
|
1486 | - |
|
1487 | - |
|
1488 | - |
|
1489 | - /** |
|
1490 | - * enqueue_styles_and_scripts |
|
1491 | - * |
|
1492 | - * @access public |
|
1493 | - * @return void |
|
1494 | - * @throws EE_Error |
|
1495 | - */ |
|
1496 | - public function enqueue_styles_and_scripts() |
|
1497 | - { |
|
1498 | - // load css |
|
1499 | - wp_register_style( |
|
1500 | - 'single_page_checkout', |
|
1501 | - SPCO_CSS_URL . 'single_page_checkout.css', |
|
1502 | - array('espresso_default'), |
|
1503 | - EVENT_ESPRESSO_VERSION |
|
1504 | - ); |
|
1505 | - wp_enqueue_style('single_page_checkout'); |
|
1506 | - // load JS |
|
1507 | - wp_register_script( |
|
1508 | - 'jquery_plugin', |
|
1509 | - EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', |
|
1510 | - array('jquery'), |
|
1511 | - '1.0.1', |
|
1512 | - true |
|
1513 | - ); |
|
1514 | - wp_register_script( |
|
1515 | - 'jquery_countdown', |
|
1516 | - EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', |
|
1517 | - array('jquery_plugin'), |
|
1518 | - '2.0.2', |
|
1519 | - true |
|
1520 | - ); |
|
1521 | - wp_register_script( |
|
1522 | - 'single_page_checkout', |
|
1523 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1524 | - array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1525 | - EVENT_ESPRESSO_VERSION, |
|
1526 | - true |
|
1527 | - ); |
|
1528 | - if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) { |
|
1529 | - $this->checkout->registration_form->enqueue_js(); |
|
1530 | - } |
|
1531 | - if ($this->checkout->current_step->reg_form instanceof EE_Form_Section_Proper) { |
|
1532 | - $this->checkout->current_step->reg_form->enqueue_js(); |
|
1533 | - } |
|
1534 | - wp_enqueue_script('single_page_checkout'); |
|
1535 | - /** |
|
1536 | - * global action hook for enqueueing styles and scripts with |
|
1537 | - * spco calls. |
|
1538 | - */ |
|
1539 | - do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1540 | - /** |
|
1541 | - * dynamic action hook for enqueueing styles and scripts with spco calls. |
|
1542 | - * The hook will end up being something like: |
|
1543 | - * AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
|
1544 | - */ |
|
1545 | - do_action( |
|
1546 | - 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), |
|
1547 | - $this |
|
1548 | - ); |
|
1549 | - } |
|
1550 | - |
|
1551 | - |
|
1552 | - |
|
1553 | - /** |
|
1554 | - * display the Registration Single Page Checkout Form |
|
1555 | - * |
|
1556 | - * @access private |
|
1557 | - * @return void |
|
1558 | - * @throws EE_Error |
|
1559 | - */ |
|
1560 | - private function _display_spco_reg_form() |
|
1561 | - { |
|
1562 | - // if registering via the admin, just display the reg form for the current step |
|
1563 | - if ($this->checkout->admin_request) { |
|
1564 | - EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1565 | - } else { |
|
1566 | - // add powered by EE msg |
|
1567 | - add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1568 | - $empty_cart = count( |
|
1569 | - $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) |
|
1570 | - ) < 1; |
|
1571 | - EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1572 | - $cookies_not_set_msg = ''; |
|
1573 | - if ($empty_cart) { |
|
1574 | - $cookies_not_set_msg = apply_filters( |
|
1575 | - 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
|
1576 | - sprintf( |
|
1577 | - __( |
|
1578 | - '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', |
|
1579 | - 'event_espresso' |
|
1580 | - ), |
|
1581 | - '<div class="ee-attention hidden" id="ee-cookies-not-set-msg">', |
|
1582 | - '</div>', |
|
1583 | - '<h6 class="important-notice">', |
|
1584 | - '</h6>', |
|
1585 | - '<p>', |
|
1586 | - '</p>', |
|
1587 | - '<br />', |
|
1588 | - '<a href="http://www.whatarecookies.com/enable.asp" target="_blank">', |
|
1589 | - '</a>' |
|
1590 | - ) |
|
1591 | - ); |
|
1592 | - } |
|
1593 | - $this->checkout->registration_form = new EE_Form_Section_Proper( |
|
1594 | - array( |
|
1595 | - 'name' => 'single-page-checkout', |
|
1596 | - 'html_id' => 'ee-single-page-checkout-dv', |
|
1597 | - 'layout_strategy' => |
|
1598 | - new EE_Template_Layout( |
|
1599 | - array( |
|
1600 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1601 | - 'template_args' => array( |
|
1602 | - 'empty_cart' => $empty_cart, |
|
1603 | - 'revisit' => $this->checkout->revisit, |
|
1604 | - 'reg_steps' => $this->checkout->reg_steps, |
|
1605 | - 'next_step' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step |
|
1606 | - ? $this->checkout->next_step->slug() |
|
1607 | - : '', |
|
1608 | - 'empty_msg' => apply_filters( |
|
1609 | - 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
|
1610 | - sprintf( |
|
1611 | - __( |
|
1612 | - 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', |
|
1613 | - 'event_espresso' |
|
1614 | - ), |
|
1615 | - '<a href="' |
|
1616 | - . get_post_type_archive_link('espresso_events') |
|
1617 | - . '" title="', |
|
1618 | - '">', |
|
1619 | - '</a>' |
|
1620 | - ) |
|
1621 | - ), |
|
1622 | - 'cookies_not_set_msg' => $cookies_not_set_msg, |
|
1623 | - 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
|
1624 | - 'session_expiration' => gmdate( |
|
1625 | - 'M d, Y H:i:s', |
|
1626 | - EE_Registry::instance()->SSN->expiration() |
|
1627 | - + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1628 | - ), |
|
1629 | - ), |
|
1630 | - ) |
|
1631 | - ), |
|
1632 | - ) |
|
1633 | - ); |
|
1634 | - // load template and add to output sent that gets filtered into the_content() |
|
1635 | - EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html()); |
|
1636 | - } |
|
1637 | - } |
|
1638 | - |
|
1639 | - |
|
1640 | - |
|
1641 | - /** |
|
1642 | - * add_extra_finalize_registration_inputs |
|
1643 | - * |
|
1644 | - * @access public |
|
1645 | - * @param $next_step |
|
1646 | - * @internal param string $label |
|
1647 | - * @return void |
|
1648 | - */ |
|
1649 | - public function add_extra_finalize_registration_inputs($next_step) |
|
1650 | - { |
|
1651 | - if ($next_step === 'finalize_registration') { |
|
1652 | - echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
|
1653 | - } |
|
1654 | - } |
|
1655 | - |
|
1656 | - |
|
1657 | - |
|
1658 | - /** |
|
1659 | - * display_registration_footer |
|
1660 | - * |
|
1661 | - * @access public |
|
1662 | - * @return string |
|
1663 | - */ |
|
1664 | - public static function display_registration_footer() |
|
1665 | - { |
|
1666 | - if ( |
|
1667 | - apply_filters( |
|
1668 | - 'FHEE__EE_Front__Controller__show_reg_footer', |
|
1669 | - EE_Registry::instance()->CFG->admin->show_reg_footer |
|
1670 | - ) |
|
1671 | - ) { |
|
1672 | - add_filter( |
|
1673 | - 'FHEE__EEH_Template__powered_by_event_espresso__url', |
|
1674 | - function ($url) { |
|
1675 | - return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1676 | - } |
|
1677 | - ); |
|
1678 | - echo apply_filters( |
|
1679 | - 'FHEE__EE_Front_Controller__display_registration_footer', |
|
1680 | - \EEH_Template::powered_by_event_espresso( |
|
1681 | - '', |
|
1682 | - 'espresso-registration-footer-dv', |
|
1683 | - array('utm_content' => 'registration_checkout') |
|
1684 | - ) |
|
1685 | - ); |
|
1686 | - } |
|
1687 | - return ''; |
|
1688 | - } |
|
1689 | - |
|
1690 | - |
|
1691 | - |
|
1692 | - /** |
|
1693 | - * unlock_transaction |
|
1694 | - * |
|
1695 | - * @access public |
|
1696 | - * @return void |
|
1697 | - * @throws EE_Error |
|
1698 | - */ |
|
1699 | - public function unlock_transaction() |
|
1700 | - { |
|
1701 | - if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1702 | - $this->checkout->transaction->unlock(); |
|
1703 | - } |
|
1704 | - } |
|
1705 | - |
|
1706 | - |
|
1707 | - |
|
1708 | - /** |
|
1709 | - * _setup_redirect |
|
1710 | - * |
|
1711 | - * @access private |
|
1712 | - * @return void |
|
1713 | - */ |
|
1714 | - private function _setup_redirect() |
|
1715 | - { |
|
1716 | - if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1717 | - $this->checkout->redirect = true; |
|
1718 | - if (empty($this->checkout->redirect_url)) { |
|
1719 | - $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
|
1720 | - } |
|
1721 | - $this->checkout->redirect_url = apply_filters( |
|
1722 | - 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', |
|
1723 | - $this->checkout->redirect_url, |
|
1724 | - $this->checkout |
|
1725 | - ); |
|
1726 | - } |
|
1727 | - } |
|
1728 | - |
|
1729 | - |
|
1730 | - |
|
1731 | - /** |
|
1732 | - * handle ajax message responses and redirects |
|
1733 | - * |
|
1734 | - * @access public |
|
1735 | - * @return void |
|
1736 | - * @throws EE_Error |
|
1737 | - */ |
|
1738 | - public function go_to_next_step() |
|
1739 | - { |
|
1740 | - if (EE_Registry::instance()->REQ->ajax) { |
|
1741 | - // capture contents of output buffer we started earlier in the request, and insert into JSON response |
|
1742 | - $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1743 | - } |
|
1744 | - $this->unlock_transaction(); |
|
1745 | - // just return for these conditions |
|
1746 | - if ( |
|
1747 | - $this->checkout->admin_request |
|
1748 | - || $this->checkout->action === 'redirect_form' |
|
1749 | - || $this->checkout->action === 'update_checkout' |
|
1750 | - ) { |
|
1751 | - return; |
|
1752 | - } |
|
1753 | - // AJAX response |
|
1754 | - $this->_handle_json_response(); |
|
1755 | - // redirect to next step or the Thank You page |
|
1756 | - $this->_handle_html_redirects(); |
|
1757 | - // hmmm... must be something wrong, so let's just display the form again ! |
|
1758 | - $this->_display_spco_reg_form(); |
|
1759 | - } |
|
1760 | - |
|
1761 | - |
|
1762 | - |
|
1763 | - /** |
|
1764 | - * _handle_json_response |
|
1765 | - * |
|
1766 | - * @access protected |
|
1767 | - * @return void |
|
1768 | - */ |
|
1769 | - protected function _handle_json_response() |
|
1770 | - { |
|
1771 | - // if this is an ajax request |
|
1772 | - if (EE_Registry::instance()->REQ->ajax) { |
|
1773 | - // DEBUG LOG |
|
1774 | - //$this->checkout->log( |
|
1775 | - // __CLASS__, __FUNCTION__, __LINE__, |
|
1776 | - // array( |
|
1777 | - // 'json_response_redirect_url' => $this->checkout->json_response->redirect_url(), |
|
1778 | - // 'redirect' => $this->checkout->redirect, |
|
1779 | - // 'continue_reg' => $this->checkout->continue_reg, |
|
1780 | - // ) |
|
1781 | - //); |
|
1782 | - $this->checkout->json_response->set_registration_time_limit( |
|
1783 | - $this->checkout->get_registration_time_limit() |
|
1784 | - ); |
|
1785 | - $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1786 | - // just send the ajax ( |
|
1787 | - $json_response = apply_filters( |
|
1788 | - 'FHEE__EE_Single_Page_Checkout__JSON_response', |
|
1789 | - $this->checkout->json_response |
|
1790 | - ); |
|
1791 | - echo $json_response; |
|
1792 | - exit(); |
|
1793 | - } |
|
1794 | - } |
|
1795 | - |
|
1796 | - |
|
1797 | - |
|
1798 | - /** |
|
1799 | - * _handle_redirects |
|
1800 | - * |
|
1801 | - * @access protected |
|
1802 | - * @return void |
|
1803 | - */ |
|
1804 | - protected function _handle_html_redirects() |
|
1805 | - { |
|
1806 | - // going somewhere ? |
|
1807 | - if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1808 | - // store notices in a transient |
|
1809 | - EE_Error::get_notices(false, true, true); |
|
1810 | - // DEBUG LOG |
|
1811 | - //$this->checkout->log( |
|
1812 | - // __CLASS__, __FUNCTION__, __LINE__, |
|
1813 | - // array( |
|
1814 | - // 'headers_sent' => headers_sent(), |
|
1815 | - // 'redirect_url' => $this->checkout->redirect_url, |
|
1816 | - // 'headers_list' => headers_list(), |
|
1817 | - // ) |
|
1818 | - //); |
|
1819 | - wp_safe_redirect($this->checkout->redirect_url); |
|
1820 | - exit(); |
|
1821 | - } |
|
1822 | - } |
|
1823 | - |
|
1824 | - |
|
1825 | - |
|
1826 | - /** |
|
1827 | - * set_checkout_anchor |
|
1828 | - * |
|
1829 | - * @access public |
|
1830 | - * @return void |
|
1831 | - */ |
|
1832 | - public function set_checkout_anchor() |
|
1833 | - { |
|
1834 | - echo '<a id="checkout" style="float: left; margin-left: -999em;"></a>'; |
|
1835 | - } |
|
1836 | - |
|
1837 | - /** |
|
1838 | - * getRegistrationExpirationNotice |
|
1839 | - * |
|
1840 | - * @since 4.9.59.p |
|
1841 | - * @access public |
|
1842 | - * @return string |
|
1843 | - */ |
|
1844 | - public static function getRegistrationExpirationNotice() |
|
1845 | - { |
|
1846 | - return sprintf( |
|
1847 | - __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please accept our apologies for any inconvenience this may have caused.%8$s', |
|
1848 | - 'event_espresso'), |
|
1849 | - '<h4 class="important-notice">', |
|
1850 | - '</h4>', |
|
1851 | - '<br />', |
|
1852 | - '<p>', |
|
1853 | - '<a href="' . get_post_type_archive_link('espresso_events') . '" title="', |
|
1854 | - '">', |
|
1855 | - '</a>', |
|
1856 | - '</p>' |
|
1857 | - ); |
|
1858 | - } |
|
24 | + /** |
|
25 | + * $_initialized - has the SPCO controller already been initialized ? |
|
26 | + * |
|
27 | + * @access private |
|
28 | + * @var bool $_initialized |
|
29 | + */ |
|
30 | + private static $_initialized = false; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * $_checkout_verified - is the EE_Checkout verified as correct for this request ? |
|
35 | + * |
|
36 | + * @access private |
|
37 | + * @var bool $_valid_checkout |
|
38 | + */ |
|
39 | + private static $_checkout_verified = true; |
|
40 | + |
|
41 | + /** |
|
42 | + * $_reg_steps_array - holds initial array of reg steps |
|
43 | + * |
|
44 | + * @access private |
|
45 | + * @var array $_reg_steps_array |
|
46 | + */ |
|
47 | + private static $_reg_steps_array = array(); |
|
48 | + |
|
49 | + /** |
|
50 | + * $checkout - EE_Checkout object for handling the properties of the current checkout process |
|
51 | + * |
|
52 | + * @access public |
|
53 | + * @var EE_Checkout $checkout |
|
54 | + */ |
|
55 | + public $checkout; |
|
56 | + |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * @return EED_Module|EED_Single_Page_Checkout |
|
61 | + */ |
|
62 | + public static function instance() |
|
63 | + { |
|
64 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
65 | + return parent::get_instance(__CLASS__); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * @return EE_CART |
|
72 | + */ |
|
73 | + public function cart() |
|
74 | + { |
|
75 | + return $this->checkout->cart; |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @return EE_Transaction |
|
82 | + */ |
|
83 | + public function transaction() |
|
84 | + { |
|
85 | + return $this->checkout->transaction; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
92 | + * |
|
93 | + * @access public |
|
94 | + * @return void |
|
95 | + * @throws EE_Error |
|
96 | + */ |
|
97 | + public static function set_hooks() |
|
98 | + { |
|
99 | + EED_Single_Page_Checkout::set_definitions(); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
106 | + * |
|
107 | + * @access public |
|
108 | + * @return void |
|
109 | + * @throws EE_Error |
|
110 | + */ |
|
111 | + public static function set_hooks_admin() |
|
112 | + { |
|
113 | + EED_Single_Page_Checkout::set_definitions(); |
|
114 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX)) { |
|
115 | + return; |
|
116 | + } |
|
117 | + // going to start an output buffer in case anything gets accidentally output |
|
118 | + // that might disrupt our JSON response |
|
119 | + ob_start(); |
|
120 | + EED_Single_Page_Checkout::load_request_handler(); |
|
121 | + EED_Single_Page_Checkout::load_reg_steps(); |
|
122 | + // set ajax hooks |
|
123 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
124 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
125 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
126 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
127 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
128 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
129 | + } |
|
130 | + |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * process ajax request |
|
135 | + * |
|
136 | + * @param string $ajax_action |
|
137 | + * @throws EE_Error |
|
138 | + */ |
|
139 | + public static function process_ajax_request($ajax_action) |
|
140 | + { |
|
141 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
142 | + EED_Single_Page_Checkout::instance()->_initialize(); |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * ajax display registration step |
|
149 | + * |
|
150 | + * @throws EE_Error |
|
151 | + */ |
|
152 | + public static function display_reg_step() |
|
153 | + { |
|
154 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * ajax process registration step |
|
161 | + * |
|
162 | + * @throws EE_Error |
|
163 | + */ |
|
164 | + public static function process_reg_step() |
|
165 | + { |
|
166 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * ajax process registration step |
|
173 | + * |
|
174 | + * @throws EE_Error |
|
175 | + */ |
|
176 | + public static function update_reg_step() |
|
177 | + { |
|
178 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * update_checkout |
|
185 | + * |
|
186 | + * @access public |
|
187 | + * @return void |
|
188 | + * @throws EE_Error |
|
189 | + */ |
|
190 | + public static function update_checkout() |
|
191 | + { |
|
192 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
193 | + } |
|
194 | + |
|
195 | + |
|
196 | + |
|
197 | + /** |
|
198 | + * load_request_handler |
|
199 | + * |
|
200 | + * @access public |
|
201 | + * @return void |
|
202 | + */ |
|
203 | + public static function load_request_handler() |
|
204 | + { |
|
205 | + // load core Request_Handler class |
|
206 | + if (EE_Registry::instance()->REQ !== null) { |
|
207 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
208 | + } |
|
209 | + } |
|
210 | + |
|
211 | + |
|
212 | + |
|
213 | + /** |
|
214 | + * set_definitions |
|
215 | + * |
|
216 | + * @access public |
|
217 | + * @return void |
|
218 | + * @throws EE_Error |
|
219 | + */ |
|
220 | + public static function set_definitions() |
|
221 | + { |
|
222 | + if(defined('SPCO_BASE_PATH')) { |
|
223 | + return; |
|
224 | + } |
|
225 | + define( |
|
226 | + 'SPCO_BASE_PATH', |
|
227 | + rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS |
|
228 | + ); |
|
229 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS); |
|
230 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS); |
|
231 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS); |
|
232 | + define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS); |
|
233 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS); |
|
234 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS); |
|
235 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true); |
|
236 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = EED_Single_Page_Checkout::getRegistrationExpirationNotice(); |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + |
|
241 | + /** |
|
242 | + * load_reg_steps |
|
243 | + * loads and instantiates each reg step based on the EE_Registry::instance()->CFG->registration->reg_steps array |
|
244 | + * |
|
245 | + * @access private |
|
246 | + * @throws EE_Error |
|
247 | + */ |
|
248 | + public static function load_reg_steps() |
|
249 | + { |
|
250 | + static $reg_steps_loaded = false; |
|
251 | + if ($reg_steps_loaded) { |
|
252 | + return; |
|
253 | + } |
|
254 | + // filter list of reg_steps |
|
255 | + $reg_steps_to_load = (array)apply_filters( |
|
256 | + 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', |
|
257 | + EED_Single_Page_Checkout::get_reg_steps() |
|
258 | + ); |
|
259 | + // sort by key (order) |
|
260 | + ksort($reg_steps_to_load); |
|
261 | + // loop through folders |
|
262 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
263 | + // we need a |
|
264 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
265 | + // copy over to the reg_steps_array |
|
266 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
267 | + // register custom key route for each reg step |
|
268 | + // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
|
269 | + EE_Config::register_route( |
|
270 | + $reg_step['slug'], |
|
271 | + 'EED_Single_Page_Checkout', |
|
272 | + 'run', |
|
273 | + 'step' |
|
274 | + ); |
|
275 | + // add AJAX or other hooks |
|
276 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
277 | + // setup autoloaders if necessary |
|
278 | + if ( ! class_exists($reg_step['class_name'])) { |
|
279 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder( |
|
280 | + $reg_step['file_path'], |
|
281 | + true |
|
282 | + ); |
|
283 | + } |
|
284 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
285 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
286 | + } |
|
287 | + } |
|
288 | + } |
|
289 | + } |
|
290 | + $reg_steps_loaded = true; |
|
291 | + } |
|
292 | + |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * get_reg_steps |
|
297 | + * |
|
298 | + * @access public |
|
299 | + * @return array |
|
300 | + */ |
|
301 | + public static function get_reg_steps() |
|
302 | + { |
|
303 | + $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
|
304 | + if (empty($reg_steps)) { |
|
305 | + $reg_steps = array( |
|
306 | + 10 => array( |
|
307 | + 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
308 | + 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
|
309 | + 'slug' => 'attendee_information', |
|
310 | + 'has_hooks' => false, |
|
311 | + ), |
|
312 | + 30 => array( |
|
313 | + 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
314 | + 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
|
315 | + 'slug' => 'payment_options', |
|
316 | + 'has_hooks' => true, |
|
317 | + ), |
|
318 | + 999 => array( |
|
319 | + 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
320 | + 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
|
321 | + 'slug' => 'finalize_registration', |
|
322 | + 'has_hooks' => false, |
|
323 | + ), |
|
324 | + ); |
|
325 | + } |
|
326 | + return $reg_steps; |
|
327 | + } |
|
328 | + |
|
329 | + |
|
330 | + |
|
331 | + /** |
|
332 | + * registration_checkout_for_admin |
|
333 | + * |
|
334 | + * @access public |
|
335 | + * @return string |
|
336 | + * @throws EE_Error |
|
337 | + */ |
|
338 | + public static function registration_checkout_for_admin() |
|
339 | + { |
|
340 | + EED_Single_Page_Checkout::load_request_handler(); |
|
341 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
342 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
343 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
344 | + EED_Single_Page_Checkout::instance()->_initialize(); |
|
345 | + EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
|
346 | + return EE_Registry::instance()->REQ->get_output(); |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + |
|
351 | + /** |
|
352 | + * process_registration_from_admin |
|
353 | + * |
|
354 | + * @access public |
|
355 | + * @return \EE_Transaction |
|
356 | + * @throws EE_Error |
|
357 | + */ |
|
358 | + public static function process_registration_from_admin() |
|
359 | + { |
|
360 | + EED_Single_Page_Checkout::load_request_handler(); |
|
361 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
362 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
363 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
364 | + EED_Single_Page_Checkout::instance()->_initialize(); |
|
365 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
366 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
367 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
368 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
369 | + if ($final_reg_step->process_reg_step()) { |
|
370 | + $final_reg_step->set_completed(); |
|
371 | + EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
|
372 | + return EED_Single_Page_Checkout::instance()->checkout->transaction; |
|
373 | + } |
|
374 | + } |
|
375 | + } |
|
376 | + return null; |
|
377 | + } |
|
378 | + |
|
379 | + |
|
380 | + |
|
381 | + /** |
|
382 | + * run |
|
383 | + * |
|
384 | + * @access public |
|
385 | + * @param WP_Query $WP_Query |
|
386 | + * @return void |
|
387 | + * @throws EE_Error |
|
388 | + */ |
|
389 | + public function run($WP_Query) |
|
390 | + { |
|
391 | + if ( |
|
392 | + $WP_Query instanceof WP_Query |
|
393 | + && $WP_Query->is_main_query() |
|
394 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
395 | + && $this->_is_reg_checkout() |
|
396 | + ) { |
|
397 | + $this->_initialize(); |
|
398 | + } |
|
399 | + } |
|
400 | + |
|
401 | + |
|
402 | + |
|
403 | + /** |
|
404 | + * determines whether current url matches reg page url |
|
405 | + * |
|
406 | + * @return bool |
|
407 | + */ |
|
408 | + protected function _is_reg_checkout() |
|
409 | + { |
|
410 | + // get current permalink for reg page without any extra query args |
|
411 | + $reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id); |
|
412 | + // get request URI for current request, but without the scheme or host |
|
413 | + $current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI'); |
|
414 | + $current_request_uri = html_entity_decode($current_request_uri); |
|
415 | + // get array of query args from the current request URI |
|
416 | + $query_args = \EEH_URL::get_query_string($current_request_uri); |
|
417 | + // grab page id if it is set |
|
418 | + $page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0; |
|
419 | + // and remove the page id from the query args (we will re-add it later) |
|
420 | + unset($query_args['page_id']); |
|
421 | + // now strip all query args from current request URI |
|
422 | + $current_request_uri = remove_query_arg(array_keys($query_args), $current_request_uri); |
|
423 | + // and re-add the page id if it was set |
|
424 | + if ($page_id) { |
|
425 | + $current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri); |
|
426 | + } |
|
427 | + // remove slashes and ? |
|
428 | + $current_request_uri = trim($current_request_uri, '?/'); |
|
429 | + // is current request URI part of the known full reg page URL ? |
|
430 | + return ! empty($current_request_uri) && strpos($reg_page_url, $current_request_uri) !== false; |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + |
|
435 | + /** |
|
436 | + * @param WP_Query $wp_query |
|
437 | + * @return void |
|
438 | + * @throws EE_Error |
|
439 | + */ |
|
440 | + public static function init($wp_query) |
|
441 | + { |
|
442 | + EED_Single_Page_Checkout::instance()->run($wp_query); |
|
443 | + } |
|
444 | + |
|
445 | + |
|
446 | + |
|
447 | + /** |
|
448 | + * _initialize - initial module setup |
|
449 | + * |
|
450 | + * @access private |
|
451 | + * @throws EE_Error |
|
452 | + * @return void |
|
453 | + */ |
|
454 | + private function _initialize() |
|
455 | + { |
|
456 | + // ensure SPCO doesn't run twice |
|
457 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
458 | + return; |
|
459 | + } |
|
460 | + try { |
|
461 | + EED_Single_Page_Checkout::load_reg_steps(); |
|
462 | + $this->_verify_session(); |
|
463 | + // setup the EE_Checkout object |
|
464 | + $this->checkout = $this->_initialize_checkout(); |
|
465 | + // filter checkout |
|
466 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
467 | + // get the $_GET |
|
468 | + $this->_get_request_vars(); |
|
469 | + if ($this->_block_bots()) { |
|
470 | + return; |
|
471 | + } |
|
472 | + // filter continue_reg |
|
473 | + $this->checkout->continue_reg = apply_filters( |
|
474 | + 'FHEE__EED_Single_Page_Checkout__init___continue_reg', |
|
475 | + true, |
|
476 | + $this->checkout |
|
477 | + ); |
|
478 | + // load the reg steps array |
|
479 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
480 | + EED_Single_Page_Checkout::$_initialized = true; |
|
481 | + return; |
|
482 | + } |
|
483 | + // set the current step |
|
484 | + $this->checkout->set_current_step($this->checkout->step); |
|
485 | + // and the next step |
|
486 | + $this->checkout->set_next_step(); |
|
487 | + // verify that everything has been setup correctly |
|
488 | + if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
489 | + EED_Single_Page_Checkout::$_initialized = true; |
|
490 | + return; |
|
491 | + } |
|
492 | + // lock the transaction |
|
493 | + $this->checkout->transaction->lock(); |
|
494 | + // make sure all of our cached objects are added to their respective model entity mappers |
|
495 | + $this->checkout->refresh_all_entities(); |
|
496 | + // set amount owing |
|
497 | + $this->checkout->amount_owing = $this->checkout->transaction->remaining(); |
|
498 | + // initialize each reg step, which gives them the chance to potentially alter the process |
|
499 | + $this->_initialize_reg_steps(); |
|
500 | + // DEBUG LOG |
|
501 | + //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
|
502 | + // get reg form |
|
503 | + if( ! $this->_check_form_submission()) { |
|
504 | + EED_Single_Page_Checkout::$_initialized = true; |
|
505 | + return; |
|
506 | + } |
|
507 | + // checkout the action!!! |
|
508 | + $this->_process_form_action(); |
|
509 | + // add some style and make it dance |
|
510 | + $this->add_styles_and_scripts(); |
|
511 | + // kk... SPCO has successfully run |
|
512 | + EED_Single_Page_Checkout::$_initialized = true; |
|
513 | + // set no cache headers and constants |
|
514 | + EE_System::do_not_cache(); |
|
515 | + // add anchor |
|
516 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
517 | + // remove transaction lock |
|
518 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
519 | + } catch (Exception $e) { |
|
520 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
521 | + } |
|
522 | + } |
|
523 | + |
|
524 | + |
|
525 | + |
|
526 | + /** |
|
527 | + * _verify_session |
|
528 | + * checks that the session is valid and not expired |
|
529 | + * |
|
530 | + * @access private |
|
531 | + * @throws EE_Error |
|
532 | + */ |
|
533 | + private function _verify_session() |
|
534 | + { |
|
535 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
536 | + throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
537 | + } |
|
538 | + $clear_session_requested = filter_var( |
|
539 | + EE_Registry::instance()->REQ->get('clear_session', false), |
|
540 | + FILTER_VALIDATE_BOOLEAN |
|
541 | + ); |
|
542 | + // is session still valid ? |
|
543 | + if ($clear_session_requested |
|
544 | + || ( EE_Registry::instance()->SSN->expired() |
|
545 | + && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '' |
|
546 | + ) |
|
547 | + ) { |
|
548 | + $this->checkout = new EE_Checkout(); |
|
549 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
550 | + // EE_Registry::instance()->SSN->reset_cart(); |
|
551 | + // EE_Registry::instance()->SSN->reset_checkout(); |
|
552 | + // EE_Registry::instance()->SSN->reset_transaction(); |
|
553 | + if (! $clear_session_requested) { |
|
554 | + EE_Error::add_attention( |
|
555 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'], |
|
556 | + __FILE__, __FUNCTION__, __LINE__ |
|
557 | + ); |
|
558 | + } |
|
559 | + // EE_Registry::instance()->SSN->reset_expired(); |
|
560 | + } |
|
561 | + } |
|
562 | + |
|
563 | + |
|
564 | + |
|
565 | + /** |
|
566 | + * _initialize_checkout |
|
567 | + * loads and instantiates EE_Checkout |
|
568 | + * |
|
569 | + * @access private |
|
570 | + * @throws EE_Error |
|
571 | + * @return EE_Checkout |
|
572 | + */ |
|
573 | + private function _initialize_checkout() |
|
574 | + { |
|
575 | + // look in session for existing checkout |
|
576 | + /** @type EE_Checkout $checkout */ |
|
577 | + $checkout = EE_Registry::instance()->SSN->checkout(); |
|
578 | + // verify |
|
579 | + if ( ! $checkout instanceof EE_Checkout) { |
|
580 | + // instantiate EE_Checkout object for handling the properties of the current checkout process |
|
581 | + $checkout = EE_Registry::instance()->load_file( |
|
582 | + SPCO_INC_PATH, |
|
583 | + 'EE_Checkout', |
|
584 | + 'class', array(), |
|
585 | + false |
|
586 | + ); |
|
587 | + } else { |
|
588 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
589 | + $this->unlock_transaction(); |
|
590 | + wp_safe_redirect($checkout->redirect_url); |
|
591 | + exit(); |
|
592 | + } |
|
593 | + } |
|
594 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
595 | + // verify again |
|
596 | + if ( ! $checkout instanceof EE_Checkout) { |
|
597 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
598 | + } |
|
599 | + // reset anything that needs a clean slate for each request |
|
600 | + $checkout->reset_for_current_request(); |
|
601 | + return $checkout; |
|
602 | + } |
|
603 | + |
|
604 | + |
|
605 | + |
|
606 | + /** |
|
607 | + * _get_request_vars |
|
608 | + * |
|
609 | + * @access private |
|
610 | + * @return void |
|
611 | + * @throws EE_Error |
|
612 | + */ |
|
613 | + private function _get_request_vars() |
|
614 | + { |
|
615 | + // load classes |
|
616 | + EED_Single_Page_Checkout::load_request_handler(); |
|
617 | + //make sure this request is marked as belonging to EE |
|
618 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
619 | + // which step is being requested ? |
|
620 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
621 | + // which step is being edited ? |
|
622 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
623 | + // and what we're doing on the current step |
|
624 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
625 | + // timestamp |
|
626 | + $this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0); |
|
627 | + // returning to edit ? |
|
628 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
629 | + // add reg url link to registration query params |
|
630 | + if ($this->checkout->reg_url_link && strpos($this->checkout->reg_url_link, '1-') !== 0) { |
|
631 | + $this->checkout->reg_cache_where_params[0]['REG_url_link'] = $this->checkout->reg_url_link; |
|
632 | + } |
|
633 | + // or some other kind of revisit ? |
|
634 | + $this->checkout->revisit = filter_var( |
|
635 | + EE_Registry::instance()->REQ->get('revisit', false), |
|
636 | + FILTER_VALIDATE_BOOLEAN |
|
637 | + ); |
|
638 | + // and whether or not to generate a reg form for this request |
|
639 | + $this->checkout->generate_reg_form = filter_var( |
|
640 | + EE_Registry::instance()->REQ->get('generate_reg_form', true), |
|
641 | + FILTER_VALIDATE_BOOLEAN |
|
642 | + ); |
|
643 | + // and whether or not to process a reg form submission for this request |
|
644 | + $this->checkout->process_form_submission = filter_var( |
|
645 | + EE_Registry::instance()->REQ->get( |
|
646 | + 'process_form_submission', |
|
647 | + $this->checkout->action === 'process_reg_step' |
|
648 | + ), |
|
649 | + FILTER_VALIDATE_BOOLEAN |
|
650 | + ); |
|
651 | + $this->checkout->process_form_submission = filter_var( |
|
652 | + $this->checkout->action !== 'display_spco_reg_step' |
|
653 | + ? $this->checkout->process_form_submission |
|
654 | + : false, |
|
655 | + FILTER_VALIDATE_BOOLEAN |
|
656 | + ); |
|
657 | + // $this->_display_request_vars(); |
|
658 | + } |
|
659 | + |
|
660 | + |
|
661 | + |
|
662 | + /** |
|
663 | + * _display_request_vars |
|
664 | + * |
|
665 | + * @access protected |
|
666 | + * @return void |
|
667 | + */ |
|
668 | + protected function _display_request_vars() |
|
669 | + { |
|
670 | + if ( ! WP_DEBUG) { |
|
671 | + return; |
|
672 | + } |
|
673 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
674 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
675 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
676 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
677 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
678 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
679 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
680 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
681 | + } |
|
682 | + |
|
683 | + |
|
684 | + |
|
685 | + /** |
|
686 | + * _block_bots |
|
687 | + * checks that the incoming request has either of the following set: |
|
688 | + * a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector |
|
689 | + * a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN |
|
690 | + * so if you're not coming from the Ticket Selector nor returning for a valid IP... |
|
691 | + * then where you coming from man? |
|
692 | + * |
|
693 | + * @return boolean |
|
694 | + */ |
|
695 | + private function _block_bots() |
|
696 | + { |
|
697 | + $invalid_checkout_access = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
698 | + if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) { |
|
699 | + return true; |
|
700 | + } |
|
701 | + return false; |
|
702 | + } |
|
703 | + |
|
704 | + |
|
705 | + |
|
706 | + /** |
|
707 | + * _get_first_step |
|
708 | + * gets slug for first step in $_reg_steps_array |
|
709 | + * |
|
710 | + * @access private |
|
711 | + * @throws EE_Error |
|
712 | + * @return string |
|
713 | + */ |
|
714 | + private function _get_first_step() |
|
715 | + { |
|
716 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
717 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
718 | + } |
|
719 | + |
|
720 | + |
|
721 | + /** |
|
722 | + * instantiates each reg step based on the loaded reg_steps array |
|
723 | + * |
|
724 | + * @return bool |
|
725 | + * @throws EE_Error |
|
726 | + * @throws InvalidArgumentException |
|
727 | + * @throws InvalidDataTypeException |
|
728 | + * @throws InvalidInterfaceException |
|
729 | + */ |
|
730 | + private function _load_and_instantiate_reg_steps() |
|
731 | + { |
|
732 | + do_action('AHEE__Single_Page_Checkout___load_and_instantiate_reg_steps__start', $this->checkout); |
|
733 | + // have reg_steps already been instantiated ? |
|
734 | + if ( |
|
735 | + empty($this->checkout->reg_steps) |
|
736 | + || apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
737 | + ) { |
|
738 | + // if not, then loop through raw reg steps array |
|
739 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
740 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
741 | + return false; |
|
742 | + } |
|
743 | + } |
|
744 | + if(isset($this->checkout->reg_steps['registration_confirmation'])){ |
|
745 | + // skip the registration_confirmation page ? |
|
746 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
747 | + // just remove it from the reg steps array |
|
748 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
749 | + } elseif (EE_Registry::instance()->CFG->registration->reg_confirmation_last |
|
750 | + ) { |
|
751 | + // set the order to something big like 100 |
|
752 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
753 | + } |
|
754 | + } |
|
755 | + // filter the array for good luck |
|
756 | + $this->checkout->reg_steps = apply_filters( |
|
757 | + 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', |
|
758 | + $this->checkout->reg_steps |
|
759 | + ); |
|
760 | + // finally re-sort based on the reg step class order properties |
|
761 | + $this->checkout->sort_reg_steps(); |
|
762 | + } else { |
|
763 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
764 | + // set all current step stati to FALSE |
|
765 | + $reg_step->set_is_current_step(false); |
|
766 | + } |
|
767 | + } |
|
768 | + if (empty($this->checkout->reg_steps)) { |
|
769 | + EE_Error::add_error( |
|
770 | + __('No Reg Steps were loaded..', 'event_espresso'), |
|
771 | + __FILE__, __FUNCTION__, __LINE__ |
|
772 | + ); |
|
773 | + return false; |
|
774 | + } |
|
775 | + // make reg step details available to JS |
|
776 | + $this->checkout->set_reg_step_JSON_info(); |
|
777 | + return true; |
|
778 | + } |
|
779 | + |
|
780 | + |
|
781 | + |
|
782 | + /** |
|
783 | + * _load_and_instantiate_reg_step |
|
784 | + * |
|
785 | + * @access private |
|
786 | + * @param array $reg_step |
|
787 | + * @param int $order |
|
788 | + * @return bool |
|
789 | + */ |
|
790 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) |
|
791 | + { |
|
792 | + // we need a file_path, class_name, and slug to add a reg step |
|
793 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
794 | + // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
|
795 | + if ( |
|
796 | + $this->checkout->reg_url_link |
|
797 | + && $this->checkout->step !== $reg_step['slug'] |
|
798 | + && $reg_step['slug'] !== 'finalize_registration' |
|
799 | + // normally at this point we would NOT load the reg step, but this filter can change that |
|
800 | + && apply_filters( |
|
801 | + 'FHEE__Single_Page_Checkout___load_and_instantiate_reg_step__bypass_reg_step', |
|
802 | + true, |
|
803 | + $reg_step, |
|
804 | + $this->checkout |
|
805 | + ) |
|
806 | + ) { |
|
807 | + return true; |
|
808 | + } |
|
809 | + // instantiate step class using file path and class name |
|
810 | + $reg_step_obj = EE_Registry::instance()->load_file( |
|
811 | + $reg_step['file_path'], |
|
812 | + $reg_step['class_name'], |
|
813 | + 'class', |
|
814 | + $this->checkout, |
|
815 | + false |
|
816 | + ); |
|
817 | + // did we gets the goods ? |
|
818 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
819 | + // set reg step order based on config |
|
820 | + $reg_step_obj->set_order($order); |
|
821 | + // add instantiated reg step object to the master reg steps array |
|
822 | + $this->checkout->add_reg_step($reg_step_obj); |
|
823 | + } else { |
|
824 | + EE_Error::add_error( |
|
825 | + __('The current step could not be set.', 'event_espresso'), |
|
826 | + __FILE__, __FUNCTION__, __LINE__ |
|
827 | + ); |
|
828 | + return false; |
|
829 | + } |
|
830 | + } else { |
|
831 | + if (WP_DEBUG) { |
|
832 | + EE_Error::add_error( |
|
833 | + sprintf( |
|
834 | + __( |
|
835 | + 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', |
|
836 | + 'event_espresso' |
|
837 | + ), |
|
838 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
839 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
840 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
841 | + '<ul>', |
|
842 | + '<li>', |
|
843 | + '</li>', |
|
844 | + '</ul>' |
|
845 | + ), |
|
846 | + __FILE__, __FUNCTION__, __LINE__ |
|
847 | + ); |
|
848 | + } |
|
849 | + return false; |
|
850 | + } |
|
851 | + return true; |
|
852 | + } |
|
853 | + |
|
854 | + |
|
855 | + /** |
|
856 | + * _verify_transaction_and_get_registrations |
|
857 | + * |
|
858 | + * @access private |
|
859 | + * @return bool |
|
860 | + * @throws InvalidDataTypeException |
|
861 | + * @throws InvalidEntityException |
|
862 | + * @throws EE_Error |
|
863 | + */ |
|
864 | + private function _verify_transaction_and_get_registrations() |
|
865 | + { |
|
866 | + // was there already a valid transaction in the checkout from the session ? |
|
867 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
868 | + // get transaction from db or session |
|
869 | + $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
|
870 | + ? $this->_get_transaction_and_cart_for_previous_visit() |
|
871 | + : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
|
872 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
873 | + EE_Error::add_error( |
|
874 | + __('Your Registration and Transaction information could not be retrieved from the db.', |
|
875 | + 'event_espresso'), |
|
876 | + __FILE__, __FUNCTION__, __LINE__ |
|
877 | + ); |
|
878 | + $this->checkout->transaction = EE_Transaction::new_instance(); |
|
879 | + // add some style and make it dance |
|
880 | + $this->add_styles_and_scripts(); |
|
881 | + EED_Single_Page_Checkout::$_initialized = true; |
|
882 | + return false; |
|
883 | + } |
|
884 | + // and the registrations for the transaction |
|
885 | + $this->_get_registrations($this->checkout->transaction); |
|
886 | + } |
|
887 | + return true; |
|
888 | + } |
|
889 | + |
|
890 | + |
|
891 | + |
|
892 | + /** |
|
893 | + * _get_transaction_and_cart_for_previous_visit |
|
894 | + * |
|
895 | + * @access private |
|
896 | + * @return mixed EE_Transaction|NULL |
|
897 | + */ |
|
898 | + private function _get_transaction_and_cart_for_previous_visit() |
|
899 | + { |
|
900 | + /** @var $TXN_model EEM_Transaction */ |
|
901 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
902 | + // because the reg_url_link is present in the request, |
|
903 | + // this is a return visit to SPCO, so we'll get the transaction data from the db |
|
904 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
905 | + // verify transaction |
|
906 | + if ($transaction instanceof EE_Transaction) { |
|
907 | + // and get the cart that was used for that transaction |
|
908 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
909 | + return $transaction; |
|
910 | + } |
|
911 | + EE_Error::add_error( |
|
912 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
913 | + __FILE__, __FUNCTION__, __LINE__ |
|
914 | + ); |
|
915 | + return null; |
|
916 | + |
|
917 | + } |
|
918 | + |
|
919 | + |
|
920 | + |
|
921 | + /** |
|
922 | + * _get_cart_for_transaction |
|
923 | + * |
|
924 | + * @access private |
|
925 | + * @param EE_Transaction $transaction |
|
926 | + * @return EE_Cart |
|
927 | + */ |
|
928 | + private function _get_cart_for_transaction($transaction) |
|
929 | + { |
|
930 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
931 | + } |
|
932 | + |
|
933 | + |
|
934 | + |
|
935 | + /** |
|
936 | + * get_cart_for_transaction |
|
937 | + * |
|
938 | + * @access public |
|
939 | + * @param EE_Transaction $transaction |
|
940 | + * @return EE_Cart |
|
941 | + */ |
|
942 | + public function get_cart_for_transaction(EE_Transaction $transaction) |
|
943 | + { |
|
944 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
945 | + } |
|
946 | + |
|
947 | + |
|
948 | + |
|
949 | + /** |
|
950 | + * _get_transaction_and_cart_for_current_session |
|
951 | + * generates a new EE_Transaction object and adds it to the $_transaction property. |
|
952 | + * |
|
953 | + * @access private |
|
954 | + * @return EE_Transaction |
|
955 | + * @throws EE_Error |
|
956 | + */ |
|
957 | + private function _get_cart_for_current_session_and_setup_new_transaction() |
|
958 | + { |
|
959 | + // if there's no transaction, then this is the FIRST visit to SPCO |
|
960 | + // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
|
961 | + $this->checkout->cart = $this->_get_cart_for_transaction(null); |
|
962 | + // and then create a new transaction |
|
963 | + $transaction = $this->_initialize_transaction(); |
|
964 | + // verify transaction |
|
965 | + if ($transaction instanceof EE_Transaction) { |
|
966 | + // save it so that we have an ID for other objects to use |
|
967 | + $transaction->save(); |
|
968 | + // and save TXN data to the cart |
|
969 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
970 | + } else { |
|
971 | + EE_Error::add_error( |
|
972 | + __('A Valid Transaction could not be initialized.', 'event_espresso'), |
|
973 | + __FILE__, __FUNCTION__, __LINE__ |
|
974 | + ); |
|
975 | + } |
|
976 | + return $transaction; |
|
977 | + } |
|
978 | + |
|
979 | + |
|
980 | + |
|
981 | + /** |
|
982 | + * generates a new EE_Transaction object and adds it to the $_transaction property. |
|
983 | + * |
|
984 | + * @access private |
|
985 | + * @return mixed EE_Transaction|NULL |
|
986 | + */ |
|
987 | + private function _initialize_transaction() |
|
988 | + { |
|
989 | + try { |
|
990 | + // ensure cart totals have been calculated |
|
991 | + $this->checkout->cart->get_grand_total()->recalculate_total_including_taxes(); |
|
992 | + // grab the cart grand total |
|
993 | + $cart_total = $this->checkout->cart->get_cart_grand_total(); |
|
994 | + // create new TXN |
|
995 | + $transaction = EE_Transaction::new_instance( |
|
996 | + array( |
|
997 | + 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
|
998 | + 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
|
999 | + 'TXN_paid' => 0, |
|
1000 | + 'STS_ID' => EEM_Transaction::failed_status_code, |
|
1001 | + ) |
|
1002 | + ); |
|
1003 | + // save it so that we have an ID for other objects to use |
|
1004 | + $transaction->save(); |
|
1005 | + // set cron job for following up on TXNs after their session has expired |
|
1006 | + EE_Cron_Tasks::schedule_expired_transaction_check( |
|
1007 | + EE_Registry::instance()->SSN->expiration() + 1, |
|
1008 | + $transaction->ID() |
|
1009 | + ); |
|
1010 | + return $transaction; |
|
1011 | + } catch (Exception $e) { |
|
1012 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1013 | + } |
|
1014 | + return null; |
|
1015 | + } |
|
1016 | + |
|
1017 | + |
|
1018 | + /** |
|
1019 | + * _get_registrations |
|
1020 | + * |
|
1021 | + * @access private |
|
1022 | + * @param EE_Transaction $transaction |
|
1023 | + * @return void |
|
1024 | + * @throws InvalidDataTypeException |
|
1025 | + * @throws InvalidEntityException |
|
1026 | + * @throws EE_Error |
|
1027 | + */ |
|
1028 | + private function _get_registrations(EE_Transaction $transaction) |
|
1029 | + { |
|
1030 | + // first step: grab the registrants { : o |
|
1031 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
1032 | + $this->checkout->total_ticket_count = count($registrations); |
|
1033 | + // verify registrations have been set |
|
1034 | + if (empty($registrations)) { |
|
1035 | + // if no cached registrations, then check the db |
|
1036 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
1037 | + // still nothing ? well as long as this isn't a revisit |
|
1038 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
1039 | + // generate new registrations from scratch |
|
1040 | + $registrations = $this->_initialize_registrations($transaction); |
|
1041 | + } |
|
1042 | + } |
|
1043 | + // sort by their original registration order |
|
1044 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
1045 | + // then loop thru the array |
|
1046 | + foreach ($registrations as $registration) { |
|
1047 | + // verify each registration |
|
1048 | + if ($registration instanceof EE_Registration) { |
|
1049 | + // we display all attendee info for the primary registrant |
|
1050 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
1051 | + && $registration->is_primary_registrant() |
|
1052 | + ) { |
|
1053 | + $this->checkout->primary_revisit = true; |
|
1054 | + break; |
|
1055 | + } |
|
1056 | + if ($this->checkout->revisit && $this->checkout->reg_url_link !== $registration->reg_url_link()) { |
|
1057 | + // but hide info if it doesn't belong to you |
|
1058 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
1059 | + $this->checkout->total_ticket_count--; |
|
1060 | + } |
|
1061 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
1062 | + } |
|
1063 | + } |
|
1064 | + } |
|
1065 | + |
|
1066 | + |
|
1067 | + /** |
|
1068 | + * adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object |
|
1069 | + * |
|
1070 | + * @access private |
|
1071 | + * @param EE_Transaction $transaction |
|
1072 | + * @return array |
|
1073 | + * @throws InvalidDataTypeException |
|
1074 | + * @throws InvalidEntityException |
|
1075 | + * @throws EE_Error |
|
1076 | + */ |
|
1077 | + private function _initialize_registrations(EE_Transaction $transaction) |
|
1078 | + { |
|
1079 | + $att_nmbr = 0; |
|
1080 | + $registrations = array(); |
|
1081 | + if ($transaction instanceof EE_Transaction) { |
|
1082 | + /** @type EE_Registration_Processor $registration_processor */ |
|
1083 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1084 | + $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
|
1085 | + // now let's add the cart items to the $transaction |
|
1086 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
1087 | + //do the following for each ticket of this type they selected |
|
1088 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
1089 | + $att_nmbr++; |
|
1090 | + /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
1091 | + $CreateRegistrationCommand = EE_Registry::instance()->create( |
|
1092 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
1093 | + array( |
|
1094 | + $transaction, |
|
1095 | + $line_item, |
|
1096 | + $att_nmbr, |
|
1097 | + $this->checkout->total_ticket_count, |
|
1098 | + ) |
|
1099 | + ); |
|
1100 | + // override capabilities for frontend registrations |
|
1101 | + if ( ! is_admin()) { |
|
1102 | + $CreateRegistrationCommand->setCapCheck( |
|
1103 | + new PublicCapabilities('', 'create_new_registration') |
|
1104 | + ); |
|
1105 | + } |
|
1106 | + $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
1107 | + if ( ! $registration instanceof EE_Registration) { |
|
1108 | + throw new InvalidEntityException($registration, 'EE_Registration'); |
|
1109 | + } |
|
1110 | + $registrations[ $registration->ID() ] = $registration; |
|
1111 | + } |
|
1112 | + } |
|
1113 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
1114 | + } |
|
1115 | + return $registrations; |
|
1116 | + } |
|
1117 | + |
|
1118 | + |
|
1119 | + |
|
1120 | + /** |
|
1121 | + * sorts registrations by REG_count |
|
1122 | + * |
|
1123 | + * @access public |
|
1124 | + * @param EE_Registration $reg_A |
|
1125 | + * @param EE_Registration $reg_B |
|
1126 | + * @return int |
|
1127 | + */ |
|
1128 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) |
|
1129 | + { |
|
1130 | + // this shouldn't ever happen within the same TXN, but oh well |
|
1131 | + if ($reg_A->count() === $reg_B->count()) { |
|
1132 | + return 0; |
|
1133 | + } |
|
1134 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
1135 | + } |
|
1136 | + |
|
1137 | + |
|
1138 | + |
|
1139 | + /** |
|
1140 | + * _final_verifications |
|
1141 | + * just makes sure that everything is set up correctly before proceeding |
|
1142 | + * |
|
1143 | + * @access private |
|
1144 | + * @return bool |
|
1145 | + * @throws EE_Error |
|
1146 | + */ |
|
1147 | + private function _final_verifications() |
|
1148 | + { |
|
1149 | + // filter checkout |
|
1150 | + $this->checkout = apply_filters( |
|
1151 | + 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', |
|
1152 | + $this->checkout |
|
1153 | + ); |
|
1154 | + //verify that current step is still set correctly |
|
1155 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
1156 | + EE_Error::add_error( |
|
1157 | + __('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), |
|
1158 | + __FILE__, |
|
1159 | + __FUNCTION__, |
|
1160 | + __LINE__ |
|
1161 | + ); |
|
1162 | + return false; |
|
1163 | + } |
|
1164 | + // if returning to SPCO, then verify that primary registrant is set |
|
1165 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
1166 | + $valid_registrant = $this->checkout->transaction->primary_registration(); |
|
1167 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
1168 | + EE_Error::add_error( |
|
1169 | + __('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), |
|
1170 | + __FILE__, |
|
1171 | + __FUNCTION__, |
|
1172 | + __LINE__ |
|
1173 | + ); |
|
1174 | + return false; |
|
1175 | + } |
|
1176 | + $valid_registrant = null; |
|
1177 | + foreach ( |
|
1178 | + $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration |
|
1179 | + ) { |
|
1180 | + if ( |
|
1181 | + $registration instanceof EE_Registration |
|
1182 | + && $registration->reg_url_link() === $this->checkout->reg_url_link |
|
1183 | + ) { |
|
1184 | + $valid_registrant = $registration; |
|
1185 | + } |
|
1186 | + } |
|
1187 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
1188 | + // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
|
1189 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
1190 | + // clear the session, mark the checkout as unverified, and try again |
|
1191 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1192 | + EED_Single_Page_Checkout::$_initialized = false; |
|
1193 | + EED_Single_Page_Checkout::$_checkout_verified = false; |
|
1194 | + $this->_initialize(); |
|
1195 | + EE_Error::reset_notices(); |
|
1196 | + return false; |
|
1197 | + } |
|
1198 | + EE_Error::add_error( |
|
1199 | + __( |
|
1200 | + 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', |
|
1201 | + 'event_espresso' |
|
1202 | + ), |
|
1203 | + __FILE__, |
|
1204 | + __FUNCTION__, |
|
1205 | + __LINE__ |
|
1206 | + ); |
|
1207 | + return false; |
|
1208 | + } |
|
1209 | + } |
|
1210 | + // now that things have been kinda sufficiently verified, |
|
1211 | + // let's add the checkout to the session so that it's available to other systems |
|
1212 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
1213 | + return true; |
|
1214 | + } |
|
1215 | + |
|
1216 | + |
|
1217 | + |
|
1218 | + /** |
|
1219 | + * _initialize_reg_steps |
|
1220 | + * first makes sure that EE_Transaction_Processor::set_reg_step_initiated() is called as required |
|
1221 | + * then loops thru all of the active reg steps and calls the initialize_reg_step() method |
|
1222 | + * |
|
1223 | + * @access private |
|
1224 | + * @param bool $reinitializing |
|
1225 | + * @throws EE_Error |
|
1226 | + */ |
|
1227 | + private function _initialize_reg_steps($reinitializing = false) |
|
1228 | + { |
|
1229 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
1230 | + // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
|
1231 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
1232 | + if ( ! $reg_step->initialize_reg_step()) { |
|
1233 | + // if not initialized then maybe this step is being removed... |
|
1234 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
1235 | + // if it was the current step, then we need to start over here |
|
1236 | + $this->_initialize_reg_steps(true); |
|
1237 | + return; |
|
1238 | + } |
|
1239 | + continue; |
|
1240 | + } |
|
1241 | + // add css and JS for current step |
|
1242 | + $reg_step->enqueue_styles_and_scripts(); |
|
1243 | + // i18n |
|
1244 | + $reg_step->translate_js_strings(); |
|
1245 | + if ($reg_step->is_current_step()) { |
|
1246 | + // the text that appears on the reg step form submit button |
|
1247 | + $reg_step->set_submit_button_text(); |
|
1248 | + } |
|
1249 | + } |
|
1250 | + // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
|
1251 | + do_action( |
|
1252 | + "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", |
|
1253 | + $this->checkout->current_step |
|
1254 | + ); |
|
1255 | + } |
|
1256 | + |
|
1257 | + |
|
1258 | + |
|
1259 | + /** |
|
1260 | + * _check_form_submission |
|
1261 | + * |
|
1262 | + * @access private |
|
1263 | + * @return boolean |
|
1264 | + */ |
|
1265 | + private function _check_form_submission() |
|
1266 | + { |
|
1267 | + //does this request require the reg form to be generated ? |
|
1268 | + if ($this->checkout->generate_reg_form) { |
|
1269 | + // ever heard that song by Blue Rodeo ? |
|
1270 | + try { |
|
1271 | + $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
|
1272 | + // if not displaying a form, then check for form submission |
|
1273 | + if ( |
|
1274 | + $this->checkout->process_form_submission |
|
1275 | + && $this->checkout->current_step->reg_form->was_submitted() |
|
1276 | + ) { |
|
1277 | + // clear out any old data in case this step is being run again |
|
1278 | + $this->checkout->current_step->set_valid_data(array()); |
|
1279 | + // capture submitted form data |
|
1280 | + $this->checkout->current_step->reg_form->receive_form_submission( |
|
1281 | + apply_filters( |
|
1282 | + 'FHEE__Single_Page_Checkout___check_form_submission__request_params', |
|
1283 | + EE_Registry::instance()->REQ->params(), |
|
1284 | + $this->checkout |
|
1285 | + ) |
|
1286 | + ); |
|
1287 | + // validate submitted form data |
|
1288 | + if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1289 | + // thou shall not pass !!! |
|
1290 | + $this->checkout->continue_reg = false; |
|
1291 | + // any form validation errors? |
|
1292 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1293 | + EE_Error::add_error( |
|
1294 | + $this->checkout->current_step->reg_form->submission_error_message(), |
|
1295 | + __FILE__, __FUNCTION__, __LINE__ |
|
1296 | + ); |
|
1297 | + } |
|
1298 | + // well not really... what will happen is |
|
1299 | + // we'll just get redirected back to redo the current step |
|
1300 | + $this->go_to_next_step(); |
|
1301 | + return false; |
|
1302 | + } |
|
1303 | + } |
|
1304 | + } catch (EE_Error $e) { |
|
1305 | + $e->get_error(); |
|
1306 | + } |
|
1307 | + } |
|
1308 | + return true; |
|
1309 | + } |
|
1310 | + |
|
1311 | + |
|
1312 | + |
|
1313 | + /** |
|
1314 | + * _process_action |
|
1315 | + * |
|
1316 | + * @access private |
|
1317 | + * @return void |
|
1318 | + * @throws EE_Error |
|
1319 | + */ |
|
1320 | + private function _process_form_action() |
|
1321 | + { |
|
1322 | + // what cha wanna do? |
|
1323 | + switch ($this->checkout->action) { |
|
1324 | + // AJAX next step reg form |
|
1325 | + case 'display_spco_reg_step' : |
|
1326 | + $this->checkout->redirect = false; |
|
1327 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1328 | + $this->checkout->json_response->set_reg_step_html( |
|
1329 | + $this->checkout->current_step->display_reg_form() |
|
1330 | + ); |
|
1331 | + } |
|
1332 | + break; |
|
1333 | + default : |
|
1334 | + // meh... do one of those other steps first |
|
1335 | + if ( |
|
1336 | + ! empty($this->checkout->action) |
|
1337 | + && is_callable(array($this->checkout->current_step, $this->checkout->action)) |
|
1338 | + ) { |
|
1339 | + // dynamically creates hook point like: |
|
1340 | + // AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
|
1341 | + do_action( |
|
1342 | + "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", |
|
1343 | + $this->checkout->current_step |
|
1344 | + ); |
|
1345 | + // call action on current step |
|
1346 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1347 | + // good registrant, you get to proceed |
|
1348 | + if ( |
|
1349 | + $this->checkout->current_step->success_message() !== '' |
|
1350 | + && apply_filters( |
|
1351 | + 'FHEE__Single_Page_Checkout___process_form_action__display_success', |
|
1352 | + false |
|
1353 | + ) |
|
1354 | + ) { |
|
1355 | + EE_Error::add_success( |
|
1356 | + $this->checkout->current_step->success_message() |
|
1357 | + . '<br />' . $this->checkout->next_step->_instructions() |
|
1358 | + ); |
|
1359 | + } |
|
1360 | + // pack it up, pack it in... |
|
1361 | + $this->_setup_redirect(); |
|
1362 | + } |
|
1363 | + // dynamically creates hook point like: |
|
1364 | + // AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
|
1365 | + do_action( |
|
1366 | + "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", |
|
1367 | + $this->checkout->current_step |
|
1368 | + ); |
|
1369 | + } else { |
|
1370 | + EE_Error::add_error( |
|
1371 | + sprintf( |
|
1372 | + __( |
|
1373 | + 'The requested form action "%s" does not exist for the current "%s" registration step.', |
|
1374 | + 'event_espresso' |
|
1375 | + ), |
|
1376 | + $this->checkout->action, |
|
1377 | + $this->checkout->current_step->name() |
|
1378 | + ), |
|
1379 | + __FILE__, |
|
1380 | + __FUNCTION__, |
|
1381 | + __LINE__ |
|
1382 | + ); |
|
1383 | + } |
|
1384 | + // end default |
|
1385 | + } |
|
1386 | + // store our progress so far |
|
1387 | + $this->checkout->stash_transaction_and_checkout(); |
|
1388 | + // advance to the next step! If you pass GO, collect $200 |
|
1389 | + $this->go_to_next_step(); |
|
1390 | + } |
|
1391 | + |
|
1392 | + |
|
1393 | + |
|
1394 | + /** |
|
1395 | + * add_styles_and_scripts |
|
1396 | + * |
|
1397 | + * @access public |
|
1398 | + * @return void |
|
1399 | + */ |
|
1400 | + public function add_styles_and_scripts() |
|
1401 | + { |
|
1402 | + // i18n |
|
1403 | + $this->translate_js_strings(); |
|
1404 | + if ($this->checkout->admin_request) { |
|
1405 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1406 | + } else { |
|
1407 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1408 | + } |
|
1409 | + } |
|
1410 | + |
|
1411 | + |
|
1412 | + |
|
1413 | + /** |
|
1414 | + * translate_js_strings |
|
1415 | + * |
|
1416 | + * @access public |
|
1417 | + * @return void |
|
1418 | + */ |
|
1419 | + public function translate_js_strings() |
|
1420 | + { |
|
1421 | + EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
|
1422 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
|
1423 | + EE_Registry::$i18n_js_strings['server_error'] = __( |
|
1424 | + 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', |
|
1425 | + 'event_espresso' |
|
1426 | + ); |
|
1427 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __( |
|
1428 | + 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', |
|
1429 | + 'event_espresso' |
|
1430 | + ); |
|
1431 | + EE_Registry::$i18n_js_strings['validation_error'] = __( |
|
1432 | + 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', |
|
1433 | + 'event_espresso' |
|
1434 | + ); |
|
1435 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( |
|
1436 | + 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', |
|
1437 | + 'event_espresso' |
|
1438 | + ); |
|
1439 | + EE_Registry::$i18n_js_strings['reg_step_error'] = __( |
|
1440 | + 'This registration step could not be completed. Please refresh the page and try again.', |
|
1441 | + 'event_espresso' |
|
1442 | + ); |
|
1443 | + EE_Registry::$i18n_js_strings['invalid_coupon'] = __( |
|
1444 | + 'We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', |
|
1445 | + 'event_espresso' |
|
1446 | + ); |
|
1447 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
|
1448 | + __( |
|
1449 | + 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', |
|
1450 | + 'event_espresso' |
|
1451 | + ), |
|
1452 | + '<br/>', |
|
1453 | + '<br/>' |
|
1454 | + ); |
|
1455 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1456 | + EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
|
1457 | + EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
|
1458 | + EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
|
1459 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1460 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1461 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1462 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1463 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1464 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1465 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1466 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1467 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1468 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1469 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1470 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1471 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1472 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1473 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = EED_Single_Page_Checkout::getRegistrationExpirationNotice(); |
|
1474 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters( |
|
1475 | + 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
|
1476 | + true |
|
1477 | + ); |
|
1478 | + EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1479 | + apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1480 | + ); |
|
1481 | + EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1482 | + 'M d, Y H:i:s', |
|
1483 | + EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1484 | + ); |
|
1485 | + } |
|
1486 | + |
|
1487 | + |
|
1488 | + |
|
1489 | + /** |
|
1490 | + * enqueue_styles_and_scripts |
|
1491 | + * |
|
1492 | + * @access public |
|
1493 | + * @return void |
|
1494 | + * @throws EE_Error |
|
1495 | + */ |
|
1496 | + public function enqueue_styles_and_scripts() |
|
1497 | + { |
|
1498 | + // load css |
|
1499 | + wp_register_style( |
|
1500 | + 'single_page_checkout', |
|
1501 | + SPCO_CSS_URL . 'single_page_checkout.css', |
|
1502 | + array('espresso_default'), |
|
1503 | + EVENT_ESPRESSO_VERSION |
|
1504 | + ); |
|
1505 | + wp_enqueue_style('single_page_checkout'); |
|
1506 | + // load JS |
|
1507 | + wp_register_script( |
|
1508 | + 'jquery_plugin', |
|
1509 | + EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', |
|
1510 | + array('jquery'), |
|
1511 | + '1.0.1', |
|
1512 | + true |
|
1513 | + ); |
|
1514 | + wp_register_script( |
|
1515 | + 'jquery_countdown', |
|
1516 | + EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', |
|
1517 | + array('jquery_plugin'), |
|
1518 | + '2.0.2', |
|
1519 | + true |
|
1520 | + ); |
|
1521 | + wp_register_script( |
|
1522 | + 'single_page_checkout', |
|
1523 | + SPCO_JS_URL . 'single_page_checkout.js', |
|
1524 | + array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1525 | + EVENT_ESPRESSO_VERSION, |
|
1526 | + true |
|
1527 | + ); |
|
1528 | + if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) { |
|
1529 | + $this->checkout->registration_form->enqueue_js(); |
|
1530 | + } |
|
1531 | + if ($this->checkout->current_step->reg_form instanceof EE_Form_Section_Proper) { |
|
1532 | + $this->checkout->current_step->reg_form->enqueue_js(); |
|
1533 | + } |
|
1534 | + wp_enqueue_script('single_page_checkout'); |
|
1535 | + /** |
|
1536 | + * global action hook for enqueueing styles and scripts with |
|
1537 | + * spco calls. |
|
1538 | + */ |
|
1539 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1540 | + /** |
|
1541 | + * dynamic action hook for enqueueing styles and scripts with spco calls. |
|
1542 | + * The hook will end up being something like: |
|
1543 | + * AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
|
1544 | + */ |
|
1545 | + do_action( |
|
1546 | + 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), |
|
1547 | + $this |
|
1548 | + ); |
|
1549 | + } |
|
1550 | + |
|
1551 | + |
|
1552 | + |
|
1553 | + /** |
|
1554 | + * display the Registration Single Page Checkout Form |
|
1555 | + * |
|
1556 | + * @access private |
|
1557 | + * @return void |
|
1558 | + * @throws EE_Error |
|
1559 | + */ |
|
1560 | + private function _display_spco_reg_form() |
|
1561 | + { |
|
1562 | + // if registering via the admin, just display the reg form for the current step |
|
1563 | + if ($this->checkout->admin_request) { |
|
1564 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1565 | + } else { |
|
1566 | + // add powered by EE msg |
|
1567 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1568 | + $empty_cart = count( |
|
1569 | + $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) |
|
1570 | + ) < 1; |
|
1571 | + EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1572 | + $cookies_not_set_msg = ''; |
|
1573 | + if ($empty_cart) { |
|
1574 | + $cookies_not_set_msg = apply_filters( |
|
1575 | + 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
|
1576 | + sprintf( |
|
1577 | + __( |
|
1578 | + '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', |
|
1579 | + 'event_espresso' |
|
1580 | + ), |
|
1581 | + '<div class="ee-attention hidden" id="ee-cookies-not-set-msg">', |
|
1582 | + '</div>', |
|
1583 | + '<h6 class="important-notice">', |
|
1584 | + '</h6>', |
|
1585 | + '<p>', |
|
1586 | + '</p>', |
|
1587 | + '<br />', |
|
1588 | + '<a href="http://www.whatarecookies.com/enable.asp" target="_blank">', |
|
1589 | + '</a>' |
|
1590 | + ) |
|
1591 | + ); |
|
1592 | + } |
|
1593 | + $this->checkout->registration_form = new EE_Form_Section_Proper( |
|
1594 | + array( |
|
1595 | + 'name' => 'single-page-checkout', |
|
1596 | + 'html_id' => 'ee-single-page-checkout-dv', |
|
1597 | + 'layout_strategy' => |
|
1598 | + new EE_Template_Layout( |
|
1599 | + array( |
|
1600 | + 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1601 | + 'template_args' => array( |
|
1602 | + 'empty_cart' => $empty_cart, |
|
1603 | + 'revisit' => $this->checkout->revisit, |
|
1604 | + 'reg_steps' => $this->checkout->reg_steps, |
|
1605 | + 'next_step' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step |
|
1606 | + ? $this->checkout->next_step->slug() |
|
1607 | + : '', |
|
1608 | + 'empty_msg' => apply_filters( |
|
1609 | + 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
|
1610 | + sprintf( |
|
1611 | + __( |
|
1612 | + 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', |
|
1613 | + 'event_espresso' |
|
1614 | + ), |
|
1615 | + '<a href="' |
|
1616 | + . get_post_type_archive_link('espresso_events') |
|
1617 | + . '" title="', |
|
1618 | + '">', |
|
1619 | + '</a>' |
|
1620 | + ) |
|
1621 | + ), |
|
1622 | + 'cookies_not_set_msg' => $cookies_not_set_msg, |
|
1623 | + 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
|
1624 | + 'session_expiration' => gmdate( |
|
1625 | + 'M d, Y H:i:s', |
|
1626 | + EE_Registry::instance()->SSN->expiration() |
|
1627 | + + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1628 | + ), |
|
1629 | + ), |
|
1630 | + ) |
|
1631 | + ), |
|
1632 | + ) |
|
1633 | + ); |
|
1634 | + // load template and add to output sent that gets filtered into the_content() |
|
1635 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html()); |
|
1636 | + } |
|
1637 | + } |
|
1638 | + |
|
1639 | + |
|
1640 | + |
|
1641 | + /** |
|
1642 | + * add_extra_finalize_registration_inputs |
|
1643 | + * |
|
1644 | + * @access public |
|
1645 | + * @param $next_step |
|
1646 | + * @internal param string $label |
|
1647 | + * @return void |
|
1648 | + */ |
|
1649 | + public function add_extra_finalize_registration_inputs($next_step) |
|
1650 | + { |
|
1651 | + if ($next_step === 'finalize_registration') { |
|
1652 | + echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
|
1653 | + } |
|
1654 | + } |
|
1655 | + |
|
1656 | + |
|
1657 | + |
|
1658 | + /** |
|
1659 | + * display_registration_footer |
|
1660 | + * |
|
1661 | + * @access public |
|
1662 | + * @return string |
|
1663 | + */ |
|
1664 | + public static function display_registration_footer() |
|
1665 | + { |
|
1666 | + if ( |
|
1667 | + apply_filters( |
|
1668 | + 'FHEE__EE_Front__Controller__show_reg_footer', |
|
1669 | + EE_Registry::instance()->CFG->admin->show_reg_footer |
|
1670 | + ) |
|
1671 | + ) { |
|
1672 | + add_filter( |
|
1673 | + 'FHEE__EEH_Template__powered_by_event_espresso__url', |
|
1674 | + function ($url) { |
|
1675 | + return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1676 | + } |
|
1677 | + ); |
|
1678 | + echo apply_filters( |
|
1679 | + 'FHEE__EE_Front_Controller__display_registration_footer', |
|
1680 | + \EEH_Template::powered_by_event_espresso( |
|
1681 | + '', |
|
1682 | + 'espresso-registration-footer-dv', |
|
1683 | + array('utm_content' => 'registration_checkout') |
|
1684 | + ) |
|
1685 | + ); |
|
1686 | + } |
|
1687 | + return ''; |
|
1688 | + } |
|
1689 | + |
|
1690 | + |
|
1691 | + |
|
1692 | + /** |
|
1693 | + * unlock_transaction |
|
1694 | + * |
|
1695 | + * @access public |
|
1696 | + * @return void |
|
1697 | + * @throws EE_Error |
|
1698 | + */ |
|
1699 | + public function unlock_transaction() |
|
1700 | + { |
|
1701 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1702 | + $this->checkout->transaction->unlock(); |
|
1703 | + } |
|
1704 | + } |
|
1705 | + |
|
1706 | + |
|
1707 | + |
|
1708 | + /** |
|
1709 | + * _setup_redirect |
|
1710 | + * |
|
1711 | + * @access private |
|
1712 | + * @return void |
|
1713 | + */ |
|
1714 | + private function _setup_redirect() |
|
1715 | + { |
|
1716 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1717 | + $this->checkout->redirect = true; |
|
1718 | + if (empty($this->checkout->redirect_url)) { |
|
1719 | + $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
|
1720 | + } |
|
1721 | + $this->checkout->redirect_url = apply_filters( |
|
1722 | + 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', |
|
1723 | + $this->checkout->redirect_url, |
|
1724 | + $this->checkout |
|
1725 | + ); |
|
1726 | + } |
|
1727 | + } |
|
1728 | + |
|
1729 | + |
|
1730 | + |
|
1731 | + /** |
|
1732 | + * handle ajax message responses and redirects |
|
1733 | + * |
|
1734 | + * @access public |
|
1735 | + * @return void |
|
1736 | + * @throws EE_Error |
|
1737 | + */ |
|
1738 | + public function go_to_next_step() |
|
1739 | + { |
|
1740 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1741 | + // capture contents of output buffer we started earlier in the request, and insert into JSON response |
|
1742 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1743 | + } |
|
1744 | + $this->unlock_transaction(); |
|
1745 | + // just return for these conditions |
|
1746 | + if ( |
|
1747 | + $this->checkout->admin_request |
|
1748 | + || $this->checkout->action === 'redirect_form' |
|
1749 | + || $this->checkout->action === 'update_checkout' |
|
1750 | + ) { |
|
1751 | + return; |
|
1752 | + } |
|
1753 | + // AJAX response |
|
1754 | + $this->_handle_json_response(); |
|
1755 | + // redirect to next step or the Thank You page |
|
1756 | + $this->_handle_html_redirects(); |
|
1757 | + // hmmm... must be something wrong, so let's just display the form again ! |
|
1758 | + $this->_display_spco_reg_form(); |
|
1759 | + } |
|
1760 | + |
|
1761 | + |
|
1762 | + |
|
1763 | + /** |
|
1764 | + * _handle_json_response |
|
1765 | + * |
|
1766 | + * @access protected |
|
1767 | + * @return void |
|
1768 | + */ |
|
1769 | + protected function _handle_json_response() |
|
1770 | + { |
|
1771 | + // if this is an ajax request |
|
1772 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1773 | + // DEBUG LOG |
|
1774 | + //$this->checkout->log( |
|
1775 | + // __CLASS__, __FUNCTION__, __LINE__, |
|
1776 | + // array( |
|
1777 | + // 'json_response_redirect_url' => $this->checkout->json_response->redirect_url(), |
|
1778 | + // 'redirect' => $this->checkout->redirect, |
|
1779 | + // 'continue_reg' => $this->checkout->continue_reg, |
|
1780 | + // ) |
|
1781 | + //); |
|
1782 | + $this->checkout->json_response->set_registration_time_limit( |
|
1783 | + $this->checkout->get_registration_time_limit() |
|
1784 | + ); |
|
1785 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1786 | + // just send the ajax ( |
|
1787 | + $json_response = apply_filters( |
|
1788 | + 'FHEE__EE_Single_Page_Checkout__JSON_response', |
|
1789 | + $this->checkout->json_response |
|
1790 | + ); |
|
1791 | + echo $json_response; |
|
1792 | + exit(); |
|
1793 | + } |
|
1794 | + } |
|
1795 | + |
|
1796 | + |
|
1797 | + |
|
1798 | + /** |
|
1799 | + * _handle_redirects |
|
1800 | + * |
|
1801 | + * @access protected |
|
1802 | + * @return void |
|
1803 | + */ |
|
1804 | + protected function _handle_html_redirects() |
|
1805 | + { |
|
1806 | + // going somewhere ? |
|
1807 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1808 | + // store notices in a transient |
|
1809 | + EE_Error::get_notices(false, true, true); |
|
1810 | + // DEBUG LOG |
|
1811 | + //$this->checkout->log( |
|
1812 | + // __CLASS__, __FUNCTION__, __LINE__, |
|
1813 | + // array( |
|
1814 | + // 'headers_sent' => headers_sent(), |
|
1815 | + // 'redirect_url' => $this->checkout->redirect_url, |
|
1816 | + // 'headers_list' => headers_list(), |
|
1817 | + // ) |
|
1818 | + //); |
|
1819 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1820 | + exit(); |
|
1821 | + } |
|
1822 | + } |
|
1823 | + |
|
1824 | + |
|
1825 | + |
|
1826 | + /** |
|
1827 | + * set_checkout_anchor |
|
1828 | + * |
|
1829 | + * @access public |
|
1830 | + * @return void |
|
1831 | + */ |
|
1832 | + public function set_checkout_anchor() |
|
1833 | + { |
|
1834 | + echo '<a id="checkout" style="float: left; margin-left: -999em;"></a>'; |
|
1835 | + } |
|
1836 | + |
|
1837 | + /** |
|
1838 | + * getRegistrationExpirationNotice |
|
1839 | + * |
|
1840 | + * @since 4.9.59.p |
|
1841 | + * @access public |
|
1842 | + * @return string |
|
1843 | + */ |
|
1844 | + public static function getRegistrationExpirationNotice() |
|
1845 | + { |
|
1846 | + return sprintf( |
|
1847 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please accept our apologies for any inconvenience this may have caused.%8$s', |
|
1848 | + 'event_espresso'), |
|
1849 | + '<h4 class="important-notice">', |
|
1850 | + '</h4>', |
|
1851 | + '<br />', |
|
1852 | + '<p>', |
|
1853 | + '<a href="' . get_post_type_archive_link('espresso_events') . '" title="', |
|
1854 | + '">', |
|
1855 | + '</a>', |
|
1856 | + '</p>' |
|
1857 | + ); |
|
1858 | + } |
|
1859 | 1859 | |
1860 | 1860 | } |
1861 | 1861 | // End of file EED_Single_Page_Checkout.module.php |
@@ -219,19 +219,19 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function set_definitions() |
221 | 221 | { |
222 | - if(defined('SPCO_BASE_PATH')) { |
|
222 | + if (defined('SPCO_BASE_PATH')) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | define( |
226 | 226 | 'SPCO_BASE_PATH', |
227 | - rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS |
|
227 | + rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS |
|
228 | 228 | ); |
229 | - define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS); |
|
230 | - define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS); |
|
231 | - define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS); |
|
232 | - define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS); |
|
233 | - define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS); |
|
234 | - define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS); |
|
229 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
230 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
231 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
232 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
233 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
234 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
235 | 235 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true); |
236 | 236 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = EED_Single_Page_Checkout::getRegistrationExpirationNotice(); |
237 | 237 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return; |
253 | 253 | } |
254 | 254 | // filter list of reg_steps |
255 | - $reg_steps_to_load = (array)apply_filters( |
|
255 | + $reg_steps_to_load = (array) apply_filters( |
|
256 | 256 | 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', |
257 | 257 | EED_Single_Page_Checkout::get_reg_steps() |
258 | 258 | ); |
@@ -304,19 +304,19 @@ discard block |
||
304 | 304 | if (empty($reg_steps)) { |
305 | 305 | $reg_steps = array( |
306 | 306 | 10 => array( |
307 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
307 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
308 | 308 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
309 | 309 | 'slug' => 'attendee_information', |
310 | 310 | 'has_hooks' => false, |
311 | 311 | ), |
312 | 312 | 30 => array( |
313 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
313 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
314 | 314 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
315 | 315 | 'slug' => 'payment_options', |
316 | 316 | 'has_hooks' => true, |
317 | 317 | ), |
318 | 318 | 999 => array( |
319 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
319 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
320 | 320 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
321 | 321 | 'slug' => 'finalize_registration', |
322 | 322 | 'has_hooks' => false, |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | // DEBUG LOG |
501 | 501 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
502 | 502 | // get reg form |
503 | - if( ! $this->_check_form_submission()) { |
|
503 | + if ( ! $this->_check_form_submission()) { |
|
504 | 504 | EED_Single_Page_Checkout::$_initialized = true; |
505 | 505 | return; |
506 | 506 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | ); |
542 | 542 | // is session still valid ? |
543 | 543 | if ($clear_session_requested |
544 | - || ( EE_Registry::instance()->SSN->expired() |
|
544 | + || (EE_Registry::instance()->SSN->expired() |
|
545 | 545 | && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '' |
546 | 546 | ) |
547 | 547 | ) { |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | // EE_Registry::instance()->SSN->reset_cart(); |
551 | 551 | // EE_Registry::instance()->SSN->reset_checkout(); |
552 | 552 | // EE_Registry::instance()->SSN->reset_transaction(); |
553 | - if (! $clear_session_requested) { |
|
553 | + if ( ! $clear_session_requested) { |
|
554 | 554 | EE_Error::add_attention( |
555 | 555 | EE_Registry::$i18n_js_strings['registration_expiration_notice'], |
556 | 556 | __FILE__, __FUNCTION__, __LINE__ |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | return false; |
742 | 742 | } |
743 | 743 | } |
744 | - if(isset($this->checkout->reg_steps['registration_confirmation'])){ |
|
744 | + if (isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
745 | 745 | // skip the registration_confirmation page ? |
746 | 746 | if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
747 | 747 | // just remove it from the reg steps array |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | if ( ! $registration instanceof EE_Registration) { |
1108 | 1108 | throw new InvalidEntityException($registration, 'EE_Registration'); |
1109 | 1109 | } |
1110 | - $registrations[ $registration->ID() ] = $registration; |
|
1110 | + $registrations[$registration->ID()] = $registration; |
|
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | ) { |
1355 | 1355 | EE_Error::add_success( |
1356 | 1356 | $this->checkout->current_step->success_message() |
1357 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1357 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1358 | 1358 | ); |
1359 | 1359 | } |
1360 | 1360 | // pack it up, pack it in... |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | // load css |
1499 | 1499 | wp_register_style( |
1500 | 1500 | 'single_page_checkout', |
1501 | - SPCO_CSS_URL . 'single_page_checkout.css', |
|
1501 | + SPCO_CSS_URL.'single_page_checkout.css', |
|
1502 | 1502 | array('espresso_default'), |
1503 | 1503 | EVENT_ESPRESSO_VERSION |
1504 | 1504 | ); |
@@ -1506,21 +1506,21 @@ discard block |
||
1506 | 1506 | // load JS |
1507 | 1507 | wp_register_script( |
1508 | 1508 | 'jquery_plugin', |
1509 | - EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', |
|
1509 | + EE_THIRD_PARTY_URL.'jquery .plugin.min.js', |
|
1510 | 1510 | array('jquery'), |
1511 | 1511 | '1.0.1', |
1512 | 1512 | true |
1513 | 1513 | ); |
1514 | 1514 | wp_register_script( |
1515 | 1515 | 'jquery_countdown', |
1516 | - EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', |
|
1516 | + EE_THIRD_PARTY_URL.'jquery .countdown.min.js', |
|
1517 | 1517 | array('jquery_plugin'), |
1518 | 1518 | '2.0.2', |
1519 | 1519 | true |
1520 | 1520 | ); |
1521 | 1521 | wp_register_script( |
1522 | 1522 | 'single_page_checkout', |
1523 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1523 | + SPCO_JS_URL.'single_page_checkout.js', |
|
1524 | 1524 | array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
1525 | 1525 | EVENT_ESPRESSO_VERSION, |
1526 | 1526 | true |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | * AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1544 | 1544 | */ |
1545 | 1545 | do_action( |
1546 | - 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), |
|
1546 | + 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), |
|
1547 | 1547 | $this |
1548 | 1548 | ); |
1549 | 1549 | } |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | 'layout_strategy' => |
1598 | 1598 | new EE_Template_Layout( |
1599 | 1599 | array( |
1600 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1600 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1601 | 1601 | 'template_args' => array( |
1602 | 1602 | 'empty_cart' => $empty_cart, |
1603 | 1603 | 'revisit' => $this->checkout->revisit, |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | ) { |
1672 | 1672 | add_filter( |
1673 | 1673 | 'FHEE__EEH_Template__powered_by_event_espresso__url', |
1674 | - function ($url) { |
|
1674 | + function($url) { |
|
1675 | 1675 | return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
1676 | 1676 | } |
1677 | 1677 | ); |
@@ -1850,7 +1850,7 @@ discard block |
||
1850 | 1850 | '</h4>', |
1851 | 1851 | '<br />', |
1852 | 1852 | '<p>', |
1853 | - '<a href="' . get_post_type_archive_link('espresso_events') . '" title="', |
|
1853 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1854 | 1854 | '">', |
1855 | 1855 | '</a>', |
1856 | 1856 | '</p>' |