@@ -9,39 +9,39 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_DMS_4_5_0_update_wp_user_for_prices extends EE_Data_Migration_Script_Stage_Table |
11 | 11 | { |
12 | - public function __construct() |
|
13 | - { |
|
14 | - global $wpdb; |
|
15 | - $this->_pretty_name = __("Prices", "event_espresso"); |
|
16 | - $this->_old_table = $wpdb->prefix."esp_price"; |
|
17 | - parent::__construct(); |
|
18 | - } |
|
19 | - protected function _migrate_old_row($old_row) |
|
20 | - { |
|
21 | - // foreach ticket row we add the id for the current logged in user. |
|
22 | - global $wpdb; |
|
23 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
24 | - $updated = $wpdb->update( |
|
25 | - $this->_old_table, |
|
26 | - array('PRC_wp_user'=>$user_id), |
|
27 | - array('PRC_ID'=>$old_row['PRC_ID']), |
|
28 | - array('%d',// PRC_wp_user |
|
29 | - ), |
|
30 | - array('%d',// PRC_ID |
|
31 | - ) |
|
32 | - ); |
|
33 | - if (false === $updated) { |
|
34 | - $this->add_error( |
|
35 | - sprintf( |
|
36 | - __( |
|
37 | - "Error in updating table %s setting PRC_wp_user = %d where PRC_ID = %d", |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - $this->_old_table, |
|
41 | - $user_id, |
|
42 | - $old_row['PRC_ID'] |
|
43 | - ) |
|
44 | - ); |
|
45 | - } |
|
46 | - } |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + global $wpdb; |
|
15 | + $this->_pretty_name = __("Prices", "event_espresso"); |
|
16 | + $this->_old_table = $wpdb->prefix."esp_price"; |
|
17 | + parent::__construct(); |
|
18 | + } |
|
19 | + protected function _migrate_old_row($old_row) |
|
20 | + { |
|
21 | + // foreach ticket row we add the id for the current logged in user. |
|
22 | + global $wpdb; |
|
23 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
24 | + $updated = $wpdb->update( |
|
25 | + $this->_old_table, |
|
26 | + array('PRC_wp_user'=>$user_id), |
|
27 | + array('PRC_ID'=>$old_row['PRC_ID']), |
|
28 | + array('%d',// PRC_wp_user |
|
29 | + ), |
|
30 | + array('%d',// PRC_ID |
|
31 | + ) |
|
32 | + ); |
|
33 | + if (false === $updated) { |
|
34 | + $this->add_error( |
|
35 | + sprintf( |
|
36 | + __( |
|
37 | + "Error in updating table %s setting PRC_wp_user = %d where PRC_ID = %d", |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + $this->_old_table, |
|
41 | + $user_id, |
|
42 | + $old_row['PRC_ID'] |
|
43 | + ) |
|
44 | + ); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
@@ -25,9 +25,9 @@ |
||
25 | 25 | $this->_old_table, |
26 | 26 | array('PRC_wp_user'=>$user_id), |
27 | 27 | array('PRC_ID'=>$old_row['PRC_ID']), |
28 | - array('%d',// PRC_wp_user |
|
28 | + array('%d', // PRC_wp_user |
|
29 | 29 | ), |
30 | - array('%d',// PRC_ID |
|
30 | + array('%d', // PRC_ID |
|
31 | 31 | ) |
32 | 32 | ); |
33 | 33 | if (false === $updated) { |
@@ -9,39 +9,39 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_DMS_4_5_0_update_wp_user_for_tickets extends EE_Data_Migration_Script_Stage_Table |
11 | 11 | { |
12 | - public function __construct() |
|
13 | - { |
|
14 | - global $wpdb; |
|
15 | - $this->_pretty_name = __("Tickets", "event_espresso"); |
|
16 | - $this->_old_table = $wpdb->prefix."esp_ticket"; |
|
17 | - parent::__construct(); |
|
18 | - } |
|
19 | - protected function _migrate_old_row($old_row) |
|
20 | - { |
|
21 | - // foreach ticket row we add the id for the current logged in user. |
|
22 | - global $wpdb; |
|
23 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
24 | - $updated = $wpdb->update( |
|
25 | - $this->_old_table, |
|
26 | - array('TKT_wp_user'=>$user_id), |
|
27 | - array('TKT_ID'=>$old_row['TKT_ID']), |
|
28 | - array('%d',// TKT_wp_user |
|
29 | - ), |
|
30 | - array('%d',// TKT_ID |
|
31 | - ) |
|
32 | - ); |
|
33 | - if (false === $updated) { |
|
34 | - $this->add_error( |
|
35 | - sprintf( |
|
36 | - __( |
|
37 | - "Error in updating table %s setting TKT_wp_user = %d where TKT_ID = %d", |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - $this->_old_table, |
|
41 | - $user_id, |
|
42 | - $old_row['TKT_ID'] |
|
43 | - ) |
|
44 | - ); |
|
45 | - } |
|
46 | - } |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + global $wpdb; |
|
15 | + $this->_pretty_name = __("Tickets", "event_espresso"); |
|
16 | + $this->_old_table = $wpdb->prefix."esp_ticket"; |
|
17 | + parent::__construct(); |
|
18 | + } |
|
19 | + protected function _migrate_old_row($old_row) |
|
20 | + { |
|
21 | + // foreach ticket row we add the id for the current logged in user. |
|
22 | + global $wpdb; |
|
23 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
24 | + $updated = $wpdb->update( |
|
25 | + $this->_old_table, |
|
26 | + array('TKT_wp_user'=>$user_id), |
|
27 | + array('TKT_ID'=>$old_row['TKT_ID']), |
|
28 | + array('%d',// TKT_wp_user |
|
29 | + ), |
|
30 | + array('%d',// TKT_ID |
|
31 | + ) |
|
32 | + ); |
|
33 | + if (false === $updated) { |
|
34 | + $this->add_error( |
|
35 | + sprintf( |
|
36 | + __( |
|
37 | + "Error in updating table %s setting TKT_wp_user = %d where TKT_ID = %d", |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + $this->_old_table, |
|
41 | + $user_id, |
|
42 | + $old_row['TKT_ID'] |
|
43 | + ) |
|
44 | + ); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
@@ -25,9 +25,9 @@ |
||
25 | 25 | $this->_old_table, |
26 | 26 | array('TKT_wp_user'=>$user_id), |
27 | 27 | array('TKT_ID'=>$old_row['TKT_ID']), |
28 | - array('%d',// TKT_wp_user |
|
28 | + array('%d', // TKT_wp_user |
|
29 | 29 | ), |
30 | - array('%d',// TKT_ID |
|
30 | + array('%d', // TKT_ID |
|
31 | 31 | ) |
32 | 32 | ); |
33 | 33 | if (false === $updated) { |
@@ -9,36 +9,36 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_DMS_4_5_0_update_wp_user_for_price_types extends EE_Data_Migration_Script_Stage_Table |
11 | 11 | { |
12 | - public function __construct() |
|
13 | - { |
|
14 | - global $wpdb; |
|
15 | - $this->_pretty_name = __("Price Types", "event_espresso"); |
|
16 | - $this->_old_table = $wpdb->prefix."esp_price_type"; |
|
17 | - parent::__construct(); |
|
18 | - } |
|
19 | - protected function _migrate_old_row($old_row) |
|
20 | - { |
|
21 | - // foreach ticket row we add the id for the current logged in user. |
|
22 | - global $wpdb; |
|
23 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
24 | - $updated = $wpdb->update( |
|
25 | - $this->_old_table, |
|
26 | - array('PRT_wp_user'=>$user_id), |
|
27 | - array('PRT_ID'=>$old_row['PRT_ID']), |
|
28 | - array('%d',// PRT_wp_user |
|
29 | - ), |
|
30 | - array('%d',// PRT_ID |
|
31 | - ) |
|
32 | - ); |
|
33 | - if (false === $updated) { |
|
34 | - $this->add_error( |
|
35 | - sprintf( |
|
36 | - __("Error in updating table %s setting PRT_wp_user = %d where PRT_ID = %d", 'event_espresso'), |
|
37 | - $this->_old_table, |
|
38 | - $user_id, |
|
39 | - $old_row['PRT_ID'] |
|
40 | - ) |
|
41 | - ); |
|
42 | - } |
|
43 | - } |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + global $wpdb; |
|
15 | + $this->_pretty_name = __("Price Types", "event_espresso"); |
|
16 | + $this->_old_table = $wpdb->prefix."esp_price_type"; |
|
17 | + parent::__construct(); |
|
18 | + } |
|
19 | + protected function _migrate_old_row($old_row) |
|
20 | + { |
|
21 | + // foreach ticket row we add the id for the current logged in user. |
|
22 | + global $wpdb; |
|
23 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
24 | + $updated = $wpdb->update( |
|
25 | + $this->_old_table, |
|
26 | + array('PRT_wp_user'=>$user_id), |
|
27 | + array('PRT_ID'=>$old_row['PRT_ID']), |
|
28 | + array('%d',// PRT_wp_user |
|
29 | + ), |
|
30 | + array('%d',// PRT_ID |
|
31 | + ) |
|
32 | + ); |
|
33 | + if (false === $updated) { |
|
34 | + $this->add_error( |
|
35 | + sprintf( |
|
36 | + __("Error in updating table %s setting PRT_wp_user = %d where PRT_ID = %d", 'event_espresso'), |
|
37 | + $this->_old_table, |
|
38 | + $user_id, |
|
39 | + $old_row['PRT_ID'] |
|
40 | + ) |
|
41 | + ); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | } |
@@ -25,9 +25,9 @@ |
||
25 | 25 | $this->_old_table, |
26 | 26 | array('PRT_wp_user'=>$user_id), |
27 | 27 | array('PRT_ID'=>$old_row['PRT_ID']), |
28 | - array('%d',// PRT_wp_user |
|
28 | + array('%d', // PRT_wp_user |
|
29 | 29 | ), |
30 | - array('%d',// PRT_ID |
|
30 | + array('%d', // PRT_ID |
|
31 | 31 | ) |
32 | 32 | ); |
33 | 33 | if (false === $updated) { |
@@ -15,94 +15,94 @@ |
||
15 | 15 | class EE_DMS_4_5_0_invoice_settings extends EE_Data_Migration_Script_Stage |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * Just initializes the status of the migration |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->_pretty_name = __('Update Invoice Gateway Settings', 'event_espresso'); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
18 | + /** |
|
19 | + * Just initializes the status of the migration |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->_pretty_name = __('Update Invoice Gateway Settings', 'event_espresso'); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * _count_records_to_migrate |
|
31 | - * Counts the records to migrate; the public version may cache it |
|
32 | - * |
|
33 | - * @access protected |
|
34 | - * @return int |
|
35 | - */ |
|
36 | - protected function _count_records_to_migrate() |
|
37 | - { |
|
38 | - return 1; |
|
39 | - } |
|
29 | + /** |
|
30 | + * _count_records_to_migrate |
|
31 | + * Counts the records to migrate; the public version may cache it |
|
32 | + * |
|
33 | + * @access protected |
|
34 | + * @return int |
|
35 | + */ |
|
36 | + protected function _count_records_to_migrate() |
|
37 | + { |
|
38 | + return 1; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * _migration_step |
|
45 | - * |
|
46 | - * @access protected |
|
47 | - * @param int $num_items |
|
48 | - * @throws EE_Error |
|
49 | - * @return int number of items ACTUALLY migrated |
|
50 | - * @throws InvalidDataTypeException |
|
51 | - */ |
|
52 | - protected function _migration_step($num_items = 1) |
|
53 | - { |
|
54 | - // if this isn't set then something is really wrong |
|
55 | - if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
56 | - throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
|
57 | - } |
|
58 | - $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null; |
|
59 | - if (! $invoice_settings) { |
|
60 | - $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
|
61 | - } else { |
|
62 | - $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
|
63 | - $invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to']; |
|
64 | - $invoice_settings['template_invoice_address'] = $invoice_settings['payment_address']; |
|
65 | - $invoice_settings['template_invoice_email'] = ''; |
|
66 | - $invoice_settings['template_invoice_tax_number'] = ''; |
|
67 | - unset($invoice_settings['pdf_instructions']); |
|
68 | - unset($invoice_settings['payable_to']); |
|
69 | - unset($invoice_settings['payment_address']); |
|
70 | - EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings; |
|
71 | - EE_Config::instance()->update_espresso_config(false, false); |
|
43 | + /** |
|
44 | + * _migration_step |
|
45 | + * |
|
46 | + * @access protected |
|
47 | + * @param int $num_items |
|
48 | + * @throws EE_Error |
|
49 | + * @return int number of items ACTUALLY migrated |
|
50 | + * @throws InvalidDataTypeException |
|
51 | + */ |
|
52 | + protected function _migration_step($num_items = 1) |
|
53 | + { |
|
54 | + // if this isn't set then something is really wrong |
|
55 | + if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
56 | + throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
|
57 | + } |
|
58 | + $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null; |
|
59 | + if (! $invoice_settings) { |
|
60 | + $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
|
61 | + } else { |
|
62 | + $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
|
63 | + $invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to']; |
|
64 | + $invoice_settings['template_invoice_address'] = $invoice_settings['payment_address']; |
|
65 | + $invoice_settings['template_invoice_email'] = ''; |
|
66 | + $invoice_settings['template_invoice_tax_number'] = ''; |
|
67 | + unset($invoice_settings['pdf_instructions']); |
|
68 | + unset($invoice_settings['payable_to']); |
|
69 | + unset($invoice_settings['payment_address']); |
|
70 | + EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings; |
|
71 | + EE_Config::instance()->update_espresso_config(false, false); |
|
72 | 72 | |
73 | - // @todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice |
|
74 | - // (why is it tough to change? because we want to update the receipt and invoice message template, but |
|
75 | - // message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to |
|
76 | - // update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code; |
|
77 | - // also we don't want to build a dependency on the messages code because it is likely to change soon |
|
78 | - if (! in_array($invoice_settings['invoice_css'], array( '', 'simple.css' ))) { |
|
79 | - new PersistentAdminNotice( |
|
80 | - 'invoice_css_not_updated', |
|
81 | - sprintf( |
|
82 | - esc_html__( |
|
83 | - 'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', |
|
84 | - 'event_espresso' |
|
85 | - ), |
|
86 | - $invoice_settings['invoice_css'] |
|
87 | - ) |
|
88 | - ); |
|
89 | - } |
|
90 | - $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
91 | - $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
92 | - $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
93 | - if ($overridden_invoice_body || $overridden_receipt_body) { |
|
94 | - new PersistentAdminNotice( |
|
95 | - 'invoice_overriding_templates', |
|
96 | - esc_html__( |
|
97 | - 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
98 | - 'event_espresso' |
|
99 | - ), |
|
100 | - true |
|
101 | - ); |
|
102 | - } |
|
103 | - } |
|
104 | - // regardless of whether it worked or not, we ought to continue the migration |
|
105 | - $this->set_completed(); |
|
106 | - return 1; |
|
107 | - } |
|
73 | + // @todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice |
|
74 | + // (why is it tough to change? because we want to update the receipt and invoice message template, but |
|
75 | + // message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to |
|
76 | + // update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code; |
|
77 | + // also we don't want to build a dependency on the messages code because it is likely to change soon |
|
78 | + if (! in_array($invoice_settings['invoice_css'], array( '', 'simple.css' ))) { |
|
79 | + new PersistentAdminNotice( |
|
80 | + 'invoice_css_not_updated', |
|
81 | + sprintf( |
|
82 | + esc_html__( |
|
83 | + 'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', |
|
84 | + 'event_espresso' |
|
85 | + ), |
|
86 | + $invoice_settings['invoice_css'] |
|
87 | + ) |
|
88 | + ); |
|
89 | + } |
|
90 | + $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
91 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
92 | + $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
93 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
94 | + new PersistentAdminNotice( |
|
95 | + 'invoice_overriding_templates', |
|
96 | + esc_html__( |
|
97 | + 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
98 | + 'event_espresso' |
|
99 | + ), |
|
100 | + true |
|
101 | + ); |
|
102 | + } |
|
103 | + } |
|
104 | + // regardless of whether it worked or not, we ought to continue the migration |
|
105 | + $this->set_completed(); |
|
106 | + return 1; |
|
107 | + } |
|
108 | 108 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | protected function _migration_step($num_items = 1) |
53 | 53 | { |
54 | 54 | // if this isn't set then something is really wrong |
55 | - if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
55 | + if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
56 | 56 | throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
57 | 57 | } |
58 | 58 | $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null; |
59 | - if (! $invoice_settings) { |
|
59 | + if ( ! $invoice_settings) { |
|
60 | 60 | $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
61 | 61 | } else { |
62 | 62 | $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to |
76 | 76 | // update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code; |
77 | 77 | // also we don't want to build a dependency on the messages code because it is likely to change soon |
78 | - if (! in_array($invoice_settings['invoice_css'], array( '', 'simple.css' ))) { |
|
78 | + if ( ! in_array($invoice_settings['invoice_css'], array('', 'simple.css'))) { |
|
79 | 79 | new PersistentAdminNotice( |
80 | 80 | 'invoice_css_not_updated', |
81 | 81 | sprintf( |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | ); |
89 | 89 | } |
90 | 90 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
91 | - $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
92 | - $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
91 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', null, false, false, true); |
|
92 | + $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', null, false, false, true); |
|
93 | 93 | if ($overridden_invoice_body || $overridden_receipt_body) { |
94 | 94 | new PersistentAdminNotice( |
95 | 95 | 'invoice_overriding_templates', |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | - $matches = array(); |
|
20 | - preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
19 | + $matches = array(); |
|
20 | + preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | 22 | } |
23 | 23 | // give addons a chance to autoload their stages too |
24 | 24 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -31,59 +31,59 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * EE_DMS_Core_4_5_0 constructor. |
|
36 | - * |
|
37 | - * @param TableManager $table_manager |
|
38 | - * @param TableAnalysis $table_analysis |
|
39 | - */ |
|
40 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | - { |
|
42 | - $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | - $this->_priority = 10; |
|
44 | - $this->_migration_stages = array( |
|
45 | - new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | - new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | - new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | - new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | - new EE_DMS_4_5_0_invoice_settings(), |
|
50 | - ); |
|
51 | - parent::__construct($table_manager, $table_analysis); |
|
52 | - } |
|
34 | + /** |
|
35 | + * EE_DMS_Core_4_5_0 constructor. |
|
36 | + * |
|
37 | + * @param TableManager $table_manager |
|
38 | + * @param TableAnalysis $table_analysis |
|
39 | + */ |
|
40 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | + { |
|
42 | + $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | + $this->_priority = 10; |
|
44 | + $this->_migration_stages = array( |
|
45 | + new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | + new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | + new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | + new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | + new EE_DMS_4_5_0_invoice_settings(), |
|
50 | + ); |
|
51 | + parent::__construct($table_manager, $table_analysis); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - public function can_migrate_from_version($version_array) |
|
57 | - { |
|
58 | - $version_string = $version_array['Core']; |
|
59 | - if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
|
56 | + public function can_migrate_from_version($version_array) |
|
57 | + { |
|
58 | + $version_string = $version_array['Core']; |
|
59 | + if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
|
60 | 60 | // echo "$version_string can be migrated from"; |
61 | - return true; |
|
62 | - } elseif (! $version_string) { |
|
61 | + return true; |
|
62 | + } elseif (! $version_string) { |
|
63 | 63 | // echo "no version string provided: $version_string"; |
64 | - // no version string provided... this must be pre 4.3 |
|
65 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | - } else { |
|
64 | + // no version string provided... this must be pre 4.3 |
|
65 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | + } else { |
|
67 | 67 | // echo "$version_string doesnt apply"; |
68 | - return false; |
|
69 | - } |
|
70 | - } |
|
68 | + return false; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | - public function schema_changes_before_migration() |
|
75 | - { |
|
76 | - // relies on 4.1's EEH_Activation::create_table |
|
77 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
78 | - $table_name = 'esp_answer'; |
|
79 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
74 | + public function schema_changes_before_migration() |
|
75 | + { |
|
76 | + // relies on 4.1's EEH_Activation::create_table |
|
77 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
78 | + $table_name = 'esp_answer'; |
|
79 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
80 | 80 | REG_ID INT UNSIGNED NOT NULL, |
81 | 81 | QST_ID INT UNSIGNED NOT NULL, |
82 | 82 | ANS_value TEXT NOT NULL, |
83 | 83 | PRIMARY KEY (ANS_ID)"; |
84 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
85 | - $table_name = 'esp_attendee_meta'; |
|
86 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
84 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
85 | + $table_name = 'esp_attendee_meta'; |
|
86 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
87 | 87 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
88 | 88 | ATT_fname VARCHAR(45) NOT NULL, |
89 | 89 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | KEY ATT_fname (ATT_fname), |
100 | 100 | KEY ATT_lname (ATT_lname), |
101 | 101 | KEY ATT_email (ATT_email)"; |
102 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
103 | - $table_name = 'esp_country'; |
|
104 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
102 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
103 | + $table_name = 'esp_country'; |
|
104 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
105 | 105 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
106 | 106 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
107 | 107 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | CNT_is_EU TINYINT(1) DEFAULT '0', |
118 | 118 | CNT_active TINYINT(1) DEFAULT '0', |
119 | 119 | PRIMARY KEY (CNT_ISO)"; |
120 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
121 | - $table_name = 'esp_datetime'; |
|
122 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
120 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
121 | + $table_name = 'esp_datetime'; |
|
122 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
123 | 123 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
124 | 124 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
125 | 125 | DTT_description TEXT NOT NULL, |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | PRIMARY KEY (DTT_ID), |
135 | 135 | KEY EVT_ID (EVT_ID), |
136 | 136 | KEY DTT_is_primary (DTT_is_primary)"; |
137 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
138 | - $table_name = 'esp_event_meta'; |
|
139 | - $sql = " |
|
137 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
138 | + $table_name = 'esp_event_meta'; |
|
139 | + $sql = " |
|
140 | 140 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
141 | 141 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
142 | 142 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -151,31 +151,31 @@ discard block |
||
151 | 151 | EVT_external_URL VARCHAR(200) NULL, |
152 | 152 | EVT_donations TINYINT(1) NULL, |
153 | 153 | PRIMARY KEY (EVTM_ID)"; |
154 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | - $table_name = 'esp_event_question_group'; |
|
156 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | + $table_name = 'esp_event_question_group'; |
|
156 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
157 | 157 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
158 | 158 | QSG_ID INT UNSIGNED NOT NULL, |
159 | 159 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
160 | 160 | PRIMARY KEY (EQG_ID)"; |
161 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | - $table_name = 'esp_event_venue'; |
|
163 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
161 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | + $table_name = 'esp_event_venue'; |
|
163 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
164 | 164 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
165 | 165 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
166 | 166 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
167 | 167 | PRIMARY KEY (EVV_ID)"; |
168 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | - $table_name = 'esp_extra_meta'; |
|
170 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
168 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | + $table_name = 'esp_extra_meta'; |
|
170 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
171 | 171 | OBJ_ID INT(11) DEFAULT NULL, |
172 | 172 | EXM_type VARCHAR(45) DEFAULT NULL, |
173 | 173 | EXM_key VARCHAR(45) DEFAULT NULL, |
174 | 174 | EXM_value TEXT, |
175 | 175 | PRIMARY KEY (EXM_ID)"; |
176 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | - $table_name = 'esp_line_item'; |
|
178 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
176 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
177 | + $table_name = 'esp_line_item'; |
|
178 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
179 | 179 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
180 | 180 | TXN_ID INT(11) DEFAULT NULL, |
181 | 181 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -191,19 +191,19 @@ discard block |
||
191 | 191 | OBJ_ID INT(11) DEFAULT NULL, |
192 | 192 | OBJ_type VARCHAR(45)DEFAULT NULL, |
193 | 193 | PRIMARY KEY (LIN_ID)"; |
194 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | - $table_name = 'esp_message_template'; |
|
196 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
194 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | + $table_name = 'esp_message_template'; |
|
196 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
197 | 197 | GRP_ID INT(10) UNSIGNED NOT NULL, |
198 | 198 | MTP_context VARCHAR(50) NOT NULL, |
199 | 199 | MTP_template_field VARCHAR(30) NOT NULL, |
200 | 200 | MTP_content TEXT NOT NULL, |
201 | 201 | PRIMARY KEY (MTP_ID), |
202 | 202 | KEY GRP_ID (GRP_ID)"; |
203 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
205 | - $table_name = 'esp_message_template_group'; |
|
206 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
205 | + $table_name = 'esp_message_template_group'; |
|
206 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | 207 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
208 | 208 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
209 | 209 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
216 | 216 | PRIMARY KEY (GRP_ID), |
217 | 217 | KEY MTP_user_id (MTP_user_id)"; |
218 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | - $table_name = 'esp_event_message_template'; |
|
220 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
218 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | + $table_name = 'esp_event_message_template'; |
|
220 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
221 | 221 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
222 | 222 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EMT_ID), |
224 | 224 | KEY EVT_ID (EVT_ID), |
225 | 225 | KEY GRP_ID (GRP_ID)"; |
226 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | - $table_name = 'esp_payment'; |
|
228 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
226 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | + $table_name = 'esp_payment'; |
|
228 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
229 | 229 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
230 | 230 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
231 | 231 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | PRIMARY KEY (PAY_ID), |
242 | 242 | KEY TXN_ID (TXN_ID), |
243 | 243 | KEY PAY_timestamp (PAY_timestamp)"; |
244 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
245 | - $table_name = "esp_ticket_price"; |
|
246 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
244 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
245 | + $table_name = "esp_ticket_price"; |
|
246 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
247 | 247 | TKT_ID INT(10) UNSIGNED NOT NULL, |
248 | 248 | PRC_ID INT(10) UNSIGNED NOT NULL, |
249 | 249 | PRIMARY KEY (TKP_ID)"; |
250 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | - $table_name = "esp_datetime_ticket"; |
|
252 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
250 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | + $table_name = "esp_datetime_ticket"; |
|
252 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
253 | 253 | DTT_ID INT(10) UNSIGNED NOT NULL, |
254 | 254 | TKT_ID INT(10) UNSIGNED NOT NULL, |
255 | 255 | PRIMARY KEY (DTK_ID)"; |
256 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | - $table_name = "esp_ticket_template"; |
|
258 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
256 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | + $table_name = "esp_ticket_template"; |
|
258 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
259 | 259 | TTM_name VARCHAR(45) NOT NULL, |
260 | 260 | TTM_description TEXT, |
261 | 261 | TTM_file VARCHAR(45), |
262 | 262 | PRIMARY KEY (TTM_ID)"; |
263 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | - $table_name = 'esp_question'; |
|
265 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
263 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | + $table_name = 'esp_question'; |
|
265 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
266 | 266 | QST_display_text TEXT NOT NULL, |
267 | 267 | QST_admin_label VARCHAR(255) NOT NULL, |
268 | 268 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -274,25 +274,25 @@ discard block |
||
274 | 274 | QST_wp_user BIGINT UNSIGNED NULL, |
275 | 275 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
276 | 276 | PRIMARY KEY (QST_ID)'; |
277 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | - $table_name = 'esp_question_group_question'; |
|
279 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
277 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | + $table_name = 'esp_question_group_question'; |
|
279 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
280 | 280 | QSG_ID INT UNSIGNED NOT NULL, |
281 | 281 | QST_ID INT UNSIGNED NOT NULL, |
282 | 282 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
283 | 283 | PRIMARY KEY (QGQ_ID) "; |
284 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | - $table_name = 'esp_question_option'; |
|
286 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $table_name = 'esp_question_option'; |
|
286 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
287 | 287 | QSO_value VARCHAR(255) NOT NULL, |
288 | 288 | QSO_desc TEXT NOT NULL, |
289 | 289 | QST_ID INT UNSIGNED NOT NULL, |
290 | 290 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
291 | 291 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
292 | 292 | PRIMARY KEY (QSO_ID)"; |
293 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | - $table_name = 'esp_registration'; |
|
295 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
293 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | + $table_name = 'esp_registration'; |
|
295 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
296 | 296 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
297 | 297 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
298 | 298 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -315,25 +315,25 @@ discard block |
||
315 | 315 | KEY STS_ID (STS_ID), |
316 | 316 | KEY REG_url_link (REG_url_link), |
317 | 317 | KEY REG_code (REG_code)"; |
318 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | - $table_name = 'esp_checkin'; |
|
320 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
318 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | + $table_name = 'esp_checkin'; |
|
320 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
321 | 321 | REG_ID INT(10) UNSIGNED NOT NULL, |
322 | 322 | DTT_ID INT(10) UNSIGNED NOT NULL, |
323 | 323 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
324 | 324 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
325 | 325 | PRIMARY KEY (CHK_ID)"; |
326 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | - $table_name = 'esp_state'; |
|
328 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
326 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | + $table_name = 'esp_state'; |
|
328 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
329 | 329 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
330 | 330 | STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL, |
331 | 331 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
332 | 332 | STA_active TINYINT(1) DEFAULT '1', |
333 | 333 | PRIMARY KEY (STA_ID)"; |
334 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | - $table_name = 'esp_status'; |
|
336 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
334 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | + $table_name = 'esp_status'; |
|
336 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
337 | 337 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
338 | 338 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
339 | 339 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
342 | 342 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
343 | 343 | KEY STS_type (STS_type)"; |
344 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | - $table_name = 'esp_transaction'; |
|
346 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
344 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | + $table_name = 'esp_transaction'; |
|
346 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
347 | 347 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
348 | 348 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
349 | 349 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | PRIMARY KEY (TXN_ID), |
355 | 355 | KEY TXN_timestamp (TXN_timestamp), |
356 | 356 | KEY STS_ID (STS_ID)"; |
357 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | - $table_name = 'esp_venue_meta'; |
|
359 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
357 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | + $table_name = 'esp_venue_meta'; |
|
359 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
360 | 360 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
361 | 361 | VNU_address VARCHAR(255) DEFAULT NULL, |
362 | 362 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | PRIMARY KEY (VNUM_ID), |
375 | 375 | KEY STA_ID (STA_ID), |
376 | 376 | KEY CNT_ISO (CNT_ISO)"; |
377 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | - // modified tables |
|
379 | - $table_name = "esp_price"; |
|
380 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
377 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | + // modified tables |
|
379 | + $table_name = "esp_price"; |
|
380 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 381 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
382 | 382 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
383 | 383 | PRC_name VARCHAR(245) NOT NULL, |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | PRC_wp_user BIGINT UNSIGNED NULL, |
390 | 390 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
391 | 391 | PRIMARY KEY (PRC_ID)"; |
392 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | - $table_name = "esp_price_type"; |
|
394 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
392 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | + $table_name = "esp_price_type"; |
|
394 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | 395 | PRT_name VARCHAR(45) NOT NULL, |
396 | 396 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
397 | 397 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
401 | 401 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
402 | 402 | PRIMARY KEY (PRT_ID)"; |
403 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | - $table_name = "esp_ticket"; |
|
405 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
403 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | + $table_name = "esp_ticket"; |
|
405 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
406 | 406 | TTM_ID INT(10) UNSIGNED NOT NULL, |
407 | 407 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
408 | 408 | TKT_description TEXT NOT NULL, |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
424 | 424 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
425 | 425 | PRIMARY KEY (TKT_ID)"; |
426 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
428 | - $table_name = 'esp_question_group'; |
|
429 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
426 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
428 | + $table_name = 'esp_question_group'; |
|
429 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
430 | 430 | QSG_name VARCHAR(255) NOT NULL, |
431 | 431 | QSG_identifier VARCHAR(100) NOT NULL, |
432 | 432 | QSG_desc TEXT NULL, |
@@ -438,133 +438,133 @@ discard block |
||
438 | 438 | QSG_wp_user BIGINT UNSIGNED NULL, |
439 | 439 | PRIMARY KEY (QSG_ID), |
440 | 440 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
441 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
443 | - // (because many need to convert old string states to foreign keys into the states table) |
|
444 | - $script_4_1_defaults->insert_default_states(); |
|
445 | - $script_4_1_defaults->insert_default_countries(); |
|
446 | - // schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
447 | - $this->insert_default_price_types(); |
|
448 | - $this->insert_default_prices(); |
|
449 | - $this->insert_default_tickets(); |
|
450 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
451 | - EE_Config::instance()->update_espresso_config(false, true); |
|
452 | - return true; |
|
453 | - } |
|
441 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
443 | + // (because many need to convert old string states to foreign keys into the states table) |
|
444 | + $script_4_1_defaults->insert_default_states(); |
|
445 | + $script_4_1_defaults->insert_default_countries(); |
|
446 | + // schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
447 | + $this->insert_default_price_types(); |
|
448 | + $this->insert_default_prices(); |
|
449 | + $this->insert_default_tickets(); |
|
450 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
451 | + EE_Config::instance()->update_espresso_config(false, true); |
|
452 | + return true; |
|
453 | + } |
|
454 | 454 | |
455 | 455 | |
456 | 456 | |
457 | - /** |
|
458 | - * @return boolean |
|
459 | - */ |
|
460 | - public function schema_changes_after_migration() |
|
461 | - { |
|
462 | - return true; |
|
463 | - } |
|
457 | + /** |
|
458 | + * @return boolean |
|
459 | + */ |
|
460 | + public function schema_changes_after_migration() |
|
461 | + { |
|
462 | + return true; |
|
463 | + } |
|
464 | 464 | |
465 | 465 | |
466 | 466 | |
467 | - public function migration_page_hooks() |
|
468 | - { |
|
469 | - } |
|
467 | + public function migration_page_hooks() |
|
468 | + { |
|
469 | + } |
|
470 | 470 | |
471 | 471 | |
472 | 472 | |
473 | - /** |
|
474 | - * insert_default_price_types |
|
475 | - * |
|
476 | - * @since 4.5.0 |
|
477 | - * @return void |
|
478 | - */ |
|
479 | - public function insert_default_price_types() |
|
480 | - { |
|
481 | - global $wpdb; |
|
482 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
483 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
484 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
485 | - $price_types_exist = $wpdb->get_var($SQL); |
|
486 | - if (! $price_types_exist) { |
|
487 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
488 | - $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
473 | + /** |
|
474 | + * insert_default_price_types |
|
475 | + * |
|
476 | + * @since 4.5.0 |
|
477 | + * @return void |
|
478 | + */ |
|
479 | + public function insert_default_price_types() |
|
480 | + { |
|
481 | + global $wpdb; |
|
482 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
483 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
484 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
485 | + $price_types_exist = $wpdb->get_var($SQL); |
|
486 | + if (! $price_types_exist) { |
|
487 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
488 | + $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
489 | 489 | (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
490 | 490 | (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
491 | 491 | (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
492 | 492 | (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
493 | 493 | (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
494 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
495 | - $wpdb->query($SQL); |
|
496 | - } |
|
497 | - } |
|
498 | - } |
|
494 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
495 | + $wpdb->query($SQL); |
|
496 | + } |
|
497 | + } |
|
498 | + } |
|
499 | 499 | |
500 | 500 | |
501 | 501 | |
502 | - /** |
|
503 | - * insert DEFAULT prices. |
|
504 | - * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
505 | - * when EEH_Activaion's initialize_db_content is called via ahook in |
|
506 | - * EE_Brewing_regular |
|
507 | - * |
|
508 | - * @since 4.5.0 |
|
509 | - * @return void |
|
510 | - */ |
|
511 | - public function insert_default_prices() |
|
512 | - { |
|
513 | - global $wpdb; |
|
514 | - $price_table = $wpdb->prefix . "esp_price"; |
|
515 | - if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
516 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
517 | - $prices_exist = $wpdb->get_var($SQL); |
|
518 | - if (! $prices_exist) { |
|
519 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
520 | - $SQL = "INSERT INTO $price_table |
|
502 | + /** |
|
503 | + * insert DEFAULT prices. |
|
504 | + * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
505 | + * when EEH_Activaion's initialize_db_content is called via ahook in |
|
506 | + * EE_Brewing_regular |
|
507 | + * |
|
508 | + * @since 4.5.0 |
|
509 | + * @return void |
|
510 | + */ |
|
511 | + public function insert_default_prices() |
|
512 | + { |
|
513 | + global $wpdb; |
|
514 | + $price_table = $wpdb->prefix . "esp_price"; |
|
515 | + if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
516 | + $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
517 | + $prices_exist = $wpdb->get_var($SQL); |
|
518 | + if (! $prices_exist) { |
|
519 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
520 | + $SQL = "INSERT INTO $price_table |
|
521 | 521 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
522 | 522 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);"; |
523 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
524 | - $wpdb->query($SQL); |
|
525 | - } |
|
526 | - } |
|
527 | - } |
|
523 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
524 | + $wpdb->query($SQL); |
|
525 | + } |
|
526 | + } |
|
527 | + } |
|
528 | 528 | |
529 | 529 | |
530 | 530 | |
531 | - /** |
|
532 | - * insert DEFAULT ticket |
|
533 | - * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
534 | - * |
|
535 | - * @since 4.5.0 |
|
536 | - * @return void |
|
537 | - */ |
|
538 | - public function insert_default_tickets() |
|
539 | - { |
|
540 | - global $wpdb; |
|
541 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
542 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
543 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
544 | - $tickets_exist = $wpdb->get_var($SQL); |
|
545 | - if (! $tickets_exist) { |
|
546 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
547 | - $SQL = "INSERT INTO $ticket_table |
|
531 | + /** |
|
532 | + * insert DEFAULT ticket |
|
533 | + * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
534 | + * |
|
535 | + * @since 4.5.0 |
|
536 | + * @return void |
|
537 | + */ |
|
538 | + public function insert_default_tickets() |
|
539 | + { |
|
540 | + global $wpdb; |
|
541 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
542 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
543 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
544 | + $tickets_exist = $wpdb->get_var($SQL); |
|
545 | + if (! $tickets_exist) { |
|
546 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
547 | + $SQL = "INSERT INTO $ticket_table |
|
548 | 548 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
549 | 549 | ( 1, 0, '" |
550 | - . __("Free Ticket", "event_espresso") |
|
551 | - . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
552 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
553 | - $wpdb->query($SQL); |
|
554 | - } |
|
555 | - } |
|
556 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
557 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
558 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
559 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
560 | - if (! $ticket_prc_exist) { |
|
561 | - $SQL = "INSERT INTO $ticket_price_table |
|
550 | + . __("Free Ticket", "event_espresso") |
|
551 | + . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
552 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
553 | + $wpdb->query($SQL); |
|
554 | + } |
|
555 | + } |
|
556 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
557 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
558 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
559 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
560 | + if (! $ticket_prc_exist) { |
|
561 | + $SQL = "INSERT INTO $ticket_price_table |
|
562 | 562 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
563 | 563 | ( 1, 1, 1 ) |
564 | 564 | "; |
565 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
566 | - $wpdb->query($SQL); |
|
567 | - } |
|
568 | - } |
|
569 | - } |
|
565 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
566 | + $wpdb->query($SQL); |
|
567 | + } |
|
568 | + } |
|
569 | + } |
|
570 | 570 | } |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | // unfortunately, this needs to be done upon INCLUSION of this file, |
14 | 14 | // instead of construction, because it only gets constructed on first page load |
15 | 15 | // (all other times it gets resurrected from a wordpress option) |
16 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
|
16 | +$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*'); |
|
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | 19 | $matches = array(); |
20 | 20 | preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
21 | + $class_to_filepath[$matches[1]] = $filepath; |
|
22 | 22 | } |
23 | 23 | // give addons a chance to autoload their stages too |
24 | 24 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
60 | 60 | // echo "$version_string can be migrated from"; |
61 | 61 | return true; |
62 | - } elseif (! $version_string) { |
|
62 | + } elseif ( ! $version_string) { |
|
63 | 63 | // echo "no version string provided: $version_string"; |
64 | 64 | // no version string provided... this must be pre 4.3 |
65 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | 66 | } else { |
67 | 67 | // echo "$version_string doesnt apply"; |
68 | 68 | return false; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function schema_changes_before_migration() |
75 | 75 | { |
76 | 76 | // relies on 4.1's EEH_Activation::create_table |
77 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
77 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
78 | 78 | $table_name = 'esp_answer'; |
79 | 79 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
80 | 80 | REG_ID INT UNSIGNED NOT NULL, |
@@ -479,18 +479,18 @@ discard block |
||
479 | 479 | public function insert_default_price_types() |
480 | 480 | { |
481 | 481 | global $wpdb; |
482 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
482 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
483 | 483 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
484 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
484 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
485 | 485 | $price_types_exist = $wpdb->get_var($SQL); |
486 | - if (! $price_types_exist) { |
|
486 | + if ( ! $price_types_exist) { |
|
487 | 487 | $user_id = EEH_Activation::get_default_creator_id(); |
488 | 488 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
489 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
|
490 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
|
491 | - (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
|
492 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
|
493 | - (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
|
489 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, $user_id, 0), |
|
490 | + (2, '".__('Percent Discount', 'event_espresso')."', 2, 1, 20, $user_id, 0), |
|
491 | + (3, '".__('Dollar Discount', 'event_espresso')."', 2, 0, 30, $user_id, 0), |
|
492 | + (4, '".__('Percent Surcharge', 'event_espresso')."', 3, 1, 40, $user_id, 0), |
|
493 | + (5, '".__('Dollar Surcharge', 'event_espresso')."', 3, 0, 50, $user_id, 0);"; |
|
494 | 494 | $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
495 | 495 | $wpdb->query($SQL); |
496 | 496 | } |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | public function insert_default_prices() |
512 | 512 | { |
513 | 513 | global $wpdb; |
514 | - $price_table = $wpdb->prefix . "esp_price"; |
|
514 | + $price_table = $wpdb->prefix."esp_price"; |
|
515 | 515 | if ($this->_get_table_analysis()->tableExists($price_table)) { |
516 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
516 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
517 | 517 | $prices_exist = $wpdb->get_var($SQL); |
518 | - if (! $prices_exist) { |
|
518 | + if ( ! $prices_exist) { |
|
519 | 519 | $user_id = EEH_Activation::get_default_creator_id(); |
520 | 520 | $SQL = "INSERT INTO $price_table |
521 | 521 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | public function insert_default_tickets() |
539 | 539 | { |
540 | 540 | global $wpdb; |
541 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
541 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
542 | 542 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
543 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
543 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
544 | 544 | $tickets_exist = $wpdb->get_var($SQL); |
545 | - if (! $tickets_exist) { |
|
545 | + if ( ! $tickets_exist) { |
|
546 | 546 | $user_id = EEH_Activation::get_default_creator_id(); |
547 | 547 | $SQL = "INSERT INTO $ticket_table |
548 | 548 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | $wpdb->query($SQL); |
554 | 554 | } |
555 | 555 | } |
556 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
556 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
557 | 557 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
558 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
558 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
559 | 559 | $ticket_prc_exist = $wpdb->get_var($SQL); |
560 | - if (! $ticket_prc_exist) { |
|
560 | + if ( ! $ticket_prc_exist) { |
|
561 | 561 | $SQL = "INSERT INTO $ticket_price_table |
562 | 562 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
563 | 563 | ( 1, 1, 1 ) |
@@ -14,48 +14,48 @@ |
||
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * Just initializes the status of the migration |
|
19 | - * |
|
20 | - * @return EE_DMS_4_6_0_country_system_question |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - global $wpdb; |
|
25 | - $this->_pretty_name = __('Country - System Question', 'event_espresso'); |
|
26 | - $this->_old_table = $wpdb->prefix.'esp_question'; |
|
27 | - $this->_extra_where_sql = "WHERE QST_system = 'country'"; |
|
28 | - parent::__construct(); |
|
29 | - } |
|
17 | + /** |
|
18 | + * Just initializes the status of the migration |
|
19 | + * |
|
20 | + * @return EE_DMS_4_6_0_country_system_question |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + global $wpdb; |
|
25 | + $this->_pretty_name = __('Country - System Question', 'event_espresso'); |
|
26 | + $this->_old_table = $wpdb->prefix.'esp_question'; |
|
27 | + $this->_extra_where_sql = "WHERE QST_system = 'country'"; |
|
28 | + parent::__construct(); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * updates the question with the new question type |
|
35 | - * @param array $question an associative array where keys are column names and values are their values. |
|
36 | - * @return null |
|
37 | - */ |
|
38 | - protected function _migrate_old_row($question) |
|
39 | - { |
|
40 | - if ($question['QST_ID'] && $question['QST_system'] == 'country') { |
|
41 | - global $wpdb; |
|
42 | - $success = $wpdb->update( |
|
43 | - $this->_old_table, |
|
44 | - array( 'QST_type' => 'COUNTRY' ), // data |
|
45 | - array( 'QST_ID' => $question['QST_ID'] ), // where |
|
46 | - array( '%s' ), // data format |
|
47 | - array( '%d' ) // where format |
|
48 | - ); |
|
49 | - if (! $success) { |
|
50 | - $this->add_error( |
|
51 | - sprintf( |
|
52 | - __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
|
53 | - wp_json_encode($question['QST_system']), |
|
54 | - $question['QST_ID'], |
|
55 | - $wpdb->last_error |
|
56 | - ) |
|
57 | - ); |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
33 | + /** |
|
34 | + * updates the question with the new question type |
|
35 | + * @param array $question an associative array where keys are column names and values are their values. |
|
36 | + * @return null |
|
37 | + */ |
|
38 | + protected function _migrate_old_row($question) |
|
39 | + { |
|
40 | + if ($question['QST_ID'] && $question['QST_system'] == 'country') { |
|
41 | + global $wpdb; |
|
42 | + $success = $wpdb->update( |
|
43 | + $this->_old_table, |
|
44 | + array( 'QST_type' => 'COUNTRY' ), // data |
|
45 | + array( 'QST_ID' => $question['QST_ID'] ), // where |
|
46 | + array( '%s' ), // data format |
|
47 | + array( '%d' ) // where format |
|
48 | + ); |
|
49 | + if (! $success) { |
|
50 | + $this->add_error( |
|
51 | + sprintf( |
|
52 | + __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
|
53 | + wp_json_encode($question['QST_system']), |
|
54 | + $question['QST_ID'], |
|
55 | + $wpdb->last_error |
|
56 | + ) |
|
57 | + ); |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | 61 | } |
@@ -41,12 +41,12 @@ |
||
41 | 41 | global $wpdb; |
42 | 42 | $success = $wpdb->update( |
43 | 43 | $this->_old_table, |
44 | - array( 'QST_type' => 'COUNTRY' ), // data |
|
45 | - array( 'QST_ID' => $question['QST_ID'] ), // where |
|
46 | - array( '%s' ), // data format |
|
47 | - array( '%d' ) // where format |
|
44 | + array('QST_type' => 'COUNTRY'), // data |
|
45 | + array('QST_ID' => $question['QST_ID']), // where |
|
46 | + array('%s'), // data format |
|
47 | + array('%d') // where format |
|
48 | 48 | ); |
49 | - if (! $success) { |
|
49 | + if ( ! $success) { |
|
50 | 50 | $this->add_error( |
51 | 51 | sprintf( |
52 | 52 | __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
@@ -14,48 +14,48 @@ |
||
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * Just initializes the status of the migration |
|
19 | - * |
|
20 | - * @return EE_DMS_4_6_0_state_system_question |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - global $wpdb; |
|
25 | - $this->_pretty_name = __('State - System Question', 'event_espresso'); |
|
26 | - $this->_old_table = $wpdb->prefix.'esp_question'; |
|
27 | - $this->_extra_where_sql = "WHERE QST_system = 'state'"; |
|
28 | - parent::__construct(); |
|
29 | - } |
|
17 | + /** |
|
18 | + * Just initializes the status of the migration |
|
19 | + * |
|
20 | + * @return EE_DMS_4_6_0_state_system_question |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + global $wpdb; |
|
25 | + $this->_pretty_name = __('State - System Question', 'event_espresso'); |
|
26 | + $this->_old_table = $wpdb->prefix.'esp_question'; |
|
27 | + $this->_extra_where_sql = "WHERE QST_system = 'state'"; |
|
28 | + parent::__construct(); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * updates the question with the new question type |
|
35 | - * @param array $question an associative array where keys are column names and values are their values. |
|
36 | - * @return null |
|
37 | - */ |
|
38 | - protected function _migrate_old_row($question) |
|
39 | - { |
|
40 | - if ($question['QST_ID'] && $question['QST_system'] == 'state') { |
|
41 | - global $wpdb; |
|
42 | - $success = $wpdb->update( |
|
43 | - $this->_old_table, |
|
44 | - array( 'QST_type' => 'STATE' ), // data |
|
45 | - array( 'QST_ID' => $question['QST_ID'] ), // where |
|
46 | - array( '%s' ), // data format |
|
47 | - array( '%d' ) // where format |
|
48 | - ); |
|
49 | - if (! $success) { |
|
50 | - $this->add_error( |
|
51 | - sprintf( |
|
52 | - __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
|
53 | - wp_json_encode($question['QST_system']), |
|
54 | - $question['QST_ID'], |
|
55 | - $wpdb->last_error |
|
56 | - ) |
|
57 | - ); |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
33 | + /** |
|
34 | + * updates the question with the new question type |
|
35 | + * @param array $question an associative array where keys are column names and values are their values. |
|
36 | + * @return null |
|
37 | + */ |
|
38 | + protected function _migrate_old_row($question) |
|
39 | + { |
|
40 | + if ($question['QST_ID'] && $question['QST_system'] == 'state') { |
|
41 | + global $wpdb; |
|
42 | + $success = $wpdb->update( |
|
43 | + $this->_old_table, |
|
44 | + array( 'QST_type' => 'STATE' ), // data |
|
45 | + array( 'QST_ID' => $question['QST_ID'] ), // where |
|
46 | + array( '%s' ), // data format |
|
47 | + array( '%d' ) // where format |
|
48 | + ); |
|
49 | + if (! $success) { |
|
50 | + $this->add_error( |
|
51 | + sprintf( |
|
52 | + __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
|
53 | + wp_json_encode($question['QST_system']), |
|
54 | + $question['QST_ID'], |
|
55 | + $wpdb->last_error |
|
56 | + ) |
|
57 | + ); |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | 61 | } |
@@ -41,12 +41,12 @@ |
||
41 | 41 | global $wpdb; |
42 | 42 | $success = $wpdb->update( |
43 | 43 | $this->_old_table, |
44 | - array( 'QST_type' => 'STATE' ), // data |
|
45 | - array( 'QST_ID' => $question['QST_ID'] ), // where |
|
46 | - array( '%s' ), // data format |
|
47 | - array( '%d' ) // where format |
|
44 | + array('QST_type' => 'STATE'), // data |
|
45 | + array('QST_ID' => $question['QST_ID']), // where |
|
46 | + array('%s'), // data format |
|
47 | + array('%d') // where format |
|
48 | 48 | ); |
49 | - if (! $success) { |
|
49 | + if ( ! $success) { |
|
50 | 50 | $this->add_error( |
51 | 51 | sprintf( |
52 | 52 | __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
@@ -28,59 +28,59 @@ |
||
28 | 28 | class EE_DMS_4_6_0_invoice_settings extends EE_Data_Migration_Script_Stage |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * Just initializes the status of the migration |
|
33 | - */ |
|
34 | - public function __construct() |
|
35 | - { |
|
36 | - $this->_pretty_name = __('Update Invoice Settings', 'event_espresso'); |
|
37 | - parent::__construct(); |
|
38 | - } |
|
31 | + /** |
|
32 | + * Just initializes the status of the migration |
|
33 | + */ |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | + $this->_pretty_name = __('Update Invoice Settings', 'event_espresso'); |
|
37 | + parent::__construct(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * _count_records_to_migrate |
|
44 | - * Counts the records to migrate; the public version may cache it |
|
45 | - * |
|
46 | - * @access protected |
|
47 | - * @return int |
|
48 | - */ |
|
49 | - protected function _count_records_to_migrate() |
|
50 | - { |
|
51 | - return 1; |
|
52 | - } |
|
42 | + /** |
|
43 | + * _count_records_to_migrate |
|
44 | + * Counts the records to migrate; the public version may cache it |
|
45 | + * |
|
46 | + * @access protected |
|
47 | + * @return int |
|
48 | + */ |
|
49 | + protected function _count_records_to_migrate() |
|
50 | + { |
|
51 | + return 1; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * _migration_step |
|
58 | - * |
|
59 | - * @access protected |
|
60 | - * @param int $num_items |
|
61 | - * @throws EE_Error |
|
62 | - * @return int number of items ACTUALLY migrated |
|
63 | - * @throws InvalidDataTypeException |
|
64 | - */ |
|
65 | - protected function _migration_step($num_items = 1) |
|
66 | - { |
|
56 | + /** |
|
57 | + * _migration_step |
|
58 | + * |
|
59 | + * @access protected |
|
60 | + * @param int $num_items |
|
61 | + * @throws EE_Error |
|
62 | + * @return int number of items ACTUALLY migrated |
|
63 | + * @throws InvalidDataTypeException |
|
64 | + */ |
|
65 | + protected function _migration_step($num_items = 1) |
|
66 | + { |
|
67 | 67 | |
68 | - $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
69 | - $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
70 | - $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
71 | - if ($overridden_invoice_body || $overridden_receipt_body) { |
|
72 | - new PersistentAdminNotice( |
|
73 | - 'invoice_overriding_templates', |
|
74 | - esc_html__( |
|
75 | - 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
76 | - 'event_espresso' |
|
77 | - ), |
|
78 | - true |
|
79 | - ); |
|
80 | - } |
|
68 | + $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
69 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
70 | + $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
71 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
72 | + new PersistentAdminNotice( |
|
73 | + 'invoice_overriding_templates', |
|
74 | + esc_html__( |
|
75 | + 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
76 | + 'event_espresso' |
|
77 | + ), |
|
78 | + true |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - // regardless of whether it worked or not, we ought to continue the migration |
|
83 | - $this->set_completed(); |
|
84 | - return 1; |
|
85 | - } |
|
82 | + // regardless of whether it worked or not, we ought to continue the migration |
|
83 | + $this->set_completed(); |
|
84 | + return 1; |
|
85 | + } |
|
86 | 86 | } |
@@ -66,8 +66,8 @@ |
||
66 | 66 | { |
67 | 67 | |
68 | 68 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
69 | - $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
70 | - $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
69 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', null, false, false, true); |
|
70 | + $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', null, false, false, true); |
|
71 | 71 | if ($overridden_invoice_body || $overridden_receipt_body) { |
72 | 72 | new PersistentAdminNotice( |
73 | 73 | 'invoice_overriding_templates', |
@@ -11,69 +11,69 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_DMS_4_6_0_billing_info extends EE_Data_Migration_Script_Stage_Table |
13 | 13 | { |
14 | - public function __construct() |
|
15 | - { |
|
16 | - global $wpdb; |
|
17 | - $this->_old_table = $wpdb->postmeta; |
|
18 | - $this->_pretty_name = __('Billing Info', 'event_espresso'); |
|
19 | - $this->_extra_where_sql = "WHERE meta_key LIKE 'billing_info_%'"; |
|
20 | - parent::__construct(); |
|
21 | - } |
|
22 | - protected function _migrate_old_row($old_row) |
|
23 | - { |
|
24 | - $new_billing_info = array(); |
|
25 | - $old_billing_info = maybe_unserialize($old_row['meta_value']); |
|
26 | - $gateway_name = str_replace("billing_info_", '', $old_row['meta_key']); |
|
27 | - $repetitive_prefix = '_reg-page-billing-'; |
|
28 | - $repetitive_suffix = "-" . $gateway_name; |
|
29 | - foreach ($old_billing_info as $old_input_name => $input_value) { |
|
30 | - $old_input_name_important_part = str_replace(array( $repetitive_prefix, $repetitive_suffix ), array( '', ''), $old_input_name); |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + global $wpdb; |
|
17 | + $this->_old_table = $wpdb->postmeta; |
|
18 | + $this->_pretty_name = __('Billing Info', 'event_espresso'); |
|
19 | + $this->_extra_where_sql = "WHERE meta_key LIKE 'billing_info_%'"; |
|
20 | + parent::__construct(); |
|
21 | + } |
|
22 | + protected function _migrate_old_row($old_row) |
|
23 | + { |
|
24 | + $new_billing_info = array(); |
|
25 | + $old_billing_info = maybe_unserialize($old_row['meta_value']); |
|
26 | + $gateway_name = str_replace("billing_info_", '', $old_row['meta_key']); |
|
27 | + $repetitive_prefix = '_reg-page-billing-'; |
|
28 | + $repetitive_suffix = "-" . $gateway_name; |
|
29 | + foreach ($old_billing_info as $old_input_name => $input_value) { |
|
30 | + $old_input_name_important_part = str_replace(array( $repetitive_prefix, $repetitive_suffix ), array( '', ''), $old_input_name); |
|
31 | 31 | |
32 | - switch ($old_input_name_important_part) { |
|
33 | - case 'fname': |
|
34 | - $new_input_name = 'first_name'; |
|
35 | - break; |
|
36 | - case 'lname': |
|
37 | - $new_input_name = 'last_name'; |
|
38 | - break; |
|
39 | - case 'state': |
|
40 | - // we used to store the state's id ,but now we just store the name |
|
41 | - $new_input_name = $old_input_name_important_part; |
|
42 | - $input_value = $this->_get_state_name_by_ID($input_value); |
|
43 | - break; |
|
44 | - case 'card-nmbr': |
|
45 | - $new_input_name = 'credit_card'; |
|
46 | - break; |
|
47 | - case 'card-type':// paypal pro only |
|
48 | - $new_input_name = 'credit_card_type'; |
|
49 | - break; |
|
50 | - case 'card-exp-date-mnth': |
|
51 | - $new_input_name = 'exp_month'; |
|
52 | - $input_value = ''; |
|
53 | - break; |
|
54 | - case 'card-exp-date-year': |
|
55 | - $new_input_name = 'exp_year'; |
|
56 | - $input_value = 0; |
|
57 | - break; |
|
58 | - case 'ccv-code': |
|
59 | - $new_input_name = 'cvv'; |
|
60 | - break; |
|
61 | - default: |
|
62 | - $new_input_name = $old_input_name_important_part; |
|
63 | - } |
|
64 | - $new_billing_info[ $new_input_name ] = $input_value; |
|
65 | - } |
|
66 | - update_post_meta($old_row['post_id'], $old_row['meta_key'], $new_billing_info); |
|
67 | - } |
|
68 | - /** |
|
69 | - * |
|
70 | - * @global type $wpdb |
|
71 | - * @param int $id |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - protected function _get_state_name_by_ID($id) |
|
75 | - { |
|
76 | - global $wpdb; |
|
77 | - return $wpdb->get_var($wpdb->prepare("SELECT STA_name FROM " . $wpdb->prefix . "esp_state WHERE STA_ID = %d", $id)); |
|
78 | - } |
|
32 | + switch ($old_input_name_important_part) { |
|
33 | + case 'fname': |
|
34 | + $new_input_name = 'first_name'; |
|
35 | + break; |
|
36 | + case 'lname': |
|
37 | + $new_input_name = 'last_name'; |
|
38 | + break; |
|
39 | + case 'state': |
|
40 | + // we used to store the state's id ,but now we just store the name |
|
41 | + $new_input_name = $old_input_name_important_part; |
|
42 | + $input_value = $this->_get_state_name_by_ID($input_value); |
|
43 | + break; |
|
44 | + case 'card-nmbr': |
|
45 | + $new_input_name = 'credit_card'; |
|
46 | + break; |
|
47 | + case 'card-type':// paypal pro only |
|
48 | + $new_input_name = 'credit_card_type'; |
|
49 | + break; |
|
50 | + case 'card-exp-date-mnth': |
|
51 | + $new_input_name = 'exp_month'; |
|
52 | + $input_value = ''; |
|
53 | + break; |
|
54 | + case 'card-exp-date-year': |
|
55 | + $new_input_name = 'exp_year'; |
|
56 | + $input_value = 0; |
|
57 | + break; |
|
58 | + case 'ccv-code': |
|
59 | + $new_input_name = 'cvv'; |
|
60 | + break; |
|
61 | + default: |
|
62 | + $new_input_name = $old_input_name_important_part; |
|
63 | + } |
|
64 | + $new_billing_info[ $new_input_name ] = $input_value; |
|
65 | + } |
|
66 | + update_post_meta($old_row['post_id'], $old_row['meta_key'], $new_billing_info); |
|
67 | + } |
|
68 | + /** |
|
69 | + * |
|
70 | + * @global type $wpdb |
|
71 | + * @param int $id |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + protected function _get_state_name_by_ID($id) |
|
75 | + { |
|
76 | + global $wpdb; |
|
77 | + return $wpdb->get_var($wpdb->prepare("SELECT STA_name FROM " . $wpdb->prefix . "esp_state WHERE STA_ID = %d", $id)); |
|
78 | + } |
|
79 | 79 | } |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $old_billing_info = maybe_unserialize($old_row['meta_value']); |
26 | 26 | $gateway_name = str_replace("billing_info_", '', $old_row['meta_key']); |
27 | 27 | $repetitive_prefix = '_reg-page-billing-'; |
28 | - $repetitive_suffix = "-" . $gateway_name; |
|
28 | + $repetitive_suffix = "-".$gateway_name; |
|
29 | 29 | foreach ($old_billing_info as $old_input_name => $input_value) { |
30 | - $old_input_name_important_part = str_replace(array( $repetitive_prefix, $repetitive_suffix ), array( '', ''), $old_input_name); |
|
30 | + $old_input_name_important_part = str_replace(array($repetitive_prefix, $repetitive_suffix), array('', ''), $old_input_name); |
|
31 | 31 | |
32 | 32 | switch ($old_input_name_important_part) { |
33 | 33 | case 'fname': |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | default: |
62 | 62 | $new_input_name = $old_input_name_important_part; |
63 | 63 | } |
64 | - $new_billing_info[ $new_input_name ] = $input_value; |
|
64 | + $new_billing_info[$new_input_name] = $input_value; |
|
65 | 65 | } |
66 | 66 | update_post_meta($old_row['post_id'], $old_row['meta_key'], $new_billing_info); |
67 | 67 | } |
@@ -74,6 +74,6 @@ discard block |
||
74 | 74 | protected function _get_state_name_by_ID($id) |
75 | 75 | { |
76 | 76 | global $wpdb; |
77 | - return $wpdb->get_var($wpdb->prepare("SELECT STA_name FROM " . $wpdb->prefix . "esp_state WHERE STA_ID = %d", $id)); |
|
77 | + return $wpdb->get_var($wpdb->prepare("SELECT STA_name FROM ".$wpdb->prefix."esp_state WHERE STA_ID = %d", $id)); |
|
78 | 78 | } |
79 | 79 | } |