Completed
Branch FET-9856-direct-instantiation (a39e7f)
by
unknown
50:47 queued 37:40
created
core/data_migration_scripts/EE_DMS_Core_4_2_0.dms.php 2 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 $stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*');
16 16
 $class_to_filepath = array();
17 17
 if ( ! empty($stages)) {
18
-    foreach ($stages as $filepath) {
19
-        $matches = array();
20
-        preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-        $class_to_filepath[$matches[1]] = $filepath;
22
-    }
18
+	foreach ($stages as $filepath) {
19
+		$matches = array();
20
+		preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
+		$class_to_filepath[$matches[1]] = $filepath;
22
+	}
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath);
@@ -32,64 +32,64 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-    /**
36
-     * EE_DMS_Core_4_2_0 constructor.
37
-     *
38
-     * @param TableManager  $table_manager
39
-     * @param TableAnalysis $table_analysis
40
-     */
41
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
42
-    {
43
-        $this->_pretty_name = __("Data Migration to Event Espresso 4.2.0.P", "event_espresso");
44
-        $this->_priority = 10;
45
-        $this->_migration_stages = array(
46
-            new EE_DMS_4_2_0_question_group_questions(),
47
-            new EE_DMS_4_2_0_datetime_fields(),
48
-        );
49
-        parent::__construct($table_manager, $table_analysis);
50
-    }
35
+	/**
36
+	 * EE_DMS_Core_4_2_0 constructor.
37
+	 *
38
+	 * @param TableManager  $table_manager
39
+	 * @param TableAnalysis $table_analysis
40
+	 */
41
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
42
+	{
43
+		$this->_pretty_name = __("Data Migration to Event Espresso 4.2.0.P", "event_espresso");
44
+		$this->_priority = 10;
45
+		$this->_migration_stages = array(
46
+			new EE_DMS_4_2_0_question_group_questions(),
47
+			new EE_DMS_4_2_0_datetime_fields(),
48
+		);
49
+		parent::__construct($table_manager, $table_analysis);
50
+	}
51 51
 
52 52
 
53 53
 
54
-    public function can_migrate_from_version($version_array)
55
-    {
56
-        $version_string = $version_array['Core'];
57
-        if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
54
+	public function can_migrate_from_version($version_array)
55
+	{
56
+		$version_string = $version_array['Core'];
57
+		if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
58 58
 //			echo "$version_string can be migrated fro";
59
-            return true;
60
-        } elseif ( ! $version_string) {
59
+			return true;
60
+		} elseif ( ! $version_string) {
61 61
 //			echo "no version string provided: $version_string";
62
-            //no version string provided... this must be pre 4.1
63
-            //because since 4.1 we're
64
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
65
-        } else {
62
+			//no version string provided... this must be pre 4.1
63
+			//because since 4.1 we're
64
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
65
+		} else {
66 66
 //			echo "$version_string doesnt apply";
67
-            return false;
68
-        }
69
-    }
67
+			return false;
68
+		}
69
+	}
70 70
 
71 71
 
72 72
 
73
-    public function pretty_name()
74
-    {
75
-        return __("Core Data Migration to version 4.2.0", "event_espresso");
76
-    }
73
+	public function pretty_name()
74
+	{
75
+		return __("Core Data Migration to version 4.2.0", "event_espresso");
76
+	}
77 77
 
78 78
 
79 79
 
80
-    public function schema_changes_before_migration()
81
-    {
82
-        //relies on 4.1's EEH_Activation::create_table
83
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
84
-        $table_name = 'esp_answer';
85
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
80
+	public function schema_changes_before_migration()
81
+	{
82
+		//relies on 4.1's EEH_Activation::create_table
83
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
84
+		$table_name = 'esp_answer';
85
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
86 86
 					REG_ID INT UNSIGNED NOT NULL,
87 87
 					QST_ID INT UNSIGNED NOT NULL,
88 88
 					ANS_value TEXT NOT NULL,
89 89
 					PRIMARY KEY  (ANS_ID)";
90
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
91
-        $table_name = 'esp_attendee_meta';
92
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
90
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
91
+		$table_name = 'esp_attendee_meta';
92
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
93 93
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
94 94
 						ATT_fname VARCHAR(45) NOT NULL,
95 95
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 								KEY ATT_fname (ATT_fname),
106 106
 								KEY ATT_lname (ATT_lname),
107 107
 								KEY ATT_email (ATT_email)";
108
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
109
-        $table_name = 'esp_country';
110
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
108
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
109
+		$table_name = 'esp_country';
110
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
111 111
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
112 112
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
113 113
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
124 124
 					  CNT_active TINYINT(1) DEFAULT '0',
125 125
 					  PRIMARY KEY  (CNT_ISO)";
126
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
127
-        $table_name = 'esp_datetime';
128
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
126
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
127
+		$table_name = 'esp_datetime';
128
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
129 129
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
130 130
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
131 131
 				  DTT_description TEXT NOT NULL,
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 						PRIMARY KEY  (DTT_ID),
141 141
 						KEY EVT_ID (EVT_ID),
142 142
 						KEY DTT_is_primary (DTT_is_primary)";
143
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
144
-        $table_name = 'esp_event_meta';
145
-        $sql = "
143
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
144
+		$table_name = 'esp_event_meta';
145
+		$sql = "
146 146
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
147 147
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
148 148
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -157,31 +157,31 @@  discard block
 block discarded – undo
157 157
 			EVT_external_URL VARCHAR(200) NULL,
158 158
 			EVT_donations TINYINT(1) NULL,
159 159
 			PRIMARY KEY  (EVTM_ID)";
160
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
161
-        $table_name = 'esp_event_question_group';
162
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
160
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
161
+		$table_name = 'esp_event_question_group';
162
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
163 163
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
164 164
 					QSG_ID INT UNSIGNED NOT NULL,
165 165
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
166 166
 					PRIMARY KEY  (EQG_ID)";
167
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
-        $table_name = 'esp_event_venue';
169
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
167
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
+		$table_name = 'esp_event_venue';
169
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
170 170
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
171 171
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
173 173
 				PRIMARY KEY  (EVV_ID)";
174
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
175
-        $table_name = 'esp_extra_meta';
176
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
174
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
175
+		$table_name = 'esp_extra_meta';
176
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
177 177
 				OBJ_ID INT(11) DEFAULT NULL,
178 178
 				EXM_type VARCHAR(45) DEFAULT NULL,
179 179
 				EXM_key VARCHAR(45) DEFAULT NULL,
180 180
 				EXM_value TEXT,
181 181
 				PRIMARY KEY  (EXM_ID)";
182
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
183
-        $table_name = 'esp_line_item';
184
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
182
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
183
+		$table_name = 'esp_line_item';
184
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
185 185
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
186 186
 				TXN_ID INT(11) DEFAULT NULL,
187 187
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -197,18 +197,18 @@  discard block
 block discarded – undo
197 197
 				OBJ_ID INT(11) DEFAULT NULL,
198 198
 				OBJ_type VARCHAR(45)DEFAULT NULL,
199 199
 				PRIMARY KEY  (LIN_ID)";
200
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
201
-        $table_name = 'esp_message_template';
202
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
200
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
201
+		$table_name = 'esp_message_template';
202
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
203 203
 					GRP_ID INT(10) UNSIGNED NOT NULL,
204 204
 					MTP_context VARCHAR(50) NOT NULL,
205 205
 					MTP_template_field VARCHAR(30) NOT NULL,
206 206
 					MTP_content TEXT NOT NULL,
207 207
 					PRIMARY KEY  (MTP_ID),
208 208
 					KEY GRP_ID (GRP_ID)";
209
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
210
-        $table_name = 'esp_message_template_group';
211
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
209
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
210
+		$table_name = 'esp_message_template_group';
211
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
212 212
 					EVT_ID BIGINT(20) UNSIGNED DEFAULT NULL,
213 213
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
214 214
 					MTP_messenger VARCHAR(30) NOT NULL,
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 					PRIMARY KEY  (GRP_ID),
221 221
 					KEY EVT_ID (EVT_ID),
222 222
 					KEY MTP_user_id (MTP_user_id)";
223
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
-        $table_name = 'esp_payment';
225
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
223
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
+		$table_name = 'esp_payment';
225
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
226 226
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
227 227
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
228 228
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 					PRIMARY KEY  (PAY_ID),
239 239
 					KEY TXN_ID (TXN_ID),
240 240
 					KEY PAY_timestamp (PAY_timestamp)";
241
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
242
-        $table_name = "esp_ticket";
243
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
241
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
242
+		$table_name = "esp_ticket";
243
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244 244
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
245 245
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
246 246
 					  TKT_description TEXT NOT NULL,
@@ -259,28 +259,28 @@  discard block
 block discarded – undo
259 259
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
260 260
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
261 261
 					  PRIMARY KEY  (TKT_ID)";
262
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
263
-        $table_name = "esp_ticket_price";
264
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
262
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
263
+		$table_name = "esp_ticket_price";
264
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
265 265
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
266 266
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
267 267
 					  PRIMARY KEY  (TKP_ID)";
268
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
269
-        $table_name = "esp_datetime_ticket";
270
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
268
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
269
+		$table_name = "esp_datetime_ticket";
270
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
271 271
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
272 272
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
273 273
 					  PRIMARY KEY  (DTK_ID)";
274
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
275
-        $table_name = "esp_ticket_template";
276
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
274
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
275
+		$table_name = "esp_ticket_template";
276
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
277 277
 					  TTM_name VARCHAR(45) NOT NULL,
278 278
 					  TTM_description TEXT,
279 279
 					  TTM_file VARCHAR(45),
280 280
 					  PRIMARY KEY  (TTM_ID)";
281
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
282
-        $table_name = "esp_price";
283
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
281
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
282
+		$table_name = "esp_price";
283
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
284 284
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
285 285
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
286 286
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
292 292
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
293 293
 					  PRIMARY KEY  (PRC_ID)";
294
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
295
-        $table_name = "esp_price_type";
296
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
294
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
295
+		$table_name = "esp_price_type";
296
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
297 297
 				  PRT_name VARCHAR(45) NOT NULL,
298 298
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
299 299
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
302 302
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
303 303
 				  PRIMARY KEY  (PRT_ID)";
304
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
305
-        $table_name = 'esp_question';
306
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
304
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
305
+		$table_name = 'esp_question';
306
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
307 307
 					QST_display_text TEXT NOT NULL,
308 308
 					QST_admin_label VARCHAR(255) NOT NULL,
309 309
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 					QST_wp_user BIGINT UNSIGNED NULL,
316 316
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
317 317
 					PRIMARY KEY  (QST_ID)';
318
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
319
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
320
-        $table_name = 'esp_question_group';
321
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
319
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
320
+		$table_name = 'esp_question_group';
321
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
322 322
 					QSG_name VARCHAR(255) NOT NULL,
323 323
 					QSG_identifier VARCHAR(100) NOT NULL,
324 324
 					QSG_desc TEXT NULL,
@@ -329,24 +329,24 @@  discard block
 block discarded – undo
329 329
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
330 330
 					PRIMARY KEY  (QSG_ID),
331 331
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
332
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
333
-        $table_name = 'esp_question_group_question';
334
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
332
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
333
+		$table_name = 'esp_question_group_question';
334
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
335 335
 					QSG_ID INT UNSIGNED NOT NULL,
336 336
 					QST_ID INT UNSIGNED NOT NULL,
337 337
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
338 338
 					PRIMARY KEY  (QGQ_ID) ";
339
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
340
-        $table_name = 'esp_question_option';
341
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
339
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
340
+		$table_name = 'esp_question_option';
341
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
342 342
 					QSO_value VARCHAR(255) NOT NULL,
343 343
 					QSO_desc TEXT NOT NULL,
344 344
 					QST_ID INT UNSIGNED NOT NULL,
345 345
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
346 346
 					PRIMARY KEY  (QSO_ID)";
347
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
348
-        $table_name = 'esp_registration';
349
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
347
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
348
+		$table_name = 'esp_registration';
349
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
350 350
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
351 351
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
352 352
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -369,25 +369,25 @@  discard block
 block discarded – undo
369 369
 					  KEY STS_ID (STS_ID),
370 370
 					  KEY REG_url_link (REG_url_link),
371 371
 					  KEY REG_code (REG_code)";
372
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
373
-        $table_name = 'esp_checkin';
374
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
372
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
373
+		$table_name = 'esp_checkin';
374
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
375 375
 					REG_ID INT(10) UNSIGNED NOT NULL,
376 376
 					DTT_ID INT(10) UNSIGNED NOT NULL,
377 377
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
378 378
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
379 379
 					PRIMARY KEY  (CHK_ID)";
380
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
381
-        $table_name = 'esp_state';
382
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
380
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
381
+		$table_name = 'esp_state';
382
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
383 383
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
384 384
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
385 385
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
386 386
 					  STA_active TINYINT(1) DEFAULT '1',
387 387
 					  PRIMARY KEY  (STA_ID)";
388
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
389
-        $table_name = 'esp_status';
390
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
388
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
389
+		$table_name = 'esp_status';
390
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
391 391
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
392 392
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
393 393
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
396 396
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
397 397
 					  KEY STS_type (STS_type)";
398
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
399
-        $table_name = 'esp_transaction';
400
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
398
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
399
+		$table_name = 'esp_transaction';
400
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
401 401
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
402 402
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
403 403
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 					  PRIMARY KEY  (TXN_ID),
408 408
 					  KEY TXN_timestamp (TXN_timestamp),
409 409
 					  KEY STS_ID (STS_ID)";
410
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
411
-        $table_name = 'esp_venue_meta';
412
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
410
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
411
+		$table_name = 'esp_venue_meta';
412
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
413 413
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
414 414
 			VNU_address VARCHAR(255) DEFAULT NULL,
415 415
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -427,38 +427,38 @@  discard block
 block discarded – undo
427 427
 			PRIMARY KEY  (VNUM_ID),
428 428
 			KEY STA_ID (STA_ID),
429 429
 			KEY CNT_ISO (CNT_ISO)";
430
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
431
-        $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
432
-        //setting up the DEFAULT stats and countries is also essential for the data migrations to run
433
-        //(because many need to convert old string states to foreign keys into the states table)
434
-        $script_with_defaults->insert_default_states();
435
-        $script_with_defaults->insert_default_countries();
436
-        //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
437
-        $script_with_defaults->insert_default_price_types();
438
-        $script_with_defaults->insert_default_prices();
439
-        $script_with_defaults->insert_default_tickets();
440
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
441
-        EE_Config::instance()->update_espresso_config(false, true);
442
-        return true;
443
-    }
444
-
445
-
446
-
447
-    /**
448
-     * We COULD clean up the esp_question.QST_order field here. We'll leave it for now
449
-     *
450
-     * @return boolean
451
-     */
452
-    public function schema_changes_after_migration()
453
-    {
454
-        return true;
455
-    }
456
-
457
-
458
-
459
-    public function migration_page_hooks()
460
-    {
461
-    }
430
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
431
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
432
+		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
433
+		//(because many need to convert old string states to foreign keys into the states table)
434
+		$script_with_defaults->insert_default_states();
435
+		$script_with_defaults->insert_default_countries();
436
+		//setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
437
+		$script_with_defaults->insert_default_price_types();
438
+		$script_with_defaults->insert_default_prices();
439
+		$script_with_defaults->insert_default_tickets();
440
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
441
+		EE_Config::instance()->update_espresso_config(false, true);
442
+		return true;
443
+	}
444
+
445
+
446
+
447
+	/**
448
+	 * We COULD clean up the esp_question.QST_order field here. We'll leave it for now
449
+	 *
450
+	 * @return boolean
451
+	 */
452
+	public function schema_changes_after_migration()
453
+	{
454
+		return true;
455
+	}
456
+
457
+
458
+
459
+	public function migration_page_hooks()
460
+	{
461
+	}
462 462
 }
463 463
 
464 464
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 //unfortunately, this needs to be done upon INCLUSION of this file,
13 13
 //instead of construction, because it only gets constructed on first page load
14 14
 //(all other times it gets resurrected from a wordpress option)
15
-$stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*');
15
+$stages = glob(EE_CORE.'data_migration_scripts/4_2_0_stages/*');
16 16
 $class_to_filepath = array();
17 17
 if ( ! empty($stages)) {
18 18
     foreach ($stages as $filepath) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 //			echo "no version string provided: $version_string";
62 62
             //no version string provided... this must be pre 4.1
63 63
             //because since 4.1 we're
64
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
64
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
65 65
         } else {
66 66
 //			echo "$version_string doesnt apply";
67 67
             return false;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function schema_changes_before_migration()
81 81
     {
82 82
         //relies on 4.1's EEH_Activation::create_table
83
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
83
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
84 84
         $table_name = 'esp_answer';
85 85
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
86 86
 					REG_ID INT UNSIGNED NOT NULL,
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 2 patches
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 if ( ! empty($stages)) {
17
-    foreach ($stages as $filepath) {
18
-        $matches = array();
19
-        preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
-        $class_to_filepath[$matches[1]] = $filepath;
21
-    }
17
+	foreach ($stages as $filepath) {
18
+		$matches = array();
19
+		preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
+		$class_to_filepath[$matches[1]] = $filepath;
21
+	}
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath);
@@ -31,64 +31,64 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * EE_DMS_Core_4_3_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 Migration to Event Espresso 4.3.0.P", "event_espresso");
43
-        $this->_priority = 10;
44
-        $this->_migration_stages = array(
45
-            new EE_DMS_4_3_0_question_option_order(),
46
-            new EE_DMS_4_3_0_event_message_templates(),
47
-            new EE_DMS_4_3_0_critical_page_shortcode_tracking(),
48
-        );
49
-        parent::__construct($table_manager, $table_analysis);
50
-    }
34
+	/**
35
+	 * EE_DMS_Core_4_3_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 Migration to Event Espresso 4.3.0.P", "event_espresso");
43
+		$this->_priority = 10;
44
+		$this->_migration_stages = array(
45
+			new EE_DMS_4_3_0_question_option_order(),
46
+			new EE_DMS_4_3_0_event_message_templates(),
47
+			new EE_DMS_4_3_0_critical_page_shortcode_tracking(),
48
+		);
49
+		parent::__construct($table_manager, $table_analysis);
50
+	}
51 51
 
52 52
 
53 53
 
54
-    public function can_migrate_from_version($version_array)
55
-    {
56
-        $version_string = $version_array['Core'];
57
-        if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
54
+	public function can_migrate_from_version($version_array)
55
+	{
56
+		$version_string = $version_array['Core'];
57
+		if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
58 58
 //			echo "$version_string can be migrated fro";
59
-            return true;
60
-        } elseif ( ! $version_string) {
59
+			return true;
60
+		} elseif ( ! $version_string) {
61 61
 //			echo "no version string provided: $version_string";
62
-            //no version string provided... this must be pre 4.2
63
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
64
-        } else {
62
+			//no version string provided... this must be pre 4.2
63
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
64
+		} else {
65 65
 //			echo "$version_string doesnt apply";
66
-            return false;
67
-        }
68
-    }
66
+			return false;
67
+		}
68
+	}
69 69
 
70 70
 
71 71
 
72
-    public function pretty_name()
73
-    {
74
-        return __("Core Data Migration to version 4.3.0", "event_espresso");
75
-    }
72
+	public function pretty_name()
73
+	{
74
+		return __("Core Data Migration to version 4.3.0", "event_espresso");
75
+	}
76 76
 
77 77
 
78 78
 
79
-    public function schema_changes_before_migration()
80
-    {
81
-        //relies on 4.1's EEH_Activation::create_table
82
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
83
-        $table_name = 'esp_answer';
84
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
79
+	public function schema_changes_before_migration()
80
+	{
81
+		//relies on 4.1's EEH_Activation::create_table
82
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
83
+		$table_name = 'esp_answer';
84
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
85 85
 					REG_ID INT UNSIGNED NOT NULL,
86 86
 					QST_ID INT UNSIGNED NOT NULL,
87 87
 					ANS_value TEXT NOT NULL,
88 88
 					PRIMARY KEY  (ANS_ID)";
89
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
90
-        $table_name = 'esp_attendee_meta';
91
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
89
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
90
+		$table_name = 'esp_attendee_meta';
91
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
92 92
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
93 93
 						ATT_fname VARCHAR(45) NOT NULL,
94 94
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 								KEY ATT_fname (ATT_fname),
105 105
 								KEY ATT_lname (ATT_lname),
106 106
 								KEY ATT_email (ATT_email)";
107
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
108
-        $table_name = 'esp_country';
109
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
107
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
108
+		$table_name = 'esp_country';
109
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
110 110
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
111 111
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
112 112
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
123 123
 					  CNT_active TINYINT(1) DEFAULT '0',
124 124
 					  PRIMARY KEY  (CNT_ISO)";
125
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
126
-        $table_name = 'esp_datetime';
127
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
125
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
126
+		$table_name = 'esp_datetime';
127
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
128 128
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
129 129
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
130 130
 				  DTT_description TEXT NOT NULL,
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 						PRIMARY KEY  (DTT_ID),
140 140
 						KEY EVT_ID (EVT_ID),
141 141
 						KEY DTT_is_primary (DTT_is_primary)";
142
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
143
-        $table_name = 'esp_event_meta';
144
-        $sql = "
142
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
143
+		$table_name = 'esp_event_meta';
144
+		$sql = "
145 145
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
146 146
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
147 147
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -156,31 +156,31 @@  discard block
 block discarded – undo
156 156
 			EVT_external_URL VARCHAR(200) NULL,
157 157
 			EVT_donations TINYINT(1) NULL,
158 158
 			PRIMARY KEY  (EVTM_ID)";
159
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
160
-        $table_name = 'esp_event_question_group';
161
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
159
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
160
+		$table_name = 'esp_event_question_group';
161
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
162 162
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
163 163
 					QSG_ID INT UNSIGNED NOT NULL,
164 164
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
165 165
 					PRIMARY KEY  (EQG_ID)";
166
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167
-        $table_name = 'esp_event_venue';
168
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
166
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167
+		$table_name = 'esp_event_venue';
168
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
169 169
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
170 170
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
171 171
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
172 172
 				PRIMARY KEY  (EVV_ID)";
173
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
174
-        $table_name = 'esp_extra_meta';
175
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
173
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
174
+		$table_name = 'esp_extra_meta';
175
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
176 176
 				OBJ_ID INT(11) DEFAULT NULL,
177 177
 				EXM_type VARCHAR(45) DEFAULT NULL,
178 178
 				EXM_key VARCHAR(45) DEFAULT NULL,
179 179
 				EXM_value TEXT,
180 180
 				PRIMARY KEY  (EXM_ID)";
181
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
182
-        $table_name = 'esp_line_item';
183
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
181
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
182
+		$table_name = 'esp_line_item';
183
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
184 184
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
185 185
 				TXN_ID INT(11) DEFAULT NULL,
186 186
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -196,19 +196,19 @@  discard block
 block discarded – undo
196 196
 				OBJ_ID INT(11) DEFAULT NULL,
197 197
 				OBJ_type VARCHAR(45)DEFAULT NULL,
198 198
 				PRIMARY KEY  (LIN_ID)";
199
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
200
-        $table_name = 'esp_message_template';
201
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
199
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
200
+		$table_name = 'esp_message_template';
201
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
202 202
 					GRP_ID INT(10) UNSIGNED NOT NULL,
203 203
 					MTP_context VARCHAR(50) NOT NULL,
204 204
 					MTP_template_field VARCHAR(30) NOT NULL,
205 205
 					MTP_content TEXT NOT NULL,
206 206
 					PRIMARY KEY  (MTP_ID),
207 207
 					KEY GRP_ID (GRP_ID)";
208
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
209
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
210
-        $table_name = 'esp_message_template_group';
211
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
208
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
209
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
210
+		$table_name = 'esp_message_template_group';
211
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
212 212
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
213 213
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
214 214
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
221 221
 					PRIMARY KEY  (GRP_ID),
222 222
 					KEY MTP_user_id (MTP_user_id)";
223
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
-        $table_name = 'esp_event_message_template';
225
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
223
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
+		$table_name = 'esp_event_message_template';
225
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
226 226
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
227 227
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
228 228
 					PRIMARY KEY  (EMT_ID),
229 229
 					KEY EVT_ID (EVT_ID),
230 230
 					KEY GRP_ID (GRP_ID)";
231
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
232
-        $table_name = 'esp_payment';
233
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
231
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
232
+		$table_name = 'esp_payment';
233
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
234 234
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
235 235
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
236 236
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 					PRIMARY KEY  (PAY_ID),
247 247
 					KEY TXN_ID (TXN_ID),
248 248
 					KEY PAY_timestamp (PAY_timestamp)";
249
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
250
-        $table_name = "esp_ticket";
251
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
249
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
250
+		$table_name = "esp_ticket";
251
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
252 252
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
253 253
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
254 254
 					  TKT_description TEXT NOT NULL,
@@ -268,28 +268,28 @@  discard block
 block discarded – undo
268 268
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
269 269
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
270 270
 					  PRIMARY KEY  (TKT_ID)";
271
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
272
-        $table_name = "esp_ticket_price";
273
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
271
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
272
+		$table_name = "esp_ticket_price";
273
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
274 274
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
275 275
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
276 276
 					  PRIMARY KEY  (TKP_ID)";
277
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
-        $table_name = "esp_datetime_ticket";
279
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
277
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
+		$table_name = "esp_datetime_ticket";
279
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
280 280
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
281 281
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
282 282
 					  PRIMARY KEY  (DTK_ID)";
283
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
284
-        $table_name = "esp_ticket_template";
285
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
283
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
284
+		$table_name = "esp_ticket_template";
285
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
286 286
 					  TTM_name VARCHAR(45) NOT NULL,
287 287
 					  TTM_description TEXT,
288 288
 					  TTM_file VARCHAR(45),
289 289
 					  PRIMARY KEY  (TTM_ID)";
290
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
291
-        $table_name = "esp_price";
292
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
290
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
291
+		$table_name = "esp_price";
292
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
293 293
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
294 294
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
295 295
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
301 301
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
302 302
 					  PRIMARY KEY  (PRC_ID)";
303
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
304
-        $table_name = "esp_price_type";
305
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
303
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
304
+		$table_name = "esp_price_type";
305
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
306 306
 				  PRT_name VARCHAR(45) NOT NULL,
307 307
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
308 308
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
311 311
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
312 312
 				  PRIMARY KEY  (PRT_ID)";
313
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
314
-        $table_name = 'esp_question';
315
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
313
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
314
+		$table_name = 'esp_question';
315
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
316 316
 					QST_display_text TEXT NOT NULL,
317 317
 					QST_admin_label VARCHAR(255) NOT NULL,
318 318
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 					QST_wp_user BIGINT UNSIGNED NULL,
325 325
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
326 326
 					PRIMARY KEY  (QST_ID)';
327
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
328
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
329
-        $table_name = 'esp_question_group';
330
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
327
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
328
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
329
+		$table_name = 'esp_question_group';
330
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
331 331
 					QSG_name VARCHAR(255) NOT NULL,
332 332
 					QSG_identifier VARCHAR(100) NOT NULL,
333 333
 					QSG_desc TEXT NULL,
@@ -338,25 +338,25 @@  discard block
 block discarded – undo
338 338
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
339 339
 					PRIMARY KEY  (QSG_ID),
340 340
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
341
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
-        $table_name = 'esp_question_group_question';
343
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_question_group_question';
343
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
344 344
 					QSG_ID INT UNSIGNED NOT NULL,
345 345
 					QST_ID INT UNSIGNED NOT NULL,
346 346
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
347 347
 					PRIMARY KEY  (QGQ_ID) ";
348
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
349
-        $table_name = 'esp_question_option';
350
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
348
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
349
+		$table_name = 'esp_question_option';
350
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
351 351
 					QSO_value VARCHAR(255) NOT NULL,
352 352
 					QSO_desc TEXT NOT NULL,
353 353
 					QST_ID INT UNSIGNED NOT NULL,
354 354
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
355 355
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
356 356
 					PRIMARY KEY  (QSO_ID)";
357
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
-        $table_name = 'esp_registration';
359
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
+		$table_name = 'esp_registration';
359
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
360 360
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
361 361
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
362 362
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -379,25 +379,25 @@  discard block
 block discarded – undo
379 379
 					  KEY STS_ID (STS_ID),
380 380
 					  KEY REG_url_link (REG_url_link),
381 381
 					  KEY REG_code (REG_code)";
382
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
383
-        $table_name = 'esp_checkin';
384
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
382
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
383
+		$table_name = 'esp_checkin';
384
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
385 385
 					REG_ID INT(10) UNSIGNED NOT NULL,
386 386
 					DTT_ID INT(10) UNSIGNED NOT NULL,
387 387
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
388 388
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
389 389
 					PRIMARY KEY  (CHK_ID)";
390
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
391
-        $table_name = 'esp_state';
392
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
390
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
391
+		$table_name = 'esp_state';
392
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
393 393
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
394 394
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
395 395
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
396 396
 					  STA_active TINYINT(1) DEFAULT '1',
397 397
 					  PRIMARY KEY  (STA_ID)";
398
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
399
-        $table_name = 'esp_status';
400
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
398
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
399
+		$table_name = 'esp_status';
400
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
401 401
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
402 402
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
403 403
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
406 406
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
407 407
 					  KEY STS_type (STS_type)";
408
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
409
-        $table_name = 'esp_transaction';
410
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
408
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
409
+		$table_name = 'esp_transaction';
410
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
411 411
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
412 412
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
413 413
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 					  PRIMARY KEY  (TXN_ID),
418 418
 					  KEY TXN_timestamp (TXN_timestamp),
419 419
 					  KEY STS_ID (STS_ID)";
420
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
421
-        $table_name = 'esp_venue_meta';
422
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
420
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
421
+		$table_name = 'esp_venue_meta';
422
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
423 423
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
424 424
 			VNU_address VARCHAR(255) DEFAULT NULL,
425 425
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -437,79 +437,79 @@  discard block
 block discarded – undo
437 437
 			PRIMARY KEY  (VNUM_ID),
438 438
 			KEY STA_ID (STA_ID),
439 439
 			KEY CNT_ISO (CNT_ISO)";
440
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
441
-        $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
442
-        //setting up the DEFAULT stats and countries is also essential for the data migrations to run
443
-        //(because many need to convert old string states to foreign keys into the states table)
444
-        $script_with_defaults->insert_default_states();
445
-        $script_with_defaults->insert_default_countries();
446
-        //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
447
-        $script_with_defaults->insert_default_price_types();
448
-        $script_with_defaults->insert_default_prices();
449
-        //but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's
450
-        $this->insert_default_tickets();
451
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
452
-        EE_Config::instance()->update_espresso_config(false, true);
453
-        return true;
454
-    }
455
-
456
-
457
-
458
-    /**
459
-     * @return boolean
460
-     */
461
-    public function schema_changes_after_migration()
462
-    {
463
-        return true;
464
-    }
465
-
466
-
467
-
468
-    public function migration_page_hooks()
469
-    {
470
-    }
471
-
472
-
473
-
474
-    /**
475
-     * insert DEFAULT ticket
476
-     * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field
477
-     *
478
-     * @access public
479
-     * @static
480
-     * @return void
481
-     */
482
-    public function insert_default_tickets()
483
-    {
484
-        global $wpdb;
485
-        $ticket_table = $wpdb->prefix . "esp_ticket";
486
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
487
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
488
-            $tickets_exist = $wpdb->get_var($SQL);
489
-            if ( ! $tickets_exist) {
490
-                $SQL = "INSERT INTO $ticket_table
440
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
441
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
442
+		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
443
+		//(because many need to convert old string states to foreign keys into the states table)
444
+		$script_with_defaults->insert_default_states();
445
+		$script_with_defaults->insert_default_countries();
446
+		//setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
447
+		$script_with_defaults->insert_default_price_types();
448
+		$script_with_defaults->insert_default_prices();
449
+		//but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's
450
+		$this->insert_default_tickets();
451
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
452
+		EE_Config::instance()->update_espresso_config(false, true);
453
+		return true;
454
+	}
455
+
456
+
457
+
458
+	/**
459
+	 * @return boolean
460
+	 */
461
+	public function schema_changes_after_migration()
462
+	{
463
+		return true;
464
+	}
465
+
466
+
467
+
468
+	public function migration_page_hooks()
469
+	{
470
+	}
471
+
472
+
473
+
474
+	/**
475
+	 * insert DEFAULT ticket
476
+	 * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field
477
+	 *
478
+	 * @access public
479
+	 * @static
480
+	 * @return void
481
+	 */
482
+	public function insert_default_tickets()
483
+	{
484
+		global $wpdb;
485
+		$ticket_table = $wpdb->prefix . "esp_ticket";
486
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
487
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
488
+			$tickets_exist = $wpdb->get_var($SQL);
489
+			if ( ! $tickets_exist) {
490
+				$SQL = "INSERT INTO $ticket_table
491 491
 					( 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_deleted ) VALUES
492 492
 					( 1, 0, '"
493
-                       . __("Free Ticket", "event_espresso")
494
-                       . "', '', 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, 0);";
495
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
496
-                $wpdb->query($SQL);
497
-            }
498
-        }
499
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
500
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
501
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
502
-            $ticket_prc_exist = $wpdb->get_var($SQL);
503
-            if ( ! $ticket_prc_exist) {
504
-                $SQL = "INSERT INTO $ticket_price_table
493
+					   . __("Free Ticket", "event_espresso")
494
+					   . "', '', 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, 0);";
495
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
496
+				$wpdb->query($SQL);
497
+			}
498
+		}
499
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
500
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
501
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
502
+			$ticket_prc_exist = $wpdb->get_var($SQL);
503
+			if ( ! $ticket_prc_exist) {
504
+				$SQL = "INSERT INTO $ticket_price_table
505 505
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
506 506
 				( 1, 1, 1 )
507 507
 				";
508
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
509
-                $wpdb->query($SQL);
510
-            }
511
-        }
512
-    }
508
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
509
+				$wpdb->query($SQL);
510
+			}
511
+		}
512
+	}
513 513
 
514 514
 }
515 515
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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_3_0_stages/*');
14
+$stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 if ( ! empty($stages)) {
17 17
     foreach ($stages as $filepath) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         } elseif ( ! $version_string) {
61 61
 //			echo "no version string provided: $version_string";
62 62
             //no version string provided... this must be pre 4.2
63
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
63
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
64 64
         } else {
65 65
 //			echo "$version_string doesnt apply";
66 66
             return false;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function schema_changes_before_migration()
80 80
     {
81 81
         //relies on 4.1's EEH_Activation::create_table
82
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
82
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
83 83
         $table_name = 'esp_answer';
84 84
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
85 85
 					REG_ID INT UNSIGNED NOT NULL,
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
     public function insert_default_tickets()
483 483
     {
484 484
         global $wpdb;
485
-        $ticket_table = $wpdb->prefix . "esp_ticket";
485
+        $ticket_table = $wpdb->prefix."esp_ticket";
486 486
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
487
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
487
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
488 488
             $tickets_exist = $wpdb->get_var($SQL);
489 489
             if ( ! $tickets_exist) {
490 490
                 $SQL = "INSERT INTO $ticket_table
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
                 $wpdb->query($SQL);
497 497
             }
498 498
         }
499
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
499
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
500 500
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
501
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
501
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
502 502
             $ticket_prc_exist = $wpdb->get_var($SQL);
503 503
             if ( ! $ticket_prc_exist) {
504 504
                 $SQL = "INSERT INTO $ticket_price_table
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
Indentation   +277 added lines, -277 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
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,80 +35,80 @@  discard block
 block discarded – undo
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 Migration to Event Espresso 4.6.0.P", "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_payment_method_currencies(),
51
-            new EE_DMS_4_6_0_question_types(),
52
-            new EE_DMS_4_6_0_country_system_question(),
53
-            new EE_DMS_4_6_0_state_system_question(),
54
-            new EE_DMS_4_6_0_billing_info(),
55
-            new EE_DMS_4_6_0_transactions(),
56
-            new EE_DMS_4_6_0_payments(),
57
-            new EE_DMS_4_6_0_invoice_settings(),
58
-        );
59
-        parent::__construct($table_manager, $table_analysis);
60
-    }
61
-
62
-
63
-
64
-    /**
65
-     * @param array $version_array
66
-     * @return bool
67
-     */
68
-    public function can_migrate_from_version($version_array)
69
-    {
70
-        $version_string = $version_array['Core'];
71
-        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 Migration to Event Espresso 4.6.0.P", "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_payment_method_currencies(),
51
+			new EE_DMS_4_6_0_question_types(),
52
+			new EE_DMS_4_6_0_country_system_question(),
53
+			new EE_DMS_4_6_0_state_system_question(),
54
+			new EE_DMS_4_6_0_billing_info(),
55
+			new EE_DMS_4_6_0_transactions(),
56
+			new EE_DMS_4_6_0_payments(),
57
+			new EE_DMS_4_6_0_invoice_settings(),
58
+		);
59
+		parent::__construct($table_manager, $table_analysis);
60
+	}
61
+
62
+
63
+
64
+	/**
65
+	 * @param array $version_array
66
+	 * @return bool
67
+	 */
68
+	public function can_migrate_from_version($version_array)
69
+	{
70
+		$version_string = $version_array['Core'];
71
+		if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
72 72
 //			echo "$version_string can be migrated from";
73
-            return true;
74
-        } elseif ( ! $version_string) {
73
+			return true;
74
+		} elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
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
78
-        } else {
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
78
+		} else {
79 79
 //			echo "$version_string doesnt apply";
80
-            return false;
81
-        }
82
-    }
80
+			return false;
81
+		}
82
+	}
83 83
 
84 84
 
85 85
 
86
-    /**
87
-     * @return string|void
88
-     */
89
-    public function pretty_name()
90
-    {
91
-        return __("Core Data Migration to version 4.6.0", "event_espresso");
92
-    }
86
+	/**
87
+	 * @return string|void
88
+	 */
89
+	public function pretty_name()
90
+	{
91
+		return __("Core Data Migration to version 4.6.0", "event_espresso");
92
+	}
93 93
 
94 94
 
95 95
 
96
-    /**
97
-     * @return bool
98
-     */
99
-    public function schema_changes_before_migration()
100
-    {
101
-        //relies on 4.1's EEH_Activation::create_table
102
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
103
-        $table_name = 'esp_answer';
104
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
96
+	/**
97
+	 * @return bool
98
+	 */
99
+	public function schema_changes_before_migration()
100
+	{
101
+		//relies on 4.1's EEH_Activation::create_table
102
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
103
+		$table_name = 'esp_answer';
104
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
105 105
 					REG_ID INT UNSIGNED NOT NULL,
106 106
 					QST_ID INT UNSIGNED NOT NULL,
107 107
 					ANS_value TEXT NOT NULL,
108 108
 					PRIMARY KEY  (ANS_ID)";
109
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
110
-        $table_name = 'esp_attendee_meta';
111
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
109
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
110
+		$table_name = 'esp_attendee_meta';
111
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
112 112
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
113 113
 						ATT_fname VARCHAR(45) NOT NULL,
114 114
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 								KEY ATT_fname (ATT_fname),
125 125
 								KEY ATT_lname (ATT_lname),
126 126
 								KEY ATT_email (ATT_email)";
127
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
128
-        $table_name = 'esp_country';
129
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
127
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
128
+		$table_name = 'esp_country';
129
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
130 130
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
131 131
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
132 132
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -142,24 +142,24 @@  discard block
 block discarded – undo
142 142
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
143 143
 					  CNT_active TINYINT(1) DEFAULT '0',
144 144
 					  PRIMARY KEY  (CNT_ISO)";
145
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
146
-        $table_name = 'esp_currency';
147
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
145
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
146
+		$table_name = 'esp_currency';
147
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
148 148
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
149 149
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
150 150
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
151 151
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
152 152
 				CUR_active TINYINT(1) DEFAULT '0',
153 153
 				PRIMARY KEY  (CUR_code)";
154
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
155
-        $table_name = 'esp_currency_payment_method';
156
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
154
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
155
+		$table_name = 'esp_currency_payment_method';
156
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
157 157
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
158 158
 				PMD_ID INT(11) NOT NULL,
159 159
 				PRIMARY KEY  (CPM_ID)";
160
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
161
-        $table_name = 'esp_datetime';
162
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
160
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
161
+		$table_name = 'esp_datetime';
162
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
163 163
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
164 164
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
165 165
 				  DTT_description TEXT NOT NULL,
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 						PRIMARY KEY  (DTT_ID),
175 175
 						KEY EVT_ID (EVT_ID),
176 176
 						KEY DTT_is_primary (DTT_is_primary)";
177
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
178
-        $table_name = 'esp_event_meta';
179
-        $sql = "
177
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
178
+		$table_name = 'esp_event_meta';
179
+		$sql = "
180 180
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
181 181
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
182 182
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -191,31 +191,31 @@  discard block
 block discarded – undo
191 191
 			EVT_external_URL VARCHAR(200) NULL,
192 192
 			EVT_donations TINYINT(1) NULL,
193 193
 			PRIMARY KEY  (EVTM_ID)";
194
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
-        $table_name = 'esp_event_question_group';
196
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
194
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
+		$table_name = 'esp_event_question_group';
196
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
197 197
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
198 198
 					QSG_ID INT UNSIGNED NOT NULL,
199 199
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
200 200
 					PRIMARY KEY  (EQG_ID)";
201
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
202
-        $table_name = 'esp_event_venue';
203
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
201
+		$this->_table_should_exist_previously($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_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
209
-        $table_name = 'esp_extra_meta';
210
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
208
+		$this->_table_should_exist_previously($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
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
217
-        $table_name = 'esp_line_item';
218
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
216
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
217
+		$table_name = 'esp_line_item';
218
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
219 219
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
220 220
 				TXN_ID INT(11) DEFAULT NULL,
221 221
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 				OBJ_ID INT(11) DEFAULT NULL,
232 232
 				OBJ_type VARCHAR(45)DEFAULT NULL,
233 233
 				PRIMARY KEY  (LIN_ID)";
234
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
235
-        $table_name = 'esp_log';
236
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
234
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
235
+		$table_name = 'esp_log';
236
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
237 237
 				LOG_time DATETIME DEFAULT NULL,
238 238
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
239 239
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -241,19 +241,19 @@  discard block
 block discarded – undo
241 241
 				LOG_message TEXT,
242 242
 				LOG_wp_user INT(11) DEFAULT NULL,
243 243
 				PRIMARY KEY  (LOG_ID)";
244
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
245
-        $table_name = 'esp_message_template';
246
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
245
+		$table_name = 'esp_message_template';
246
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
247 247
 					GRP_ID INT(10) UNSIGNED NOT NULL,
248 248
 					MTP_context VARCHAR(50) NOT NULL,
249 249
 					MTP_template_field VARCHAR(30) NOT NULL,
250 250
 					MTP_content TEXT NOT NULL,
251 251
 					PRIMARY KEY  (MTP_ID),
252 252
 					KEY GRP_ID (GRP_ID)";
253
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
254
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
255
-        $table_name = 'esp_message_template_group';
256
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
253
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
254
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
255
+		$table_name = 'esp_message_template_group';
256
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
257 257
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
258 258
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
259 259
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
266 266
 					PRIMARY KEY  (GRP_ID),
267 267
 					KEY MTP_user_id (MTP_user_id)";
268
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
269
-        $table_name = 'esp_event_message_template';
270
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
268
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
269
+		$table_name = 'esp_event_message_template';
270
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
271 271
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
272 272
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
273 273
 					PRIMARY KEY  (EMT_ID),
274 274
 					KEY EVT_ID (EVT_ID),
275 275
 					KEY GRP_ID (GRP_ID)";
276
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
277
-        $table_name = 'esp_payment';
278
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
276
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
277
+		$table_name = 'esp_payment';
278
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
279 279
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
280 280
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
281 281
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 					PRIMARY KEY  (PAY_ID),
293 293
 					KEY TXN_ID (TXN_ID),
294 294
 					KEY PAY_timestamp (PAY_timestamp)";
295
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
296
-        $table_name = 'esp_payment_method';
297
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
295
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
296
+		$table_name = 'esp_payment_method';
297
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
298 298
 				PMD_type VARCHAR(124) DEFAULT NULL,
299 299
 				PMD_name VARCHAR(255) DEFAULT NULL,
300 300
 				PMD_desc TEXT,
@@ -309,28 +309,28 @@  discard block
 block discarded – undo
309 309
 				PMD_scope VARCHAR(255) NULL DEFAULT 'frontend',
310 310
 				PRIMARY KEY  (PMD_ID),
311 311
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)";
312
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
313
-        $table_name = "esp_ticket_price";
314
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
312
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
313
+		$table_name = "esp_ticket_price";
314
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
315 315
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
316 316
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
317 317
 					  PRIMARY KEY  (TKP_ID)";
318
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
319
-        $table_name = "esp_datetime_ticket";
320
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
319
+		$table_name = "esp_datetime_ticket";
320
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
321 321
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
322 322
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
323 323
 					  PRIMARY KEY  (DTK_ID)";
324
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
325
-        $table_name = "esp_ticket_template";
326
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
324
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
325
+		$table_name = "esp_ticket_template";
326
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
327 327
 					  TTM_name VARCHAR(45) NOT NULL,
328 328
 					  TTM_description TEXT,
329 329
 					  TTM_file VARCHAR(45),
330 330
 					  PRIMARY KEY  (TTM_ID)";
331
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
332
-        $table_name = 'esp_question';
333
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
331
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
332
+		$table_name = 'esp_question';
333
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
334 334
 					QST_display_text TEXT NOT NULL,
335 335
 					QST_admin_label VARCHAR(255) NOT NULL,
336 336
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -342,25 +342,25 @@  discard block
 block discarded – undo
342 342
 					QST_wp_user BIGINT UNSIGNED NULL,
343 343
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
344 344
 					PRIMARY KEY  (QST_ID)';
345
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
346
-        $table_name = 'esp_question_group_question';
347
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
345
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
346
+		$table_name = 'esp_question_group_question';
347
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
348 348
 					QSG_ID INT UNSIGNED NOT NULL,
349 349
 					QST_ID INT UNSIGNED NOT NULL,
350 350
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
351 351
 					PRIMARY KEY  (QGQ_ID) ";
352
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
353
-        $table_name = 'esp_question_option';
354
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
352
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
353
+		$table_name = 'esp_question_option';
354
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
355 355
 					QSO_value VARCHAR(255) NOT NULL,
356 356
 					QSO_desc TEXT NOT NULL,
357 357
 					QST_ID INT UNSIGNED NOT NULL,
358 358
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
359 359
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
360 360
 					PRIMARY KEY  (QSO_ID)";
361
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
362
-        $table_name = 'esp_registration';
363
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
361
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
362
+		$table_name = 'esp_registration';
363
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
364 364
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
365 365
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
366 366
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -383,25 +383,25 @@  discard block
 block discarded – undo
383 383
 					  KEY STS_ID (STS_ID),
384 384
 					  KEY REG_url_link (REG_url_link),
385 385
 					  KEY REG_code (REG_code)";
386
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
387
-        $table_name = 'esp_checkin';
388
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
386
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
387
+		$table_name = 'esp_checkin';
388
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
389 389
 					REG_ID INT(10) UNSIGNED NOT NULL,
390 390
 					DTT_ID INT(10) UNSIGNED NOT NULL,
391 391
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
392 392
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
393 393
 					PRIMARY KEY  (CHK_ID)";
394
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
395
-        $table_name = 'esp_state';
396
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
394
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
395
+		$table_name = 'esp_state';
396
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
397 397
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
398 398
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
399 399
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
400 400
 					  STA_active TINYINT(1) DEFAULT '1',
401 401
 					  PRIMARY KEY  (STA_ID)";
402
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
403
-        $table_name = 'esp_status';
404
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
402
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
403
+		$table_name = 'esp_status';
404
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
405 405
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
406 406
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
407 407
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
410 410
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
411 411
 					  KEY STS_type (STS_type)";
412
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
413
-        $table_name = 'esp_transaction';
414
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
412
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
413
+		$table_name = 'esp_transaction';
414
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
415 415
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
416 416
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
417 417
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 					  PRIMARY KEY  (TXN_ID),
424 424
 					  KEY TXN_timestamp (TXN_timestamp),
425 425
 					  KEY STS_ID (STS_ID)";
426
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
-        $table_name = 'esp_venue_meta';
428
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
426
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
+		$table_name = 'esp_venue_meta';
428
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
429 429
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
430 430
 			VNU_address VARCHAR(255) DEFAULT NULL,
431 431
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -443,10 +443,10 @@  discard block
 block discarded – undo
443 443
 			PRIMARY KEY  (VNUM_ID),
444 444
 			KEY STA_ID (STA_ID),
445 445
 			KEY CNT_ISO (CNT_ISO)";
446
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
447
-        //modified tables
448
-        $table_name = "esp_price";
449
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
446
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
447
+		//modified tables
448
+		$table_name = "esp_price";
449
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
450 450
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
451 451
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
452 452
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 					  PRC_wp_user BIGINT UNSIGNED NULL,
459 459
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
460 460
 					  PRIMARY KEY  (PRC_ID)";
461
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
462
-        $table_name = "esp_price_type";
463
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
461
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
462
+		$table_name = "esp_price_type";
463
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
464 464
 				  PRT_name VARCHAR(45) NOT NULL,
465 465
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
466 466
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
470 470
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
471 471
 				  PRIMARY KEY  (PRT_ID)";
472
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
473
-        $table_name = "esp_ticket";
474
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
472
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
473
+		$table_name = "esp_ticket";
474
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
475 475
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
476 476
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
477 477
 					  TKT_description TEXT NOT NULL,
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
493 493
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
494 494
 					  PRIMARY KEY  (TKT_ID)";
495
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
496
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
497
-        $table_name = 'esp_question_group';
498
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
495
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
496
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
497
+		$table_name = 'esp_question_group';
498
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
499 499
 					QSG_name VARCHAR(255) NOT NULL,
500 500
 					QSG_identifier VARCHAR(100) NOT NULL,
501 501
 					QSG_desc TEXT NULL,
@@ -507,119 +507,119 @@  discard block
 block discarded – undo
507 507
 					QSG_wp_user BIGINT UNSIGNED NULL,
508 508
 					PRIMARY KEY  (QSG_ID),
509 509
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
510
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
511
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
512
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
513
-        //(because many need to convert old string states to foreign keys into the states table)
514
-        $script_4_1_defaults->insert_default_states();
515
-        $script_4_1_defaults->insert_default_countries();
516
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
517
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
518
-        $script_4_5_defaults->insert_default_price_types();
519
-        $script_4_5_defaults->insert_default_prices();
520
-        $script_4_5_defaults->insert_default_tickets();
521
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
522
-        EE_Config::instance()->update_espresso_config(false, true);
523
-        $this->add_default_admin_only_payments();
524
-        $this->insert_default_currencies();
525
-        return true;
526
-    }
527
-
528
-
529
-
530
-    /**
531
-     * @return boolean
532
-     */
533
-    public function schema_changes_after_migration()
534
-    {
535
-        return true;
536
-    }
537
-
538
-
539
-
540
-    public function migration_page_hooks()
541
-    {
542
-    }
543
-
544
-
545
-
546
-    public function add_default_admin_only_payments()
547
-    {
548
-        global $wpdb;
549
-        $table_name = $wpdb->prefix . "esp_payment_method";
550
-        $user_id = EEH_Activation::get_default_creator_id();
551
-        if ($this->_get_table_analysis()->tableExists($table_name)) {
552
-            $SQL = "SELECT COUNT( * ) FROM $table_name";
553
-            $existing_payment_methods = $wpdb->get_var($SQL);
554
-            $default_admin_only_payment_methods = apply_filters(
555
-                'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
556
-                array(
557
-                    __("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
558
-                    __("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
559
-                    __("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
560
-                    __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
561
-                    __("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
562
-                    __("Invoice", 'event_espresso')     => __("Invoice received with monies included",
563
-                        'event_espresso'),
564
-                    __("Money Order", 'event_espresso') => '',
565
-                    __("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
566
-                    __('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
567
-                ));
568
-            //make sure we hae payment method records for the following
569
-            //so admins can record payments for them from the admin page
570
-            foreach ($default_admin_only_payment_methods as $nicename => $description) {
571
-                $slug = sanitize_key($nicename);
572
-                //check that such a payment method exists
573
-                $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
574
-                if ( ! $exists) {
575
-                    $values = array(
576
-                        'PMD_type'       => 'Admin_Only',
577
-                        'PMD_name'       => $nicename,
578
-                        'PMD_admin_name' => $nicename,
579
-                        'PMD_admin_desc' => $description,
580
-                        'PMD_slug'       => $slug,
581
-                        'PMD_wp_user'    => $user_id,
582
-                        'PMD_scope'      => serialize(array('ADMIN')),
583
-                    );
584
-                    $success = $wpdb->insert(
585
-                        $table_name,
586
-                        $values,
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
595
-                        )
596
-                    );
597
-                    if ( ! $success) {
598
-                        $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
599
-                            "event_espresso"), $this->_json_encode($values)));
600
-                    }
601
-                }
602
-            }
603
-        }
604
-    }
605
-
606
-
607
-
608
-    /**
609
-     * insert_default_countries
610
-     *
611
-     * @static
612
-     * @return void
613
-     */
614
-    public function insert_default_currencies()
615
-    {
616
-        global $wpdb;
617
-        $currency_table = $wpdb->prefix . "esp_currency";
618
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
619
-            $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
620
-            $countries = $wpdb->get_var($SQL);
621
-            if ( ! $countries) {
622
-                $SQL = "INSERT INTO $currency_table
510
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
511
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
512
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
513
+		//(because many need to convert old string states to foreign keys into the states table)
514
+		$script_4_1_defaults->insert_default_states();
515
+		$script_4_1_defaults->insert_default_countries();
516
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
517
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
518
+		$script_4_5_defaults->insert_default_price_types();
519
+		$script_4_5_defaults->insert_default_prices();
520
+		$script_4_5_defaults->insert_default_tickets();
521
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
522
+		EE_Config::instance()->update_espresso_config(false, true);
523
+		$this->add_default_admin_only_payments();
524
+		$this->insert_default_currencies();
525
+		return true;
526
+	}
527
+
528
+
529
+
530
+	/**
531
+	 * @return boolean
532
+	 */
533
+	public function schema_changes_after_migration()
534
+	{
535
+		return true;
536
+	}
537
+
538
+
539
+
540
+	public function migration_page_hooks()
541
+	{
542
+	}
543
+
544
+
545
+
546
+	public function add_default_admin_only_payments()
547
+	{
548
+		global $wpdb;
549
+		$table_name = $wpdb->prefix . "esp_payment_method";
550
+		$user_id = EEH_Activation::get_default_creator_id();
551
+		if ($this->_get_table_analysis()->tableExists($table_name)) {
552
+			$SQL = "SELECT COUNT( * ) FROM $table_name";
553
+			$existing_payment_methods = $wpdb->get_var($SQL);
554
+			$default_admin_only_payment_methods = apply_filters(
555
+				'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
556
+				array(
557
+					__("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
558
+					__("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
559
+					__("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
560
+					__("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
561
+					__("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
562
+					__("Invoice", 'event_espresso')     => __("Invoice received with monies included",
563
+						'event_espresso'),
564
+					__("Money Order", 'event_espresso') => '',
565
+					__("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
566
+					__('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
567
+				));
568
+			//make sure we hae payment method records for the following
569
+			//so admins can record payments for them from the admin page
570
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
571
+				$slug = sanitize_key($nicename);
572
+				//check that such a payment method exists
573
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
574
+				if ( ! $exists) {
575
+					$values = array(
576
+						'PMD_type'       => 'Admin_Only',
577
+						'PMD_name'       => $nicename,
578
+						'PMD_admin_name' => $nicename,
579
+						'PMD_admin_desc' => $description,
580
+						'PMD_slug'       => $slug,
581
+						'PMD_wp_user'    => $user_id,
582
+						'PMD_scope'      => serialize(array('ADMIN')),
583
+					);
584
+					$success = $wpdb->insert(
585
+						$table_name,
586
+						$values,
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
595
+						)
596
+					);
597
+					if ( ! $success) {
598
+						$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
599
+							"event_espresso"), $this->_json_encode($values)));
600
+					}
601
+				}
602
+			}
603
+		}
604
+	}
605
+
606
+
607
+
608
+	/**
609
+	 * insert_default_countries
610
+	 *
611
+	 * @static
612
+	 * @return void
613
+	 */
614
+	public function insert_default_currencies()
615
+	{
616
+		global $wpdb;
617
+		$currency_table = $wpdb->prefix . "esp_currency";
618
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
619
+			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
620
+			$countries = $wpdb->get_var($SQL);
621
+			if ( ! $countries) {
622
+				$SQL = "INSERT INTO $currency_table
623 623
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
624 624
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
625 625
 				( 'AED',  'Dirham',  'Dirhams', 'د.إ',2,1),
@@ -773,10 +773,10 @@  discard block
 block discarded – undo
773 773
 				( 'ZAR',  'Rand',  'Rands',  'R',  2,1),
774 774
 				( 'ZMK',  'Kwacha',  'Kwachas',  '',  2,1),
775 775
 				( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);";
776
-                $wpdb->query($SQL);
777
-            }
778
-        }
779
-    }
776
+				$wpdb->query($SQL);
777
+			}
778
+		}
779
+	}
780 780
 
781 781
 }
782 782
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 2 patches
Indentation   +362 added lines, -362 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
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,81 +38,81 @@  discard block
 block discarded – undo
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 = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "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 = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "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 string|void
89
-     */
90
-    public function pretty_name()
91
-    {
92
-        return __("Core Data Migration to version 4.8.0", "event_espresso");
93
-    }
87
+	/**
88
+	 * @return string|void
89
+	 */
90
+	public function pretty_name()
91
+	{
92
+		return __("Core Data Migration to version 4.8.0", "event_espresso");
93
+	}
94 94
 
95 95
 
96 96
 
97
-    /**
98
-     * @return bool
99
-     */
100
-    public function schema_changes_before_migration()
101
-    {
102
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
103
-        $now_in_mysql = current_time('mysql', true);
104
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
105
-        $table_name = 'esp_answer';
106
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97
+	/**
98
+	 * @return bool
99
+	 */
100
+	public function schema_changes_before_migration()
101
+	{
102
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
103
+		$now_in_mysql = current_time('mysql', true);
104
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
105
+		$table_name = 'esp_answer';
106
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
107 107
 					REG_ID int(10) unsigned NOT NULL,
108 108
 					QST_ID int(10) unsigned NOT NULL,
109 109
 					ANS_value text NOT NULL,
110 110
 					PRIMARY KEY  (ANS_ID),
111 111
 					KEY REG_ID (REG_ID),
112 112
 					KEY QST_ID (QST_ID)";
113
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
114
-        $table_name = 'esp_attendee_meta';
115
-        $sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
113
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
114
+		$table_name = 'esp_attendee_meta';
115
+		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
116 116
 						ATT_ID bigint(20) unsigned NOT NULL,
117 117
 						ATT_fname varchar(45) NOT NULL,
118 118
 						ATT_lname varchar(45) NOT	NULL,
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 								KEY ATT_email (ATT_email),
130 130
 								KEY ATT_lname (ATT_lname),
131 131
 								KEY ATT_fname (ATT_fname)";
132
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
133
-        $table_name = 'esp_country';
134
-        $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
132
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
133
+		$table_name = 'esp_country';
134
+		$sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
135 135
 					  CNT_ISO3 varchar(3) collate utf8_bin NOT NULL,
136 136
 					  RGN_ID tinyint(3) unsigned DEFAULT NULL,
137 137
 					  CNT_name varchar(45) collate utf8_bin NOT NULL,
@@ -147,25 +147,25 @@  discard block
 block discarded – undo
147 147
 					  CNT_is_EU tinyint(1) DEFAULT '0',
148 148
 					  CNT_active tinyint(1) DEFAULT '0',
149 149
 					  PRIMARY KEY  (CNT_ISO)";
150
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
-        $table_name = 'esp_currency';
152
-        $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
150
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
+		$table_name = 'esp_currency';
152
+		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
153 153
 				CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar',
154 154
 				CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars',
155 155
 				CUR_sign varchar(45) collate utf8_bin DEFAULT '$',
156 156
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
157 157
 				CUR_active tinyint(1) DEFAULT '0',
158 158
 				PRIMARY KEY  (CUR_code)";
159
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
160
-        $table_name = 'esp_currency_payment_method';
161
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
159
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
160
+		$table_name = 'esp_currency_payment_method';
161
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
162 162
 				CUR_code varchar(6) collate utf8_bin NOT NULL,
163 163
 				PMD_ID int(11) NOT NULL,
164 164
 				PRIMARY KEY  (CPM_ID),
165 165
 				KEY PMD_ID (PMD_ID)";
166
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
167
-        $table_name = 'esp_datetime';
168
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
166
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
167
+		$table_name = 'esp_datetime';
168
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
169 169
 				  EVT_ID bigint(20) unsigned NOT NULL,
170 170
 				  DTT_name varchar(255) NOT NULL DEFAULT '',
171 171
 				  DTT_description text NOT NULL,
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 						KEY DTT_EVT_start (DTT_EVT_start),
182 182
 						KEY EVT_ID (EVT_ID),
183 183
 						KEY DTT_is_primary (DTT_is_primary)";
184
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
185
-        $table_name = 'esp_event_meta';
186
-        $sql = "
184
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
185
+		$table_name = 'esp_event_meta';
186
+		$sql = "
187 187
 			EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
188 188
 			EVT_ID bigint(20) unsigned NOT NULL,
189 189
 			EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -199,34 +199,34 @@  discard block
 block discarded – undo
199 199
 			EVT_donations tinyint(1) NULL,
200 200
 			PRIMARY KEY  (EVTM_ID),
201 201
 			KEY EVT_ID (EVT_ID)";
202
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
203
-        $table_name = 'esp_event_question_group';
204
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
202
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
203
+		$table_name = 'esp_event_question_group';
204
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
205 205
 					EVT_ID bigint(20) unsigned NOT NULL,
206 206
 					QSG_ID int(10) unsigned NOT NULL,
207 207
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
208 208
 					PRIMARY KEY  (EQG_ID),
209 209
 					KEY EVT_ID (EVT_ID),
210 210
 					KEY QSG_ID (QSG_ID)";
211
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212
-        $table_name = 'esp_event_venue';
213
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
211
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212
+		$table_name = 'esp_event_venue';
213
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
214 214
 				EVT_ID bigint(20) unsigned NOT NULL,
215 215
 				VNU_ID bigint(20) unsigned NOT NULL,
216 216
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
217 217
 				PRIMARY KEY  (EVV_ID)";
218
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
219
-        $table_name = 'esp_extra_meta';
220
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
218
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_extra_meta';
220
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
221 221
 				OBJ_ID int(11) DEFAULT NULL,
222 222
 				EXM_type varchar(45) DEFAULT NULL,
223 223
 				EXM_key varchar(45) DEFAULT NULL,
224 224
 				EXM_value text,
225 225
 				PRIMARY KEY  (EXM_ID),
226 226
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
227
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
228
-        $table_name = 'esp_extra_join';
229
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
227
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
228
+		$table_name = 'esp_extra_join';
229
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
230 230
 				EXJ_first_model_id varchar(6) NOT NULL,
231 231
 				EXJ_first_model_name varchar(20) NOT NULL,
232 232
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 				PRIMARY KEY  (EXJ_ID),
235 235
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
236 236
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
237
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
238
-        $table_name = 'esp_line_item';
239
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
237
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
238
+		$table_name = 'esp_line_item';
239
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
240 240
 				LIN_code varchar(245) NOT NULL DEFAULT '',
241 241
 				TXN_ID int(11) DEFAULT NULL,
242 242
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 				PRIMARY KEY  (LIN_ID),
256 256
 				KEY LIN_code (LIN_code(191)),
257 257
 				KEY TXN_ID (TXN_ID)";
258
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
259
-        $table_name = 'esp_log';
260
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
258
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
259
+		$table_name = 'esp_log';
260
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
261 261
 				LOG_time datetime DEFAULT NULL,
262 262
 				OBJ_ID varchar(45) DEFAULT NULL,
263 263
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -268,18 +268,18 @@  discard block
 block discarded – undo
268 268
 				KEY LOG_time (LOG_time),
269 269
 				KEY OBJ (OBJ_type,OBJ_ID),
270 270
 				KEY LOG_type (LOG_type)";
271
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
272
-        $table_name = 'esp_message_template';
273
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
271
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
272
+		$table_name = 'esp_message_template';
273
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
274 274
 					GRP_ID int(10) unsigned NOT NULL,
275 275
 					MTP_context varchar(50) NOT NULL,
276 276
 					MTP_template_field varchar(30) NOT NULL,
277 277
 					MTP_content text NOT NULL,
278 278
 					PRIMARY KEY  (MTP_ID),
279 279
 					KEY GRP_ID (GRP_ID)";
280
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
281
-        $table_name = 'esp_message_template_group';
282
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
280
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
281
+		$table_name = 'esp_message_template_group';
282
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
283 283
 					MTP_user_id int(10) NOT NULL DEFAULT '1',
284 284
 					MTP_name varchar(245) NOT NULL DEFAULT '',
285 285
 					MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -291,17 +291,17 @@  discard block
 block discarded – undo
291 291
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
292 292
 					PRIMARY KEY  (GRP_ID),
293 293
 					KEY MTP_user_id (MTP_user_id)";
294
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
295
-        $table_name = 'esp_event_message_template';
296
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
294
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
295
+		$table_name = 'esp_event_message_template';
296
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
297 297
 					EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
298 298
 					GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
299 299
 					PRIMARY KEY  (EMT_ID),
300 300
 					KEY EVT_ID (EVT_ID),
301 301
 					KEY GRP_ID (GRP_ID)";
302
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
303
-        $table_name = 'esp_payment';
304
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
302
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
303
+		$table_name = 'esp_payment';
304
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
305 305
 					TXN_ID int(10) unsigned DEFAULT NULL,
306 306
 					STS_ID varchar(3) collate utf8_bin DEFAULT NULL,
307 307
 					PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 					PRIMARY KEY  (PAY_ID),
319 319
 					KEY PAY_timestamp (PAY_timestamp),
320 320
 					KEY TXN_ID (TXN_ID)";
321
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
322
-        $table_name = 'esp_payment_method';
323
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
321
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
322
+		$table_name = 'esp_payment_method';
323
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
324 324
 				PMD_type varchar(124) DEFAULT NULL,
325 325
 				PMD_name varchar(255) DEFAULT NULL,
326 326
 				PMD_desc text,
@@ -336,32 +336,32 @@  discard block
 block discarded – undo
336 336
 				PRIMARY KEY  (PMD_ID),
337 337
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
338 338
 				KEY PMD_type (PMD_type)";
339
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
340
-        $table_name = "esp_ticket_price";
341
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
339
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
340
+		$table_name = "esp_ticket_price";
341
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
342 342
 					  TKT_ID int(10) unsigned NOT NULL,
343 343
 					  PRC_ID int(10) unsigned NOT NULL,
344 344
 					  PRIMARY KEY  (TKP_ID),
345 345
 					  KEY TKT_ID (TKT_ID),
346 346
 					  KEY PRC_ID (PRC_ID)";
347
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
348
-        $table_name = "esp_datetime_ticket";
349
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
347
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
348
+		$table_name = "esp_datetime_ticket";
349
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
350 350
 					  DTT_ID int(10) unsigned NOT NULL,
351 351
 					  TKT_ID int(10) unsigned NOT NULL,
352 352
 					  PRIMARY KEY  (DTK_ID),
353 353
 					  KEY DTT_ID (DTT_ID),
354 354
 					  KEY TKT_ID (TKT_ID)";
355
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
356
-        $table_name = "esp_ticket_template";
357
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
355
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
356
+		$table_name = "esp_ticket_template";
357
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
358 358
 					  TTM_name varchar(45) NOT NULL,
359 359
 					  TTM_description text,
360 360
 					  TTM_file varchar(45),
361 361
 					  PRIMARY KEY  (TTM_ID)";
362
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
363
-        $table_name = 'esp_question';
364
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
362
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
363
+		$table_name = 'esp_question';
364
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
365 365
 					QST_display_text text NOT NULL,
366 366
 					QST_admin_label varchar(255) NOT NULL,
367 367
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -375,18 +375,18 @@  discard block
 block discarded – undo
375 375
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
376 376
 					PRIMARY KEY  (QST_ID),
377 377
 					KEY QST_order (QST_order)';
378
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
379
-        $table_name = 'esp_question_group_question';
380
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
378
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
379
+		$table_name = 'esp_question_group_question';
380
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
381 381
 					QSG_ID int(10) unsigned NOT NULL,
382 382
 					QST_ID int(10) unsigned NOT NULL,
383 383
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
384 384
 					PRIMARY KEY  (QGQ_ID),
385 385
 					KEY QST_ID (QST_ID),
386 386
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
387
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
388
-        $table_name = 'esp_question_option';
389
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
387
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
388
+		$table_name = 'esp_question_option';
389
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
390 390
 					QSO_value varchar(255) NOT NULL,
391 391
 					QSO_desc text NOT NULL,
392 392
 					QST_ID int(10) unsigned NOT NULL,
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 					PRIMARY KEY  (QSO_ID),
397 397
 					KEY QST_ID (QST_ID),
398 398
 					KEY QSO_order (QSO_order)";
399
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
400
-        $table_name = 'esp_registration';
401
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
399
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
400
+		$table_name = 'esp_registration';
401
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
402 402
 					  EVT_ID bigint(20) unsigned NOT NULL,
403 403
 					  ATT_ID bigint(20) unsigned NOT NULL,
404 404
 					  TXN_ID int(10) unsigned NOT NULL,
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 					  KEY TKT_ID (TKT_ID),
423 423
 					  KEY EVT_ID (EVT_ID),
424 424
 					  KEY STS_ID (STS_ID)";
425
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
426
-        $table_name = 'esp_registration_payment';
427
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
425
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
426
+		$table_name = 'esp_registration_payment';
427
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
428 428
 					  REG_ID int(10) unsigned NOT NULL,
429 429
 					  PAY_ID int(10) unsigned NULL,
430 430
 					  RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00',
431 431
 					  PRIMARY KEY  (RPY_ID),
432 432
 					  KEY REG_ID (REG_ID),
433 433
 					  KEY PAY_ID (PAY_ID)";
434
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
435
-        $table_name = 'esp_checkin';
436
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
434
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
435
+		$table_name = 'esp_checkin';
436
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
437 437
 					REG_ID int(10) unsigned NOT NULL,
438 438
 					DTT_ID int(10) unsigned NOT NULL,
439 439
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 					PRIMARY KEY  (CHK_ID),
442 442
 					KEY REG_ID (REG_ID),
443 443
 					KEY DTT_ID (DTT_ID)";
444
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
-        $table_name = 'esp_state';
446
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
444
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
+		$table_name = 'esp_state';
446
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
447 447
 					  CNT_ISO varchar(2) collate utf8_bin NOT NULL,
448 448
 					  STA_abbrev varchar(24) collate utf8_bin NOT NULL,
449 449
 					  STA_name varchar(100) collate utf8_bin NOT NULL,
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 					  PRIMARY KEY  (STA_ID),
452 452
 					  KEY STA_abbrev (STA_abbrev),
453 453
 					  KEY CNT_ISO (CNT_ISO)";
454
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
-        $table_name = 'esp_status';
456
-        $sql = "STS_ID varchar(3) NOT NULL,
454
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
+		$table_name = 'esp_status';
456
+		$sql = "STS_ID varchar(3) NOT NULL,
457 457
 					  STS_code varchar(45) NOT NULL,
458 458
 					  STS_type varchar(45) NOT NULL,
459 459
 					  STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 					  STS_open tinyint(1) NOT NULL DEFAULT 1,
462 462
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
463 463
 					  KEY STS_type (STS_type)";
464
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
465
-        $table_name = 'esp_transaction';
466
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
464
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
465
+		$table_name = 'esp_transaction';
466
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
467 467
 					  TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
468 468
 					  TXN_total decimal(10,3) DEFAULT '0.00',
469 469
 					  TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -475,9 +475,9 @@  discard block
 block discarded – undo
475 475
 					  PRIMARY KEY  (TXN_ID),
476 476
 					  KEY TXN_timestamp (TXN_timestamp),
477 477
 					  KEY STS_ID (STS_ID)";
478
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
479
-        $table_name = 'esp_venue_meta';
480
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
478
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
479
+		$table_name = 'esp_venue_meta';
480
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
481 481
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
482 482
 			VNU_address varchar(255) DEFAULT NULL,
483 483
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 			KEY VNU_ID (VNU_ID),
497 497
 			KEY STA_ID (STA_ID),
498 498
 			KEY CNT_ISO (CNT_ISO)";
499
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
500
-        //modified tables
501
-        $table_name = "esp_price";
502
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
499
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
500
+		//modified tables
501
+		$table_name = "esp_price";
502
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
503 503
 					  PRT_ID tinyint(3) unsigned NOT NULL,
504 504
 					  PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
505 505
 					  PRC_name varchar(245) NOT NULL,
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 					  PRC_parent int(10) unsigned DEFAULT 0,
513 513
 					  PRIMARY KEY  (PRC_ID),
514 514
 					  KEY PRT_ID (PRT_ID)";
515
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
516
-        $table_name = "esp_price_type";
517
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
515
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
516
+		$table_name = "esp_price_type";
517
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
518 518
 				  PRT_name varchar(45) NOT NULL,
519 519
 				  PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
520 520
 				  PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 				  PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
524 524
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
525 525
 				  PRIMARY KEY  (PRT_ID)";
526
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
527
-        $table_name = "esp_ticket";
528
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
526
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
527
+		$table_name = "esp_ticket";
528
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
529 529
 					  TTM_ID int(10) unsigned NOT NULL,
530 530
 					  TKT_name varchar(245) NOT NULL DEFAULT '',
531 531
 					  TKT_description text NOT NULL,
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
548 548
 					  PRIMARY KEY  (TKT_ID),
549 549
 					  KEY TKT_start_date (TKT_start_date)";
550
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
551
-        $table_name = 'esp_question_group';
552
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
550
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
551
+		$table_name = 'esp_question_group';
552
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
553 553
 					QSG_name varchar(255) NOT NULL,
554 554
 					QSG_identifier varchar(100) NOT NULL,
555 555
 					QSG_desc text NULL,
@@ -562,221 +562,221 @@  discard block
 block discarded – undo
562 562
 					PRIMARY KEY  (QSG_ID),
563 563
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
564 564
 					KEY QSG_order (QSG_order)';
565
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
566
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
567
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
568
-        //(because many need to convert old string states to foreign keys into the states table)
569
-        $script_4_1_defaults->insert_default_states();
570
-        $script_4_1_defaults->insert_default_countries();
571
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
572
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
573
-        $script_4_5_defaults->insert_default_price_types();
574
-        $script_4_5_defaults->insert_default_prices();
575
-        $script_4_5_defaults->insert_default_tickets();
576
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
577
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
578
-        $script_4_6_defaults->add_default_admin_only_payments();
579
-        $script_4_6_defaults->insert_default_currencies();
580
-        $this->verify_new_countries();
581
-        $this->verify_new_currencies();
582
-        return true;
583
-    }
565
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
566
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
567
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
568
+		//(because many need to convert old string states to foreign keys into the states table)
569
+		$script_4_1_defaults->insert_default_states();
570
+		$script_4_1_defaults->insert_default_countries();
571
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
572
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
573
+		$script_4_5_defaults->insert_default_price_types();
574
+		$script_4_5_defaults->insert_default_prices();
575
+		$script_4_5_defaults->insert_default_tickets();
576
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
577
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
578
+		$script_4_6_defaults->add_default_admin_only_payments();
579
+		$script_4_6_defaults->insert_default_currencies();
580
+		$this->verify_new_countries();
581
+		$this->verify_new_currencies();
582
+		return true;
583
+	}
584 584
 
585 585
 
586 586
 
587
-    /**
588
-     * @return boolean
589
-     */
590
-    public function schema_changes_after_migration()
591
-    {
592
-        $this->fix_non_default_taxes();
593
-        //this is actually the same as the last DMS
594
-        /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
595
-        $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
596
-        return $script_4_7_defaults->schema_changes_after_migration();
597
-    }
587
+	/**
588
+	 * @return boolean
589
+	 */
590
+	public function schema_changes_after_migration()
591
+	{
592
+		$this->fix_non_default_taxes();
593
+		//this is actually the same as the last DMS
594
+		/** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
595
+		$script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
596
+		return $script_4_7_defaults->schema_changes_after_migration();
597
+	}
598 598
 
599 599
 
600 600
 
601
-    public function migration_page_hooks()
602
-    {
603
-    }
601
+	public function migration_page_hooks()
602
+	{
603
+	}
604 604
 
605 605
 
606 606
 
607
-    /**
608
-     * verifies each of the new countries exists that somehow we missed in 4.1
609
-     */
610
-    public function verify_new_countries()
611
-    {
612
-        //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
613
-        //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
614
-        //currency symbols: http://www.xe.com/symbols.php
615
-        //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
616
-        //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
617
-        $newer_countries = array(
618
-            array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
619
-            array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
620
-            array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
621
-            array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
622
-            array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
623
-            array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
624
-            array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
625
-            array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
626
-            array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
627
-            array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
628
-            array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
629
-            array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
630
-            array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
631
-            array(
632
-                'BQ',
633
-                'BES',
634
-                0,
635
-                'Bonaire, Saint Eustatius and Saba',
636
-                'USD',
637
-                'Dollar',
638
-                'Dollars',
639
-                '$',
640
-                1,
641
-                2,
642
-                '+599',
643
-                0,
644
-                0,
645
-            ),
646
-            array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
647
-            array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
648
-            array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
649
-            array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
650
-            array(
651
-                'HM',
652
-                'HMD',
653
-                0,
654
-                'Heard Island and McDonald Islands',
655
-                'AUD',
656
-                'Dollar',
657
-                'Dollars',
658
-                '$',
659
-                1,
660
-                2,
661
-                '+891',
662
-                0,
663
-                0,
664
-            ),
665
-            array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
666
-            array(
667
-                'GS',
668
-                'SGS',
669
-                0,
670
-                'South Georgia and the South Sandwich Islands',
671
-                'GBP',
672
-                'Pound',
673
-                'Pounds',
674
-                '£',
675
-                1,
676
-                2,
677
-                '+500',
678
-                0,
679
-                0,
680
-            ),
681
-            array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
682
-            array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
683
-            array(
684
-                'UM',
685
-                'UMI',
686
-                0,
687
-                'United States Minor Outlying Islands',
688
-                'USD',
689
-                'Dollar',
690
-                'Dollars',
691
-                '$',
692
-                1,
693
-                2,
694
-                '+1',
695
-                0,
696
-                0,
697
-            ),
698
-        );
699
-        global $wpdb;
700
-        $country_table = $wpdb->prefix . "esp_country";
701
-        $country_format = array(
702
-            "CNT_ISO"         => '%s',
703
-            "CNT_ISO3"        => '%s',
704
-            "RGN_ID"          => '%d',
705
-            "CNT_name"        => '%s',
706
-            "CNT_cur_code"    => '%s',
707
-            "CNT_cur_single"  => '%s',
708
-            "CNT_cur_plural"  => '%s',
709
-            "CNT_cur_sign"    => '%s',
710
-            "CNT_cur_sign_b4" => '%d',
711
-            "CNT_cur_dec_plc" => '%d',
712
-            "CNT_tel_code"    => '%s',
713
-            "CNT_is_EU"       => '%d',
714
-            "CNT_active"      => '%d',
715
-        );
716
-        if ($this->_get_table_analysis()->tableExists($country_table)) {
717
-            foreach ($newer_countries as $country) {
718
-                $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
719
-                $countries = $wpdb->get_var($SQL);
720
-                if ( ! $countries) {
721
-                    $wpdb->insert($country_table,
722
-                        array_combine(array_keys($country_format), $country),
723
-                        $country_format
724
-                    );
725
-                }
726
-            }
727
-        }
728
-    }
607
+	/**
608
+	 * verifies each of the new countries exists that somehow we missed in 4.1
609
+	 */
610
+	public function verify_new_countries()
611
+	{
612
+		//a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
613
+		//how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
614
+		//currency symbols: http://www.xe.com/symbols.php
615
+		//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
616
+		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
617
+		$newer_countries = array(
618
+			array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
619
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
620
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
621
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
622
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
623
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
624
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
625
+			array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
626
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
627
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
628
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
629
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
630
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
631
+			array(
632
+				'BQ',
633
+				'BES',
634
+				0,
635
+				'Bonaire, Saint Eustatius and Saba',
636
+				'USD',
637
+				'Dollar',
638
+				'Dollars',
639
+				'$',
640
+				1,
641
+				2,
642
+				'+599',
643
+				0,
644
+				0,
645
+			),
646
+			array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
647
+			array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
648
+			array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
649
+			array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
650
+			array(
651
+				'HM',
652
+				'HMD',
653
+				0,
654
+				'Heard Island and McDonald Islands',
655
+				'AUD',
656
+				'Dollar',
657
+				'Dollars',
658
+				'$',
659
+				1,
660
+				2,
661
+				'+891',
662
+				0,
663
+				0,
664
+			),
665
+			array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
666
+			array(
667
+				'GS',
668
+				'SGS',
669
+				0,
670
+				'South Georgia and the South Sandwich Islands',
671
+				'GBP',
672
+				'Pound',
673
+				'Pounds',
674
+				'£',
675
+				1,
676
+				2,
677
+				'+500',
678
+				0,
679
+				0,
680
+			),
681
+			array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
682
+			array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
683
+			array(
684
+				'UM',
685
+				'UMI',
686
+				0,
687
+				'United States Minor Outlying Islands',
688
+				'USD',
689
+				'Dollar',
690
+				'Dollars',
691
+				'$',
692
+				1,
693
+				2,
694
+				'+1',
695
+				0,
696
+				0,
697
+			),
698
+		);
699
+		global $wpdb;
700
+		$country_table = $wpdb->prefix . "esp_country";
701
+		$country_format = array(
702
+			"CNT_ISO"         => '%s',
703
+			"CNT_ISO3"        => '%s',
704
+			"RGN_ID"          => '%d',
705
+			"CNT_name"        => '%s',
706
+			"CNT_cur_code"    => '%s',
707
+			"CNT_cur_single"  => '%s',
708
+			"CNT_cur_plural"  => '%s',
709
+			"CNT_cur_sign"    => '%s',
710
+			"CNT_cur_sign_b4" => '%d',
711
+			"CNT_cur_dec_plc" => '%d',
712
+			"CNT_tel_code"    => '%s',
713
+			"CNT_is_EU"       => '%d',
714
+			"CNT_active"      => '%d',
715
+		);
716
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
717
+			foreach ($newer_countries as $country) {
718
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
719
+				$countries = $wpdb->get_var($SQL);
720
+				if ( ! $countries) {
721
+					$wpdb->insert($country_table,
722
+						array_combine(array_keys($country_format), $country),
723
+						$country_format
724
+					);
725
+				}
726
+			}
727
+		}
728
+	}
729 729
 
730 730
 
731 731
 
732
-    /**
733
-     * verifies each of the new currencies exists that somehow we missed in 4.6
734
-     */
735
-    public function verify_new_currencies()
736
-    {
737
-        //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
738
-        //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
739
-        //currency symbols: http://www.xe.com/symbols.php
740
-        // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
741
-        //( 'EUR',  'Euro',  'Euros',  '€',  2,1),
742
-        $newer_currencies = array(
743
-            array('RSD', 'Dinar', 'Dinars', '', 3, 1),
744
-        );
745
-        global $wpdb;
746
-        $currency_table = $wpdb->prefix . "esp_currency";
747
-        $currency_format = array(
748
-            "CUR_code"    => '%s',
749
-            "CUR_single"  => '%s',
750
-            "CUR_plural"  => '%s',
751
-            "CUR_sign"    => '%s',
752
-            "CUR_dec_plc" => '%d',
753
-            "CUR_active"  => '%d',
754
-        );
755
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
756
-            foreach ($newer_currencies as $currency) {
757
-                $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
758
-                $countries = $wpdb->get_var($SQL);
759
-                if ( ! $countries) {
760
-                    $wpdb->insert($currency_table,
761
-                        array_combine(array_keys($currency_format), $currency),
762
-                        $currency_format
763
-                    );
764
-                }
765
-            }
766
-        }
767
-    }
732
+	/**
733
+	 * verifies each of the new currencies exists that somehow we missed in 4.6
734
+	 */
735
+	public function verify_new_currencies()
736
+	{
737
+		//a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
738
+		//how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
739
+		//currency symbols: http://www.xe.com/symbols.php
740
+		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
741
+		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
742
+		$newer_currencies = array(
743
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
744
+		);
745
+		global $wpdb;
746
+		$currency_table = $wpdb->prefix . "esp_currency";
747
+		$currency_format = array(
748
+			"CUR_code"    => '%s',
749
+			"CUR_single"  => '%s',
750
+			"CUR_plural"  => '%s',
751
+			"CUR_sign"    => '%s',
752
+			"CUR_dec_plc" => '%d',
753
+			"CUR_active"  => '%d',
754
+		);
755
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
756
+			foreach ($newer_currencies as $currency) {
757
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
758
+				$countries = $wpdb->get_var($SQL);
759
+				if ( ! $countries) {
760
+					$wpdb->insert($currency_table,
761
+						array_combine(array_keys($currency_format), $currency),
762
+						$currency_format
763
+					);
764
+				}
765
+			}
766
+		}
767
+	}
768 768
 
769 769
 
770 770
 
771
-    /**
772
-     * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
773
-     * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
774
-     * we should be able to stop doing this in 4.9
775
-     */
776
-    public function fix_non_default_taxes()
777
-    {
778
-        global $wpdb;
779
-        $query = $wpdb->prepare("UPDATE
771
+	/**
772
+	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
773
+	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
774
+	 * we should be able to stop doing this in 4.9
775
+	 */
776
+	public function fix_non_default_taxes()
777
+	{
778
+		global $wpdb;
779
+		$query = $wpdb->prepare("UPDATE
780 780
 				{$wpdb->prefix}esp_price p INNER JOIN
781 781
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
782 782
 			SET
@@ -785,6 +785,6 @@  discard block
 block discarded – undo
785 785
 				p.PRC_is_default = 0 AND
786 786
 				pt.PBT_ID = %d
787 787
 					", EEM_Price_Type::base_type_tax);
788
-        $wpdb->query($query);
789
-    }
788
+		$wpdb->query($query);
789
+	}
790 790
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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',
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 2 patches
Indentation   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
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,66 +31,66 @@  discard block
 block discarded – undo
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 Migration to Event Espresso 4.5.0.P", "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 Migration to Event Espresso 4.5.0.P", "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 pretty_name()
75
-    {
76
-        return __("Core Data Migration to version 4.5.0", "event_espresso");
77
-    }
74
+	public function pretty_name()
75
+	{
76
+		return __("Core Data Migration to version 4.5.0", "event_espresso");
77
+	}
78 78
 
79 79
 
80 80
 
81
-    public function schema_changes_before_migration()
82
-    {
83
-        //relies on 4.1's EEH_Activation::create_table
84
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
-        $table_name = 'esp_answer';
86
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
81
+	public function schema_changes_before_migration()
82
+	{
83
+		//relies on 4.1's EEH_Activation::create_table
84
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
+		$table_name = 'esp_answer';
86
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
87 87
 					REG_ID INT UNSIGNED NOT NULL,
88 88
 					QST_ID INT UNSIGNED NOT NULL,
89 89
 					ANS_value TEXT NOT NULL,
90 90
 					PRIMARY KEY  (ANS_ID)";
91
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
92
-        $table_name = 'esp_attendee_meta';
93
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
91
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
92
+		$table_name = 'esp_attendee_meta';
93
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
94 94
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
95 95
 						ATT_fname VARCHAR(45) NOT NULL,
96 96
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 								KEY ATT_fname (ATT_fname),
107 107
 								KEY ATT_lname (ATT_lname),
108 108
 								KEY ATT_email (ATT_email)";
109
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
110
-        $table_name = 'esp_country';
111
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
109
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
110
+		$table_name = 'esp_country';
111
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
112 112
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
113 113
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
114 114
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
125 125
 					  CNT_active TINYINT(1) DEFAULT '0',
126 126
 					  PRIMARY KEY  (CNT_ISO)";
127
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
128
-        $table_name = 'esp_datetime';
129
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
127
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
128
+		$table_name = 'esp_datetime';
129
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
130 130
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
131 131
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
132 132
 				  DTT_description TEXT NOT NULL,
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 						PRIMARY KEY  (DTT_ID),
142 142
 						KEY EVT_ID (EVT_ID),
143 143
 						KEY DTT_is_primary (DTT_is_primary)";
144
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
145
-        $table_name = 'esp_event_meta';
146
-        $sql = "
144
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
145
+		$table_name = 'esp_event_meta';
146
+		$sql = "
147 147
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
148 148
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
149 149
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -158,31 +158,31 @@  discard block
 block discarded – undo
158 158
 			EVT_external_URL VARCHAR(200) NULL,
159 159
 			EVT_donations TINYINT(1) NULL,
160 160
 			PRIMARY KEY  (EVTM_ID)";
161
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
-        $table_name = 'esp_event_question_group';
163
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
161
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
+		$table_name = 'esp_event_question_group';
163
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
164 164
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
165 165
 					QSG_ID INT UNSIGNED NOT NULL,
166 166
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
167 167
 					PRIMARY KEY  (EQG_ID)";
168
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
-        $table_name = 'esp_event_venue';
170
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
+		$table_name = 'esp_event_venue';
170
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
171 171
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
173 173
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
174 174
 				PRIMARY KEY  (EVV_ID)";
175
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
176
-        $table_name = 'esp_extra_meta';
177
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
175
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
176
+		$table_name = 'esp_extra_meta';
177
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
178 178
 				OBJ_ID INT(11) DEFAULT NULL,
179 179
 				EXM_type VARCHAR(45) DEFAULT NULL,
180 180
 				EXM_key VARCHAR(45) DEFAULT NULL,
181 181
 				EXM_value TEXT,
182 182
 				PRIMARY KEY  (EXM_ID)";
183
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184
-        $table_name = 'esp_line_item';
185
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
183
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184
+		$table_name = 'esp_line_item';
185
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
186 186
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
187 187
 				TXN_ID INT(11) DEFAULT NULL,
188 188
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -198,19 +198,19 @@  discard block
 block discarded – undo
198 198
 				OBJ_ID INT(11) DEFAULT NULL,
199 199
 				OBJ_type VARCHAR(45)DEFAULT NULL,
200 200
 				PRIMARY KEY  (LIN_ID)";
201
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
202
-        $table_name = 'esp_message_template';
203
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
201
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
202
+		$table_name = 'esp_message_template';
203
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
204 204
 					GRP_ID INT(10) UNSIGNED NOT NULL,
205 205
 					MTP_context VARCHAR(50) NOT NULL,
206 206
 					MTP_template_field VARCHAR(30) NOT NULL,
207 207
 					MTP_content TEXT NOT NULL,
208 208
 					PRIMARY KEY  (MTP_ID),
209 209
 					KEY GRP_ID (GRP_ID)";
210
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
211
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
212
-        $table_name = 'esp_message_template_group';
213
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
210
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
211
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
212
+		$table_name = 'esp_message_template_group';
213
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
214 214
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
215 215
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
216 216
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
223 223
 					PRIMARY KEY  (GRP_ID),
224 224
 					KEY MTP_user_id (MTP_user_id)";
225
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
226
-        $table_name = 'esp_event_message_template';
227
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
225
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
226
+		$table_name = 'esp_event_message_template';
227
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
228 228
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
229 229
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
230 230
 					PRIMARY KEY  (EMT_ID),
231 231
 					KEY EVT_ID (EVT_ID),
232 232
 					KEY GRP_ID (GRP_ID)";
233
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
234
-        $table_name = 'esp_payment';
235
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
233
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
234
+		$table_name = 'esp_payment';
235
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
236 236
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
237 237
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
238 238
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -248,28 +248,28 @@  discard block
 block discarded – undo
248 248
 					PRIMARY KEY  (PAY_ID),
249 249
 					KEY TXN_ID (TXN_ID),
250 250
 					KEY PAY_timestamp (PAY_timestamp)";
251
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
252
-        $table_name = "esp_ticket_price";
253
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
251
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
252
+		$table_name = "esp_ticket_price";
253
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
254 254
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
255 255
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
256 256
 					  PRIMARY KEY  (TKP_ID)";
257
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
258
-        $table_name = "esp_datetime_ticket";
259
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
257
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
258
+		$table_name = "esp_datetime_ticket";
259
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
260 260
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
261 261
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
262 262
 					  PRIMARY KEY  (DTK_ID)";
263
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = "esp_ticket_template";
265
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
263
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = "esp_ticket_template";
265
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
266 266
 					  TTM_name VARCHAR(45) NOT NULL,
267 267
 					  TTM_description TEXT,
268 268
 					  TTM_file VARCHAR(45),
269 269
 					  PRIMARY KEY  (TTM_ID)";
270
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
271
-        $table_name = 'esp_question';
272
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
270
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
271
+		$table_name = 'esp_question';
272
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
273 273
 					QST_display_text TEXT NOT NULL,
274 274
 					QST_admin_label VARCHAR(255) NOT NULL,
275 275
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -281,25 +281,25 @@  discard block
 block discarded – undo
281 281
 					QST_wp_user BIGINT UNSIGNED NULL,
282 282
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
283 283
 					PRIMARY KEY  (QST_ID)';
284
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_question_group_question';
286
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
284
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_question_group_question';
286
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
287 287
 					QSG_ID INT UNSIGNED NOT NULL,
288 288
 					QST_ID INT UNSIGNED NOT NULL,
289 289
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
290 290
 					PRIMARY KEY  (QGQ_ID) ";
291
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
292
-        $table_name = 'esp_question_option';
293
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
291
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
292
+		$table_name = 'esp_question_option';
293
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
294 294
 					QSO_value VARCHAR(255) NOT NULL,
295 295
 					QSO_desc TEXT NOT NULL,
296 296
 					QST_ID INT UNSIGNED NOT NULL,
297 297
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
298 298
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
299 299
 					PRIMARY KEY  (QSO_ID)";
300
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
301
-        $table_name = 'esp_registration';
302
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
300
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
301
+		$table_name = 'esp_registration';
302
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
303 303
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
304 304
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
305 305
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
 					  KEY STS_ID (STS_ID),
323 323
 					  KEY REG_url_link (REG_url_link),
324 324
 					  KEY REG_code (REG_code)";
325
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
326
-        $table_name = 'esp_checkin';
327
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
325
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
326
+		$table_name = 'esp_checkin';
327
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
328 328
 					REG_ID INT(10) UNSIGNED NOT NULL,
329 329
 					DTT_ID INT(10) UNSIGNED NOT NULL,
330 330
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
331 331
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
332 332
 					PRIMARY KEY  (CHK_ID)";
333
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
334
-        $table_name = 'esp_state';
335
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
333
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
334
+		$table_name = 'esp_state';
335
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
336 336
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
337 337
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
338 338
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
339 339
 					  STA_active TINYINT(1) DEFAULT '1',
340 340
 					  PRIMARY KEY  (STA_ID)";
341
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
-        $table_name = 'esp_status';
343
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
341
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_status';
343
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
344 344
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
345 345
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
346 346
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
349 349
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
350 350
 					  KEY STS_type (STS_type)";
351
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352
-        $table_name = 'esp_transaction';
353
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
351
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352
+		$table_name = 'esp_transaction';
353
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
354 354
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
355 355
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
356 356
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 					  PRIMARY KEY  (TXN_ID),
362 362
 					  KEY TXN_timestamp (TXN_timestamp),
363 363
 					  KEY STS_ID (STS_ID)";
364
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
365
-        $table_name = 'esp_venue_meta';
366
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
364
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
365
+		$table_name = 'esp_venue_meta';
366
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
367 367
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
368 368
 			VNU_address VARCHAR(255) DEFAULT NULL,
369 369
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 			PRIMARY KEY  (VNUM_ID),
382 382
 			KEY STA_ID (STA_ID),
383 383
 			KEY CNT_ISO (CNT_ISO)";
384
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
385
-        //modified tables
386
-        $table_name = "esp_price";
387
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
384
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
385
+		//modified tables
386
+		$table_name = "esp_price";
387
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
388 388
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
389 389
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
390 390
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 					  PRC_wp_user BIGINT UNSIGNED NULL,
397 397
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
398 398
 					  PRIMARY KEY  (PRC_ID)";
399
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
400
-        $table_name = "esp_price_type";
401
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
399
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
400
+		$table_name = "esp_price_type";
401
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
402 402
 				  PRT_name VARCHAR(45) NOT NULL,
403 403
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
404 404
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
408 408
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
409 409
 				  PRIMARY KEY  (PRT_ID)";
410
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
411
-        $table_name = "esp_ticket";
412
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
410
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
411
+		$table_name = "esp_ticket";
412
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
413 413
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
414 414
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
415 415
 					  TKT_description TEXT NOT NULL,
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
431 431
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
432 432
 					  PRIMARY KEY  (TKT_ID)";
433
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
434
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
435
-        $table_name = 'esp_question_group';
436
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
433
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
434
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
435
+		$table_name = 'esp_question_group';
436
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
437 437
 					QSG_name VARCHAR(255) NOT NULL,
438 438
 					QSG_identifier VARCHAR(100) NOT NULL,
439 439
 					QSG_desc TEXT NULL,
@@ -445,135 +445,135 @@  discard block
 block discarded – undo
445 445
 					QSG_wp_user BIGINT UNSIGNED NULL,
446 446
 					PRIMARY KEY  (QSG_ID),
447 447
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
448
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
449
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
450
-        //(because many need to convert old string states to foreign keys into the states table)
451
-        $script_4_1_defaults->insert_default_states();
452
-        $script_4_1_defaults->insert_default_countries();
453
-        //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
454
-        $this->insert_default_price_types();
455
-        $this->insert_default_prices();
456
-        $this->insert_default_tickets();
457
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
458
-        EE_Config::instance()->update_espresso_config(false, true);
459
-        return true;
460
-    }
461
-
462
-
463
-
464
-    /**
465
-     * @return boolean
466
-     */
467
-    public function schema_changes_after_migration()
468
-    {
469
-        return true;
470
-    }
471
-
472
-
473
-
474
-    public function migration_page_hooks()
475
-    {
476
-    }
477
-
478
-
479
-
480
-    /**
481
-     * insert_default_price_types
482
-     *
483
-     * @since 4.5.0
484
-     * @return void
485
-     */
486
-    public function insert_default_price_types()
487
-    {
488
-        global $wpdb;
489
-        $price_type_table = $wpdb->prefix . "esp_price_type";
490
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
491
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
492
-            $price_types_exist = $wpdb->get_var($SQL);
493
-            if ( ! $price_types_exist) {
494
-                $user_id = EEH_Activation::get_default_creator_id();
495
-                $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
448
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
449
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
450
+		//(because many need to convert old string states to foreign keys into the states table)
451
+		$script_4_1_defaults->insert_default_states();
452
+		$script_4_1_defaults->insert_default_countries();
453
+		//schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
454
+		$this->insert_default_price_types();
455
+		$this->insert_default_prices();
456
+		$this->insert_default_tickets();
457
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
458
+		EE_Config::instance()->update_espresso_config(false, true);
459
+		return true;
460
+	}
461
+
462
+
463
+
464
+	/**
465
+	 * @return boolean
466
+	 */
467
+	public function schema_changes_after_migration()
468
+	{
469
+		return true;
470
+	}
471
+
472
+
473
+
474
+	public function migration_page_hooks()
475
+	{
476
+	}
477
+
478
+
479
+
480
+	/**
481
+	 * insert_default_price_types
482
+	 *
483
+	 * @since 4.5.0
484
+	 * @return void
485
+	 */
486
+	public function insert_default_price_types()
487
+	{
488
+		global $wpdb;
489
+		$price_type_table = $wpdb->prefix . "esp_price_type";
490
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
491
+			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
492
+			$price_types_exist = $wpdb->get_var($SQL);
493
+			if ( ! $price_types_exist) {
494
+				$user_id = EEH_Activation::get_default_creator_id();
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 496
 							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
497 497
 							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
498 498
 							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
499 499
 							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
500 500
 							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
501
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
502
-                $wpdb->query($SQL);
503
-            }
504
-        }
505
-    }
506
-
507
-
508
-
509
-    /**
510
-     * insert DEFAULT prices.
511
-     *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
512
-     * when EEH_Activaion's initialize_db_content is called via  ahook in
513
-     * EE_Brewing_regular
514
-     *
515
-     * @since 4.5.0
516
-     * @return void
517
-     */
518
-    public function insert_default_prices()
519
-    {
520
-        global $wpdb;
521
-        $price_table = $wpdb->prefix . "esp_price";
522
-        if ($this->_get_table_analysis()->tableExists($price_table)) {
523
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
524
-            $prices_exist = $wpdb->get_var($SQL);
525
-            if ( ! $prices_exist) {
526
-                $user_id = EEH_Activation::get_default_creator_id();
527
-                $SQL = "INSERT INTO $price_table
501
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
502
+				$wpdb->query($SQL);
503
+			}
504
+		}
505
+	}
506
+
507
+
508
+
509
+	/**
510
+	 * insert DEFAULT prices.
511
+	 *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
512
+	 * when EEH_Activaion's initialize_db_content is called via  ahook in
513
+	 * EE_Brewing_regular
514
+	 *
515
+	 * @since 4.5.0
516
+	 * @return void
517
+	 */
518
+	public function insert_default_prices()
519
+	{
520
+		global $wpdb;
521
+		$price_table = $wpdb->prefix . "esp_price";
522
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
523
+			$SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
524
+			$prices_exist = $wpdb->get_var($SQL);
525
+			if ( ! $prices_exist) {
526
+				$user_id = EEH_Activation::get_default_creator_id();
527
+				$SQL = "INSERT INTO $price_table
528 528
 							(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
529 529
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
530
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
531
-                $wpdb->query($SQL);
532
-            }
533
-        }
534
-    }
535
-
536
-
537
-
538
-    /**
539
-     * insert DEFAULT ticket
540
-     * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
541
-     *
542
-     * @since 4.5.0
543
-     * @return void
544
-     */
545
-    public function insert_default_tickets()
546
-    {
547
-        global $wpdb;
548
-        $ticket_table = $wpdb->prefix . "esp_ticket";
549
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
550
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
551
-            $tickets_exist = $wpdb->get_var($SQL);
552
-            if ( ! $tickets_exist) {
553
-                $user_id = EEH_Activation::get_default_creator_id();
554
-                $SQL = "INSERT INTO $ticket_table
530
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
531
+				$wpdb->query($SQL);
532
+			}
533
+		}
534
+	}
535
+
536
+
537
+
538
+	/**
539
+	 * insert DEFAULT ticket
540
+	 * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
541
+	 *
542
+	 * @since 4.5.0
543
+	 * @return void
544
+	 */
545
+	public function insert_default_tickets()
546
+	{
547
+		global $wpdb;
548
+		$ticket_table = $wpdb->prefix . "esp_ticket";
549
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
550
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
551
+			$tickets_exist = $wpdb->get_var($SQL);
552
+			if ( ! $tickets_exist) {
553
+				$user_id = EEH_Activation::get_default_creator_id();
554
+				$SQL = "INSERT INTO $ticket_table
555 555
 					( 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
556 556
 					( 1, 0, '"
557
-                       . __("Free Ticket", "event_espresso")
558
-                       . "', '', 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);";
559
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
560
-                $wpdb->query($SQL);
561
-            }
562
-        }
563
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
564
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
565
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
566
-            $ticket_prc_exist = $wpdb->get_var($SQL);
567
-            if ( ! $ticket_prc_exist) {
568
-                $SQL = "INSERT INTO $ticket_price_table
557
+					   . __("Free Ticket", "event_espresso")
558
+					   . "', '', 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);";
559
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
560
+				$wpdb->query($SQL);
561
+			}
562
+		}
563
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
564
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
565
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
566
+			$ticket_prc_exist = $wpdb->get_var($SQL);
567
+			if ( ! $ticket_prc_exist) {
568
+				$SQL = "INSERT INTO $ticket_price_table
569 569
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
570 570
 				( 1, 1, 1 )
571 571
 				";
572
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
573
-                $wpdb->query($SQL);
574
-            }
575
-        }
576
-    }
572
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
573
+				$wpdb->query($SQL);
574
+			}
575
+		}
576
+	}
577 577
 
578 578
 }
579 579
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 2 patches
Indentation   +188 added lines, -189 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,82 +38,82 @@  discard block
 block discarded – undo
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 Migration to Event Espresso 4.7.0.p", "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 Migration to Event Espresso 4.7.0.p", "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 string|void
92
-     */
93
-    public function pretty_name()
94
-    {
95
-        return __("Core Data Migration to version 4.7.0", "event_espresso");
96
-    }
89
+	/**
90
+	 * @return string|void
91
+	 */
92
+	public function pretty_name()
93
+	{
94
+		return __("Core Data Migration to version 4.7.0", "event_espresso");
95
+	}
97 96
 
98 97
 
99 98
 
100
-    /**
101
-     * @return bool
102
-     */
103
-    public function schema_changes_before_migration()
104
-    {
105
-        //relies on 4.1's EEH_Activation::create_table
106
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
107
-        $table_name = 'esp_answer';
108
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
99
+	/**
100
+	 * @return bool
101
+	 */
102
+	public function schema_changes_before_migration()
103
+	{
104
+		//relies on 4.1's EEH_Activation::create_table
105
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
106
+		$table_name = 'esp_answer';
107
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
109 108
 					REG_ID INT UNSIGNED NOT NULL,
110 109
 					QST_ID INT UNSIGNED NOT NULL,
111 110
 					ANS_value TEXT NOT NULL,
112 111
 					PRIMARY KEY  (ANS_ID),
113 112
 					KEY REG_ID (REG_ID),
114 113
 					KEY QST_ID (QST_ID)";
115
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
116
-        $table_name = 'esp_attendee_meta';
117
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
114
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
115
+		$table_name = 'esp_attendee_meta';
116
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
118 117
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
119 118
 						ATT_fname VARCHAR(45) NOT NULL,
120 119
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -131,9 +130,9 @@  discard block
 block discarded – undo
131 130
 								KEY ATT_email (ATT_email),
132 131
 								KEY ATT_lname (ATT_lname),
133 132
 								KEY ATT_fname (ATT_fname)";
134
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
135
-        $table_name = 'esp_country';
136
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
133
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
134
+		$table_name = 'esp_country';
135
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
137 136
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
138 137
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
139 138
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -149,25 +148,25 @@  discard block
 block discarded – undo
149 148
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
150 149
 					  CNT_active TINYINT(1) DEFAULT '0',
151 150
 					  PRIMARY KEY  (CNT_ISO)";
152
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153
-        $table_name = 'esp_currency';
154
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
151
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152
+		$table_name = 'esp_currency';
153
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
155 154
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
156 155
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
157 156
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
158 157
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
159 158
 				CUR_active TINYINT(1) DEFAULT '0',
160 159
 				PRIMARY KEY  (CUR_code)";
161
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
162
-        $table_name = 'esp_currency_payment_method';
163
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
160
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
161
+		$table_name = 'esp_currency_payment_method';
162
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
164 163
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
165 164
 				PMD_ID INT(11) NOT NULL,
166 165
 				PRIMARY KEY  (CPM_ID),
167 166
 				KEY PMD_ID (PMD_ID)";
168
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
169
-        $table_name = 'esp_datetime';
170
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
167
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
168
+		$table_name = 'esp_datetime';
169
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
171 170
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
172 171
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
173 172
 				  DTT_description TEXT NOT NULL,
@@ -183,9 +182,9 @@  discard block
 block discarded – undo
183 182
 						KEY DTT_EVT_start (DTT_EVT_start),
184 183
 						KEY EVT_ID (EVT_ID),
185 184
 						KEY DTT_is_primary (DTT_is_primary)";
186
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
187
-        $table_name = 'esp_event_meta';
188
-        $sql = "
185
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
186
+		$table_name = 'esp_event_meta';
187
+		$sql = "
189 188
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
190 189
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
191 190
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -201,34 +200,34 @@  discard block
 block discarded – undo
201 200
 			EVT_donations TINYINT(1) NULL,
202 201
 			PRIMARY KEY  (EVTM_ID),
203 202
 			KEY EVT_ID (EVT_ID)";
204
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
205
-        $table_name = 'esp_event_question_group';
206
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
203
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
204
+		$table_name = 'esp_event_question_group';
205
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
207 206
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
208 207
 					QSG_ID INT UNSIGNED NOT NULL,
209 208
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
210 209
 					PRIMARY KEY  (EQG_ID),
211 210
 					KEY EVT_ID (EVT_ID),
212 211
 					KEY QSG_ID (QSG_ID)";
213
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
214
-        $table_name = 'esp_event_venue';
215
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
212
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
213
+		$table_name = 'esp_event_venue';
214
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
216 215
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
217 216
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
218 217
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
219 218
 				PRIMARY KEY  (EVV_ID)";
220
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
221
-        $table_name = 'esp_extra_meta';
222
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
219
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
220
+		$table_name = 'esp_extra_meta';
221
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
223 222
 				OBJ_ID INT(11) DEFAULT NULL,
224 223
 				EXM_type VARCHAR(45) DEFAULT NULL,
225 224
 				EXM_key VARCHAR(45) DEFAULT NULL,
226 225
 				EXM_value TEXT,
227 226
 				PRIMARY KEY  (EXM_ID),
228 227
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
229
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
230
-        $table_name = 'esp_line_item';
231
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
228
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
229
+		$table_name = 'esp_line_item';
230
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
232 231
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
233 232
 				TXN_ID INT(11) DEFAULT NULL,
234 233
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -246,9 +245,9 @@  discard block
 block discarded – undo
246 245
 				PRIMARY KEY  (LIN_ID),
247 246
 				KEY LIN_code (LIN_code(191)),
248 247
 				KEY TXN_ID (TXN_ID)";
249
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
250
-        $table_name = 'esp_log';
251
-        $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,
252 251
 				LOG_time DATETIME DEFAULT NULL,
253 252
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
254 253
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -259,18 +258,18 @@  discard block
 block discarded – undo
259 258
 				KEY LOG_time (LOG_time),
260 259
 				KEY OBJ (OBJ_type,OBJ_ID),
261 260
 				KEY LOG_type (LOG_type)";
262
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
263
-        $table_name = 'esp_message_template';
264
-        $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,
265 264
 					GRP_ID INT(10) UNSIGNED NOT NULL,
266 265
 					MTP_context VARCHAR(50) NOT NULL,
267 266
 					MTP_template_field VARCHAR(30) NOT NULL,
268 267
 					MTP_content TEXT NOT NULL,
269 268
 					PRIMARY KEY  (MTP_ID),
270 269
 					KEY GRP_ID (GRP_ID)";
271
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
272
-        $table_name = 'esp_message_template_group';
273
-        $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,
274 273
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
275 274
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
276 275
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -282,17 +281,17 @@  discard block
 block discarded – undo
282 281
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
283 282
 					PRIMARY KEY  (GRP_ID),
284 283
 					KEY MTP_user_id (MTP_user_id)";
285
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
286
-        $table_name = 'esp_event_message_template';
287
-        $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,
288 287
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
289 288
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
290 289
 					PRIMARY KEY  (EMT_ID),
291 290
 					KEY EVT_ID (EVT_ID),
292 291
 					KEY GRP_ID (GRP_ID)";
293
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
294
-        $table_name = 'esp_payment';
295
-        $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,
296 295
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
297 296
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
298 297
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -309,9 +308,9 @@  discard block
 block discarded – undo
309 308
 					PRIMARY KEY  (PAY_ID),
310 309
 					KEY PAY_timestamp (PAY_timestamp),
311 310
 					KEY TXN_ID (TXN_ID)";
312
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
313
-        $table_name = 'esp_payment_method';
314
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
311
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
312
+		$table_name = 'esp_payment_method';
313
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
315 314
 				PMD_type VARCHAR(124) DEFAULT NULL,
316 315
 				PMD_name VARCHAR(255) DEFAULT NULL,
317 316
 				PMD_desc TEXT,
@@ -327,32 +326,32 @@  discard block
 block discarded – undo
327 326
 				PRIMARY KEY  (PMD_ID),
328 327
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
329 328
 				KEY PMD_type (PMD_type)";
330
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
331
-        $table_name = "esp_ticket_price";
332
-        $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,
333 332
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
334 333
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
335 334
 					  PRIMARY KEY  (TKP_ID),
336 335
 					  KEY TKT_ID (TKT_ID),
337 336
 					  KEY PRC_ID (PRC_ID)";
338
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
339
-        $table_name = "esp_datetime_ticket";
340
-        $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,
341 340
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
342 341
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
343 342
 					  PRIMARY KEY  (DTK_ID),
344 343
 					  KEY DTT_ID (DTT_ID),
345 344
 					  KEY TKT_ID (TKT_ID)";
346
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
347
-        $table_name = "esp_ticket_template";
348
-        $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,
349 348
 					  TTM_name VARCHAR(45) NOT NULL,
350 349
 					  TTM_description TEXT,
351 350
 					  TTM_file VARCHAR(45),
352 351
 					  PRIMARY KEY  (TTM_ID)";
353
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
354
-        $table_name = 'esp_question';
355
-        $sql = 'QST_ID INT 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 UNSIGNED NOT NULL AUTO_INCREMENT,
356 355
 					QST_display_text TEXT NOT NULL,
357 356
 					QST_admin_label VARCHAR(255) NOT NULL,
358 357
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -365,18 +364,18 @@  discard block
 block discarded – undo
365 364
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
366 365
 					PRIMARY KEY  (QST_ID),
367 366
 					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 UNSIGNED NOT NULL AUTO_INCREMENT,
367
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
368
+		$table_name = 'esp_question_group_question';
369
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
371 370
 					QSG_ID INT UNSIGNED NOT NULL,
372 371
 					QST_ID INT UNSIGNED NOT NULL,
373 372
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
374 373
 					PRIMARY KEY  (QGQ_ID),
375 374
 					KEY QST_ID (QST_ID),
376 375
 					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 UNSIGNED NOT NULL AUTO_INCREMENT,
376
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
377
+		$table_name = 'esp_question_option';
378
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
380 379
 					QSO_value VARCHAR(255) NOT NULL,
381 380
 					QSO_desc TEXT NOT NULL,
382 381
 					QST_ID INT UNSIGNED NOT NULL,
@@ -385,9 +384,9 @@  discard block
 block discarded – undo
385 384
 					PRIMARY KEY  (QSO_ID),
386 385
 					KEY QST_ID (QST_ID),
387 386
 					KEY QSO_order (QSO_order)";
388
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
389
-        $table_name = 'esp_registration';
390
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
387
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
388
+		$table_name = 'esp_registration';
389
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
391 390
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
392 391
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
393 392
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -411,18 +410,18 @@  discard block
 block discarded – undo
411 410
 					  KEY TKT_ID (TKT_ID),
412 411
 					  KEY EVT_ID (EVT_ID),
413 412
 					  KEY STS_ID (STS_ID)";
414
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
415
-        $table_name = 'esp_registration_payment';
416
-        $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
413
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
414
+		$table_name = 'esp_registration_payment';
415
+		$sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
417 416
 					  REG_ID INT(10) UNSIGNED NOT NULL,
418 417
 					  PAY_ID INT(10) UNSIGNED NULL,
419 418
 					  RPY_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
420 419
 					  PRIMARY KEY  (RPY_ID),
421 420
 					  KEY REG_ID (REG_ID),
422 421
 					  KEY PAY_ID (PAY_ID)";
423
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
424
-        $table_name = 'esp_checkin';
425
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
422
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
423
+		$table_name = 'esp_checkin';
424
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
426 425
 					REG_ID INT(10) UNSIGNED NOT NULL,
427 426
 					DTT_ID INT(10) UNSIGNED NOT NULL,
428 427
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -430,9 +429,9 @@  discard block
 block discarded – undo
430 429
 					PRIMARY KEY  (CHK_ID),
431 430
 					KEY REG_ID (REG_ID),
432 431
 					KEY DTT_ID (DTT_ID)";
433
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
434
-        $table_name = 'esp_state';
435
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
432
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
433
+		$table_name = 'esp_state';
434
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
436 435
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
437 436
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
438 437
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
@@ -440,9 +439,9 @@  discard block
 block discarded – undo
440 439
 					  PRIMARY KEY  (STA_ID),
441 440
 					  KEY STA_abbrev (STA_abbrev),
442 441
 					  KEY CNT_ISO (CNT_ISO)";
443
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
444
-        $table_name = 'esp_status';
445
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
442
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
443
+		$table_name = 'esp_status';
444
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
446 445
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
447 446
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
448 447
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -450,9 +449,9 @@  discard block
 block discarded – undo
450 449
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
451 450
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
452 451
 					  KEY STS_type (STS_type)";
453
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
454
-        $table_name = 'esp_transaction';
455
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
452
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
453
+		$table_name = 'esp_transaction';
454
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
456 455
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
457 456
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
458 457
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -464,9 +463,9 @@  discard block
 block discarded – undo
464 463
 					  PRIMARY KEY  (TXN_ID),
465 464
 					  KEY TXN_timestamp (TXN_timestamp),
466 465
 					  KEY STS_ID (STS_ID)";
467
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
468
-        $table_name = 'esp_venue_meta';
469
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
466
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
467
+		$table_name = 'esp_venue_meta';
468
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
470 469
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
471 470
 			VNU_address VARCHAR(255) DEFAULT NULL,
472 471
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -485,10 +484,10 @@  discard block
 block discarded – undo
485 484
 			KEY VNU_ID (VNU_ID),
486 485
 			KEY STA_ID (STA_ID),
487 486
 			KEY CNT_ISO (CNT_ISO)";
488
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
489
-        //modified tables
490
-        $table_name = "esp_price";
491
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
487
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
488
+		//modified tables
489
+		$table_name = "esp_price";
490
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
492 491
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
493 492
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
494 493
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -501,9 +500,9 @@  discard block
 block discarded – undo
501 500
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
502 501
 					  PRIMARY KEY  (PRC_ID),
503 502
 					  KEY PRT_ID (PRT_ID)";
504
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
505
-        $table_name = "esp_price_type";
506
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
503
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
504
+		$table_name = "esp_price_type";
505
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
507 506
 				  PRT_name VARCHAR(45) NOT NULL,
508 507
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
509 508
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -512,9 +511,9 @@  discard block
 block discarded – undo
512 511
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
513 512
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
514 513
 				  PRIMARY KEY  (PRT_ID)";
515
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
516
-        $table_name = "esp_ticket";
517
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
514
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
515
+		$table_name = "esp_ticket";
516
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
518 517
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
519 518
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
520 519
 					  TKT_description TEXT NOT NULL,
@@ -536,9 +535,9 @@  discard block
 block discarded – undo
536 535
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
537 536
 					  PRIMARY KEY  (TKT_ID),
538 537
 					  KEY TKT_start_date (TKT_start_date)";
539
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
540
-        $table_name = 'esp_question_group';
541
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
538
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
539
+		$table_name = 'esp_question_group';
540
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
542 541
 					QSG_name VARCHAR(255) NOT NULL,
543 542
 					QSG_identifier VARCHAR(100) NOT NULL,
544 543
 					QSG_desc TEXT NULL,
@@ -551,38 +550,38 @@  discard block
 block discarded – undo
551 550
 					PRIMARY KEY  (QSG_ID),
552 551
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
553 552
 					KEY QSG_order (QSG_order)';
554
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
555
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
556
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
557
-        //(because many need to convert old string states to foreign keys into the states table)
558
-        $script_4_1_defaults->insert_default_states();
559
-        $script_4_1_defaults->insert_default_countries();
560
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
561
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
562
-        $script_4_5_defaults->insert_default_price_types();
563
-        $script_4_5_defaults->insert_default_prices();
564
-        $script_4_5_defaults->insert_default_tickets();
565
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
566
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
567
-        $script_4_6_defaults->add_default_admin_only_payments();
568
-        $script_4_6_defaults->insert_default_currencies();
569
-        return true;
570
-    }
553
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
554
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
555
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
556
+		//(because many need to convert old string states to foreign keys into the states table)
557
+		$script_4_1_defaults->insert_default_states();
558
+		$script_4_1_defaults->insert_default_countries();
559
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
560
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
561
+		$script_4_5_defaults->insert_default_price_types();
562
+		$script_4_5_defaults->insert_default_prices();
563
+		$script_4_5_defaults->insert_default_tickets();
564
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
565
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
566
+		$script_4_6_defaults->add_default_admin_only_payments();
567
+		$script_4_6_defaults->insert_default_currencies();
568
+		return true;
569
+	}
571 570
 
572 571
 
573 572
 
574
-    /**
575
-     * @return boolean
576
-     */
577
-    public function schema_changes_after_migration()
578
-    {
579
-        return true;
580
-    }
573
+	/**
574
+	 * @return boolean
575
+	 */
576
+	public function schema_changes_after_migration()
577
+	{
578
+		return true;
579
+	}
581 580
 
582 581
 
583 582
 
584
-    public function migration_page_hooks()
585
-    {
586
-    }
583
+	public function migration_page_hooks()
584
+	{
585
+	}
587 586
 }
588 587
 // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php
589 588
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Doc Comments   +18 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      * @param  EE_Event $evtobj The Event object we're attaching data to
203 203
      * @param  array    $data   The request data from the form
204 204
      *
205
-     * @return bool             success or fail
205
+     * @return boolean|null             success or fail
206 206
      */
207 207
     public function dtt_and_tickets_caf_update($evtobj, $data)
208 208
     {
@@ -980,6 +980,9 @@  discard block
 block discarded – undo
980 980
     }
981 981
     
982 982
     
983
+    /**
984
+     * @param integer $dttrow
985
+     */
983 986
     protected function _get_datetime_row(
984 987
         $dttrow,
985 988
         EE_Datetime $dtt,
@@ -1012,6 +1015,7 @@  discard block
 block discarded – undo
1012 1015
      *                                                                       object.
1013 1016
      * @param bool          $default                        Whether a default row is being generated or not.
1014 1017
      * @param EE_Datetime[] $all_dtts                       This is the array of all datetimes used in the editor.
1018
+     * @param EE_Datetime|null $dtt
1015 1019
      *
1016 1020
      * @return string Generated edit row.
1017 1021
      */
@@ -1056,6 +1060,10 @@  discard block
 block discarded – undo
1056 1060
     }
1057 1061
     
1058 1062
     
1063
+    /**
1064
+     * @param EE_Datetime|null $dtt
1065
+     * @param boolean $default
1066
+     */
1059 1067
     protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default)
1060 1068
     {
1061 1069
         
@@ -1305,6 +1313,9 @@  discard block
 block discarded – undo
1305 1313
     }
1306 1314
     
1307 1315
     
1316
+    /**
1317
+     * @param integer $tktrow
1318
+     */
1308 1319
     protected function _get_tax_rows($tktrow, $ticket)
1309 1320
     {
1310 1321
         $tax_rows      = '';
@@ -1340,6 +1351,9 @@  discard block
 block discarded – undo
1340 1351
     }
1341 1352
     
1342 1353
     
1354
+    /**
1355
+     * @param boolean $default
1356
+     */
1343 1357
     protected function _get_ticket_price_row(
1344 1358
         $tktrow,
1345 1359
         $prcrow,
@@ -1475,6 +1489,9 @@  discard block
 block discarded – undo
1475 1489
     }
1476 1490
     
1477 1491
     
1492
+    /**
1493
+     * @param boolean $default
1494
+     */
1478 1495
     protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default)
1479 1496
     {
1480 1497
         $dttid         = ! empty($dtt) ? $dtt->ID() : 0;
Please login to merge, or discard this patch.
Indentation   +1410 added lines, -1410 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -31,1535 +31,1535 @@  discard block
 block discarded – undo
31 31
 class espresso_events_Pricing_Hooks extends EE_Admin_Hooks
32 32
 {
33 33
     
34
-    /**
35
-     * This property is just used to hold the status of whether an event is currently being
36
-     * created (true) or edited (false)
37
-     * @access protected
38
-     * @var bool
39
-     */
40
-    protected $_is_creating_event;
34
+	/**
35
+	 * This property is just used to hold the status of whether an event is currently being
36
+	 * created (true) or edited (false)
37
+	 * @access protected
38
+	 * @var bool
39
+	 */
40
+	protected $_is_creating_event;
41 41
     
42 42
     
43
-    /**
44
-     * Used to contain the format strings for date and time that will be used for php date and
45
-     * time.
46
-     *
47
-     * Is set in the _set_hooks_properties() method.
48
-     *
49
-     * @var array
50
-     */
51
-    protected $_date_format_strings;
43
+	/**
44
+	 * Used to contain the format strings for date and time that will be used for php date and
45
+	 * time.
46
+	 *
47
+	 * Is set in the _set_hooks_properties() method.
48
+	 *
49
+	 * @var array
50
+	 */
51
+	protected $_date_format_strings;
52 52
     
53 53
     
54
-    protected function _set_hooks_properties()
55
-    {
56
-        $this->_name = 'pricing';
57
-        
58
-        //capability check
59
-        if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices',
60
-            'advanced_ticket_datetime_metabox')
61
-        ) {
62
-            return;
63
-        }
64
-        
65
-        
66
-        //if we were going to add our own metaboxes we'd use the below.
67
-        $this->_metaboxes = array(
68
-            0 => array(
69
-                'page_route' => array('edit', 'create_new'),
70
-                'func'       => 'pricing_metabox',
71
-                'label'      => __('Event Tickets & Datetimes', 'event_espresso'),
72
-                'priority'   => 'high',
73
-                'context'    => 'normal'
74
-            ),
75
-        
76
-        );/**/
77
-        
78
-        $this->_remove_metaboxes = array(
79
-            0 => array(
80
-                'page_route' => array('edit', 'create_new'),
81
-                'id'         => 'espresso_event_editor_tickets',
82
-                'context'    => 'normal'
83
-            )
84
-        );
85
-        
86
-        /**
87
-         * Format strings for date and time.  Defaults are existing behaviour from 4.1.
88
-         * Note, that if you return null as the value for 'date', and 'time' in the array, then
89
-         * EE will automatically use the set wp_options, 'date_format', and 'time_format'.
90
-         *
91
-         * @since 4.6.7
92
-         *
93
-         * @var array  Expected an array returned with 'date' and 'time' keys.
94
-         */
95
-        $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings',
96
-            array(
97
-                'date' => 'Y-m-d',
98
-                'time' => 'h:i a'
99
-            ));
100
-        
101
-        //validate
102
-        $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
103
-        $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
104
-        
105
-        //validate format strings
106
-        $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
107
-        if (is_array($format_validation)) {
108
-            $msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:',
109
-                    'event_espresso'),
110
-                    $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>';
111
-            foreach ($format_validation as $error) {
112
-                $msg .= '<li>' . $error . '</li>';
113
-            }
114
-            $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s',
115
-                    'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>';
116
-            EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
117
-            $this->_date_format_strings = array(
118
-                'date' => 'Y-m-d',
119
-                'time' => 'h:i a'
120
-            );
121
-        }
122
-        
123
-        
124
-        $this->_scripts_styles = array(
125
-            'registers'   => array(
126
-                'ee-tickets-datetimes-css' => array(
127
-                    'url'  => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
128
-                    'type' => 'css'
129
-                ),
130
-                'ee-dtt-ticket-metabox'    => array(
131
-                    'url'     => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
132
-                    'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
133
-                )
134
-            ),
135
-            'deregisters' => array(
136
-                'event-editor-css'       => array('type' => 'css'),
137
-                'event-datetime-metabox' => array('type' => 'js')
138
-            ),
139
-            'enqueues'    => array(
140
-                'ee-tickets-datetimes-css' => array('edit', 'create_new'),
141
-                'ee-dtt-ticket-metabox'    => array('edit', 'create_new')
142
-            ),
143
-            'localize'    => array(
144
-                'ee-dtt-ticket-metabox' => array(
145
-                    'DTT_TRASH_BLOCK'       => array(
146
-                        'main_warning'            => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):',
147
-                            'event_espresso'),
148
-                        'after_warning'           => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.',
149
-                            'event_espresso'),
150
-                        'cancel_button'           => '<button class="button-secondary ee-modal-cancel">' . __('Cancel',
151
-                                'event_espresso') . '</button>',
152
-                        'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.',
153
-                            'event_espresso'),
154
-                        'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.',
155
-                            'event_espresso'),
156
-                        'dismiss_button'          => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss',
157
-                                'event_espresso') . '</button>'
158
-                    ),
159
-                    'DTT_ERROR_MSG'         => array(
160
-                        'no_ticket_name' => __('General Admission', 'event_espresso'),
161
-                        'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss',
162
-                                'event_espresso') . '</button></div>'
163
-                    ),
164
-                    'DTT_OVERSELL_WARNING'  => array(
165
-                        'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.',
166
-                            'event_espresso'),
167
-                        'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.',
168
-                            'event_espresso')
169
-                    ),
170
-                    'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'],
171
-                        $this->_date_format_strings['time']),
172
-                    'DTT_START_OF_WEEK'     => array('dayValue' => (int)get_option('start_of_week'))
173
-                )
174
-            )
175
-        );
176
-        
177
-        
178
-        add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page',
179
-            array($this, 'autosave_handling'), 10);
180
-        add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
181
-            array($this, 'caf_updates'), 10);
182
-    }
54
+	protected function _set_hooks_properties()
55
+	{
56
+		$this->_name = 'pricing';
57
+        
58
+		//capability check
59
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices',
60
+			'advanced_ticket_datetime_metabox')
61
+		) {
62
+			return;
63
+		}
64
+        
65
+        
66
+		//if we were going to add our own metaboxes we'd use the below.
67
+		$this->_metaboxes = array(
68
+			0 => array(
69
+				'page_route' => array('edit', 'create_new'),
70
+				'func'       => 'pricing_metabox',
71
+				'label'      => __('Event Tickets & Datetimes', 'event_espresso'),
72
+				'priority'   => 'high',
73
+				'context'    => 'normal'
74
+			),
75
+        
76
+		);/**/
77
+        
78
+		$this->_remove_metaboxes = array(
79
+			0 => array(
80
+				'page_route' => array('edit', 'create_new'),
81
+				'id'         => 'espresso_event_editor_tickets',
82
+				'context'    => 'normal'
83
+			)
84
+		);
85
+        
86
+		/**
87
+		 * Format strings for date and time.  Defaults are existing behaviour from 4.1.
88
+		 * Note, that if you return null as the value for 'date', and 'time' in the array, then
89
+		 * EE will automatically use the set wp_options, 'date_format', and 'time_format'.
90
+		 *
91
+		 * @since 4.6.7
92
+		 *
93
+		 * @var array  Expected an array returned with 'date' and 'time' keys.
94
+		 */
95
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings',
96
+			array(
97
+				'date' => 'Y-m-d',
98
+				'time' => 'h:i a'
99
+			));
100
+        
101
+		//validate
102
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
103
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
104
+        
105
+		//validate format strings
106
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
107
+		if (is_array($format_validation)) {
108
+			$msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:',
109
+					'event_espresso'),
110
+					$this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>';
111
+			foreach ($format_validation as $error) {
112
+				$msg .= '<li>' . $error . '</li>';
113
+			}
114
+			$msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s',
115
+					'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>';
116
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
117
+			$this->_date_format_strings = array(
118
+				'date' => 'Y-m-d',
119
+				'time' => 'h:i a'
120
+			);
121
+		}
122
+        
123
+        
124
+		$this->_scripts_styles = array(
125
+			'registers'   => array(
126
+				'ee-tickets-datetimes-css' => array(
127
+					'url'  => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
128
+					'type' => 'css'
129
+				),
130
+				'ee-dtt-ticket-metabox'    => array(
131
+					'url'     => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
132
+					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
133
+				)
134
+			),
135
+			'deregisters' => array(
136
+				'event-editor-css'       => array('type' => 'css'),
137
+				'event-datetime-metabox' => array('type' => 'js')
138
+			),
139
+			'enqueues'    => array(
140
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
141
+				'ee-dtt-ticket-metabox'    => array('edit', 'create_new')
142
+			),
143
+			'localize'    => array(
144
+				'ee-dtt-ticket-metabox' => array(
145
+					'DTT_TRASH_BLOCK'       => array(
146
+						'main_warning'            => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):',
147
+							'event_espresso'),
148
+						'after_warning'           => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.',
149
+							'event_espresso'),
150
+						'cancel_button'           => '<button class="button-secondary ee-modal-cancel">' . __('Cancel',
151
+								'event_espresso') . '</button>',
152
+						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.',
153
+							'event_espresso'),
154
+						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.',
155
+							'event_espresso'),
156
+						'dismiss_button'          => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss',
157
+								'event_espresso') . '</button>'
158
+					),
159
+					'DTT_ERROR_MSG'         => array(
160
+						'no_ticket_name' => __('General Admission', 'event_espresso'),
161
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss',
162
+								'event_espresso') . '</button></div>'
163
+					),
164
+					'DTT_OVERSELL_WARNING'  => array(
165
+						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.',
166
+							'event_espresso'),
167
+						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.',
168
+							'event_espresso')
169
+					),
170
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'],
171
+						$this->_date_format_strings['time']),
172
+					'DTT_START_OF_WEEK'     => array('dayValue' => (int)get_option('start_of_week'))
173
+				)
174
+			)
175
+		);
176
+        
177
+        
178
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page',
179
+			array($this, 'autosave_handling'), 10);
180
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
181
+			array($this, 'caf_updates'), 10);
182
+	}
183 183
     
184 184
     
185
-    public function caf_updates($update_callbacks)
186
-    {
187
-        foreach ($update_callbacks as $key => $callback) {
188
-            if ($callback[1] == '_default_tickets_update') {
189
-                unset($update_callbacks[$key]);
190
-            }
191
-        }
192
-        
193
-        $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
194
-        
195
-        return $update_callbacks;
196
-    }
185
+	public function caf_updates($update_callbacks)
186
+	{
187
+		foreach ($update_callbacks as $key => $callback) {
188
+			if ($callback[1] == '_default_tickets_update') {
189
+				unset($update_callbacks[$key]);
190
+			}
191
+		}
192
+        
193
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
194
+        
195
+		return $update_callbacks;
196
+	}
197 197
     
198 198
     
199
-    /**
200
-     * Handles saving everything related to Tickets (datetimes, tickets, prices)
201
-     *
202
-     * @param  EE_Event $evtobj The Event object we're attaching data to
203
-     * @param  array    $data   The request data from the form
204
-     *
205
-     * @return bool             success or fail
206
-     */
207
-    public function dtt_and_tickets_caf_update($evtobj, $data)
208
-    {
209
-        //first we need to start with datetimes cause they are the "root" items attached to events.
210
-        $saved_dtts = $this->_update_dtts($evtobj, $data);
211
-        //next tackle the tickets (and prices?)
212
-        $this->_update_tkts($evtobj, $saved_dtts, $data);
213
-    }
199
+	/**
200
+	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
201
+	 *
202
+	 * @param  EE_Event $evtobj The Event object we're attaching data to
203
+	 * @param  array    $data   The request data from the form
204
+	 *
205
+	 * @return bool             success or fail
206
+	 */
207
+	public function dtt_and_tickets_caf_update($evtobj, $data)
208
+	{
209
+		//first we need to start with datetimes cause they are the "root" items attached to events.
210
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
211
+		//next tackle the tickets (and prices?)
212
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
213
+	}
214 214
     
215 215
     
216
-    /**
217
-     * update event_datetimes
218
-     *
219
-     * @param  EE_Event $evt_obj Event being updated
220
-     * @param  array    $data    the request data from the form
221
-     *
222
-     * @return EE_Datetime[]
223
-     */
224
-    protected function _update_dtts($evt_obj, $data)
225
-    {
226
-        $timezone       = isset($data['timezone_string']) ? $data['timezone_string'] : null;
227
-        $saved_dtt_ids  = array();
228
-        $saved_dtt_objs = array();
229
-        
230
-        foreach ($data['edit_event_datetimes'] as $row => $dtt) {
231
-            //trim all values to ensure any excess whitespace is removed.
232
-            $dtt                = array_map(
233
-                function ($datetime_data) {
234
-                    return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
235
-                },
236
-                $dtt
237
-            );
238
-            $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
239
-            $datetime_values    = array(
240
-                'DTT_ID'          => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
241
-                'DTT_name'        => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
242
-                'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
243
-                'DTT_EVT_start'   => $dtt['DTT_EVT_start'],
244
-                'DTT_EVT_end'     => $dtt['DTT_EVT_end'],
245
-                'DTT_reg_limit'   => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
246
-                'DTT_order'       => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
247
-            );
216
+	/**
217
+	 * update event_datetimes
218
+	 *
219
+	 * @param  EE_Event $evt_obj Event being updated
220
+	 * @param  array    $data    the request data from the form
221
+	 *
222
+	 * @return EE_Datetime[]
223
+	 */
224
+	protected function _update_dtts($evt_obj, $data)
225
+	{
226
+		$timezone       = isset($data['timezone_string']) ? $data['timezone_string'] : null;
227
+		$saved_dtt_ids  = array();
228
+		$saved_dtt_objs = array();
229
+        
230
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
231
+			//trim all values to ensure any excess whitespace is removed.
232
+			$dtt                = array_map(
233
+				function ($datetime_data) {
234
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
235
+				},
236
+				$dtt
237
+			);
238
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
239
+			$datetime_values    = array(
240
+				'DTT_ID'          => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
241
+				'DTT_name'        => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
242
+				'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
243
+				'DTT_EVT_start'   => $dtt['DTT_EVT_start'],
244
+				'DTT_EVT_end'     => $dtt['DTT_EVT_end'],
245
+				'DTT_reg_limit'   => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
246
+				'DTT_order'       => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
247
+			);
248 248
             
249
-            //if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
249
+			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
250 250
             
251
-            if ( ! empty($dtt['DTT_ID'])) {
252
-                $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
251
+			if ( ! empty($dtt['DTT_ID'])) {
252
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
253 253
                 
254
-                //set date and time format according to what is set in this class.
255
-                $DTM->set_date_format($this->_date_format_strings['date']);
256
-                $DTM->set_time_format($this->_date_format_strings['time']);
254
+				//set date and time format according to what is set in this class.
255
+				$DTM->set_date_format($this->_date_format_strings['date']);
256
+				$DTM->set_time_format($this->_date_format_strings['time']);
257 257
                 
258
-                foreach ($datetime_values as $field => $value) {
259
-                    $DTM->set($field, $value);
260
-                }
258
+				foreach ($datetime_values as $field => $value) {
259
+					$DTM->set($field, $value);
260
+				}
261 261
                 
262
-                // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
263
-                // We need to do this so we dont' TRASH the parent DTT.(save the ID for both key and value to avoid duplications)
264
-                $saved_dtt_ids[$DTM->ID()] = $DTM->ID();
262
+				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
263
+				// We need to do this so we dont' TRASH the parent DTT.(save the ID for both key and value to avoid duplications)
264
+				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
265 265
                 
266
-            } else {
267
-                $DTM = EE_Registry::instance()->load_class(
268
-                    'Datetime',
269
-                    array(
270
-                        $datetime_values,
271
-                        $timezone,
272
-                        array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
273
-                    ),
274
-                    false,
275
-                    false
276
-                );
266
+			} else {
267
+				$DTM = EE_Registry::instance()->load_class(
268
+					'Datetime',
269
+					array(
270
+						$datetime_values,
271
+						$timezone,
272
+						array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
273
+					),
274
+					false,
275
+					false
276
+				);
277 277
                 
278
-                foreach ($datetime_values as $field => $value) {
279
-                    $DTM->set($field, $value);
280
-                }
281
-            }
278
+				foreach ($datetime_values as $field => $value) {
279
+					$DTM->set($field, $value);
280
+				}
281
+			}
282 282
             
283 283
             
284
-            $DTM->save();
285
-            $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
286
-            $evt_obj->save();
284
+			$DTM->save();
285
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
286
+			$evt_obj->save();
287 287
             
288
-            //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
289
-            if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
290
-                $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
291
-                $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
292
-                $DTM->save();
293
-            }
288
+			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
289
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
290
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
291
+				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
292
+				$DTM->save();
293
+			}
294 294
             
295
-            //	now we have to make sure we add the new DTT_ID to the $saved_dtt_ids array
296
-            // because it is possible there was a new one created for the autosave.
297
-            // (save the ID for both key and value to avoid duplications)
298
-            $saved_dtt_ids[$DTM->ID()] = $DTM->ID();
299
-            $saved_dtt_objs[$row]      = $DTM;
295
+			//	now we have to make sure we add the new DTT_ID to the $saved_dtt_ids array
296
+			// because it is possible there was a new one created for the autosave.
297
+			// (save the ID for both key and value to avoid duplications)
298
+			$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
299
+			$saved_dtt_objs[$row]      = $DTM;
300 300
             
301
-            //todo if ANY of these updates fail then we want the appropriate global error message.
302
-        }
303
-        
304
-        //now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
305
-        $old_datetimes = explode(',', $data['datetime_IDs']);
306
-        $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
307
-        
308
-        if (is_array($old_datetimes)) {
309
-            $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
310
-            foreach ($dtts_to_delete as $id) {
311
-                $id = absint($id);
312
-                if (empty($id)) {
313
-                    continue;
314
-                }
301
+			//todo if ANY of these updates fail then we want the appropriate global error message.
302
+		}
303
+        
304
+		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
305
+		$old_datetimes = explode(',', $data['datetime_IDs']);
306
+		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
307
+        
308
+		if (is_array($old_datetimes)) {
309
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
310
+			foreach ($dtts_to_delete as $id) {
311
+				$id = absint($id);
312
+				if (empty($id)) {
313
+					continue;
314
+				}
315 315
                 
316
-                $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
316
+				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
317 317
                 
318
-                //remove tkt relationships.
319
-                $related_tickets = $dtt_to_remove->get_many_related('Ticket');
320
-                foreach ($related_tickets as $tkt) {
321
-                    $dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
322
-                }
318
+				//remove tkt relationships.
319
+				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
320
+				foreach ($related_tickets as $tkt) {
321
+					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
322
+				}
323 323
                 
324
-                $evt_obj->_remove_relation_to($id, 'Datetime');
325
-                $dtt_to_remove->refresh_cache_of_related_objects();
324
+				$evt_obj->_remove_relation_to($id, 'Datetime');
325
+				$dtt_to_remove->refresh_cache_of_related_objects();
326 326
                 
327
-            }
328
-        }
327
+			}
328
+		}
329 329
         
330
-        return $saved_dtt_objs;
331
-    }
330
+		return $saved_dtt_objs;
331
+	}
332 332
     
333 333
     
334
-    /**
335
-     * update tickets
336
-     *
337
-     * @param  EE_Event      $evtobj     Event object being updated
338
-     * @param  EE_Datetime[] $saved_dtts an array of datetime ids being updated
339
-     * @param  array         $data       incoming request data
340
-     *
341
-     * @return EE_Ticket[]
342
-     */
343
-    protected function _update_tkts($evtobj, $saved_dtts, $data)
344
-    {
345
-        
346
-        $new_tkt     = null;
347
-        $new_default = null;
348
-        //stripslashes because WP filtered the $_POST ($data) array to add slashes
349
-        $data          = stripslashes_deep($data);
350
-        $timezone      = isset($data['timezone_string']) ? $data['timezone_string'] : null;
351
-        $saved_tickets = $dtts_on_existing = array();
352
-        $old_tickets   = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
353
-        
354
-        //load money helper
355
-        
356
-        foreach ($data['edit_tickets'] as $row => $tkt) {
334
+	/**
335
+	 * update tickets
336
+	 *
337
+	 * @param  EE_Event      $evtobj     Event object being updated
338
+	 * @param  EE_Datetime[] $saved_dtts an array of datetime ids being updated
339
+	 * @param  array         $data       incoming request data
340
+	 *
341
+	 * @return EE_Ticket[]
342
+	 */
343
+	protected function _update_tkts($evtobj, $saved_dtts, $data)
344
+	{
345
+        
346
+		$new_tkt     = null;
347
+		$new_default = null;
348
+		//stripslashes because WP filtered the $_POST ($data) array to add slashes
349
+		$data          = stripslashes_deep($data);
350
+		$timezone      = isset($data['timezone_string']) ? $data['timezone_string'] : null;
351
+		$saved_tickets = $dtts_on_existing = array();
352
+		$old_tickets   = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
353
+        
354
+		//load money helper
355
+        
356
+		foreach ($data['edit_tickets'] as $row => $tkt) {
357 357
             
358
-            $update_prices = $create_new_TKT = false;
358
+			$update_prices = $create_new_TKT = false;
359 359
             
360
-            //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
360
+			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
361 361
             
362
-            $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
363
-            $tkt_dtt_rows          = explode(',', $data['ticket_datetime_rows'][$row]);
364
-            $dtts_added            = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
365
-            $dtts_removed          = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
362
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
363
+			$tkt_dtt_rows          = explode(',', $data['ticket_datetime_rows'][$row]);
364
+			$dtts_added            = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
365
+			$dtts_removed          = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
366 366
             
367
-            // trim inputs to ensure any excess whitespace is removed.
368
-            $tkt = array_map(
369
-                function ($ticket_data) {
370
-                    return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
371
-                },
372
-                $tkt
373
-            );
367
+			// trim inputs to ensure any excess whitespace is removed.
368
+			$tkt = array_map(
369
+				function ($ticket_data) {
370
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
371
+				},
372
+				$tkt
373
+			);
374 374
             
375
-            //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
376
-            //note incoming ['TKT_price'] value is already in standard notation (via js).
377
-            $ticket_price = isset($tkt['TKT_price']) ? round((float)$tkt['TKT_price'], 3) : 0;
375
+			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
376
+			//note incoming ['TKT_price'] value is already in standard notation (via js).
377
+			$ticket_price = isset($tkt['TKT_price']) ? round((float)$tkt['TKT_price'], 3) : 0;
378 378
             
379
-            //note incoming base price needs converted from localized value.
380
-            $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
381
-            //if ticket price == 0 and $base_price != 0 then ticket price == base_price
382
-            $ticket_price  = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
383
-            $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
379
+			//note incoming base price needs converted from localized value.
380
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
381
+			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
382
+			$ticket_price  = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
383
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
384 384
             
385
-            $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
385
+			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
386 386
             
387
-            $now = null;
388
-            if (empty($tkt['TKT_start_date'])) {
389
-                //lets' use now in the set timezone.
390
-                $now                   = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
391
-                $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
392
-            }
387
+			$now = null;
388
+			if (empty($tkt['TKT_start_date'])) {
389
+				//lets' use now in the set timezone.
390
+				$now                   = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
391
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
392
+			}
393 393
             
394
-            if (empty($tkt['TKT_end_date'])) {
395
-                /**
396
-                 * set the TKT_end_date to the first datetime attached to the ticket.
397
-                 */
398
-                $first_dtt           = $saved_dtts[reset($tkt_dtt_rows)];
399
-                $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time']);
400
-            }
394
+			if (empty($tkt['TKT_end_date'])) {
395
+				/**
396
+				 * set the TKT_end_date to the first datetime attached to the ticket.
397
+				 */
398
+				$first_dtt           = $saved_dtts[reset($tkt_dtt_rows)];
399
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time']);
400
+			}
401 401
             
402
-            $TKT_values = array(
403
-                'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
404
-                'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
405
-                'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
406
-                'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description',
407
-                    'event_espresso') ? $tkt['TKT_description'] : '',
408
-                'TKT_start_date'  => $tkt['TKT_start_date'],
409
-                'TKT_end_date'    => $tkt['TKT_end_date'],
410
-                'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
411
-                'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
412
-                'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
413
-                'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
414
-                'TKT_row'         => $row,
415
-                'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
416
-                'TKT_taxable'     => ! empty($tkt['TKT_taxable']) ? 1 : 0,
417
-                'TKT_required'    => ! empty($tkt['TKT_required']) ? 1 : 0,
418
-                'TKT_price'       => $ticket_price
419
-            );
402
+			$TKT_values = array(
403
+				'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
404
+				'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
405
+				'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
406
+				'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description',
407
+					'event_espresso') ? $tkt['TKT_description'] : '',
408
+				'TKT_start_date'  => $tkt['TKT_start_date'],
409
+				'TKT_end_date'    => $tkt['TKT_end_date'],
410
+				'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
411
+				'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
412
+				'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
413
+				'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
414
+				'TKT_row'         => $row,
415
+				'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
416
+				'TKT_taxable'     => ! empty($tkt['TKT_taxable']) ? 1 : 0,
417
+				'TKT_required'    => ! empty($tkt['TKT_required']) ? 1 : 0,
418
+				'TKT_price'       => $ticket_price
419
+			);
420 420
             
421 421
             
422
-            //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
423
-            if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
424
-                $TKT_values['TKT_ID']         = 0;
425
-                $TKT_values['TKT_is_default'] = 0;
426
-                $update_prices                = true;
427
-            }
422
+			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
423
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
424
+				$TKT_values['TKT_ID']         = 0;
425
+				$TKT_values['TKT_is_default'] = 0;
426
+				$update_prices                = true;
427
+			}
428 428
             
429
-            // if we have a TKT_ID then we need to get that existing TKT_obj and update it
430
-            // we actually do our saves ahead of doing any add_relations to
431
-            // because its entirely possible that this ticket wasn't removed or added to any datetime in the session
432
-            // but DID have it's items modified.
433
-            // keep in mind that if the TKT has been sold (and we have changed pricing information),
434
-            // then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
435
-            if (absint($TKT_values['TKT_ID'])) {
436
-                $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
437
-                if ($TKT instanceof EE_Ticket) {
429
+			// if we have a TKT_ID then we need to get that existing TKT_obj and update it
430
+			// we actually do our saves ahead of doing any add_relations to
431
+			// because its entirely possible that this ticket wasn't removed or added to any datetime in the session
432
+			// but DID have it's items modified.
433
+			// keep in mind that if the TKT has been sold (and we have changed pricing information),
434
+			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
435
+			if (absint($TKT_values['TKT_ID'])) {
436
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
437
+				if ($TKT instanceof EE_Ticket) {
438 438
                     
439
-                    $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
440
-                    // are there any registrations using this ticket ?
441
-                    $tickets_sold = $TKT->count_related(
442
-                        'Registration',
443
-                        array(
444
-                            array(
445
-                                'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
446
-                            )
447
-                        )
448
-                    );
449
-                    //set ticket formats
450
-                    $TKT->set_date_format($this->_date_format_strings['date']);
451
-                    $TKT->set_time_format($this->_date_format_strings['time']);
439
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
440
+					// are there any registrations using this ticket ?
441
+					$tickets_sold = $TKT->count_related(
442
+						'Registration',
443
+						array(
444
+							array(
445
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
446
+							)
447
+						)
448
+					);
449
+					//set ticket formats
450
+					$TKT->set_date_format($this->_date_format_strings['date']);
451
+					$TKT->set_time_format($this->_date_format_strings['time']);
452 452
                     
453
-                    // let's just check the total price for the existing ticket
454
-                    // and determine if it matches the new total price.
455
-                    // if they are different then we create a new ticket (if tkts sold)
456
-                    // if they aren't different then we go ahead and modify existing ticket.
457
-                    $create_new_TKT = $tickets_sold > 0 && $ticket_price != $TKT->price() && ! $TKT->deleted()
458
-                        ? true : false;
453
+					// let's just check the total price for the existing ticket
454
+					// and determine if it matches the new total price.
455
+					// if they are different then we create a new ticket (if tkts sold)
456
+					// if they aren't different then we go ahead and modify existing ticket.
457
+					$create_new_TKT = $tickets_sold > 0 && $ticket_price != $TKT->price() && ! $TKT->deleted()
458
+						? true : false;
459 459
                     
460
-                    //set new values
461
-                    foreach ($TKT_values as $field => $value) {
462
-                        if ($field === 'TKT_qty') {
463
-                            $TKT->set_qty($value);
464
-                        } else {
465
-                            $TKT->set($field, $value);
466
-                        }
467
-                    }
460
+					//set new values
461
+					foreach ($TKT_values as $field => $value) {
462
+						if ($field === 'TKT_qty') {
463
+							$TKT->set_qty($value);
464
+						} else {
465
+							$TKT->set($field, $value);
466
+						}
467
+					}
468 468
                     
469
-                    //if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
470
-                    if ($create_new_TKT) {
471
-                        $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price,
472
-                            $base_price_id);
473
-                    }
474
-                }
469
+					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
470
+					if ($create_new_TKT) {
471
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price,
472
+							$base_price_id);
473
+					}
474
+				}
475 475
                 
476
-            } else {
477
-                // no TKT_id so a new TKT
478
-                $TKT = EE_Ticket::new_instance(
479
-                    $TKT_values,
480
-                    $timezone,
481
-                    array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
482
-                );
483
-                if ($TKT instanceof EE_Ticket) {
484
-                    // make sure ticket has an ID of setting relations won't work
485
-                    $TKT->save();
486
-                    $TKT           = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
487
-                    $update_prices = true;
488
-                }
489
-            }
490
-            //make sure any current values have been saved.
491
-            //$TKT->save();
476
+			} else {
477
+				// no TKT_id so a new TKT
478
+				$TKT = EE_Ticket::new_instance(
479
+					$TKT_values,
480
+					$timezone,
481
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
482
+				);
483
+				if ($TKT instanceof EE_Ticket) {
484
+					// make sure ticket has an ID of setting relations won't work
485
+					$TKT->save();
486
+					$TKT           = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
487
+					$update_prices = true;
488
+				}
489
+			}
490
+			//make sure any current values have been saved.
491
+			//$TKT->save();
492 492
             
493
-            //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
494
-            if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
495
-                $TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
496
-                $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
497
-            }
493
+			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
494
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
495
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
496
+				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
497
+			}
498 498
             
499
-            //let's make sure the base price is handled
500
-            $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price,
501
-                $base_price_id) : $TKT;
499
+			//let's make sure the base price is handled
500
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price,
501
+				$base_price_id) : $TKT;
502 502
             
503
-            //add/update price_modifiers
504
-            $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
503
+			//add/update price_modifiers
504
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
505 505
             
506
-            //need to make sue that the TKT_price is accurate after saving the prices.
507
-            $TKT->ensure_TKT_Price_correct();
506
+			//need to make sue that the TKT_price is accurate after saving the prices.
507
+			$TKT->ensure_TKT_Price_correct();
508 508
             
509
-            //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
510
-            if ( ! defined('DOING_AUTOSAVE')) {
511
-                if ( ! empty($tkt['TKT_is_default_selector'])) {
512
-                    $update_prices = true;
513
-                    $new_default   = clone $TKT;
514
-                    $new_default->set('TKT_ID', 0);
515
-                    $new_default->set('TKT_is_default', 1);
516
-                    $new_default->set('TKT_row', 1);
517
-                    $new_default->set('TKT_price', $ticket_price);
518
-                    //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
519
-                    $new_default->_remove_relations('Datetime');
520
-                    //todo we need to add the current attached prices as new prices to the new default ticket.
521
-                    $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
522
-                    //don't forget the base price!
523
-                    $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price,
524
-                        $base_price_id);
525
-                    $new_default->save();
526
-                    do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default,
527
-                        $row, $TKT, $data);
528
-                }
529
-            }
509
+			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
510
+			if ( ! defined('DOING_AUTOSAVE')) {
511
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
512
+					$update_prices = true;
513
+					$new_default   = clone $TKT;
514
+					$new_default->set('TKT_ID', 0);
515
+					$new_default->set('TKT_is_default', 1);
516
+					$new_default->set('TKT_row', 1);
517
+					$new_default->set('TKT_price', $ticket_price);
518
+					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
519
+					$new_default->_remove_relations('Datetime');
520
+					//todo we need to add the current attached prices as new prices to the new default ticket.
521
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
522
+					//don't forget the base price!
523
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price,
524
+						$base_price_id);
525
+					$new_default->save();
526
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default,
527
+						$row, $TKT, $data);
528
+				}
529
+			}
530 530
             
531 531
             
532
-            //DO ALL dtt relationships for both current tickets and any archived tickets for the given dtt that are related to the current ticket. TODO... not sure exactly how we're going to do this considering we don't know what current ticket the archived tickets are related to (and TKT_parent is used for autosaves so that's not a field we can reliably use).
532
+			//DO ALL dtt relationships for both current tickets and any archived tickets for the given dtt that are related to the current ticket. TODO... not sure exactly how we're going to do this considering we don't know what current ticket the archived tickets are related to (and TKT_parent is used for autosaves so that's not a field we can reliably use).
533 533
             
534 534
             
535
-            //let's assign any tickets that have been setup to the saved_tickets tracker
536
-            //save existing TKT
537
-            $TKT->save();
538
-            if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
539
-                //save new TKT
540
-                $new_tkt->save();
541
-                //add new ticket to array
542
-                $saved_tickets[$new_tkt->ID()] = $new_tkt;
535
+			//let's assign any tickets that have been setup to the saved_tickets tracker
536
+			//save existing TKT
537
+			$TKT->save();
538
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
539
+				//save new TKT
540
+				$new_tkt->save();
541
+				//add new ticket to array
542
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
543 543
                 
544
-                do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
544
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
545 545
                 
546
-            } else {
547
-                //add tkt to saved tkts
548
-                $saved_tickets[$TKT->ID()] = $TKT;
546
+			} else {
547
+				//add tkt to saved tkts
548
+				$saved_tickets[$TKT->ID()] = $TKT;
549 549
                 
550
-                do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
551
-            }
550
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
551
+			}
552 552
             
553
-        }
554
-        
555
-        // now we need to handle tickets actually "deleted permanently".
556
-        // There are cases where we'd want this to happen
557
-        // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
558
-        // Or a draft event was saved and in the process of editing a ticket is trashed.
559
-        // No sense in keeping all the related data in the db!
560
-        $old_tickets     = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
561
-        $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
562
-        
563
-        foreach ($tickets_removed as $id) {
564
-            $id = absint($id);
553
+		}
554
+        
555
+		// now we need to handle tickets actually "deleted permanently".
556
+		// There are cases where we'd want this to happen
557
+		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
558
+		// Or a draft event was saved and in the process of editing a ticket is trashed.
559
+		// No sense in keeping all the related data in the db!
560
+		$old_tickets     = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
561
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
562
+        
563
+		foreach ($tickets_removed as $id) {
564
+			$id = absint($id);
565 565
             
566
-            //get the ticket for this id
567
-            $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
566
+			//get the ticket for this id
567
+			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
568 568
             
569
-            //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
570
-            if ($tkt_to_remove->get('TKT_is_default')) {
571
-                continue;
572
-            }
569
+			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
570
+			if ($tkt_to_remove->get('TKT_is_default')) {
571
+				continue;
572
+			}
573 573
             
574
-            // if this tkt has any registrations attached so then we just ARCHIVE
575
-            // because we don't actually permanently delete these tickets.
576
-            if ($tkt_to_remove->count_related('Registration') > 0) {
577
-                $tkt_to_remove->delete();
578
-                continue;
579
-            }
574
+			// if this tkt has any registrations attached so then we just ARCHIVE
575
+			// because we don't actually permanently delete these tickets.
576
+			if ($tkt_to_remove->count_related('Registration') > 0) {
577
+				$tkt_to_remove->delete();
578
+				continue;
579
+			}
580 580
             
581
-            // need to get all the related datetimes on this ticket and remove from every single one of them
582
-            // (remember this process can ONLY kick off if there are NO tkts_sold)
583
-            $dtts = $tkt_to_remove->get_many_related('Datetime');
581
+			// need to get all the related datetimes on this ticket and remove from every single one of them
582
+			// (remember this process can ONLY kick off if there are NO tkts_sold)
583
+			$dtts = $tkt_to_remove->get_many_related('Datetime');
584 584
             
585
-            foreach ($dtts as $dtt) {
586
-                $tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
587
-            }
585
+			foreach ($dtts as $dtt) {
586
+				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
587
+			}
588 588
             
589
-            // need to do the same for prices (except these prices can also be deleted because again,
590
-            // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
591
-            $tkt_to_remove->delete_related_permanently('Price');
589
+			// need to do the same for prices (except these prices can also be deleted because again,
590
+			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
591
+			$tkt_to_remove->delete_related_permanently('Price');
592 592
             
593
-            do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
593
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
594 594
             
595
-            // finally let's delete this ticket
596
-            // (which should not be blocked at this point b/c we've removed all our relationships)
597
-            $tkt_to_remove->delete_permanently();
598
-        }
595
+			// finally let's delete this ticket
596
+			// (which should not be blocked at this point b/c we've removed all our relationships)
597
+			$tkt_to_remove->delete_permanently();
598
+		}
599 599
         
600
-        return $saved_tickets;
601
-    }
600
+		return $saved_tickets;
601
+	}
602 602
     
603 603
     
604
-    /**
605
-     *
606
-     * @access  protected
607
-     *
608
-     * @param \EE_Ticket     $ticket
609
-     * @param \EE_Datetime[] $saved_datetimes
610
-     * @param \EE_Datetime[] $added_datetimes
611
-     * @param \EE_Datetime[] $removed_datetimes
612
-     *
613
-     * @return \EE_Ticket
614
-     * @throws \EE_Error
615
-     */
616
-    protected function _update_ticket_datetimes(
617
-        EE_Ticket $ticket,
618
-        $saved_datetimes = array(),
619
-        $added_datetimes = array(),
620
-        $removed_datetimes = array()
621
-    ) {
622
-        
623
-        // to start we have to add the ticket to all the datetimes its supposed to be with,
624
-        // and removing the ticket from datetimes it got removed from.
625
-        
626
-        // first let's add datetimes
627
-        if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
628
-            foreach ($added_datetimes as $row_id) {
629
-                $row_id = (int)$row_id;
630
-                if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
631
-                    $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
632
-                    // Is this an existing ticket (has an ID) and does it have any sold?
633
-                    // If so, then we need to add that to the DTT sold because this DTT is getting added.
634
-                    if ($ticket->ID() && $ticket->sold() > 0) {
635
-                        $saved_datetimes[$row_id]->increase_sold($ticket->sold());
636
-                        $saved_datetimes[$row_id]->save();
637
-                    }
638
-                }
639
-            }
640
-        }
641
-        // then remove datetimes
642
-        if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
643
-            foreach ($removed_datetimes as $row_id) {
644
-                $row_id = (int)$row_id;
645
-                // its entirely possible that a datetime got deleted (instead of just removed from relationship.
646
-                // So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
647
-                if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
648
-                    $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
649
-                    // Is this an existing ticket (has an ID) and does it have any sold?
650
-                    // If so, then we need to remove it's sold from the DTT_sold.
651
-                    if ($ticket->ID() && $ticket->sold() > 0) {
652
-                        $saved_datetimes[$row_id]->decrease_sold($ticket->sold());
653
-                        $saved_datetimes[$row_id]->save();
654
-                    }
655
-                }
656
-            }
657
-        }
658
-        // cap ticket qty by datetime reg limits
659
-        $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
660
-        
661
-        return $ticket;
662
-    }
604
+	/**
605
+	 *
606
+	 * @access  protected
607
+	 *
608
+	 * @param \EE_Ticket     $ticket
609
+	 * @param \EE_Datetime[] $saved_datetimes
610
+	 * @param \EE_Datetime[] $added_datetimes
611
+	 * @param \EE_Datetime[] $removed_datetimes
612
+	 *
613
+	 * @return \EE_Ticket
614
+	 * @throws \EE_Error
615
+	 */
616
+	protected function _update_ticket_datetimes(
617
+		EE_Ticket $ticket,
618
+		$saved_datetimes = array(),
619
+		$added_datetimes = array(),
620
+		$removed_datetimes = array()
621
+	) {
622
+        
623
+		// to start we have to add the ticket to all the datetimes its supposed to be with,
624
+		// and removing the ticket from datetimes it got removed from.
625
+        
626
+		// first let's add datetimes
627
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
628
+			foreach ($added_datetimes as $row_id) {
629
+				$row_id = (int)$row_id;
630
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
631
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
632
+					// Is this an existing ticket (has an ID) and does it have any sold?
633
+					// If so, then we need to add that to the DTT sold because this DTT is getting added.
634
+					if ($ticket->ID() && $ticket->sold() > 0) {
635
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
636
+						$saved_datetimes[$row_id]->save();
637
+					}
638
+				}
639
+			}
640
+		}
641
+		// then remove datetimes
642
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
643
+			foreach ($removed_datetimes as $row_id) {
644
+				$row_id = (int)$row_id;
645
+				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
646
+				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
647
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
648
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
649
+					// Is this an existing ticket (has an ID) and does it have any sold?
650
+					// If so, then we need to remove it's sold from the DTT_sold.
651
+					if ($ticket->ID() && $ticket->sold() > 0) {
652
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
653
+						$saved_datetimes[$row_id]->save();
654
+					}
655
+				}
656
+			}
657
+		}
658
+		// cap ticket qty by datetime reg limits
659
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
660
+        
661
+		return $ticket;
662
+	}
663 663
     
664 664
     
665
-    /**
666
-     *
667
-     * @access  protected
668
-     *
669
-     * @param \EE_Ticket $ticket
670
-     * @param array      $price_rows
671
-     * @param int        $ticket_price
672
-     * @param int        $base_price
673
-     * @param int        $base_price_id
674
-     *
675
-     * @return \EE_Ticket
676
-     * @throws \EE_Error
677
-     */
678
-    protected function _duplicate_ticket(
679
-        EE_Ticket $ticket,
680
-        $price_rows = array(),
681
-        $ticket_price = 0,
682
-        $base_price = 0,
683
-        $base_price_id = 0
684
-    ) {
685
-        
686
-        // create new ticket that's a copy of the existing
687
-        // except a new id of course (and not archived)
688
-        // AND has the new TKT_price associated with it.
689
-        $new_ticket = clone($ticket);
690
-        $new_ticket->set('TKT_ID', 0);
691
-        $new_ticket->set('TKT_deleted', 0);
692
-        $new_ticket->set('TKT_price', $ticket_price);
693
-        $new_ticket->set('TKT_sold', 0);
694
-        // let's get a new ID for this ticket
695
-        $new_ticket->save();
696
-        // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
697
-        $datetimes_on_existing = $ticket->get_many_related('Datetime');
698
-        $new_ticket            = $this->_update_ticket_datetimes(
699
-            $new_ticket,
700
-            $datetimes_on_existing,
701
-            array_keys($datetimes_on_existing)
702
-        );
703
-        
704
-        // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
705
-        // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
706
-        // available.
707
-        if ($ticket->sold() > 0) {
708
-            $new_qty = $ticket->qty() - $ticket->sold();
709
-            $new_ticket->set_qty($new_qty);
710
-        }
711
-        //now we update the prices just for this ticket
712
-        $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
713
-        //and we update the base price
714
-        $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
715
-        
716
-        return $new_ticket;
717
-    }
665
+	/**
666
+	 *
667
+	 * @access  protected
668
+	 *
669
+	 * @param \EE_Ticket $ticket
670
+	 * @param array      $price_rows
671
+	 * @param int        $ticket_price
672
+	 * @param int        $base_price
673
+	 * @param int        $base_price_id
674
+	 *
675
+	 * @return \EE_Ticket
676
+	 * @throws \EE_Error
677
+	 */
678
+	protected function _duplicate_ticket(
679
+		EE_Ticket $ticket,
680
+		$price_rows = array(),
681
+		$ticket_price = 0,
682
+		$base_price = 0,
683
+		$base_price_id = 0
684
+	) {
685
+        
686
+		// create new ticket that's a copy of the existing
687
+		// except a new id of course (and not archived)
688
+		// AND has the new TKT_price associated with it.
689
+		$new_ticket = clone($ticket);
690
+		$new_ticket->set('TKT_ID', 0);
691
+		$new_ticket->set('TKT_deleted', 0);
692
+		$new_ticket->set('TKT_price', $ticket_price);
693
+		$new_ticket->set('TKT_sold', 0);
694
+		// let's get a new ID for this ticket
695
+		$new_ticket->save();
696
+		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
697
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
698
+		$new_ticket            = $this->_update_ticket_datetimes(
699
+			$new_ticket,
700
+			$datetimes_on_existing,
701
+			array_keys($datetimes_on_existing)
702
+		);
703
+        
704
+		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
705
+		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
706
+		// available.
707
+		if ($ticket->sold() > 0) {
708
+			$new_qty = $ticket->qty() - $ticket->sold();
709
+			$new_ticket->set_qty($new_qty);
710
+		}
711
+		//now we update the prices just for this ticket
712
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
713
+		//and we update the base price
714
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
715
+        
716
+		return $new_ticket;
717
+	}
718 718
     
719 719
     
720
-    /**
721
-     * This attaches a list of given prices to a ticket.
722
-     * Note we dont' have to worry about ever removing relationships (or archiving prices) because if there is a change
723
-     * in price information on a ticket, a new ticket is created anyways so the archived ticket will retain the old
724
-     * price info and prices are automatically "archived" via the ticket.
725
-     *
726
-     * @access  private
727
-     *
728
-     * @param array     $prices        Array of prices from the form.
729
-     * @param EE_Ticket $ticket        EE_Ticket object that prices are being attached to.
730
-     * @param bool      $new_prices    Whether attach existing incoming prices or create new ones.
731
-     * @param int|bool  $base_price    if FALSE then NOT doing a base price add.
732
-     * @param int|bool  $base_price_id if present then this is the base_price_id being updated.
733
-     *
734
-     * @return EE_Ticket
735
-     */
736
-    protected function _add_prices_to_ticket(
737
-        $prices = array(),
738
-        EE_Ticket $ticket,
739
-        $new_prices = false,
740
-        $base_price = false,
741
-        $base_price_id = false
742
-    ) {
743
-        
744
-        //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
745
-        $current_prices_on_ticket = $base_price !== false ? $ticket->base_price(true) : $ticket->price_modifiers();
746
-        
747
-        $updated_prices = array();
748
-        
749
-        // if $base_price ! FALSE then updating a base price.
750
-        if ($base_price !== false) {
751
-            $prices[1] = array(
752
-                'PRC_ID'     => $new_prices || $base_price_id === 1 ? null : $base_price_id,
753
-                'PRT_ID'     => 1,
754
-                'PRC_amount' => $base_price,
755
-                'PRC_name'   => $ticket->get('TKT_name'),
756
-                'PRC_desc'   => $ticket->get('TKT_description')
757
-            );
758
-        }
759
-        
760
-        //possibly need to save tkt
761
-        if ( ! $ticket->ID()) {
762
-            $ticket->save();
763
-        }
764
-        
765
-        foreach ($prices as $row => $prc) {
766
-            $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null;
767
-            if (empty($prt_id)) {
768
-                continue;
769
-            } //prices MUST have a price type id.
770
-            $PRC_values = array(
771
-                'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
772
-                'PRT_ID'         => $prt_id,
773
-                'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
774
-                'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
775
-                'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
776
-                'PRC_is_default' => false,
777
-                //make sure we set PRC_is_default to false for all ticket saves from event_editor
778
-                'PRC_order'      => $row
779
-            );
780
-            if ($new_prices || empty($PRC_values['PRC_ID'])) {
781
-                $PRC_values['PRC_ID'] = 0;
782
-                $PRC                  = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false);
783
-            } else {
784
-                $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
785
-                //update this price with new values
786
-                foreach ($PRC_values as $field => $newprc) {
787
-                    $PRC->set($field, $newprc);
788
-                }
789
-            }
790
-            $PRC->save();
791
-            $prcid                  = $PRC->ID();
792
-            $updated_prices[$prcid] = $PRC;
793
-            $ticket->_add_relation_to($PRC, 'Price');
794
-        }
795
-        
796
-        //now let's remove any prices that got removed from the ticket
797
-        if ( ! empty ($current_prices_on_ticket)) {
798
-            $current          = array_keys($current_prices_on_ticket);
799
-            $updated          = array_keys($updated_prices);
800
-            $prices_to_remove = array_diff($current, $updated);
801
-            if ( ! empty($prices_to_remove)) {
802
-                foreach ($prices_to_remove as $prc_id) {
803
-                    $p = $current_prices_on_ticket[$prc_id];
804
-                    $ticket->_remove_relation_to($p, 'Price');
720
+	/**
721
+	 * This attaches a list of given prices to a ticket.
722
+	 * Note we dont' have to worry about ever removing relationships (or archiving prices) because if there is a change
723
+	 * in price information on a ticket, a new ticket is created anyways so the archived ticket will retain the old
724
+	 * price info and prices are automatically "archived" via the ticket.
725
+	 *
726
+	 * @access  private
727
+	 *
728
+	 * @param array     $prices        Array of prices from the form.
729
+	 * @param EE_Ticket $ticket        EE_Ticket object that prices are being attached to.
730
+	 * @param bool      $new_prices    Whether attach existing incoming prices or create new ones.
731
+	 * @param int|bool  $base_price    if FALSE then NOT doing a base price add.
732
+	 * @param int|bool  $base_price_id if present then this is the base_price_id being updated.
733
+	 *
734
+	 * @return EE_Ticket
735
+	 */
736
+	protected function _add_prices_to_ticket(
737
+		$prices = array(),
738
+		EE_Ticket $ticket,
739
+		$new_prices = false,
740
+		$base_price = false,
741
+		$base_price_id = false
742
+	) {
743
+        
744
+		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
745
+		$current_prices_on_ticket = $base_price !== false ? $ticket->base_price(true) : $ticket->price_modifiers();
746
+        
747
+		$updated_prices = array();
748
+        
749
+		// if $base_price ! FALSE then updating a base price.
750
+		if ($base_price !== false) {
751
+			$prices[1] = array(
752
+				'PRC_ID'     => $new_prices || $base_price_id === 1 ? null : $base_price_id,
753
+				'PRT_ID'     => 1,
754
+				'PRC_amount' => $base_price,
755
+				'PRC_name'   => $ticket->get('TKT_name'),
756
+				'PRC_desc'   => $ticket->get('TKT_description')
757
+			);
758
+		}
759
+        
760
+		//possibly need to save tkt
761
+		if ( ! $ticket->ID()) {
762
+			$ticket->save();
763
+		}
764
+        
765
+		foreach ($prices as $row => $prc) {
766
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null;
767
+			if (empty($prt_id)) {
768
+				continue;
769
+			} //prices MUST have a price type id.
770
+			$PRC_values = array(
771
+				'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
772
+				'PRT_ID'         => $prt_id,
773
+				'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
774
+				'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
775
+				'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
776
+				'PRC_is_default' => false,
777
+				//make sure we set PRC_is_default to false for all ticket saves from event_editor
778
+				'PRC_order'      => $row
779
+			);
780
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
781
+				$PRC_values['PRC_ID'] = 0;
782
+				$PRC                  = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false);
783
+			} else {
784
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
785
+				//update this price with new values
786
+				foreach ($PRC_values as $field => $newprc) {
787
+					$PRC->set($field, $newprc);
788
+				}
789
+			}
790
+			$PRC->save();
791
+			$prcid                  = $PRC->ID();
792
+			$updated_prices[$prcid] = $PRC;
793
+			$ticket->_add_relation_to($PRC, 'Price');
794
+		}
795
+        
796
+		//now let's remove any prices that got removed from the ticket
797
+		if ( ! empty ($current_prices_on_ticket)) {
798
+			$current          = array_keys($current_prices_on_ticket);
799
+			$updated          = array_keys($updated_prices);
800
+			$prices_to_remove = array_diff($current, $updated);
801
+			if ( ! empty($prices_to_remove)) {
802
+				foreach ($prices_to_remove as $prc_id) {
803
+					$p = $current_prices_on_ticket[$prc_id];
804
+					$ticket->_remove_relation_to($p, 'Price');
805 805
                     
806
-                    //delete permanently the price
807
-                    $p->delete_permanently();
808
-                }
809
-            }
810
-        }
811
-        
812
-        return $ticket;
813
-    }
806
+					//delete permanently the price
807
+					$p->delete_permanently();
808
+				}
809
+			}
810
+		}
811
+        
812
+		return $ticket;
813
+	}
814 814
     
815 815
     
816
-    public function autosave_handling($event_admin_obj)
817
-    {
818
-        return $event_admin_obj; //doing nothing for the moment.
819
-        //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
820
-        
821
-        /**
822
-         * need to remember to handle TICKET DEFAULT saves correctly:  I've got two input fields in the dom:
823
-         *
824
-         * 1. TKT_is_default_selector (visible)
825
-         * 2. TKT_is_default (hidden)
826
-         *
827
-         * I think we'll use the TKT_is_default for recording whether the ticket displayed IS a default ticket (on new event creations). Whereas the TKT_is_default_selector is for the user to indicate they want this ticket to be saved as a default.
828
-         *
829
-         * The tricky part is, on an initial display on create or edit (or after manually updating), the TKT_is_default_selector will always be unselected and the TKT_is_default will only be true if this is a create.  However, after an autosave, users will want some sort of indicator that the TKT HAS been saved as a default.. in other words we don't want to remove the check on TKT_is_default_selector. So here's what I'm thinking.
830
-         * On Autosave:
831
-         * 1. If TKT_is_default is true: we create a new TKT, send back the new id and add id to related elements, then set the TKT_is_default to false.
832
-         * 2. If TKT_is_default_selector is true: we create/edit existing ticket (following conditions above as well).  We do NOT create a new default ticket.  The checkbox stays selected after autosave.
833
-         * 3. only on MANUAL update do we check for the selection and if selected create the new default ticket.
834
-         */
835
-    }
816
+	public function autosave_handling($event_admin_obj)
817
+	{
818
+		return $event_admin_obj; //doing nothing for the moment.
819
+		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
820
+        
821
+		/**
822
+		 * need to remember to handle TICKET DEFAULT saves correctly:  I've got two input fields in the dom:
823
+		 *
824
+		 * 1. TKT_is_default_selector (visible)
825
+		 * 2. TKT_is_default (hidden)
826
+		 *
827
+		 * I think we'll use the TKT_is_default for recording whether the ticket displayed IS a default ticket (on new event creations). Whereas the TKT_is_default_selector is for the user to indicate they want this ticket to be saved as a default.
828
+		 *
829
+		 * The tricky part is, on an initial display on create or edit (or after manually updating), the TKT_is_default_selector will always be unselected and the TKT_is_default will only be true if this is a create.  However, after an autosave, users will want some sort of indicator that the TKT HAS been saved as a default.. in other words we don't want to remove the check on TKT_is_default_selector. So here's what I'm thinking.
830
+		 * On Autosave:
831
+		 * 1. If TKT_is_default is true: we create a new TKT, send back the new id and add id to related elements, then set the TKT_is_default to false.
832
+		 * 2. If TKT_is_default_selector is true: we create/edit existing ticket (following conditions above as well).  We do NOT create a new default ticket.  The checkbox stays selected after autosave.
833
+		 * 3. only on MANUAL update do we check for the selection and if selected create the new default ticket.
834
+		 */
835
+	}
836 836
     
837 837
     
838
-    public function pricing_metabox()
839
-    {
840
-        $existing_datetime_ids = $existing_ticket_ids = $datetime_tickets = $ticket_datetimes = array();
841
-        
842
-        $evtobj = $this->_adminpage_obj->get_cpt_model_obj();
843
-        
844
-        //set is_creating_event property.
845
-        $evtID                    = $evtobj->ID();
846
-        $this->_is_creating_event = absint($evtID) != 0 ? false : true;
847
-        
848
-        //default main template args
849
-        $main_template_args = array(
850
-            'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab',
851
-                $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false),
852
-            //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
853
-            'existing_datetime_ids'    => '',
854
-            'total_dtt_rows'           => 1,
855
-            'add_new_dtt_help_link'    => EEH_Template::get_help_tab_link('add_new_dtt_info',
856
-                $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false),
857
-            //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
858
-            'datetime_rows'            => '',
859
-            'show_tickets_container'   => '',
860
-            //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
861
-            'ticket_rows'              => '',
862
-            'existing_ticket_ids'      => '',
863
-            'total_ticket_rows'        => 1,
864
-            'ticket_js_structure'      => '',
865
-            'ee_collapsible_status'    => ' ee-collapsible-open'
866
-            //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' ee-collapsible-closed' : ' ee-collapsible-open'
867
-        );
868
-        
869
-        $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : null;
870
-        
871
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
872
-        
873
-        /**
874
-         * 1. Start with retrieving Datetimes
875
-         * 2. For each datetime get related tickets
876
-         * 3. For each ticket get related prices
877
-         */
878
-        
879
-        $DTM   = EE_Registry::instance()->load_model('Datetime', array($timezone));
880
-        $times = $DTM->get_all_event_dates($evtID);
881
-        
882
-        
883
-        $main_template_args['total_dtt_rows'] = count($times);
884
-        
885
-        /** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
886
-        $dttrow = 1;
887
-        foreach ($times as $time) {
888
-            $dttid = $time->get('DTT_ID');
889
-            $time->set('DTT_order', $dttrow);
890
-            $existing_datetime_ids[] = $dttid;
838
+	public function pricing_metabox()
839
+	{
840
+		$existing_datetime_ids = $existing_ticket_ids = $datetime_tickets = $ticket_datetimes = array();
841
+        
842
+		$evtobj = $this->_adminpage_obj->get_cpt_model_obj();
843
+        
844
+		//set is_creating_event property.
845
+		$evtID                    = $evtobj->ID();
846
+		$this->_is_creating_event = absint($evtID) != 0 ? false : true;
847
+        
848
+		//default main template args
849
+		$main_template_args = array(
850
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab',
851
+				$this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false),
852
+			//todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
853
+			'existing_datetime_ids'    => '',
854
+			'total_dtt_rows'           => 1,
855
+			'add_new_dtt_help_link'    => EEH_Template::get_help_tab_link('add_new_dtt_info',
856
+				$this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false),
857
+			//todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
858
+			'datetime_rows'            => '',
859
+			'show_tickets_container'   => '',
860
+			//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
861
+			'ticket_rows'              => '',
862
+			'existing_ticket_ids'      => '',
863
+			'total_ticket_rows'        => 1,
864
+			'ticket_js_structure'      => '',
865
+			'ee_collapsible_status'    => ' ee-collapsible-open'
866
+			//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' ee-collapsible-closed' : ' ee-collapsible-open'
867
+		);
868
+        
869
+		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : null;
870
+        
871
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
872
+        
873
+		/**
874
+		 * 1. Start with retrieving Datetimes
875
+		 * 2. For each datetime get related tickets
876
+		 * 3. For each ticket get related prices
877
+		 */
878
+        
879
+		$DTM   = EE_Registry::instance()->load_model('Datetime', array($timezone));
880
+		$times = $DTM->get_all_event_dates($evtID);
881
+        
882
+        
883
+		$main_template_args['total_dtt_rows'] = count($times);
884
+        
885
+		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
886
+		$dttrow = 1;
887
+		foreach ($times as $time) {
888
+			$dttid = $time->get('DTT_ID');
889
+			$time->set('DTT_order', $dttrow);
890
+			$existing_datetime_ids[] = $dttid;
891 891
             
892
-            //tickets attached
893
-            $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(
894
-                array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
895
-                'default_where_conditions' => 'none',
896
-                'order_by'                 => array('TKT_order' => 'ASC')
897
-            )) : array();
892
+			//tickets attached
893
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(
894
+				array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
895
+				'default_where_conditions' => 'none',
896
+				'order_by'                 => array('TKT_order' => 'ASC')
897
+			)) : array();
898 898
             
899
-            //if there are no related tickets this is likely a new event OR autodraft
900
-            // event so we need to generate the default tickets because dtts
901
-            // ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
902
-            // datetime on the event.
903
-            if (empty ($related_tickets) && count($times) < 2) {
904
-                $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
899
+			//if there are no related tickets this is likely a new event OR autodraft
900
+			// event so we need to generate the default tickets because dtts
901
+			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
902
+			// datetime on the event.
903
+			if (empty ($related_tickets) && count($times) < 2) {
904
+				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
905 905
                 
906
-                //this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
907
-                $default_prices = EEM_Price::instance()->get_all_default_prices();
906
+				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
907
+				$default_prices = EEM_Price::instance()->get_all_default_prices();
908 908
                 
909
-                $main_default_ticket = reset($related_tickets);
910
-                if ($main_default_ticket instanceof EE_Ticket) {
911
-                    foreach ($default_prices as $default_price) {
912
-                        if ($default_price->is_base_price()) {
913
-                            continue;
914
-                        }
915
-                        $main_default_ticket->cache('Price', $default_price);
916
-                    }
917
-                }
918
-            }
909
+				$main_default_ticket = reset($related_tickets);
910
+				if ($main_default_ticket instanceof EE_Ticket) {
911
+					foreach ($default_prices as $default_price) {
912
+						if ($default_price->is_base_price()) {
913
+							continue;
914
+						}
915
+						$main_default_ticket->cache('Price', $default_price);
916
+					}
917
+				}
918
+			}
919 919
             
920 920
             
921
-            //we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
921
+			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
922 922
             
923
-            //loop through and setup the ticket rows and make sure the order is set.
924
-            foreach ($related_tickets as $ticket) {
925
-                $tktid  = $ticket->get('TKT_ID');
926
-                $tktrow = $ticket->get('TKT_row');
927
-                //we only want unique tickets in our final display!!
928
-                if ( ! in_array($tktid, $existing_ticket_ids)) {
929
-                    $existing_ticket_ids[] = $tktid;
930
-                    $all_tickets[]         = $ticket;
931
-                }
923
+			//loop through and setup the ticket rows and make sure the order is set.
924
+			foreach ($related_tickets as $ticket) {
925
+				$tktid  = $ticket->get('TKT_ID');
926
+				$tktrow = $ticket->get('TKT_row');
927
+				//we only want unique tickets in our final display!!
928
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
929
+					$existing_ticket_ids[] = $tktid;
930
+					$all_tickets[]         = $ticket;
931
+				}
932 932
                 
933
-                //temporary cache of this ticket info for this datetime for later processing of datetime rows.
934
-                $datetime_tickets[$dttid][] = $tktrow;
933
+				//temporary cache of this ticket info for this datetime for later processing of datetime rows.
934
+				$datetime_tickets[$dttid][] = $tktrow;
935 935
                 
936
-                //temporary cache of this datetime info for this ticket for later processing of ticket rows.
937
-                if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) {
938
-                    $ticket_datetimes[$tktid][] = $dttrow;
939
-                }
940
-            }
941
-            $dttrow++;
942
-        }
943
-        
944
-        $main_template_args['total_ticket_rows']     = count($existing_ticket_ids);
945
-        $main_template_args['existing_ticket_ids']   = implode(',', $existing_ticket_ids);
946
-        $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
947
-        
948
-        //sort $all_tickets by order
949
-        usort($all_tickets, function ($a, $b) {
950
-            $a_order = (int)$a->get('TKT_order');
951
-            $b_order = (int)$b->get('TKT_order');
952
-            if ($a_order == $b_order) {
953
-                return 0;
954
-            }
936
+				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
937
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) {
938
+					$ticket_datetimes[$tktid][] = $dttrow;
939
+				}
940
+			}
941
+			$dttrow++;
942
+		}
943
+        
944
+		$main_template_args['total_ticket_rows']     = count($existing_ticket_ids);
945
+		$main_template_args['existing_ticket_ids']   = implode(',', $existing_ticket_ids);
946
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
947
+        
948
+		//sort $all_tickets by order
949
+		usort($all_tickets, function ($a, $b) {
950
+			$a_order = (int)$a->get('TKT_order');
951
+			$b_order = (int)$b->get('TKT_order');
952
+			if ($a_order == $b_order) {
953
+				return 0;
954
+			}
955 955
             
956
-            return ($a_order < $b_order) ? -1 : 1;
957
-        });
958
-        
959
-        //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
960
-        $dttrow = 1;
961
-        foreach ($times as $time) {
962
-            $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets,
963
-                $all_tickets, false, $times);
964
-            $dttrow++;
965
-        }
966
-        
967
-        //then loop through all tickets for the ticket rows.
968
-        $tktrow = 1;
969
-        foreach ($all_tickets as $ticket) {
970
-            $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times,
971
-                false, $all_tickets);
972
-            $tktrow++;
973
-        }
974
-        
975
-        $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
976
-        $template                                  = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
977
-        EEH_Template::display_template($template, $main_template_args);
978
-        
979
-        return;
980
-    }
956
+			return ($a_order < $b_order) ? -1 : 1;
957
+		});
958
+        
959
+		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
960
+		$dttrow = 1;
961
+		foreach ($times as $time) {
962
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets,
963
+				$all_tickets, false, $times);
964
+			$dttrow++;
965
+		}
966
+        
967
+		//then loop through all tickets for the ticket rows.
968
+		$tktrow = 1;
969
+		foreach ($all_tickets as $ticket) {
970
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times,
971
+				false, $all_tickets);
972
+			$tktrow++;
973
+		}
974
+        
975
+		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
976
+		$template                                  = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
977
+		EEH_Template::display_template($template, $main_template_args);
978
+        
979
+		return;
980
+	}
981 981
     
982 982
     
983
-    protected function _get_datetime_row(
984
-        $dttrow,
985
-        EE_Datetime $dtt,
986
-        $datetime_tickets,
987
-        $all_tickets,
988
-        $default = false,
989
-        $all_dtts = array()
990
-    ) {
991
-        
992
-        $dtt_display_template_args = array(
993
-            'dtt_edit_row'             => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
994
-            'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets,
995
-                $all_tickets, $default),
996
-            'dtt_row'                  => $default ? 'DTTNUM' : $dttrow
997
-        );
998
-        $template                  = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
999
-        
1000
-        return EEH_Template::display_template($template, $dtt_display_template_args, true);
1001
-    }
983
+	protected function _get_datetime_row(
984
+		$dttrow,
985
+		EE_Datetime $dtt,
986
+		$datetime_tickets,
987
+		$all_tickets,
988
+		$default = false,
989
+		$all_dtts = array()
990
+	) {
991
+        
992
+		$dtt_display_template_args = array(
993
+			'dtt_edit_row'             => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
994
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets,
995
+				$all_tickets, $default),
996
+			'dtt_row'                  => $default ? 'DTTNUM' : $dttrow
997
+		);
998
+		$template                  = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
999
+        
1000
+		return EEH_Template::display_template($template, $dtt_display_template_args, true);
1001
+	}
1002 1002
     
1003 1003
     
1004
-    /**
1005
-     * This method is used to generate a dtt fields  edit row.
1006
-     * The same row is used to generate a row with valid DTT objects and the default row that is used as the
1007
-     * skeleton by the js.
1008
-     *
1009
-     * @param int           $dttrow                         The row number for the row being generated.
1010
-     * @param               mixed                           EE_Datetime|null $dtt      If not default row being
1011
-     *                                                                       generated, this must be a EE_Datetime
1012
-     *                                                                       object.
1013
-     * @param bool          $default                        Whether a default row is being generated or not.
1014
-     * @param EE_Datetime[] $all_dtts                       This is the array of all datetimes used in the editor.
1015
-     *
1016
-     * @return string Generated edit row.
1017
-     */
1018
-    protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts)
1019
-    {
1020
-        
1021
-        // if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true.
1022
-        $default = ! $dtt instanceof EE_Datetime ? true : false;
1023
-        
1024
-        $template_args = array(
1025
-            'dtt_row'              => $default ? 'DTTNUM' : $dttrow,
1026
-            'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
1027
-            'edit_dtt_expanded'    => '',
1028
-            //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
1029
-            'DTT_ID'               => $default ? '' : $dtt->ID(),
1030
-            'DTT_name'             => $default ? '' : $dtt->name(),
1031
-            'DTT_description'      => $default ? '' : $dtt->description(),
1032
-            'DTT_EVT_start'        => $default ? '' : $dtt->start_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1033
-            'DTT_EVT_end'          => $default ? '' : $dtt->end_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1034
-            'DTT_reg_limit'        => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
1035
-            'DTT_order'            => $default ? 'DTTNUM' : $dttrow,
1036
-            'dtt_sold'             => $default ? '0' : $dtt->get('DTT_sold'),
1037
-            'clone_icon'           => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
1038
-            'trash_icon'           => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
1039
-            'reg_list_url'         => $default || ! $dtt->event() instanceof \EE_Event
1040
-                ? ''
1041
-                : EE_Admin_Page::add_query_args_and_nonce(
1042
-                    array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()),
1043
-                    REG_ADMIN_URL
1044
-                )
1045
-        );
1046
-        
1047
-        $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
1048
-        
1049
-        //allow filtering of template args at this point.
1050
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args',
1051
-            $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
1052
-        
1053
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
1054
-        
1055
-        return EEH_Template::display_template($template, $template_args, true);
1056
-    }
1004
+	/**
1005
+	 * This method is used to generate a dtt fields  edit row.
1006
+	 * The same row is used to generate a row with valid DTT objects and the default row that is used as the
1007
+	 * skeleton by the js.
1008
+	 *
1009
+	 * @param int           $dttrow                         The row number for the row being generated.
1010
+	 * @param               mixed                           EE_Datetime|null $dtt      If not default row being
1011
+	 *                                                                       generated, this must be a EE_Datetime
1012
+	 *                                                                       object.
1013
+	 * @param bool          $default                        Whether a default row is being generated or not.
1014
+	 * @param EE_Datetime[] $all_dtts                       This is the array of all datetimes used in the editor.
1015
+	 *
1016
+	 * @return string Generated edit row.
1017
+	 */
1018
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts)
1019
+	{
1020
+        
1021
+		// if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true.
1022
+		$default = ! $dtt instanceof EE_Datetime ? true : false;
1023
+        
1024
+		$template_args = array(
1025
+			'dtt_row'              => $default ? 'DTTNUM' : $dttrow,
1026
+			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
1027
+			'edit_dtt_expanded'    => '',
1028
+			//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
1029
+			'DTT_ID'               => $default ? '' : $dtt->ID(),
1030
+			'DTT_name'             => $default ? '' : $dtt->name(),
1031
+			'DTT_description'      => $default ? '' : $dtt->description(),
1032
+			'DTT_EVT_start'        => $default ? '' : $dtt->start_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1033
+			'DTT_EVT_end'          => $default ? '' : $dtt->end_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1034
+			'DTT_reg_limit'        => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
1035
+			'DTT_order'            => $default ? 'DTTNUM' : $dttrow,
1036
+			'dtt_sold'             => $default ? '0' : $dtt->get('DTT_sold'),
1037
+			'clone_icon'           => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
1038
+			'trash_icon'           => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
1039
+			'reg_list_url'         => $default || ! $dtt->event() instanceof \EE_Event
1040
+				? ''
1041
+				: EE_Admin_Page::add_query_args_and_nonce(
1042
+					array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()),
1043
+					REG_ADMIN_URL
1044
+				)
1045
+		);
1046
+        
1047
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
1048
+        
1049
+		//allow filtering of template args at this point.
1050
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args',
1051
+			$template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
1052
+        
1053
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
1054
+        
1055
+		return EEH_Template::display_template($template, $template_args, true);
1056
+	}
1057 1057
     
1058 1058
     
1059
-    protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default)
1060
-    {
1061
-        
1062
-        $template_args = array(
1063
-            'dtt_row'                           => $default ? 'DTTNUM' : $dttrow,
1064
-            'event_datetimes_name'              => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
1065
-            'DTT_description'                   => $default ? '' : $dtt->description(),
1066
-            'datetime_tickets_list'             => $default ? '<li class="hidden"></li>' : '',
1067
-            'show_tickets_row'                  => ' style="display:none;"',
1068
-            //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
1069
-            'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime',
1070
-                $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false),
1071
-            //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
1072
-            'DTT_ID'                            => $default ? '' : $dtt->ID()
1073
-        );
1074
-        
1075
-        //need to setup the list items (but only if this isnt' a default skeleton setup)
1076
-        if ( ! $default) {
1077
-            $tktrow = 1;
1078
-            foreach ($all_tickets as $ticket) {
1079
-                $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow,
1080
-                    $dtt, $ticket, $datetime_tickets, $default);
1081
-                $tktrow++;
1082
-            }
1083
-        }
1084
-        
1085
-        //filter template args at this point
1086
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args',
1087
-            $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
1088
-        
1089
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1090
-        
1091
-        return EEH_Template::display_template($template, $template_args, true);
1092
-    }
1059
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default)
1060
+	{
1061
+        
1062
+		$template_args = array(
1063
+			'dtt_row'                           => $default ? 'DTTNUM' : $dttrow,
1064
+			'event_datetimes_name'              => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
1065
+			'DTT_description'                   => $default ? '' : $dtt->description(),
1066
+			'datetime_tickets_list'             => $default ? '<li class="hidden"></li>' : '',
1067
+			'show_tickets_row'                  => ' style="display:none;"',
1068
+			//$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
1069
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime',
1070
+				$this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false),
1071
+			//todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
1072
+			'DTT_ID'                            => $default ? '' : $dtt->ID()
1073
+		);
1074
+        
1075
+		//need to setup the list items (but only if this isnt' a default skeleton setup)
1076
+		if ( ! $default) {
1077
+			$tktrow = 1;
1078
+			foreach ($all_tickets as $ticket) {
1079
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow,
1080
+					$dtt, $ticket, $datetime_tickets, $default);
1081
+				$tktrow++;
1082
+			}
1083
+		}
1084
+        
1085
+		//filter template args at this point
1086
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args',
1087
+			$template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
1088
+        
1089
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1090
+        
1091
+		return EEH_Template::display_template($template, $template_args, true);
1092
+	}
1093 1093
     
1094 1094
     
1095
-    protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default)
1096
-    {
1097
-        $tktid    = ! empty($ticket) ? $ticket->ID() : 0;
1098
-        $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1099
-        
1100
-        $displayrow    = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1101
-        $template_args = array(
1102
-            'dtt_row'                 => $default ? 'DTTNUM' : $dttrow,
1103
-            'tkt_row'                 => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1104
-            'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1105
-            'ticket_selected'         => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1106
-            'TKT_name'                => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1107
-            'tkt_status_class'        => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1108
-        );
1109
-        
1110
-        //filter template args
1111
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args',
1112
-            $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1113
-        
1114
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1115
-        
1116
-        return EEH_Template::display_template($template, $template_args, true);
1117
-    }
1095
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default)
1096
+	{
1097
+		$tktid    = ! empty($ticket) ? $ticket->ID() : 0;
1098
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1099
+        
1100
+		$displayrow    = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1101
+		$template_args = array(
1102
+			'dtt_row'                 => $default ? 'DTTNUM' : $dttrow,
1103
+			'tkt_row'                 => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1104
+			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1105
+			'ticket_selected'         => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1106
+			'TKT_name'                => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1107
+			'tkt_status_class'        => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1108
+		);
1109
+        
1110
+		//filter template args
1111
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args',
1112
+			$template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1113
+        
1114
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1115
+        
1116
+		return EEH_Template::display_template($template, $template_args, true);
1117
+	}
1118 1118
     
1119 1119
     
1120
-    /**
1121
-     * This generates the ticket row for tickets.
1122
-     * This same method is used to generate both the actual rows and the js skeleton row (when default ==
1123
-     * true)
1124
-     *
1125
-     * @param int           $tktrow                          Represents the row number being generated.
1126
-     * @param               mixed                            null|EE_Ticket $ticket           If default then this will
1127
-     *                                                                      be null.
1128
-     * @param EE_Datetime[] $ticket_datetimes                Either an array of all datetimes on all tickets indexed by
1129
-     *                                                       each ticket or empty for  default
1130
-     * @param EE_Datetime[] $all_dtts                        All Datetimes on the event or empty for default.
1131
-     * @param bool          $default                         Whether default row being generated or not.
1132
-     * @param EE_Ticket[]   $all_tickets                     This is an array of all tickets attached to the event (or
1133
-     *                                                       empty in the case of defaults)
1134
-     *
1135
-     * @return [type] [description]
1136
-     */
1137
-    protected function _get_ticket_row(
1138
-        $tktrow,
1139
-        $ticket,
1140
-        $ticket_datetimes,
1141
-        $all_dtts,
1142
-        $default = false,
1143
-        $all_tickets = array()
1144
-    ) {
1145
-        
1146
-        //if $ticket is not an instance of EE_Ticket then force default to true.
1147
-        $default = ! $ticket instanceof EE_Ticket ? true : false;
1148
-        
1149
-        $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price',
1150
-            array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1151
-        
1152
-        //if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1153
-        //the object.  This is done by not including any query_params.
1154
-        if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1155
-            $prices = $ticket->get_many_related('Price');
1156
-        }
1157
-        
1158
-        // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1159
-        $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? true : false;
1160
-        
1161
-        $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1162
-        
1163
-        $ticket_subtotal  = $default ? 0 : $ticket->get_ticket_subtotal();
1164
-        $base_price       = $default ? null : $ticket->base_price();
1165
-        $count_price_mods = EEM_Price::instance()->get_all_default_prices(true);
1166
-        
1167
-        //breaking out complicated condition for ticket_status
1168
-        if ($default) {
1169
-            $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1170
-        } else {
1171
-            $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1172
-        }
1173
-        
1174
-        //breaking out complicated condition for TKT_taxable
1175
-        if ($default) {
1176
-            $TKT_taxable = '';
1177
-        } else {
1178
-            $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
1179
-        }
1180
-        
1181
-        
1182
-        $template_args = array(
1183
-            'tkt_row'                       => $default ? 'TICKETNUM' : $tktrow,
1184
-            'TKT_order'                     => $default ? 'TICKETNUM' : $tktrow,
1185
-            //on initial page load this will always be the correct order.
1186
-            'tkt_status_class'              => $ticket_status_class,
1187
-            'display_edit_tkt_row'          => ' style="display:none;"',
1188
-            'edit_tkt_expanded'             => '',
1189
-            'edit_tickets_name'             => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1190
-            'TKT_name'                      => $default ? '' : $ticket->get('TKT_name'),
1191
-            'TKT_start_date'                => $default ? '' : $ticket->get_date('TKT_start_date',
1192
-                $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1193
-            'TKT_end_date'                  => $default ? '' : $ticket->get_date('TKT_end_date',
1194
-                $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1195
-            'TKT_status'                    => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, false,
1196
-                'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, false,
1197
-                'sentence') : $ticket->ticket_status(true),
1198
-            'TKT_price'                     => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(),
1199
-                false, false),
1200
-            'TKT_price_code'                => EE_Registry::instance()->CFG->currency->code,
1201
-            'TKT_price_amount'              => $default ? 0 : $ticket_subtotal,
1202
-            'TKT_qty'                       => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1203
-            'TKT_qty_for_input'             => $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1204
-            'TKT_uses'                      => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1205
-            'TKT_min'                       => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1206
-            'TKT_max'                       => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1207
-            'TKT_sold'                      => $default ? 0 : $ticket->tickets_sold('ticket'),
1208
-            'TKT_registrations'             => $default ? 0 : $ticket->count_registrations(array(
1209
-                array(
1210
-                    'STS_ID' => array(
1211
-                        '!=',
1212
-                        EEM_Registration::status_id_incomplete
1213
-                    )
1214
-                )
1215
-            )),
1216
-            'TKT_ID'                        => $default ? 0 : $ticket->get('TKT_ID'),
1217
-            'TKT_description'               => $default ? '' : $ticket->get('TKT_description'),
1218
-            'TKT_is_default'                => $default ? 0 : $ticket->get('TKT_is_default'),
1219
-            'TKT_required'                  => $default ? 0 : $ticket->required(),
1220
-            'TKT_is_default_selector'       => '',
1221
-            'ticket_price_rows'             => '',
1222
-            'TKT_base_price'                => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount',
1223
-                'localized_float'),
1224
-            'TKT_base_price_ID'             => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1225
-            'show_price_modifier'           => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1226
-            'show_price_mod_button'         => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1227
-            'total_price_rows'              => count($prices) > 1 ? count($prices) : 1,
1228
-            'ticket_datetimes_list'         => $default ? '<li class="hidden"></li>' : '',
1229
-            'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1230
-            'ticket_datetime_rows'          => $default ? '' : implode(',', $tkt_dtts),
1231
-            'existing_ticket_price_ids'     => $default,
1232
-            '',
1233
-            implode(',', array_keys($prices)),
1234
-            'ticket_template_id'            => $default ? 0 : $ticket->get('TTM_ID'),
1235
-            'TKT_taxable'                   => $TKT_taxable,
1236
-            'display_subtotal'              => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1237
-            'price_currency_symbol'         => EE_Registry::instance()->CFG->currency->sign,
1238
-            'TKT_subtotal_amount_display'   => EEH_Template::format_currency($ticket_subtotal, false, false),
1239
-            'TKT_subtotal_amount'           => $ticket_subtotal,
1240
-            'tax_rows'                      => $this->_get_tax_rows($tktrow, $ticket),
1241
-            'disabled'                      => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? true : false,
1242
-            'ticket_archive_class'          => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1243
-            'trash_icon'                    => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1244
-            'clone_icon'                    => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1245
-        );
1246
-        
1247
-        $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1248
-        
1249
-        //handle rows that should NOT be empty
1250
-        if (empty($template_args['TKT_start_date'])) {
1251
-            //if empty then the start date will be now.
1252
-            $template_args['TKT_start_date']   = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'],
1253
-                current_time('timestamp'));
1254
-            $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1255
-        }
1256
-        
1257
-        if (empty($template_args['TKT_end_date'])) {
1120
+	/**
1121
+	 * This generates the ticket row for tickets.
1122
+	 * This same method is used to generate both the actual rows and the js skeleton row (when default ==
1123
+	 * true)
1124
+	 *
1125
+	 * @param int           $tktrow                          Represents the row number being generated.
1126
+	 * @param               mixed                            null|EE_Ticket $ticket           If default then this will
1127
+	 *                                                                      be null.
1128
+	 * @param EE_Datetime[] $ticket_datetimes                Either an array of all datetimes on all tickets indexed by
1129
+	 *                                                       each ticket or empty for  default
1130
+	 * @param EE_Datetime[] $all_dtts                        All Datetimes on the event or empty for default.
1131
+	 * @param bool          $default                         Whether default row being generated or not.
1132
+	 * @param EE_Ticket[]   $all_tickets                     This is an array of all tickets attached to the event (or
1133
+	 *                                                       empty in the case of defaults)
1134
+	 *
1135
+	 * @return [type] [description]
1136
+	 */
1137
+	protected function _get_ticket_row(
1138
+		$tktrow,
1139
+		$ticket,
1140
+		$ticket_datetimes,
1141
+		$all_dtts,
1142
+		$default = false,
1143
+		$all_tickets = array()
1144
+	) {
1145
+        
1146
+		//if $ticket is not an instance of EE_Ticket then force default to true.
1147
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1148
+        
1149
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price',
1150
+			array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1151
+        
1152
+		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1153
+		//the object.  This is done by not including any query_params.
1154
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1155
+			$prices = $ticket->get_many_related('Price');
1156
+		}
1157
+        
1158
+		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1159
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? true : false;
1160
+        
1161
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1162
+        
1163
+		$ticket_subtotal  = $default ? 0 : $ticket->get_ticket_subtotal();
1164
+		$base_price       = $default ? null : $ticket->base_price();
1165
+		$count_price_mods = EEM_Price::instance()->get_all_default_prices(true);
1166
+        
1167
+		//breaking out complicated condition for ticket_status
1168
+		if ($default) {
1169
+			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1170
+		} else {
1171
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1172
+		}
1173
+        
1174
+		//breaking out complicated condition for TKT_taxable
1175
+		if ($default) {
1176
+			$TKT_taxable = '';
1177
+		} else {
1178
+			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
1179
+		}
1180
+        
1181
+        
1182
+		$template_args = array(
1183
+			'tkt_row'                       => $default ? 'TICKETNUM' : $tktrow,
1184
+			'TKT_order'                     => $default ? 'TICKETNUM' : $tktrow,
1185
+			//on initial page load this will always be the correct order.
1186
+			'tkt_status_class'              => $ticket_status_class,
1187
+			'display_edit_tkt_row'          => ' style="display:none;"',
1188
+			'edit_tkt_expanded'             => '',
1189
+			'edit_tickets_name'             => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1190
+			'TKT_name'                      => $default ? '' : $ticket->get('TKT_name'),
1191
+			'TKT_start_date'                => $default ? '' : $ticket->get_date('TKT_start_date',
1192
+				$this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1193
+			'TKT_end_date'                  => $default ? '' : $ticket->get_date('TKT_end_date',
1194
+				$this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1195
+			'TKT_status'                    => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, false,
1196
+				'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, false,
1197
+				'sentence') : $ticket->ticket_status(true),
1198
+			'TKT_price'                     => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(),
1199
+				false, false),
1200
+			'TKT_price_code'                => EE_Registry::instance()->CFG->currency->code,
1201
+			'TKT_price_amount'              => $default ? 0 : $ticket_subtotal,
1202
+			'TKT_qty'                       => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1203
+			'TKT_qty_for_input'             => $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1204
+			'TKT_uses'                      => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1205
+			'TKT_min'                       => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1206
+			'TKT_max'                       => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1207
+			'TKT_sold'                      => $default ? 0 : $ticket->tickets_sold('ticket'),
1208
+			'TKT_registrations'             => $default ? 0 : $ticket->count_registrations(array(
1209
+				array(
1210
+					'STS_ID' => array(
1211
+						'!=',
1212
+						EEM_Registration::status_id_incomplete
1213
+					)
1214
+				)
1215
+			)),
1216
+			'TKT_ID'                        => $default ? 0 : $ticket->get('TKT_ID'),
1217
+			'TKT_description'               => $default ? '' : $ticket->get('TKT_description'),
1218
+			'TKT_is_default'                => $default ? 0 : $ticket->get('TKT_is_default'),
1219
+			'TKT_required'                  => $default ? 0 : $ticket->required(),
1220
+			'TKT_is_default_selector'       => '',
1221
+			'ticket_price_rows'             => '',
1222
+			'TKT_base_price'                => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount',
1223
+				'localized_float'),
1224
+			'TKT_base_price_ID'             => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1225
+			'show_price_modifier'           => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1226
+			'show_price_mod_button'         => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1227
+			'total_price_rows'              => count($prices) > 1 ? count($prices) : 1,
1228
+			'ticket_datetimes_list'         => $default ? '<li class="hidden"></li>' : '',
1229
+			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1230
+			'ticket_datetime_rows'          => $default ? '' : implode(',', $tkt_dtts),
1231
+			'existing_ticket_price_ids'     => $default,
1232
+			'',
1233
+			implode(',', array_keys($prices)),
1234
+			'ticket_template_id'            => $default ? 0 : $ticket->get('TTM_ID'),
1235
+			'TKT_taxable'                   => $TKT_taxable,
1236
+			'display_subtotal'              => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1237
+			'price_currency_symbol'         => EE_Registry::instance()->CFG->currency->sign,
1238
+			'TKT_subtotal_amount_display'   => EEH_Template::format_currency($ticket_subtotal, false, false),
1239
+			'TKT_subtotal_amount'           => $ticket_subtotal,
1240
+			'tax_rows'                      => $this->_get_tax_rows($tktrow, $ticket),
1241
+			'disabled'                      => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? true : false,
1242
+			'ticket_archive_class'          => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1243
+			'trash_icon'                    => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1244
+			'clone_icon'                    => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1245
+		);
1246
+        
1247
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1248
+        
1249
+		//handle rows that should NOT be empty
1250
+		if (empty($template_args['TKT_start_date'])) {
1251
+			//if empty then the start date will be now.
1252
+			$template_args['TKT_start_date']   = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'],
1253
+				current_time('timestamp'));
1254
+			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1255
+		}
1256
+        
1257
+		if (empty($template_args['TKT_end_date'])) {
1258 1258
             
1259
-            //get the earliest datetime (if present);
1260
-            $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime',
1261
-                array('order_by' => array('DTT_EVT_start' => 'ASC'))) : null;
1259
+			//get the earliest datetime (if present);
1260
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime',
1261
+				array('order_by' => array('DTT_EVT_start' => 'ASC'))) : null;
1262 1262
             
1263
-            if ( ! empty($earliest_dtt)) {
1264
-                $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start',
1265
-                    $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
1266
-            } else {
1267
-                //default so let's just use what's been set for the default date-time which is 30 days from now.
1268
-                $template_args['TKT_end_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'],
1269
-                    mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1270
-            }
1271
-            $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1272
-        }
1273
-        
1274
-        //generate ticket_datetime items
1275
-        if ( ! $default) {
1276
-            $dttrow = 1;
1277
-            foreach ($all_dtts as $dtt) {
1278
-                $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt,
1279
-                    $ticket, $ticket_datetimes, $default);
1280
-                $dttrow++;
1281
-            }
1282
-        }
1283
-        
1284
-        $prcrow = 1;
1285
-        foreach ($prices as $price) {
1286
-            if ($price->is_base_price()) {
1287
-                $prcrow++;
1288
-                continue;
1289
-            }
1290
-            $show_trash  = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? false : true;
1291
-            $show_create = count($prices) > 1 && count($prices) !== $prcrow ? false : true;
1292
-            $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default,
1293
-                $ticket, $show_trash, $show_create);
1294
-            $prcrow++;
1295
-        }
1296
-        
1297
-        //filter $template_args
1298
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args',
1299
-            $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets,
1300
-            $this->_is_creating_event);
1301
-        
1302
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1303
-        
1304
-        return EEH_Template::display_template($template, $template_args, true);
1305
-    }
1263
+			if ( ! empty($earliest_dtt)) {
1264
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start',
1265
+					$this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
1266
+			} else {
1267
+				//default so let's just use what's been set for the default date-time which is 30 days from now.
1268
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'],
1269
+					mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1270
+			}
1271
+			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1272
+		}
1273
+        
1274
+		//generate ticket_datetime items
1275
+		if ( ! $default) {
1276
+			$dttrow = 1;
1277
+			foreach ($all_dtts as $dtt) {
1278
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt,
1279
+					$ticket, $ticket_datetimes, $default);
1280
+				$dttrow++;
1281
+			}
1282
+		}
1283
+        
1284
+		$prcrow = 1;
1285
+		foreach ($prices as $price) {
1286
+			if ($price->is_base_price()) {
1287
+				$prcrow++;
1288
+				continue;
1289
+			}
1290
+			$show_trash  = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? false : true;
1291
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? false : true;
1292
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default,
1293
+				$ticket, $show_trash, $show_create);
1294
+			$prcrow++;
1295
+		}
1296
+        
1297
+		//filter $template_args
1298
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args',
1299
+			$template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets,
1300
+			$this->_is_creating_event);
1301
+        
1302
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1303
+        
1304
+		return EEH_Template::display_template($template, $template_args, true);
1305
+	}
1306 1306
     
1307 1307
     
1308
-    protected function _get_tax_rows($tktrow, $ticket)
1309
-    {
1310
-        $tax_rows      = '';
1311
-        $template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1312
-        $template_args = array();
1313
-        $taxes         = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1314
-        foreach ($taxes as $tax) {
1315
-            $tax_added     = $this->_get_tax_added($tax, $ticket);
1316
-            $template_args = array(
1317
-                'display_tax'       => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1318
-                'tax_id'            => $tax->ID(),
1319
-                'tkt_row'           => $tktrow,
1320
-                'tax_label'         => $tax->get('PRC_name'),
1321
-                'tax_added'         => $tax_added,
1322
-                'tax_added_display' => EEH_Template::format_currency($tax_added, false, false),
1323
-                'tax_amount'        => $tax->get('PRC_amount')
1324
-            );
1325
-            $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args',
1326
-                $template_args, $tktrow, $ticket, $this->_is_creating_event);
1327
-            $tax_rows .= EEH_Template::display_template($template, $template_args, true);
1328
-        }
1329
-        
1330
-        
1331
-        return $tax_rows;
1332
-    }
1308
+	protected function _get_tax_rows($tktrow, $ticket)
1309
+	{
1310
+		$tax_rows      = '';
1311
+		$template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1312
+		$template_args = array();
1313
+		$taxes         = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1314
+		foreach ($taxes as $tax) {
1315
+			$tax_added     = $this->_get_tax_added($tax, $ticket);
1316
+			$template_args = array(
1317
+				'display_tax'       => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1318
+				'tax_id'            => $tax->ID(),
1319
+				'tkt_row'           => $tktrow,
1320
+				'tax_label'         => $tax->get('PRC_name'),
1321
+				'tax_added'         => $tax_added,
1322
+				'tax_added_display' => EEH_Template::format_currency($tax_added, false, false),
1323
+				'tax_amount'        => $tax->get('PRC_amount')
1324
+			);
1325
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args',
1326
+				$template_args, $tktrow, $ticket, $this->_is_creating_event);
1327
+			$tax_rows .= EEH_Template::display_template($template, $template_args, true);
1328
+		}
1329
+        
1330
+        
1331
+		return $tax_rows;
1332
+	}
1333 1333
     
1334 1334
     
1335
-    protected function _get_tax_added(EE_Price $tax, $ticket)
1336
-    {
1337
-        $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1335
+	protected function _get_tax_added(EE_Price $tax, $ticket)
1336
+	{
1337
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1338 1338
         
1339
-        return $subtotal * $tax->get('PRC_amount') / 100;
1340
-    }
1339
+		return $subtotal * $tax->get('PRC_amount') / 100;
1340
+	}
1341 1341
     
1342 1342
     
1343
-    protected function _get_ticket_price_row(
1344
-        $tktrow,
1345
-        $prcrow,
1346
-        $price,
1347
-        $default,
1348
-        $ticket,
1349
-        $show_trash = true,
1350
-        $show_create = true
1351
-    ) {
1352
-        $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false;
1353
-        $template_args = array(
1354
-            'tkt_row'               => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1355
-            'PRC_order'             => $default && empty($price) ? 'PRICENUM' : $prcrow,
1356
-            'edit_prices_name'      => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1357
-            'price_type_selector'   => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow,
1358
-                $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1359
-            'PRC_ID'                => $default && empty($price) ? 0 : $price->ID(),
1360
-            'PRC_is_default'        => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1361
-            'PRC_name'              => $default && empty($price) ? '' : $price->get('PRC_name'),
1362
-            'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1363
-            'show_plus_or_minus'    => $default && empty($price) ? '' : ' style="display:none;"',
1364
-            'show_plus'             => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1365
-            'show_minus'            => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1366
-            'show_currency_symbol'  => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1367
-            'PRC_amount'            => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount',
1368
-                'localized_float'),
1369
-            'show_percentage'       => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1370
-            'show_trash_icon'       => $show_trash ? '' : ' style="display:none;"',
1371
-            'show_create_button'    => $show_create ? '' : ' style="display:none;"',
1372
-            'PRC_desc'              => $default && empty($price) ? '' : $price->get('PRC_desc'),
1373
-            'disabled'              => ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false
1374
-        );
1375
-        
1376
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args',
1377
-            $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create,
1378
-            $this->_is_creating_event);
1379
-        
1380
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1381
-        
1382
-        return EEH_Template::display_template($template, $template_args, true);
1383
-    }
1343
+	protected function _get_ticket_price_row(
1344
+		$tktrow,
1345
+		$prcrow,
1346
+		$price,
1347
+		$default,
1348
+		$ticket,
1349
+		$show_trash = true,
1350
+		$show_create = true
1351
+	) {
1352
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false;
1353
+		$template_args = array(
1354
+			'tkt_row'               => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1355
+			'PRC_order'             => $default && empty($price) ? 'PRICENUM' : $prcrow,
1356
+			'edit_prices_name'      => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1357
+			'price_type_selector'   => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow,
1358
+				$price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1359
+			'PRC_ID'                => $default && empty($price) ? 0 : $price->ID(),
1360
+			'PRC_is_default'        => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1361
+			'PRC_name'              => $default && empty($price) ? '' : $price->get('PRC_name'),
1362
+			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1363
+			'show_plus_or_minus'    => $default && empty($price) ? '' : ' style="display:none;"',
1364
+			'show_plus'             => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1365
+			'show_minus'            => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1366
+			'show_currency_symbol'  => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1367
+			'PRC_amount'            => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount',
1368
+				'localized_float'),
1369
+			'show_percentage'       => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1370
+			'show_trash_icon'       => $show_trash ? '' : ' style="display:none;"',
1371
+			'show_create_button'    => $show_create ? '' : ' style="display:none;"',
1372
+			'PRC_desc'              => $default && empty($price) ? '' : $price->get('PRC_desc'),
1373
+			'disabled'              => ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false
1374
+		);
1375
+        
1376
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args',
1377
+			$template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create,
1378
+			$this->_is_creating_event);
1379
+        
1380
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1381
+        
1382
+		return EEH_Template::display_template($template, $template_args, true);
1383
+	}
1384 1384
     
1385 1385
     
1386
-    protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = false)
1387
-    {
1388
-        if ($price->is_base_price()) {
1389
-            return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1390
-        } else {
1391
-            return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1392
-        }
1393
-        
1394
-    }
1386
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = false)
1387
+	{
1388
+		if ($price->is_base_price()) {
1389
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1390
+		} else {
1391
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1392
+		}
1393
+        
1394
+	}
1395 1395
     
1396 1396
     
1397
-    protected function _get_base_price_template($tktrow, $prcrow, $price, $default)
1398
-    {
1399
-        $template_args = array(
1400
-            'tkt_row'                   => $default ? 'TICKETNUM' : $tktrow,
1401
-            'PRC_order'                 => $default && empty($price) ? 'PRICENUM' : $prcrow,
1402
-            'PRT_ID'                    => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1403
-            'PRT_name'                  => __('Price', 'event_espresso'),
1404
-            'price_selected_operator'   => '+',
1405
-            'price_selected_is_percent' => 0
1406
-        );
1407
-        $template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1408
-        
1409
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args',
1410
-            $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1411
-        
1412
-        return EEH_Template::display_template($template, $template_args, true);
1413
-    }
1397
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default)
1398
+	{
1399
+		$template_args = array(
1400
+			'tkt_row'                   => $default ? 'TICKETNUM' : $tktrow,
1401
+			'PRC_order'                 => $default && empty($price) ? 'PRICENUM' : $prcrow,
1402
+			'PRT_ID'                    => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1403
+			'PRT_name'                  => __('Price', 'event_espresso'),
1404
+			'price_selected_operator'   => '+',
1405
+			'price_selected_is_percent' => 0
1406
+		);
1407
+		$template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1408
+        
1409
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args',
1410
+			$template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1411
+        
1412
+		return EEH_Template::display_template($template, $template_args, true);
1413
+	}
1414 1414
     
1415 1415
     
1416
-    protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = false)
1417
-    {
1418
-        $select_name                = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1419
-        $price_types                = EE_Registry::instance()->load_model('Price_Type')->get_all(array(
1420
-            array(
1421
-                'OR' => array(
1422
-                    'PBT_ID'  => '2',
1423
-                    'PBT_ID*' => '3'
1424
-                )
1425
-            )
1426
-        ));
1427
-        $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1428
-        $all_price_types            = $default && empty($price) ? array(
1429
-            array(
1430
-                'id'   => 0,
1431
-                'text' => __('Select Modifier', 'event_espresso')
1432
-            )
1433
-        ) : array();
1434
-        $selected_price_type_id     = $default && empty($price) ? 0 : $price->type();
1435
-        $price_option_spans         = '';
1436
-        //setup pricetypes for selector
1437
-        foreach ($price_types as $price_type) {
1438
-            $all_price_types[] = array(
1439
-                'id'   => $price_type->ID(),
1440
-                'text' => $price_type->get('PRT_name'),
1441
-            );
1416
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = false)
1417
+	{
1418
+		$select_name                = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1419
+		$price_types                = EE_Registry::instance()->load_model('Price_Type')->get_all(array(
1420
+			array(
1421
+				'OR' => array(
1422
+					'PBT_ID'  => '2',
1423
+					'PBT_ID*' => '3'
1424
+				)
1425
+			)
1426
+		));
1427
+		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1428
+		$all_price_types            = $default && empty($price) ? array(
1429
+			array(
1430
+				'id'   => 0,
1431
+				'text' => __('Select Modifier', 'event_espresso')
1432
+			)
1433
+		) : array();
1434
+		$selected_price_type_id     = $default && empty($price) ? 0 : $price->type();
1435
+		$price_option_spans         = '';
1436
+		//setup pricetypes for selector
1437
+		foreach ($price_types as $price_type) {
1438
+			$all_price_types[] = array(
1439
+				'id'   => $price_type->ID(),
1440
+				'text' => $price_type->get('PRT_name'),
1441
+			);
1442 1442
             
1443
-            //while we're in the loop let's setup the option spans used by js
1444
-            $spanargs = array(
1445
-                'PRT_ID'         => $price_type->ID(),
1446
-                'PRT_operator'   => $price_type->is_discount() ? '-' : '+',
1447
-                'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1448
-            );
1449
-            $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, true);
1450
-        }
1451
-        
1452
-        $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1453
-        $main_name     = $select_name;
1454
-        $select_name   = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1455
-        
1456
-        $template_args = array(
1457
-            'tkt_row'                   => $default ? 'TICKETNUM' : $tktrow,
1458
-            'PRC_order'                 => $default && empty($price) ? 'PRICENUM' : $prcrow,
1459
-            'price_modifier_selector'   => EEH_Form_Fields::select_input($select_name, $all_price_types,
1460
-                $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1461
-            'main_name'                 => $main_name,
1462
-            'selected_price_type_id'    => $selected_price_type_id,
1463
-            'price_option_spans'        => $price_option_spans,
1464
-            'price_selected_operator'   => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1465
-            'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1466
-            'disabled'                  => $disabled
1467
-        );
1468
-        
1469
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args',
1470
-            $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1471
-        
1472
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1473
-        
1474
-        return EEH_Template::display_template($template, $template_args, true);
1475
-    }
1443
+			//while we're in the loop let's setup the option spans used by js
1444
+			$spanargs = array(
1445
+				'PRT_ID'         => $price_type->ID(),
1446
+				'PRT_operator'   => $price_type->is_discount() ? '-' : '+',
1447
+				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1448
+			);
1449
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, true);
1450
+		}
1451
+        
1452
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1453
+		$main_name     = $select_name;
1454
+		$select_name   = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1455
+        
1456
+		$template_args = array(
1457
+			'tkt_row'                   => $default ? 'TICKETNUM' : $tktrow,
1458
+			'PRC_order'                 => $default && empty($price) ? 'PRICENUM' : $prcrow,
1459
+			'price_modifier_selector'   => EEH_Form_Fields::select_input($select_name, $all_price_types,
1460
+				$selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1461
+			'main_name'                 => $main_name,
1462
+			'selected_price_type_id'    => $selected_price_type_id,
1463
+			'price_option_spans'        => $price_option_spans,
1464
+			'price_selected_operator'   => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1465
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1466
+			'disabled'                  => $disabled
1467
+		);
1468
+        
1469
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args',
1470
+			$template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1471
+        
1472
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1473
+        
1474
+		return EEH_Template::display_template($template, $template_args, true);
1475
+	}
1476 1476
     
1477 1477
     
1478
-    protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default)
1479
-    {
1480
-        $dttid         = ! empty($dtt) ? $dtt->ID() : 0;
1481
-        $displayrow    = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1482
-        $tkt_dtts      = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1483
-        $template_args = array(
1484
-            'dtt_row'                  => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1485
-            'tkt_row'                  => $default ? 'TICKETNUM' : $tktrow,
1486
-            'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1487
-            'ticket_datetime_checked'  => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1488
-            'DTT_name'                 => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(true),
1489
-            'tkt_status_class'         => '',
1490
-        );
1491
-        
1492
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args',
1493
-            $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1494
-        $template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1495
-        
1496
-        return EEH_Template::display_template($template, $template_args, true);
1497
-    }
1478
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default)
1479
+	{
1480
+		$dttid         = ! empty($dtt) ? $dtt->ID() : 0;
1481
+		$displayrow    = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1482
+		$tkt_dtts      = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1483
+		$template_args = array(
1484
+			'dtt_row'                  => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1485
+			'tkt_row'                  => $default ? 'TICKETNUM' : $tktrow,
1486
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1487
+			'ticket_datetime_checked'  => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1488
+			'DTT_name'                 => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(true),
1489
+			'tkt_status_class'         => '',
1490
+		);
1491
+        
1492
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args',
1493
+			$template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1494
+		$template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1495
+        
1496
+		return EEH_Template::display_template($template, $template_args, true);
1497
+	}
1498 1498
     
1499 1499
     
1500
-    protected function _get_ticket_js_structure($all_dtts, $all_tickets)
1501
-    {
1502
-        $template_args = array(
1503
-            'default_datetime_edit_row'                => $this->_get_dtt_edit_row('DTTNUM', null, true, $all_dtts),
1504
-            'default_ticket_row'                       => $this->_get_ticket_row('TICKETNUM', null, array(), array(),
1505
-                true),
1506
-            'default_price_row'                        => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', null,
1507
-                true, null),
1508
-            'default_price_rows'                       => '',
1509
-            'default_base_price_amount'                => 0,
1510
-            'default_base_price_name'                  => '',
1511
-            'default_base_price_description'           => '',
1512
-            'default_price_modifier_selector_row'      => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM',
1513
-                null, true),
1514
-            'default_available_tickets_for_datetime'   => $this->_get_dtt_attached_tickets_row('DTTNUM', null, array(),
1515
-                array(), true),
1516
-            'existing_available_datetime_tickets_list' => '',
1517
-            'existing_available_ticket_datetimes_list' => '',
1518
-            'new_available_datetime_ticket_list_item'  => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM',
1519
-                null, null, array(), true),
1520
-            'new_available_ticket_datetime_list_item'  => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM',
1521
-                null, null, array(), true)
1522
-        );
1523
-        
1524
-        $tktrow = 1;
1525
-        foreach ($all_tickets as $ticket) {
1526
-            $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM',
1527
-                $tktrow, null, $ticket, array(), true);
1528
-            $tktrow++;
1529
-        }
1530
-        
1531
-        
1532
-        $dttrow = 1;
1533
-        foreach ($all_dtts as $dtt) {
1534
-            $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow,
1535
-                'TICKETNUM', $dtt, null, array(), true);
1536
-            $dttrow++;
1537
-        }
1538
-        
1539
-        $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1540
-        $prcrow         = 1;
1541
-        foreach ($default_prices as $price) {
1542
-            if ($price->is_base_price()) {
1543
-                $template_args['default_base_price_amount']      = $price->get_pretty('PRC_amount', 'localized_float');
1544
-                $template_args['default_base_price_name']        = $price->get('PRC_name');
1545
-                $template_args['default_base_price_description'] = $price->get('PRC_desc');
1546
-                $prcrow++;
1547
-                continue;
1548
-            }
1549
-            $show_trash  = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? false : true;
1550
-            $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? false : true;
1551
-            $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, true,
1552
-                null, $show_trash, $show_create);
1553
-            $prcrow++;
1554
-        }
1555
-        
1556
-        $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args',
1557
-            $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1558
-        
1559
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1560
-        
1561
-        return EEH_Template::display_template($template, $template_args, true);
1562
-    }
1500
+	protected function _get_ticket_js_structure($all_dtts, $all_tickets)
1501
+	{
1502
+		$template_args = array(
1503
+			'default_datetime_edit_row'                => $this->_get_dtt_edit_row('DTTNUM', null, true, $all_dtts),
1504
+			'default_ticket_row'                       => $this->_get_ticket_row('TICKETNUM', null, array(), array(),
1505
+				true),
1506
+			'default_price_row'                        => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', null,
1507
+				true, null),
1508
+			'default_price_rows'                       => '',
1509
+			'default_base_price_amount'                => 0,
1510
+			'default_base_price_name'                  => '',
1511
+			'default_base_price_description'           => '',
1512
+			'default_price_modifier_selector_row'      => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM',
1513
+				null, true),
1514
+			'default_available_tickets_for_datetime'   => $this->_get_dtt_attached_tickets_row('DTTNUM', null, array(),
1515
+				array(), true),
1516
+			'existing_available_datetime_tickets_list' => '',
1517
+			'existing_available_ticket_datetimes_list' => '',
1518
+			'new_available_datetime_ticket_list_item'  => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM',
1519
+				null, null, array(), true),
1520
+			'new_available_ticket_datetime_list_item'  => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM',
1521
+				null, null, array(), true)
1522
+		);
1523
+        
1524
+		$tktrow = 1;
1525
+		foreach ($all_tickets as $ticket) {
1526
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM',
1527
+				$tktrow, null, $ticket, array(), true);
1528
+			$tktrow++;
1529
+		}
1530
+        
1531
+        
1532
+		$dttrow = 1;
1533
+		foreach ($all_dtts as $dtt) {
1534
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow,
1535
+				'TICKETNUM', $dtt, null, array(), true);
1536
+			$dttrow++;
1537
+		}
1538
+        
1539
+		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1540
+		$prcrow         = 1;
1541
+		foreach ($default_prices as $price) {
1542
+			if ($price->is_base_price()) {
1543
+				$template_args['default_base_price_amount']      = $price->get_pretty('PRC_amount', 'localized_float');
1544
+				$template_args['default_base_price_name']        = $price->get('PRC_name');
1545
+				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1546
+				$prcrow++;
1547
+				continue;
1548
+			}
1549
+			$show_trash  = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? false : true;
1550
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? false : true;
1551
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, true,
1552
+				null, $show_trash, $show_create);
1553
+			$prcrow++;
1554
+		}
1555
+        
1556
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args',
1557
+			$template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1558
+        
1559
+		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1560
+        
1561
+		return EEH_Template::display_template($template, $template_args, true);
1562
+	}
1563 1563
     
1564 1564
     
1565 1565
 } //end class espresso_events_Pricing_Hooks
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 'context'    => 'normal'
74 74
             ),
75 75
         
76
-        );/**/
76
+        ); /**/
77 77
         
78 78
         $this->_remove_metaboxes = array(
79 79
             0 => array(
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
         $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
104 104
         
105 105
         //validate format strings
106
-        $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
106
+        $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
107 107
         if (is_array($format_validation)) {
108
-            $msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:',
108
+            $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:',
109 109
                     'event_espresso'),
110
-                    $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>';
110
+                    $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
111 111
             foreach ($format_validation as $error) {
112
-                $msg .= '<li>' . $error . '</li>';
112
+                $msg .= '<li>'.$error.'</li>';
113 113
             }
114
-            $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s',
115
-                    'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>';
114
+            $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s',
115
+                    'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
116 116
             EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
117 117
             $this->_date_format_strings = array(
118 118
                 'date' => 'Y-m-d',
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
         $this->_scripts_styles = array(
125 125
             'registers'   => array(
126 126
                 'ee-tickets-datetimes-css' => array(
127
-                    'url'  => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
127
+                    'url'  => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
128 128
                     'type' => 'css'
129 129
                 ),
130 130
                 'ee-dtt-ticket-metabox'    => array(
131
-                    'url'     => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
131
+                    'url'     => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
132 132
                     'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
133 133
                 )
134 134
             ),
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
                             'event_espresso'),
148 148
                         'after_warning'           => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.',
149 149
                             'event_espresso'),
150
-                        'cancel_button'           => '<button class="button-secondary ee-modal-cancel">' . __('Cancel',
151
-                                'event_espresso') . '</button>',
150
+                        'cancel_button'           => '<button class="button-secondary ee-modal-cancel">'.__('Cancel',
151
+                                'event_espresso').'</button>',
152 152
                         'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.',
153 153
                             'event_espresso'),
154 154
                         'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.',
155 155
                             'event_espresso'),
156
-                        'dismiss_button'          => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss',
157
-                                'event_espresso') . '</button>'
156
+                        'dismiss_button'          => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss',
157
+                                'event_espresso').'</button>'
158 158
                     ),
159 159
                     'DTT_ERROR_MSG'         => array(
160 160
                         'no_ticket_name' => __('General Admission', 'event_espresso'),
161
-                        'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss',
162
-                                'event_espresso') . '</button></div>'
161
+                        'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss',
162
+                                'event_espresso').'</button></div>'
163 163
                     ),
164 164
                     'DTT_OVERSELL_WARNING'  => array(
165 165
                         'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                     ),
170 170
                     'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'],
171 171
                         $this->_date_format_strings['time']),
172
-                    'DTT_START_OF_WEEK'     => array('dayValue' => (int)get_option('start_of_week'))
172
+                    'DTT_START_OF_WEEK'     => array('dayValue' => (int) get_option('start_of_week'))
173 173
                 )
174 174
             )
175 175
         );
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
         
230 230
         foreach ($data['edit_event_datetimes'] as $row => $dtt) {
231 231
             //trim all values to ensure any excess whitespace is removed.
232
-            $dtt                = array_map(
233
-                function ($datetime_data) {
232
+            $dtt = array_map(
233
+                function($datetime_data) {
234 234
                     return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
235 235
                 },
236 236
                 $dtt
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             
367 367
             // trim inputs to ensure any excess whitespace is removed.
368 368
             $tkt = array_map(
369
-                function ($ticket_data) {
369
+                function($ticket_data) {
370 370
                     return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
371 371
                 },
372 372
                 $tkt
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             
375 375
             //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
376 376
             //note incoming ['TKT_price'] value is already in standard notation (via js).
377
-            $ticket_price = isset($tkt['TKT_price']) ? round((float)$tkt['TKT_price'], 3) : 0;
377
+            $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
378 378
             
379 379
             //note incoming base price needs converted from localized value.
380 380
             $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
             if (empty($tkt['TKT_start_date'])) {
389 389
                 //lets' use now in the set timezone.
390 390
                 $now                   = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
391
-                $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
391
+                $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
392 392
             }
393 393
             
394 394
             if (empty($tkt['TKT_end_date'])) {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                  * set the TKT_end_date to the first datetime attached to the ticket.
397 397
                  */
398 398
                 $first_dtt           = $saved_dtts[reset($tkt_dtt_rows)];
399
-                $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time']);
399
+                $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
400 400
             }
401 401
             
402 402
             $TKT_values = array(
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
         // first let's add datetimes
627 627
         if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
628 628
             foreach ($added_datetimes as $row_id) {
629
-                $row_id = (int)$row_id;
629
+                $row_id = (int) $row_id;
630 630
                 if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
631 631
                     $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
632 632
                     // Is this an existing ticket (has an ID) and does it have any sold?
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
         // then remove datetimes
642 642
         if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
643 643
             foreach ($removed_datetimes as $row_id) {
644
-                $row_id = (int)$row_id;
644
+                $row_id = (int) $row_id;
645 645
                 // its entirely possible that a datetime got deleted (instead of just removed from relationship.
646 646
                 // So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
647 647
                 if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
@@ -946,9 +946,9 @@  discard block
 block discarded – undo
946 946
         $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
947 947
         
948 948
         //sort $all_tickets by order
949
-        usort($all_tickets, function ($a, $b) {
950
-            $a_order = (int)$a->get('TKT_order');
951
-            $b_order = (int)$b->get('TKT_order');
949
+        usort($all_tickets, function($a, $b) {
950
+            $a_order = (int) $a->get('TKT_order');
951
+            $b_order = (int) $b->get('TKT_order');
952 952
             if ($a_order == $b_order) {
953 953
                 return 0;
954 954
             }
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
         }
974 974
         
975 975
         $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
976
-        $template                                  = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
976
+        $template                                  = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
977 977
         EEH_Template::display_template($template, $main_template_args);
978 978
         
979 979
         return;
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
                 $all_tickets, $default),
996 996
             'dtt_row'                  => $default ? 'DTTNUM' : $dttrow
997 997
         );
998
-        $template                  = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
998
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
999 999
         
1000 1000
         return EEH_Template::display_template($template, $dtt_display_template_args, true);
1001 1001
     }
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
             'DTT_ID'               => $default ? '' : $dtt->ID(),
1030 1030
             'DTT_name'             => $default ? '' : $dtt->name(),
1031 1031
             'DTT_description'      => $default ? '' : $dtt->description(),
1032
-            'DTT_EVT_start'        => $default ? '' : $dtt->start_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1033
-            'DTT_EVT_end'          => $default ? '' : $dtt->end_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1032
+            'DTT_EVT_start'        => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1033
+            'DTT_EVT_end'          => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1034 1034
             'DTT_reg_limit'        => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
1035 1035
             'DTT_order'            => $default ? 'DTTNUM' : $dttrow,
1036 1036
             'dtt_sold'             => $default ? '0' : $dtt->get('DTT_sold'),
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args',
1051 1051
             $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
1052 1052
         
1053
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
1053
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
1054 1054
         
1055 1055
         return EEH_Template::display_template($template, $template_args, true);
1056 1056
     }
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args',
1087 1087
             $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
1088 1088
         
1089
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1089
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
1090 1090
         
1091 1091
         return EEH_Template::display_template($template, $template_args, true);
1092 1092
     }
@@ -1104,14 +1104,14 @@  discard block
 block discarded – undo
1104 1104
             'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1105 1105
             'ticket_selected'         => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1106 1106
             'TKT_name'                => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1107
-            'tkt_status_class'        => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1107
+            'tkt_status_class'        => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1108 1108
         );
1109 1109
         
1110 1110
         //filter template args
1111 1111
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args',
1112 1112
             $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1113 1113
         
1114
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1114
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1115 1115
         
1116 1116
         return EEH_Template::display_template($template, $template_args, true);
1117 1117
     }
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
         
1167 1167
         //breaking out complicated condition for ticket_status
1168 1168
         if ($default) {
1169
-            $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1169
+            $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1170 1170
         } else {
1171
-            $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1171
+            $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1172 1172
         }
1173 1173
         
1174 1174
         //breaking out complicated condition for TKT_taxable
@@ -1189,9 +1189,9 @@  discard block
 block discarded – undo
1189 1189
             'edit_tickets_name'             => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1190 1190
             'TKT_name'                      => $default ? '' : $ticket->get('TKT_name'),
1191 1191
             'TKT_start_date'                => $default ? '' : $ticket->get_date('TKT_start_date',
1192
-                $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1192
+                $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1193 1193
             'TKT_end_date'                  => $default ? '' : $ticket->get_date('TKT_end_date',
1194
-                $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']),
1194
+                $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1195 1195
             'TKT_status'                    => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, false,
1196 1196
                 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, false,
1197 1197
                 'sentence') : $ticket->ticket_status(true),
@@ -1249,9 +1249,9 @@  discard block
 block discarded – undo
1249 1249
         //handle rows that should NOT be empty
1250 1250
         if (empty($template_args['TKT_start_date'])) {
1251 1251
             //if empty then the start date will be now.
1252
-            $template_args['TKT_start_date']   = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'],
1252
+            $template_args['TKT_start_date']   = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'],
1253 1253
                 current_time('timestamp'));
1254
-            $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1254
+            $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1255 1255
         }
1256 1256
         
1257 1257
         if (empty($template_args['TKT_end_date'])) {
@@ -1262,13 +1262,13 @@  discard block
 block discarded – undo
1262 1262
             
1263 1263
             if ( ! empty($earliest_dtt)) {
1264 1264
                 $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start',
1265
-                    $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']);
1265
+                    $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1266 1266
             } else {
1267 1267
                 //default so let's just use what's been set for the default date-time which is 30 days from now.
1268
-                $template_args['TKT_end_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'],
1268
+                $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'],
1269 1269
                     mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1270 1270
             }
1271
-            $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1271
+            $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1272 1272
         }
1273 1273
         
1274 1274
         //generate ticket_datetime items
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
             $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets,
1300 1300
             $this->_is_creating_event);
1301 1301
         
1302
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1302
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1303 1303
         
1304 1304
         return EEH_Template::display_template($template, $template_args, true);
1305 1305
     }
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
     protected function _get_tax_rows($tktrow, $ticket)
1309 1309
     {
1310 1310
         $tax_rows      = '';
1311
-        $template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1311
+        $template      = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1312 1312
         $template_args = array();
1313 1313
         $taxes         = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1314 1314
         foreach ($taxes as $tax) {
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
             $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create,
1378 1378
             $this->_is_creating_event);
1379 1379
         
1380
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1380
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1381 1381
         
1382 1382
         return EEH_Template::display_template($template, $template_args, true);
1383 1383
     }
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
             'price_selected_operator'   => '+',
1405 1405
             'price_selected_is_percent' => 0
1406 1406
         );
1407
-        $template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1407
+        $template      = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1408 1408
         
1409 1409
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args',
1410 1410
             $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
     
1416 1416
     protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = false)
1417 1417
     {
1418
-        $select_name                = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1418
+        $select_name                = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1419 1419
         $price_types                = EE_Registry::instance()->load_model('Price_Type')->get_all(array(
1420 1420
             array(
1421 1421
                 'OR' => array(
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
                 )
1425 1425
             )
1426 1426
         ));
1427
-        $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1427
+        $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1428 1428
         $all_price_types            = $default && empty($price) ? array(
1429 1429
             array(
1430 1430
                 'id'   => 0,
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
         
1452 1452
         $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1453 1453
         $main_name     = $select_name;
1454
-        $select_name   = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1454
+        $select_name   = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1455 1455
         
1456 1456
         $template_args = array(
1457 1457
             'tkt_row'                   => $default ? 'TICKETNUM' : $tktrow,
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args',
1470 1470
             $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1471 1471
         
1472
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1472
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1473 1473
         
1474 1474
         return EEH_Template::display_template($template, $template_args, true);
1475 1475
     }
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
         
1492 1492
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args',
1493 1493
             $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1494
-        $template      = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1494
+        $template      = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1495 1495
         
1496 1496
         return EEH_Template::display_template($template, $template_args, true);
1497 1497
     }
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
         $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args',
1557 1557
             $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1558 1558
         
1559
-        $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1559
+        $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1560 1560
         
1561 1561
         return EEH_Template::display_template($template, $template_args, true);
1562 1562
     }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Datetime_Field.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 * allowed)
591 591
 	 *
592 592
 	 * @param string $datetime_string mysql timestamp in UTC
593
-	 * @return  mixed null | DateTime
593
+	 * @return  null|DbSafeDateTime null | DateTime
594 594
 	 * @throws \EE_Error
595 595
 	 */
596 596
     public function prepare_for_set_from_db($datetime_string)
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
      * @param \DateTimeZone $DateTimeZone
732 732
      * @param int           $time
733 733
      *
734
-     * @return mixed
734
+     * @return string
735 735
      */
736 736
     public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null)
737 737
     {
Please login to merge, or discard this patch.
Indentation   +639 added lines, -639 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\domain\entities\DbSafeDateTime;
2 2
 
3 3
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
-    exit('No direct script access allowed');
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 /**
@@ -17,102 +17,102 @@  discard block
 block discarded – undo
17 17
 class EE_Datetime_Field extends EE_Model_Field_Base
18 18
 {
19 19
 
20
-    /**
21
-     * The pattern we're looking for is if only the characters 0-9 are found and there are only
22
-     * 10 or more numbers (because 9 numbers even with all 9's would be sometime in 2001 )
23
-     * @type string unix_timestamp_regex
24
-     */
25
-    const unix_timestamp_regex = '/[0-9]{10,}/';
26
-
27
-    /**
28
-     * @type string mysql_timestamp_format
29
-     */
30
-    const mysql_timestamp_format = 'Y-m-d H:i:s';
31
-
32
-    /**
33
-     * @type string mysql_date_format
34
-     */
35
-    const mysql_date_format = 'Y-m-d';
36
-
37
-    /**
38
-     * @type string mysql_time_format
39
-     */
40
-    const mysql_time_format = 'H:i:s';
41
-
42
-    /**
43
-     * Const for using in the default value. If the field's default is set to this,
44
-     * then we will return the time of calling `get_default_value()`, not
45
-     * just the current time at construction
46
-     */
47
-    const now = 'now';
48
-
49
-    /**
50
-     * The following properties hold the default formats for date and time.
51
-     * Defaults are set via the constructor and can be overridden on class instantiation.
52
-     * However they can also be overridden later by the set_format() method
53
-     * (and corresponding set_date_format, set_time_format methods);
54
-     */
55
-    /**
56
-     * @type string $_date_format
57
-     */
58
-    protected $_date_format = '';
59
-
60
-    /**
61
-     * @type string $_time_format
62
-     */
63
-    protected $_time_format = '';
64
-
65
-    /**
66
-     * @type string $_pretty_date_format
67
-     */
68
-    protected $_pretty_date_format = '';
69
-
70
-    /**
71
-     * @type string $_pretty_time_format
72
-     */
73
-    protected $_pretty_time_format = '';
74
-
75
-    /**
76
-     * @type DateTimeZone $_DateTimeZone
77
-     */
78
-    protected $_DateTimeZone;
79
-
80
-    /**
81
-     * @type DateTimeZone $_UTC_DateTimeZone
82
-     */
83
-    protected $_UTC_DateTimeZone;
84
-
85
-    /**
86
-     * @type DateTimeZone $_blog_DateTimeZone
87
-     */
88
-    protected $_blog_DateTimeZone;
89
-
90
-
91
-    /**
92
-     * This property holds how we want the output returned when getting a datetime string.  It is set for the
93
-     * set_date_time_output() method.  By default this is empty.  When empty, we are assuming that we want both date
94
-     * and time returned via getters.
95
-     * @var mixed (null|string)
96
-     */
97
-    protected $_date_time_output;
98
-
99
-
100
-    /**
101
-     * timezone string
102
-     * This gets set by the constructor and can be changed by the "set_timezone()" method so that we know what timezone
103
-     * incoming strings|timestamps are in.  This can also be used before a get to set what timezone you want strings
104
-     * coming out of the object to be in.  Default timezone is the current WP timezone option setting
105
-     * @var string
106
-     */
107
-    protected $_timezone_string;
108
-
109
-
110
-    /**
111
-     * This holds whatever UTC offset for the blog (we automatically convert timezone strings into their related
112
-     * offsets for comparison purposes).
113
-     * @var int
114
-     */
115
-    protected $_blog_offset;
20
+	/**
21
+	 * The pattern we're looking for is if only the characters 0-9 are found and there are only
22
+	 * 10 or more numbers (because 9 numbers even with all 9's would be sometime in 2001 )
23
+	 * @type string unix_timestamp_regex
24
+	 */
25
+	const unix_timestamp_regex = '/[0-9]{10,}/';
26
+
27
+	/**
28
+	 * @type string mysql_timestamp_format
29
+	 */
30
+	const mysql_timestamp_format = 'Y-m-d H:i:s';
31
+
32
+	/**
33
+	 * @type string mysql_date_format
34
+	 */
35
+	const mysql_date_format = 'Y-m-d';
36
+
37
+	/**
38
+	 * @type string mysql_time_format
39
+	 */
40
+	const mysql_time_format = 'H:i:s';
41
+
42
+	/**
43
+	 * Const for using in the default value. If the field's default is set to this,
44
+	 * then we will return the time of calling `get_default_value()`, not
45
+	 * just the current time at construction
46
+	 */
47
+	const now = 'now';
48
+
49
+	/**
50
+	 * The following properties hold the default formats for date and time.
51
+	 * Defaults are set via the constructor and can be overridden on class instantiation.
52
+	 * However they can also be overridden later by the set_format() method
53
+	 * (and corresponding set_date_format, set_time_format methods);
54
+	 */
55
+	/**
56
+	 * @type string $_date_format
57
+	 */
58
+	protected $_date_format = '';
59
+
60
+	/**
61
+	 * @type string $_time_format
62
+	 */
63
+	protected $_time_format = '';
64
+
65
+	/**
66
+	 * @type string $_pretty_date_format
67
+	 */
68
+	protected $_pretty_date_format = '';
69
+
70
+	/**
71
+	 * @type string $_pretty_time_format
72
+	 */
73
+	protected $_pretty_time_format = '';
74
+
75
+	/**
76
+	 * @type DateTimeZone $_DateTimeZone
77
+	 */
78
+	protected $_DateTimeZone;
79
+
80
+	/**
81
+	 * @type DateTimeZone $_UTC_DateTimeZone
82
+	 */
83
+	protected $_UTC_DateTimeZone;
84
+
85
+	/**
86
+	 * @type DateTimeZone $_blog_DateTimeZone
87
+	 */
88
+	protected $_blog_DateTimeZone;
89
+
90
+
91
+	/**
92
+	 * This property holds how we want the output returned when getting a datetime string.  It is set for the
93
+	 * set_date_time_output() method.  By default this is empty.  When empty, we are assuming that we want both date
94
+	 * and time returned via getters.
95
+	 * @var mixed (null|string)
96
+	 */
97
+	protected $_date_time_output;
98
+
99
+
100
+	/**
101
+	 * timezone string
102
+	 * This gets set by the constructor and can be changed by the "set_timezone()" method so that we know what timezone
103
+	 * incoming strings|timestamps are in.  This can also be used before a get to set what timezone you want strings
104
+	 * coming out of the object to be in.  Default timezone is the current WP timezone option setting
105
+	 * @var string
106
+	 */
107
+	protected $_timezone_string;
108
+
109
+
110
+	/**
111
+	 * This holds whatever UTC offset for the blog (we automatically convert timezone strings into their related
112
+	 * offsets for comparison purposes).
113
+	 * @var int
114
+	 */
115
+	protected $_blog_offset;
116 116
 
117 117
 
118 118
 
@@ -128,36 +128,36 @@  discard block
 block discarded – undo
128 128
 	 * @param string $pretty_time_format
129 129
 	 * @throws \EE_Error
130 130
 	 */
131
-    public function __construct(
132
-        $table_column,
133
-        $nice_name,
134
-        $nullable,
135
-        $default_value,
136
-        $timezone_string = '',
137
-        $date_format = '',
138
-        $time_format = '',
139
-        $pretty_date_format = '',
140
-        $pretty_time_format = ''
141
-    ) {
131
+	public function __construct(
132
+		$table_column,
133
+		$nice_name,
134
+		$nullable,
135
+		$default_value,
136
+		$timezone_string = '',
137
+		$date_format = '',
138
+		$time_format = '',
139
+		$pretty_date_format = '',
140
+		$pretty_time_format = ''
141
+	) {
142 142
 
143
-        $this->_date_format        = ! empty($date_format) ? $date_format : get_option('date_format');
144
-        $this->_time_format        = ! empty($time_format) ? $time_format : get_option('time_format');
145
-        $this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
146
-        $this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
143
+		$this->_date_format        = ! empty($date_format) ? $date_format : get_option('date_format');
144
+		$this->_time_format        = ! empty($time_format) ? $time_format : get_option('time_format');
145
+		$this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
146
+		$this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
147 147
 
148
-        parent::__construct($table_column, $nice_name, $nullable, $default_value);
149
-        $this->set_timezone($timezone_string);
148
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
149
+		$this->set_timezone($timezone_string);
150 150
 
151
-    }
151
+	}
152 152
 
153 153
 
154
-    /**
155
-     * @return string
156
-     */
157
-    public function get_wpdb_data_type()
158
-    {
159
-        return '%s';
160
-    }
154
+	/**
155
+	 * @return string
156
+	 */
157
+	public function get_wpdb_data_type()
158
+	{
159
+		return '%s';
160
+	}
161 161
 
162 162
 
163 163
 
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 	 * @return DateTimeZone
166 166
 	 * @throws \EE_Error
167 167
 	 */
168
-    public function get_UTC_DateTimeZone()
169
-    {
170
-        return $this->_UTC_DateTimeZone instanceof DateTimeZone
171
-	        ? $this->_UTC_DateTimeZone
172
-	        : $this->_create_timezone_object_from_timezone_string('UTC');
173
-    }
168
+	public function get_UTC_DateTimeZone()
169
+	{
170
+		return $this->_UTC_DateTimeZone instanceof DateTimeZone
171
+			? $this->_UTC_DateTimeZone
172
+			: $this->_create_timezone_object_from_timezone_string('UTC');
173
+	}
174 174
 
175 175
 
176 176
 
@@ -178,69 +178,69 @@  discard block
 block discarded – undo
178 178
 	 * @return DateTimeZone
179 179
 	 * @throws \EE_Error
180 180
 	 */
181
-    public function get_blog_DateTimeZone()
182
-    {
183
-        return $this->_blog_DateTimeZone instanceof DateTimeZone
184
-	        ? $this->_blog_DateTimeZone
185
-	        : $this->_create_timezone_object_from_timezone_string('');
186
-    }
187
-
188
-
189
-    /**
190
-     * this prepares any incoming date data and make sure its converted to a utc unix timestamp
191
-     *
192
-     * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix
193
-     *                                                              timestamp
194
-     *
195
-     * @return DateTime
196
-     */
197
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
198
-    {
199
-        return $this->_get_date_object($value_inputted_for_field_on_model_object);
200
-    }
201
-
202
-
203
-    /**
204
-     * This returns the format string to be used by getters depending on what the $_date_time_output property is set at.
205
-     *
206
-     * getters need to know whether we're just returning the date or the time or both.  By default we return both.
207
-     *
208
-     * @param bool $pretty If we're returning the pretty formats or standard format string.
209
-     * @return string    The final assembled format string.
210
-     */
211
-    protected function _get_date_time_output($pretty = false)
212
-    {
213
-
214
-        switch ($this->_date_time_output) {
215
-            case 'time' :
216
-                return $pretty ? $this->_pretty_time_format : $this->_time_format;
217
-                break;
218
-
219
-            case 'date' :
220
-                return $pretty ? $this->_pretty_date_format : $this->_date_format;
221
-                break;
222
-
223
-            default :
224
-                return $pretty
225
-	                ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format
226
-	                : $this->_date_format . ' ' . $this->_time_format;
227
-        }
228
-    }
229
-
230
-
231
-    /**
232
-     * This just sets the $_date_time_output property so we can flag how date and times are formatted before being
233
-     * returned (using the format properties)
234
-     *
235
-     * @param string $what acceptable values are 'time' or 'date'.
236
-     *                     Any other value will be set but will always result
237
-     *                     in both 'date' and 'time' being returned.
238
-     * @return void
239
-     */
240
-    public function set_date_time_output($what = null)
241
-    {
242
-        $this->_date_time_output = $what;
243
-    }
181
+	public function get_blog_DateTimeZone()
182
+	{
183
+		return $this->_blog_DateTimeZone instanceof DateTimeZone
184
+			? $this->_blog_DateTimeZone
185
+			: $this->_create_timezone_object_from_timezone_string('');
186
+	}
187
+
188
+
189
+	/**
190
+	 * this prepares any incoming date data and make sure its converted to a utc unix timestamp
191
+	 *
192
+	 * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix
193
+	 *                                                              timestamp
194
+	 *
195
+	 * @return DateTime
196
+	 */
197
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
198
+	{
199
+		return $this->_get_date_object($value_inputted_for_field_on_model_object);
200
+	}
201
+
202
+
203
+	/**
204
+	 * This returns the format string to be used by getters depending on what the $_date_time_output property is set at.
205
+	 *
206
+	 * getters need to know whether we're just returning the date or the time or both.  By default we return both.
207
+	 *
208
+	 * @param bool $pretty If we're returning the pretty formats or standard format string.
209
+	 * @return string    The final assembled format string.
210
+	 */
211
+	protected function _get_date_time_output($pretty = false)
212
+	{
213
+
214
+		switch ($this->_date_time_output) {
215
+			case 'time' :
216
+				return $pretty ? $this->_pretty_time_format : $this->_time_format;
217
+				break;
218
+
219
+			case 'date' :
220
+				return $pretty ? $this->_pretty_date_format : $this->_date_format;
221
+				break;
222
+
223
+			default :
224
+				return $pretty
225
+					? $this->_pretty_date_format . ' ' . $this->_pretty_time_format
226
+					: $this->_date_format . ' ' . $this->_time_format;
227
+		}
228
+	}
229
+
230
+
231
+	/**
232
+	 * This just sets the $_date_time_output property so we can flag how date and times are formatted before being
233
+	 * returned (using the format properties)
234
+	 *
235
+	 * @param string $what acceptable values are 'time' or 'date'.
236
+	 *                     Any other value will be set but will always result
237
+	 *                     in both 'date' and 'time' being returned.
238
+	 * @return void
239
+	 */
240
+	public function set_date_time_output($what = null)
241
+	{
242
+		$this->_date_time_output = $what;
243
+	}
244 244
 
245 245
 
246 246
 
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 	 * @return void
256 256
 	 * @throws \EE_Error
257 257
 	 */
258
-    public function set_timezone($timezone_string)
259
-    {
260
-        if (empty($timezone_string) && $this->_timezone_string !== null) {
261
-            // leave the timezone AS-IS if we already have one and
262
-            // the function arg didn't provide one
263
-            return;
264
-        }
265
-        $timezone_string        = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
266
-        $this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
267
-        $this->_DateTimeZone    = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
268
-    }
258
+	public function set_timezone($timezone_string)
259
+	{
260
+		if (empty($timezone_string) && $this->_timezone_string !== null) {
261
+			// leave the timezone AS-IS if we already have one and
262
+			// the function arg didn't provide one
263
+			return;
264
+		}
265
+		$timezone_string        = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
266
+		$this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
267
+		$this->_DateTimeZone    = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
268
+	}
269 269
 
270 270
 
271 271
 
@@ -277,178 +277,178 @@  discard block
 block discarded – undo
277 277
 	 * @return \DateTimeZone
278 278
 	 * @throws \EE_Error
279 279
 	 */
280
-    protected function _create_timezone_object_from_timezone_string($timezone_string = '')
281
-    {
282
-        return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
283
-    }
284
-
285
-
286
-    /**
287
-     * This just returns whatever is set for the current timezone.
288
-     *
289
-     * @access public
290
-     * @return string timezone string
291
-     */
292
-    public function get_timezone()
293
-    {
294
-        return $this->_timezone_string;
295
-    }
296
-
297
-
298
-    /**
299
-     * set the $_date_format property
300
-     *
301
-     * @access public
302
-     *
303
-     * @param string $format a new date format (corresponding to formats accepted by PHP date() function)
304
-     * @param bool   $pretty Whether to set pretty format or not.
305
-     *
306
-     * @return void
307
-     */
308
-    public function set_date_format($format, $pretty = false)
309
-    {
310
-        if ($pretty) {
311
-            $this->_pretty_date_format = $format;
312
-        } else {
313
-            $this->_date_format = $format;
314
-        }
315
-    }
316
-
317
-
318
-    /**
319
-     * return the $_date_format property value.
320
-     *
321
-     * @param bool $pretty Whether to get pretty format or not.
322
-     *
323
-     * @return string
324
-     */
325
-    public function get_date_format($pretty = false)
326
-    {
327
-        return $pretty ? $this->_pretty_date_format : $this->_date_format;
328
-    }
329
-
330
-
331
-    /**
332
-     * set the $_time_format property
333
-     *
334
-     * @access public
335
-     *
336
-     * @param string $format a new time format (corresponding to formats accepted by PHP date() function)
337
-     * @param bool   $pretty Whether to set pretty format or not.
338
-     *
339
-     * @return void
340
-     */
341
-    public function set_time_format($format, $pretty = false)
342
-    {
343
-        if ($pretty) {
344
-            $this->_pretty_time_format = $format;
345
-        } else {
346
-            $this->_time_format = $format;
347
-        }
348
-    }
349
-
350
-
351
-    /**
352
-     * return the $_time_format property value.
353
-     *
354
-     * @param bool $pretty Whether to get pretty format or not.
355
-     *
356
-     * @return string
357
-     */
358
-    public function get_time_format($pretty = false)
359
-    {
360
-        return $pretty ? $this->_pretty_time_format : $this->_time_format;
361
-    }
362
-
363
-
364
-    /**
365
-     * set the $_pretty_date_format property
366
-     *
367
-     * @access public
368
-     *
369
-     * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
370
-     *
371
-     * @return void
372
-     */
373
-    public function set_pretty_date_format($format)
374
-    {
375
-        $this->_pretty_date_format = $format;
376
-    }
377
-
378
-
379
-    /**
380
-     * set the $_pretty_time_format property
381
-     *
382
-     * @access public
383
-     *
384
-     * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
385
-     *
386
-     * @return void
387
-     */
388
-    public function set_pretty_time_format($format)
389
-    {
390
-        $this->_pretty_time_format = $format;
391
-    }
392
-
393
-
394
-    /**
395
-     * Only sets the time portion of the datetime.
396
-     *
397
-     * @param string|DateTime $time_to_set_string like 8am OR a DateTime object.
398
-     * @param DateTime        $current            current DateTime object for the datetime field
399
-     *
400
-     * @return DateTime
401
-     */
402
-    public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current)
403
-    {
404
-        // if $time_to_set_string is datetime object, then let's use it to set the parse array.
405
-	    // Otherwise parse the string.
406
-        if ($time_to_set_string instanceof DateTime) {
407
-            $parsed = array(
408
-                'hour'   => $time_to_set_string->format('H'),
409
-                'minute' => $time_to_set_string->format('i'),
410
-                'second' => $time_to_set_string->format('s')
411
-            );
412
-        } else {
413
-            //parse incoming string
414
-            $parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
415
-        }
416
-
417
-        //make sure $current is in the correct timezone.
418
-        $current->setTimezone($this->_DateTimeZone);
419
-
420
-        return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
421
-    }
422
-
423
-
424
-    /**
425
-     * Only sets the date portion of the datetime.
426
-     *
427
-     * @param string|DateTime $date_to_set_string like Friday, January 8th or a DateTime object.
428
-     * @param DateTime        $current            current DateTime object for the datetime field
429
-     *
430
-     * @return DateTime
431
-     */
432
-    public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current)
433
-    {
434
-        // if $time_to_set_string is datetime object, then let's use it to set the parse array.
435
-	    // Otherwise parse the string.
436
-        if ($date_to_set_string instanceof DateTime) {
437
-            $parsed = array(
438
-                'year'  => $date_to_set_string->format('Y'),
439
-                'month' => $date_to_set_string->format('m'),
440
-                'day'   => $date_to_set_string->format('d')
441
-            );
442
-        } else {
443
-            //parse incoming string
444
-            $parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
445
-        }
446
-
447
-        //make sure $current is in the correct timezone
448
-        $current->setTimezone($this->_DateTimeZone);
449
-
450
-        return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
451
-    }
280
+	protected function _create_timezone_object_from_timezone_string($timezone_string = '')
281
+	{
282
+		return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
283
+	}
284
+
285
+
286
+	/**
287
+	 * This just returns whatever is set for the current timezone.
288
+	 *
289
+	 * @access public
290
+	 * @return string timezone string
291
+	 */
292
+	public function get_timezone()
293
+	{
294
+		return $this->_timezone_string;
295
+	}
296
+
297
+
298
+	/**
299
+	 * set the $_date_format property
300
+	 *
301
+	 * @access public
302
+	 *
303
+	 * @param string $format a new date format (corresponding to formats accepted by PHP date() function)
304
+	 * @param bool   $pretty Whether to set pretty format or not.
305
+	 *
306
+	 * @return void
307
+	 */
308
+	public function set_date_format($format, $pretty = false)
309
+	{
310
+		if ($pretty) {
311
+			$this->_pretty_date_format = $format;
312
+		} else {
313
+			$this->_date_format = $format;
314
+		}
315
+	}
316
+
317
+
318
+	/**
319
+	 * return the $_date_format property value.
320
+	 *
321
+	 * @param bool $pretty Whether to get pretty format or not.
322
+	 *
323
+	 * @return string
324
+	 */
325
+	public function get_date_format($pretty = false)
326
+	{
327
+		return $pretty ? $this->_pretty_date_format : $this->_date_format;
328
+	}
329
+
330
+
331
+	/**
332
+	 * set the $_time_format property
333
+	 *
334
+	 * @access public
335
+	 *
336
+	 * @param string $format a new time format (corresponding to formats accepted by PHP date() function)
337
+	 * @param bool   $pretty Whether to set pretty format or not.
338
+	 *
339
+	 * @return void
340
+	 */
341
+	public function set_time_format($format, $pretty = false)
342
+	{
343
+		if ($pretty) {
344
+			$this->_pretty_time_format = $format;
345
+		} else {
346
+			$this->_time_format = $format;
347
+		}
348
+	}
349
+
350
+
351
+	/**
352
+	 * return the $_time_format property value.
353
+	 *
354
+	 * @param bool $pretty Whether to get pretty format or not.
355
+	 *
356
+	 * @return string
357
+	 */
358
+	public function get_time_format($pretty = false)
359
+	{
360
+		return $pretty ? $this->_pretty_time_format : $this->_time_format;
361
+	}
362
+
363
+
364
+	/**
365
+	 * set the $_pretty_date_format property
366
+	 *
367
+	 * @access public
368
+	 *
369
+	 * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
370
+	 *
371
+	 * @return void
372
+	 */
373
+	public function set_pretty_date_format($format)
374
+	{
375
+		$this->_pretty_date_format = $format;
376
+	}
377
+
378
+
379
+	/**
380
+	 * set the $_pretty_time_format property
381
+	 *
382
+	 * @access public
383
+	 *
384
+	 * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
385
+	 *
386
+	 * @return void
387
+	 */
388
+	public function set_pretty_time_format($format)
389
+	{
390
+		$this->_pretty_time_format = $format;
391
+	}
392
+
393
+
394
+	/**
395
+	 * Only sets the time portion of the datetime.
396
+	 *
397
+	 * @param string|DateTime $time_to_set_string like 8am OR a DateTime object.
398
+	 * @param DateTime        $current            current DateTime object for the datetime field
399
+	 *
400
+	 * @return DateTime
401
+	 */
402
+	public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current)
403
+	{
404
+		// if $time_to_set_string is datetime object, then let's use it to set the parse array.
405
+		// Otherwise parse the string.
406
+		if ($time_to_set_string instanceof DateTime) {
407
+			$parsed = array(
408
+				'hour'   => $time_to_set_string->format('H'),
409
+				'minute' => $time_to_set_string->format('i'),
410
+				'second' => $time_to_set_string->format('s')
411
+			);
412
+		} else {
413
+			//parse incoming string
414
+			$parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
415
+		}
416
+
417
+		//make sure $current is in the correct timezone.
418
+		$current->setTimezone($this->_DateTimeZone);
419
+
420
+		return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
421
+	}
422
+
423
+
424
+	/**
425
+	 * Only sets the date portion of the datetime.
426
+	 *
427
+	 * @param string|DateTime $date_to_set_string like Friday, January 8th or a DateTime object.
428
+	 * @param DateTime        $current            current DateTime object for the datetime field
429
+	 *
430
+	 * @return DateTime
431
+	 */
432
+	public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current)
433
+	{
434
+		// if $time_to_set_string is datetime object, then let's use it to set the parse array.
435
+		// Otherwise parse the string.
436
+		if ($date_to_set_string instanceof DateTime) {
437
+			$parsed = array(
438
+				'year'  => $date_to_set_string->format('Y'),
439
+				'month' => $date_to_set_string->format('m'),
440
+				'day'   => $date_to_set_string->format('d')
441
+			);
442
+		} else {
443
+			//parse incoming string
444
+			$parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
445
+		}
446
+
447
+		//make sure $current is in the correct timezone
448
+		$current->setTimezone($this->_DateTimeZone);
449
+
450
+		return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
451
+	}
452 452
 
453 453
 
454 454
 
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
 	 * @return string formatted date time for given timezone
461 461
 	 * @throws \EE_Error
462 462
 	 */
463
-    public function prepare_for_get($DateTime)
464
-    {
465
-        return $this->_prepare_for_display($DateTime);
466
-    }
463
+	public function prepare_for_get($DateTime)
464
+	{
465
+		return $this->_prepare_for_display($DateTime);
466
+	}
467 467
 
468 468
 
469 469
 
@@ -478,110 +478,110 @@  discard block
 block discarded – undo
478 478
 	 * @return string
479 479
 	 * @throws \EE_Error
480 480
 	 */
481
-    public function prepare_for_pretty_echoing($DateTime, $schema = null)
482
-    {
483
-        return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
484
-    }
485
-
486
-
487
-    /**
488
-     * This prepares the EE_DateTime value to be saved to the db as mysql timestamp (UTC +0
489
-     * timezone).
490
-     *
491
-     * @param DateTime    $DateTime
492
-     * @param bool|string $schema
493
-     * @return string
494
-     * @throws \EE_Error
495
-     */
496
-    protected function _prepare_for_display($DateTime, $schema = false)
497
-    {
498
-        if ( ! $DateTime instanceof DateTime) {
499
-            if ($this->_nullable) {
500
-                return '';
501
-            } else {
502
-                if (WP_DEBUG) {
503
-	                throw new EE_Error(
504
-		                sprintf(
505
-			                __(
506
-				                'EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.',
507
-				                'event_espresso'
508
-			                ),
509
-			                $this->_nicename
510
-		                )
511
-	                );
512
-                } else {
513
-                    $DateTime = new DbSafeDateTime(\EE_Datetime_Field::now);
514
-	                EE_Error::add_error(
515
-		                sprintf(
516
-			                __(
517
-				                'EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.',
518
-				                'event_espresso'
519
-			                ),
520
-			                $this->_nicename
521
-		                )
522
-	                );
523
-                }
524
-            }
525
-        }
526
-        $format_string = $this->_get_date_time_output($schema);
527
-        //make sure datetime_value is in the correct timezone (in case that's been updated).
528
-        $DateTime->setTimezone($this->_DateTimeZone);
529
-        if ($schema) {
530
-            if ($this->_display_timezone()) {
531
-                //must be explicit because schema could equal true.
532
-                if ($schema === 'no_html') {
533
-                    $timezone_string = ' (' . $DateTime->format('T') . ')';
534
-                } else {
535
-                    $timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format('T') . ')</span>';
536
-                }
537
-            } else {
538
-                $timezone_string = '';
539
-            }
540
-
541
-            return $DateTime->format($format_string) . $timezone_string;
542
-        } else {
543
-            return $DateTime->format($format_string);
544
-        }
545
-    }
546
-
547
-
548
-    /**
549
-     * This prepares the EE_DateTime value to be saved to the db as mysql timestamp (UTC +0
550
-     * timezone).
551
-     *
552
-     * @param  mixed $datetime_value u
553
-     *
554
-     * @return string mysql timestamp in UTC
555
-     * @throws \EE_Error
556
-     */
557
-    public function prepare_for_use_in_db($datetime_value)
558
-    {
559
-        //we allow an empty value or DateTime object, but nothing else.
560
-        if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
561
-            throw new EE_Error(
562
-            	__(
563
-            		'The incoming value being prepared for setting in the database must either be empty or a php DateTime object',
564
-                    'event_espresso'
565
-	            )
566
-            );
567
-        }
568
-
569
-        if ($datetime_value instanceof DateTime) {
570
-            if ( ! $datetime_value instanceof DbSafeDateTime) {
571
-                $datetime_value = new DbSafeDateTime(
572
-                    $datetime_value->format(EE_Datetime_Field::mysql_timestamp_format),
573
-                    new \DateTimeZone($datetime_value->format('e'))
574
-                );
575
-            }
576
-
577
-            return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(
578
-            	EE_Datetime_Field::mysql_timestamp_format
579
-            );
580
-        }
581
-
582
-        // if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
583
-        return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
584
-    }
481
+	public function prepare_for_pretty_echoing($DateTime, $schema = null)
482
+	{
483
+		return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
484
+	}
485
+
486
+
487
+	/**
488
+	 * This prepares the EE_DateTime value to be saved to the db as mysql timestamp (UTC +0
489
+	 * timezone).
490
+	 *
491
+	 * @param DateTime    $DateTime
492
+	 * @param bool|string $schema
493
+	 * @return string
494
+	 * @throws \EE_Error
495
+	 */
496
+	protected function _prepare_for_display($DateTime, $schema = false)
497
+	{
498
+		if ( ! $DateTime instanceof DateTime) {
499
+			if ($this->_nullable) {
500
+				return '';
501
+			} else {
502
+				if (WP_DEBUG) {
503
+					throw new EE_Error(
504
+						sprintf(
505
+							__(
506
+								'EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.',
507
+								'event_espresso'
508
+							),
509
+							$this->_nicename
510
+						)
511
+					);
512
+				} else {
513
+					$DateTime = new DbSafeDateTime(\EE_Datetime_Field::now);
514
+					EE_Error::add_error(
515
+						sprintf(
516
+							__(
517
+								'EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.',
518
+								'event_espresso'
519
+							),
520
+							$this->_nicename
521
+						)
522
+					);
523
+				}
524
+			}
525
+		}
526
+		$format_string = $this->_get_date_time_output($schema);
527
+		//make sure datetime_value is in the correct timezone (in case that's been updated).
528
+		$DateTime->setTimezone($this->_DateTimeZone);
529
+		if ($schema) {
530
+			if ($this->_display_timezone()) {
531
+				//must be explicit because schema could equal true.
532
+				if ($schema === 'no_html') {
533
+					$timezone_string = ' (' . $DateTime->format('T') . ')';
534
+				} else {
535
+					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format('T') . ')</span>';
536
+				}
537
+			} else {
538
+				$timezone_string = '';
539
+			}
540
+
541
+			return $DateTime->format($format_string) . $timezone_string;
542
+		} else {
543
+			return $DateTime->format($format_string);
544
+		}
545
+	}
546
+
547
+
548
+	/**
549
+	 * This prepares the EE_DateTime value to be saved to the db as mysql timestamp (UTC +0
550
+	 * timezone).
551
+	 *
552
+	 * @param  mixed $datetime_value u
553
+	 *
554
+	 * @return string mysql timestamp in UTC
555
+	 * @throws \EE_Error
556
+	 */
557
+	public function prepare_for_use_in_db($datetime_value)
558
+	{
559
+		//we allow an empty value or DateTime object, but nothing else.
560
+		if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
561
+			throw new EE_Error(
562
+				__(
563
+					'The incoming value being prepared for setting in the database must either be empty or a php DateTime object',
564
+					'event_espresso'
565
+				)
566
+			);
567
+		}
568
+
569
+		if ($datetime_value instanceof DateTime) {
570
+			if ( ! $datetime_value instanceof DbSafeDateTime) {
571
+				$datetime_value = new DbSafeDateTime(
572
+					$datetime_value->format(EE_Datetime_Field::mysql_timestamp_format),
573
+					new \DateTimeZone($datetime_value->format('e'))
574
+				);
575
+			}
576
+
577
+			return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(
578
+				EE_Datetime_Field::mysql_timestamp_format
579
+			);
580
+		}
581
+
582
+		// if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
583
+		return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
584
+	}
585 585
 
586 586
 
587 587
 
@@ -593,38 +593,38 @@  discard block
 block discarded – undo
593 593
 	 * @return  mixed null | DateTime
594 594
 	 * @throws \EE_Error
595 595
 	 */
596
-    public function prepare_for_set_from_db($datetime_string)
597
-    {
598
-        //if $datetime_value is empty, and ! $this->_nullable, just use time()
599
-        if (empty($datetime_string) && $this->_nullable) {
600
-            return null;
601
-        }
602
-        // datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
603
-        if (empty($datetime_string)) {
604
-            $DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->get_UTC_DateTimeZone());
605
-        } else {
606
-            $DateTime = DateTime::createFromFormat(
607
-                EE_Datetime_Field::mysql_timestamp_format,
608
-                $datetime_string,
609
-                $this->get_UTC_DateTimeZone()
610
-            );
611
-            if ($DateTime instanceof \DateTime) {
612
-                $DateTime = new DbSafeDateTime(
613
-                    $DateTime->format(\EE_Datetime_Field::mysql_timestamp_format),
614
-                    $this->get_UTC_DateTimeZone()
615
-                );
616
-            }
617
-        }
618
-
619
-        if ( ! $DateTime instanceof DbSafeDateTime) {
620
-            // if still no datetime object, then let's just use now
621
-            $DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->get_UTC_DateTimeZone());
622
-        }
623
-        // THEN apply the field's set DateTimeZone
624
-        $DateTime->setTimezone($this->_DateTimeZone);
625
-
626
-        return $DateTime;
627
-    }
596
+	public function prepare_for_set_from_db($datetime_string)
597
+	{
598
+		//if $datetime_value is empty, and ! $this->_nullable, just use time()
599
+		if (empty($datetime_string) && $this->_nullable) {
600
+			return null;
601
+		}
602
+		// datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
603
+		if (empty($datetime_string)) {
604
+			$DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->get_UTC_DateTimeZone());
605
+		} else {
606
+			$DateTime = DateTime::createFromFormat(
607
+				EE_Datetime_Field::mysql_timestamp_format,
608
+				$datetime_string,
609
+				$this->get_UTC_DateTimeZone()
610
+			);
611
+			if ($DateTime instanceof \DateTime) {
612
+				$DateTime = new DbSafeDateTime(
613
+					$DateTime->format(\EE_Datetime_Field::mysql_timestamp_format),
614
+					$this->get_UTC_DateTimeZone()
615
+				);
616
+			}
617
+		}
618
+
619
+		if ( ! $DateTime instanceof DbSafeDateTime) {
620
+			// if still no datetime object, then let's just use now
621
+			$DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->get_UTC_DateTimeZone());
622
+		}
623
+		// THEN apply the field's set DateTimeZone
624
+		$DateTime->setTimezone($this->_DateTimeZone);
625
+
626
+		return $DateTime;
627
+	}
628 628
 
629 629
 
630 630
 
@@ -636,110 +636,110 @@  discard block
 block discarded – undo
636 636
 	 * @return bool true for yes false for no
637 637
 	 * @throws \EE_Error
638 638
 	 */
639
-    protected function _display_timezone()
640
-    {
641
-
642
-        // first let's do a comparison of timezone strings.
643
-	    // If they match then we can get out without any further calculations
644
-        $blog_string = get_option('timezone_string');
645
-        if ($blog_string === $this->_timezone_string) {
646
-            return false;
647
-        }
648
-        // now we need to calc the offset for the timezone string so we can compare with the blog offset.
649
-        $this_offset = $this->get_timezone_offset($this->_DateTimeZone);
650
-        $blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
651
-        // now compare
652
-	    return $blog_offset !== $this_offset;
653
-    }
654
-
655
-
656
-    /**
657
-     * This method returns a php DateTime object for setting on the EE_Base_Class model.
658
-     * EE passes around DateTime objects because they are MUCH easier to manipulate and deal
659
-     * with.
660
-     *
661
-     * @param int|string|DateTime $date_string            This should be the incoming date string.  It's assumed to be
662
-     *                                                    in the format that is set on the date_field (or DateTime
663
-     *                                                    object)!
664
-     *
665
-     * @return DateTime
666
-     */
667
-    protected function _get_date_object($date_string)
668
-    {
669
-        //first if this is an empty date_string and nullable is allowed, just return null.
670
-        if ($this->_nullable && empty($date_string)) {
671
-            return null;
672
-        }
673
-
674
-        // if incoming date
675
-        if ($date_string instanceof DateTime) {
676
-            $date_string->setTimezone($this->_DateTimeZone);
677
-
678
-            return $date_string;
679
-        }
680
-        // if empty date_string and made it here.
681
-        // Return a datetime object for now in the given timezone.
682
-        if (empty($date_string)) {
683
-            return new DbSafeDateTime(\EE_Datetime_Field::now, $this->_DateTimeZone);
684
-        }
685
-        // if $date_string is matches something that looks like a Unix timestamp let's just use it.
686
-        if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
687
-            try {
688
-                // This is operating under the assumption that the incoming Unix timestamp
689
-	            // is an ACTUAL Unix timestamp and not the calculated one output by current_time('timestamp');
690
-                $DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->_DateTimeZone);
691
-                $DateTime->setTimestamp($date_string);
692
-
693
-                return $DateTime;
694
-            } catch (Exception $e) {
695
-                // should be rare, but if things got fooled then let's just continue
696
-            }
697
-        }
698
-        //not a unix timestamp.  So we will use the set format on this object and set timezone to
699
-        //create the DateTime object.
700
-        $format = $this->_date_format . ' ' . $this->_time_format;
701
-        try {
702
-            $DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
703
-            if ($DateTime instanceof DateTime) {
704
-                $DateTime = new DbSafeDateTime(
705
-                    $DateTime->format(\EE_Datetime_Field::mysql_timestamp_format),
706
-                    $this->_DateTimeZone
707
-                );
708
-            }
709
-            if ( ! $DateTime instanceof DbSafeDateTime) {
710
-                throw new EE_Error(
711
-                    sprintf(
712
-                        __('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
713
-                        $date_string,
714
-                        $format
715
-                    )
716
-                );
717
-            }
718
-        } catch (Exception $e) {
719
-            // if we made it here then likely then something went really wrong.
720
-	        // Instead of throwing an exception, let's just return a DateTime object for now, in the set timezone.
721
-            $DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->_DateTimeZone);
722
-        }
723
-
724
-        return $DateTime;
725
-    }
726
-
727
-
728
-    /**
729
-     * get_timezone_offset
730
-     *
731
-     * @param \DateTimeZone $DateTimeZone
732
-     * @param int           $time
733
-     *
734
-     * @return mixed
735
-     */
736
-    public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null)
737
-    {
738
-        $time        = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
739
-        $transitions = $DateTimeZone->getTransitions($time);
740
-
741
-        return $transitions[0]['offset'];
742
-    }
639
+	protected function _display_timezone()
640
+	{
641
+
642
+		// first let's do a comparison of timezone strings.
643
+		// If they match then we can get out without any further calculations
644
+		$blog_string = get_option('timezone_string');
645
+		if ($blog_string === $this->_timezone_string) {
646
+			return false;
647
+		}
648
+		// now we need to calc the offset for the timezone string so we can compare with the blog offset.
649
+		$this_offset = $this->get_timezone_offset($this->_DateTimeZone);
650
+		$blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
651
+		// now compare
652
+		return $blog_offset !== $this_offset;
653
+	}
654
+
655
+
656
+	/**
657
+	 * This method returns a php DateTime object for setting on the EE_Base_Class model.
658
+	 * EE passes around DateTime objects because they are MUCH easier to manipulate and deal
659
+	 * with.
660
+	 *
661
+	 * @param int|string|DateTime $date_string            This should be the incoming date string.  It's assumed to be
662
+	 *                                                    in the format that is set on the date_field (or DateTime
663
+	 *                                                    object)!
664
+	 *
665
+	 * @return DateTime
666
+	 */
667
+	protected function _get_date_object($date_string)
668
+	{
669
+		//first if this is an empty date_string and nullable is allowed, just return null.
670
+		if ($this->_nullable && empty($date_string)) {
671
+			return null;
672
+		}
673
+
674
+		// if incoming date
675
+		if ($date_string instanceof DateTime) {
676
+			$date_string->setTimezone($this->_DateTimeZone);
677
+
678
+			return $date_string;
679
+		}
680
+		// if empty date_string and made it here.
681
+		// Return a datetime object for now in the given timezone.
682
+		if (empty($date_string)) {
683
+			return new DbSafeDateTime(\EE_Datetime_Field::now, $this->_DateTimeZone);
684
+		}
685
+		// if $date_string is matches something that looks like a Unix timestamp let's just use it.
686
+		if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
687
+			try {
688
+				// This is operating under the assumption that the incoming Unix timestamp
689
+				// is an ACTUAL Unix timestamp and not the calculated one output by current_time('timestamp');
690
+				$DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->_DateTimeZone);
691
+				$DateTime->setTimestamp($date_string);
692
+
693
+				return $DateTime;
694
+			} catch (Exception $e) {
695
+				// should be rare, but if things got fooled then let's just continue
696
+			}
697
+		}
698
+		//not a unix timestamp.  So we will use the set format on this object and set timezone to
699
+		//create the DateTime object.
700
+		$format = $this->_date_format . ' ' . $this->_time_format;
701
+		try {
702
+			$DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
703
+			if ($DateTime instanceof DateTime) {
704
+				$DateTime = new DbSafeDateTime(
705
+					$DateTime->format(\EE_Datetime_Field::mysql_timestamp_format),
706
+					$this->_DateTimeZone
707
+				);
708
+			}
709
+			if ( ! $DateTime instanceof DbSafeDateTime) {
710
+				throw new EE_Error(
711
+					sprintf(
712
+						__('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
713
+						$date_string,
714
+						$format
715
+					)
716
+				);
717
+			}
718
+		} catch (Exception $e) {
719
+			// if we made it here then likely then something went really wrong.
720
+			// Instead of throwing an exception, let's just return a DateTime object for now, in the set timezone.
721
+			$DateTime = new DbSafeDateTime(\EE_Datetime_Field::now, $this->_DateTimeZone);
722
+		}
723
+
724
+		return $DateTime;
725
+	}
726
+
727
+
728
+	/**
729
+	 * get_timezone_offset
730
+	 *
731
+	 * @param \DateTimeZone $DateTimeZone
732
+	 * @param int           $time
733
+	 *
734
+	 * @return mixed
735
+	 */
736
+	public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null)
737
+	{
738
+		$time        = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
739
+		$transitions = $DateTimeZone->getTransitions($time);
740
+
741
+		return $transitions[0]['offset'];
742
+	}
743 743
 
744 744
 
745 745
 
@@ -750,27 +750,27 @@  discard block
 block discarded – undo
750 750
 	 * @return string           abbreviation
751 751
 	 * @throws \EE_Error
752 752
 	 */
753
-    public function get_timezone_abbrev($timezone_string)
754
-    {
755
-        $timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
756
-        $dateTime        = new DateTime(\EE_Datetime_Field::now, new DateTimeZone($timezone_string));
757
-
758
-        return $dateTime->format('T');
759
-    }
760
-
761
-    /**
762
-     * Overrides the parent to allow for having a dynamic "now" value
763
-     *
764
-     * @return mixed
765
-     */
766
-    public function get_default_value()
767
-    {
768
-        if ($this->_default_value === EE_Datetime_Field::now) {
769
-            return time();
770
-        } else {
771
-            return parent::get_default_value();
772
-        }
773
-    }
753
+	public function get_timezone_abbrev($timezone_string)
754
+	{
755
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
756
+		$dateTime        = new DateTime(\EE_Datetime_Field::now, new DateTimeZone($timezone_string));
757
+
758
+		return $dateTime->format('T');
759
+	}
760
+
761
+	/**
762
+	 * Overrides the parent to allow for having a dynamic "now" value
763
+	 *
764
+	 * @return mixed
765
+	 */
766
+	public function get_default_value()
767
+	{
768
+		if ($this->_default_value === EE_Datetime_Field::now) {
769
+			return time();
770
+		} else {
771
+			return parent::get_default_value();
772
+		}
773
+	}
774 774
 
775 775
 
776 776
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 
223 223
             default :
224 224
                 return $pretty
225
-	                ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format
226
-	                : $this->_date_format . ' ' . $this->_time_format;
225
+	                ? $this->_pretty_date_format.' '.$this->_pretty_time_format
226
+	                : $this->_date_format.' '.$this->_time_format;
227 227
         }
228 228
     }
229 229
 
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
             if ($this->_display_timezone()) {
531 531
                 //must be explicit because schema could equal true.
532 532
                 if ($schema === 'no_html') {
533
-                    $timezone_string = ' (' . $DateTime->format('T') . ')';
533
+                    $timezone_string = ' ('.$DateTime->format('T').')';
534 534
                 } else {
535
-                    $timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format('T') . ')</span>';
535
+                    $timezone_string = ' <span class="ee_dtt_timezone_string">('.$DateTime->format('T').')</span>';
536 536
                 }
537 537
             } else {
538 538
                 $timezone_string = '';
539 539
             }
540 540
 
541
-            return $DateTime->format($format_string) . $timezone_string;
541
+            return $DateTime->format($format_string).$timezone_string;
542 542
         } else {
543 543
             return $DateTime->format($format_string);
544 544
         }
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
         }
698 698
         //not a unix timestamp.  So we will use the set format on this object and set timezone to
699 699
         //create the DateTime object.
700
-        $format = $this->_date_format . ' ' . $this->_time_format;
700
+        $format = $this->_date_format.' '.$this->_time_format;
701 701
         try {
702 702
             $DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
703 703
             if ($DateTime instanceof DateTime) {
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_Checkout
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage    core
10
- * @author				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_Checkout
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage    core
10
+  * @author				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_Checkout {
15 15
 
16 16
 	/**
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
 	 */
805 805
 	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
806 806
 		return ! $this->revisit
807
-		       || $this->primary_revisit
808
-		       || (
809
-			       $this->revisit && $this->reg_url_link === $registration->reg_url_link()
810
-		       )
807
+			   || $this->primary_revisit
808
+			   || (
809
+				   $this->revisit && $this->reg_url_link === $registration->reg_url_link()
810
+			   )
811 811
 			? true
812 812
 			: false;
813 813
 	}
@@ -1199,16 +1199,16 @@  discard block
 block discarded – undo
1199 1199
 	 * @return array
1200 1200
 	 * @throws \EE_Error
1201 1201
 	 */
1202
-    public function __sleep()
1203
-    {
1204
-	    if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) {
1205
-		    $this->primary_attendee_obj = $this->primary_attendee_obj->ID();
1206
-	    }        // remove the reg form and the checkout
1207
-	    if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1208
-		    $this->transaction = $this->transaction->ID();
1209
-	    }        // remove the reg form and the checkout
1210
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1211
-    }
1202
+	public function __sleep()
1203
+	{
1204
+		if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) {
1205
+			$this->primary_attendee_obj = $this->primary_attendee_obj->ID();
1206
+		}        // remove the reg form and the checkout
1207
+		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1208
+			$this->transaction = $this->transaction->ID();
1209
+		}        // remove the reg form and the checkout
1210
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1211
+	}
1212 1212
 
1213 1213
 
1214 1214
 	/**
Please login to merge, or discard this patch.
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
248 248
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
249 249
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
250
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
250
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
251 251
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
252
-		$this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' ));
252
+		$this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC'));
253 253
 	}
254 254
 
255 255
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @return boolean
261 261
 	 */
262 262
 	public function any_reg_status_updated() {
263
-		foreach ( $this->reg_status_updated as $reg_status ) {
264
-			if ( $reg_status ) {
263
+		foreach ($this->reg_status_updated as $reg_status) {
264
+			if ($reg_status) {
265 265
 				return true;
266 266
 			}
267 267
 		}
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @param $REG_ID
275 275
 	 * @return boolean
276 276
 	 */
277
-	public function reg_status_updated( $REG_ID ) {
278
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
277
+	public function reg_status_updated($REG_ID) {
278
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
279 279
 	}
280 280
 
281 281
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param $REG_ID
285 285
 	 * @param $reg_status
286 286
 	 */
287
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
288
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
287
+	public function set_reg_status_updated($REG_ID, $reg_status) {
288
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
289 289
 	}
290 290
 
291 291
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * can ONLY be set by the  Finalize_Registration reg step
307 307
 	 */
308 308
 	public function set_exit_spco() {
309
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
309
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310 310
 			$this->exit_spco = true;
311 311
 		}
312 312
 	}
@@ -323,12 +323,12 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public function reset_for_current_request() {
325 325
 		$this->process_form_submission = FALSE;
326
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
326
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
327 327
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
328 328
 		$this->continue_reg = true;
329 329
 		$this->redirect = false;
330 330
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
331
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
331
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
332 332
 			$this->redirect_form = '';
333 333
 		}
334 334
 		$this->redirect_url = '';
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
346 346
 	 * @return    void
347 347
 	 */
348
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
349
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
348
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
349
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
350 350
 	}
351 351
 
352 352
 
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
 	 * @return    void
363 363
 	 * @throws \EE_Error
364 364
 	 */
365
-	public function skip_reg_step( $reg_step_slug = '' ) {
366
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
367
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
368
-			$step_to_skip->set_is_current_step( false );
365
+	public function skip_reg_step($reg_step_slug = '') {
366
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
367
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
368
+			$step_to_skip->set_is_current_step(false);
369 369
 			$step_to_skip->set_completed();
370 370
 			// advance to the next step
371
-			$this->set_current_step( $this->next_step->slug() );
371
+			$this->set_current_step($this->next_step->slug());
372 372
 			// also reset the step param in the request in case any other code references that directly
373
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
373
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
374 374
 			// since we are skipping a step and setting the current step to be what was previously the next step,
375 375
 			// we need to check that the next step is now correct, and not still set to the current step.
376
-			if ( $this->current_step->slug() === $this->next_step->slug() ) {
376
+			if ($this->current_step->slug() === $this->next_step->slug()) {
377 377
 				// correctly setup the next step
378 378
 				$this->set_next_step();
379 379
 			}
380
-			$this->set_reg_step_initiated( $this->current_step );
380
+			$this->set_reg_step_initiated($this->current_step);
381 381
 		}
382 382
 	}
383 383
 
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 	 * @param bool   $reset whether to reset reg steps after removal
392 392
 	 * @throws EE_Error
393 393
 	 */
394
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
395
-		unset( $this->reg_steps[ $reg_step_slug  ] );
396
-		if ( $this->transaction instanceof EE_Transaction ) {
394
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
395
+		unset($this->reg_steps[$reg_step_slug]);
396
+		if ($this->transaction instanceof EE_Transaction) {
397 397
 			// now remove reg step from TXN and save
398
-			$this->transaction->remove_reg_step( $reg_step_slug );
398
+			$this->transaction->remove_reg_step($reg_step_slug);
399 399
 			$this->transaction->save();
400 400
 		}
401
-		if ( $reset ) {
401
+		if ($reset) {
402 402
 			$this->reset_reg_steps();
403 403
 		}
404 404
 	}
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 	 * @param int    $order
414 414
 	 * @return    void
415 415
 	 */
416
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
417
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
418
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
416
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
417
+		if (isset($this->reg_steps[$reg_step_slug])) {
418
+			$this->reg_steps[$reg_step_slug]->set_order($order);
419 419
 		}
420 420
 	}
421 421
 
@@ -428,25 +428,25 @@  discard block
 block discarded – undo
428 428
 	 * @param string $current_step
429 429
 	 * @return    void
430 430
 	 */
431
-	public function set_current_step( $current_step ) {
431
+	public function set_current_step($current_step) {
432 432
 		// grab what step we're on
433
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
433
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
434 434
 		// verify instance
435
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
435
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
436 436
 			// we don't want to repeat completed steps if this is the first time through SPCO
437
-			if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) {
437
+			if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) {
438 438
 				// so advance to the next step
439 439
 				$this->set_next_step();
440
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
440
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
441 441
 					// and attempt to set it as the current step
442
-					$this->set_current_step( $this->next_step->slug() );
442
+					$this->set_current_step($this->next_step->slug());
443 443
 				}
444 444
 				return;
445 445
 			}
446
-			$this->current_step->set_is_current_step( TRUE );
446
+			$this->current_step->set_is_current_step(TRUE);
447 447
 		} else {
448 448
 			EE_Error::add_error(
449
-				__( 'The current step could not be set.', 'event_espresso' ),
449
+				__('The current step could not be set.', 'event_espresso'),
450 450
 				__FILE__, __FUNCTION__, __LINE__
451 451
 			);
452 452
 		}
@@ -463,20 +463,20 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function set_next_step() {
465 465
 		// set pointer to start of array
466
-		reset( $this->reg_steps );
466
+		reset($this->reg_steps);
467 467
 		// if there is more than one step
468
-		if ( count( $this->reg_steps ) > 1 ) {
468
+		if (count($this->reg_steps) > 1) {
469 469
 			// advance to the current step and set pointer
470
-			while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) {
471
-				next( $this->reg_steps );
470
+			while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') {
471
+				next($this->reg_steps);
472 472
 			}
473 473
 		}
474 474
 		// advance one more spot ( if it exists )
475
-		$this->next_step = next( $this->reg_steps );
475
+		$this->next_step = next($this->reg_steps);
476 476
 		// verify instance
477
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
477
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
478 478
 		// then back to current step to reset
479
-		prev( $this->reg_steps );
479
+		prev($this->reg_steps);
480 480
 	}
481 481
 
482 482
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 *  @return 	EE_SPCO_Reg_Step | null
491 491
 	 */
492 492
 	public function get_next_reg_step() {
493
-		$next = next( $this->reg_steps );
494
-		prev( $this->reg_steps );
493
+		$next = next($this->reg_steps);
494
+		prev($this->reg_steps);
495 495
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
496 496
 	}
497 497
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *  @return 	EE_SPCO_Reg_Step | null
507 507
 	 */
508 508
 	public function get_prev_reg_step() {
509
-		$prev = prev( $this->reg_steps );
510
-		next( $this->reg_steps );
509
+		$prev = prev($this->reg_steps);
510
+		next($this->reg_steps);
511 511
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
512 512
 	}
513 513
 
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	 * @return void
521 521
 	 */
522 522
 	public function sort_reg_steps() {
523
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
524
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
523
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
524
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
525 525
 	}
526 526
 
527 527
 
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
 	 * @param string $reg_step_slug
535 535
 	 * @return EE_SPCO_Reg_Step|null
536 536
 	 */
537
-	public function find_reg_step( $reg_step_slug = '' ) {
538
-		if ( ! empty( $reg_step_slug ) ) {
537
+	public function find_reg_step($reg_step_slug = '') {
538
+		if ( ! empty($reg_step_slug)) {
539 539
 			// copy reg step array
540 540
 			$reg_steps = $this->reg_steps;
541 541
 			// set pointer to start of array
542
-			reset( $reg_steps );
542
+			reset($reg_steps);
543 543
 			// if there is more than one step
544
-			if ( count( $reg_steps ) > 1 ) {
544
+			if (count($reg_steps) > 1) {
545 545
 				// advance to the current step and set pointer
546
-				while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) {
547
-					next( $reg_steps );
546
+				while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') {
547
+					next($reg_steps);
548 548
 				}
549
-				return current( $reg_steps );
549
+				return current($reg_steps);
550 550
 			}
551 551
 		}
552 552
 		return null;
@@ -562,17 +562,17 @@  discard block
 block discarded – undo
562 562
 	 * @param EE_SPCO_Reg_Step $reg_step_B
563 563
 	 * @return int
564 564
 	 */
565
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
565
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
566 566
 		// send finalize_registration step to the end of the array
567
-		if ( $reg_step_A->slug() === 'finalize_registration' ) {
567
+		if ($reg_step_A->slug() === 'finalize_registration') {
568 568
 			return 1;
569
-		} else if ( $reg_step_B->slug() === 'finalize_registration' ) {
569
+		} else if ($reg_step_B->slug() === 'finalize_registration') {
570 570
 			return -1;
571 571
 		}
572
-		if ( $reg_step_A->order() === $reg_step_B->order() ) {
572
+		if ($reg_step_A->order() === $reg_step_B->order()) {
573 573
 			return 0;
574 574
 		}
575
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
575
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
576 576
 	}
577 577
 
578 578
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @param    EE_SPCO_Reg_Step $reg_step
585 585
 	 * @throws \EE_Error
586 586
 	 */
587
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
587
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
588 588
 		// call set_reg_step_initiated ???
589 589
 		if (
590 590
 			// first time visiting SPCO ?
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 			)
598 598
 		) {
599 599
 			// set the start time for this reg step
600
-			if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) {
601
-				if ( WP_DEBUG ) {
600
+			if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) {
601
+				if (WP_DEBUG) {
602 602
 					EE_Error::add_error(
603 603
 						sprintf(
604
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
604
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
605 605
 							$reg_step->name()
606 606
 						),
607 607
 						__FILE__, __FUNCTION__, __LINE__
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
 	 * 	@return 	void
621 621
 	 */
622 622
 	public function set_reg_step_JSON_info() {
623
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
623
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
624 624
 		// pass basic reg step data to JS
625
-		foreach ( $this->reg_steps as $reg_step ) {
626
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
625
+		foreach ($this->reg_steps as $reg_step) {
626
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
627 627
 		}
628 628
 		// reset reg step html
629 629
 //		$this->json_response->set_reg_step_html( '' );
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function reset_reg_steps() {
641 641
 		$this->sort_reg_steps();
642
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
642
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
643 643
 		$this->set_next_step();
644 644
 		// the text that appears on the reg step form submit button
645 645
 		$this->current_step->set_submit_button_text();
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
 	 */
657 657
 	public function get_registration_time_limit() {
658 658
 
659
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
659
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
660 660
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
661
-		$registration_time_limit = date( $time_limit_format, $registration_time_limit );
661
+		$registration_time_limit = date($time_limit_format, $registration_time_limit);
662 662
 		return apply_filters(
663 663
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
664 664
 			$registration_time_limit
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		//		overpaid TXN
679 679
 		//		free TXN ( total = 0.00 )
680 680
 		// then payment required is TRUE
681
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
681
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
682 682
 	}
683 683
 
684 684
 
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
 	 * @param EE_Transaction $transaction
691 691
 	 * @return EE_Cart
692 692
 	 */
693
-	public function get_cart_for_transaction( $transaction ) {
694
-		$session = EE_Registry::instance()->load_core( 'Session' );
695
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null;
693
+	public function get_cart_for_transaction($transaction) {
694
+		$session = EE_Registry::instance()->load_core('Session');
695
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null;
696 696
 		// verify cart
697
-		if ( ! $cart instanceof EE_Cart ) {
698
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
697
+		if ( ! $cart instanceof EE_Cart) {
698
+			$cart = EE_Registry::instance()->load_core('Cart');
699 699
 		}
700 700
 
701 701
 		return $cart;
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function initialize_txn_reg_steps_array() {
713 713
 		$txn_reg_steps_array = array();
714
-		foreach ( $this->reg_steps as $reg_step ) {
715
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
714
+		foreach ($this->reg_steps as $reg_step) {
715
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
716 716
 		}
717 717
 		return $txn_reg_steps_array;
718 718
 	}
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
 	 */
729 729
 	public function update_txn_reg_steps_array() {
730 730
 		$updated = false;
731
-		foreach ( $this->reg_steps as $reg_step ) {
732
-			if ( $reg_step->completed() ) {
733
-				$updated = $this->transaction->set_reg_step_completed( $reg_step->slug() )
731
+		foreach ($this->reg_steps as $reg_step) {
732
+			if ($reg_step->completed()) {
733
+				$updated = $this->transaction->set_reg_step_completed($reg_step->slug())
734 734
 					? true
735 735
 					: $updated;
736 736
 			}
737 737
 		}
738
-		if ( $updated ) {
738
+		if ($updated) {
739 739
 			$this->transaction->save();
740 740
 		}
741 741
 		return $updated;
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
 	 * @throws \EE_Error
752 752
 	 */
753 753
 	public function stash_transaction_and_checkout() {
754
-		if ( ! $this->revisit ) {
754
+		if ( ! $this->revisit) {
755 755
 			$this->update_txn_reg_steps_array();
756 756
 		}
757 757
 		$this->track_transaction_and_registration_status_updates();
758 758
 		// save all data to the db, but suppress errors
759 759
 		//$this->save_all_data( FALSE );
760 760
 		// cache the checkout in the session
761
-		EE_Registry::instance()->SSN->set_checkout( $this );
761
+		EE_Registry::instance()->SSN->set_checkout($this);
762 762
 	}
763 763
 
764 764
 
@@ -773,15 +773,15 @@  discard block
 block discarded – undo
773 773
 	 */
774 774
 	public function track_transaction_and_registration_status_updates() {
775 775
 		// verify the transaction
776
-		if ( $this->transaction instanceof EE_Transaction ) {
776
+		if ($this->transaction instanceof EE_Transaction) {
777 777
 			// has there been a TXN status change during this checkout?
778 778
 			$this->txn_status_updated = $this->transaction->txn_status_updated();
779 779
 			/** @type EE_Registration_Processor $registration_processor */
780
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
780
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
781 781
 			// grab the saved registrations from the transaction
782
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
783
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
784
-					$this->set_reg_status_updated( $registration->ID(), true );
782
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
783
+				if ($registration_processor->reg_status_updated($registration->ID())) {
784
+					$this->set_reg_status_updated($registration->ID(), true);
785 785
 				}
786 786
 			}
787 787
 		}
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	 * @return    bool
803 803
 	 * @throws \EE_Error
804 804
 	 */
805
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
805
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
806 806
 		return ! $this->revisit
807 807
 		       || $this->primary_revisit
808 808
 		       || (
@@ -835,18 +835,18 @@  discard block
 block discarded – undo
835 835
 	 * @return bool
836 836
 	 * @throws \EE_Error
837 837
 	 */
838
-	public function save_all_data( $show_errors = TRUE ) {
838
+	public function save_all_data($show_errors = TRUE) {
839 839
 		// verify the transaction
840
-		if ( $this->transaction instanceof EE_Transaction ) {
840
+		if ($this->transaction instanceof EE_Transaction) {
841 841
 			// save to ensure that TXN has ID
842 842
 			$this->transaction->save();
843 843
 			// grab the saved registrations from the transaction
844
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
845
-				$this->_save_registration( $registration, $show_errors );
844
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
845
+				$this->_save_registration($registration, $show_errors);
846 846
 			}
847 847
 		} else {
848
-			if ( $show_errors ) {
849
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
848
+			if ($show_errors) {
849
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			}
851 851
 			return FALSE;
852 852
 		}
@@ -863,32 +863,32 @@  discard block
 block discarded – undo
863 863
 	 * @return void
864 864
 	 * @throws \EE_Error
865 865
 	 */
866
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
866
+	private function _save_registration($registration, $show_errors = TRUE) {
867 867
 		// verify object
868
-		if ( $registration instanceof EE_Registration ) {
868
+		if ($registration instanceof EE_Registration) {
869 869
 			// should this registration be processed during this visit ?
870
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
870
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
871 871
 				//set TXN ID
872
-				if ( ! $registration->transaction_ID() ) {
873
-					$registration->set_transaction_id( $this->transaction->ID() );
872
+				if ( ! $registration->transaction_ID()) {
873
+					$registration->set_transaction_id($this->transaction->ID());
874 874
 				}
875 875
 				// verify and save the attendee
876
-				$this->_save_registration_attendee( $registration, $show_errors );
876
+				$this->_save_registration_attendee($registration, $show_errors);
877 877
 				// save answers to reg form questions
878
-				$this->_save_registration_answers( $registration, $show_errors );
878
+				$this->_save_registration_answers($registration, $show_errors);
879 879
 				// save changes
880 880
 				$registration->save();
881 881
 				// update txn cache
882
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
883
-					if ( $show_errors ) {
884
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
882
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
883
+					if ($show_errors) {
884
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
885 885
 					}
886 886
 				}
887 887
 			}
888 888
 		} else {
889
-			if ( $show_errors ) {
889
+			if ($show_errors) {
890 890
 				EE_Error::add_error(
891
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
891
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
892 892
 					__FILE__, __FUNCTION__, __LINE__
893 893
 				);
894 894
 			}
@@ -905,25 +905,25 @@  discard block
 block discarded – undo
905 905
 	 * @return void
906 906
 	 * @throws \EE_Error
907 907
 	 */
908
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
909
-		if ( $registration->attendee() instanceof EE_Attendee ) {
908
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
909
+		if ($registration->attendee() instanceof EE_Attendee) {
910 910
 			// save so that ATT has ID
911 911
 			$registration->attendee()->save();
912
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) {
913
-				if ( $show_errors ) {
912
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
913
+				if ($show_errors) {
914 914
 					EE_Error::add_error(
915
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
915
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
916 916
 						__FILE__, __FUNCTION__, __LINE__
917 917
 					);
918 918
 				}
919 919
 			}
920 920
 		} else {
921
-			if ( $show_errors ) {
921
+			if ($show_errors) {
922 922
 				EE_Error::add_error(
923 923
 					sprintf(
924 924
 						'%1$s||%1$s $attendee = %2$s',
925
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
926
-						var_export( $registration->attendee(), true )
925
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
926
+						var_export($registration->attendee(), true)
927 927
 					),
928 928
 					__FILE__, __FUNCTION__, __LINE__
929 929
 				);
@@ -941,25 +941,25 @@  discard block
 block discarded – undo
941 941
 	 * @return void
942 942
 	 * @throws \EE_Error
943 943
 	 */
944
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
944
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
945 945
 		// now save the answers
946
-		foreach ( $registration->answers() as $cache_key => $answer ) {
946
+		foreach ($registration->answers() as $cache_key => $answer) {
947 947
 			// verify object
948
-			if ( $answer instanceof EE_Answer ) {
949
-				$answer->set_registration( $registration->ID() );
948
+			if ($answer instanceof EE_Answer) {
949
+				$answer->set_registration($registration->ID());
950 950
 				$answer->save();
951
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
952
-					if ( $show_errors ) {
951
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
952
+					if ($show_errors) {
953 953
 						EE_Error::add_error(
954
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
954
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
955 955
 							__FILE__, __FUNCTION__, __LINE__
956 956
 						);
957 957
 					}
958 958
 				}
959 959
 			} else {
960
-				if ( $show_errors ) {
960
+				if ($show_errors) {
961 961
 					EE_Error::add_error(
962
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
962
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
963 963
 						__FILE__, __FUNCTION__, __LINE__
964 964
 					);
965 965
 				}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @return bool
979 979
 	 * @throws \EE_Error
980 980
 	 */
981
-	public function refresh_all_entities( $from_db = false ) {
981
+	public function refresh_all_entities($from_db = false) {
982 982
 		$from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response'
983 983
 			? true
984 984
 			: $from_db;
@@ -1002,11 +1002,11 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	protected function refresh_from_db() {
1004 1004
 		// verify the transaction
1005
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1005
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1006 1006
 			// pull fresh TXN data from the db
1007
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
1007
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
1008 1008
 			// update EE_Checkout's cached primary_attendee object
1009
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
1009
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
1010 1010
 			// update EE_Checkout's cached payment object
1011 1011
 			$payment = $this->transaction->last_payment();
1012 1012
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -1014,9 +1014,9 @@  discard block
 block discarded – undo
1014 1014
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
1015 1015
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
1016 1016
 			//now refresh the cart, based on the TXN
1017
-			$this->cart = $this->get_cart_for_transaction( $this->transaction );
1017
+			$this->cart = $this->get_cart_for_transaction($this->transaction);
1018 1018
 		} else {
1019
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1019
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1020 1020
 			return FALSE;
1021 1021
 		}
1022 1022
 		return TRUE;
@@ -1031,21 +1031,21 @@  discard block
 block discarded – undo
1031 1031
 	 * @return  EE_Attendee | null
1032 1032
 	 * @throws \EE_Error
1033 1033
 	 */
1034
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1034
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1035 1035
 
1036 1036
 		$primary_attendee_obj = null;
1037 1037
 		// grab the saved registrations from the transaction
1038
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1038
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1039 1039
 			// verify object
1040
-			if ( $registration instanceof EE_Registration ) {
1040
+			if ($registration instanceof EE_Registration) {
1041 1041
 				$attendee = $registration->attendee();
1042 1042
 				// verify object && maybe cache primary_attendee_obj ?
1043
-				if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) {
1043
+				if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) {
1044 1044
 					$primary_attendee_obj = $attendee;
1045 1045
 				}
1046 1046
 			} else {
1047 1047
 				EE_Error::add_error(
1048
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1048
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1049 1049
 						__FILE__, __FUNCTION__, __LINE__
1050 1050
 				);
1051 1051
 			}
@@ -1066,43 +1066,43 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	protected function refresh_entity_map() {
1068 1068
 		// verify the transaction
1069
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1069
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1070 1070
 			// never cache payment info
1071
-			$this->transaction->clear_cache( 'Payment' );
1071
+			$this->transaction->clear_cache('Payment');
1072 1072
 			// is the Payment Options Reg Step completed ?
1073
-			if ( $this->transaction->reg_step_completed( 'payment_options' ) ) {
1073
+			if ($this->transaction->reg_step_completed('payment_options')) {
1074 1074
 				// then check for payments and update TXN accordingly
1075 1075
 				/** @type EE_Transaction_Payments $transaction_payments */
1076
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1077
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1076
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1077
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1078 1078
 			}
1079 1079
 			// grab the saved registrations from the transaction
1080 1080
 			foreach (
1081
-				$this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration
1081
+				$this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration
1082 1082
 			) {
1083
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1083
+				$this->_refresh_registration($reg_cache_ID, $registration);
1084 1084
 			}
1085 1085
 			// make sure our cached TXN is added to the model entity mapper
1086
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1086
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1087 1087
 
1088 1088
 		} else {
1089
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1089
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1090 1090
 			return FALSE;
1091 1091
 		}
1092 1092
 		// verify and update the cart because inaccurate totals are not so much fun
1093
-		if ( $this->cart instanceof EE_Cart ) {
1093
+		if ($this->cart instanceof EE_Cart) {
1094 1094
 			$grand_total = $this->cart->get_grand_total();
1095
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1095
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1096 1096
 				$grand_total->recalculate_total_including_taxes();
1097 1097
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1098 1098
 					$this->cart->get_grand_total()->ID(),
1099 1099
 					$this->cart->get_grand_total()
1100 1100
 				);
1101 1101
 			}
1102
-			if ( $grand_total instanceof EE_Line_Item ) {
1103
-				$this->cart = EE_Cart::instance( $grand_total );
1102
+			if ($grand_total instanceof EE_Line_Item) {
1103
+				$this->cart = EE_Cart::instance($grand_total);
1104 1104
 			} else {
1105
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1105
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1106 1106
 				return false;
1107 1107
 			}
1108 1108
 		}
@@ -1119,19 +1119,19 @@  discard block
 block discarded – undo
1119 1119
 	 * @return void
1120 1120
 	 * @throws \EE_Error
1121 1121
 	 */
1122
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1122
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1123 1123
 
1124 1124
 		// verify object
1125
-		if ( $registration instanceof EE_Registration ) {
1125
+		if ($registration instanceof EE_Registration) {
1126 1126
 			// update the entity mapper attendee
1127
-			$this->_refresh_registration_attendee( $registration );
1127
+			$this->_refresh_registration_attendee($registration);
1128 1128
 			// update the entity mapper answers for reg form questions
1129
-			$this->_refresh_registration_answers( $registration );
1129
+			$this->_refresh_registration_answers($registration);
1130 1130
 			// make sure the cached registration is added to the model entity mapper
1131
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1131
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1132 1132
 		} else {
1133 1133
 			EE_Error::add_error(
1134
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1134
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1135 1135
 				__FILE__, __FUNCTION__, __LINE__
1136 1136
 			);
1137 1137
 		}
@@ -1146,15 +1146,15 @@  discard block
 block discarded – undo
1146 1146
 	 * @return void
1147 1147
 	 * @throws \EE_Error
1148 1148
 	 */
1149
-	protected function _refresh_registration_attendee( $registration ) {
1149
+	protected function _refresh_registration_attendee($registration) {
1150 1150
 
1151 1151
 		$attendee = $registration->attendee();
1152 1152
 		// verify object
1153
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1153
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1154 1154
 			// make sure the cached attendee is added to the model entity mapper
1155
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1155
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1156 1156
 			// maybe cache primary_attendee_obj ?
1157
-			if ( $registration->is_primary_registrant() ) {
1157
+			if ($registration->is_primary_registrant()) {
1158 1158
 				$this->primary_attendee_obj = $attendee;
1159 1159
 			}
1160 1160
 		}
@@ -1169,19 +1169,19 @@  discard block
 block discarded – undo
1169 1169
 	 * @return void
1170 1170
 	 * @throws \EE_Error
1171 1171
 	 */
1172
-	protected function _refresh_registration_answers( $registration ) {
1172
+	protected function _refresh_registration_answers($registration) {
1173 1173
 
1174 1174
 		// now update the answers
1175
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1175
+		foreach ($registration->answers() as $cache_key => $answer) {
1176 1176
 			// verify object
1177
-			if ( $answer instanceof EE_Answer ) {
1178
-				if ( $answer->ID() ) {
1177
+			if ($answer instanceof EE_Answer) {
1178
+				if ($answer->ID()) {
1179 1179
 					// make sure the cached answer is added to the model entity mapper
1180
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1180
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1181 1181
 				}
1182 1182
 			} else {
1183 1183
 				EE_Error::add_error(
1184
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1184
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1185 1185
 					__FILE__, __FUNCTION__, __LINE__
1186 1186
 				);
1187 1187
 			}
@@ -1201,13 +1201,13 @@  discard block
 block discarded – undo
1201 1201
 	 */
1202 1202
     public function __sleep()
1203 1203
     {
1204
-	    if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) {
1204
+	    if ($this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID()) {
1205 1205
 		    $this->primary_attendee_obj = $this->primary_attendee_obj->ID();
1206 1206
 	    }        // remove the reg form and the checkout
1207
-	    if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1207
+	    if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1208 1208
 		    $this->transaction = $this->transaction->ID();
1209 1209
 	    }        // remove the reg form and the checkout
1210
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1210
+        return array_diff(array_keys(get_object_vars($this)), array('billing_form', 'registration_form'));
1211 1211
     }
1212 1212
 
1213 1213
 
@@ -1217,15 +1217,15 @@  discard block
 block discarded – undo
1217 1217
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1218 1218
 	 */
1219 1219
 	public function __wakeup() {
1220
-		if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint( $this->primary_attendee_obj ) !== 0 ) {
1220
+		if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint($this->primary_attendee_obj) !== 0) {
1221 1221
 			// $this->primary_attendee_obj is actually just an ID, so use it to get the object from the db
1222
-			$this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID( $this->primary_attendee_obj );
1222
+			$this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID($this->primary_attendee_obj);
1223 1223
 		}
1224
-		if ( ! $this->transaction instanceof EE_Transaction && absint( $this->transaction ) !== 0 ) {
1224
+		if ( ! $this->transaction instanceof EE_Transaction && absint($this->transaction) !== 0) {
1225 1225
 			// $this->transaction is actually just an ID, so use it to get the object from the db
1226
-			$this->transaction = EEM_Transaction::instance()->get_one_by_ID( $this->transaction );
1226
+			$this->transaction = EEM_Transaction::instance()->get_one_by_ID($this->transaction);
1227 1227
 		}
1228
-		foreach ( $this->reg_steps as $reg_step ) {
1228
+		foreach ($this->reg_steps as $reg_step) {
1229 1229
 			$reg_step->checkout = $this;
1230 1230
 		}
1231 1231
 	}
@@ -1242,12 +1242,12 @@  discard block
 block discarded – undo
1242 1242
 	 * @param bool   $display_request
1243 1243
 	 * @throws \EE_Error
1244 1244
 	 */
1245
-	public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1245
+	public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1246 1246
 		$disabled = true;
1247
-		if ( WP_DEBUG && ! $disabled ) {
1248
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1247
+		if (WP_DEBUG && ! $disabled) {
1248
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1249 1249
 			$default_data = array(
1250
-				$class 		=> $func . '() : ' . $line,
1250
+				$class 		=> $func.'() : '.$line,
1251 1251
 				'request->step' 		=> $this->step,
1252 1252
 				'request->action' 	=> $this->action,
1253 1253
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1259,24 +1259,24 @@  discard block
 block discarded – undo
1259 1259
 				'reg_url_link' => $this->reg_url_link,
1260 1260
 				'REQ' => $display_request ? $_REQUEST : '',
1261 1261
 			);
1262
-			if ( $this->transaction instanceof EE_Transaction ) {
1263
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1264
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1265
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1266
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1262
+			if ($this->transaction instanceof EE_Transaction) {
1263
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1264
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1265
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1266
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1267 1267
 				}
1268
-				if ( $this->transaction->ID() ) {
1269
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1268
+				if ($this->transaction->ID()) {
1269
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1270 1270
 					// don't serialize objects
1271
-					$info = $this->_strip_objects( $info );
1272
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1273
-						$debug_data[ $TXN_ID ] = array();
1271
+					$info = $this->_strip_objects($info);
1272
+					if ( ! isset($debug_data[$TXN_ID])) {
1273
+						$debug_data[$TXN_ID] = array();
1274 1274
 					}
1275
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1275
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1276 1276
 						$default_data,
1277 1277
 						$info
1278 1278
 					);
1279
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1279
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1280 1280
 				}
1281 1281
 			}
1282 1282
 		}
@@ -1289,23 +1289,23 @@  discard block
 block discarded – undo
1289 1289
 	 * @param array $info
1290 1290
 	 * @return array
1291 1291
 	 */
1292
-	public function _strip_objects( $info = array() ) {
1293
-		foreach ( (array)$info as $key => $value ) {
1294
-			if ( is_array( $value )) {
1295
-				$info[ $key ] = $this->_strip_objects( $value );
1296
-			} else if ( is_object( $value ) ) {
1297
-				$object_class = get_class( $value );
1298
-				$info[ $object_class ] = array();
1299
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1300
-				if ( method_exists( $value, 'status' ) ) {
1301
-					$info[ $object_class ][ 'status' ] = $value->status();
1302
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1303
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1292
+	public function _strip_objects($info = array()) {
1293
+		foreach ((array) $info as $key => $value) {
1294
+			if (is_array($value)) {
1295
+				$info[$key] = $this->_strip_objects($value);
1296
+			} else if (is_object($value)) {
1297
+				$object_class = get_class($value);
1298
+				$info[$object_class] = array();
1299
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1300
+				if (method_exists($value, 'status')) {
1301
+					$info[$object_class]['status'] = $value->status();
1302
+				} else if (method_exists($value, 'status_ID')) {
1303
+					$info[$object_class]['status'] = $value->status_ID();
1304 1304
 				}
1305
-				unset( $info[ $key ] );
1305
+				unset($info[$key]);
1306 1306
 			}
1307 1307
 		}
1308
-		return (array)$info;
1308
+		return (array) $info;
1309 1309
 	}
1310 1310
 
1311 1311
 
Please login to merge, or discard this patch.