Completed
Pull Request — master (#1194)
by Darren
09:05
created
data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_org_options.dmsstage.php 2 patches
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -103,289 +103,289 @@
 block discarded – undo
103 103
 class EE_DMS_4_1_0_org_options extends EE_Data_Migration_Script_Stage
104 104
 {
105 105
 
106
-    public function _migration_step($num_items = 50)
107
-    {
106
+	public function _migration_step($num_items = 50)
107
+	{
108 108
 
109
-        $items_actually_migrated = 0;
110
-        $old_org_options = get_option('events_organization_settings');
111
-        foreach ($this->_org_options_we_know_how_to_migrate as $option_name) {
112
-            // only bother migrating if there's a setting to migrate. Otherwise we'll just use the default
113
-            if (isset($old_org_options[ $option_name ])) {
114
-                $this->_handle_org_option($option_name, $old_org_options[ $option_name ]);
115
-            }
116
-            if ($option_name=='surcharge') {
117
-                $this->_insert_new_global_surcharge_price($old_org_options);
118
-            }
119
-            $items_actually_migrated++;
120
-        }
109
+		$items_actually_migrated = 0;
110
+		$old_org_options = get_option('events_organization_settings');
111
+		foreach ($this->_org_options_we_know_how_to_migrate as $option_name) {
112
+			// only bother migrating if there's a setting to migrate. Otherwise we'll just use the default
113
+			if (isset($old_org_options[ $option_name ])) {
114
+				$this->_handle_org_option($option_name, $old_org_options[ $option_name ]);
115
+			}
116
+			if ($option_name=='surcharge') {
117
+				$this->_insert_new_global_surcharge_price($old_org_options);
118
+			}
119
+			$items_actually_migrated++;
120
+		}
121 121
 
122
-        $success = EE_Config::instance()->update_espresso_config(false, true);
123
-        if (! $success) {
124
-            $this->add_error(sprintf(__('Could not save EE Config during org options stage. Reason: %s', 'event_espresso'), EE_Error::get_notices(false)));
125
-            EE_Error::overwrite_errors();
126
-        }
127
-        EE_Network_Config::instance()->update_config(false, false);
128
-        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
129
-            // we may have added new pages and this might be necessary
130
-            flush_rewrite_rules();
131
-            $this->set_completed();
132
-        }
133
-        return $items_actually_migrated;
134
-    }
135
-    public function _count_records_to_migrate()
136
-    {
137
-        $count_of_options_to_migrate = count($this->_org_options_we_know_how_to_migrate);
138
-        return $count_of_options_to_migrate;
139
-    }
140
-    public function __construct()
141
-    {
142
-        $this->_pretty_name = __("Organization Options/Config", "event_espresso");
143
-        $this->_org_options_we_know_how_to_migrate = apply_filters('FHEE__EE_DMS_4_1_0_org_options__org_options_we_know_how_to_migrate', $this->_org_options_we_know_how_to_migrate);
144
-        parent::__construct();
145
-    }
122
+		$success = EE_Config::instance()->update_espresso_config(false, true);
123
+		if (! $success) {
124
+			$this->add_error(sprintf(__('Could not save EE Config during org options stage. Reason: %s', 'event_espresso'), EE_Error::get_notices(false)));
125
+			EE_Error::overwrite_errors();
126
+		}
127
+		EE_Network_Config::instance()->update_config(false, false);
128
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
129
+			// we may have added new pages and this might be necessary
130
+			flush_rewrite_rules();
131
+			$this->set_completed();
132
+		}
133
+		return $items_actually_migrated;
134
+	}
135
+	public function _count_records_to_migrate()
136
+	{
137
+		$count_of_options_to_migrate = count($this->_org_options_we_know_how_to_migrate);
138
+		return $count_of_options_to_migrate;
139
+	}
140
+	public function __construct()
141
+	{
142
+		$this->_pretty_name = __("Organization Options/Config", "event_espresso");
143
+		$this->_org_options_we_know_how_to_migrate = apply_filters('FHEE__EE_DMS_4_1_0_org_options__org_options_we_know_how_to_migrate', $this->_org_options_we_know_how_to_migrate);
144
+		parent::__construct();
145
+	}
146 146
 
147
-    private function _handle_org_option($option_name, $value)
148
-    {
149
-        $c = EE_Config::instance();
150
-        $cn = EE_Network_Config::instance();
151
-        switch ($option_name) {
152
-            case 'organization':
153
-                $c->organization->name = $value;
154
-                break;
155
-            case 'organization_street1':
156
-                $c->organization->address_1 = $value;
157
-                break;
158
-            case 'organization_street2':
159
-                $c->organization->address_2 = $value;
160
-                break;
161
-            case 'organization_city':
162
-                $c->organization->city = $value;
163
-                break;
164
-            case 'organization_state':
165
-                try {
166
-                    $state = $this->get_migration_script()->get_or_create_state($value);
167
-                    $state_id = $state['STA_ID'];
168
-                    $c->organization->STA_ID = $state_id;
169
-                } catch (EE_Error $e) {
170
-                }
171
-                break;
172
-            case 'organization_zip':
173
-                $c->organization->zip = $value;
174
-                break;
175
-            case 'contact_email':
176
-                $c->organization->email = $value;
177
-                break;
178
-            case 'default_payment_status':
179
-                $c->registration->default_STS_ID =  $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value);
180
-                break;
181
-            case 'organization_country':
182
-                $iso =$this->get_migration_script()->get_iso_from_3_1_country_id($value);
183
-                $c->organization->CNT_ISO = $iso;
184
-                $country_row = $this->get_migration_script()->get_or_create_country($iso);
185
-                if (! $country_row) {
186
-                    $this->add_error(sprintf(__("Could not set country's currency config because no country exists for ISO %s", "event_espresso"), $iso));
187
-                }
188
-                // can't use EE_Currency_Config's handy constructor because the models are off-limits right now (and it uses them)
189
-                $c->currency->code = $country_row['CNT_cur_code'];          // currency code: USD, CAD, EUR
190
-                $c->currency->name = $country_row['CNT_cur_single'];    // Dollar
191
-                $c->currency->plural = $country_row['CNT_cur_plural'];  // Dollars
192
-                $c->currency->sign =  $country_row['CNT_cur_sign'];             // currency sign: $
193
-                $c->currency->sign_b4 = filter_var($country_row['CNT_cur_sign_b4'], FILTER_VALIDATE_BOOLEAN);        // currency sign before or after: $TRUE  or  FALSE$
194
-                $c->currency->dec_plc = (int) $country_row['CNT_cur_dec_plc'];    // decimal places: 2 = 0.00  3 = 0.000
195
-                $c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk'];    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
196
-                $c->currency->thsnds = $country_row['CNT_cur_thsnds'];  // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
147
+	private function _handle_org_option($option_name, $value)
148
+	{
149
+		$c = EE_Config::instance();
150
+		$cn = EE_Network_Config::instance();
151
+		switch ($option_name) {
152
+			case 'organization':
153
+				$c->organization->name = $value;
154
+				break;
155
+			case 'organization_street1':
156
+				$c->organization->address_1 = $value;
157
+				break;
158
+			case 'organization_street2':
159
+				$c->organization->address_2 = $value;
160
+				break;
161
+			case 'organization_city':
162
+				$c->organization->city = $value;
163
+				break;
164
+			case 'organization_state':
165
+				try {
166
+					$state = $this->get_migration_script()->get_or_create_state($value);
167
+					$state_id = $state['STA_ID'];
168
+					$c->organization->STA_ID = $state_id;
169
+				} catch (EE_Error $e) {
170
+				}
171
+				break;
172
+			case 'organization_zip':
173
+				$c->organization->zip = $value;
174
+				break;
175
+			case 'contact_email':
176
+				$c->organization->email = $value;
177
+				break;
178
+			case 'default_payment_status':
179
+				$c->registration->default_STS_ID =  $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value);
180
+				break;
181
+			case 'organization_country':
182
+				$iso =$this->get_migration_script()->get_iso_from_3_1_country_id($value);
183
+				$c->organization->CNT_ISO = $iso;
184
+				$country_row = $this->get_migration_script()->get_or_create_country($iso);
185
+				if (! $country_row) {
186
+					$this->add_error(sprintf(__("Could not set country's currency config because no country exists for ISO %s", "event_espresso"), $iso));
187
+				}
188
+				// can't use EE_Currency_Config's handy constructor because the models are off-limits right now (and it uses them)
189
+				$c->currency->code = $country_row['CNT_cur_code'];          // currency code: USD, CAD, EUR
190
+				$c->currency->name = $country_row['CNT_cur_single'];    // Dollar
191
+				$c->currency->plural = $country_row['CNT_cur_plural'];  // Dollars
192
+				$c->currency->sign =  $country_row['CNT_cur_sign'];             // currency sign: $
193
+				$c->currency->sign_b4 = filter_var($country_row['CNT_cur_sign_b4'], FILTER_VALIDATE_BOOLEAN);        // currency sign before or after: $TRUE  or  FALSE$
194
+				$c->currency->dec_plc = (int) $country_row['CNT_cur_dec_plc'];    // decimal places: 2 = 0.00  3 = 0.000
195
+				$c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk'];    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
196
+				$c->currency->thsnds = $country_row['CNT_cur_thsnds'];  // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
197 197
   //            $c->currency = new EE_Currency_Config($c->organization->CNT_ISO);break;
198 198
   //        case 'currency_symbol': ignore the currency symbol. we'll just go by their country.
199 199
   //            $c->currency->sign = $value;break;
200
-            case 'show_pending_payment_options':
201
-                $c->registration->show_pending_payment_options = ($value == 'Y');
202
-                break;
203
-            case 'display_address_in_regform':
204
-                $c->template_settings->display_address_in_regform = ($value == 'Y');
205
-                break;
206
-            case 'default_logo_url':
207
-                $c->organization->logo_url = $value;
208
-                break;
209
-            case 'event_page_id':
210
-                // also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS
211
-                // to ESPRESSO_THANK_YOU
212
-                $reg_page_post = get_post($value);
213
-                $reg_page_post->post_content = str_replace("[ESPRESSO_EVENTS]", "[ESPRESSO_CHECKOUT]", $reg_page_post->post_content);
214
-                wp_update_post($reg_page_post);
215
-                $c->core->reg_page_id = $value;
216
-                break;
217
-            case 'return_url':
218
-                // also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS
219
-                // to ESPRESSO_THANK_YOU
220
-                $thank_you_page_post = get_post($value);
221
-                $thank_you_page_post->post_content = str_replace("[ESPRESSO_PAYMENTS]", "[ESPRESSO_THANK_YOU]", $thank_you_page_post->post_content);
222
-                wp_update_post($thank_you_page_post);
223
-                $c->core->thank_you_page_id = $value;
224
-                break;
225
-            case 'cancel_return':
226
-                $c->core->cancel_page_id = $value;
200
+			case 'show_pending_payment_options':
201
+				$c->registration->show_pending_payment_options = ($value == 'Y');
202
+				break;
203
+			case 'display_address_in_regform':
204
+				$c->template_settings->display_address_in_regform = ($value == 'Y');
205
+				break;
206
+			case 'default_logo_url':
207
+				$c->organization->logo_url = $value;
208
+				break;
209
+			case 'event_page_id':
210
+				// also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS
211
+				// to ESPRESSO_THANK_YOU
212
+				$reg_page_post = get_post($value);
213
+				$reg_page_post->post_content = str_replace("[ESPRESSO_EVENTS]", "[ESPRESSO_CHECKOUT]", $reg_page_post->post_content);
214
+				wp_update_post($reg_page_post);
215
+				$c->core->reg_page_id = $value;
216
+				break;
217
+			case 'return_url':
218
+				// also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS
219
+				// to ESPRESSO_THANK_YOU
220
+				$thank_you_page_post = get_post($value);
221
+				$thank_you_page_post->post_content = str_replace("[ESPRESSO_PAYMENTS]", "[ESPRESSO_THANK_YOU]", $thank_you_page_post->post_content);
222
+				wp_update_post($thank_you_page_post);
223
+				$c->core->thank_you_page_id = $value;
224
+				break;
225
+			case 'cancel_return':
226
+				$c->core->cancel_page_id = $value;
227 227
 
228
-                break;
229
-            case 'notify_url':
230
-                $c->core->txn_page_id = $value;
231
-                break;
232
-            case 'use_captcha':
233
-                $c->registration->use_captcha = ($value == 'Y');
234
-                break;
235
-            case 'recaptcha_publickey':
236
-                $c->registration->recaptcha_publickey = $value;
237
-                break;
238
-            case 'recaptcha_privatekey':
239
-                $c->registration->recaptcha_privatekey = $value;
240
-                break;
241
-            case 'recaptcha_theme':
242
-                $c->registration->recaptcha_theme = $value;
243
-                break;
244
-            case 'recaptcha_width':
245
-                $c->registration->recaptcha_width = $value;
246
-                break;
247
-            case 'recaptcha_language':
248
-                $c->registration->recaptcha_language = $value;
249
-                break;
250
-            case 'espresso_dashboard_widget':
251
-                $c->admin->use_dashboard_widget = ($value == 'Y');
252
-                break;
253
-            case 'use_personnel_manager':
254
-                $c->admin->use_personnel_manager = ($value == 'Y');
255
-                break;
256
-            case 'use_event_timezones':
257
-                $c->admin->use_event_timezones = ($value == 'Y');
258
-                break;
259
-            case 'full_logging':
260
-                $c->admin->use_full_logging = ($value == 'Y');
261
-                break;
262
-            case 'affiliate_id':
263
-                $c->admin->affiliate_id = $value;
264
-                break;
265
-            case 'site_license_key':
266
-                $cn->core->site_license_key = $value;
267
-                break;
268
-            default:
269
-                do_action('AHEE__EE_DMS_4_1_0__handle_org_option', $option_name, $value);
270
-        }
271
-    }
228
+				break;
229
+			case 'notify_url':
230
+				$c->core->txn_page_id = $value;
231
+				break;
232
+			case 'use_captcha':
233
+				$c->registration->use_captcha = ($value == 'Y');
234
+				break;
235
+			case 'recaptcha_publickey':
236
+				$c->registration->recaptcha_publickey = $value;
237
+				break;
238
+			case 'recaptcha_privatekey':
239
+				$c->registration->recaptcha_privatekey = $value;
240
+				break;
241
+			case 'recaptcha_theme':
242
+				$c->registration->recaptcha_theme = $value;
243
+				break;
244
+			case 'recaptcha_width':
245
+				$c->registration->recaptcha_width = $value;
246
+				break;
247
+			case 'recaptcha_language':
248
+				$c->registration->recaptcha_language = $value;
249
+				break;
250
+			case 'espresso_dashboard_widget':
251
+				$c->admin->use_dashboard_widget = ($value == 'Y');
252
+				break;
253
+			case 'use_personnel_manager':
254
+				$c->admin->use_personnel_manager = ($value == 'Y');
255
+				break;
256
+			case 'use_event_timezones':
257
+				$c->admin->use_event_timezones = ($value == 'Y');
258
+				break;
259
+			case 'full_logging':
260
+				$c->admin->use_full_logging = ($value == 'Y');
261
+				break;
262
+			case 'affiliate_id':
263
+				$c->admin->affiliate_id = $value;
264
+				break;
265
+			case 'site_license_key':
266
+				$cn->core->site_license_key = $value;
267
+				break;
268
+			default:
269
+				do_action('AHEE__EE_DMS_4_1_0__handle_org_option', $option_name, $value);
270
+		}
271
+	}
272 272
 
273
-    /**
274
-     * Creates a 4.1 member price discount
275
-     * @global type $wpdb
276
-     * @param type $old_price
277
-     * @return int
278
-     */
279
-    private function _insert_new_global_surcharge_price($org_options)
280
-    {
281
-        $amount = floatval($org_options['surcharge']);
282
-        // dont createa a price if the surcharge is 0
283
-        if ($amount <=.01) {
284
-            return 0;
285
-        }
286
-        if ($org_options['surcharge_type'] == 'flat_rate') {
287
-            $price_type = EE_DMS_4_1_0_prices::price_type_flat_surcharge;
288
-        } else {
289
-            $price_type = EE_DMS_4_1_0_prices::price_type_percent_surcharge;
290
-        }
291
-        global $wpdb;
292
-        $cols_n_values = array(
293
-            'PRT_ID'=>$price_type,
294
-            'PRC_amount'=>$amount,
295
-            'PRC_name'=>  $org_options['surcharge_text'],
296
-            'PRC_is_default'=>true,
297
-            'PRC_overrides'=>false,
298
-            'PRC_order'=>100,
299
-            'PRC_deleted'=>false,
300
-            'PRC_parent'=>null
273
+	/**
274
+	 * Creates a 4.1 member price discount
275
+	 * @global type $wpdb
276
+	 * @param type $old_price
277
+	 * @return int
278
+	 */
279
+	private function _insert_new_global_surcharge_price($org_options)
280
+	{
281
+		$amount = floatval($org_options['surcharge']);
282
+		// dont createa a price if the surcharge is 0
283
+		if ($amount <=.01) {
284
+			return 0;
285
+		}
286
+		if ($org_options['surcharge_type'] == 'flat_rate') {
287
+			$price_type = EE_DMS_4_1_0_prices::price_type_flat_surcharge;
288
+		} else {
289
+			$price_type = EE_DMS_4_1_0_prices::price_type_percent_surcharge;
290
+		}
291
+		global $wpdb;
292
+		$cols_n_values = array(
293
+			'PRT_ID'=>$price_type,
294
+			'PRC_amount'=>$amount,
295
+			'PRC_name'=>  $org_options['surcharge_text'],
296
+			'PRC_is_default'=>true,
297
+			'PRC_overrides'=>false,
298
+			'PRC_order'=>100,
299
+			'PRC_deleted'=>false,
300
+			'PRC_parent'=>null
301 301
 
302
-        );
303
-        $datatypes = array(
304
-            '%d',// PRT_ID
305
-            '%f',// PRT_amount
306
-            '%s',// PRC_name
307
-            '%d',// PRC_is_default
308
-            '%d',// PRC_overrides
309
-            '%d',// PRC_order
310
-            '%d',// PRC_deleted
311
-            '%d',// PRC_parent
312
-        );
313
-        $price_table = $wpdb->prefix."esp_price";
314
-        $success = $wpdb->insert($price_table, $cols_n_values, $datatypes);
315
-        if (! $success) {
316
-            $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion(
317
-                'org_options',
318
-                array(
319
-                        'surcharge'=>$org_options['surcharge'],
320
-                        'surcharge_type'=>$org_options['surcharge_type'],
321
-                        'surcharge_text'=>$org_options['surcharge_text']),
322
-                $price_table,
323
-                $cols_n_values,
324
-                $datatypes
325
-            ));
326
-            return 0;
327
-        }
328
-        $new_id = $wpdb->insert_id;
329
-        return $new_id;
330
-    }
302
+		);
303
+		$datatypes = array(
304
+			'%d',// PRT_ID
305
+			'%f',// PRT_amount
306
+			'%s',// PRC_name
307
+			'%d',// PRC_is_default
308
+			'%d',// PRC_overrides
309
+			'%d',// PRC_order
310
+			'%d',// PRC_deleted
311
+			'%d',// PRC_parent
312
+		);
313
+		$price_table = $wpdb->prefix."esp_price";
314
+		$success = $wpdb->insert($price_table, $cols_n_values, $datatypes);
315
+		if (! $success) {
316
+			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion(
317
+				'org_options',
318
+				array(
319
+						'surcharge'=>$org_options['surcharge'],
320
+						'surcharge_type'=>$org_options['surcharge_type'],
321
+						'surcharge_text'=>$org_options['surcharge_text']),
322
+				$price_table,
323
+				$cols_n_values,
324
+				$datatypes
325
+			));
326
+			return 0;
327
+		}
328
+		$new_id = $wpdb->insert_id;
329
+		return $new_id;
330
+	}
331 331
 
332
-    protected $_org_options_we_know_how_to_migrate = array(
333
-      'organization',
334
-      'organization_street1',
335
-      'organization_street2',
336
-      'organization_city',
337
-      'organization_state',
338
-      'organization_zip',
339
-      'contact_email',
340
-      'default_mail',
341
-      'payment_subject',
342
-      'payment_message',
343
-      'message',
344
-      'default_payment_status',
345
-      'surcharge',// unused?
346
-      'country_id',// unused?
347
-      'organization_country',
332
+	protected $_org_options_we_know_how_to_migrate = array(
333
+	  'organization',
334
+	  'organization_street1',
335
+	  'organization_street2',
336
+	  'organization_city',
337
+	  'organization_state',
338
+	  'organization_zip',
339
+	  'contact_email',
340
+	  'default_mail',
341
+	  'payment_subject',
342
+	  'payment_message',
343
+	  'message',
344
+	  'default_payment_status',
345
+	  'surcharge',// unused?
346
+	  'country_id',// unused?
347
+	  'organization_country',
348 348
 //    'currency_symbol',
349
-      'expire_on_registration_end',
350
-      'email_before_payment',
351
-      'email_fancy_headers',
352
-      'enable_default_style',
353
-      'event_ssl_active',
354
-      'selected_style',
355
-      'show_pending_payment_options',
356
-      'show_reg_footer',
357
-      'skip_confirmation_page',
358
-      'allow_mer_discounts',// no equiv
359
-      'allow_mer_vouchers',// no equiv
360
-      'display_short_description_in_event_list',
361
-      'display_description_on_multi_reg_page',
362
-      'display_address_in_event_list',
363
-      'display_address_in_regform',
364
-      'use_custom_post_types',// no equiv
365
-      'display_ical_download',
366
-      'display_featured_image',
367
-      'themeroller',
368
-      'default_logo_url',
369
-      'event_page_id',
370
-      'return_url',
371
-      'cancel_return',
372
-      'notify_url',
373
-      'events_in_dashboard',
374
-      'use_captcha',
375
-      'recaptcha_publickey',
376
-      'recaptcha_privatekey',
377
-      'recaptcha_theme',
378
-      'recaptcha_width',
379
-      'recaptcha_language',
380
-      'espresso_dashboard_widget',
381
-      'time_reg_limit',
349
+	  'expire_on_registration_end',
350
+	  'email_before_payment',
351
+	  'email_fancy_headers',
352
+	  'enable_default_style',
353
+	  'event_ssl_active',
354
+	  'selected_style',
355
+	  'show_pending_payment_options',
356
+	  'show_reg_footer',
357
+	  'skip_confirmation_page',
358
+	  'allow_mer_discounts',// no equiv
359
+	  'allow_mer_vouchers',// no equiv
360
+	  'display_short_description_in_event_list',
361
+	  'display_description_on_multi_reg_page',
362
+	  'display_address_in_event_list',
363
+	  'display_address_in_regform',
364
+	  'use_custom_post_types',// no equiv
365
+	  'display_ical_download',
366
+	  'display_featured_image',
367
+	  'themeroller',
368
+	  'default_logo_url',
369
+	  'event_page_id',
370
+	  'return_url',
371
+	  'cancel_return',
372
+	  'notify_url',
373
+	  'events_in_dashboard',
374
+	  'use_captcha',
375
+	  'recaptcha_publickey',
376
+	  'recaptcha_privatekey',
377
+	  'recaptcha_theme',
378
+	  'recaptcha_width',
379
+	  'recaptcha_language',
380
+	  'espresso_dashboard_widget',
381
+	  'time_reg_limit',
382 382
 //    'use_attendee_pre_approval', removed in 4.1- instead this is factored into the default reg status
383
-      'use_personnel_manager',// no equiv
384
-      'use_event_timezones',
385
-      'full_logging',
386
-      'surcharge_type',// unused
387
-      'surcharge_text',// unused
388
-      'affiliate_id',
389
-      'site_license_key',
390
-    );
383
+	  'use_personnel_manager',// no equiv
384
+	  'use_event_timezones',
385
+	  'full_logging',
386
+	  'surcharge_type',// unused
387
+	  'surcharge_text',// unused
388
+	  'affiliate_id',
389
+	  'site_license_key',
390
+	);
391 391
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
         $old_org_options = get_option('events_organization_settings');
111 111
         foreach ($this->_org_options_we_know_how_to_migrate as $option_name) {
112 112
             // only bother migrating if there's a setting to migrate. Otherwise we'll just use the default
113
-            if (isset($old_org_options[ $option_name ])) {
114
-                $this->_handle_org_option($option_name, $old_org_options[ $option_name ]);
113
+            if (isset($old_org_options[$option_name])) {
114
+                $this->_handle_org_option($option_name, $old_org_options[$option_name]);
115 115
             }
116
-            if ($option_name=='surcharge') {
116
+            if ($option_name == 'surcharge') {
117 117
                 $this->_insert_new_global_surcharge_price($old_org_options);
118 118
             }
119 119
             $items_actually_migrated++;
120 120
         }
121 121
 
122 122
         $success = EE_Config::instance()->update_espresso_config(false, true);
123
-        if (! $success) {
123
+        if ( ! $success) {
124 124
             $this->add_error(sprintf(__('Could not save EE Config during org options stage. Reason: %s', 'event_espresso'), EE_Error::get_notices(false)));
125 125
             EE_Error::overwrite_errors();
126 126
         }
@@ -176,24 +176,24 @@  discard block
 block discarded – undo
176 176
                 $c->organization->email = $value;
177 177
                 break;
178 178
             case 'default_payment_status':
179
-                $c->registration->default_STS_ID =  $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value);
179
+                $c->registration->default_STS_ID = $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value);
180 180
                 break;
181 181
             case 'organization_country':
182
-                $iso =$this->get_migration_script()->get_iso_from_3_1_country_id($value);
182
+                $iso = $this->get_migration_script()->get_iso_from_3_1_country_id($value);
183 183
                 $c->organization->CNT_ISO = $iso;
184 184
                 $country_row = $this->get_migration_script()->get_or_create_country($iso);
185
-                if (! $country_row) {
185
+                if ( ! $country_row) {
186 186
                     $this->add_error(sprintf(__("Could not set country's currency config because no country exists for ISO %s", "event_espresso"), $iso));
187 187
                 }
188 188
                 // can't use EE_Currency_Config's handy constructor because the models are off-limits right now (and it uses them)
189
-                $c->currency->code = $country_row['CNT_cur_code'];          // currency code: USD, CAD, EUR
190
-                $c->currency->name = $country_row['CNT_cur_single'];    // Dollar
191
-                $c->currency->plural = $country_row['CNT_cur_plural'];  // Dollars
192
-                $c->currency->sign =  $country_row['CNT_cur_sign'];             // currency sign: $
193
-                $c->currency->sign_b4 = filter_var($country_row['CNT_cur_sign_b4'], FILTER_VALIDATE_BOOLEAN);        // currency sign before or after: $TRUE  or  FALSE$
194
-                $c->currency->dec_plc = (int) $country_row['CNT_cur_dec_plc'];    // decimal places: 2 = 0.00  3 = 0.000
195
-                $c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk'];    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
196
-                $c->currency->thsnds = $country_row['CNT_cur_thsnds'];  // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
189
+                $c->currency->code = $country_row['CNT_cur_code']; // currency code: USD, CAD, EUR
190
+                $c->currency->name = $country_row['CNT_cur_single']; // Dollar
191
+                $c->currency->plural = $country_row['CNT_cur_plural']; // Dollars
192
+                $c->currency->sign = $country_row['CNT_cur_sign']; // currency sign: $
193
+                $c->currency->sign_b4 = filter_var($country_row['CNT_cur_sign_b4'], FILTER_VALIDATE_BOOLEAN); // currency sign before or after: $TRUE  or  FALSE$
194
+                $c->currency->dec_plc = (int) $country_row['CNT_cur_dec_plc']; // decimal places: 2 = 0.00  3 = 0.000
195
+                $c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk']; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
196
+                $c->currency->thsnds = $country_row['CNT_cur_thsnds']; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
197 197
   //            $c->currency = new EE_Currency_Config($c->organization->CNT_ISO);break;
198 198
   //        case 'currency_symbol': ignore the currency symbol. we'll just go by their country.
199 199
   //            $c->currency->sign = $value;break;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     {
281 281
         $amount = floatval($org_options['surcharge']);
282 282
         // dont createa a price if the surcharge is 0
283
-        if ($amount <=.01) {
283
+        if ($amount <= .01) {
284 284
             return 0;
285 285
         }
286 286
         if ($org_options['surcharge_type'] == 'flat_rate') {
@@ -301,18 +301,18 @@  discard block
 block discarded – undo
301 301
 
302 302
         );
303 303
         $datatypes = array(
304
-            '%d',// PRT_ID
305
-            '%f',// PRT_amount
306
-            '%s',// PRC_name
307
-            '%d',// PRC_is_default
308
-            '%d',// PRC_overrides
309
-            '%d',// PRC_order
310
-            '%d',// PRC_deleted
311
-            '%d',// PRC_parent
304
+            '%d', // PRT_ID
305
+            '%f', // PRT_amount
306
+            '%s', // PRC_name
307
+            '%d', // PRC_is_default
308
+            '%d', // PRC_overrides
309
+            '%d', // PRC_order
310
+            '%d', // PRC_deleted
311
+            '%d', // PRC_parent
312 312
         );
313 313
         $price_table = $wpdb->prefix."esp_price";
314 314
         $success = $wpdb->insert($price_table, $cols_n_values, $datatypes);
315
-        if (! $success) {
315
+        if ( ! $success) {
316 316
             $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion(
317 317
                 'org_options',
318 318
                 array(
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
       'payment_message',
343 343
       'message',
344 344
       'default_payment_status',
345
-      'surcharge',// unused?
346
-      'country_id',// unused?
345
+      'surcharge', // unused?
346
+      'country_id', // unused?
347 347
       'organization_country',
348 348
 //    'currency_symbol',
349 349
       'expire_on_registration_end',
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
       'show_pending_payment_options',
356 356
       'show_reg_footer',
357 357
       'skip_confirmation_page',
358
-      'allow_mer_discounts',// no equiv
359
-      'allow_mer_vouchers',// no equiv
358
+      'allow_mer_discounts', // no equiv
359
+      'allow_mer_vouchers', // no equiv
360 360
       'display_short_description_in_event_list',
361 361
       'display_description_on_multi_reg_page',
362 362
       'display_address_in_event_list',
363 363
       'display_address_in_regform',
364
-      'use_custom_post_types',// no equiv
364
+      'use_custom_post_types', // no equiv
365 365
       'display_ical_download',
366 366
       'display_featured_image',
367 367
       'themeroller',
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
       'espresso_dashboard_widget',
381 381
       'time_reg_limit',
382 382
 //    'use_attendee_pre_approval', removed in 4.1- instead this is factored into the default reg status
383
-      'use_personnel_manager',// no equiv
383
+      'use_personnel_manager', // no equiv
384 384
       'use_event_timezones',
385 385
       'full_logging',
386
-      'surcharge_type',// unused
387
-      'surcharge_text',// unused
386
+      'surcharge_type', // unused
387
+      'surcharge_text', // unused
388 388
       'affiliate_id',
389 389
       'site_license_key',
390 390
     );
Please login to merge, or discard this patch.