@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -21,68 +21,68 @@ discard block |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - public function __construct($routing = true) |
|
25 | - { |
|
26 | - parent::__construct($routing); |
|
27 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
28 | - } |
|
24 | + public function __construct($routing = true) |
|
25 | + { |
|
26 | + parent::__construct($routing); |
|
27 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | - protected function _extend_page_config() |
|
32 | - { |
|
31 | + protected function _extend_page_config() |
|
32 | + { |
|
33 | 33 | |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
35 | 35 | |
36 | - //filters and action hooks here |
|
37 | - add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
38 | - add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
39 | - array($this, 'update_debug_logging_options'), 10, 1); |
|
36 | + //filters and action hooks here |
|
37 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
38 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
39 | + array($this, 'update_debug_logging_options'), 10, 1); |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /************* Logging Settings *************/ |
|
45 | + /************* Logging Settings *************/ |
|
46 | 46 | |
47 | - /** |
|
48 | - * debug_logging_options |
|
49 | - * |
|
50 | - * @param array $template_args |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function debug_logging_options($template_args = array()) |
|
55 | - { |
|
56 | - $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
|
57 | - $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
|
58 | - $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
59 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
60 | - EEH_Template::display_template($template, $template_args); |
|
61 | - } |
|
47 | + /** |
|
48 | + * debug_logging_options |
|
49 | + * |
|
50 | + * @param array $template_args |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function debug_logging_options($template_args = array()) |
|
55 | + { |
|
56 | + $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
|
57 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
|
58 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
59 | + $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
60 | + EEH_Template::display_template($template, $template_args); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * update_debug_logging_options |
|
66 | - * |
|
67 | - * @param array $admin_options |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function update_debug_logging_options($admin_options = array()) |
|
72 | - { |
|
73 | - $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | - $admin_options->use_full_logging = $use_full_logging; |
|
64 | + /** |
|
65 | + * update_debug_logging_options |
|
66 | + * |
|
67 | + * @param array $admin_options |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function update_debug_logging_options($admin_options = array()) |
|
72 | + { |
|
73 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | + $admin_options->use_full_logging = $use_full_logging; |
|
75 | 75 | |
76 | - if ($use_full_logging === false) { |
|
77 | - EE_Error::get_notices(false); |
|
78 | - EE_Error::reset_notices(); |
|
79 | - } |
|
76 | + if ($use_full_logging === false) { |
|
77 | + EE_Error::get_notices(false); |
|
78 | + EE_Error::reset_notices(); |
|
79 | + } |
|
80 | 80 | |
81 | - $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
82 | - $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
81 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
82 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
83 | 83 | |
84 | - return $admin_options; |
|
85 | - } |
|
84 | + return $admin_options; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | 88 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | public function __construct($routing = true) |
25 | 25 | { |
26 | 26 | parent::__construct($routing); |
27 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
27 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function _extend_page_config() |
32 | 32 | { |
33 | 33 | |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings'; |
|
35 | 35 | |
36 | 36 | //filters and action hooks here |
37 | 37 | add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
57 | 57 | $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
58 | 58 | $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
59 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
59 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
60 | 60 | EEH_Template::display_template($template, $template_args); |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function update_debug_logging_options($admin_options = array()) |
72 | 72 | { |
73 | - $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
73 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | 74 | $admin_options->use_full_logging = $use_full_logging; |
75 | 75 | |
76 | 76 | if ($use_full_logging === false) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @link {@link http://www.eventespresso.com} |
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | -if ( function_exists( 'espresso_version' ) ) { |
|
42 | +if (function_exists('espresso_version')) { |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * espresso_duplicate_plugin_error |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | 60 | } |
61 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | 62 | |
63 | 63 | } else { |
64 | 64 | |
65 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
66 | 66 | |
67 | - if ( ! version_compare( PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=' ) ) { |
|
67 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * espresso_minimum_php_version_error |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | </p> |
91 | 91 | </div> |
92 | 92 | <?php |
93 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
93 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
94 | 94 | } |
95 | - add_action( 'admin_notices', 'espresso_minimum_php_version_error', 1 ); |
|
95 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
96 | 96 | |
97 | 97 | } else { |
98 | 98 | |
@@ -103,99 +103,99 @@ discard block |
||
103 | 103 | * @return string |
104 | 104 | */ |
105 | 105 | function espresso_version() { |
106 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.22.rc.000' ); |
|
106 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.22.rc.000'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // define versions |
110 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
111 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
112 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
113 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
114 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
110 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
111 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
112 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
113 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
114 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
115 | 115 | |
116 | 116 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
117 | - if ( ! defined( 'DS' ) ) { |
|
118 | - define( 'DS', '/' ); |
|
117 | + if ( ! defined('DS')) { |
|
118 | + define('DS', '/'); |
|
119 | 119 | } |
120 | - if ( ! defined( 'PS' ) ) { |
|
121 | - define( 'PS', PATH_SEPARATOR ); |
|
120 | + if ( ! defined('PS')) { |
|
121 | + define('PS', PATH_SEPARATOR); |
|
122 | 122 | } |
123 | - if ( ! defined( 'SP' ) ) { |
|
124 | - define( 'SP', ' ' ); |
|
123 | + if ( ! defined('SP')) { |
|
124 | + define('SP', ' '); |
|
125 | 125 | } |
126 | - if ( ! defined( 'EENL' ) ) { |
|
127 | - define( 'EENL', "\n" ); |
|
126 | + if ( ! defined('EENL')) { |
|
127 | + define('EENL', "\n"); |
|
128 | 128 | } |
129 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
129 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
130 | 130 | // define the plugin directory and URL |
131 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
132 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
133 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
131 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
132 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
133 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
134 | 134 | // main root folder paths |
135 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
136 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
137 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
138 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
139 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
140 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
141 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
142 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
135 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
136 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
137 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
138 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
139 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
140 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
141 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
142 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
143 | 143 | // core system paths |
144 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
145 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
146 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
147 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
148 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
149 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
150 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
151 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
152 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
153 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
154 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
155 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
144 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
145 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
146 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
147 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
148 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
149 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
150 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
151 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
152 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
153 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
154 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
155 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
156 | 156 | // gateways |
157 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
158 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
157 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
158 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
159 | 159 | // asset URL paths |
160 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
161 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
162 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
163 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
164 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
165 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
160 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
161 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
162 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
163 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
164 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
165 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
166 | 166 | // define upload paths |
167 | 167 | $uploads = wp_upload_dir(); |
168 | 168 | // define the uploads directory and URL |
169 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS ); |
|
170 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS ); |
|
169 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
170 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
171 | 171 | // define the templates directory and URL |
172 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS ); |
|
173 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS ); |
|
172 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
173 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
174 | 174 | // define the gateway directory and URL |
175 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
176 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
175 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
176 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
177 | 177 | // languages folder/path |
178 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
179 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
178 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
179 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
180 | 180 | //check for dompdf fonts in uploads |
181 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
182 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
181 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
182 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
183 | 183 | } |
184 | 184 | //ajax constants |
185 | 185 | define( |
186 | 186 | 'EE_FRONT_AJAX', |
187 | - isset( $_REQUEST['ee_front_ajax'] ) || isset( $_REQUEST['data']['ee_front_ajax'] ) ? true : false |
|
187 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
188 | 188 | ); |
189 | 189 | define( |
190 | 190 | 'EE_ADMIN_AJAX', |
191 | - isset( $_REQUEST['ee_admin_ajax'] ) || isset( $_REQUEST['data']['ee_admin_ajax'] ) ? true : false |
|
191 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
192 | 192 | ); |
193 | 193 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
194 | 194 | //you're better to use this than its straight value (currently -1) in case you ever |
195 | 195 | //want to change its default value! or find when -1 means infinity |
196 | - define( 'EE_INF_IN_DB', -1 ); |
|
197 | - define( 'EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
198 | - define( 'EE_DEBUG', false ); |
|
196 | + define('EE_INF_IN_DB', -1); |
|
197 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
198 | + define('EE_DEBUG', false); |
|
199 | 199 | |
200 | 200 | |
201 | 201 | /** |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
204 | 204 | */ |
205 | 205 | function espresso_plugin_activation() { |
206 | - update_option( 'ee_espresso_activation', true ); |
|
206 | + update_option('ee_espresso_activation', true); |
|
207 | 207 | } |
208 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
208 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
209 | 209 | |
210 | 210 | |
211 | 211 | |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function espresso_load_error_handling() { |
217 | 217 | // load debugging tools |
218 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
219 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
218 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
219 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
220 | 220 | EEH_Debug_Tools::instance(); |
221 | 221 | } |
222 | 222 | // load error handling |
223 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
224 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
223 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
224 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
225 | 225 | } else { |
226 | - wp_die( esc_html__( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
226 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -237,16 +237,16 @@ discard block |
||
237 | 237 | * @param string $full_path_to_file |
238 | 238 | * @throws EE_Error |
239 | 239 | */ |
240 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
240 | + function espresso_load_required($classname, $full_path_to_file) { |
|
241 | 241 | static $error_handling_loaded = false; |
242 | - if ( ! $error_handling_loaded ) { |
|
242 | + if ( ! $error_handling_loaded) { |
|
243 | 243 | espresso_load_error_handling(); |
244 | 244 | $error_handling_loaded = true; |
245 | 245 | } |
246 | - if ( is_readable( $full_path_to_file ) ) { |
|
247 | - require_once( $full_path_to_file ); |
|
246 | + if (is_readable($full_path_to_file)) { |
|
247 | + require_once($full_path_to_file); |
|
248 | 248 | } else { |
249 | - throw new EE_Error ( |
|
249 | + throw new EE_Error( |
|
250 | 250 | sprintf( |
251 | 251 | esc_html__( |
252 | 252 | 'The %s class file could not be located or is not readable due to file permissions.', |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
262 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
263 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
261 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
262 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
263 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
264 | 264 | new EE_Bootstrap(); |
265 | 265 | |
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
269 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * deactivate_plugin |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
277 | 277 | * @return void |
278 | 278 | */ |
279 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
280 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
281 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
279 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
280 | + if ( ! function_exists('deactivate_plugins')) { |
|
281 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
282 | 282 | } |
283 | - unset( $_GET['activate'], $_REQUEST['activate'] ); |
|
284 | - deactivate_plugins( $plugin_basename ); |
|
283 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
284 | + deactivate_plugins($plugin_basename); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | } |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | $stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | 17 | if ( ! empty($stages)) { |
18 | - foreach ($stages as $filepath) { |
|
19 | - $matches = array(); |
|
20 | - preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | - $class_to_filepath[$matches[1]] = $filepath; |
|
22 | - } |
|
18 | + foreach ($stages as $filepath) { |
|
19 | + $matches = array(); |
|
20 | + preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | + $class_to_filepath[$matches[1]] = $filepath; |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | //give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath); |
@@ -32,64 +32,64 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * EE_DMS_Core_4_2_0 constructor. |
|
37 | - * |
|
38 | - * @param TableManager $table_manager |
|
39 | - * @param TableAnalysis $table_analysis |
|
40 | - */ |
|
41 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
42 | - { |
|
43 | - $this->_pretty_name = __("Data Migration to Event Espresso 4.2.0.P", "event_espresso"); |
|
44 | - $this->_priority = 10; |
|
45 | - $this->_migration_stages = array( |
|
46 | - new EE_DMS_4_2_0_question_group_questions(), |
|
47 | - new EE_DMS_4_2_0_datetime_fields(), |
|
48 | - ); |
|
49 | - parent::__construct($table_manager, $table_analysis); |
|
50 | - } |
|
35 | + /** |
|
36 | + * EE_DMS_Core_4_2_0 constructor. |
|
37 | + * |
|
38 | + * @param TableManager $table_manager |
|
39 | + * @param TableAnalysis $table_analysis |
|
40 | + */ |
|
41 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
42 | + { |
|
43 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.2.0.P", "event_espresso"); |
|
44 | + $this->_priority = 10; |
|
45 | + $this->_migration_stages = array( |
|
46 | + new EE_DMS_4_2_0_question_group_questions(), |
|
47 | + new EE_DMS_4_2_0_datetime_fields(), |
|
48 | + ); |
|
49 | + parent::__construct($table_manager, $table_analysis); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - public function can_migrate_from_version($version_array) |
|
55 | - { |
|
56 | - $version_string = $version_array['Core']; |
|
57 | - if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) { |
|
54 | + public function can_migrate_from_version($version_array) |
|
55 | + { |
|
56 | + $version_string = $version_array['Core']; |
|
57 | + if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) { |
|
58 | 58 | // echo "$version_string can be migrated fro"; |
59 | - return true; |
|
60 | - } elseif ( ! $version_string) { |
|
59 | + return true; |
|
60 | + } elseif ( ! $version_string) { |
|
61 | 61 | // echo "no version string provided: $version_string"; |
62 | - //no version string provided... this must be pre 4.1 |
|
63 | - //because since 4.1 we're |
|
64 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | - } else { |
|
62 | + //no version string provided... this must be pre 4.1 |
|
63 | + //because since 4.1 we're |
|
64 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | + } else { |
|
66 | 66 | // echo "$version_string doesnt apply"; |
67 | - return false; |
|
68 | - } |
|
69 | - } |
|
67 | + return false; |
|
68 | + } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - public function pretty_name() |
|
74 | - { |
|
75 | - return __("Core Data Migration to version 4.2.0", "event_espresso"); |
|
76 | - } |
|
73 | + public function pretty_name() |
|
74 | + { |
|
75 | + return __("Core Data Migration to version 4.2.0", "event_espresso"); |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | - public function schema_changes_before_migration() |
|
81 | - { |
|
82 | - //relies on 4.1's EEH_Activation::create_table |
|
83 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
84 | - $table_name = 'esp_answer'; |
|
85 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
80 | + public function schema_changes_before_migration() |
|
81 | + { |
|
82 | + //relies on 4.1's EEH_Activation::create_table |
|
83 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
84 | + $table_name = 'esp_answer'; |
|
85 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
86 | 86 | REG_ID INT UNSIGNED NOT NULL, |
87 | 87 | QST_ID INT UNSIGNED NOT NULL, |
88 | 88 | ANS_value TEXT NOT NULL, |
89 | 89 | PRIMARY KEY (ANS_ID)"; |
90 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
91 | - $table_name = 'esp_attendee_meta'; |
|
92 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
90 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
91 | + $table_name = 'esp_attendee_meta'; |
|
92 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
93 | 93 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
94 | 94 | ATT_fname VARCHAR(45) NOT NULL, |
95 | 95 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | KEY ATT_fname (ATT_fname), |
106 | 106 | KEY ATT_lname (ATT_lname), |
107 | 107 | KEY ATT_email (ATT_email)"; |
108 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
109 | - $table_name = 'esp_country'; |
|
110 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
108 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
109 | + $table_name = 'esp_country'; |
|
110 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
111 | 111 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
112 | 112 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
113 | 113 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | CNT_is_EU TINYINT(1) DEFAULT '0', |
124 | 124 | CNT_active TINYINT(1) DEFAULT '0', |
125 | 125 | PRIMARY KEY (CNT_ISO)"; |
126 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
127 | - $table_name = 'esp_datetime'; |
|
128 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
126 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
127 | + $table_name = 'esp_datetime'; |
|
128 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
129 | 129 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
130 | 130 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
131 | 131 | DTT_description TEXT NOT NULL, |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | PRIMARY KEY (DTT_ID), |
141 | 141 | KEY EVT_ID (EVT_ID), |
142 | 142 | KEY DTT_is_primary (DTT_is_primary)"; |
143 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | - $table_name = 'esp_event_meta'; |
|
145 | - $sql = " |
|
143 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | + $table_name = 'esp_event_meta'; |
|
145 | + $sql = " |
|
146 | 146 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
147 | 147 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
148 | 148 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -157,31 +157,31 @@ discard block |
||
157 | 157 | EVT_external_URL VARCHAR(200) NULL, |
158 | 158 | EVT_donations TINYINT(1) NULL, |
159 | 159 | PRIMARY KEY (EVTM_ID)"; |
160 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | - $table_name = 'esp_event_question_group'; |
|
162 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
160 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | + $table_name = 'esp_event_question_group'; |
|
162 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
163 | 163 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
164 | 164 | QSG_ID INT UNSIGNED NOT NULL, |
165 | 165 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
166 | 166 | PRIMARY KEY (EQG_ID)"; |
167 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
168 | - $table_name = 'esp_event_venue'; |
|
169 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
167 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
168 | + $table_name = 'esp_event_venue'; |
|
169 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
170 | 170 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
171 | 171 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
172 | 172 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
173 | 173 | PRIMARY KEY (EVV_ID)"; |
174 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | - $table_name = 'esp_extra_meta'; |
|
176 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
174 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | + $table_name = 'esp_extra_meta'; |
|
176 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
177 | 177 | OBJ_ID INT(11) DEFAULT NULL, |
178 | 178 | EXM_type VARCHAR(45) DEFAULT NULL, |
179 | 179 | EXM_key VARCHAR(45) DEFAULT NULL, |
180 | 180 | EXM_value TEXT, |
181 | 181 | PRIMARY KEY (EXM_ID)"; |
182 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
183 | - $table_name = 'esp_line_item'; |
|
184 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
182 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
183 | + $table_name = 'esp_line_item'; |
|
184 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
185 | 185 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
186 | 186 | TXN_ID INT(11) DEFAULT NULL, |
187 | 187 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -197,18 +197,18 @@ discard block |
||
197 | 197 | OBJ_ID INT(11) DEFAULT NULL, |
198 | 198 | OBJ_type VARCHAR(45)DEFAULT NULL, |
199 | 199 | PRIMARY KEY (LIN_ID)"; |
200 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
201 | - $table_name = 'esp_message_template'; |
|
202 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
200 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
201 | + $table_name = 'esp_message_template'; |
|
202 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | 203 | GRP_ID INT(10) UNSIGNED NOT NULL, |
204 | 204 | MTP_context VARCHAR(50) NOT NULL, |
205 | 205 | MTP_template_field VARCHAR(30) NOT NULL, |
206 | 206 | MTP_content TEXT NOT NULL, |
207 | 207 | PRIMARY KEY (MTP_ID), |
208 | 208 | KEY GRP_ID (GRP_ID)"; |
209 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
210 | - $table_name = 'esp_message_template_group'; |
|
211 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
209 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
210 | + $table_name = 'esp_message_template_group'; |
|
211 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
212 | 212 | EVT_ID BIGINT(20) UNSIGNED DEFAULT NULL, |
213 | 213 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
214 | 214 | MTP_messenger VARCHAR(30) NOT NULL, |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | PRIMARY KEY (GRP_ID), |
221 | 221 | KEY EVT_ID (EVT_ID), |
222 | 222 | KEY MTP_user_id (MTP_user_id)"; |
223 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | - $table_name = 'esp_payment'; |
|
225 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
223 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | + $table_name = 'esp_payment'; |
|
225 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
226 | 226 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
227 | 227 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
228 | 228 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | PRIMARY KEY (PAY_ID), |
239 | 239 | KEY TXN_ID (TXN_ID), |
240 | 240 | KEY PAY_timestamp (PAY_timestamp)"; |
241 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
242 | - $table_name = "esp_ticket"; |
|
243 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
241 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
242 | + $table_name = "esp_ticket"; |
|
243 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
244 | 244 | TTM_ID INT(10) UNSIGNED NOT NULL, |
245 | 245 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
246 | 246 | TKT_description TEXT NOT NULL, |
@@ -259,28 +259,28 @@ discard block |
||
259 | 259 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
260 | 260 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
261 | 261 | PRIMARY KEY (TKT_ID)"; |
262 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
263 | - $table_name = "esp_ticket_price"; |
|
264 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
262 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
263 | + $table_name = "esp_ticket_price"; |
|
264 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
265 | 265 | TKT_ID INT(10) UNSIGNED NOT NULL, |
266 | 266 | PRC_ID INT(10) UNSIGNED NOT NULL, |
267 | 267 | PRIMARY KEY (TKP_ID)"; |
268 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | - $table_name = "esp_datetime_ticket"; |
|
270 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
268 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | + $table_name = "esp_datetime_ticket"; |
|
270 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
271 | 271 | DTT_ID INT(10) UNSIGNED NOT NULL, |
272 | 272 | TKT_ID INT(10) UNSIGNED NOT NULL, |
273 | 273 | PRIMARY KEY (DTK_ID)"; |
274 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | - $table_name = "esp_ticket_template"; |
|
276 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
274 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | + $table_name = "esp_ticket_template"; |
|
276 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
277 | 277 | TTM_name VARCHAR(45) NOT NULL, |
278 | 278 | TTM_description TEXT, |
279 | 279 | TTM_file VARCHAR(45), |
280 | 280 | PRIMARY KEY (TTM_ID)"; |
281 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
282 | - $table_name = "esp_price"; |
|
283 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
281 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
282 | + $table_name = "esp_price"; |
|
283 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
284 | 284 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
285 | 285 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
286 | 286 | PRC_name VARCHAR(245) NOT NULL, |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', |
292 | 292 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
293 | 293 | PRIMARY KEY (PRC_ID)"; |
294 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | - $table_name = "esp_price_type"; |
|
296 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
294 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | + $table_name = "esp_price_type"; |
|
296 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
297 | 297 | PRT_name VARCHAR(45) NOT NULL, |
298 | 298 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
299 | 299 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
302 | 302 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
303 | 303 | PRIMARY KEY (PRT_ID)"; |
304 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
305 | - $table_name = 'esp_question'; |
|
306 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
304 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
305 | + $table_name = 'esp_question'; |
|
306 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
307 | 307 | QST_display_text TEXT NOT NULL, |
308 | 308 | QST_admin_label VARCHAR(255) NOT NULL, |
309 | 309 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | QST_wp_user BIGINT UNSIGNED NULL, |
316 | 316 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
317 | 317 | PRIMARY KEY (QST_ID)'; |
318 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
320 | - $table_name = 'esp_question_group'; |
|
321 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
318 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
320 | + $table_name = 'esp_question_group'; |
|
321 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
322 | 322 | QSG_name VARCHAR(255) NOT NULL, |
323 | 323 | QSG_identifier VARCHAR(100) NOT NULL, |
324 | 324 | QSG_desc TEXT NULL, |
@@ -329,24 +329,24 @@ discard block |
||
329 | 329 | QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
330 | 330 | PRIMARY KEY (QSG_ID), |
331 | 331 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
332 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | - $table_name = 'esp_question_group_question'; |
|
334 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
332 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | + $table_name = 'esp_question_group_question'; |
|
334 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
335 | 335 | QSG_ID INT UNSIGNED NOT NULL, |
336 | 336 | QST_ID INT UNSIGNED NOT NULL, |
337 | 337 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
338 | 338 | PRIMARY KEY (QGQ_ID) "; |
339 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
340 | - $table_name = 'esp_question_option'; |
|
341 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
339 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
340 | + $table_name = 'esp_question_option'; |
|
341 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
342 | 342 | QSO_value VARCHAR(255) NOT NULL, |
343 | 343 | QSO_desc TEXT NOT NULL, |
344 | 344 | QST_ID INT UNSIGNED NOT NULL, |
345 | 345 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
346 | 346 | PRIMARY KEY (QSO_ID)"; |
347 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | - $table_name = 'esp_registration'; |
|
349 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
347 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | + $table_name = 'esp_registration'; |
|
349 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
350 | 350 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
351 | 351 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
352 | 352 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -369,25 +369,25 @@ discard block |
||
369 | 369 | KEY STS_ID (STS_ID), |
370 | 370 | KEY REG_url_link (REG_url_link), |
371 | 371 | KEY REG_code (REG_code)"; |
372 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
373 | - $table_name = 'esp_checkin'; |
|
374 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
372 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
373 | + $table_name = 'esp_checkin'; |
|
374 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
375 | 375 | REG_ID INT(10) UNSIGNED NOT NULL, |
376 | 376 | DTT_ID INT(10) UNSIGNED NOT NULL, |
377 | 377 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
378 | 378 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
379 | 379 | PRIMARY KEY (CHK_ID)"; |
380 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
381 | - $table_name = 'esp_state'; |
|
382 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
380 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
381 | + $table_name = 'esp_state'; |
|
382 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
383 | 383 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
384 | 384 | STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL, |
385 | 385 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
386 | 386 | STA_active TINYINT(1) DEFAULT '1', |
387 | 387 | PRIMARY KEY (STA_ID)"; |
388 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
389 | - $table_name = 'esp_status'; |
|
390 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
388 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
389 | + $table_name = 'esp_status'; |
|
390 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
391 | 391 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
392 | 392 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
393 | 393 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
396 | 396 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
397 | 397 | KEY STS_type (STS_type)"; |
398 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
399 | - $table_name = 'esp_transaction'; |
|
400 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
398 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
399 | + $table_name = 'esp_transaction'; |
|
400 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
401 | 401 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
402 | 402 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
403 | 403 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -407,9 +407,9 @@ discard block |
||
407 | 407 | PRIMARY KEY (TXN_ID), |
408 | 408 | KEY TXN_timestamp (TXN_timestamp), |
409 | 409 | KEY STS_ID (STS_ID)"; |
410 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
411 | - $table_name = 'esp_venue_meta'; |
|
412 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
410 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
411 | + $table_name = 'esp_venue_meta'; |
|
412 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
413 | 413 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
414 | 414 | VNU_address VARCHAR(255) DEFAULT NULL, |
415 | 415 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -427,38 +427,38 @@ discard block |
||
427 | 427 | PRIMARY KEY (VNUM_ID), |
428 | 428 | KEY STA_ID (STA_ID), |
429 | 429 | KEY CNT_ISO (CNT_ISO)"; |
430 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
431 | - $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
432 | - //setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
433 | - //(because many need to convert old string states to foreign keys into the states table) |
|
434 | - $script_with_defaults->insert_default_states(); |
|
435 | - $script_with_defaults->insert_default_countries(); |
|
436 | - //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
437 | - $script_with_defaults->insert_default_price_types(); |
|
438 | - $script_with_defaults->insert_default_prices(); |
|
439 | - $script_with_defaults->insert_default_tickets(); |
|
440 | - //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
441 | - EE_Config::instance()->update_espresso_config(false, true); |
|
442 | - return true; |
|
443 | - } |
|
444 | - |
|
445 | - |
|
446 | - |
|
447 | - /** |
|
448 | - * We COULD clean up the esp_question.QST_order field here. We'll leave it for now |
|
449 | - * |
|
450 | - * @return boolean |
|
451 | - */ |
|
452 | - public function schema_changes_after_migration() |
|
453 | - { |
|
454 | - return true; |
|
455 | - } |
|
456 | - |
|
457 | - |
|
458 | - |
|
459 | - public function migration_page_hooks() |
|
460 | - { |
|
461 | - } |
|
430 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
431 | + $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
432 | + //setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
433 | + //(because many need to convert old string states to foreign keys into the states table) |
|
434 | + $script_with_defaults->insert_default_states(); |
|
435 | + $script_with_defaults->insert_default_countries(); |
|
436 | + //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
437 | + $script_with_defaults->insert_default_price_types(); |
|
438 | + $script_with_defaults->insert_default_prices(); |
|
439 | + $script_with_defaults->insert_default_tickets(); |
|
440 | + //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
441 | + EE_Config::instance()->update_espresso_config(false, true); |
|
442 | + return true; |
|
443 | + } |
|
444 | + |
|
445 | + |
|
446 | + |
|
447 | + /** |
|
448 | + * We COULD clean up the esp_question.QST_order field here. We'll leave it for now |
|
449 | + * |
|
450 | + * @return boolean |
|
451 | + */ |
|
452 | + public function schema_changes_after_migration() |
|
453 | + { |
|
454 | + return true; |
|
455 | + } |
|
456 | + |
|
457 | + |
|
458 | + |
|
459 | + public function migration_page_hooks() |
|
460 | + { |
|
461 | + } |
|
462 | 462 | } |
463 | 463 | |
464 | 464 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | //unfortunately, this needs to be done upon INCLUSION of this file, |
13 | 13 | //instead of construction, because it only gets constructed on first page load |
14 | 14 | //(all other times it gets resurrected from a wordpress option) |
15 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*'); |
|
15 | +$stages = glob(EE_CORE.'data_migration_scripts/4_2_0_stages/*'); |
|
16 | 16 | $class_to_filepath = array(); |
17 | 17 | if ( ! empty($stages)) { |
18 | 18 | foreach ($stages as $filepath) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // echo "no version string provided: $version_string"; |
62 | 62 | //no version string provided... this must be pre 4.1 |
63 | 63 | //because since 4.1 we're |
64 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | 65 | } else { |
66 | 66 | // echo "$version_string doesnt apply"; |
67 | 67 | return false; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function schema_changes_before_migration() |
81 | 81 | { |
82 | 82 | //relies on 4.1's EEH_Activation::create_table |
83 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
83 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
84 | 84 | $table_name = 'esp_answer'; |
85 | 85 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
86 | 86 | REG_ID INT UNSIGNED NOT NULL, |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | $stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | 16 | if ( ! empty($stages)) { |
17 | - foreach ($stages as $filepath) { |
|
18 | - $matches = array(); |
|
19 | - preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | - $class_to_filepath[$matches[1]] = $filepath; |
|
21 | - } |
|
17 | + foreach ($stages as $filepath) { |
|
18 | + $matches = array(); |
|
19 | + preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | + $class_to_filepath[$matches[1]] = $filepath; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | //give addons a chance to autoload their stages too |
24 | 24 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath); |
@@ -31,64 +31,64 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * EE_DMS_Core_4_3_0 constructor. |
|
36 | - * |
|
37 | - * @param TableManager $table_manager |
|
38 | - * @param TableAnalysis $table_analysis |
|
39 | - */ |
|
40 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | - { |
|
42 | - $this->_pretty_name = __("Data Migration to Event Espresso 4.3.0.P", "event_espresso"); |
|
43 | - $this->_priority = 10; |
|
44 | - $this->_migration_stages = array( |
|
45 | - new EE_DMS_4_3_0_question_option_order(), |
|
46 | - new EE_DMS_4_3_0_event_message_templates(), |
|
47 | - new EE_DMS_4_3_0_critical_page_shortcode_tracking(), |
|
48 | - ); |
|
49 | - parent::__construct($table_manager, $table_analysis); |
|
50 | - } |
|
34 | + /** |
|
35 | + * EE_DMS_Core_4_3_0 constructor. |
|
36 | + * |
|
37 | + * @param TableManager $table_manager |
|
38 | + * @param TableAnalysis $table_analysis |
|
39 | + */ |
|
40 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | + { |
|
42 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.3.0.P", "event_espresso"); |
|
43 | + $this->_priority = 10; |
|
44 | + $this->_migration_stages = array( |
|
45 | + new EE_DMS_4_3_0_question_option_order(), |
|
46 | + new EE_DMS_4_3_0_event_message_templates(), |
|
47 | + new EE_DMS_4_3_0_critical_page_shortcode_tracking(), |
|
48 | + ); |
|
49 | + parent::__construct($table_manager, $table_analysis); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - public function can_migrate_from_version($version_array) |
|
55 | - { |
|
56 | - $version_string = $version_array['Core']; |
|
57 | - if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) { |
|
54 | + public function can_migrate_from_version($version_array) |
|
55 | + { |
|
56 | + $version_string = $version_array['Core']; |
|
57 | + if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) { |
|
58 | 58 | // echo "$version_string can be migrated fro"; |
59 | - return true; |
|
60 | - } elseif ( ! $version_string) { |
|
59 | + return true; |
|
60 | + } elseif ( ! $version_string) { |
|
61 | 61 | // echo "no version string provided: $version_string"; |
62 | - //no version string provided... this must be pre 4.2 |
|
63 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | - } else { |
|
62 | + //no version string provided... this must be pre 4.2 |
|
63 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | + } else { |
|
65 | 65 | // echo "$version_string doesnt apply"; |
66 | - return false; |
|
67 | - } |
|
68 | - } |
|
66 | + return false; |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | 71 | |
72 | - public function pretty_name() |
|
73 | - { |
|
74 | - return __("Core Data Migration to version 4.3.0", "event_espresso"); |
|
75 | - } |
|
72 | + public function pretty_name() |
|
73 | + { |
|
74 | + return __("Core Data Migration to version 4.3.0", "event_espresso"); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | 78 | |
79 | - public function schema_changes_before_migration() |
|
80 | - { |
|
81 | - //relies on 4.1's EEH_Activation::create_table |
|
82 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
83 | - $table_name = 'esp_answer'; |
|
84 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
79 | + public function schema_changes_before_migration() |
|
80 | + { |
|
81 | + //relies on 4.1's EEH_Activation::create_table |
|
82 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
83 | + $table_name = 'esp_answer'; |
|
84 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
85 | 85 | REG_ID INT UNSIGNED NOT NULL, |
86 | 86 | QST_ID INT UNSIGNED NOT NULL, |
87 | 87 | ANS_value TEXT NOT NULL, |
88 | 88 | PRIMARY KEY (ANS_ID)"; |
89 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
90 | - $table_name = 'esp_attendee_meta'; |
|
91 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
89 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
90 | + $table_name = 'esp_attendee_meta'; |
|
91 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
92 | 92 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
93 | 93 | ATT_fname VARCHAR(45) NOT NULL, |
94 | 94 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | KEY ATT_fname (ATT_fname), |
105 | 105 | KEY ATT_lname (ATT_lname), |
106 | 106 | KEY ATT_email (ATT_email)"; |
107 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
108 | - $table_name = 'esp_country'; |
|
109 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
107 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
108 | + $table_name = 'esp_country'; |
|
109 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
110 | 110 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
111 | 111 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
112 | 112 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | CNT_is_EU TINYINT(1) DEFAULT '0', |
123 | 123 | CNT_active TINYINT(1) DEFAULT '0', |
124 | 124 | PRIMARY KEY (CNT_ISO)"; |
125 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
126 | - $table_name = 'esp_datetime'; |
|
127 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
125 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
126 | + $table_name = 'esp_datetime'; |
|
127 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
128 | 128 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
129 | 129 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
130 | 130 | DTT_description TEXT NOT NULL, |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | PRIMARY KEY (DTT_ID), |
140 | 140 | KEY EVT_ID (EVT_ID), |
141 | 141 | KEY DTT_is_primary (DTT_is_primary)"; |
142 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | - $table_name = 'esp_event_meta'; |
|
144 | - $sql = " |
|
142 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | + $table_name = 'esp_event_meta'; |
|
144 | + $sql = " |
|
145 | 145 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
146 | 146 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
147 | 147 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -156,31 +156,31 @@ discard block |
||
156 | 156 | EVT_external_URL VARCHAR(200) NULL, |
157 | 157 | EVT_donations TINYINT(1) NULL, |
158 | 158 | PRIMARY KEY (EVTM_ID)"; |
159 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
160 | - $table_name = 'esp_event_question_group'; |
|
161 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
159 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
160 | + $table_name = 'esp_event_question_group'; |
|
161 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
162 | 162 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
163 | 163 | QSG_ID INT UNSIGNED NOT NULL, |
164 | 164 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
165 | 165 | PRIMARY KEY (EQG_ID)"; |
166 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | - $table_name = 'esp_event_venue'; |
|
168 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
166 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | + $table_name = 'esp_event_venue'; |
|
168 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
169 | 169 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
170 | 170 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
171 | 171 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
172 | 172 | PRIMARY KEY (EVV_ID)"; |
173 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
174 | - $table_name = 'esp_extra_meta'; |
|
175 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
173 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
174 | + $table_name = 'esp_extra_meta'; |
|
175 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
176 | 176 | OBJ_ID INT(11) DEFAULT NULL, |
177 | 177 | EXM_type VARCHAR(45) DEFAULT NULL, |
178 | 178 | EXM_key VARCHAR(45) DEFAULT NULL, |
179 | 179 | EXM_value TEXT, |
180 | 180 | PRIMARY KEY (EXM_ID)"; |
181 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
182 | - $table_name = 'esp_line_item'; |
|
183 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
181 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
182 | + $table_name = 'esp_line_item'; |
|
183 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
184 | 184 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
185 | 185 | TXN_ID INT(11) DEFAULT NULL, |
186 | 186 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -196,19 +196,19 @@ discard block |
||
196 | 196 | OBJ_ID INT(11) DEFAULT NULL, |
197 | 197 | OBJ_type VARCHAR(45)DEFAULT NULL, |
198 | 198 | PRIMARY KEY (LIN_ID)"; |
199 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
200 | - $table_name = 'esp_message_template'; |
|
201 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
199 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
200 | + $table_name = 'esp_message_template'; |
|
201 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
202 | 202 | GRP_ID INT(10) UNSIGNED NOT NULL, |
203 | 203 | MTP_context VARCHAR(50) NOT NULL, |
204 | 204 | MTP_template_field VARCHAR(30) NOT NULL, |
205 | 205 | MTP_content TEXT NOT NULL, |
206 | 206 | PRIMARY KEY (MTP_ID), |
207 | 207 | KEY GRP_ID (GRP_ID)"; |
208 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
210 | - $table_name = 'esp_message_template_group'; |
|
211 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
208 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
210 | + $table_name = 'esp_message_template_group'; |
|
211 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
212 | 212 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
213 | 213 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
214 | 214 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -220,17 +220,17 @@ discard block |
||
220 | 220 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
221 | 221 | PRIMARY KEY (GRP_ID), |
222 | 222 | KEY MTP_user_id (MTP_user_id)"; |
223 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | - $table_name = 'esp_event_message_template'; |
|
225 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
223 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | + $table_name = 'esp_event_message_template'; |
|
225 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
226 | 226 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
227 | 227 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
228 | 228 | PRIMARY KEY (EMT_ID), |
229 | 229 | KEY EVT_ID (EVT_ID), |
230 | 230 | KEY GRP_ID (GRP_ID)"; |
231 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
232 | - $table_name = 'esp_payment'; |
|
233 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
231 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
232 | + $table_name = 'esp_payment'; |
|
233 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
234 | 234 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
235 | 235 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
236 | 236 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | PRIMARY KEY (PAY_ID), |
247 | 247 | KEY TXN_ID (TXN_ID), |
248 | 248 | KEY PAY_timestamp (PAY_timestamp)"; |
249 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
250 | - $table_name = "esp_ticket"; |
|
251 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
249 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
250 | + $table_name = "esp_ticket"; |
|
251 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
252 | 252 | TTM_ID INT(10) UNSIGNED NOT NULL, |
253 | 253 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
254 | 254 | TKT_description TEXT NOT NULL, |
@@ -268,28 +268,28 @@ discard block |
||
268 | 268 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
269 | 269 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
270 | 270 | PRIMARY KEY (TKT_ID)"; |
271 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | - $table_name = "esp_ticket_price"; |
|
273 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
271 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | + $table_name = "esp_ticket_price"; |
|
273 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
274 | 274 | TKT_ID INT(10) UNSIGNED NOT NULL, |
275 | 275 | PRC_ID INT(10) UNSIGNED NOT NULL, |
276 | 276 | PRIMARY KEY (TKP_ID)"; |
277 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | - $table_name = "esp_datetime_ticket"; |
|
279 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
277 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | + $table_name = "esp_datetime_ticket"; |
|
279 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
280 | 280 | DTT_ID INT(10) UNSIGNED NOT NULL, |
281 | 281 | TKT_ID INT(10) UNSIGNED NOT NULL, |
282 | 282 | PRIMARY KEY (DTK_ID)"; |
283 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
284 | - $table_name = "esp_ticket_template"; |
|
285 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
283 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
284 | + $table_name = "esp_ticket_template"; |
|
285 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
286 | 286 | TTM_name VARCHAR(45) NOT NULL, |
287 | 287 | TTM_description TEXT, |
288 | 288 | TTM_file VARCHAR(45), |
289 | 289 | PRIMARY KEY (TTM_ID)"; |
290 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | - $table_name = "esp_price"; |
|
292 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
290 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | + $table_name = "esp_price"; |
|
292 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
293 | 293 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
294 | 294 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
295 | 295 | PRC_name VARCHAR(245) NOT NULL, |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', |
301 | 301 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
302 | 302 | PRIMARY KEY (PRC_ID)"; |
303 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
304 | - $table_name = "esp_price_type"; |
|
305 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
303 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
304 | + $table_name = "esp_price_type"; |
|
305 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
306 | 306 | PRT_name VARCHAR(45) NOT NULL, |
307 | 307 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
308 | 308 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
311 | 311 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
312 | 312 | PRIMARY KEY (PRT_ID)"; |
313 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
314 | - $table_name = 'esp_question'; |
|
315 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
313 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
314 | + $table_name = 'esp_question'; |
|
315 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
316 | 316 | QST_display_text TEXT NOT NULL, |
317 | 317 | QST_admin_label VARCHAR(255) NOT NULL, |
318 | 318 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | QST_wp_user BIGINT UNSIGNED NULL, |
325 | 325 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
326 | 326 | PRIMARY KEY (QST_ID)'; |
327 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
328 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
329 | - $table_name = 'esp_question_group'; |
|
330 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
327 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
328 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
329 | + $table_name = 'esp_question_group'; |
|
330 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
331 | 331 | QSG_name VARCHAR(255) NOT NULL, |
332 | 332 | QSG_identifier VARCHAR(100) NOT NULL, |
333 | 333 | QSG_desc TEXT NULL, |
@@ -338,25 +338,25 @@ discard block |
||
338 | 338 | QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
339 | 339 | PRIMARY KEY (QSG_ID), |
340 | 340 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
341 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | - $table_name = 'esp_question_group_question'; |
|
343 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
341 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | + $table_name = 'esp_question_group_question'; |
|
343 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
344 | 344 | QSG_ID INT UNSIGNED NOT NULL, |
345 | 345 | QST_ID INT UNSIGNED NOT NULL, |
346 | 346 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
347 | 347 | PRIMARY KEY (QGQ_ID) "; |
348 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
349 | - $table_name = 'esp_question_option'; |
|
350 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
348 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
349 | + $table_name = 'esp_question_option'; |
|
350 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
351 | 351 | QSO_value VARCHAR(255) NOT NULL, |
352 | 352 | QSO_desc TEXT NOT NULL, |
353 | 353 | QST_ID INT UNSIGNED NOT NULL, |
354 | 354 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
355 | 355 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
356 | 356 | PRIMARY KEY (QSO_ID)"; |
357 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | - $table_name = 'esp_registration'; |
|
359 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
357 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | + $table_name = 'esp_registration'; |
|
359 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
360 | 360 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
361 | 361 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
362 | 362 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -379,25 +379,25 @@ discard block |
||
379 | 379 | KEY STS_ID (STS_ID), |
380 | 380 | KEY REG_url_link (REG_url_link), |
381 | 381 | KEY REG_code (REG_code)"; |
382 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
383 | - $table_name = 'esp_checkin'; |
|
384 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
382 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
383 | + $table_name = 'esp_checkin'; |
|
384 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
385 | 385 | REG_ID INT(10) UNSIGNED NOT NULL, |
386 | 386 | DTT_ID INT(10) UNSIGNED NOT NULL, |
387 | 387 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
388 | 388 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
389 | 389 | PRIMARY KEY (CHK_ID)"; |
390 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
391 | - $table_name = 'esp_state'; |
|
392 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
390 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
391 | + $table_name = 'esp_state'; |
|
392 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
393 | 393 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
394 | 394 | STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL, |
395 | 395 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
396 | 396 | STA_active TINYINT(1) DEFAULT '1', |
397 | 397 | PRIMARY KEY (STA_ID)"; |
398 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
399 | - $table_name = 'esp_status'; |
|
400 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
398 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
399 | + $table_name = 'esp_status'; |
|
400 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
401 | 401 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
402 | 402 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
403 | 403 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
406 | 406 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
407 | 407 | KEY STS_type (STS_type)"; |
408 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
409 | - $table_name = 'esp_transaction'; |
|
410 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
408 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
409 | + $table_name = 'esp_transaction'; |
|
410 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
411 | 411 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
412 | 412 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
413 | 413 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | PRIMARY KEY (TXN_ID), |
418 | 418 | KEY TXN_timestamp (TXN_timestamp), |
419 | 419 | KEY STS_ID (STS_ID)"; |
420 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
421 | - $table_name = 'esp_venue_meta'; |
|
422 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
420 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
421 | + $table_name = 'esp_venue_meta'; |
|
422 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
423 | 423 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
424 | 424 | VNU_address VARCHAR(255) DEFAULT NULL, |
425 | 425 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -437,79 +437,79 @@ discard block |
||
437 | 437 | PRIMARY KEY (VNUM_ID), |
438 | 438 | KEY STA_ID (STA_ID), |
439 | 439 | KEY CNT_ISO (CNT_ISO)"; |
440 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
441 | - $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
442 | - //setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
443 | - //(because many need to convert old string states to foreign keys into the states table) |
|
444 | - $script_with_defaults->insert_default_states(); |
|
445 | - $script_with_defaults->insert_default_countries(); |
|
446 | - //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
447 | - $script_with_defaults->insert_default_price_types(); |
|
448 | - $script_with_defaults->insert_default_prices(); |
|
449 | - //but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's |
|
450 | - $this->insert_default_tickets(); |
|
451 | - //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
452 | - EE_Config::instance()->update_espresso_config(false, true); |
|
453 | - return true; |
|
454 | - } |
|
455 | - |
|
456 | - |
|
457 | - |
|
458 | - /** |
|
459 | - * @return boolean |
|
460 | - */ |
|
461 | - public function schema_changes_after_migration() |
|
462 | - { |
|
463 | - return true; |
|
464 | - } |
|
465 | - |
|
466 | - |
|
467 | - |
|
468 | - public function migration_page_hooks() |
|
469 | - { |
|
470 | - } |
|
471 | - |
|
472 | - |
|
473 | - |
|
474 | - /** |
|
475 | - * insert DEFAULT ticket |
|
476 | - * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field |
|
477 | - * |
|
478 | - * @access public |
|
479 | - * @static |
|
480 | - * @return void |
|
481 | - */ |
|
482 | - public function insert_default_tickets() |
|
483 | - { |
|
484 | - global $wpdb; |
|
485 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
486 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
487 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
488 | - $tickets_exist = $wpdb->get_var($SQL); |
|
489 | - if ( ! $tickets_exist) { |
|
490 | - $SQL = "INSERT INTO $ticket_table |
|
440 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
441 | + $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
442 | + //setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
443 | + //(because many need to convert old string states to foreign keys into the states table) |
|
444 | + $script_with_defaults->insert_default_states(); |
|
445 | + $script_with_defaults->insert_default_countries(); |
|
446 | + //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
447 | + $script_with_defaults->insert_default_price_types(); |
|
448 | + $script_with_defaults->insert_default_prices(); |
|
449 | + //but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's |
|
450 | + $this->insert_default_tickets(); |
|
451 | + //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
452 | + EE_Config::instance()->update_espresso_config(false, true); |
|
453 | + return true; |
|
454 | + } |
|
455 | + |
|
456 | + |
|
457 | + |
|
458 | + /** |
|
459 | + * @return boolean |
|
460 | + */ |
|
461 | + public function schema_changes_after_migration() |
|
462 | + { |
|
463 | + return true; |
|
464 | + } |
|
465 | + |
|
466 | + |
|
467 | + |
|
468 | + public function migration_page_hooks() |
|
469 | + { |
|
470 | + } |
|
471 | + |
|
472 | + |
|
473 | + |
|
474 | + /** |
|
475 | + * insert DEFAULT ticket |
|
476 | + * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field |
|
477 | + * |
|
478 | + * @access public |
|
479 | + * @static |
|
480 | + * @return void |
|
481 | + */ |
|
482 | + public function insert_default_tickets() |
|
483 | + { |
|
484 | + global $wpdb; |
|
485 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
486 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
487 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
488 | + $tickets_exist = $wpdb->get_var($SQL); |
|
489 | + if ( ! $tickets_exist) { |
|
490 | + $SQL = "INSERT INTO $ticket_table |
|
491 | 491 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES |
492 | 492 | ( 1, 0, '" |
493 | - . __("Free Ticket", "event_espresso") |
|
494 | - . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
495 | - $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
496 | - $wpdb->query($SQL); |
|
497 | - } |
|
498 | - } |
|
499 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
500 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
501 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
502 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
503 | - if ( ! $ticket_prc_exist) { |
|
504 | - $SQL = "INSERT INTO $ticket_price_table |
|
493 | + . __("Free Ticket", "event_espresso") |
|
494 | + . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
495 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
496 | + $wpdb->query($SQL); |
|
497 | + } |
|
498 | + } |
|
499 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
500 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
501 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
502 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
503 | + if ( ! $ticket_prc_exist) { |
|
504 | + $SQL = "INSERT INTO $ticket_price_table |
|
505 | 505 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
506 | 506 | ( 1, 1, 1 ) |
507 | 507 | "; |
508 | - $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
509 | - $wpdb->query($SQL); |
|
510 | - } |
|
511 | - } |
|
512 | - } |
|
508 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
509 | + $wpdb->query($SQL); |
|
510 | + } |
|
511 | + } |
|
512 | + } |
|
513 | 513 | |
514 | 514 | } |
515 | 515 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | //unfortunately, this needs to be done upon INCLUSION of this file, |
12 | 12 | //instead of construction, because it only gets constructed on first page load |
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*'); |
|
14 | +$stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*'); |
|
15 | 15 | $class_to_filepath = array(); |
16 | 16 | if ( ! empty($stages)) { |
17 | 17 | foreach ($stages as $filepath) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } elseif ( ! $version_string) { |
61 | 61 | // echo "no version string provided: $version_string"; |
62 | 62 | //no version string provided... this must be pre 4.2 |
63 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
63 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | 64 | } else { |
65 | 65 | // echo "$version_string doesnt apply"; |
66 | 66 | return false; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function schema_changes_before_migration() |
80 | 80 | { |
81 | 81 | //relies on 4.1's EEH_Activation::create_table |
82 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
82 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
83 | 83 | $table_name = 'esp_answer'; |
84 | 84 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
85 | 85 | REG_ID INT UNSIGNED NOT NULL, |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | public function insert_default_tickets() |
483 | 483 | { |
484 | 484 | global $wpdb; |
485 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
485 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
486 | 486 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
487 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
487 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
488 | 488 | $tickets_exist = $wpdb->get_var($SQL); |
489 | 489 | if ( ! $tickets_exist) { |
490 | 490 | $SQL = "INSERT INTO $ticket_table |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | $wpdb->query($SQL); |
497 | 497 | } |
498 | 498 | } |
499 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
499 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
500 | 500 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
501 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
501 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
502 | 502 | $ticket_prc_exist = $wpdb->get_var($SQL); |
503 | 503 | if ( ! $ticket_prc_exist) { |
504 | 504 | $SQL = "INSERT INTO $ticket_price_table |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | 16 | foreach ($stages as $filepath) { |
17 | - $matches = array(); |
|
18 | - preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | - $class_to_filepath[$matches[1]] = $filepath; |
|
17 | + $matches = array(); |
|
18 | + preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | + $class_to_filepath[$matches[1]] = $filepath; |
|
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | 22 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
@@ -35,80 +35,80 @@ discard block |
||
35 | 35 | class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base |
36 | 36 | { |
37 | 37 | |
38 | - /** |
|
39 | - * return EE_DMS_Core_4_6_0 |
|
40 | - * |
|
41 | - * @param TableManager $table_manager |
|
42 | - * @param TableAnalysis $table_analysis |
|
43 | - */ |
|
44 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
45 | - { |
|
46 | - $this->_pretty_name = __("Data Migration to Event Espresso 4.6.0.P", "event_espresso"); |
|
47 | - $this->_priority = 10; |
|
48 | - $this->_migration_stages = array( |
|
49 | - new EE_DMS_4_6_0_gateways(), |
|
50 | - new EE_DMS_4_6_0_payment_method_currencies(), |
|
51 | - new EE_DMS_4_6_0_question_types(), |
|
52 | - new EE_DMS_4_6_0_country_system_question(), |
|
53 | - new EE_DMS_4_6_0_state_system_question(), |
|
54 | - new EE_DMS_4_6_0_billing_info(), |
|
55 | - new EE_DMS_4_6_0_transactions(), |
|
56 | - new EE_DMS_4_6_0_payments(), |
|
57 | - new EE_DMS_4_6_0_invoice_settings(), |
|
58 | - ); |
|
59 | - parent::__construct($table_manager, $table_analysis); |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @param array $version_array |
|
66 | - * @return bool |
|
67 | - */ |
|
68 | - public function can_migrate_from_version($version_array) |
|
69 | - { |
|
70 | - $version_string = $version_array['Core']; |
|
71 | - if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) { |
|
38 | + /** |
|
39 | + * return EE_DMS_Core_4_6_0 |
|
40 | + * |
|
41 | + * @param TableManager $table_manager |
|
42 | + * @param TableAnalysis $table_analysis |
|
43 | + */ |
|
44 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
45 | + { |
|
46 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.6.0.P", "event_espresso"); |
|
47 | + $this->_priority = 10; |
|
48 | + $this->_migration_stages = array( |
|
49 | + new EE_DMS_4_6_0_gateways(), |
|
50 | + new EE_DMS_4_6_0_payment_method_currencies(), |
|
51 | + new EE_DMS_4_6_0_question_types(), |
|
52 | + new EE_DMS_4_6_0_country_system_question(), |
|
53 | + new EE_DMS_4_6_0_state_system_question(), |
|
54 | + new EE_DMS_4_6_0_billing_info(), |
|
55 | + new EE_DMS_4_6_0_transactions(), |
|
56 | + new EE_DMS_4_6_0_payments(), |
|
57 | + new EE_DMS_4_6_0_invoice_settings(), |
|
58 | + ); |
|
59 | + parent::__construct($table_manager, $table_analysis); |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @param array $version_array |
|
66 | + * @return bool |
|
67 | + */ |
|
68 | + public function can_migrate_from_version($version_array) |
|
69 | + { |
|
70 | + $version_string = $version_array['Core']; |
|
71 | + if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) { |
|
72 | 72 | // echo "$version_string can be migrated from"; |
73 | - return true; |
|
74 | - } elseif ( ! $version_string) { |
|
73 | + return true; |
|
74 | + } elseif ( ! $version_string) { |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | - //no version string provided... this must be pre 4.3 |
|
77 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | - } else { |
|
76 | + //no version string provided... this must be pre 4.3 |
|
77 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + } else { |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | - return false; |
|
81 | - } |
|
82 | - } |
|
80 | + return false; |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @return string|void |
|
88 | - */ |
|
89 | - public function pretty_name() |
|
90 | - { |
|
91 | - return __("Core Data Migration to version 4.6.0", "event_espresso"); |
|
92 | - } |
|
86 | + /** |
|
87 | + * @return string|void |
|
88 | + */ |
|
89 | + public function pretty_name() |
|
90 | + { |
|
91 | + return __("Core Data Migration to version 4.6.0", "event_espresso"); |
|
92 | + } |
|
93 | 93 | |
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function schema_changes_before_migration() |
|
100 | - { |
|
101 | - //relies on 4.1's EEH_Activation::create_table |
|
102 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
103 | - $table_name = 'esp_answer'; |
|
104 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
96 | + /** |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function schema_changes_before_migration() |
|
100 | + { |
|
101 | + //relies on 4.1's EEH_Activation::create_table |
|
102 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
103 | + $table_name = 'esp_answer'; |
|
104 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
105 | 105 | REG_ID INT UNSIGNED NOT NULL, |
106 | 106 | QST_ID INT UNSIGNED NOT NULL, |
107 | 107 | ANS_value TEXT NOT NULL, |
108 | 108 | PRIMARY KEY (ANS_ID)"; |
109 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
110 | - $table_name = 'esp_attendee_meta'; |
|
111 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
109 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
110 | + $table_name = 'esp_attendee_meta'; |
|
111 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
112 | 112 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
113 | 113 | ATT_fname VARCHAR(45) NOT NULL, |
114 | 114 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | KEY ATT_fname (ATT_fname), |
125 | 125 | KEY ATT_lname (ATT_lname), |
126 | 126 | KEY ATT_email (ATT_email)"; |
127 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
128 | - $table_name = 'esp_country'; |
|
129 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
127 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
128 | + $table_name = 'esp_country'; |
|
129 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
130 | 130 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
131 | 131 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
132 | 132 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -142,24 +142,24 @@ discard block |
||
142 | 142 | CNT_is_EU TINYINT(1) DEFAULT '0', |
143 | 143 | CNT_active TINYINT(1) DEFAULT '0', |
144 | 144 | PRIMARY KEY (CNT_ISO)"; |
145 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | - $table_name = 'esp_currency'; |
|
147 | - $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
145 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | + $table_name = 'esp_currency'; |
|
147 | + $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
148 | 148 | CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar', |
149 | 149 | CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars', |
150 | 150 | CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$', |
151 | 151 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
152 | 152 | CUR_active TINYINT(1) DEFAULT '0', |
153 | 153 | PRIMARY KEY (CUR_code)"; |
154 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | - $table_name = 'esp_currency_payment_method'; |
|
156 | - $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | + $table_name = 'esp_currency_payment_method'; |
|
156 | + $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
157 | 157 | CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
158 | 158 | PMD_ID INT(11) NOT NULL, |
159 | 159 | PRIMARY KEY (CPM_ID)"; |
160 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
161 | - $table_name = 'esp_datetime'; |
|
162 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
160 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
161 | + $table_name = 'esp_datetime'; |
|
162 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
163 | 163 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
164 | 164 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
165 | 165 | DTT_description TEXT NOT NULL, |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | PRIMARY KEY (DTT_ID), |
175 | 175 | KEY EVT_ID (EVT_ID), |
176 | 176 | KEY DTT_is_primary (DTT_is_primary)"; |
177 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
178 | - $table_name = 'esp_event_meta'; |
|
179 | - $sql = " |
|
177 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
178 | + $table_name = 'esp_event_meta'; |
|
179 | + $sql = " |
|
180 | 180 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
181 | 181 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
182 | 182 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -191,31 +191,31 @@ discard block |
||
191 | 191 | EVT_external_URL VARCHAR(200) NULL, |
192 | 192 | EVT_donations TINYINT(1) NULL, |
193 | 193 | PRIMARY KEY (EVTM_ID)"; |
194 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | - $table_name = 'esp_event_question_group'; |
|
196 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
194 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
195 | + $table_name = 'esp_event_question_group'; |
|
196 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
197 | 197 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
198 | 198 | QSG_ID INT UNSIGNED NOT NULL, |
199 | 199 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
200 | 200 | PRIMARY KEY (EQG_ID)"; |
201 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | - $table_name = 'esp_event_venue'; |
|
203 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
201 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $table_name = 'esp_event_venue'; |
|
203 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
204 | 204 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
205 | 205 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
206 | 206 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
207 | 207 | PRIMARY KEY (EVV_ID)"; |
208 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | - $table_name = 'esp_extra_meta'; |
|
210 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
208 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | + $table_name = 'esp_extra_meta'; |
|
210 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
211 | 211 | OBJ_ID INT(11) DEFAULT NULL, |
212 | 212 | EXM_type VARCHAR(45) DEFAULT NULL, |
213 | 213 | EXM_key VARCHAR(45) DEFAULT NULL, |
214 | 214 | EXM_value TEXT, |
215 | 215 | PRIMARY KEY (EXM_ID)"; |
216 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | - $table_name = 'esp_line_item'; |
|
218 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
216 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | + $table_name = 'esp_line_item'; |
|
218 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
219 | 219 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
220 | 220 | TXN_ID INT(11) DEFAULT NULL, |
221 | 221 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | OBJ_ID INT(11) DEFAULT NULL, |
232 | 232 | OBJ_type VARCHAR(45)DEFAULT NULL, |
233 | 233 | PRIMARY KEY (LIN_ID)"; |
234 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
235 | - $table_name = 'esp_log'; |
|
236 | - $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
234 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
235 | + $table_name = 'esp_log'; |
|
236 | + $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
237 | 237 | LOG_time DATETIME DEFAULT NULL, |
238 | 238 | OBJ_ID VARCHAR(45) DEFAULT NULL, |
239 | 239 | OBJ_type VARCHAR(45) DEFAULT NULL, |
@@ -241,19 +241,19 @@ discard block |
||
241 | 241 | LOG_message TEXT, |
242 | 242 | LOG_wp_user INT(11) DEFAULT NULL, |
243 | 243 | PRIMARY KEY (LOG_ID)"; |
244 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
245 | - $table_name = 'esp_message_template'; |
|
246 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
244 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
245 | + $table_name = 'esp_message_template'; |
|
246 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
247 | 247 | GRP_ID INT(10) UNSIGNED NOT NULL, |
248 | 248 | MTP_context VARCHAR(50) NOT NULL, |
249 | 249 | MTP_template_field VARCHAR(30) NOT NULL, |
250 | 250 | MTP_content TEXT NOT NULL, |
251 | 251 | PRIMARY KEY (MTP_ID), |
252 | 252 | KEY GRP_ID (GRP_ID)"; |
253 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
254 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
255 | - $table_name = 'esp_message_template_group'; |
|
256 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
253 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
254 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
255 | + $table_name = 'esp_message_template_group'; |
|
256 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
257 | 257 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
258 | 258 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
259 | 259 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -265,17 +265,17 @@ discard block |
||
265 | 265 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
266 | 266 | PRIMARY KEY (GRP_ID), |
267 | 267 | KEY MTP_user_id (MTP_user_id)"; |
268 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | - $table_name = 'esp_event_message_template'; |
|
270 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
268 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | + $table_name = 'esp_event_message_template'; |
|
270 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
271 | 271 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
272 | 272 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
273 | 273 | PRIMARY KEY (EMT_ID), |
274 | 274 | KEY EVT_ID (EVT_ID), |
275 | 275 | KEY GRP_ID (GRP_ID)"; |
276 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
277 | - $table_name = 'esp_payment'; |
|
278 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
276 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
277 | + $table_name = 'esp_payment'; |
|
278 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
279 | 279 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
280 | 280 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
281 | 281 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | PRIMARY KEY (PAY_ID), |
293 | 293 | KEY TXN_ID (TXN_ID), |
294 | 294 | KEY PAY_timestamp (PAY_timestamp)"; |
295 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
296 | - $table_name = 'esp_payment_method'; |
|
297 | - $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
295 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
296 | + $table_name = 'esp_payment_method'; |
|
297 | + $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
298 | 298 | PMD_type VARCHAR(124) DEFAULT NULL, |
299 | 299 | PMD_name VARCHAR(255) DEFAULT NULL, |
300 | 300 | PMD_desc TEXT, |
@@ -309,28 +309,28 @@ discard block |
||
309 | 309 | PMD_scope VARCHAR(255) NULL DEFAULT 'frontend', |
310 | 310 | PRIMARY KEY (PMD_ID), |
311 | 311 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)"; |
312 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
313 | - $table_name = "esp_ticket_price"; |
|
314 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
312 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
313 | + $table_name = "esp_ticket_price"; |
|
314 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
315 | 315 | TKT_ID INT(10) UNSIGNED NOT NULL, |
316 | 316 | PRC_ID INT(10) UNSIGNED NOT NULL, |
317 | 317 | PRIMARY KEY (TKP_ID)"; |
318 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | - $table_name = "esp_datetime_ticket"; |
|
320 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
318 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | + $table_name = "esp_datetime_ticket"; |
|
320 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
321 | 321 | DTT_ID INT(10) UNSIGNED NOT NULL, |
322 | 322 | TKT_ID INT(10) UNSIGNED NOT NULL, |
323 | 323 | PRIMARY KEY (DTK_ID)"; |
324 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | - $table_name = "esp_ticket_template"; |
|
326 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
324 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | + $table_name = "esp_ticket_template"; |
|
326 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
327 | 327 | TTM_name VARCHAR(45) NOT NULL, |
328 | 328 | TTM_description TEXT, |
329 | 329 | TTM_file VARCHAR(45), |
330 | 330 | PRIMARY KEY (TTM_ID)"; |
331 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
332 | - $table_name = 'esp_question'; |
|
333 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
331 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
332 | + $table_name = 'esp_question'; |
|
333 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
334 | 334 | QST_display_text TEXT NOT NULL, |
335 | 335 | QST_admin_label VARCHAR(255) NOT NULL, |
336 | 336 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -342,25 +342,25 @@ discard block |
||
342 | 342 | QST_wp_user BIGINT UNSIGNED NULL, |
343 | 343 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
344 | 344 | PRIMARY KEY (QST_ID)'; |
345 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
346 | - $table_name = 'esp_question_group_question'; |
|
347 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
345 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
346 | + $table_name = 'esp_question_group_question'; |
|
347 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
348 | 348 | QSG_ID INT UNSIGNED NOT NULL, |
349 | 349 | QST_ID INT UNSIGNED NOT NULL, |
350 | 350 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
351 | 351 | PRIMARY KEY (QGQ_ID) "; |
352 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
353 | - $table_name = 'esp_question_option'; |
|
354 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
352 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
353 | + $table_name = 'esp_question_option'; |
|
354 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
355 | 355 | QSO_value VARCHAR(255) NOT NULL, |
356 | 356 | QSO_desc TEXT NOT NULL, |
357 | 357 | QST_ID INT UNSIGNED NOT NULL, |
358 | 358 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
359 | 359 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
360 | 360 | PRIMARY KEY (QSO_ID)"; |
361 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
362 | - $table_name = 'esp_registration'; |
|
363 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
361 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
362 | + $table_name = 'esp_registration'; |
|
363 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
364 | 364 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
365 | 365 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
366 | 366 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -383,25 +383,25 @@ discard block |
||
383 | 383 | KEY STS_ID (STS_ID), |
384 | 384 | KEY REG_url_link (REG_url_link), |
385 | 385 | KEY REG_code (REG_code)"; |
386 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
387 | - $table_name = 'esp_checkin'; |
|
388 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
386 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
387 | + $table_name = 'esp_checkin'; |
|
388 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
389 | 389 | REG_ID INT(10) UNSIGNED NOT NULL, |
390 | 390 | DTT_ID INT(10) UNSIGNED NOT NULL, |
391 | 391 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
392 | 392 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
393 | 393 | PRIMARY KEY (CHK_ID)"; |
394 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
395 | - $table_name = 'esp_state'; |
|
396 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
394 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
395 | + $table_name = 'esp_state'; |
|
396 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
397 | 397 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
398 | 398 | STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL, |
399 | 399 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
400 | 400 | STA_active TINYINT(1) DEFAULT '1', |
401 | 401 | PRIMARY KEY (STA_ID)"; |
402 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
403 | - $table_name = 'esp_status'; |
|
404 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
402 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
403 | + $table_name = 'esp_status'; |
|
404 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
405 | 405 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
406 | 406 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
407 | 407 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
410 | 410 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
411 | 411 | KEY STS_type (STS_type)"; |
412 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
413 | - $table_name = 'esp_transaction'; |
|
414 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
412 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
413 | + $table_name = 'esp_transaction'; |
|
414 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
415 | 415 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
416 | 416 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
417 | 417 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | PRIMARY KEY (TXN_ID), |
424 | 424 | KEY TXN_timestamp (TXN_timestamp), |
425 | 425 | KEY STS_ID (STS_ID)"; |
426 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | - $table_name = 'esp_venue_meta'; |
|
428 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
426 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | + $table_name = 'esp_venue_meta'; |
|
428 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
429 | 429 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
430 | 430 | VNU_address VARCHAR(255) DEFAULT NULL, |
431 | 431 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | PRIMARY KEY (VNUM_ID), |
444 | 444 | KEY STA_ID (STA_ID), |
445 | 445 | KEY CNT_ISO (CNT_ISO)"; |
446 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
447 | - //modified tables |
|
448 | - $table_name = "esp_price"; |
|
449 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
446 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
447 | + //modified tables |
|
448 | + $table_name = "esp_price"; |
|
449 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
450 | 450 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
451 | 451 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
452 | 452 | PRC_name VARCHAR(245) NOT NULL, |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | PRC_wp_user BIGINT UNSIGNED NULL, |
459 | 459 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
460 | 460 | PRIMARY KEY (PRC_ID)"; |
461 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
462 | - $table_name = "esp_price_type"; |
|
463 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
461 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
462 | + $table_name = "esp_price_type"; |
|
463 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
464 | 464 | PRT_name VARCHAR(45) NOT NULL, |
465 | 465 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
466 | 466 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
470 | 470 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
471 | 471 | PRIMARY KEY (PRT_ID)"; |
472 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
473 | - $table_name = "esp_ticket"; |
|
474 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
472 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
473 | + $table_name = "esp_ticket"; |
|
474 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
475 | 475 | TTM_ID INT(10) UNSIGNED NOT NULL, |
476 | 476 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
477 | 477 | TKT_description TEXT NOT NULL, |
@@ -492,10 +492,10 @@ discard block |
||
492 | 492 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
493 | 493 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
494 | 494 | PRIMARY KEY (TKT_ID)"; |
495 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
496 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
497 | - $table_name = 'esp_question_group'; |
|
498 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
495 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
496 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
497 | + $table_name = 'esp_question_group'; |
|
498 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
499 | 499 | QSG_name VARCHAR(255) NOT NULL, |
500 | 500 | QSG_identifier VARCHAR(100) NOT NULL, |
501 | 501 | QSG_desc TEXT NULL, |
@@ -507,119 +507,119 @@ discard block |
||
507 | 507 | QSG_wp_user BIGINT UNSIGNED NULL, |
508 | 508 | PRIMARY KEY (QSG_ID), |
509 | 509 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
510 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
511 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
512 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
513 | - //(because many need to convert old string states to foreign keys into the states table) |
|
514 | - $script_4_1_defaults->insert_default_states(); |
|
515 | - $script_4_1_defaults->insert_default_countries(); |
|
516 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
517 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
518 | - $script_4_5_defaults->insert_default_price_types(); |
|
519 | - $script_4_5_defaults->insert_default_prices(); |
|
520 | - $script_4_5_defaults->insert_default_tickets(); |
|
521 | - //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
522 | - EE_Config::instance()->update_espresso_config(false, true); |
|
523 | - $this->add_default_admin_only_payments(); |
|
524 | - $this->insert_default_currencies(); |
|
525 | - return true; |
|
526 | - } |
|
527 | - |
|
528 | - |
|
529 | - |
|
530 | - /** |
|
531 | - * @return boolean |
|
532 | - */ |
|
533 | - public function schema_changes_after_migration() |
|
534 | - { |
|
535 | - return true; |
|
536 | - } |
|
537 | - |
|
538 | - |
|
539 | - |
|
540 | - public function migration_page_hooks() |
|
541 | - { |
|
542 | - } |
|
543 | - |
|
544 | - |
|
545 | - |
|
546 | - public function add_default_admin_only_payments() |
|
547 | - { |
|
548 | - global $wpdb; |
|
549 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
550 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
551 | - if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
552 | - $SQL = "SELECT COUNT( * ) FROM $table_name"; |
|
553 | - $existing_payment_methods = $wpdb->get_var($SQL); |
|
554 | - $default_admin_only_payment_methods = apply_filters( |
|
555 | - 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
556 | - array( |
|
557 | - __("Bank", 'event_espresso') => __("Bank Draft", 'event_espresso'), |
|
558 | - __("Cash", 'event_espresso') => __("Cash Delivered Physically", 'event_espresso'), |
|
559 | - __("Check", 'event_espresso') => __("Paper Check", 'event_espresso'), |
|
560 | - __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'), |
|
561 | - __("Debit Card", 'event_espresso') => __("Offline Debit Payment", 'event_espresso'), |
|
562 | - __("Invoice", 'event_espresso') => __("Invoice received with monies included", |
|
563 | - 'event_espresso'), |
|
564 | - __("Money Order", 'event_espresso') => '', |
|
565 | - __("Paypal", 'event_espresso') => __("Paypal eCheck, Invoice, etc", 'event_espresso'), |
|
566 | - __('Other', 'event_espresso') => __('Other method of payment', 'event_espresso'), |
|
567 | - )); |
|
568 | - //make sure we hae payment method records for the following |
|
569 | - //so admins can record payments for them from the admin page |
|
570 | - foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
571 | - $slug = sanitize_key($nicename); |
|
572 | - //check that such a payment method exists |
|
573 | - $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
574 | - if ( ! $exists) { |
|
575 | - $values = array( |
|
576 | - 'PMD_type' => 'Admin_Only', |
|
577 | - 'PMD_name' => $nicename, |
|
578 | - 'PMD_admin_name' => $nicename, |
|
579 | - 'PMD_admin_desc' => $description, |
|
580 | - 'PMD_slug' => $slug, |
|
581 | - 'PMD_wp_user' => $user_id, |
|
582 | - 'PMD_scope' => serialize(array('ADMIN')), |
|
583 | - ); |
|
584 | - $success = $wpdb->insert( |
|
585 | - $table_name, |
|
586 | - $values, |
|
587 | - array( |
|
588 | - '%s',//PMD_type |
|
589 | - '%s',//PMD_name |
|
590 | - '%s',//PMD_admin_name |
|
591 | - '%s',//PMD_admin_desc |
|
592 | - '%s',//PMD_slug |
|
593 | - '%d',//PMD_wp_user |
|
594 | - '%s',//PMD_scope |
|
595 | - ) |
|
596 | - ); |
|
597 | - if ( ! $success) { |
|
598 | - $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", |
|
599 | - "event_espresso"), $this->_json_encode($values))); |
|
600 | - } |
|
601 | - } |
|
602 | - } |
|
603 | - } |
|
604 | - } |
|
605 | - |
|
606 | - |
|
607 | - |
|
608 | - /** |
|
609 | - * insert_default_countries |
|
610 | - * |
|
611 | - * @static |
|
612 | - * @return void |
|
613 | - */ |
|
614 | - public function insert_default_currencies() |
|
615 | - { |
|
616 | - global $wpdb; |
|
617 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
618 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
619 | - $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
620 | - $countries = $wpdb->get_var($SQL); |
|
621 | - if ( ! $countries) { |
|
622 | - $SQL = "INSERT INTO $currency_table |
|
510 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
511 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
512 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
513 | + //(because many need to convert old string states to foreign keys into the states table) |
|
514 | + $script_4_1_defaults->insert_default_states(); |
|
515 | + $script_4_1_defaults->insert_default_countries(); |
|
516 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
517 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
518 | + $script_4_5_defaults->insert_default_price_types(); |
|
519 | + $script_4_5_defaults->insert_default_prices(); |
|
520 | + $script_4_5_defaults->insert_default_tickets(); |
|
521 | + //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
522 | + EE_Config::instance()->update_espresso_config(false, true); |
|
523 | + $this->add_default_admin_only_payments(); |
|
524 | + $this->insert_default_currencies(); |
|
525 | + return true; |
|
526 | + } |
|
527 | + |
|
528 | + |
|
529 | + |
|
530 | + /** |
|
531 | + * @return boolean |
|
532 | + */ |
|
533 | + public function schema_changes_after_migration() |
|
534 | + { |
|
535 | + return true; |
|
536 | + } |
|
537 | + |
|
538 | + |
|
539 | + |
|
540 | + public function migration_page_hooks() |
|
541 | + { |
|
542 | + } |
|
543 | + |
|
544 | + |
|
545 | + |
|
546 | + public function add_default_admin_only_payments() |
|
547 | + { |
|
548 | + global $wpdb; |
|
549 | + $table_name = $wpdb->prefix . "esp_payment_method"; |
|
550 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
551 | + if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
552 | + $SQL = "SELECT COUNT( * ) FROM $table_name"; |
|
553 | + $existing_payment_methods = $wpdb->get_var($SQL); |
|
554 | + $default_admin_only_payment_methods = apply_filters( |
|
555 | + 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
556 | + array( |
|
557 | + __("Bank", 'event_espresso') => __("Bank Draft", 'event_espresso'), |
|
558 | + __("Cash", 'event_espresso') => __("Cash Delivered Physically", 'event_espresso'), |
|
559 | + __("Check", 'event_espresso') => __("Paper Check", 'event_espresso'), |
|
560 | + __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'), |
|
561 | + __("Debit Card", 'event_espresso') => __("Offline Debit Payment", 'event_espresso'), |
|
562 | + __("Invoice", 'event_espresso') => __("Invoice received with monies included", |
|
563 | + 'event_espresso'), |
|
564 | + __("Money Order", 'event_espresso') => '', |
|
565 | + __("Paypal", 'event_espresso') => __("Paypal eCheck, Invoice, etc", 'event_espresso'), |
|
566 | + __('Other', 'event_espresso') => __('Other method of payment', 'event_espresso'), |
|
567 | + )); |
|
568 | + //make sure we hae payment method records for the following |
|
569 | + //so admins can record payments for them from the admin page |
|
570 | + foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
571 | + $slug = sanitize_key($nicename); |
|
572 | + //check that such a payment method exists |
|
573 | + $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
574 | + if ( ! $exists) { |
|
575 | + $values = array( |
|
576 | + 'PMD_type' => 'Admin_Only', |
|
577 | + 'PMD_name' => $nicename, |
|
578 | + 'PMD_admin_name' => $nicename, |
|
579 | + 'PMD_admin_desc' => $description, |
|
580 | + 'PMD_slug' => $slug, |
|
581 | + 'PMD_wp_user' => $user_id, |
|
582 | + 'PMD_scope' => serialize(array('ADMIN')), |
|
583 | + ); |
|
584 | + $success = $wpdb->insert( |
|
585 | + $table_name, |
|
586 | + $values, |
|
587 | + array( |
|
588 | + '%s',//PMD_type |
|
589 | + '%s',//PMD_name |
|
590 | + '%s',//PMD_admin_name |
|
591 | + '%s',//PMD_admin_desc |
|
592 | + '%s',//PMD_slug |
|
593 | + '%d',//PMD_wp_user |
|
594 | + '%s',//PMD_scope |
|
595 | + ) |
|
596 | + ); |
|
597 | + if ( ! $success) { |
|
598 | + $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", |
|
599 | + "event_espresso"), $this->_json_encode($values))); |
|
600 | + } |
|
601 | + } |
|
602 | + } |
|
603 | + } |
|
604 | + } |
|
605 | + |
|
606 | + |
|
607 | + |
|
608 | + /** |
|
609 | + * insert_default_countries |
|
610 | + * |
|
611 | + * @static |
|
612 | + * @return void |
|
613 | + */ |
|
614 | + public function insert_default_currencies() |
|
615 | + { |
|
616 | + global $wpdb; |
|
617 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
618 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
619 | + $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
620 | + $countries = $wpdb->get_var($SQL); |
|
621 | + if ( ! $countries) { |
|
622 | + $SQL = "INSERT INTO $currency_table |
|
623 | 623 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
624 | 624 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
625 | 625 | ( 'AED', 'Dirham', 'Dirhams', 'د.إ',2,1), |
@@ -773,10 +773,10 @@ discard block |
||
773 | 773 | ( 'ZAR', 'Rand', 'Rands', 'R', 2,1), |
774 | 774 | ( 'ZMK', 'Kwacha', 'Kwachas', '', 2,1), |
775 | 775 | ( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);"; |
776 | - $wpdb->query($SQL); |
|
777 | - } |
|
778 | - } |
|
779 | - } |
|
776 | + $wpdb->query($SQL); |
|
777 | + } |
|
778 | + } |
|
779 | + } |
|
780 | 780 | |
781 | 781 | } |
782 | 782 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | //unfortunately, this needs to be done upon INCLUSION of this file, |
12 | 12 | //instead of construction, because it only gets constructed on first page load |
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
|
14 | +$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*'); |
|
15 | 15 | $class_to_filepath = array(); |
16 | 16 | foreach ($stages as $filepath) { |
17 | 17 | $matches = array(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } elseif ( ! $version_string) { |
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | 78 | } else { |
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function schema_changes_before_migration() |
100 | 100 | { |
101 | 101 | //relies on 4.1's EEH_Activation::create_table |
102 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
102 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
103 | 103 | $table_name = 'esp_answer'; |
104 | 104 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
105 | 105 | REG_ID INT UNSIGNED NOT NULL, |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | public function add_default_admin_only_payments() |
547 | 547 | { |
548 | 548 | global $wpdb; |
549 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
549 | + $table_name = $wpdb->prefix."esp_payment_method"; |
|
550 | 550 | $user_id = EEH_Activation::get_default_creator_id(); |
551 | 551 | if ($this->_get_table_analysis()->tableExists($table_name)) { |
552 | 552 | $SQL = "SELECT COUNT( * ) FROM $table_name"; |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | $table_name, |
586 | 586 | $values, |
587 | 587 | array( |
588 | - '%s',//PMD_type |
|
589 | - '%s',//PMD_name |
|
590 | - '%s',//PMD_admin_name |
|
591 | - '%s',//PMD_admin_desc |
|
592 | - '%s',//PMD_slug |
|
593 | - '%d',//PMD_wp_user |
|
594 | - '%s',//PMD_scope |
|
588 | + '%s', //PMD_type |
|
589 | + '%s', //PMD_name |
|
590 | + '%s', //PMD_admin_name |
|
591 | + '%s', //PMD_admin_desc |
|
592 | + '%s', //PMD_slug |
|
593 | + '%d', //PMD_wp_user |
|
594 | + '%s', //PMD_scope |
|
595 | 595 | ) |
596 | 596 | ); |
597 | 597 | if ( ! $success) { |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | public function insert_default_currencies() |
615 | 615 | { |
616 | 616 | global $wpdb; |
617 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
617 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
618 | 618 | if ($this->_get_table_analysis()->tableExists($currency_table)) { |
619 | 619 | $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
620 | 620 | $countries = $wpdb->get_var($SQL); |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | - $matches = array(); |
|
21 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | - $class_to_filepath[$matches[1]] = $filepath; |
|
20 | + $matches = array(); |
|
21 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | + $class_to_filepath[$matches[1]] = $filepath; |
|
23 | 23 | } |
24 | 24 | //give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -38,81 +38,81 @@ discard block |
||
38 | 38 | class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base |
39 | 39 | { |
40 | 40 | |
41 | - /** |
|
42 | - * return EE_DMS_Core_4_8_0 |
|
43 | - * |
|
44 | - * @param TableManager $table_manager |
|
45 | - * @param TableAnalysis $table_analysis |
|
46 | - */ |
|
47 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | - { |
|
49 | - $this->_pretty_name = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "event_espresso"); |
|
50 | - $this->_priority = 10; |
|
51 | - $this->_migration_stages = array( |
|
52 | - new EE_DMS_4_8_0_pretax_totals(), |
|
53 | - new EE_DMS_4_8_0_event_subtotals(), |
|
54 | - ); |
|
55 | - parent::__construct($table_manager, $table_analysis); |
|
56 | - } |
|
41 | + /** |
|
42 | + * return EE_DMS_Core_4_8_0 |
|
43 | + * |
|
44 | + * @param TableManager $table_manager |
|
45 | + * @param TableAnalysis $table_analysis |
|
46 | + */ |
|
47 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | + { |
|
49 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_8_0_pretax_totals(), |
|
53 | + new EE_DMS_4_8_0_event_subtotals(), |
|
54 | + ); |
|
55 | + parent::__construct($table_manager, $table_analysis); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * Because this is being done at basically the same time as the MER-ready branch |
|
62 | - * of core, it's possible people might have installed MEr-ready branch first, |
|
63 | - * and then this one, in which case we still want to perform this migration, |
|
64 | - * even though the version might not have increased |
|
65 | - * |
|
66 | - * @param array $version_array |
|
67 | - * @return bool |
|
68 | - */ |
|
69 | - public function can_migrate_from_version($version_array) |
|
70 | - { |
|
71 | - $version_string = $version_array['Core']; |
|
72 | - if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
|
60 | + /** |
|
61 | + * Because this is being done at basically the same time as the MER-ready branch |
|
62 | + * of core, it's possible people might have installed MEr-ready branch first, |
|
63 | + * and then this one, in which case we still want to perform this migration, |
|
64 | + * even though the version might not have increased |
|
65 | + * |
|
66 | + * @param array $version_array |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | + public function can_migrate_from_version($version_array) |
|
70 | + { |
|
71 | + $version_string = $version_array['Core']; |
|
72 | + if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
|
73 | 73 | // echo "$version_string can be migrated from"; |
74 | - return true; |
|
75 | - } elseif ( ! $version_string) { |
|
74 | + return true; |
|
75 | + } elseif ( ! $version_string) { |
|
76 | 76 | // echo "no version string provided: $version_string"; |
77 | - //no version string provided... this must be pre 4.3 |
|
78 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | - } else { |
|
77 | + //no version string provided... this must be pre 4.3 |
|
78 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | + } else { |
|
80 | 80 | // echo "$version_string doesnt apply"; |
81 | - return false; |
|
82 | - } |
|
83 | - } |
|
81 | + return false; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @return string|void |
|
89 | - */ |
|
90 | - public function pretty_name() |
|
91 | - { |
|
92 | - return __("Core Data Migration to version 4.8.0", "event_espresso"); |
|
93 | - } |
|
87 | + /** |
|
88 | + * @return string|void |
|
89 | + */ |
|
90 | + public function pretty_name() |
|
91 | + { |
|
92 | + return __("Core Data Migration to version 4.8.0", "event_espresso"); |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * @return bool |
|
99 | - */ |
|
100 | - public function schema_changes_before_migration() |
|
101 | - { |
|
102 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
103 | - $now_in_mysql = current_time('mysql', true); |
|
104 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
105 | - $table_name = 'esp_answer'; |
|
106 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
97 | + /** |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | + public function schema_changes_before_migration() |
|
101 | + { |
|
102 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
103 | + $now_in_mysql = current_time('mysql', true); |
|
104 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
105 | + $table_name = 'esp_answer'; |
|
106 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
107 | 107 | REG_ID int(10) unsigned NOT NULL, |
108 | 108 | QST_ID int(10) unsigned NOT NULL, |
109 | 109 | ANS_value text NOT NULL, |
110 | 110 | PRIMARY KEY (ANS_ID), |
111 | 111 | KEY REG_ID (REG_ID), |
112 | 112 | KEY QST_ID (QST_ID)"; |
113 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
114 | - $table_name = 'esp_attendee_meta'; |
|
115 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
113 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
114 | + $table_name = 'esp_attendee_meta'; |
|
115 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
116 | 116 | ATT_ID bigint(20) unsigned NOT NULL, |
117 | 117 | ATT_fname varchar(45) NOT NULL, |
118 | 118 | ATT_lname varchar(45) NOT NULL, |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | KEY ATT_email (ATT_email), |
130 | 130 | KEY ATT_lname (ATT_lname), |
131 | 131 | KEY ATT_fname (ATT_fname)"; |
132 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
133 | - $table_name = 'esp_country'; |
|
134 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
132 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
133 | + $table_name = 'esp_country'; |
|
134 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
135 | 135 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
136 | 136 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
137 | 137 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -147,25 +147,25 @@ discard block |
||
147 | 147 | CNT_is_EU tinyint(1) DEFAULT '0', |
148 | 148 | CNT_active tinyint(1) DEFAULT '0', |
149 | 149 | PRIMARY KEY (CNT_ISO)"; |
150 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | - $table_name = 'esp_currency'; |
|
152 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
150 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | + $table_name = 'esp_currency'; |
|
152 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
153 | 153 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
154 | 154 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
155 | 155 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
156 | 156 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
157 | 157 | CUR_active tinyint(1) DEFAULT '0', |
158 | 158 | PRIMARY KEY (CUR_code)"; |
159 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
160 | - $table_name = 'esp_currency_payment_method'; |
|
161 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
159 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
160 | + $table_name = 'esp_currency_payment_method'; |
|
161 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
162 | 162 | CUR_code varchar(6) collate utf8_bin NOT NULL, |
163 | 163 | PMD_ID int(11) NOT NULL, |
164 | 164 | PRIMARY KEY (CPM_ID), |
165 | 165 | KEY PMD_ID (PMD_ID)"; |
166 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
167 | - $table_name = 'esp_datetime'; |
|
168 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
166 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
167 | + $table_name = 'esp_datetime'; |
|
168 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
169 | 169 | EVT_ID bigint(20) unsigned NOT NULL, |
170 | 170 | DTT_name varchar(255) NOT NULL DEFAULT '', |
171 | 171 | DTT_description text NOT NULL, |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | KEY DTT_EVT_start (DTT_EVT_start), |
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | - $table_name = 'esp_event_meta'; |
|
186 | - $sql = " |
|
184 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | + $table_name = 'esp_event_meta'; |
|
186 | + $sql = " |
|
187 | 187 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
188 | 188 | EVT_ID bigint(20) unsigned NOT NULL, |
189 | 189 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -199,34 +199,34 @@ discard block |
||
199 | 199 | EVT_donations tinyint(1) NULL, |
200 | 200 | PRIMARY KEY (EVTM_ID), |
201 | 201 | KEY EVT_ID (EVT_ID)"; |
202 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | - $table_name = 'esp_event_question_group'; |
|
204 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
202 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | + $table_name = 'esp_event_question_group'; |
|
204 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
205 | 205 | EVT_ID bigint(20) unsigned NOT NULL, |
206 | 206 | QSG_ID int(10) unsigned NOT NULL, |
207 | 207 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
208 | 208 | PRIMARY KEY (EQG_ID), |
209 | 209 | KEY EVT_ID (EVT_ID), |
210 | 210 | KEY QSG_ID (QSG_ID)"; |
211 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
212 | - $table_name = 'esp_event_venue'; |
|
213 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
211 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
212 | + $table_name = 'esp_event_venue'; |
|
213 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
214 | 214 | EVT_ID bigint(20) unsigned NOT NULL, |
215 | 215 | VNU_ID bigint(20) unsigned NOT NULL, |
216 | 216 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
217 | 217 | PRIMARY KEY (EVV_ID)"; |
218 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | - $table_name = 'esp_extra_meta'; |
|
220 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | + $table_name = 'esp_extra_meta'; |
|
220 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
221 | 221 | OBJ_ID int(11) DEFAULT NULL, |
222 | 222 | EXM_type varchar(45) DEFAULT NULL, |
223 | 223 | EXM_key varchar(45) DEFAULT NULL, |
224 | 224 | EXM_value text, |
225 | 225 | PRIMARY KEY (EXM_ID), |
226 | 226 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
227 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | - $table_name = 'esp_extra_join'; |
|
229 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
227 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | + $table_name = 'esp_extra_join'; |
|
229 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | EXJ_first_model_id varchar(6) NOT NULL, |
231 | 231 | EXJ_first_model_name varchar(20) NOT NULL, |
232 | 232 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | PRIMARY KEY (EXJ_ID), |
235 | 235 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
236 | 236 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
237 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
238 | - $table_name = 'esp_line_item'; |
|
239 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
237 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
238 | + $table_name = 'esp_line_item'; |
|
239 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
240 | 240 | LIN_code varchar(245) NOT NULL DEFAULT '', |
241 | 241 | TXN_ID int(11) DEFAULT NULL, |
242 | 242 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | PRIMARY KEY (LIN_ID), |
256 | 256 | KEY LIN_code (LIN_code(191)), |
257 | 257 | KEY TXN_ID (TXN_ID)"; |
258 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
259 | - $table_name = 'esp_log'; |
|
260 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
258 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
259 | + $table_name = 'esp_log'; |
|
260 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
261 | 261 | LOG_time datetime DEFAULT NULL, |
262 | 262 | OBJ_ID varchar(45) DEFAULT NULL, |
263 | 263 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | KEY LOG_time (LOG_time), |
269 | 269 | KEY OBJ (OBJ_type,OBJ_ID), |
270 | 270 | KEY LOG_type (LOG_type)"; |
271 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | - $table_name = 'esp_message_template'; |
|
273 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
271 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | + $table_name = 'esp_message_template'; |
|
273 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
274 | 274 | GRP_ID int(10) unsigned NOT NULL, |
275 | 275 | MTP_context varchar(50) NOT NULL, |
276 | 276 | MTP_template_field varchar(30) NOT NULL, |
277 | 277 | MTP_content text NOT NULL, |
278 | 278 | PRIMARY KEY (MTP_ID), |
279 | 279 | KEY GRP_ID (GRP_ID)"; |
280 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
281 | - $table_name = 'esp_message_template_group'; |
|
282 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
280 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
281 | + $table_name = 'esp_message_template_group'; |
|
282 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
283 | 283 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
284 | 284 | MTP_name varchar(245) NOT NULL DEFAULT '', |
285 | 285 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -291,17 +291,17 @@ discard block |
||
291 | 291 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
292 | 292 | PRIMARY KEY (GRP_ID), |
293 | 293 | KEY MTP_user_id (MTP_user_id)"; |
294 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | - $table_name = 'esp_event_message_template'; |
|
296 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
294 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | + $table_name = 'esp_event_message_template'; |
|
296 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
297 | 297 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
298 | 298 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
299 | 299 | PRIMARY KEY (EMT_ID), |
300 | 300 | KEY EVT_ID (EVT_ID), |
301 | 301 | KEY GRP_ID (GRP_ID)"; |
302 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
303 | - $table_name = 'esp_payment'; |
|
304 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
302 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
303 | + $table_name = 'esp_payment'; |
|
304 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
305 | 305 | TXN_ID int(10) unsigned DEFAULT NULL, |
306 | 306 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
307 | 307 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | PRIMARY KEY (PAY_ID), |
319 | 319 | KEY PAY_timestamp (PAY_timestamp), |
320 | 320 | KEY TXN_ID (TXN_ID)"; |
321 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
322 | - $table_name = 'esp_payment_method'; |
|
323 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
321 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
322 | + $table_name = 'esp_payment_method'; |
|
323 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
324 | 324 | PMD_type varchar(124) DEFAULT NULL, |
325 | 325 | PMD_name varchar(255) DEFAULT NULL, |
326 | 326 | PMD_desc text, |
@@ -336,32 +336,32 @@ discard block |
||
336 | 336 | PRIMARY KEY (PMD_ID), |
337 | 337 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
338 | 338 | KEY PMD_type (PMD_type)"; |
339 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
340 | - $table_name = "esp_ticket_price"; |
|
341 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
339 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
340 | + $table_name = "esp_ticket_price"; |
|
341 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
342 | 342 | TKT_ID int(10) unsigned NOT NULL, |
343 | 343 | PRC_ID int(10) unsigned NOT NULL, |
344 | 344 | PRIMARY KEY (TKP_ID), |
345 | 345 | KEY TKT_ID (TKT_ID), |
346 | 346 | KEY PRC_ID (PRC_ID)"; |
347 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | - $table_name = "esp_datetime_ticket"; |
|
349 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
347 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | + $table_name = "esp_datetime_ticket"; |
|
349 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
350 | 350 | DTT_ID int(10) unsigned NOT NULL, |
351 | 351 | TKT_ID int(10) unsigned NOT NULL, |
352 | 352 | PRIMARY KEY (DTK_ID), |
353 | 353 | KEY DTT_ID (DTT_ID), |
354 | 354 | KEY TKT_ID (TKT_ID)"; |
355 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
356 | - $table_name = "esp_ticket_template"; |
|
357 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
355 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
356 | + $table_name = "esp_ticket_template"; |
|
357 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
358 | 358 | TTM_name varchar(45) NOT NULL, |
359 | 359 | TTM_description text, |
360 | 360 | TTM_file varchar(45), |
361 | 361 | PRIMARY KEY (TTM_ID)"; |
362 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
363 | - $table_name = 'esp_question'; |
|
364 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
362 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
363 | + $table_name = 'esp_question'; |
|
364 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
365 | 365 | QST_display_text text NOT NULL, |
366 | 366 | QST_admin_label varchar(255) NOT NULL, |
367 | 367 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -375,18 +375,18 @@ discard block |
||
375 | 375 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
376 | 376 | PRIMARY KEY (QST_ID), |
377 | 377 | KEY QST_order (QST_order)'; |
378 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
379 | - $table_name = 'esp_question_group_question'; |
|
380 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
378 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
379 | + $table_name = 'esp_question_group_question'; |
|
380 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
381 | 381 | QSG_ID int(10) unsigned NOT NULL, |
382 | 382 | QST_ID int(10) unsigned NOT NULL, |
383 | 383 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
384 | 384 | PRIMARY KEY (QGQ_ID), |
385 | 385 | KEY QST_ID (QST_ID), |
386 | 386 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
387 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | - $table_name = 'esp_question_option'; |
|
389 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
387 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | + $table_name = 'esp_question_option'; |
|
389 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
390 | 390 | QSO_value varchar(255) NOT NULL, |
391 | 391 | QSO_desc text NOT NULL, |
392 | 392 | QST_ID int(10) unsigned NOT NULL, |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | PRIMARY KEY (QSO_ID), |
397 | 397 | KEY QST_ID (QST_ID), |
398 | 398 | KEY QSO_order (QSO_order)"; |
399 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | - $table_name = 'esp_registration'; |
|
401 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
399 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | + $table_name = 'esp_registration'; |
|
401 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
402 | 402 | EVT_ID bigint(20) unsigned NOT NULL, |
403 | 403 | ATT_ID bigint(20) unsigned NOT NULL, |
404 | 404 | TXN_ID int(10) unsigned NOT NULL, |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | KEY TKT_ID (TKT_ID), |
423 | 423 | KEY EVT_ID (EVT_ID), |
424 | 424 | KEY STS_ID (STS_ID)"; |
425 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
426 | - $table_name = 'esp_registration_payment'; |
|
427 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
425 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
426 | + $table_name = 'esp_registration_payment'; |
|
427 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
428 | 428 | REG_ID int(10) unsigned NOT NULL, |
429 | 429 | PAY_ID int(10) unsigned NULL, |
430 | 430 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
431 | 431 | PRIMARY KEY (RPY_ID), |
432 | 432 | KEY REG_ID (REG_ID), |
433 | 433 | KEY PAY_ID (PAY_ID)"; |
434 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
435 | - $table_name = 'esp_checkin'; |
|
436 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
434 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
435 | + $table_name = 'esp_checkin'; |
|
436 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
437 | 437 | REG_ID int(10) unsigned NOT NULL, |
438 | 438 | DTT_ID int(10) unsigned NOT NULL, |
439 | 439 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | PRIMARY KEY (CHK_ID), |
442 | 442 | KEY REG_ID (REG_ID), |
443 | 443 | KEY DTT_ID (DTT_ID)"; |
444 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
445 | - $table_name = 'esp_state'; |
|
446 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
444 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
445 | + $table_name = 'esp_state'; |
|
446 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
447 | 447 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
448 | 448 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
449 | 449 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | PRIMARY KEY (STA_ID), |
452 | 452 | KEY STA_abbrev (STA_abbrev), |
453 | 453 | KEY CNT_ISO (CNT_ISO)"; |
454 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
455 | - $table_name = 'esp_status'; |
|
456 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
454 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
455 | + $table_name = 'esp_status'; |
|
456 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
457 | 457 | STS_code varchar(45) NOT NULL, |
458 | 458 | STS_type varchar(45) NOT NULL, |
459 | 459 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
462 | 462 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
463 | 463 | KEY STS_type (STS_type)"; |
464 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
465 | - $table_name = 'esp_transaction'; |
|
466 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
464 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
465 | + $table_name = 'esp_transaction'; |
|
466 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
467 | 467 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
468 | 468 | TXN_total decimal(10,3) DEFAULT '0.00', |
469 | 469 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -475,9 +475,9 @@ discard block |
||
475 | 475 | PRIMARY KEY (TXN_ID), |
476 | 476 | KEY TXN_timestamp (TXN_timestamp), |
477 | 477 | KEY STS_ID (STS_ID)"; |
478 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
479 | - $table_name = 'esp_venue_meta'; |
|
480 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
478 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
479 | + $table_name = 'esp_venue_meta'; |
|
480 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
481 | 481 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
482 | 482 | VNU_address varchar(255) DEFAULT NULL, |
483 | 483 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -496,10 +496,10 @@ discard block |
||
496 | 496 | KEY VNU_ID (VNU_ID), |
497 | 497 | KEY STA_ID (STA_ID), |
498 | 498 | KEY CNT_ISO (CNT_ISO)"; |
499 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | - //modified tables |
|
501 | - $table_name = "esp_price"; |
|
502 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
499 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | + //modified tables |
|
501 | + $table_name = "esp_price"; |
|
502 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
503 | 503 | PRT_ID tinyint(3) unsigned NOT NULL, |
504 | 504 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
505 | 505 | PRC_name varchar(245) NOT NULL, |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | PRC_parent int(10) unsigned DEFAULT 0, |
513 | 513 | PRIMARY KEY (PRC_ID), |
514 | 514 | KEY PRT_ID (PRT_ID)"; |
515 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
516 | - $table_name = "esp_price_type"; |
|
517 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
515 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
516 | + $table_name = "esp_price_type"; |
|
517 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
518 | 518 | PRT_name varchar(45) NOT NULL, |
519 | 519 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
520 | 520 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
524 | 524 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
525 | 525 | PRIMARY KEY (PRT_ID)"; |
526 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
527 | - $table_name = "esp_ticket"; |
|
528 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
526 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
527 | + $table_name = "esp_ticket"; |
|
528 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
529 | 529 | TTM_ID int(10) unsigned NOT NULL, |
530 | 530 | TKT_name varchar(245) NOT NULL DEFAULT '', |
531 | 531 | TKT_description text NOT NULL, |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
548 | 548 | PRIMARY KEY (TKT_ID), |
549 | 549 | KEY TKT_start_date (TKT_start_date)"; |
550 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
551 | - $table_name = 'esp_question_group'; |
|
552 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
550 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
551 | + $table_name = 'esp_question_group'; |
|
552 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
553 | 553 | QSG_name varchar(255) NOT NULL, |
554 | 554 | QSG_identifier varchar(100) NOT NULL, |
555 | 555 | QSG_desc text NULL, |
@@ -562,221 +562,221 @@ discard block |
||
562 | 562 | PRIMARY KEY (QSG_ID), |
563 | 563 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
564 | 564 | KEY QSG_order (QSG_order)'; |
565 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
566 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
567 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
568 | - //(because many need to convert old string states to foreign keys into the states table) |
|
569 | - $script_4_1_defaults->insert_default_states(); |
|
570 | - $script_4_1_defaults->insert_default_countries(); |
|
571 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
572 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
573 | - $script_4_5_defaults->insert_default_price_types(); |
|
574 | - $script_4_5_defaults->insert_default_prices(); |
|
575 | - $script_4_5_defaults->insert_default_tickets(); |
|
576 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
577 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
578 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
579 | - $script_4_6_defaults->insert_default_currencies(); |
|
580 | - $this->verify_new_countries(); |
|
581 | - $this->verify_new_currencies(); |
|
582 | - return true; |
|
583 | - } |
|
565 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
566 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
567 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
568 | + //(because many need to convert old string states to foreign keys into the states table) |
|
569 | + $script_4_1_defaults->insert_default_states(); |
|
570 | + $script_4_1_defaults->insert_default_countries(); |
|
571 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
572 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
573 | + $script_4_5_defaults->insert_default_price_types(); |
|
574 | + $script_4_5_defaults->insert_default_prices(); |
|
575 | + $script_4_5_defaults->insert_default_tickets(); |
|
576 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
577 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
578 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
579 | + $script_4_6_defaults->insert_default_currencies(); |
|
580 | + $this->verify_new_countries(); |
|
581 | + $this->verify_new_currencies(); |
|
582 | + return true; |
|
583 | + } |
|
584 | 584 | |
585 | 585 | |
586 | 586 | |
587 | - /** |
|
588 | - * @return boolean |
|
589 | - */ |
|
590 | - public function schema_changes_after_migration() |
|
591 | - { |
|
592 | - $this->fix_non_default_taxes(); |
|
593 | - //this is actually the same as the last DMS |
|
594 | - /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
595 | - $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
596 | - return $script_4_7_defaults->schema_changes_after_migration(); |
|
597 | - } |
|
587 | + /** |
|
588 | + * @return boolean |
|
589 | + */ |
|
590 | + public function schema_changes_after_migration() |
|
591 | + { |
|
592 | + $this->fix_non_default_taxes(); |
|
593 | + //this is actually the same as the last DMS |
|
594 | + /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
595 | + $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
596 | + return $script_4_7_defaults->schema_changes_after_migration(); |
|
597 | + } |
|
598 | 598 | |
599 | 599 | |
600 | 600 | |
601 | - public function migration_page_hooks() |
|
602 | - { |
|
603 | - } |
|
601 | + public function migration_page_hooks() |
|
602 | + { |
|
603 | + } |
|
604 | 604 | |
605 | 605 | |
606 | 606 | |
607 | - /** |
|
608 | - * verifies each of the new countries exists that somehow we missed in 4.1 |
|
609 | - */ |
|
610 | - public function verify_new_countries() |
|
611 | - { |
|
612 | - //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
613 | - //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
614 | - //currency symbols: http://www.xe.com/symbols.php |
|
615 | - //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
616 | - //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
617 | - $newer_countries = array( |
|
618 | - array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
619 | - array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
620 | - array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
621 | - array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
622 | - array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
623 | - array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
624 | - array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
625 | - array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
626 | - array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
627 | - array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
628 | - array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
629 | - array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
630 | - array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
631 | - array( |
|
632 | - 'BQ', |
|
633 | - 'BES', |
|
634 | - 0, |
|
635 | - 'Bonaire, Saint Eustatius and Saba', |
|
636 | - 'USD', |
|
637 | - 'Dollar', |
|
638 | - 'Dollars', |
|
639 | - '$', |
|
640 | - 1, |
|
641 | - 2, |
|
642 | - '+599', |
|
643 | - 0, |
|
644 | - 0, |
|
645 | - ), |
|
646 | - array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
647 | - array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
648 | - array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
649 | - array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
650 | - array( |
|
651 | - 'HM', |
|
652 | - 'HMD', |
|
653 | - 0, |
|
654 | - 'Heard Island and McDonald Islands', |
|
655 | - 'AUD', |
|
656 | - 'Dollar', |
|
657 | - 'Dollars', |
|
658 | - '$', |
|
659 | - 1, |
|
660 | - 2, |
|
661 | - '+891', |
|
662 | - 0, |
|
663 | - 0, |
|
664 | - ), |
|
665 | - array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
666 | - array( |
|
667 | - 'GS', |
|
668 | - 'SGS', |
|
669 | - 0, |
|
670 | - 'South Georgia and the South Sandwich Islands', |
|
671 | - 'GBP', |
|
672 | - 'Pound', |
|
673 | - 'Pounds', |
|
674 | - '£', |
|
675 | - 1, |
|
676 | - 2, |
|
677 | - '+500', |
|
678 | - 0, |
|
679 | - 0, |
|
680 | - ), |
|
681 | - array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
682 | - array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
683 | - array( |
|
684 | - 'UM', |
|
685 | - 'UMI', |
|
686 | - 0, |
|
687 | - 'United States Minor Outlying Islands', |
|
688 | - 'USD', |
|
689 | - 'Dollar', |
|
690 | - 'Dollars', |
|
691 | - '$', |
|
692 | - 1, |
|
693 | - 2, |
|
694 | - '+1', |
|
695 | - 0, |
|
696 | - 0, |
|
697 | - ), |
|
698 | - ); |
|
699 | - global $wpdb; |
|
700 | - $country_table = $wpdb->prefix . "esp_country"; |
|
701 | - $country_format = array( |
|
702 | - "CNT_ISO" => '%s', |
|
703 | - "CNT_ISO3" => '%s', |
|
704 | - "RGN_ID" => '%d', |
|
705 | - "CNT_name" => '%s', |
|
706 | - "CNT_cur_code" => '%s', |
|
707 | - "CNT_cur_single" => '%s', |
|
708 | - "CNT_cur_plural" => '%s', |
|
709 | - "CNT_cur_sign" => '%s', |
|
710 | - "CNT_cur_sign_b4" => '%d', |
|
711 | - "CNT_cur_dec_plc" => '%d', |
|
712 | - "CNT_tel_code" => '%s', |
|
713 | - "CNT_is_EU" => '%d', |
|
714 | - "CNT_active" => '%d', |
|
715 | - ); |
|
716 | - if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
717 | - foreach ($newer_countries as $country) { |
|
718 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
719 | - $countries = $wpdb->get_var($SQL); |
|
720 | - if ( ! $countries) { |
|
721 | - $wpdb->insert($country_table, |
|
722 | - array_combine(array_keys($country_format), $country), |
|
723 | - $country_format |
|
724 | - ); |
|
725 | - } |
|
726 | - } |
|
727 | - } |
|
728 | - } |
|
607 | + /** |
|
608 | + * verifies each of the new countries exists that somehow we missed in 4.1 |
|
609 | + */ |
|
610 | + public function verify_new_countries() |
|
611 | + { |
|
612 | + //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
613 | + //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
614 | + //currency symbols: http://www.xe.com/symbols.php |
|
615 | + //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
616 | + //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
617 | + $newer_countries = array( |
|
618 | + array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
619 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
620 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
621 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
622 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
623 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
624 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
625 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
626 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
627 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
628 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
629 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
630 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
631 | + array( |
|
632 | + 'BQ', |
|
633 | + 'BES', |
|
634 | + 0, |
|
635 | + 'Bonaire, Saint Eustatius and Saba', |
|
636 | + 'USD', |
|
637 | + 'Dollar', |
|
638 | + 'Dollars', |
|
639 | + '$', |
|
640 | + 1, |
|
641 | + 2, |
|
642 | + '+599', |
|
643 | + 0, |
|
644 | + 0, |
|
645 | + ), |
|
646 | + array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
647 | + array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
648 | + array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
649 | + array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
650 | + array( |
|
651 | + 'HM', |
|
652 | + 'HMD', |
|
653 | + 0, |
|
654 | + 'Heard Island and McDonald Islands', |
|
655 | + 'AUD', |
|
656 | + 'Dollar', |
|
657 | + 'Dollars', |
|
658 | + '$', |
|
659 | + 1, |
|
660 | + 2, |
|
661 | + '+891', |
|
662 | + 0, |
|
663 | + 0, |
|
664 | + ), |
|
665 | + array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
666 | + array( |
|
667 | + 'GS', |
|
668 | + 'SGS', |
|
669 | + 0, |
|
670 | + 'South Georgia and the South Sandwich Islands', |
|
671 | + 'GBP', |
|
672 | + 'Pound', |
|
673 | + 'Pounds', |
|
674 | + '£', |
|
675 | + 1, |
|
676 | + 2, |
|
677 | + '+500', |
|
678 | + 0, |
|
679 | + 0, |
|
680 | + ), |
|
681 | + array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
682 | + array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
683 | + array( |
|
684 | + 'UM', |
|
685 | + 'UMI', |
|
686 | + 0, |
|
687 | + 'United States Minor Outlying Islands', |
|
688 | + 'USD', |
|
689 | + 'Dollar', |
|
690 | + 'Dollars', |
|
691 | + '$', |
|
692 | + 1, |
|
693 | + 2, |
|
694 | + '+1', |
|
695 | + 0, |
|
696 | + 0, |
|
697 | + ), |
|
698 | + ); |
|
699 | + global $wpdb; |
|
700 | + $country_table = $wpdb->prefix . "esp_country"; |
|
701 | + $country_format = array( |
|
702 | + "CNT_ISO" => '%s', |
|
703 | + "CNT_ISO3" => '%s', |
|
704 | + "RGN_ID" => '%d', |
|
705 | + "CNT_name" => '%s', |
|
706 | + "CNT_cur_code" => '%s', |
|
707 | + "CNT_cur_single" => '%s', |
|
708 | + "CNT_cur_plural" => '%s', |
|
709 | + "CNT_cur_sign" => '%s', |
|
710 | + "CNT_cur_sign_b4" => '%d', |
|
711 | + "CNT_cur_dec_plc" => '%d', |
|
712 | + "CNT_tel_code" => '%s', |
|
713 | + "CNT_is_EU" => '%d', |
|
714 | + "CNT_active" => '%d', |
|
715 | + ); |
|
716 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
717 | + foreach ($newer_countries as $country) { |
|
718 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
719 | + $countries = $wpdb->get_var($SQL); |
|
720 | + if ( ! $countries) { |
|
721 | + $wpdb->insert($country_table, |
|
722 | + array_combine(array_keys($country_format), $country), |
|
723 | + $country_format |
|
724 | + ); |
|
725 | + } |
|
726 | + } |
|
727 | + } |
|
728 | + } |
|
729 | 729 | |
730 | 730 | |
731 | 731 | |
732 | - /** |
|
733 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
734 | - */ |
|
735 | - public function verify_new_currencies() |
|
736 | - { |
|
737 | - //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
738 | - //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
739 | - //currency symbols: http://www.xe.com/symbols.php |
|
740 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
741 | - //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
742 | - $newer_currencies = array( |
|
743 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
744 | - ); |
|
745 | - global $wpdb; |
|
746 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
747 | - $currency_format = array( |
|
748 | - "CUR_code" => '%s', |
|
749 | - "CUR_single" => '%s', |
|
750 | - "CUR_plural" => '%s', |
|
751 | - "CUR_sign" => '%s', |
|
752 | - "CUR_dec_plc" => '%d', |
|
753 | - "CUR_active" => '%d', |
|
754 | - ); |
|
755 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
756 | - foreach ($newer_currencies as $currency) { |
|
757 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
758 | - $countries = $wpdb->get_var($SQL); |
|
759 | - if ( ! $countries) { |
|
760 | - $wpdb->insert($currency_table, |
|
761 | - array_combine(array_keys($currency_format), $currency), |
|
762 | - $currency_format |
|
763 | - ); |
|
764 | - } |
|
765 | - } |
|
766 | - } |
|
767 | - } |
|
732 | + /** |
|
733 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
734 | + */ |
|
735 | + public function verify_new_currencies() |
|
736 | + { |
|
737 | + //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
738 | + //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
739 | + //currency symbols: http://www.xe.com/symbols.php |
|
740 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
741 | + //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
742 | + $newer_currencies = array( |
|
743 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
744 | + ); |
|
745 | + global $wpdb; |
|
746 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
747 | + $currency_format = array( |
|
748 | + "CUR_code" => '%s', |
|
749 | + "CUR_single" => '%s', |
|
750 | + "CUR_plural" => '%s', |
|
751 | + "CUR_sign" => '%s', |
|
752 | + "CUR_dec_plc" => '%d', |
|
753 | + "CUR_active" => '%d', |
|
754 | + ); |
|
755 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
756 | + foreach ($newer_currencies as $currency) { |
|
757 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
758 | + $countries = $wpdb->get_var($SQL); |
|
759 | + if ( ! $countries) { |
|
760 | + $wpdb->insert($currency_table, |
|
761 | + array_combine(array_keys($currency_format), $currency), |
|
762 | + $currency_format |
|
763 | + ); |
|
764 | + } |
|
765 | + } |
|
766 | + } |
|
767 | + } |
|
768 | 768 | |
769 | 769 | |
770 | 770 | |
771 | - /** |
|
772 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
773 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
774 | - * we should be able to stop doing this in 4.9 |
|
775 | - */ |
|
776 | - public function fix_non_default_taxes() |
|
777 | - { |
|
778 | - global $wpdb; |
|
779 | - $query = $wpdb->prepare("UPDATE |
|
771 | + /** |
|
772 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
773 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
774 | + * we should be able to stop doing this in 4.9 |
|
775 | + */ |
|
776 | + public function fix_non_default_taxes() |
|
777 | + { |
|
778 | + global $wpdb; |
|
779 | + $query = $wpdb->prepare("UPDATE |
|
780 | 780 | {$wpdb->prefix}esp_price p INNER JOIN |
781 | 781 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
782 | 782 | SET |
@@ -785,6 +785,6 @@ discard block |
||
785 | 785 | p.PRC_is_default = 0 AND |
786 | 786 | pt.PBT_ID = %d |
787 | 787 | ", EEM_Price_Type::base_type_tax); |
788 | - $wpdb->query($query); |
|
789 | - } |
|
788 | + $wpdb->query($query); |
|
789 | + } |
|
790 | 790 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | //unfortunately, this needs to be done upon INCLUSION of this file, |
15 | 15 | //instead of construction, because it only gets constructed on first page load |
16 | 16 | //(all other times it gets resurrected from a wordpress option) |
17 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
|
17 | +$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
|
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | 20 | $matches = array(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } elseif ( ! $version_string) { |
76 | 76 | // echo "no version string provided: $version_string"; |
77 | 77 | //no version string provided... this must be pre 4.3 |
78 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | 79 | } else { |
80 | 80 | // echo "$version_string doesnt apply"; |
81 | 81 | return false; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function schema_changes_before_migration() |
101 | 101 | { |
102 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
102 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
103 | 103 | $now_in_mysql = current_time('mysql', true); |
104 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
104 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
105 | 105 | $table_name = 'esp_answer'; |
106 | 106 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
107 | 107 | REG_ID int(10) unsigned NOT NULL, |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ), |
698 | 698 | ); |
699 | 699 | global $wpdb; |
700 | - $country_table = $wpdb->prefix . "esp_country"; |
|
700 | + $country_table = $wpdb->prefix."esp_country"; |
|
701 | 701 | $country_format = array( |
702 | 702 | "CNT_ISO" => '%s', |
703 | 703 | "CNT_ISO3" => '%s', |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
744 | 744 | ); |
745 | 745 | global $wpdb; |
746 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
746 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
747 | 747 | $currency_format = array( |
748 | 748 | "CUR_code" => '%s', |
749 | 749 | "CUR_single" => '%s', |
@@ -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,66 +31,66 @@ 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 Migration to Event Espresso 4.5.0.P", "event_espresso"); |
|
43 | - $this->_priority = 10; |
|
44 | - $this->_migration_stages = array( |
|
45 | - new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | - new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | - new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | - new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | - new EE_DMS_4_5_0_invoice_settings(), |
|
50 | - ); |
|
51 | - parent::__construct($table_manager, $table_analysis); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - |
|
56 | - public function can_migrate_from_version($version_array) |
|
57 | - { |
|
58 | - $version_string = $version_array['Core']; |
|
59 | - if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
|
34 | + /** |
|
35 | + * EE_DMS_Core_4_5_0 constructor. |
|
36 | + * |
|
37 | + * @param TableManager $table_manager |
|
38 | + * @param TableAnalysis $table_analysis |
|
39 | + */ |
|
40 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | + { |
|
42 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.5.0.P", "event_espresso"); |
|
43 | + $this->_priority = 10; |
|
44 | + $this->_migration_stages = array( |
|
45 | + new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | + new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | + new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | + new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | + new EE_DMS_4_5_0_invoice_settings(), |
|
50 | + ); |
|
51 | + parent::__construct($table_manager, $table_analysis); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + |
|
56 | + public function can_migrate_from_version($version_array) |
|
57 | + { |
|
58 | + $version_string = $version_array['Core']; |
|
59 | + if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) { |
|
60 | 60 | // echo "$version_string can be migrated from"; |
61 | - return true; |
|
62 | - } elseif ( ! $version_string) { |
|
61 | + return true; |
|
62 | + } elseif ( ! $version_string) { |
|
63 | 63 | // echo "no version string provided: $version_string"; |
64 | - //no version string provided... this must be pre 4.3 |
|
65 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | - } else { |
|
64 | + //no version string provided... this must be pre 4.3 |
|
65 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | + } else { |
|
67 | 67 | // echo "$version_string doesnt apply"; |
68 | - return false; |
|
69 | - } |
|
70 | - } |
|
68 | + return false; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | - public function pretty_name() |
|
75 | - { |
|
76 | - return __("Core Data Migration to version 4.5.0", "event_espresso"); |
|
77 | - } |
|
74 | + public function pretty_name() |
|
75 | + { |
|
76 | + return __("Core Data Migration to version 4.5.0", "event_espresso"); |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | - public function schema_changes_before_migration() |
|
82 | - { |
|
83 | - //relies on 4.1's EEH_Activation::create_table |
|
84 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
85 | - $table_name = 'esp_answer'; |
|
86 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
81 | + public function schema_changes_before_migration() |
|
82 | + { |
|
83 | + //relies on 4.1's EEH_Activation::create_table |
|
84 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
85 | + $table_name = 'esp_answer'; |
|
86 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
87 | 87 | REG_ID INT UNSIGNED NOT NULL, |
88 | 88 | QST_ID INT UNSIGNED NOT NULL, |
89 | 89 | ANS_value TEXT NOT NULL, |
90 | 90 | PRIMARY KEY (ANS_ID)"; |
91 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
92 | - $table_name = 'esp_attendee_meta'; |
|
93 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
91 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
92 | + $table_name = 'esp_attendee_meta'; |
|
93 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | 94 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
95 | 95 | ATT_fname VARCHAR(45) NOT NULL, |
96 | 96 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | KEY ATT_fname (ATT_fname), |
107 | 107 | KEY ATT_lname (ATT_lname), |
108 | 108 | KEY ATT_email (ATT_email)"; |
109 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
110 | - $table_name = 'esp_country'; |
|
111 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
109 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
110 | + $table_name = 'esp_country'; |
|
111 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
112 | 112 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
113 | 113 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
114 | 114 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | CNT_is_EU TINYINT(1) DEFAULT '0', |
125 | 125 | CNT_active TINYINT(1) DEFAULT '0', |
126 | 126 | PRIMARY KEY (CNT_ISO)"; |
127 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
128 | - $table_name = 'esp_datetime'; |
|
129 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
127 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
128 | + $table_name = 'esp_datetime'; |
|
129 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
130 | 130 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
131 | 131 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
132 | 132 | DTT_description TEXT NOT NULL, |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | PRIMARY KEY (DTT_ID), |
142 | 142 | KEY EVT_ID (EVT_ID), |
143 | 143 | KEY DTT_is_primary (DTT_is_primary)"; |
144 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
145 | - $table_name = 'esp_event_meta'; |
|
146 | - $sql = " |
|
144 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
145 | + $table_name = 'esp_event_meta'; |
|
146 | + $sql = " |
|
147 | 147 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
148 | 148 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
149 | 149 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -158,31 +158,31 @@ discard block |
||
158 | 158 | EVT_external_URL VARCHAR(200) NULL, |
159 | 159 | EVT_donations TINYINT(1) NULL, |
160 | 160 | PRIMARY KEY (EVTM_ID)"; |
161 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | - $table_name = 'esp_event_question_group'; |
|
163 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
161 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | + $table_name = 'esp_event_question_group'; |
|
163 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
164 | 164 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
165 | 165 | QSG_ID INT UNSIGNED NOT NULL, |
166 | 166 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
167 | 167 | PRIMARY KEY (EQG_ID)"; |
168 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | - $table_name = 'esp_event_venue'; |
|
170 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
168 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | + $table_name = 'esp_event_venue'; |
|
170 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
171 | 171 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
172 | 172 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
173 | 173 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
174 | 174 | PRIMARY KEY (EVV_ID)"; |
175 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
176 | - $table_name = 'esp_extra_meta'; |
|
177 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
175 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
176 | + $table_name = 'esp_extra_meta'; |
|
177 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
178 | 178 | OBJ_ID INT(11) DEFAULT NULL, |
179 | 179 | EXM_type VARCHAR(45) DEFAULT NULL, |
180 | 180 | EXM_key VARCHAR(45) DEFAULT NULL, |
181 | 181 | EXM_value TEXT, |
182 | 182 | PRIMARY KEY (EXM_ID)"; |
183 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | - $table_name = 'esp_line_item'; |
|
185 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
183 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | + $table_name = 'esp_line_item'; |
|
185 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
186 | 186 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
187 | 187 | TXN_ID INT(11) DEFAULT NULL, |
188 | 188 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -198,19 +198,19 @@ discard block |
||
198 | 198 | OBJ_ID INT(11) DEFAULT NULL, |
199 | 199 | OBJ_type VARCHAR(45)DEFAULT NULL, |
200 | 200 | PRIMARY KEY (LIN_ID)"; |
201 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | - $table_name = 'esp_message_template'; |
|
203 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
201 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $table_name = 'esp_message_template'; |
|
203 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
204 | 204 | GRP_ID INT(10) UNSIGNED NOT NULL, |
205 | 205 | MTP_context VARCHAR(50) NOT NULL, |
206 | 206 | MTP_template_field VARCHAR(30) NOT NULL, |
207 | 207 | MTP_content TEXT NOT NULL, |
208 | 208 | PRIMARY KEY (MTP_ID), |
209 | 209 | KEY GRP_ID (GRP_ID)"; |
210 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
212 | - $table_name = 'esp_message_template_group'; |
|
213 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
210 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
212 | + $table_name = 'esp_message_template_group'; |
|
213 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
214 | 214 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
215 | 215 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
216 | 216 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -222,17 +222,17 @@ discard block |
||
222 | 222 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
223 | 223 | PRIMARY KEY (GRP_ID), |
224 | 224 | KEY MTP_user_id (MTP_user_id)"; |
225 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
226 | - $table_name = 'esp_event_message_template'; |
|
227 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
225 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
226 | + $table_name = 'esp_event_message_template'; |
|
227 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
228 | 228 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
229 | 229 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
230 | 230 | PRIMARY KEY (EMT_ID), |
231 | 231 | KEY EVT_ID (EVT_ID), |
232 | 232 | KEY GRP_ID (GRP_ID)"; |
233 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | - $table_name = 'esp_payment'; |
|
235 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
233 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | + $table_name = 'esp_payment'; |
|
235 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
236 | 236 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
237 | 237 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
238 | 238 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -248,28 +248,28 @@ discard block |
||
248 | 248 | PRIMARY KEY (PAY_ID), |
249 | 249 | KEY TXN_ID (TXN_ID), |
250 | 250 | KEY PAY_timestamp (PAY_timestamp)"; |
251 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
252 | - $table_name = "esp_ticket_price"; |
|
253 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
251 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
252 | + $table_name = "esp_ticket_price"; |
|
253 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
254 | 254 | TKT_ID INT(10) UNSIGNED NOT NULL, |
255 | 255 | PRC_ID INT(10) UNSIGNED NOT NULL, |
256 | 256 | PRIMARY KEY (TKP_ID)"; |
257 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | - $table_name = "esp_datetime_ticket"; |
|
259 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
257 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | + $table_name = "esp_datetime_ticket"; |
|
259 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
260 | 260 | DTT_ID INT(10) UNSIGNED NOT NULL, |
261 | 261 | TKT_ID INT(10) UNSIGNED NOT NULL, |
262 | 262 | PRIMARY KEY (DTK_ID)"; |
263 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | - $table_name = "esp_ticket_template"; |
|
265 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
263 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
264 | + $table_name = "esp_ticket_template"; |
|
265 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
266 | 266 | TTM_name VARCHAR(45) NOT NULL, |
267 | 267 | TTM_description TEXT, |
268 | 268 | TTM_file VARCHAR(45), |
269 | 269 | PRIMARY KEY (TTM_ID)"; |
270 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
271 | - $table_name = 'esp_question'; |
|
272 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
270 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
271 | + $table_name = 'esp_question'; |
|
272 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
273 | 273 | QST_display_text TEXT NOT NULL, |
274 | 274 | QST_admin_label VARCHAR(255) NOT NULL, |
275 | 275 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -281,25 +281,25 @@ discard block |
||
281 | 281 | QST_wp_user BIGINT UNSIGNED NULL, |
282 | 282 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
283 | 283 | PRIMARY KEY (QST_ID)'; |
284 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | - $table_name = 'esp_question_group_question'; |
|
286 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $table_name = 'esp_question_group_question'; |
|
286 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
287 | 287 | QSG_ID INT UNSIGNED NOT NULL, |
288 | 288 | QST_ID INT UNSIGNED NOT NULL, |
289 | 289 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
290 | 290 | PRIMARY KEY (QGQ_ID) "; |
291 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
292 | - $table_name = 'esp_question_option'; |
|
293 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
291 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
292 | + $table_name = 'esp_question_option'; |
|
293 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
294 | 294 | QSO_value VARCHAR(255) NOT NULL, |
295 | 295 | QSO_desc TEXT NOT NULL, |
296 | 296 | QST_ID INT UNSIGNED NOT NULL, |
297 | 297 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
298 | 298 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
299 | 299 | PRIMARY KEY (QSO_ID)"; |
300 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
301 | - $table_name = 'esp_registration'; |
|
302 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
300 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
301 | + $table_name = 'esp_registration'; |
|
302 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
303 | 303 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
304 | 304 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
305 | 305 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -322,25 +322,25 @@ discard block |
||
322 | 322 | KEY STS_ID (STS_ID), |
323 | 323 | KEY REG_url_link (REG_url_link), |
324 | 324 | KEY REG_code (REG_code)"; |
325 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
326 | - $table_name = 'esp_checkin'; |
|
327 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
325 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
326 | + $table_name = 'esp_checkin'; |
|
327 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
328 | 328 | REG_ID INT(10) UNSIGNED NOT NULL, |
329 | 329 | DTT_ID INT(10) UNSIGNED NOT NULL, |
330 | 330 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
331 | 331 | CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
332 | 332 | PRIMARY KEY (CHK_ID)"; |
333 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
334 | - $table_name = 'esp_state'; |
|
335 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
333 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
334 | + $table_name = 'esp_state'; |
|
335 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
336 | 336 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
337 | 337 | STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL, |
338 | 338 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
339 | 339 | STA_active TINYINT(1) DEFAULT '1', |
340 | 340 | PRIMARY KEY (STA_ID)"; |
341 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | - $table_name = 'esp_status'; |
|
343 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
341 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | + $table_name = 'esp_status'; |
|
343 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
344 | 344 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
345 | 345 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
346 | 346 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
349 | 349 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
350 | 350 | KEY STS_type (STS_type)"; |
351 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
352 | - $table_name = 'esp_transaction'; |
|
353 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
351 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
352 | + $table_name = 'esp_transaction'; |
|
353 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
354 | 354 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
355 | 355 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
356 | 356 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | PRIMARY KEY (TXN_ID), |
362 | 362 | KEY TXN_timestamp (TXN_timestamp), |
363 | 363 | KEY STS_ID (STS_ID)"; |
364 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
365 | - $table_name = 'esp_venue_meta'; |
|
366 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
364 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
365 | + $table_name = 'esp_venue_meta'; |
|
366 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
367 | 367 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
368 | 368 | VNU_address VARCHAR(255) DEFAULT NULL, |
369 | 369 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | PRIMARY KEY (VNUM_ID), |
382 | 382 | KEY STA_ID (STA_ID), |
383 | 383 | KEY CNT_ISO (CNT_ISO)"; |
384 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
385 | - //modified tables |
|
386 | - $table_name = "esp_price"; |
|
387 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
384 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
385 | + //modified tables |
|
386 | + $table_name = "esp_price"; |
|
387 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
388 | 388 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
389 | 389 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
390 | 390 | PRC_name VARCHAR(245) NOT NULL, |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | PRC_wp_user BIGINT UNSIGNED NULL, |
397 | 397 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
398 | 398 | PRIMARY KEY (PRC_ID)"; |
399 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | - $table_name = "esp_price_type"; |
|
401 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
399 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | + $table_name = "esp_price_type"; |
|
401 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
402 | 402 | PRT_name VARCHAR(45) NOT NULL, |
403 | 403 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
404 | 404 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -407,9 +407,9 @@ discard block |
||
407 | 407 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
408 | 408 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
409 | 409 | PRIMARY KEY (PRT_ID)"; |
410 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
411 | - $table_name = "esp_ticket"; |
|
412 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
410 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
411 | + $table_name = "esp_ticket"; |
|
412 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
413 | 413 | TTM_ID INT(10) UNSIGNED NOT NULL, |
414 | 414 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
415 | 415 | TKT_description TEXT NOT NULL, |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
431 | 431 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
432 | 432 | PRIMARY KEY (TKT_ID)"; |
433 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
434 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
435 | - $table_name = 'esp_question_group'; |
|
436 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
433 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
434 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
435 | + $table_name = 'esp_question_group'; |
|
436 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
437 | 437 | QSG_name VARCHAR(255) NOT NULL, |
438 | 438 | QSG_identifier VARCHAR(100) NOT NULL, |
439 | 439 | QSG_desc TEXT NULL, |
@@ -445,135 +445,135 @@ discard block |
||
445 | 445 | QSG_wp_user BIGINT UNSIGNED NULL, |
446 | 446 | PRIMARY KEY (QSG_ID), |
447 | 447 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
448 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
449 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
450 | - //(because many need to convert old string states to foreign keys into the states table) |
|
451 | - $script_4_1_defaults->insert_default_states(); |
|
452 | - $script_4_1_defaults->insert_default_countries(); |
|
453 | - //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
454 | - $this->insert_default_price_types(); |
|
455 | - $this->insert_default_prices(); |
|
456 | - $this->insert_default_tickets(); |
|
457 | - //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
458 | - EE_Config::instance()->update_espresso_config(false, true); |
|
459 | - return true; |
|
460 | - } |
|
461 | - |
|
462 | - |
|
463 | - |
|
464 | - /** |
|
465 | - * @return boolean |
|
466 | - */ |
|
467 | - public function schema_changes_after_migration() |
|
468 | - { |
|
469 | - return true; |
|
470 | - } |
|
471 | - |
|
472 | - |
|
473 | - |
|
474 | - public function migration_page_hooks() |
|
475 | - { |
|
476 | - } |
|
477 | - |
|
478 | - |
|
479 | - |
|
480 | - /** |
|
481 | - * insert_default_price_types |
|
482 | - * |
|
483 | - * @since 4.5.0 |
|
484 | - * @return void |
|
485 | - */ |
|
486 | - public function insert_default_price_types() |
|
487 | - { |
|
488 | - global $wpdb; |
|
489 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
490 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
491 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
492 | - $price_types_exist = $wpdb->get_var($SQL); |
|
493 | - if ( ! $price_types_exist) { |
|
494 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
495 | - $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
448 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
449 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
450 | + //(because many need to convert old string states to foreign keys into the states table) |
|
451 | + $script_4_1_defaults->insert_default_states(); |
|
452 | + $script_4_1_defaults->insert_default_countries(); |
|
453 | + //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
454 | + $this->insert_default_price_types(); |
|
455 | + $this->insert_default_prices(); |
|
456 | + $this->insert_default_tickets(); |
|
457 | + //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
458 | + EE_Config::instance()->update_espresso_config(false, true); |
|
459 | + return true; |
|
460 | + } |
|
461 | + |
|
462 | + |
|
463 | + |
|
464 | + /** |
|
465 | + * @return boolean |
|
466 | + */ |
|
467 | + public function schema_changes_after_migration() |
|
468 | + { |
|
469 | + return true; |
|
470 | + } |
|
471 | + |
|
472 | + |
|
473 | + |
|
474 | + public function migration_page_hooks() |
|
475 | + { |
|
476 | + } |
|
477 | + |
|
478 | + |
|
479 | + |
|
480 | + /** |
|
481 | + * insert_default_price_types |
|
482 | + * |
|
483 | + * @since 4.5.0 |
|
484 | + * @return void |
|
485 | + */ |
|
486 | + public function insert_default_price_types() |
|
487 | + { |
|
488 | + global $wpdb; |
|
489 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
490 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
491 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
492 | + $price_types_exist = $wpdb->get_var($SQL); |
|
493 | + if ( ! $price_types_exist) { |
|
494 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
495 | + $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
496 | 496 | (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
497 | 497 | (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
498 | 498 | (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
499 | 499 | (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
500 | 500 | (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
501 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
502 | - $wpdb->query($SQL); |
|
503 | - } |
|
504 | - } |
|
505 | - } |
|
506 | - |
|
507 | - |
|
508 | - |
|
509 | - /** |
|
510 | - * insert DEFAULT prices. |
|
511 | - * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
512 | - * when EEH_Activaion's initialize_db_content is called via ahook in |
|
513 | - * EE_Brewing_regular |
|
514 | - * |
|
515 | - * @since 4.5.0 |
|
516 | - * @return void |
|
517 | - */ |
|
518 | - public function insert_default_prices() |
|
519 | - { |
|
520 | - global $wpdb; |
|
521 | - $price_table = $wpdb->prefix . "esp_price"; |
|
522 | - if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
523 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
524 | - $prices_exist = $wpdb->get_var($SQL); |
|
525 | - if ( ! $prices_exist) { |
|
526 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
527 | - $SQL = "INSERT INTO $price_table |
|
501 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
502 | + $wpdb->query($SQL); |
|
503 | + } |
|
504 | + } |
|
505 | + } |
|
506 | + |
|
507 | + |
|
508 | + |
|
509 | + /** |
|
510 | + * insert DEFAULT prices. |
|
511 | + * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
512 | + * when EEH_Activaion's initialize_db_content is called via ahook in |
|
513 | + * EE_Brewing_regular |
|
514 | + * |
|
515 | + * @since 4.5.0 |
|
516 | + * @return void |
|
517 | + */ |
|
518 | + public function insert_default_prices() |
|
519 | + { |
|
520 | + global $wpdb; |
|
521 | + $price_table = $wpdb->prefix . "esp_price"; |
|
522 | + if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
523 | + $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
524 | + $prices_exist = $wpdb->get_var($SQL); |
|
525 | + if ( ! $prices_exist) { |
|
526 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
527 | + $SQL = "INSERT INTO $price_table |
|
528 | 528 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
529 | 529 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);"; |
530 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
531 | - $wpdb->query($SQL); |
|
532 | - } |
|
533 | - } |
|
534 | - } |
|
535 | - |
|
536 | - |
|
537 | - |
|
538 | - /** |
|
539 | - * insert DEFAULT ticket |
|
540 | - * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
541 | - * |
|
542 | - * @since 4.5.0 |
|
543 | - * @return void |
|
544 | - */ |
|
545 | - public function insert_default_tickets() |
|
546 | - { |
|
547 | - global $wpdb; |
|
548 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
549 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
550 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
551 | - $tickets_exist = $wpdb->get_var($SQL); |
|
552 | - if ( ! $tickets_exist) { |
|
553 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
554 | - $SQL = "INSERT INTO $ticket_table |
|
530 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
531 | + $wpdb->query($SQL); |
|
532 | + } |
|
533 | + } |
|
534 | + } |
|
535 | + |
|
536 | + |
|
537 | + |
|
538 | + /** |
|
539 | + * insert DEFAULT ticket |
|
540 | + * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
541 | + * |
|
542 | + * @since 4.5.0 |
|
543 | + * @return void |
|
544 | + */ |
|
545 | + public function insert_default_tickets() |
|
546 | + { |
|
547 | + global $wpdb; |
|
548 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
549 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
550 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
551 | + $tickets_exist = $wpdb->get_var($SQL); |
|
552 | + if ( ! $tickets_exist) { |
|
553 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
554 | + $SQL = "INSERT INTO $ticket_table |
|
555 | 555 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
556 | 556 | ( 1, 0, '" |
557 | - . __("Free Ticket", "event_espresso") |
|
558 | - . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
559 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
560 | - $wpdb->query($SQL); |
|
561 | - } |
|
562 | - } |
|
563 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
564 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
565 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
566 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
567 | - if ( ! $ticket_prc_exist) { |
|
568 | - $SQL = "INSERT INTO $ticket_price_table |
|
557 | + . __("Free Ticket", "event_espresso") |
|
558 | + . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
559 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
560 | + $wpdb->query($SQL); |
|
561 | + } |
|
562 | + } |
|
563 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
564 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
565 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
566 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
567 | + if ( ! $ticket_prc_exist) { |
|
568 | + $SQL = "INSERT INTO $ticket_price_table |
|
569 | 569 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
570 | 570 | ( 1, 1, 1 ) |
571 | 571 | "; |
572 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
573 | - $wpdb->query($SQL); |
|
574 | - } |
|
575 | - } |
|
576 | - } |
|
572 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
573 | + $wpdb->query($SQL); |
|
574 | + } |
|
575 | + } |
|
576 | + } |
|
577 | 577 | |
578 | 578 | } |
579 | 579 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | //unfortunately, this needs to be done upon INCLUSION of this file, |
14 | 14 | //instead of construction, because it only gets constructed on first page load |
15 | 15 | //(all other times it gets resurrected from a wordpress option) |
16 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
|
16 | +$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*'); |
|
17 | 17 | $class_to_filepath = array(); |
18 | 18 | foreach ($stages as $filepath) { |
19 | 19 | $matches = array(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } elseif ( ! $version_string) { |
63 | 63 | // echo "no version string provided: $version_string"; |
64 | 64 | //no version string provided... this must be pre 4.3 |
65 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
66 | 66 | } else { |
67 | 67 | // echo "$version_string doesnt apply"; |
68 | 68 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function schema_changes_before_migration() |
82 | 82 | { |
83 | 83 | //relies on 4.1's EEH_Activation::create_table |
84 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
84 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
85 | 85 | $table_name = 'esp_answer'; |
86 | 86 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
87 | 87 | REG_ID INT UNSIGNED NOT NULL, |
@@ -486,18 +486,18 @@ discard block |
||
486 | 486 | public function insert_default_price_types() |
487 | 487 | { |
488 | 488 | global $wpdb; |
489 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
489 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
490 | 490 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
491 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
491 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
492 | 492 | $price_types_exist = $wpdb->get_var($SQL); |
493 | 493 | if ( ! $price_types_exist) { |
494 | 494 | $user_id = EEH_Activation::get_default_creator_id(); |
495 | 495 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
496 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
|
497 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
|
498 | - (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
|
499 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
|
500 | - (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
|
496 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, $user_id, 0), |
|
497 | + (2, '".__('Percent Discount', 'event_espresso')."', 2, 1, 20, $user_id, 0), |
|
498 | + (3, '".__('Dollar Discount', 'event_espresso')."', 2, 0, 30, $user_id, 0), |
|
499 | + (4, '".__('Percent Surcharge', 'event_espresso')."', 3, 1, 40, $user_id, 0), |
|
500 | + (5, '".__('Dollar Surcharge', 'event_espresso')."', 3, 0, 50, $user_id, 0);"; |
|
501 | 501 | $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
502 | 502 | $wpdb->query($SQL); |
503 | 503 | } |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | public function insert_default_prices() |
519 | 519 | { |
520 | 520 | global $wpdb; |
521 | - $price_table = $wpdb->prefix . "esp_price"; |
|
521 | + $price_table = $wpdb->prefix."esp_price"; |
|
522 | 522 | if ($this->_get_table_analysis()->tableExists($price_table)) { |
523 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
523 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
524 | 524 | $prices_exist = $wpdb->get_var($SQL); |
525 | 525 | if ( ! $prices_exist) { |
526 | 526 | $user_id = EEH_Activation::get_default_creator_id(); |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | public function insert_default_tickets() |
546 | 546 | { |
547 | 547 | global $wpdb; |
548 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
548 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
549 | 549 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
550 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
550 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
551 | 551 | $tickets_exist = $wpdb->get_var($SQL); |
552 | 552 | if ( ! $tickets_exist) { |
553 | 553 | $user_id = EEH_Activation::get_default_creator_id(); |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | $wpdb->query($SQL); |
561 | 561 | } |
562 | 562 | } |
563 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
563 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
564 | 564 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
565 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
565 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
566 | 566 | $ticket_prc_exist = $wpdb->get_var($SQL); |
567 | 567 | if ( ! $ticket_prc_exist) { |
568 | 568 | $SQL = "INSERT INTO $ticket_price_table |
@@ -9,7 +9,6 @@ discard block |
||
9 | 9 | * and recalculates esp_registration.REG_final_price to actually be the final price |
10 | 10 | * for that registration (before this it was just the ticket's price, NOT including |
11 | 11 | * taxes or other price modifiers) |
12 | - |
|
13 | 12 | */ |
14 | 13 | // make sure we have all the stages loaded too |
15 | 14 | // unfortunately, this needs to be done upon INCLUSION of this file, |
@@ -18,9 +17,9 @@ discard block |
||
18 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
19 | 18 | $class_to_filepath = array(); |
20 | 19 | foreach ($stages as $filepath) { |
21 | - $matches = array(); |
|
22 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
23 | - $class_to_filepath[$matches[1]] = $filepath; |
|
20 | + $matches = array(); |
|
21 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | + $class_to_filepath[$matches[1]] = $filepath; |
|
24 | 23 | } |
25 | 24 | //give addons a chance to autoload their stages too |
26 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
@@ -39,82 +38,82 @@ discard block |
||
39 | 38 | class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base |
40 | 39 | { |
41 | 40 | |
42 | - /** |
|
43 | - * return EE_DMS_Core_4_7_0 |
|
44 | - * |
|
45 | - * @param TableManager $table_manager |
|
46 | - * @param TableAnalysis $table_analysis |
|
47 | - */ |
|
48 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
49 | - { |
|
50 | - $this->_pretty_name = __("Data Migration to Event Espresso 4.7.0.p", "event_espresso"); |
|
51 | - $this->_priority = 10; |
|
52 | - $this->_migration_stages = array( |
|
53 | - new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
54 | - new EE_DMS_4_7_0_Registration_Payments(), |
|
55 | - ); |
|
56 | - parent::__construct($table_manager, $table_analysis); |
|
57 | - } |
|
41 | + /** |
|
42 | + * return EE_DMS_Core_4_7_0 |
|
43 | + * |
|
44 | + * @param TableManager $table_manager |
|
45 | + * @param TableAnalysis $table_analysis |
|
46 | + */ |
|
47 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | + { |
|
49 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.7.0.p", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
53 | + new EE_DMS_4_7_0_Registration_Payments(), |
|
54 | + ); |
|
55 | + parent::__construct($table_manager, $table_analysis); |
|
56 | + } |
|
58 | 57 | |
59 | 58 | |
60 | 59 | |
61 | - /** |
|
62 | - * @param array $version_array |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - public function can_migrate_from_version($version_array) |
|
66 | - { |
|
67 | - $version_string = $version_array['Core']; |
|
68 | - if ( |
|
69 | - ( |
|
70 | - version_compare($version_string, '4.7.0', '<=') |
|
71 | - && version_compare($version_string, '4.6.0', '>=') |
|
72 | - ) |
|
73 | - || ( |
|
74 | - version_compare($version_string, '4.7.0', '>=') |
|
75 | - && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
76 | - && $this->_get_table_analysis()->tableExists('esp_registration') |
|
77 | - ) |
|
78 | - ) { |
|
79 | - return true; |
|
80 | - } elseif ( ! $version_string) { |
|
81 | - //no version string provided... this must be pre 4.3 |
|
82 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
83 | - } else { |
|
84 | - return false; |
|
85 | - } |
|
86 | - } |
|
60 | + /** |
|
61 | + * @param array $version_array |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | + public function can_migrate_from_version($version_array) |
|
65 | + { |
|
66 | + $version_string = $version_array['Core']; |
|
67 | + if ( |
|
68 | + ( |
|
69 | + version_compare($version_string, '4.7.0', '<=') |
|
70 | + && version_compare($version_string, '4.6.0', '>=') |
|
71 | + ) |
|
72 | + || ( |
|
73 | + version_compare($version_string, '4.7.0', '>=') |
|
74 | + && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
75 | + && $this->_get_table_analysis()->tableExists('esp_registration') |
|
76 | + ) |
|
77 | + ) { |
|
78 | + return true; |
|
79 | + } elseif ( ! $version_string) { |
|
80 | + //no version string provided... this must be pre 4.3 |
|
81 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | + } else { |
|
83 | + return false; |
|
84 | + } |
|
85 | + } |
|
87 | 86 | |
88 | 87 | |
89 | 88 | |
90 | - /** |
|
91 | - * @return string|void |
|
92 | - */ |
|
93 | - public function pretty_name() |
|
94 | - { |
|
95 | - return __("Core Data Migration to version 4.7.0", "event_espresso"); |
|
96 | - } |
|
89 | + /** |
|
90 | + * @return string|void |
|
91 | + */ |
|
92 | + public function pretty_name() |
|
93 | + { |
|
94 | + return __("Core Data Migration to version 4.7.0", "event_espresso"); |
|
95 | + } |
|
97 | 96 | |
98 | 97 | |
99 | 98 | |
100 | - /** |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - public function schema_changes_before_migration() |
|
104 | - { |
|
105 | - //relies on 4.1's EEH_Activation::create_table |
|
106 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
107 | - $table_name = 'esp_answer'; |
|
108 | - $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
99 | + /** |
|
100 | + * @return bool |
|
101 | + */ |
|
102 | + public function schema_changes_before_migration() |
|
103 | + { |
|
104 | + //relies on 4.1's EEH_Activation::create_table |
|
105 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
106 | + $table_name = 'esp_answer'; |
|
107 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
109 | 108 | REG_ID INT UNSIGNED NOT NULL, |
110 | 109 | QST_ID INT UNSIGNED NOT NULL, |
111 | 110 | ANS_value TEXT NOT NULL, |
112 | 111 | PRIMARY KEY (ANS_ID), |
113 | 112 | KEY REG_ID (REG_ID), |
114 | 113 | KEY QST_ID (QST_ID)"; |
115 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
116 | - $table_name = 'esp_attendee_meta'; |
|
117 | - $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
114 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
115 | + $table_name = 'esp_attendee_meta'; |
|
116 | + $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
118 | 117 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
119 | 118 | ATT_fname VARCHAR(45) NOT NULL, |
120 | 119 | ATT_lname VARCHAR(45) NOT NULL, |
@@ -131,9 +130,9 @@ discard block |
||
131 | 130 | KEY ATT_email (ATT_email), |
132 | 131 | KEY ATT_lname (ATT_lname), |
133 | 132 | KEY ATT_fname (ATT_fname)"; |
134 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
135 | - $table_name = 'esp_country'; |
|
136 | - $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
133 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
134 | + $table_name = 'esp_country'; |
|
135 | + $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
|
137 | 136 | CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL, |
138 | 137 | RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL, |
139 | 138 | CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL, |
@@ -149,25 +148,25 @@ discard block |
||
149 | 148 | CNT_is_EU TINYINT(1) DEFAULT '0', |
150 | 149 | CNT_active TINYINT(1) DEFAULT '0', |
151 | 150 | PRIMARY KEY (CNT_ISO)"; |
152 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
153 | - $table_name = 'esp_currency'; |
|
154 | - $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | + $table_name = 'esp_currency'; |
|
153 | + $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
|
155 | 154 | CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar', |
156 | 155 | CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars', |
157 | 156 | CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$', |
158 | 157 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
159 | 158 | CUR_active TINYINT(1) DEFAULT '0', |
160 | 159 | PRIMARY KEY (CUR_code)"; |
161 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | - $table_name = 'esp_currency_payment_method'; |
|
163 | - $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
160 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | + $table_name = 'esp_currency_payment_method'; |
|
162 | + $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
164 | 163 | CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
165 | 164 | PMD_ID INT(11) NOT NULL, |
166 | 165 | PRIMARY KEY (CPM_ID), |
167 | 166 | KEY PMD_ID (PMD_ID)"; |
168 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
169 | - $table_name = 'esp_datetime'; |
|
170 | - $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
167 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
168 | + $table_name = 'esp_datetime'; |
|
169 | + $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
171 | 170 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
172 | 171 | DTT_name VARCHAR(255) NOT NULL DEFAULT '', |
173 | 172 | DTT_description TEXT NOT NULL, |
@@ -183,9 +182,9 @@ discard block |
||
183 | 182 | KEY DTT_EVT_start (DTT_EVT_start), |
184 | 183 | KEY EVT_ID (EVT_ID), |
185 | 184 | KEY DTT_is_primary (DTT_is_primary)"; |
186 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
187 | - $table_name = 'esp_event_meta'; |
|
188 | - $sql = " |
|
185 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | + $table_name = 'esp_event_meta'; |
|
187 | + $sql = " |
|
189 | 188 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
190 | 189 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
191 | 190 | EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -201,34 +200,34 @@ discard block |
||
201 | 200 | EVT_donations TINYINT(1) NULL, |
202 | 201 | PRIMARY KEY (EVTM_ID), |
203 | 202 | KEY EVT_ID (EVT_ID)"; |
204 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | - $table_name = 'esp_event_question_group'; |
|
206 | - $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | + $table_name = 'esp_event_question_group'; |
|
205 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | 206 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
208 | 207 | QSG_ID INT UNSIGNED NOT NULL, |
209 | 208 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
210 | 209 | PRIMARY KEY (EQG_ID), |
211 | 210 | KEY EVT_ID (EVT_ID), |
212 | 211 | KEY QSG_ID (QSG_ID)"; |
213 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
214 | - $table_name = 'esp_event_venue'; |
|
215 | - $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
212 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
213 | + $table_name = 'esp_event_venue'; |
|
214 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
216 | 215 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
217 | 216 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
218 | 217 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
219 | 218 | PRIMARY KEY (EVV_ID)"; |
220 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
221 | - $table_name = 'esp_extra_meta'; |
|
222 | - $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
219 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | + $table_name = 'esp_extra_meta'; |
|
221 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
223 | 222 | OBJ_ID INT(11) DEFAULT NULL, |
224 | 223 | EXM_type VARCHAR(45) DEFAULT NULL, |
225 | 224 | EXM_key VARCHAR(45) DEFAULT NULL, |
226 | 225 | EXM_value TEXT, |
227 | 226 | PRIMARY KEY (EXM_ID), |
228 | 227 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
229 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
230 | - $table_name = 'esp_line_item'; |
|
231 | - $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
228 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
229 | + $table_name = 'esp_line_item'; |
|
230 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
232 | 231 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
233 | 232 | TXN_ID INT(11) DEFAULT NULL, |
234 | 233 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -246,9 +245,9 @@ discard block |
||
246 | 245 | PRIMARY KEY (LIN_ID), |
247 | 246 | KEY LIN_code (LIN_code(191)), |
248 | 247 | KEY TXN_ID (TXN_ID)"; |
249 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
250 | - $table_name = 'esp_log'; |
|
251 | - $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
248 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | + $table_name = 'esp_log'; |
|
250 | + $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
252 | 251 | LOG_time DATETIME DEFAULT NULL, |
253 | 252 | OBJ_ID VARCHAR(45) DEFAULT NULL, |
254 | 253 | OBJ_type VARCHAR(45) DEFAULT NULL, |
@@ -259,18 +258,18 @@ discard block |
||
259 | 258 | KEY LOG_time (LOG_time), |
260 | 259 | KEY OBJ (OBJ_type,OBJ_ID), |
261 | 260 | KEY LOG_type (LOG_type)"; |
262 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
263 | - $table_name = 'esp_message_template'; |
|
264 | - $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
261 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | + $table_name = 'esp_message_template'; |
|
263 | + $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
265 | 264 | GRP_ID INT(10) UNSIGNED NOT NULL, |
266 | 265 | MTP_context VARCHAR(50) NOT NULL, |
267 | 266 | MTP_template_field VARCHAR(30) NOT NULL, |
268 | 267 | MTP_content TEXT NOT NULL, |
269 | 268 | PRIMARY KEY (MTP_ID), |
270 | 269 | KEY GRP_ID (GRP_ID)"; |
271 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | - $table_name = 'esp_message_template_group'; |
|
273 | - $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
270 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
271 | + $table_name = 'esp_message_template_group'; |
|
272 | + $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
274 | 273 | MTP_user_id INT(10) NOT NULL DEFAULT '1', |
275 | 274 | MTP_name VARCHAR(245) NOT NULL DEFAULT '', |
276 | 275 | MTP_description VARCHAR(245) NOT NULL DEFAULT '', |
@@ -282,17 +281,17 @@ discard block |
||
282 | 281 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
283 | 282 | PRIMARY KEY (GRP_ID), |
284 | 283 | KEY MTP_user_id (MTP_user_id)"; |
285 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
286 | - $table_name = 'esp_event_message_template'; |
|
287 | - $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $table_name = 'esp_event_message_template'; |
|
286 | + $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
288 | 287 | EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
289 | 288 | GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
290 | 289 | PRIMARY KEY (EMT_ID), |
291 | 290 | KEY EVT_ID (EVT_ID), |
292 | 291 | KEY GRP_ID (GRP_ID)"; |
293 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | - $table_name = 'esp_payment'; |
|
295 | - $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
292 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
293 | + $table_name = 'esp_payment'; |
|
294 | + $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
296 | 295 | TXN_ID INT(10) UNSIGNED DEFAULT NULL, |
297 | 296 | STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL, |
298 | 297 | PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -309,9 +308,9 @@ discard block |
||
309 | 308 | PRIMARY KEY (PAY_ID), |
310 | 309 | KEY PAY_timestamp (PAY_timestamp), |
311 | 310 | KEY TXN_ID (TXN_ID)"; |
312 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
313 | - $table_name = 'esp_payment_method'; |
|
314 | - $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
311 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
312 | + $table_name = 'esp_payment_method'; |
|
313 | + $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
315 | 314 | PMD_type VARCHAR(124) DEFAULT NULL, |
316 | 315 | PMD_name VARCHAR(255) DEFAULT NULL, |
317 | 316 | PMD_desc TEXT, |
@@ -327,32 +326,32 @@ discard block |
||
327 | 326 | PRIMARY KEY (PMD_ID), |
328 | 327 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
329 | 328 | KEY PMD_type (PMD_type)"; |
330 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
331 | - $table_name = "esp_ticket_price"; |
|
332 | - $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
329 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
330 | + $table_name = "esp_ticket_price"; |
|
331 | + $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
333 | 332 | TKT_ID INT(10) UNSIGNED NOT NULL, |
334 | 333 | PRC_ID INT(10) UNSIGNED NOT NULL, |
335 | 334 | PRIMARY KEY (TKP_ID), |
336 | 335 | KEY TKT_ID (TKT_ID), |
337 | 336 | KEY PRC_ID (PRC_ID)"; |
338 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
339 | - $table_name = "esp_datetime_ticket"; |
|
340 | - $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
337 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
338 | + $table_name = "esp_datetime_ticket"; |
|
339 | + $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
341 | 340 | DTT_ID INT(10) UNSIGNED NOT NULL, |
342 | 341 | TKT_ID INT(10) UNSIGNED NOT NULL, |
343 | 342 | PRIMARY KEY (DTK_ID), |
344 | 343 | KEY DTT_ID (DTT_ID), |
345 | 344 | KEY TKT_ID (TKT_ID)"; |
346 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
347 | - $table_name = "esp_ticket_template"; |
|
348 | - $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
345 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
346 | + $table_name = "esp_ticket_template"; |
|
347 | + $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
349 | 348 | TTM_name VARCHAR(45) NOT NULL, |
350 | 349 | TTM_description TEXT, |
351 | 350 | TTM_file VARCHAR(45), |
352 | 351 | PRIMARY KEY (TTM_ID)"; |
353 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
354 | - $table_name = 'esp_question'; |
|
355 | - $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
352 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
353 | + $table_name = 'esp_question'; |
|
354 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
356 | 355 | QST_display_text TEXT NOT NULL, |
357 | 356 | QST_admin_label VARCHAR(255) NOT NULL, |
358 | 357 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -365,18 +364,18 @@ discard block |
||
365 | 364 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
366 | 365 | PRIMARY KEY (QST_ID), |
367 | 366 | KEY QST_order (QST_order)'; |
368 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
369 | - $table_name = 'esp_question_group_question'; |
|
370 | - $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
367 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
368 | + $table_name = 'esp_question_group_question'; |
|
369 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
371 | 370 | QSG_ID INT UNSIGNED NOT NULL, |
372 | 371 | QST_ID INT UNSIGNED NOT NULL, |
373 | 372 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
374 | 373 | PRIMARY KEY (QGQ_ID), |
375 | 374 | KEY QST_ID (QST_ID), |
376 | 375 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
377 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | - $table_name = 'esp_question_option'; |
|
379 | - $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
376 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
377 | + $table_name = 'esp_question_option'; |
|
378 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
380 | 379 | QSO_value VARCHAR(255) NOT NULL, |
381 | 380 | QSO_desc TEXT NOT NULL, |
382 | 381 | QST_ID INT UNSIGNED NOT NULL, |
@@ -385,9 +384,9 @@ discard block |
||
385 | 384 | PRIMARY KEY (QSO_ID), |
386 | 385 | KEY QST_ID (QST_ID), |
387 | 386 | KEY QSO_order (QSO_order)"; |
388 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
389 | - $table_name = 'esp_registration'; |
|
390 | - $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
387 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | + $table_name = 'esp_registration'; |
|
389 | + $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
391 | 390 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
392 | 391 | ATT_ID BIGINT(20) UNSIGNED NOT NULL, |
393 | 392 | TXN_ID INT(10) UNSIGNED NOT NULL, |
@@ -411,18 +410,18 @@ discard block |
||
411 | 410 | KEY TKT_ID (TKT_ID), |
412 | 411 | KEY EVT_ID (EVT_ID), |
413 | 412 | KEY STS_ID (STS_ID)"; |
414 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
415 | - $table_name = 'esp_registration_payment'; |
|
416 | - $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
413 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
414 | + $table_name = 'esp_registration_payment'; |
|
415 | + $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
417 | 416 | REG_ID INT(10) UNSIGNED NOT NULL, |
418 | 417 | PAY_ID INT(10) UNSIGNED NULL, |
419 | 418 | RPY_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
420 | 419 | PRIMARY KEY (RPY_ID), |
421 | 420 | KEY REG_ID (REG_ID), |
422 | 421 | KEY PAY_ID (PAY_ID)"; |
423 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
424 | - $table_name = 'esp_checkin'; |
|
425 | - $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
422 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
423 | + $table_name = 'esp_checkin'; |
|
424 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
426 | 425 | REG_ID INT(10) UNSIGNED NOT NULL, |
427 | 426 | DTT_ID INT(10) UNSIGNED NOT NULL, |
428 | 427 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -430,9 +429,9 @@ discard block |
||
430 | 429 | PRIMARY KEY (CHK_ID), |
431 | 430 | KEY REG_ID (REG_ID), |
432 | 431 | KEY DTT_ID (DTT_ID)"; |
433 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
434 | - $table_name = 'esp_state'; |
|
435 | - $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | + $table_name = 'esp_state'; |
|
434 | + $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
436 | 435 | CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL, |
437 | 436 | STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL, |
438 | 437 | STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL, |
@@ -440,9 +439,9 @@ discard block |
||
440 | 439 | PRIMARY KEY (STA_ID), |
441 | 440 | KEY STA_abbrev (STA_abbrev), |
442 | 441 | KEY CNT_ISO (CNT_ISO)"; |
443 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
444 | - $table_name = 'esp_status'; |
|
445 | - $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
442 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | + $table_name = 'esp_status'; |
|
444 | + $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL, |
|
446 | 445 | STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL, |
447 | 446 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
448 | 447 | STS_can_edit TINYINT(1) NOT NULL DEFAULT 0, |
@@ -450,9 +449,9 @@ discard block |
||
450 | 449 | STS_open TINYINT(1) NOT NULL DEFAULT 1, |
451 | 450 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
452 | 451 | KEY STS_type (STS_type)"; |
453 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
454 | - $table_name = 'esp_transaction'; |
|
455 | - $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
452 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
453 | + $table_name = 'esp_transaction'; |
|
454 | + $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
456 | 455 | TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
457 | 456 | TXN_total DECIMAL(10,3) DEFAULT '0.00', |
458 | 457 | TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
@@ -464,9 +463,9 @@ discard block |
||
464 | 463 | PRIMARY KEY (TXN_ID), |
465 | 464 | KEY TXN_timestamp (TXN_timestamp), |
466 | 465 | KEY STS_ID (STS_ID)"; |
467 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
468 | - $table_name = 'esp_venue_meta'; |
|
469 | - $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
466 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
467 | + $table_name = 'esp_venue_meta'; |
|
468 | + $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
470 | 469 | VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, |
471 | 470 | VNU_address VARCHAR(255) DEFAULT NULL, |
472 | 471 | VNU_address2 VARCHAR(255) DEFAULT NULL, |
@@ -485,10 +484,10 @@ discard block |
||
485 | 484 | KEY VNU_ID (VNU_ID), |
486 | 485 | KEY STA_ID (STA_ID), |
487 | 486 | KEY CNT_ISO (CNT_ISO)"; |
488 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
489 | - //modified tables |
|
490 | - $table_name = "esp_price"; |
|
491 | - $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
487 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | + //modified tables |
|
489 | + $table_name = "esp_price"; |
|
490 | + $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
492 | 491 | PRT_ID TINYINT(3) UNSIGNED NOT NULL, |
493 | 492 | PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00', |
494 | 493 | PRC_name VARCHAR(245) NOT NULL, |
@@ -501,9 +500,9 @@ discard block |
||
501 | 500 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
502 | 501 | PRIMARY KEY (PRC_ID), |
503 | 502 | KEY PRT_ID (PRT_ID)"; |
504 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
505 | - $table_name = "esp_price_type"; |
|
506 | - $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
503 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
504 | + $table_name = "esp_price_type"; |
|
505 | + $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
507 | 506 | PRT_name VARCHAR(45) NOT NULL, |
508 | 507 | PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', |
509 | 508 | PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0', |
@@ -512,9 +511,9 @@ discard block |
||
512 | 511 | PRT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
513 | 512 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
514 | 513 | PRIMARY KEY (PRT_ID)"; |
515 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
516 | - $table_name = "esp_ticket"; |
|
517 | - $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
514 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
515 | + $table_name = "esp_ticket"; |
|
516 | + $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
518 | 517 | TTM_ID INT(10) UNSIGNED NOT NULL, |
519 | 518 | TKT_name VARCHAR(245) NOT NULL DEFAULT '', |
520 | 519 | TKT_description TEXT NOT NULL, |
@@ -536,9 +535,9 @@ discard block |
||
536 | 535 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
537 | 536 | PRIMARY KEY (TKT_ID), |
538 | 537 | KEY TKT_start_date (TKT_start_date)"; |
539 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
540 | - $table_name = 'esp_question_group'; |
|
541 | - $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
538 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | + $table_name = 'esp_question_group'; |
|
540 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
542 | 541 | QSG_name VARCHAR(255) NOT NULL, |
543 | 542 | QSG_identifier VARCHAR(100) NOT NULL, |
544 | 543 | QSG_desc TEXT NULL, |
@@ -551,38 +550,38 @@ discard block |
||
551 | 550 | PRIMARY KEY (QSG_ID), |
552 | 551 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
553 | 552 | KEY QSG_order (QSG_order)'; |
554 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
555 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
556 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
557 | - //(because many need to convert old string states to foreign keys into the states table) |
|
558 | - $script_4_1_defaults->insert_default_states(); |
|
559 | - $script_4_1_defaults->insert_default_countries(); |
|
560 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
561 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
562 | - $script_4_5_defaults->insert_default_price_types(); |
|
563 | - $script_4_5_defaults->insert_default_prices(); |
|
564 | - $script_4_5_defaults->insert_default_tickets(); |
|
565 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
566 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
567 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
568 | - $script_4_6_defaults->insert_default_currencies(); |
|
569 | - return true; |
|
570 | - } |
|
553 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
554 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
555 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
556 | + //(because many need to convert old string states to foreign keys into the states table) |
|
557 | + $script_4_1_defaults->insert_default_states(); |
|
558 | + $script_4_1_defaults->insert_default_countries(); |
|
559 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
560 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
561 | + $script_4_5_defaults->insert_default_price_types(); |
|
562 | + $script_4_5_defaults->insert_default_prices(); |
|
563 | + $script_4_5_defaults->insert_default_tickets(); |
|
564 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
565 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
566 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
567 | + $script_4_6_defaults->insert_default_currencies(); |
|
568 | + return true; |
|
569 | + } |
|
571 | 570 | |
572 | 571 | |
573 | 572 | |
574 | - /** |
|
575 | - * @return boolean |
|
576 | - */ |
|
577 | - public function schema_changes_after_migration() |
|
578 | - { |
|
579 | - return true; |
|
580 | - } |
|
573 | + /** |
|
574 | + * @return boolean |
|
575 | + */ |
|
576 | + public function schema_changes_after_migration() |
|
577 | + { |
|
578 | + return true; |
|
579 | + } |
|
581 | 580 | |
582 | 581 | |
583 | 582 | |
584 | - public function migration_page_hooks() |
|
585 | - { |
|
586 | - } |
|
583 | + public function migration_page_hooks() |
|
584 | + { |
|
585 | + } |
|
587 | 586 | } |
588 | 587 | // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php |
589 | 588 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // unfortunately, this needs to be done upon INCLUSION of this file, |
16 | 16 | // instead of construction, because it only gets constructed on first page load |
17 | 17 | // (all other times it gets resurrected from a wordpress option) |
18 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
|
18 | +$stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
|
19 | 19 | $class_to_filepath = array(); |
20 | 20 | foreach ($stages as $filepath) { |
21 | 21 | $matches = array(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return true; |
80 | 80 | } elseif ( ! $version_string) { |
81 | 81 | //no version string provided... this must be pre 4.3 |
82 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
83 | 83 | } else { |
84 | 84 | return false; |
85 | 85 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function schema_changes_before_migration() |
104 | 104 | { |
105 | 105 | //relies on 4.1's EEH_Activation::create_table |
106 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
106 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
107 | 107 | $table_name = 'esp_answer'; |
108 | 108 | $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
109 | 109 | REG_ID INT UNSIGNED NOT NULL, |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @param EE_Event $evtobj The Event object we're attaching data to |
203 | 203 | * @param array $data The request data from the form |
204 | 204 | * |
205 | - * @return bool success or fail |
|
205 | + * @return boolean|null success or fail |
|
206 | 206 | */ |
207 | 207 | public function dtt_and_tickets_caf_update($evtobj, $data) |
208 | 208 | { |
@@ -980,6 +980,9 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | |
983 | + /** |
|
984 | + * @param integer $dttrow |
|
985 | + */ |
|
983 | 986 | protected function _get_datetime_row( |
984 | 987 | $dttrow, |
985 | 988 | EE_Datetime $dtt, |
@@ -1012,6 +1015,7 @@ discard block |
||
1012 | 1015 | * object. |
1013 | 1016 | * @param bool $default Whether a default row is being generated or not. |
1014 | 1017 | * @param EE_Datetime[] $all_dtts This is the array of all datetimes used in the editor. |
1018 | + * @param EE_Datetime|null $dtt |
|
1015 | 1019 | * |
1016 | 1020 | * @return string Generated edit row. |
1017 | 1021 | */ |
@@ -1056,6 +1060,10 @@ discard block |
||
1056 | 1060 | } |
1057 | 1061 | |
1058 | 1062 | |
1063 | + /** |
|
1064 | + * @param EE_Datetime|null $dtt |
|
1065 | + * @param boolean $default |
|
1066 | + */ |
|
1059 | 1067 | protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) |
1060 | 1068 | { |
1061 | 1069 | |
@@ -1305,6 +1313,9 @@ discard block |
||
1305 | 1313 | } |
1306 | 1314 | |
1307 | 1315 | |
1316 | + /** |
|
1317 | + * @param integer $tktrow |
|
1318 | + */ |
|
1308 | 1319 | protected function _get_tax_rows($tktrow, $ticket) |
1309 | 1320 | { |
1310 | 1321 | $tax_rows = ''; |
@@ -1340,6 +1351,9 @@ discard block |
||
1340 | 1351 | } |
1341 | 1352 | |
1342 | 1353 | |
1354 | + /** |
|
1355 | + * @param boolean $default |
|
1356 | + */ |
|
1343 | 1357 | protected function _get_ticket_price_row( |
1344 | 1358 | $tktrow, |
1345 | 1359 | $prcrow, |
@@ -1475,6 +1489,9 @@ discard block |
||
1475 | 1489 | } |
1476 | 1490 | |
1477 | 1491 | |
1492 | + /** |
|
1493 | + * @param boolean $default |
|
1494 | + */ |
|
1478 | 1495 | protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) |
1479 | 1496 | { |
1480 | 1497 | $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -31,1535 +31,1535 @@ discard block |
||
31 | 31 | class espresso_events_Pricing_Hooks extends EE_Admin_Hooks |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * This property is just used to hold the status of whether an event is currently being |
|
36 | - * created (true) or edited (false) |
|
37 | - * @access protected |
|
38 | - * @var bool |
|
39 | - */ |
|
40 | - protected $_is_creating_event; |
|
34 | + /** |
|
35 | + * This property is just used to hold the status of whether an event is currently being |
|
36 | + * created (true) or edited (false) |
|
37 | + * @access protected |
|
38 | + * @var bool |
|
39 | + */ |
|
40 | + protected $_is_creating_event; |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * Used to contain the format strings for date and time that will be used for php date and |
|
45 | - * time. |
|
46 | - * |
|
47 | - * Is set in the _set_hooks_properties() method. |
|
48 | - * |
|
49 | - * @var array |
|
50 | - */ |
|
51 | - protected $_date_format_strings; |
|
43 | + /** |
|
44 | + * Used to contain the format strings for date and time that will be used for php date and |
|
45 | + * time. |
|
46 | + * |
|
47 | + * Is set in the _set_hooks_properties() method. |
|
48 | + * |
|
49 | + * @var array |
|
50 | + */ |
|
51 | + protected $_date_format_strings; |
|
52 | 52 | |
53 | 53 | |
54 | - protected function _set_hooks_properties() |
|
55 | - { |
|
56 | - $this->_name = 'pricing'; |
|
57 | - |
|
58 | - //capability check |
|
59 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', |
|
60 | - 'advanced_ticket_datetime_metabox') |
|
61 | - ) { |
|
62 | - return; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - //if we were going to add our own metaboxes we'd use the below. |
|
67 | - $this->_metaboxes = array( |
|
68 | - 0 => array( |
|
69 | - 'page_route' => array('edit', 'create_new'), |
|
70 | - 'func' => 'pricing_metabox', |
|
71 | - 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
|
72 | - 'priority' => 'high', |
|
73 | - 'context' => 'normal' |
|
74 | - ), |
|
75 | - |
|
76 | - );/**/ |
|
77 | - |
|
78 | - $this->_remove_metaboxes = array( |
|
79 | - 0 => array( |
|
80 | - 'page_route' => array('edit', 'create_new'), |
|
81 | - 'id' => 'espresso_event_editor_tickets', |
|
82 | - 'context' => 'normal' |
|
83 | - ) |
|
84 | - ); |
|
85 | - |
|
86 | - /** |
|
87 | - * Format strings for date and time. Defaults are existing behaviour from 4.1. |
|
88 | - * Note, that if you return null as the value for 'date', and 'time' in the array, then |
|
89 | - * EE will automatically use the set wp_options, 'date_format', and 'time_format'. |
|
90 | - * |
|
91 | - * @since 4.6.7 |
|
92 | - * |
|
93 | - * @var array Expected an array returned with 'date' and 'time' keys. |
|
94 | - */ |
|
95 | - $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', |
|
96 | - array( |
|
97 | - 'date' => 'Y-m-d', |
|
98 | - 'time' => 'h:i a' |
|
99 | - )); |
|
100 | - |
|
101 | - //validate |
|
102 | - $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
103 | - $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
104 | - |
|
105 | - //validate format strings |
|
106 | - $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
107 | - if (is_array($format_validation)) { |
|
108 | - $msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', |
|
109 | - 'event_espresso'), |
|
110 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>'; |
|
111 | - foreach ($format_validation as $error) { |
|
112 | - $msg .= '<li>' . $error . '</li>'; |
|
113 | - } |
|
114 | - $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', |
|
115 | - 'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>'; |
|
116 | - EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
117 | - $this->_date_format_strings = array( |
|
118 | - 'date' => 'Y-m-d', |
|
119 | - 'time' => 'h:i a' |
|
120 | - ); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - $this->_scripts_styles = array( |
|
125 | - 'registers' => array( |
|
126 | - 'ee-tickets-datetimes-css' => array( |
|
127 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
128 | - 'type' => 'css' |
|
129 | - ), |
|
130 | - 'ee-dtt-ticket-metabox' => array( |
|
131 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
132 | - 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
|
133 | - ) |
|
134 | - ), |
|
135 | - 'deregisters' => array( |
|
136 | - 'event-editor-css' => array('type' => 'css'), |
|
137 | - 'event-datetime-metabox' => array('type' => 'js') |
|
138 | - ), |
|
139 | - 'enqueues' => array( |
|
140 | - 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
141 | - 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
142 | - ), |
|
143 | - 'localize' => array( |
|
144 | - 'ee-dtt-ticket-metabox' => array( |
|
145 | - 'DTT_TRASH_BLOCK' => array( |
|
146 | - 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', |
|
147 | - 'event_espresso'), |
|
148 | - 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', |
|
149 | - 'event_espresso'), |
|
150 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', |
|
151 | - 'event_espresso') . '</button>', |
|
152 | - 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', |
|
153 | - 'event_espresso'), |
|
154 | - 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', |
|
155 | - 'event_espresso'), |
|
156 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', |
|
157 | - 'event_espresso') . '</button>' |
|
158 | - ), |
|
159 | - 'DTT_ERROR_MSG' => array( |
|
160 | - 'no_ticket_name' => __('General Admission', 'event_espresso'), |
|
161 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', |
|
162 | - 'event_espresso') . '</button></div>' |
|
163 | - ), |
|
164 | - 'DTT_OVERSELL_WARNING' => array( |
|
165 | - 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', |
|
166 | - 'event_espresso'), |
|
167 | - 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', |
|
168 | - 'event_espresso') |
|
169 | - ), |
|
170 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], |
|
171 | - $this->_date_format_strings['time']), |
|
172 | - 'DTT_START_OF_WEEK' => array('dayValue' => (int)get_option('start_of_week')) |
|
173 | - ) |
|
174 | - ) |
|
175 | - ); |
|
176 | - |
|
177 | - |
|
178 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', |
|
179 | - array($this, 'autosave_handling'), 10); |
|
180 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
181 | - array($this, 'caf_updates'), 10); |
|
182 | - } |
|
54 | + protected function _set_hooks_properties() |
|
55 | + { |
|
56 | + $this->_name = 'pricing'; |
|
57 | + |
|
58 | + //capability check |
|
59 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', |
|
60 | + 'advanced_ticket_datetime_metabox') |
|
61 | + ) { |
|
62 | + return; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + //if we were going to add our own metaboxes we'd use the below. |
|
67 | + $this->_metaboxes = array( |
|
68 | + 0 => array( |
|
69 | + 'page_route' => array('edit', 'create_new'), |
|
70 | + 'func' => 'pricing_metabox', |
|
71 | + 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
|
72 | + 'priority' => 'high', |
|
73 | + 'context' => 'normal' |
|
74 | + ), |
|
75 | + |
|
76 | + );/**/ |
|
77 | + |
|
78 | + $this->_remove_metaboxes = array( |
|
79 | + 0 => array( |
|
80 | + 'page_route' => array('edit', 'create_new'), |
|
81 | + 'id' => 'espresso_event_editor_tickets', |
|
82 | + 'context' => 'normal' |
|
83 | + ) |
|
84 | + ); |
|
85 | + |
|
86 | + /** |
|
87 | + * Format strings for date and time. Defaults are existing behaviour from 4.1. |
|
88 | + * Note, that if you return null as the value for 'date', and 'time' in the array, then |
|
89 | + * EE will automatically use the set wp_options, 'date_format', and 'time_format'. |
|
90 | + * |
|
91 | + * @since 4.6.7 |
|
92 | + * |
|
93 | + * @var array Expected an array returned with 'date' and 'time' keys. |
|
94 | + */ |
|
95 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', |
|
96 | + array( |
|
97 | + 'date' => 'Y-m-d', |
|
98 | + 'time' => 'h:i a' |
|
99 | + )); |
|
100 | + |
|
101 | + //validate |
|
102 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
103 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
104 | + |
|
105 | + //validate format strings |
|
106 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
107 | + if (is_array($format_validation)) { |
|
108 | + $msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', |
|
109 | + 'event_espresso'), |
|
110 | + $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>'; |
|
111 | + foreach ($format_validation as $error) { |
|
112 | + $msg .= '<li>' . $error . '</li>'; |
|
113 | + } |
|
114 | + $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', |
|
115 | + 'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>'; |
|
116 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
117 | + $this->_date_format_strings = array( |
|
118 | + 'date' => 'Y-m-d', |
|
119 | + 'time' => 'h:i a' |
|
120 | + ); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + $this->_scripts_styles = array( |
|
125 | + 'registers' => array( |
|
126 | + 'ee-tickets-datetimes-css' => array( |
|
127 | + 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
128 | + 'type' => 'css' |
|
129 | + ), |
|
130 | + 'ee-dtt-ticket-metabox' => array( |
|
131 | + 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
132 | + 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
|
133 | + ) |
|
134 | + ), |
|
135 | + 'deregisters' => array( |
|
136 | + 'event-editor-css' => array('type' => 'css'), |
|
137 | + 'event-datetime-metabox' => array('type' => 'js') |
|
138 | + ), |
|
139 | + 'enqueues' => array( |
|
140 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
141 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
142 | + ), |
|
143 | + 'localize' => array( |
|
144 | + 'ee-dtt-ticket-metabox' => array( |
|
145 | + 'DTT_TRASH_BLOCK' => array( |
|
146 | + 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', |
|
147 | + 'event_espresso'), |
|
148 | + 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', |
|
149 | + 'event_espresso'), |
|
150 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', |
|
151 | + 'event_espresso') . '</button>', |
|
152 | + 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', |
|
153 | + 'event_espresso'), |
|
154 | + 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', |
|
155 | + 'event_espresso'), |
|
156 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', |
|
157 | + 'event_espresso') . '</button>' |
|
158 | + ), |
|
159 | + 'DTT_ERROR_MSG' => array( |
|
160 | + 'no_ticket_name' => __('General Admission', 'event_espresso'), |
|
161 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', |
|
162 | + 'event_espresso') . '</button></div>' |
|
163 | + ), |
|
164 | + 'DTT_OVERSELL_WARNING' => array( |
|
165 | + 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', |
|
166 | + 'event_espresso'), |
|
167 | + 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', |
|
168 | + 'event_espresso') |
|
169 | + ), |
|
170 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], |
|
171 | + $this->_date_format_strings['time']), |
|
172 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int)get_option('start_of_week')) |
|
173 | + ) |
|
174 | + ) |
|
175 | + ); |
|
176 | + |
|
177 | + |
|
178 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', |
|
179 | + array($this, 'autosave_handling'), 10); |
|
180 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
181 | + array($this, 'caf_updates'), 10); |
|
182 | + } |
|
183 | 183 | |
184 | 184 | |
185 | - public function caf_updates($update_callbacks) |
|
186 | - { |
|
187 | - foreach ($update_callbacks as $key => $callback) { |
|
188 | - if ($callback[1] == '_default_tickets_update') { |
|
189 | - unset($update_callbacks[$key]); |
|
190 | - } |
|
191 | - } |
|
192 | - |
|
193 | - $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
194 | - |
|
195 | - return $update_callbacks; |
|
196 | - } |
|
185 | + public function caf_updates($update_callbacks) |
|
186 | + { |
|
187 | + foreach ($update_callbacks as $key => $callback) { |
|
188 | + if ($callback[1] == '_default_tickets_update') { |
|
189 | + unset($update_callbacks[$key]); |
|
190 | + } |
|
191 | + } |
|
192 | + |
|
193 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
194 | + |
|
195 | + return $update_callbacks; |
|
196 | + } |
|
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * Handles saving everything related to Tickets (datetimes, tickets, prices) |
|
201 | - * |
|
202 | - * @param EE_Event $evtobj The Event object we're attaching data to |
|
203 | - * @param array $data The request data from the form |
|
204 | - * |
|
205 | - * @return bool success or fail |
|
206 | - */ |
|
207 | - public function dtt_and_tickets_caf_update($evtobj, $data) |
|
208 | - { |
|
209 | - //first we need to start with datetimes cause they are the "root" items attached to events. |
|
210 | - $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
211 | - //next tackle the tickets (and prices?) |
|
212 | - $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
213 | - } |
|
199 | + /** |
|
200 | + * Handles saving everything related to Tickets (datetimes, tickets, prices) |
|
201 | + * |
|
202 | + * @param EE_Event $evtobj The Event object we're attaching data to |
|
203 | + * @param array $data The request data from the form |
|
204 | + * |
|
205 | + * @return bool success or fail |
|
206 | + */ |
|
207 | + public function dtt_and_tickets_caf_update($evtobj, $data) |
|
208 | + { |
|
209 | + //first we need to start with datetimes cause they are the "root" items attached to events. |
|
210 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
211 | + //next tackle the tickets (and prices?) |
|
212 | + $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
213 | + } |
|
214 | 214 | |
215 | 215 | |
216 | - /** |
|
217 | - * update event_datetimes |
|
218 | - * |
|
219 | - * @param EE_Event $evt_obj Event being updated |
|
220 | - * @param array $data the request data from the form |
|
221 | - * |
|
222 | - * @return EE_Datetime[] |
|
223 | - */ |
|
224 | - protected function _update_dtts($evt_obj, $data) |
|
225 | - { |
|
226 | - $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : null; |
|
227 | - $saved_dtt_ids = array(); |
|
228 | - $saved_dtt_objs = array(); |
|
229 | - |
|
230 | - foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
231 | - //trim all values to ensure any excess whitespace is removed. |
|
232 | - $dtt = array_map( |
|
233 | - function ($datetime_data) { |
|
234 | - return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
|
235 | - }, |
|
236 | - $dtt |
|
237 | - ); |
|
238 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
239 | - $datetime_values = array( |
|
240 | - 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
241 | - 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
242 | - 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
243 | - 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
|
244 | - 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
|
245 | - 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
246 | - 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
247 | - ); |
|
216 | + /** |
|
217 | + * update event_datetimes |
|
218 | + * |
|
219 | + * @param EE_Event $evt_obj Event being updated |
|
220 | + * @param array $data the request data from the form |
|
221 | + * |
|
222 | + * @return EE_Datetime[] |
|
223 | + */ |
|
224 | + protected function _update_dtts($evt_obj, $data) |
|
225 | + { |
|
226 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : null; |
|
227 | + $saved_dtt_ids = array(); |
|
228 | + $saved_dtt_objs = array(); |
|
229 | + |
|
230 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
231 | + //trim all values to ensure any excess whitespace is removed. |
|
232 | + $dtt = array_map( |
|
233 | + function ($datetime_data) { |
|
234 | + return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
|
235 | + }, |
|
236 | + $dtt |
|
237 | + ); |
|
238 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
239 | + $datetime_values = array( |
|
240 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
241 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
242 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
243 | + 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
|
244 | + 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
|
245 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
246 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
247 | + ); |
|
248 | 248 | |
249 | - //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
|
249 | + //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
|
250 | 250 | |
251 | - if ( ! empty($dtt['DTT_ID'])) { |
|
252 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
251 | + if ( ! empty($dtt['DTT_ID'])) { |
|
252 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
253 | 253 | |
254 | - //set date and time format according to what is set in this class. |
|
255 | - $DTM->set_date_format($this->_date_format_strings['date']); |
|
256 | - $DTM->set_time_format($this->_date_format_strings['time']); |
|
254 | + //set date and time format according to what is set in this class. |
|
255 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
256 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
257 | 257 | |
258 | - foreach ($datetime_values as $field => $value) { |
|
259 | - $DTM->set($field, $value); |
|
260 | - } |
|
258 | + foreach ($datetime_values as $field => $value) { |
|
259 | + $DTM->set($field, $value); |
|
260 | + } |
|
261 | 261 | |
262 | - // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
|
263 | - // We need to do this so we dont' TRASH the parent DTT.(save the ID for both key and value to avoid duplications) |
|
264 | - $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
|
262 | + // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
|
263 | + // We need to do this so we dont' TRASH the parent DTT.(save the ID for both key and value to avoid duplications) |
|
264 | + $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
|
265 | 265 | |
266 | - } else { |
|
267 | - $DTM = EE_Registry::instance()->load_class( |
|
268 | - 'Datetime', |
|
269 | - array( |
|
270 | - $datetime_values, |
|
271 | - $timezone, |
|
272 | - array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
273 | - ), |
|
274 | - false, |
|
275 | - false |
|
276 | - ); |
|
266 | + } else { |
|
267 | + $DTM = EE_Registry::instance()->load_class( |
|
268 | + 'Datetime', |
|
269 | + array( |
|
270 | + $datetime_values, |
|
271 | + $timezone, |
|
272 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
273 | + ), |
|
274 | + false, |
|
275 | + false |
|
276 | + ); |
|
277 | 277 | |
278 | - foreach ($datetime_values as $field => $value) { |
|
279 | - $DTM->set($field, $value); |
|
280 | - } |
|
281 | - } |
|
278 | + foreach ($datetime_values as $field => $value) { |
|
279 | + $DTM->set($field, $value); |
|
280 | + } |
|
281 | + } |
|
282 | 282 | |
283 | 283 | |
284 | - $DTM->save(); |
|
285 | - $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
286 | - $evt_obj->save(); |
|
284 | + $DTM->save(); |
|
285 | + $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
286 | + $evt_obj->save(); |
|
287 | 287 | |
288 | - //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
|
289 | - if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
290 | - $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
291 | - $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
|
292 | - $DTM->save(); |
|
293 | - } |
|
288 | + //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
|
289 | + if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
290 | + $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
291 | + $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
|
292 | + $DTM->save(); |
|
293 | + } |
|
294 | 294 | |
295 | - // now we have to make sure we add the new DTT_ID to the $saved_dtt_ids array |
|
296 | - // because it is possible there was a new one created for the autosave. |
|
297 | - // (save the ID for both key and value to avoid duplications) |
|
298 | - $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
|
299 | - $saved_dtt_objs[$row] = $DTM; |
|
295 | + // now we have to make sure we add the new DTT_ID to the $saved_dtt_ids array |
|
296 | + // because it is possible there was a new one created for the autosave. |
|
297 | + // (save the ID for both key and value to avoid duplications) |
|
298 | + $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
|
299 | + $saved_dtt_objs[$row] = $DTM; |
|
300 | 300 | |
301 | - //todo if ANY of these updates fail then we want the appropriate global error message. |
|
302 | - } |
|
303 | - |
|
304 | - //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
|
305 | - $old_datetimes = explode(',', $data['datetime_IDs']); |
|
306 | - $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
|
307 | - |
|
308 | - if (is_array($old_datetimes)) { |
|
309 | - $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
310 | - foreach ($dtts_to_delete as $id) { |
|
311 | - $id = absint($id); |
|
312 | - if (empty($id)) { |
|
313 | - continue; |
|
314 | - } |
|
301 | + //todo if ANY of these updates fail then we want the appropriate global error message. |
|
302 | + } |
|
303 | + |
|
304 | + //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
|
305 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
306 | + $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
|
307 | + |
|
308 | + if (is_array($old_datetimes)) { |
|
309 | + $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
310 | + foreach ($dtts_to_delete as $id) { |
|
311 | + $id = absint($id); |
|
312 | + if (empty($id)) { |
|
313 | + continue; |
|
314 | + } |
|
315 | 315 | |
316 | - $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
|
316 | + $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
|
317 | 317 | |
318 | - //remove tkt relationships. |
|
319 | - $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
|
320 | - foreach ($related_tickets as $tkt) { |
|
321 | - $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
|
322 | - } |
|
318 | + //remove tkt relationships. |
|
319 | + $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
|
320 | + foreach ($related_tickets as $tkt) { |
|
321 | + $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
|
322 | + } |
|
323 | 323 | |
324 | - $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
325 | - $dtt_to_remove->refresh_cache_of_related_objects(); |
|
324 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
325 | + $dtt_to_remove->refresh_cache_of_related_objects(); |
|
326 | 326 | |
327 | - } |
|
328 | - } |
|
327 | + } |
|
328 | + } |
|
329 | 329 | |
330 | - return $saved_dtt_objs; |
|
331 | - } |
|
330 | + return $saved_dtt_objs; |
|
331 | + } |
|
332 | 332 | |
333 | 333 | |
334 | - /** |
|
335 | - * update tickets |
|
336 | - * |
|
337 | - * @param EE_Event $evtobj Event object being updated |
|
338 | - * @param EE_Datetime[] $saved_dtts an array of datetime ids being updated |
|
339 | - * @param array $data incoming request data |
|
340 | - * |
|
341 | - * @return EE_Ticket[] |
|
342 | - */ |
|
343 | - protected function _update_tkts($evtobj, $saved_dtts, $data) |
|
344 | - { |
|
345 | - |
|
346 | - $new_tkt = null; |
|
347 | - $new_default = null; |
|
348 | - //stripslashes because WP filtered the $_POST ($data) array to add slashes |
|
349 | - $data = stripslashes_deep($data); |
|
350 | - $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : null; |
|
351 | - $saved_tickets = $dtts_on_existing = array(); |
|
352 | - $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
353 | - |
|
354 | - //load money helper |
|
355 | - |
|
356 | - foreach ($data['edit_tickets'] as $row => $tkt) { |
|
334 | + /** |
|
335 | + * update tickets |
|
336 | + * |
|
337 | + * @param EE_Event $evtobj Event object being updated |
|
338 | + * @param EE_Datetime[] $saved_dtts an array of datetime ids being updated |
|
339 | + * @param array $data incoming request data |
|
340 | + * |
|
341 | + * @return EE_Ticket[] |
|
342 | + */ |
|
343 | + protected function _update_tkts($evtobj, $saved_dtts, $data) |
|
344 | + { |
|
345 | + |
|
346 | + $new_tkt = null; |
|
347 | + $new_default = null; |
|
348 | + //stripslashes because WP filtered the $_POST ($data) array to add slashes |
|
349 | + $data = stripslashes_deep($data); |
|
350 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : null; |
|
351 | + $saved_tickets = $dtts_on_existing = array(); |
|
352 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
353 | + |
|
354 | + //load money helper |
|
355 | + |
|
356 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
357 | 357 | |
358 | - $update_prices = $create_new_TKT = false; |
|
358 | + $update_prices = $create_new_TKT = false; |
|
359 | 359 | |
360 | - //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
|
360 | + //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
|
361 | 361 | |
362 | - $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
363 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
364 | - $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
|
365 | - $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
|
362 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
363 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
364 | + $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
|
365 | + $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
|
366 | 366 | |
367 | - // trim inputs to ensure any excess whitespace is removed. |
|
368 | - $tkt = array_map( |
|
369 | - function ($ticket_data) { |
|
370 | - return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
|
371 | - }, |
|
372 | - $tkt |
|
373 | - ); |
|
367 | + // trim inputs to ensure any excess whitespace is removed. |
|
368 | + $tkt = array_map( |
|
369 | + function ($ticket_data) { |
|
370 | + return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
|
371 | + }, |
|
372 | + $tkt |
|
373 | + ); |
|
374 | 374 | |
375 | - //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
|
376 | - //note incoming ['TKT_price'] value is already in standard notation (via js). |
|
377 | - $ticket_price = isset($tkt['TKT_price']) ? round((float)$tkt['TKT_price'], 3) : 0; |
|
375 | + //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
|
376 | + //note incoming ['TKT_price'] value is already in standard notation (via js). |
|
377 | + $ticket_price = isset($tkt['TKT_price']) ? round((float)$tkt['TKT_price'], 3) : 0; |
|
378 | 378 | |
379 | - //note incoming base price needs converted from localized value. |
|
380 | - $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
381 | - //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
|
382 | - $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
|
383 | - $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
379 | + //note incoming base price needs converted from localized value. |
|
380 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
381 | + //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
|
382 | + $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
|
383 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
384 | 384 | |
385 | - $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
|
385 | + $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
|
386 | 386 | |
387 | - $now = null; |
|
388 | - if (empty($tkt['TKT_start_date'])) { |
|
389 | - //lets' use now in the set timezone. |
|
390 | - $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
391 | - $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
392 | - } |
|
387 | + $now = null; |
|
388 | + if (empty($tkt['TKT_start_date'])) { |
|
389 | + //lets' use now in the set timezone. |
|
390 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
391 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
392 | + } |
|
393 | 393 | |
394 | - if (empty($tkt['TKT_end_date'])) { |
|
395 | - /** |
|
396 | - * set the TKT_end_date to the first datetime attached to the ticket. |
|
397 | - */ |
|
398 | - $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
399 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time']); |
|
400 | - } |
|
394 | + if (empty($tkt['TKT_end_date'])) { |
|
395 | + /** |
|
396 | + * set the TKT_end_date to the first datetime attached to the ticket. |
|
397 | + */ |
|
398 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
399 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time']); |
|
400 | + } |
|
401 | 401 | |
402 | - $TKT_values = array( |
|
403 | - 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
404 | - 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
405 | - 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
406 | - 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', |
|
407 | - 'event_espresso') ? $tkt['TKT_description'] : '', |
|
408 | - 'TKT_start_date' => $tkt['TKT_start_date'], |
|
409 | - 'TKT_end_date' => $tkt['TKT_end_date'], |
|
410 | - 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
411 | - 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
412 | - 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
413 | - 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
414 | - 'TKT_row' => $row, |
|
415 | - 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
416 | - 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
417 | - 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
418 | - 'TKT_price' => $ticket_price |
|
419 | - ); |
|
402 | + $TKT_values = array( |
|
403 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
404 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
405 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
406 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', |
|
407 | + 'event_espresso') ? $tkt['TKT_description'] : '', |
|
408 | + 'TKT_start_date' => $tkt['TKT_start_date'], |
|
409 | + 'TKT_end_date' => $tkt['TKT_end_date'], |
|
410 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
411 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
412 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
413 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
414 | + 'TKT_row' => $row, |
|
415 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
416 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
417 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
418 | + 'TKT_price' => $ticket_price |
|
419 | + ); |
|
420 | 420 | |
421 | 421 | |
422 | - //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
|
423 | - if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
424 | - $TKT_values['TKT_ID'] = 0; |
|
425 | - $TKT_values['TKT_is_default'] = 0; |
|
426 | - $update_prices = true; |
|
427 | - } |
|
422 | + //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
|
423 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
424 | + $TKT_values['TKT_ID'] = 0; |
|
425 | + $TKT_values['TKT_is_default'] = 0; |
|
426 | + $update_prices = true; |
|
427 | + } |
|
428 | 428 | |
429 | - // if we have a TKT_ID then we need to get that existing TKT_obj and update it |
|
430 | - // we actually do our saves ahead of doing any add_relations to |
|
431 | - // because its entirely possible that this ticket wasn't removed or added to any datetime in the session |
|
432 | - // but DID have it's items modified. |
|
433 | - // keep in mind that if the TKT has been sold (and we have changed pricing information), |
|
434 | - // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
|
435 | - if (absint($TKT_values['TKT_ID'])) { |
|
436 | - $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
437 | - if ($TKT instanceof EE_Ticket) { |
|
429 | + // if we have a TKT_ID then we need to get that existing TKT_obj and update it |
|
430 | + // we actually do our saves ahead of doing any add_relations to |
|
431 | + // because its entirely possible that this ticket wasn't removed or added to any datetime in the session |
|
432 | + // but DID have it's items modified. |
|
433 | + // keep in mind that if the TKT has been sold (and we have changed pricing information), |
|
434 | + // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
|
435 | + if (absint($TKT_values['TKT_ID'])) { |
|
436 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
437 | + if ($TKT instanceof EE_Ticket) { |
|
438 | 438 | |
439 | - $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
440 | - // are there any registrations using this ticket ? |
|
441 | - $tickets_sold = $TKT->count_related( |
|
442 | - 'Registration', |
|
443 | - array( |
|
444 | - array( |
|
445 | - 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
446 | - ) |
|
447 | - ) |
|
448 | - ); |
|
449 | - //set ticket formats |
|
450 | - $TKT->set_date_format($this->_date_format_strings['date']); |
|
451 | - $TKT->set_time_format($this->_date_format_strings['time']); |
|
439 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
440 | + // are there any registrations using this ticket ? |
|
441 | + $tickets_sold = $TKT->count_related( |
|
442 | + 'Registration', |
|
443 | + array( |
|
444 | + array( |
|
445 | + 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
446 | + ) |
|
447 | + ) |
|
448 | + ); |
|
449 | + //set ticket formats |
|
450 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
451 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
452 | 452 | |
453 | - // let's just check the total price for the existing ticket |
|
454 | - // and determine if it matches the new total price. |
|
455 | - // if they are different then we create a new ticket (if tkts sold) |
|
456 | - // if they aren't different then we go ahead and modify existing ticket. |
|
457 | - $create_new_TKT = $tickets_sold > 0 && $ticket_price != $TKT->price() && ! $TKT->deleted() |
|
458 | - ? true : false; |
|
453 | + // let's just check the total price for the existing ticket |
|
454 | + // and determine if it matches the new total price. |
|
455 | + // if they are different then we create a new ticket (if tkts sold) |
|
456 | + // if they aren't different then we go ahead and modify existing ticket. |
|
457 | + $create_new_TKT = $tickets_sold > 0 && $ticket_price != $TKT->price() && ! $TKT->deleted() |
|
458 | + ? true : false; |
|
459 | 459 | |
460 | - //set new values |
|
461 | - foreach ($TKT_values as $field => $value) { |
|
462 | - if ($field === 'TKT_qty') { |
|
463 | - $TKT->set_qty($value); |
|
464 | - } else { |
|
465 | - $TKT->set($field, $value); |
|
466 | - } |
|
467 | - } |
|
460 | + //set new values |
|
461 | + foreach ($TKT_values as $field => $value) { |
|
462 | + if ($field === 'TKT_qty') { |
|
463 | + $TKT->set_qty($value); |
|
464 | + } else { |
|
465 | + $TKT->set($field, $value); |
|
466 | + } |
|
467 | + } |
|
468 | 468 | |
469 | - //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
|
470 | - if ($create_new_TKT) { |
|
471 | - $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, |
|
472 | - $base_price_id); |
|
473 | - } |
|
474 | - } |
|
469 | + //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
|
470 | + if ($create_new_TKT) { |
|
471 | + $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, |
|
472 | + $base_price_id); |
|
473 | + } |
|
474 | + } |
|
475 | 475 | |
476 | - } else { |
|
477 | - // no TKT_id so a new TKT |
|
478 | - $TKT = EE_Ticket::new_instance( |
|
479 | - $TKT_values, |
|
480 | - $timezone, |
|
481 | - array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
482 | - ); |
|
483 | - if ($TKT instanceof EE_Ticket) { |
|
484 | - // make sure ticket has an ID of setting relations won't work |
|
485 | - $TKT->save(); |
|
486 | - $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
487 | - $update_prices = true; |
|
488 | - } |
|
489 | - } |
|
490 | - //make sure any current values have been saved. |
|
491 | - //$TKT->save(); |
|
476 | + } else { |
|
477 | + // no TKT_id so a new TKT |
|
478 | + $TKT = EE_Ticket::new_instance( |
|
479 | + $TKT_values, |
|
480 | + $timezone, |
|
481 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
482 | + ); |
|
483 | + if ($TKT instanceof EE_Ticket) { |
|
484 | + // make sure ticket has an ID of setting relations won't work |
|
485 | + $TKT->save(); |
|
486 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
487 | + $update_prices = true; |
|
488 | + } |
|
489 | + } |
|
490 | + //make sure any current values have been saved. |
|
491 | + //$TKT->save(); |
|
492 | 492 | |
493 | - //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
|
494 | - if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
495 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
496 | - $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
497 | - } |
|
493 | + //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
|
494 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
495 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
496 | + $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
497 | + } |
|
498 | 498 | |
499 | - //let's make sure the base price is handled |
|
500 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, |
|
501 | - $base_price_id) : $TKT; |
|
499 | + //let's make sure the base price is handled |
|
500 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, |
|
501 | + $base_price_id) : $TKT; |
|
502 | 502 | |
503 | - //add/update price_modifiers |
|
504 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
503 | + //add/update price_modifiers |
|
504 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
505 | 505 | |
506 | - //need to make sue that the TKT_price is accurate after saving the prices. |
|
507 | - $TKT->ensure_TKT_Price_correct(); |
|
506 | + //need to make sue that the TKT_price is accurate after saving the prices. |
|
507 | + $TKT->ensure_TKT_Price_correct(); |
|
508 | 508 | |
509 | - //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
|
510 | - if ( ! defined('DOING_AUTOSAVE')) { |
|
511 | - if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
512 | - $update_prices = true; |
|
513 | - $new_default = clone $TKT; |
|
514 | - $new_default->set('TKT_ID', 0); |
|
515 | - $new_default->set('TKT_is_default', 1); |
|
516 | - $new_default->set('TKT_row', 1); |
|
517 | - $new_default->set('TKT_price', $ticket_price); |
|
518 | - //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
|
519 | - $new_default->_remove_relations('Datetime'); |
|
520 | - //todo we need to add the current attached prices as new prices to the new default ticket. |
|
521 | - $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
522 | - //don't forget the base price! |
|
523 | - $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, |
|
524 | - $base_price_id); |
|
525 | - $new_default->save(); |
|
526 | - do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, |
|
527 | - $row, $TKT, $data); |
|
528 | - } |
|
529 | - } |
|
509 | + //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
|
510 | + if ( ! defined('DOING_AUTOSAVE')) { |
|
511 | + if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
512 | + $update_prices = true; |
|
513 | + $new_default = clone $TKT; |
|
514 | + $new_default->set('TKT_ID', 0); |
|
515 | + $new_default->set('TKT_is_default', 1); |
|
516 | + $new_default->set('TKT_row', 1); |
|
517 | + $new_default->set('TKT_price', $ticket_price); |
|
518 | + //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
|
519 | + $new_default->_remove_relations('Datetime'); |
|
520 | + //todo we need to add the current attached prices as new prices to the new default ticket. |
|
521 | + $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
522 | + //don't forget the base price! |
|
523 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, |
|
524 | + $base_price_id); |
|
525 | + $new_default->save(); |
|
526 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, |
|
527 | + $row, $TKT, $data); |
|
528 | + } |
|
529 | + } |
|
530 | 530 | |
531 | 531 | |
532 | - //DO ALL dtt relationships for both current tickets and any archived tickets for the given dtt that are related to the current ticket. TODO... not sure exactly how we're going to do this considering we don't know what current ticket the archived tickets are related to (and TKT_parent is used for autosaves so that's not a field we can reliably use). |
|
532 | + //DO ALL dtt relationships for both current tickets and any archived tickets for the given dtt that are related to the current ticket. TODO... not sure exactly how we're going to do this considering we don't know what current ticket the archived tickets are related to (and TKT_parent is used for autosaves so that's not a field we can reliably use). |
|
533 | 533 | |
534 | 534 | |
535 | - //let's assign any tickets that have been setup to the saved_tickets tracker |
|
536 | - //save existing TKT |
|
537 | - $TKT->save(); |
|
538 | - if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
539 | - //save new TKT |
|
540 | - $new_tkt->save(); |
|
541 | - //add new ticket to array |
|
542 | - $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
535 | + //let's assign any tickets that have been setup to the saved_tickets tracker |
|
536 | + //save existing TKT |
|
537 | + $TKT->save(); |
|
538 | + if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
539 | + //save new TKT |
|
540 | + $new_tkt->save(); |
|
541 | + //add new ticket to array |
|
542 | + $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
543 | 543 | |
544 | - do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
544 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
545 | 545 | |
546 | - } else { |
|
547 | - //add tkt to saved tkts |
|
548 | - $saved_tickets[$TKT->ID()] = $TKT; |
|
546 | + } else { |
|
547 | + //add tkt to saved tkts |
|
548 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
549 | 549 | |
550 | - do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
551 | - } |
|
550 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
551 | + } |
|
552 | 552 | |
553 | - } |
|
554 | - |
|
555 | - // now we need to handle tickets actually "deleted permanently". |
|
556 | - // There are cases where we'd want this to happen |
|
557 | - // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
|
558 | - // Or a draft event was saved and in the process of editing a ticket is trashed. |
|
559 | - // No sense in keeping all the related data in the db! |
|
560 | - $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
561 | - $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
562 | - |
|
563 | - foreach ($tickets_removed as $id) { |
|
564 | - $id = absint($id); |
|
553 | + } |
|
554 | + |
|
555 | + // now we need to handle tickets actually "deleted permanently". |
|
556 | + // There are cases where we'd want this to happen |
|
557 | + // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
|
558 | + // Or a draft event was saved and in the process of editing a ticket is trashed. |
|
559 | + // No sense in keeping all the related data in the db! |
|
560 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
561 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
562 | + |
|
563 | + foreach ($tickets_removed as $id) { |
|
564 | + $id = absint($id); |
|
565 | 565 | |
566 | - //get the ticket for this id |
|
567 | - $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
566 | + //get the ticket for this id |
|
567 | + $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
568 | 568 | |
569 | - //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
|
570 | - if ($tkt_to_remove->get('TKT_is_default')) { |
|
571 | - continue; |
|
572 | - } |
|
569 | + //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
|
570 | + if ($tkt_to_remove->get('TKT_is_default')) { |
|
571 | + continue; |
|
572 | + } |
|
573 | 573 | |
574 | - // if this tkt has any registrations attached so then we just ARCHIVE |
|
575 | - // because we don't actually permanently delete these tickets. |
|
576 | - if ($tkt_to_remove->count_related('Registration') > 0) { |
|
577 | - $tkt_to_remove->delete(); |
|
578 | - continue; |
|
579 | - } |
|
574 | + // if this tkt has any registrations attached so then we just ARCHIVE |
|
575 | + // because we don't actually permanently delete these tickets. |
|
576 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
577 | + $tkt_to_remove->delete(); |
|
578 | + continue; |
|
579 | + } |
|
580 | 580 | |
581 | - // need to get all the related datetimes on this ticket and remove from every single one of them |
|
582 | - // (remember this process can ONLY kick off if there are NO tkts_sold) |
|
583 | - $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
581 | + // need to get all the related datetimes on this ticket and remove from every single one of them |
|
582 | + // (remember this process can ONLY kick off if there are NO tkts_sold) |
|
583 | + $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
584 | 584 | |
585 | - foreach ($dtts as $dtt) { |
|
586 | - $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
587 | - } |
|
585 | + foreach ($dtts as $dtt) { |
|
586 | + $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
587 | + } |
|
588 | 588 | |
589 | - // need to do the same for prices (except these prices can also be deleted because again, |
|
590 | - // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
|
591 | - $tkt_to_remove->delete_related_permanently('Price'); |
|
589 | + // need to do the same for prices (except these prices can also be deleted because again, |
|
590 | + // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
|
591 | + $tkt_to_remove->delete_related_permanently('Price'); |
|
592 | 592 | |
593 | - do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
593 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
594 | 594 | |
595 | - // finally let's delete this ticket |
|
596 | - // (which should not be blocked at this point b/c we've removed all our relationships) |
|
597 | - $tkt_to_remove->delete_permanently(); |
|
598 | - } |
|
595 | + // finally let's delete this ticket |
|
596 | + // (which should not be blocked at this point b/c we've removed all our relationships) |
|
597 | + $tkt_to_remove->delete_permanently(); |
|
598 | + } |
|
599 | 599 | |
600 | - return $saved_tickets; |
|
601 | - } |
|
600 | + return $saved_tickets; |
|
601 | + } |
|
602 | 602 | |
603 | 603 | |
604 | - /** |
|
605 | - * |
|
606 | - * @access protected |
|
607 | - * |
|
608 | - * @param \EE_Ticket $ticket |
|
609 | - * @param \EE_Datetime[] $saved_datetimes |
|
610 | - * @param \EE_Datetime[] $added_datetimes |
|
611 | - * @param \EE_Datetime[] $removed_datetimes |
|
612 | - * |
|
613 | - * @return \EE_Ticket |
|
614 | - * @throws \EE_Error |
|
615 | - */ |
|
616 | - protected function _update_ticket_datetimes( |
|
617 | - EE_Ticket $ticket, |
|
618 | - $saved_datetimes = array(), |
|
619 | - $added_datetimes = array(), |
|
620 | - $removed_datetimes = array() |
|
621 | - ) { |
|
622 | - |
|
623 | - // to start we have to add the ticket to all the datetimes its supposed to be with, |
|
624 | - // and removing the ticket from datetimes it got removed from. |
|
625 | - |
|
626 | - // first let's add datetimes |
|
627 | - if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
628 | - foreach ($added_datetimes as $row_id) { |
|
629 | - $row_id = (int)$row_id; |
|
630 | - if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
631 | - $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
632 | - // Is this an existing ticket (has an ID) and does it have any sold? |
|
633 | - // If so, then we need to add that to the DTT sold because this DTT is getting added. |
|
634 | - if ($ticket->ID() && $ticket->sold() > 0) { |
|
635 | - $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
636 | - $saved_datetimes[$row_id]->save(); |
|
637 | - } |
|
638 | - } |
|
639 | - } |
|
640 | - } |
|
641 | - // then remove datetimes |
|
642 | - if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
643 | - foreach ($removed_datetimes as $row_id) { |
|
644 | - $row_id = (int)$row_id; |
|
645 | - // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
|
646 | - // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
|
647 | - if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
648 | - $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
649 | - // Is this an existing ticket (has an ID) and does it have any sold? |
|
650 | - // If so, then we need to remove it's sold from the DTT_sold. |
|
651 | - if ($ticket->ID() && $ticket->sold() > 0) { |
|
652 | - $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
653 | - $saved_datetimes[$row_id]->save(); |
|
654 | - } |
|
655 | - } |
|
656 | - } |
|
657 | - } |
|
658 | - // cap ticket qty by datetime reg limits |
|
659 | - $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
660 | - |
|
661 | - return $ticket; |
|
662 | - } |
|
604 | + /** |
|
605 | + * |
|
606 | + * @access protected |
|
607 | + * |
|
608 | + * @param \EE_Ticket $ticket |
|
609 | + * @param \EE_Datetime[] $saved_datetimes |
|
610 | + * @param \EE_Datetime[] $added_datetimes |
|
611 | + * @param \EE_Datetime[] $removed_datetimes |
|
612 | + * |
|
613 | + * @return \EE_Ticket |
|
614 | + * @throws \EE_Error |
|
615 | + */ |
|
616 | + protected function _update_ticket_datetimes( |
|
617 | + EE_Ticket $ticket, |
|
618 | + $saved_datetimes = array(), |
|
619 | + $added_datetimes = array(), |
|
620 | + $removed_datetimes = array() |
|
621 | + ) { |
|
622 | + |
|
623 | + // to start we have to add the ticket to all the datetimes its supposed to be with, |
|
624 | + // and removing the ticket from datetimes it got removed from. |
|
625 | + |
|
626 | + // first let's add datetimes |
|
627 | + if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
628 | + foreach ($added_datetimes as $row_id) { |
|
629 | + $row_id = (int)$row_id; |
|
630 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
631 | + $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
632 | + // Is this an existing ticket (has an ID) and does it have any sold? |
|
633 | + // If so, then we need to add that to the DTT sold because this DTT is getting added. |
|
634 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
635 | + $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
636 | + $saved_datetimes[$row_id]->save(); |
|
637 | + } |
|
638 | + } |
|
639 | + } |
|
640 | + } |
|
641 | + // then remove datetimes |
|
642 | + if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
643 | + foreach ($removed_datetimes as $row_id) { |
|
644 | + $row_id = (int)$row_id; |
|
645 | + // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
|
646 | + // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
|
647 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
648 | + $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
649 | + // Is this an existing ticket (has an ID) and does it have any sold? |
|
650 | + // If so, then we need to remove it's sold from the DTT_sold. |
|
651 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
652 | + $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
653 | + $saved_datetimes[$row_id]->save(); |
|
654 | + } |
|
655 | + } |
|
656 | + } |
|
657 | + } |
|
658 | + // cap ticket qty by datetime reg limits |
|
659 | + $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
660 | + |
|
661 | + return $ticket; |
|
662 | + } |
|
663 | 663 | |
664 | 664 | |
665 | - /** |
|
666 | - * |
|
667 | - * @access protected |
|
668 | - * |
|
669 | - * @param \EE_Ticket $ticket |
|
670 | - * @param array $price_rows |
|
671 | - * @param int $ticket_price |
|
672 | - * @param int $base_price |
|
673 | - * @param int $base_price_id |
|
674 | - * |
|
675 | - * @return \EE_Ticket |
|
676 | - * @throws \EE_Error |
|
677 | - */ |
|
678 | - protected function _duplicate_ticket( |
|
679 | - EE_Ticket $ticket, |
|
680 | - $price_rows = array(), |
|
681 | - $ticket_price = 0, |
|
682 | - $base_price = 0, |
|
683 | - $base_price_id = 0 |
|
684 | - ) { |
|
685 | - |
|
686 | - // create new ticket that's a copy of the existing |
|
687 | - // except a new id of course (and not archived) |
|
688 | - // AND has the new TKT_price associated with it. |
|
689 | - $new_ticket = clone($ticket); |
|
690 | - $new_ticket->set('TKT_ID', 0); |
|
691 | - $new_ticket->set('TKT_deleted', 0); |
|
692 | - $new_ticket->set('TKT_price', $ticket_price); |
|
693 | - $new_ticket->set('TKT_sold', 0); |
|
694 | - // let's get a new ID for this ticket |
|
695 | - $new_ticket->save(); |
|
696 | - // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
|
697 | - $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
698 | - $new_ticket = $this->_update_ticket_datetimes( |
|
699 | - $new_ticket, |
|
700 | - $datetimes_on_existing, |
|
701 | - array_keys($datetimes_on_existing) |
|
702 | - ); |
|
703 | - |
|
704 | - // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
|
705 | - // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
|
706 | - // available. |
|
707 | - if ($ticket->sold() > 0) { |
|
708 | - $new_qty = $ticket->qty() - $ticket->sold(); |
|
709 | - $new_ticket->set_qty($new_qty); |
|
710 | - } |
|
711 | - //now we update the prices just for this ticket |
|
712 | - $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
713 | - //and we update the base price |
|
714 | - $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
715 | - |
|
716 | - return $new_ticket; |
|
717 | - } |
|
665 | + /** |
|
666 | + * |
|
667 | + * @access protected |
|
668 | + * |
|
669 | + * @param \EE_Ticket $ticket |
|
670 | + * @param array $price_rows |
|
671 | + * @param int $ticket_price |
|
672 | + * @param int $base_price |
|
673 | + * @param int $base_price_id |
|
674 | + * |
|
675 | + * @return \EE_Ticket |
|
676 | + * @throws \EE_Error |
|
677 | + */ |
|
678 | + protected function _duplicate_ticket( |
|
679 | + EE_Ticket $ticket, |
|
680 | + $price_rows = array(), |
|
681 | + $ticket_price = 0, |
|
682 | + $base_price = 0, |
|
683 | + $base_price_id = 0 |
|
684 | + ) { |
|
685 | + |
|
686 | + // create new ticket that's a copy of the existing |
|
687 | + // except a new id of course (and not archived) |
|
688 | + // AND has the new TKT_price associated with it. |
|
689 | + $new_ticket = clone($ticket); |
|
690 | + $new_ticket->set('TKT_ID', 0); |
|
691 | + $new_ticket->set('TKT_deleted', 0); |
|
692 | + $new_ticket->set('TKT_price', $ticket_price); |
|
693 | + $new_ticket->set('TKT_sold', 0); |
|
694 | + // let's get a new ID for this ticket |
|
695 | + $new_ticket->save(); |
|
696 | + // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
|
697 | + $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
698 | + $new_ticket = $this->_update_ticket_datetimes( |
|
699 | + $new_ticket, |
|
700 | + $datetimes_on_existing, |
|
701 | + array_keys($datetimes_on_existing) |
|
702 | + ); |
|
703 | + |
|
704 | + // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
|
705 | + // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
|
706 | + // available. |
|
707 | + if ($ticket->sold() > 0) { |
|
708 | + $new_qty = $ticket->qty() - $ticket->sold(); |
|
709 | + $new_ticket->set_qty($new_qty); |
|
710 | + } |
|
711 | + //now we update the prices just for this ticket |
|
712 | + $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
713 | + //and we update the base price |
|
714 | + $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
715 | + |
|
716 | + return $new_ticket; |
|
717 | + } |
|
718 | 718 | |
719 | 719 | |
720 | - /** |
|
721 | - * This attaches a list of given prices to a ticket. |
|
722 | - * Note we dont' have to worry about ever removing relationships (or archiving prices) because if there is a change |
|
723 | - * in price information on a ticket, a new ticket is created anyways so the archived ticket will retain the old |
|
724 | - * price info and prices are automatically "archived" via the ticket. |
|
725 | - * |
|
726 | - * @access private |
|
727 | - * |
|
728 | - * @param array $prices Array of prices from the form. |
|
729 | - * @param EE_Ticket $ticket EE_Ticket object that prices are being attached to. |
|
730 | - * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
|
731 | - * @param int|bool $base_price if FALSE then NOT doing a base price add. |
|
732 | - * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
|
733 | - * |
|
734 | - * @return EE_Ticket |
|
735 | - */ |
|
736 | - protected function _add_prices_to_ticket( |
|
737 | - $prices = array(), |
|
738 | - EE_Ticket $ticket, |
|
739 | - $new_prices = false, |
|
740 | - $base_price = false, |
|
741 | - $base_price_id = false |
|
742 | - ) { |
|
743 | - |
|
744 | - //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
|
745 | - $current_prices_on_ticket = $base_price !== false ? $ticket->base_price(true) : $ticket->price_modifiers(); |
|
746 | - |
|
747 | - $updated_prices = array(); |
|
748 | - |
|
749 | - // if $base_price ! FALSE then updating a base price. |
|
750 | - if ($base_price !== false) { |
|
751 | - $prices[1] = array( |
|
752 | - 'PRC_ID' => $new_prices || $base_price_id === 1 ? null : $base_price_id, |
|
753 | - 'PRT_ID' => 1, |
|
754 | - 'PRC_amount' => $base_price, |
|
755 | - 'PRC_name' => $ticket->get('TKT_name'), |
|
756 | - 'PRC_desc' => $ticket->get('TKT_description') |
|
757 | - ); |
|
758 | - } |
|
759 | - |
|
760 | - //possibly need to save tkt |
|
761 | - if ( ! $ticket->ID()) { |
|
762 | - $ticket->save(); |
|
763 | - } |
|
764 | - |
|
765 | - foreach ($prices as $row => $prc) { |
|
766 | - $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null; |
|
767 | - if (empty($prt_id)) { |
|
768 | - continue; |
|
769 | - } //prices MUST have a price type id. |
|
770 | - $PRC_values = array( |
|
771 | - 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
772 | - 'PRT_ID' => $prt_id, |
|
773 | - 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
774 | - 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
775 | - 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
776 | - 'PRC_is_default' => false, |
|
777 | - //make sure we set PRC_is_default to false for all ticket saves from event_editor |
|
778 | - 'PRC_order' => $row |
|
779 | - ); |
|
780 | - if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
781 | - $PRC_values['PRC_ID'] = 0; |
|
782 | - $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
783 | - } else { |
|
784 | - $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
785 | - //update this price with new values |
|
786 | - foreach ($PRC_values as $field => $newprc) { |
|
787 | - $PRC->set($field, $newprc); |
|
788 | - } |
|
789 | - } |
|
790 | - $PRC->save(); |
|
791 | - $prcid = $PRC->ID(); |
|
792 | - $updated_prices[$prcid] = $PRC; |
|
793 | - $ticket->_add_relation_to($PRC, 'Price'); |
|
794 | - } |
|
795 | - |
|
796 | - //now let's remove any prices that got removed from the ticket |
|
797 | - if ( ! empty ($current_prices_on_ticket)) { |
|
798 | - $current = array_keys($current_prices_on_ticket); |
|
799 | - $updated = array_keys($updated_prices); |
|
800 | - $prices_to_remove = array_diff($current, $updated); |
|
801 | - if ( ! empty($prices_to_remove)) { |
|
802 | - foreach ($prices_to_remove as $prc_id) { |
|
803 | - $p = $current_prices_on_ticket[$prc_id]; |
|
804 | - $ticket->_remove_relation_to($p, 'Price'); |
|
720 | + /** |
|
721 | + * This attaches a list of given prices to a ticket. |
|
722 | + * Note we dont' have to worry about ever removing relationships (or archiving prices) because if there is a change |
|
723 | + * in price information on a ticket, a new ticket is created anyways so the archived ticket will retain the old |
|
724 | + * price info and prices are automatically "archived" via the ticket. |
|
725 | + * |
|
726 | + * @access private |
|
727 | + * |
|
728 | + * @param array $prices Array of prices from the form. |
|
729 | + * @param EE_Ticket $ticket EE_Ticket object that prices are being attached to. |
|
730 | + * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
|
731 | + * @param int|bool $base_price if FALSE then NOT doing a base price add. |
|
732 | + * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
|
733 | + * |
|
734 | + * @return EE_Ticket |
|
735 | + */ |
|
736 | + protected function _add_prices_to_ticket( |
|
737 | + $prices = array(), |
|
738 | + EE_Ticket $ticket, |
|
739 | + $new_prices = false, |
|
740 | + $base_price = false, |
|
741 | + $base_price_id = false |
|
742 | + ) { |
|
743 | + |
|
744 | + //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
|
745 | + $current_prices_on_ticket = $base_price !== false ? $ticket->base_price(true) : $ticket->price_modifiers(); |
|
746 | + |
|
747 | + $updated_prices = array(); |
|
748 | + |
|
749 | + // if $base_price ! FALSE then updating a base price. |
|
750 | + if ($base_price !== false) { |
|
751 | + $prices[1] = array( |
|
752 | + 'PRC_ID' => $new_prices || $base_price_id === 1 ? null : $base_price_id, |
|
753 | + 'PRT_ID' => 1, |
|
754 | + 'PRC_amount' => $base_price, |
|
755 | + 'PRC_name' => $ticket->get('TKT_name'), |
|
756 | + 'PRC_desc' => $ticket->get('TKT_description') |
|
757 | + ); |
|
758 | + } |
|
759 | + |
|
760 | + //possibly need to save tkt |
|
761 | + if ( ! $ticket->ID()) { |
|
762 | + $ticket->save(); |
|
763 | + } |
|
764 | + |
|
765 | + foreach ($prices as $row => $prc) { |
|
766 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null; |
|
767 | + if (empty($prt_id)) { |
|
768 | + continue; |
|
769 | + } //prices MUST have a price type id. |
|
770 | + $PRC_values = array( |
|
771 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
772 | + 'PRT_ID' => $prt_id, |
|
773 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
774 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
775 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
776 | + 'PRC_is_default' => false, |
|
777 | + //make sure we set PRC_is_default to false for all ticket saves from event_editor |
|
778 | + 'PRC_order' => $row |
|
779 | + ); |
|
780 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
781 | + $PRC_values['PRC_ID'] = 0; |
|
782 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
783 | + } else { |
|
784 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
785 | + //update this price with new values |
|
786 | + foreach ($PRC_values as $field => $newprc) { |
|
787 | + $PRC->set($field, $newprc); |
|
788 | + } |
|
789 | + } |
|
790 | + $PRC->save(); |
|
791 | + $prcid = $PRC->ID(); |
|
792 | + $updated_prices[$prcid] = $PRC; |
|
793 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
794 | + } |
|
795 | + |
|
796 | + //now let's remove any prices that got removed from the ticket |
|
797 | + if ( ! empty ($current_prices_on_ticket)) { |
|
798 | + $current = array_keys($current_prices_on_ticket); |
|
799 | + $updated = array_keys($updated_prices); |
|
800 | + $prices_to_remove = array_diff($current, $updated); |
|
801 | + if ( ! empty($prices_to_remove)) { |
|
802 | + foreach ($prices_to_remove as $prc_id) { |
|
803 | + $p = $current_prices_on_ticket[$prc_id]; |
|
804 | + $ticket->_remove_relation_to($p, 'Price'); |
|
805 | 805 | |
806 | - //delete permanently the price |
|
807 | - $p->delete_permanently(); |
|
808 | - } |
|
809 | - } |
|
810 | - } |
|
811 | - |
|
812 | - return $ticket; |
|
813 | - } |
|
806 | + //delete permanently the price |
|
807 | + $p->delete_permanently(); |
|
808 | + } |
|
809 | + } |
|
810 | + } |
|
811 | + |
|
812 | + return $ticket; |
|
813 | + } |
|
814 | 814 | |
815 | 815 | |
816 | - public function autosave_handling($event_admin_obj) |
|
817 | - { |
|
818 | - return $event_admin_obj; //doing nothing for the moment. |
|
819 | - //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
|
820 | - |
|
821 | - /** |
|
822 | - * need to remember to handle TICKET DEFAULT saves correctly: I've got two input fields in the dom: |
|
823 | - * |
|
824 | - * 1. TKT_is_default_selector (visible) |
|
825 | - * 2. TKT_is_default (hidden) |
|
826 | - * |
|
827 | - * I think we'll use the TKT_is_default for recording whether the ticket displayed IS a default ticket (on new event creations). Whereas the TKT_is_default_selector is for the user to indicate they want this ticket to be saved as a default. |
|
828 | - * |
|
829 | - * The tricky part is, on an initial display on create or edit (or after manually updating), the TKT_is_default_selector will always be unselected and the TKT_is_default will only be true if this is a create. However, after an autosave, users will want some sort of indicator that the TKT HAS been saved as a default.. in other words we don't want to remove the check on TKT_is_default_selector. So here's what I'm thinking. |
|
830 | - * On Autosave: |
|
831 | - * 1. If TKT_is_default is true: we create a new TKT, send back the new id and add id to related elements, then set the TKT_is_default to false. |
|
832 | - * 2. If TKT_is_default_selector is true: we create/edit existing ticket (following conditions above as well). We do NOT create a new default ticket. The checkbox stays selected after autosave. |
|
833 | - * 3. only on MANUAL update do we check for the selection and if selected create the new default ticket. |
|
834 | - */ |
|
835 | - } |
|
816 | + public function autosave_handling($event_admin_obj) |
|
817 | + { |
|
818 | + return $event_admin_obj; //doing nothing for the moment. |
|
819 | + //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
|
820 | + |
|
821 | + /** |
|
822 | + * need to remember to handle TICKET DEFAULT saves correctly: I've got two input fields in the dom: |
|
823 | + * |
|
824 | + * 1. TKT_is_default_selector (visible) |
|
825 | + * 2. TKT_is_default (hidden) |
|
826 | + * |
|
827 | + * I think we'll use the TKT_is_default for recording whether the ticket displayed IS a default ticket (on new event creations). Whereas the TKT_is_default_selector is for the user to indicate they want this ticket to be saved as a default. |
|
828 | + * |
|
829 | + * The tricky part is, on an initial display on create or edit (or after manually updating), the TKT_is_default_selector will always be unselected and the TKT_is_default will only be true if this is a create. However, after an autosave, users will want some sort of indicator that the TKT HAS been saved as a default.. in other words we don't want to remove the check on TKT_is_default_selector. So here's what I'm thinking. |
|
830 | + * On Autosave: |
|
831 | + * 1. If TKT_is_default is true: we create a new TKT, send back the new id and add id to related elements, then set the TKT_is_default to false. |
|
832 | + * 2. If TKT_is_default_selector is true: we create/edit existing ticket (following conditions above as well). We do NOT create a new default ticket. The checkbox stays selected after autosave. |
|
833 | + * 3. only on MANUAL update do we check for the selection and if selected create the new default ticket. |
|
834 | + */ |
|
835 | + } |
|
836 | 836 | |
837 | 837 | |
838 | - public function pricing_metabox() |
|
839 | - { |
|
840 | - $existing_datetime_ids = $existing_ticket_ids = $datetime_tickets = $ticket_datetimes = array(); |
|
841 | - |
|
842 | - $evtobj = $this->_adminpage_obj->get_cpt_model_obj(); |
|
843 | - |
|
844 | - //set is_creating_event property. |
|
845 | - $evtID = $evtobj->ID(); |
|
846 | - $this->_is_creating_event = absint($evtID) != 0 ? false : true; |
|
847 | - |
|
848 | - //default main template args |
|
849 | - $main_template_args = array( |
|
850 | - 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', |
|
851 | - $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false), |
|
852 | - //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
853 | - 'existing_datetime_ids' => '', |
|
854 | - 'total_dtt_rows' => 1, |
|
855 | - 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', |
|
856 | - $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false), |
|
857 | - //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
858 | - 'datetime_rows' => '', |
|
859 | - 'show_tickets_container' => '', |
|
860 | - //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
861 | - 'ticket_rows' => '', |
|
862 | - 'existing_ticket_ids' => '', |
|
863 | - 'total_ticket_rows' => 1, |
|
864 | - 'ticket_js_structure' => '', |
|
865 | - 'ee_collapsible_status' => ' ee-collapsible-open' |
|
866 | - //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' ee-collapsible-closed' : ' ee-collapsible-open' |
|
867 | - ); |
|
868 | - |
|
869 | - $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : null; |
|
870 | - |
|
871 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
872 | - |
|
873 | - /** |
|
874 | - * 1. Start with retrieving Datetimes |
|
875 | - * 2. For each datetime get related tickets |
|
876 | - * 3. For each ticket get related prices |
|
877 | - */ |
|
878 | - |
|
879 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
880 | - $times = $DTM->get_all_event_dates($evtID); |
|
881 | - |
|
882 | - |
|
883 | - $main_template_args['total_dtt_rows'] = count($times); |
|
884 | - |
|
885 | - /** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */ |
|
886 | - $dttrow = 1; |
|
887 | - foreach ($times as $time) { |
|
888 | - $dttid = $time->get('DTT_ID'); |
|
889 | - $time->set('DTT_order', $dttrow); |
|
890 | - $existing_datetime_ids[] = $dttid; |
|
838 | + public function pricing_metabox() |
|
839 | + { |
|
840 | + $existing_datetime_ids = $existing_ticket_ids = $datetime_tickets = $ticket_datetimes = array(); |
|
841 | + |
|
842 | + $evtobj = $this->_adminpage_obj->get_cpt_model_obj(); |
|
843 | + |
|
844 | + //set is_creating_event property. |
|
845 | + $evtID = $evtobj->ID(); |
|
846 | + $this->_is_creating_event = absint($evtID) != 0 ? false : true; |
|
847 | + |
|
848 | + //default main template args |
|
849 | + $main_template_args = array( |
|
850 | + 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', |
|
851 | + $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false), |
|
852 | + //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
853 | + 'existing_datetime_ids' => '', |
|
854 | + 'total_dtt_rows' => 1, |
|
855 | + 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', |
|
856 | + $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false), |
|
857 | + //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
858 | + 'datetime_rows' => '', |
|
859 | + 'show_tickets_container' => '', |
|
860 | + //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
861 | + 'ticket_rows' => '', |
|
862 | + 'existing_ticket_ids' => '', |
|
863 | + 'total_ticket_rows' => 1, |
|
864 | + 'ticket_js_structure' => '', |
|
865 | + 'ee_collapsible_status' => ' ee-collapsible-open' |
|
866 | + //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' ee-collapsible-closed' : ' ee-collapsible-open' |
|
867 | + ); |
|
868 | + |
|
869 | + $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : null; |
|
870 | + |
|
871 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
872 | + |
|
873 | + /** |
|
874 | + * 1. Start with retrieving Datetimes |
|
875 | + * 2. For each datetime get related tickets |
|
876 | + * 3. For each ticket get related prices |
|
877 | + */ |
|
878 | + |
|
879 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
880 | + $times = $DTM->get_all_event_dates($evtID); |
|
881 | + |
|
882 | + |
|
883 | + $main_template_args['total_dtt_rows'] = count($times); |
|
884 | + |
|
885 | + /** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */ |
|
886 | + $dttrow = 1; |
|
887 | + foreach ($times as $time) { |
|
888 | + $dttid = $time->get('DTT_ID'); |
|
889 | + $time->set('DTT_order', $dttrow); |
|
890 | + $existing_datetime_ids[] = $dttid; |
|
891 | 891 | |
892 | - //tickets attached |
|
893 | - $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( |
|
894 | - array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
895 | - 'default_where_conditions' => 'none', |
|
896 | - 'order_by' => array('TKT_order' => 'ASC') |
|
897 | - )) : array(); |
|
892 | + //tickets attached |
|
893 | + $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( |
|
894 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
895 | + 'default_where_conditions' => 'none', |
|
896 | + 'order_by' => array('TKT_order' => 'ASC') |
|
897 | + )) : array(); |
|
898 | 898 | |
899 | - //if there are no related tickets this is likely a new event OR autodraft |
|
900 | - // event so we need to generate the default tickets because dtts |
|
901 | - // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
|
902 | - // datetime on the event. |
|
903 | - if (empty ($related_tickets) && count($times) < 2) { |
|
904 | - $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
899 | + //if there are no related tickets this is likely a new event OR autodraft |
|
900 | + // event so we need to generate the default tickets because dtts |
|
901 | + // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
|
902 | + // datetime on the event. |
|
903 | + if (empty ($related_tickets) && count($times) < 2) { |
|
904 | + $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
905 | 905 | |
906 | - //this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save). |
|
907 | - $default_prices = EEM_Price::instance()->get_all_default_prices(); |
|
906 | + //this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save). |
|
907 | + $default_prices = EEM_Price::instance()->get_all_default_prices(); |
|
908 | 908 | |
909 | - $main_default_ticket = reset($related_tickets); |
|
910 | - if ($main_default_ticket instanceof EE_Ticket) { |
|
911 | - foreach ($default_prices as $default_price) { |
|
912 | - if ($default_price->is_base_price()) { |
|
913 | - continue; |
|
914 | - } |
|
915 | - $main_default_ticket->cache('Price', $default_price); |
|
916 | - } |
|
917 | - } |
|
918 | - } |
|
909 | + $main_default_ticket = reset($related_tickets); |
|
910 | + if ($main_default_ticket instanceof EE_Ticket) { |
|
911 | + foreach ($default_prices as $default_price) { |
|
912 | + if ($default_price->is_base_price()) { |
|
913 | + continue; |
|
914 | + } |
|
915 | + $main_default_ticket->cache('Price', $default_price); |
|
916 | + } |
|
917 | + } |
|
918 | + } |
|
919 | 919 | |
920 | 920 | |
921 | - //we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information. |
|
921 | + //we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information. |
|
922 | 922 | |
923 | - //loop through and setup the ticket rows and make sure the order is set. |
|
924 | - foreach ($related_tickets as $ticket) { |
|
925 | - $tktid = $ticket->get('TKT_ID'); |
|
926 | - $tktrow = $ticket->get('TKT_row'); |
|
927 | - //we only want unique tickets in our final display!! |
|
928 | - if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
929 | - $existing_ticket_ids[] = $tktid; |
|
930 | - $all_tickets[] = $ticket; |
|
931 | - } |
|
923 | + //loop through and setup the ticket rows and make sure the order is set. |
|
924 | + foreach ($related_tickets as $ticket) { |
|
925 | + $tktid = $ticket->get('TKT_ID'); |
|
926 | + $tktrow = $ticket->get('TKT_row'); |
|
927 | + //we only want unique tickets in our final display!! |
|
928 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
929 | + $existing_ticket_ids[] = $tktid; |
|
930 | + $all_tickets[] = $ticket; |
|
931 | + } |
|
932 | 932 | |
933 | - //temporary cache of this ticket info for this datetime for later processing of datetime rows. |
|
934 | - $datetime_tickets[$dttid][] = $tktrow; |
|
933 | + //temporary cache of this ticket info for this datetime for later processing of datetime rows. |
|
934 | + $datetime_tickets[$dttid][] = $tktrow; |
|
935 | 935 | |
936 | - //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
|
937 | - if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) { |
|
938 | - $ticket_datetimes[$tktid][] = $dttrow; |
|
939 | - } |
|
940 | - } |
|
941 | - $dttrow++; |
|
942 | - } |
|
943 | - |
|
944 | - $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
945 | - $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
946 | - $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
947 | - |
|
948 | - //sort $all_tickets by order |
|
949 | - usort($all_tickets, function ($a, $b) { |
|
950 | - $a_order = (int)$a->get('TKT_order'); |
|
951 | - $b_order = (int)$b->get('TKT_order'); |
|
952 | - if ($a_order == $b_order) { |
|
953 | - return 0; |
|
954 | - } |
|
936 | + //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
|
937 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) { |
|
938 | + $ticket_datetimes[$tktid][] = $dttrow; |
|
939 | + } |
|
940 | + } |
|
941 | + $dttrow++; |
|
942 | + } |
|
943 | + |
|
944 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
945 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
946 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
947 | + |
|
948 | + //sort $all_tickets by order |
|
949 | + usort($all_tickets, function ($a, $b) { |
|
950 | + $a_order = (int)$a->get('TKT_order'); |
|
951 | + $b_order = (int)$b->get('TKT_order'); |
|
952 | + if ($a_order == $b_order) { |
|
953 | + return 0; |
|
954 | + } |
|
955 | 955 | |
956 | - return ($a_order < $b_order) ? -1 : 1; |
|
957 | - }); |
|
958 | - |
|
959 | - //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
|
960 | - $dttrow = 1; |
|
961 | - foreach ($times as $time) { |
|
962 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, |
|
963 | - $all_tickets, false, $times); |
|
964 | - $dttrow++; |
|
965 | - } |
|
966 | - |
|
967 | - //then loop through all tickets for the ticket rows. |
|
968 | - $tktrow = 1; |
|
969 | - foreach ($all_tickets as $ticket) { |
|
970 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, |
|
971 | - false, $all_tickets); |
|
972 | - $tktrow++; |
|
973 | - } |
|
974 | - |
|
975 | - $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
|
976 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
977 | - EEH_Template::display_template($template, $main_template_args); |
|
978 | - |
|
979 | - return; |
|
980 | - } |
|
956 | + return ($a_order < $b_order) ? -1 : 1; |
|
957 | + }); |
|
958 | + |
|
959 | + //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
|
960 | + $dttrow = 1; |
|
961 | + foreach ($times as $time) { |
|
962 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, |
|
963 | + $all_tickets, false, $times); |
|
964 | + $dttrow++; |
|
965 | + } |
|
966 | + |
|
967 | + //then loop through all tickets for the ticket rows. |
|
968 | + $tktrow = 1; |
|
969 | + foreach ($all_tickets as $ticket) { |
|
970 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, |
|
971 | + false, $all_tickets); |
|
972 | + $tktrow++; |
|
973 | + } |
|
974 | + |
|
975 | + $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
|
976 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
977 | + EEH_Template::display_template($template, $main_template_args); |
|
978 | + |
|
979 | + return; |
|
980 | + } |
|
981 | 981 | |
982 | 982 | |
983 | - protected function _get_datetime_row( |
|
984 | - $dttrow, |
|
985 | - EE_Datetime $dtt, |
|
986 | - $datetime_tickets, |
|
987 | - $all_tickets, |
|
988 | - $default = false, |
|
989 | - $all_dtts = array() |
|
990 | - ) { |
|
991 | - |
|
992 | - $dtt_display_template_args = array( |
|
993 | - 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
994 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, |
|
995 | - $all_tickets, $default), |
|
996 | - 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
|
997 | - ); |
|
998 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
999 | - |
|
1000 | - return EEH_Template::display_template($template, $dtt_display_template_args, true); |
|
1001 | - } |
|
983 | + protected function _get_datetime_row( |
|
984 | + $dttrow, |
|
985 | + EE_Datetime $dtt, |
|
986 | + $datetime_tickets, |
|
987 | + $all_tickets, |
|
988 | + $default = false, |
|
989 | + $all_dtts = array() |
|
990 | + ) { |
|
991 | + |
|
992 | + $dtt_display_template_args = array( |
|
993 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
994 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, |
|
995 | + $all_tickets, $default), |
|
996 | + 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
|
997 | + ); |
|
998 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
999 | + |
|
1000 | + return EEH_Template::display_template($template, $dtt_display_template_args, true); |
|
1001 | + } |
|
1002 | 1002 | |
1003 | 1003 | |
1004 | - /** |
|
1005 | - * This method is used to generate a dtt fields edit row. |
|
1006 | - * The same row is used to generate a row with valid DTT objects and the default row that is used as the |
|
1007 | - * skeleton by the js. |
|
1008 | - * |
|
1009 | - * @param int $dttrow The row number for the row being generated. |
|
1010 | - * @param mixed EE_Datetime|null $dtt If not default row being |
|
1011 | - * generated, this must be a EE_Datetime |
|
1012 | - * object. |
|
1013 | - * @param bool $default Whether a default row is being generated or not. |
|
1014 | - * @param EE_Datetime[] $all_dtts This is the array of all datetimes used in the editor. |
|
1015 | - * |
|
1016 | - * @return string Generated edit row. |
|
1017 | - */ |
|
1018 | - protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) |
|
1019 | - { |
|
1020 | - |
|
1021 | - // if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true. |
|
1022 | - $default = ! $dtt instanceof EE_Datetime ? true : false; |
|
1023 | - |
|
1024 | - $template_args = array( |
|
1025 | - 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
|
1026 | - 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
|
1027 | - 'edit_dtt_expanded' => '', |
|
1028 | - //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
1029 | - 'DTT_ID' => $default ? '' : $dtt->ID(), |
|
1030 | - 'DTT_name' => $default ? '' : $dtt->name(), |
|
1031 | - 'DTT_description' => $default ? '' : $dtt->description(), |
|
1032 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1033 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1034 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
1035 | - 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
|
1036 | - 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
|
1037 | - 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
1038 | - 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable', |
|
1039 | - 'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event |
|
1040 | - ? '' |
|
1041 | - : EE_Admin_Page::add_query_args_and_nonce( |
|
1042 | - array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()), |
|
1043 | - REG_ADMIN_URL |
|
1044 | - ) |
|
1045 | - ); |
|
1046 | - |
|
1047 | - $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1048 | - |
|
1049 | - //allow filtering of template args at this point. |
|
1050 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', |
|
1051 | - $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
1052 | - |
|
1053 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
1054 | - |
|
1055 | - return EEH_Template::display_template($template, $template_args, true); |
|
1056 | - } |
|
1004 | + /** |
|
1005 | + * This method is used to generate a dtt fields edit row. |
|
1006 | + * The same row is used to generate a row with valid DTT objects and the default row that is used as the |
|
1007 | + * skeleton by the js. |
|
1008 | + * |
|
1009 | + * @param int $dttrow The row number for the row being generated. |
|
1010 | + * @param mixed EE_Datetime|null $dtt If not default row being |
|
1011 | + * generated, this must be a EE_Datetime |
|
1012 | + * object. |
|
1013 | + * @param bool $default Whether a default row is being generated or not. |
|
1014 | + * @param EE_Datetime[] $all_dtts This is the array of all datetimes used in the editor. |
|
1015 | + * |
|
1016 | + * @return string Generated edit row. |
|
1017 | + */ |
|
1018 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) |
|
1019 | + { |
|
1020 | + |
|
1021 | + // if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true. |
|
1022 | + $default = ! $dtt instanceof EE_Datetime ? true : false; |
|
1023 | + |
|
1024 | + $template_args = array( |
|
1025 | + 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
|
1026 | + 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
|
1027 | + 'edit_dtt_expanded' => '', |
|
1028 | + //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
1029 | + 'DTT_ID' => $default ? '' : $dtt->ID(), |
|
1030 | + 'DTT_name' => $default ? '' : $dtt->name(), |
|
1031 | + 'DTT_description' => $default ? '' : $dtt->description(), |
|
1032 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1033 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1034 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
1035 | + 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
|
1036 | + 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
|
1037 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
1038 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable', |
|
1039 | + 'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event |
|
1040 | + ? '' |
|
1041 | + : EE_Admin_Page::add_query_args_and_nonce( |
|
1042 | + array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()), |
|
1043 | + REG_ADMIN_URL |
|
1044 | + ) |
|
1045 | + ); |
|
1046 | + |
|
1047 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1048 | + |
|
1049 | + //allow filtering of template args at this point. |
|
1050 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', |
|
1051 | + $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
1052 | + |
|
1053 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
1054 | + |
|
1055 | + return EEH_Template::display_template($template, $template_args, true); |
|
1056 | + } |
|
1057 | 1057 | |
1058 | 1058 | |
1059 | - protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) |
|
1060 | - { |
|
1061 | - |
|
1062 | - $template_args = array( |
|
1063 | - 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
|
1064 | - 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
|
1065 | - 'DTT_description' => $default ? '' : $dtt->description(), |
|
1066 | - 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
|
1067 | - 'show_tickets_row' => ' style="display:none;"', |
|
1068 | - //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
|
1069 | - 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', |
|
1070 | - $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false), |
|
1071 | - //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
1072 | - 'DTT_ID' => $default ? '' : $dtt->ID() |
|
1073 | - ); |
|
1074 | - |
|
1075 | - //need to setup the list items (but only if this isnt' a default skeleton setup) |
|
1076 | - if ( ! $default) { |
|
1077 | - $tktrow = 1; |
|
1078 | - foreach ($all_tickets as $ticket) { |
|
1079 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, |
|
1080 | - $dtt, $ticket, $datetime_tickets, $default); |
|
1081 | - $tktrow++; |
|
1082 | - } |
|
1083 | - } |
|
1084 | - |
|
1085 | - //filter template args at this point |
|
1086 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', |
|
1087 | - $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
1088 | - |
|
1089 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
1090 | - |
|
1091 | - return EEH_Template::display_template($template, $template_args, true); |
|
1092 | - } |
|
1059 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) |
|
1060 | + { |
|
1061 | + |
|
1062 | + $template_args = array( |
|
1063 | + 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
|
1064 | + 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
|
1065 | + 'DTT_description' => $default ? '' : $dtt->description(), |
|
1066 | + 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
|
1067 | + 'show_tickets_row' => ' style="display:none;"', |
|
1068 | + //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
|
1069 | + 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', |
|
1070 | + $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), false, false), |
|
1071 | + //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
1072 | + 'DTT_ID' => $default ? '' : $dtt->ID() |
|
1073 | + ); |
|
1074 | + |
|
1075 | + //need to setup the list items (but only if this isnt' a default skeleton setup) |
|
1076 | + if ( ! $default) { |
|
1077 | + $tktrow = 1; |
|
1078 | + foreach ($all_tickets as $ticket) { |
|
1079 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, |
|
1080 | + $dtt, $ticket, $datetime_tickets, $default); |
|
1081 | + $tktrow++; |
|
1082 | + } |
|
1083 | + } |
|
1084 | + |
|
1085 | + //filter template args at this point |
|
1086 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', |
|
1087 | + $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
1088 | + |
|
1089 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
1090 | + |
|
1091 | + return EEH_Template::display_template($template, $template_args, true); |
|
1092 | + } |
|
1093 | 1093 | |
1094 | 1094 | |
1095 | - protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) |
|
1096 | - { |
|
1097 | - $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
1098 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1099 | - |
|
1100 | - $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
1101 | - $template_args = array( |
|
1102 | - 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
|
1103 | - 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1104 | - 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
|
1105 | - 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
|
1106 | - 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1107 | - 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1108 | - ); |
|
1109 | - |
|
1110 | - //filter template args |
|
1111 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', |
|
1112 | - $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
1113 | - |
|
1114 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1115 | - |
|
1116 | - return EEH_Template::display_template($template, $template_args, true); |
|
1117 | - } |
|
1095 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) |
|
1096 | + { |
|
1097 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
1098 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1099 | + |
|
1100 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
1101 | + $template_args = array( |
|
1102 | + 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
|
1103 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1104 | + 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
|
1105 | + 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
|
1106 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1107 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1108 | + ); |
|
1109 | + |
|
1110 | + //filter template args |
|
1111 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', |
|
1112 | + $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
1113 | + |
|
1114 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1115 | + |
|
1116 | + return EEH_Template::display_template($template, $template_args, true); |
|
1117 | + } |
|
1118 | 1118 | |
1119 | 1119 | |
1120 | - /** |
|
1121 | - * This generates the ticket row for tickets. |
|
1122 | - * This same method is used to generate both the actual rows and the js skeleton row (when default == |
|
1123 | - * true) |
|
1124 | - * |
|
1125 | - * @param int $tktrow Represents the row number being generated. |
|
1126 | - * @param mixed null|EE_Ticket $ticket If default then this will |
|
1127 | - * be null. |
|
1128 | - * @param EE_Datetime[] $ticket_datetimes Either an array of all datetimes on all tickets indexed by |
|
1129 | - * each ticket or empty for default |
|
1130 | - * @param EE_Datetime[] $all_dtts All Datetimes on the event or empty for default. |
|
1131 | - * @param bool $default Whether default row being generated or not. |
|
1132 | - * @param EE_Ticket[] $all_tickets This is an array of all tickets attached to the event (or |
|
1133 | - * empty in the case of defaults) |
|
1134 | - * |
|
1135 | - * @return [type] [description] |
|
1136 | - */ |
|
1137 | - protected function _get_ticket_row( |
|
1138 | - $tktrow, |
|
1139 | - $ticket, |
|
1140 | - $ticket_datetimes, |
|
1141 | - $all_dtts, |
|
1142 | - $default = false, |
|
1143 | - $all_tickets = array() |
|
1144 | - ) { |
|
1145 | - |
|
1146 | - //if $ticket is not an instance of EE_Ticket then force default to true. |
|
1147 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1148 | - |
|
1149 | - $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', |
|
1150 | - array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1151 | - |
|
1152 | - //if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on |
|
1153 | - //the object. This is done by not including any query_params. |
|
1154 | - if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) { |
|
1155 | - $prices = $ticket->get_many_related('Price'); |
|
1156 | - } |
|
1157 | - |
|
1158 | - // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
|
1159 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? true : false; |
|
1160 | - |
|
1161 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1162 | - |
|
1163 | - $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
|
1164 | - $base_price = $default ? null : $ticket->base_price(); |
|
1165 | - $count_price_mods = EEM_Price::instance()->get_all_default_prices(true); |
|
1166 | - |
|
1167 | - //breaking out complicated condition for ticket_status |
|
1168 | - if ($default) { |
|
1169 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1170 | - } else { |
|
1171 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1172 | - } |
|
1173 | - |
|
1174 | - //breaking out complicated condition for TKT_taxable |
|
1175 | - if ($default) { |
|
1176 | - $TKT_taxable = ''; |
|
1177 | - } else { |
|
1178 | - $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
|
1179 | - } |
|
1180 | - |
|
1181 | - |
|
1182 | - $template_args = array( |
|
1183 | - 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1184 | - 'TKT_order' => $default ? 'TICKETNUM' : $tktrow, |
|
1185 | - //on initial page load this will always be the correct order. |
|
1186 | - 'tkt_status_class' => $ticket_status_class, |
|
1187 | - 'display_edit_tkt_row' => ' style="display:none;"', |
|
1188 | - 'edit_tkt_expanded' => '', |
|
1189 | - 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
|
1190 | - 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
|
1191 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', |
|
1192 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1193 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', |
|
1194 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1195 | - 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, false, |
|
1196 | - 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, false, |
|
1197 | - 'sentence') : $ticket->ticket_status(true), |
|
1198 | - 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), |
|
1199 | - false, false), |
|
1200 | - 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
|
1201 | - 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
|
1202 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1203 | - 'TKT_qty_for_input' => $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1204 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1205 | - 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1206 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1207 | - 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
|
1208 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array( |
|
1209 | - array( |
|
1210 | - 'STS_ID' => array( |
|
1211 | - '!=', |
|
1212 | - EEM_Registration::status_id_incomplete |
|
1213 | - ) |
|
1214 | - ) |
|
1215 | - )), |
|
1216 | - 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
|
1217 | - 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
|
1218 | - 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
|
1219 | - 'TKT_required' => $default ? 0 : $ticket->required(), |
|
1220 | - 'TKT_is_default_selector' => '', |
|
1221 | - 'ticket_price_rows' => '', |
|
1222 | - 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', |
|
1223 | - 'localized_float'), |
|
1224 | - 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
|
1225 | - 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1226 | - 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1227 | - 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
|
1228 | - 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
|
1229 | - 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
|
1230 | - 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
|
1231 | - 'existing_ticket_price_ids' => $default, |
|
1232 | - '', |
|
1233 | - implode(',', array_keys($prices)), |
|
1234 | - 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
|
1235 | - 'TKT_taxable' => $TKT_taxable, |
|
1236 | - 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
|
1237 | - 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
|
1238 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, false, false), |
|
1239 | - 'TKT_subtotal_amount' => $ticket_subtotal, |
|
1240 | - 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1241 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? true : false, |
|
1242 | - 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
|
1243 | - 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
|
1244 | - 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
|
1245 | - ); |
|
1246 | - |
|
1247 | - $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1248 | - |
|
1249 | - //handle rows that should NOT be empty |
|
1250 | - if (empty($template_args['TKT_start_date'])) { |
|
1251 | - //if empty then the start date will be now. |
|
1252 | - $template_args['TKT_start_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'], |
|
1253 | - current_time('timestamp')); |
|
1254 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1255 | - } |
|
1256 | - |
|
1257 | - if (empty($template_args['TKT_end_date'])) { |
|
1120 | + /** |
|
1121 | + * This generates the ticket row for tickets. |
|
1122 | + * This same method is used to generate both the actual rows and the js skeleton row (when default == |
|
1123 | + * true) |
|
1124 | + * |
|
1125 | + * @param int $tktrow Represents the row number being generated. |
|
1126 | + * @param mixed null|EE_Ticket $ticket If default then this will |
|
1127 | + * be null. |
|
1128 | + * @param EE_Datetime[] $ticket_datetimes Either an array of all datetimes on all tickets indexed by |
|
1129 | + * each ticket or empty for default |
|
1130 | + * @param EE_Datetime[] $all_dtts All Datetimes on the event or empty for default. |
|
1131 | + * @param bool $default Whether default row being generated or not. |
|
1132 | + * @param EE_Ticket[] $all_tickets This is an array of all tickets attached to the event (or |
|
1133 | + * empty in the case of defaults) |
|
1134 | + * |
|
1135 | + * @return [type] [description] |
|
1136 | + */ |
|
1137 | + protected function _get_ticket_row( |
|
1138 | + $tktrow, |
|
1139 | + $ticket, |
|
1140 | + $ticket_datetimes, |
|
1141 | + $all_dtts, |
|
1142 | + $default = false, |
|
1143 | + $all_tickets = array() |
|
1144 | + ) { |
|
1145 | + |
|
1146 | + //if $ticket is not an instance of EE_Ticket then force default to true. |
|
1147 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1148 | + |
|
1149 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', |
|
1150 | + array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1151 | + |
|
1152 | + //if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on |
|
1153 | + //the object. This is done by not including any query_params. |
|
1154 | + if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) { |
|
1155 | + $prices = $ticket->get_many_related('Price'); |
|
1156 | + } |
|
1157 | + |
|
1158 | + // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
|
1159 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? true : false; |
|
1160 | + |
|
1161 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1162 | + |
|
1163 | + $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
|
1164 | + $base_price = $default ? null : $ticket->base_price(); |
|
1165 | + $count_price_mods = EEM_Price::instance()->get_all_default_prices(true); |
|
1166 | + |
|
1167 | + //breaking out complicated condition for ticket_status |
|
1168 | + if ($default) { |
|
1169 | + $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1170 | + } else { |
|
1171 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1172 | + } |
|
1173 | + |
|
1174 | + //breaking out complicated condition for TKT_taxable |
|
1175 | + if ($default) { |
|
1176 | + $TKT_taxable = ''; |
|
1177 | + } else { |
|
1178 | + $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
|
1179 | + } |
|
1180 | + |
|
1181 | + |
|
1182 | + $template_args = array( |
|
1183 | + 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1184 | + 'TKT_order' => $default ? 'TICKETNUM' : $tktrow, |
|
1185 | + //on initial page load this will always be the correct order. |
|
1186 | + 'tkt_status_class' => $ticket_status_class, |
|
1187 | + 'display_edit_tkt_row' => ' style="display:none;"', |
|
1188 | + 'edit_tkt_expanded' => '', |
|
1189 | + 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
|
1190 | + 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
|
1191 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', |
|
1192 | + $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1193 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', |
|
1194 | + $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1195 | + 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, false, |
|
1196 | + 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, false, |
|
1197 | + 'sentence') : $ticket->ticket_status(true), |
|
1198 | + 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), |
|
1199 | + false, false), |
|
1200 | + 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
|
1201 | + 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
|
1202 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1203 | + 'TKT_qty_for_input' => $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1204 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1205 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1206 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1207 | + 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
|
1208 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array( |
|
1209 | + array( |
|
1210 | + 'STS_ID' => array( |
|
1211 | + '!=', |
|
1212 | + EEM_Registration::status_id_incomplete |
|
1213 | + ) |
|
1214 | + ) |
|
1215 | + )), |
|
1216 | + 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
|
1217 | + 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
|
1218 | + 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
|
1219 | + 'TKT_required' => $default ? 0 : $ticket->required(), |
|
1220 | + 'TKT_is_default_selector' => '', |
|
1221 | + 'ticket_price_rows' => '', |
|
1222 | + 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', |
|
1223 | + 'localized_float'), |
|
1224 | + 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
|
1225 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1226 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1227 | + 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
|
1228 | + 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
|
1229 | + 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
|
1230 | + 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
|
1231 | + 'existing_ticket_price_ids' => $default, |
|
1232 | + '', |
|
1233 | + implode(',', array_keys($prices)), |
|
1234 | + 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
|
1235 | + 'TKT_taxable' => $TKT_taxable, |
|
1236 | + 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
|
1237 | + 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
|
1238 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, false, false), |
|
1239 | + 'TKT_subtotal_amount' => $ticket_subtotal, |
|
1240 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1241 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? true : false, |
|
1242 | + 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
|
1243 | + 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
|
1244 | + 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
|
1245 | + ); |
|
1246 | + |
|
1247 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1248 | + |
|
1249 | + //handle rows that should NOT be empty |
|
1250 | + if (empty($template_args['TKT_start_date'])) { |
|
1251 | + //if empty then the start date will be now. |
|
1252 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'], |
|
1253 | + current_time('timestamp')); |
|
1254 | + $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1255 | + } |
|
1256 | + |
|
1257 | + if (empty($template_args['TKT_end_date'])) { |
|
1258 | 1258 | |
1259 | - //get the earliest datetime (if present); |
|
1260 | - $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', |
|
1261 | - array('order_by' => array('DTT_EVT_start' => 'ASC'))) : null; |
|
1259 | + //get the earliest datetime (if present); |
|
1260 | + $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', |
|
1261 | + array('order_by' => array('DTT_EVT_start' => 'ASC'))) : null; |
|
1262 | 1262 | |
1263 | - if ( ! empty($earliest_dtt)) { |
|
1264 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', |
|
1265 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
1266 | - } else { |
|
1267 | - //default so let's just use what's been set for the default date-time which is 30 days from now. |
|
1268 | - $template_args['TKT_end_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'], |
|
1269 | - mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1270 | - } |
|
1271 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1272 | - } |
|
1273 | - |
|
1274 | - //generate ticket_datetime items |
|
1275 | - if ( ! $default) { |
|
1276 | - $dttrow = 1; |
|
1277 | - foreach ($all_dtts as $dtt) { |
|
1278 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, |
|
1279 | - $ticket, $ticket_datetimes, $default); |
|
1280 | - $dttrow++; |
|
1281 | - } |
|
1282 | - } |
|
1283 | - |
|
1284 | - $prcrow = 1; |
|
1285 | - foreach ($prices as $price) { |
|
1286 | - if ($price->is_base_price()) { |
|
1287 | - $prcrow++; |
|
1288 | - continue; |
|
1289 | - } |
|
1290 | - $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? false : true; |
|
1291 | - $show_create = count($prices) > 1 && count($prices) !== $prcrow ? false : true; |
|
1292 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, |
|
1293 | - $ticket, $show_trash, $show_create); |
|
1294 | - $prcrow++; |
|
1295 | - } |
|
1296 | - |
|
1297 | - //filter $template_args |
|
1298 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', |
|
1299 | - $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, |
|
1300 | - $this->_is_creating_event); |
|
1301 | - |
|
1302 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1303 | - |
|
1304 | - return EEH_Template::display_template($template, $template_args, true); |
|
1305 | - } |
|
1263 | + if ( ! empty($earliest_dtt)) { |
|
1264 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', |
|
1265 | + $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
1266 | + } else { |
|
1267 | + //default so let's just use what's been set for the default date-time which is 30 days from now. |
|
1268 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'], |
|
1269 | + mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1270 | + } |
|
1271 | + $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1272 | + } |
|
1273 | + |
|
1274 | + //generate ticket_datetime items |
|
1275 | + if ( ! $default) { |
|
1276 | + $dttrow = 1; |
|
1277 | + foreach ($all_dtts as $dtt) { |
|
1278 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, |
|
1279 | + $ticket, $ticket_datetimes, $default); |
|
1280 | + $dttrow++; |
|
1281 | + } |
|
1282 | + } |
|
1283 | + |
|
1284 | + $prcrow = 1; |
|
1285 | + foreach ($prices as $price) { |
|
1286 | + if ($price->is_base_price()) { |
|
1287 | + $prcrow++; |
|
1288 | + continue; |
|
1289 | + } |
|
1290 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? false : true; |
|
1291 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? false : true; |
|
1292 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, |
|
1293 | + $ticket, $show_trash, $show_create); |
|
1294 | + $prcrow++; |
|
1295 | + } |
|
1296 | + |
|
1297 | + //filter $template_args |
|
1298 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', |
|
1299 | + $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, |
|
1300 | + $this->_is_creating_event); |
|
1301 | + |
|
1302 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1303 | + |
|
1304 | + return EEH_Template::display_template($template, $template_args, true); |
|
1305 | + } |
|
1306 | 1306 | |
1307 | 1307 | |
1308 | - protected function _get_tax_rows($tktrow, $ticket) |
|
1309 | - { |
|
1310 | - $tax_rows = ''; |
|
1311 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1312 | - $template_args = array(); |
|
1313 | - $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1314 | - foreach ($taxes as $tax) { |
|
1315 | - $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1316 | - $template_args = array( |
|
1317 | - 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1318 | - 'tax_id' => $tax->ID(), |
|
1319 | - 'tkt_row' => $tktrow, |
|
1320 | - 'tax_label' => $tax->get('PRC_name'), |
|
1321 | - 'tax_added' => $tax_added, |
|
1322 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, false, false), |
|
1323 | - 'tax_amount' => $tax->get('PRC_amount') |
|
1324 | - ); |
|
1325 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', |
|
1326 | - $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1327 | - $tax_rows .= EEH_Template::display_template($template, $template_args, true); |
|
1328 | - } |
|
1329 | - |
|
1330 | - |
|
1331 | - return $tax_rows; |
|
1332 | - } |
|
1308 | + protected function _get_tax_rows($tktrow, $ticket) |
|
1309 | + { |
|
1310 | + $tax_rows = ''; |
|
1311 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1312 | + $template_args = array(); |
|
1313 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1314 | + foreach ($taxes as $tax) { |
|
1315 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1316 | + $template_args = array( |
|
1317 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1318 | + 'tax_id' => $tax->ID(), |
|
1319 | + 'tkt_row' => $tktrow, |
|
1320 | + 'tax_label' => $tax->get('PRC_name'), |
|
1321 | + 'tax_added' => $tax_added, |
|
1322 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, false, false), |
|
1323 | + 'tax_amount' => $tax->get('PRC_amount') |
|
1324 | + ); |
|
1325 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', |
|
1326 | + $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1327 | + $tax_rows .= EEH_Template::display_template($template, $template_args, true); |
|
1328 | + } |
|
1329 | + |
|
1330 | + |
|
1331 | + return $tax_rows; |
|
1332 | + } |
|
1333 | 1333 | |
1334 | 1334 | |
1335 | - protected function _get_tax_added(EE_Price $tax, $ticket) |
|
1336 | - { |
|
1337 | - $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1335 | + protected function _get_tax_added(EE_Price $tax, $ticket) |
|
1336 | + { |
|
1337 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1338 | 1338 | |
1339 | - return $subtotal * $tax->get('PRC_amount') / 100; |
|
1340 | - } |
|
1339 | + return $subtotal * $tax->get('PRC_amount') / 100; |
|
1340 | + } |
|
1341 | 1341 | |
1342 | 1342 | |
1343 | - protected function _get_ticket_price_row( |
|
1344 | - $tktrow, |
|
1345 | - $prcrow, |
|
1346 | - $price, |
|
1347 | - $default, |
|
1348 | - $ticket, |
|
1349 | - $show_trash = true, |
|
1350 | - $show_create = true |
|
1351 | - ) { |
|
1352 | - $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false; |
|
1353 | - $template_args = array( |
|
1354 | - 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1355 | - 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1356 | - 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
|
1357 | - 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, |
|
1358 | - $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1359 | - 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
|
1360 | - 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
|
1361 | - 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
|
1362 | - 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
|
1363 | - 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
|
1364 | - 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1365 | - 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1366 | - 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1367 | - 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', |
|
1368 | - 'localized_float'), |
|
1369 | - 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1370 | - 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
|
1371 | - 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
|
1372 | - 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1373 | - 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false |
|
1374 | - ); |
|
1375 | - |
|
1376 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', |
|
1377 | - $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, |
|
1378 | - $this->_is_creating_event); |
|
1379 | - |
|
1380 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1381 | - |
|
1382 | - return EEH_Template::display_template($template, $template_args, true); |
|
1383 | - } |
|
1343 | + protected function _get_ticket_price_row( |
|
1344 | + $tktrow, |
|
1345 | + $prcrow, |
|
1346 | + $price, |
|
1347 | + $default, |
|
1348 | + $ticket, |
|
1349 | + $show_trash = true, |
|
1350 | + $show_create = true |
|
1351 | + ) { |
|
1352 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false; |
|
1353 | + $template_args = array( |
|
1354 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1355 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1356 | + 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
|
1357 | + 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, |
|
1358 | + $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1359 | + 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
|
1360 | + 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
|
1361 | + 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
|
1362 | + 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
|
1363 | + 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
|
1364 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1365 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1366 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1367 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', |
|
1368 | + 'localized_float'), |
|
1369 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1370 | + 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
|
1371 | + 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
|
1372 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1373 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? true : false |
|
1374 | + ); |
|
1375 | + |
|
1376 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', |
|
1377 | + $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, |
|
1378 | + $this->_is_creating_event); |
|
1379 | + |
|
1380 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1381 | + |
|
1382 | + return EEH_Template::display_template($template, $template_args, true); |
|
1383 | + } |
|
1384 | 1384 | |
1385 | 1385 | |
1386 | - protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = false) |
|
1387 | - { |
|
1388 | - if ($price->is_base_price()) { |
|
1389 | - return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1390 | - } else { |
|
1391 | - return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1392 | - } |
|
1393 | - |
|
1394 | - } |
|
1386 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = false) |
|
1387 | + { |
|
1388 | + if ($price->is_base_price()) { |
|
1389 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1390 | + } else { |
|
1391 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1392 | + } |
|
1393 | + |
|
1394 | + } |
|
1395 | 1395 | |
1396 | 1396 | |
1397 | - protected function _get_base_price_template($tktrow, $prcrow, $price, $default) |
|
1398 | - { |
|
1399 | - $template_args = array( |
|
1400 | - 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1401 | - 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1402 | - 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1403 | - 'PRT_name' => __('Price', 'event_espresso'), |
|
1404 | - 'price_selected_operator' => '+', |
|
1405 | - 'price_selected_is_percent' => 0 |
|
1406 | - ); |
|
1407 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1408 | - |
|
1409 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', |
|
1410 | - $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1411 | - |
|
1412 | - return EEH_Template::display_template($template, $template_args, true); |
|
1413 | - } |
|
1397 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) |
|
1398 | + { |
|
1399 | + $template_args = array( |
|
1400 | + 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1401 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1402 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1403 | + 'PRT_name' => __('Price', 'event_espresso'), |
|
1404 | + 'price_selected_operator' => '+', |
|
1405 | + 'price_selected_is_percent' => 0 |
|
1406 | + ); |
|
1407 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1408 | + |
|
1409 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', |
|
1410 | + $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1411 | + |
|
1412 | + return EEH_Template::display_template($template, $template_args, true); |
|
1413 | + } |
|
1414 | 1414 | |
1415 | 1415 | |
1416 | - protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = false) |
|
1417 | - { |
|
1418 | - $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1419 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( |
|
1420 | - array( |
|
1421 | - 'OR' => array( |
|
1422 | - 'PBT_ID' => '2', |
|
1423 | - 'PBT_ID*' => '3' |
|
1424 | - ) |
|
1425 | - ) |
|
1426 | - )); |
|
1427 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1428 | - $all_price_types = $default && empty($price) ? array( |
|
1429 | - array( |
|
1430 | - 'id' => 0, |
|
1431 | - 'text' => __('Select Modifier', 'event_espresso') |
|
1432 | - ) |
|
1433 | - ) : array(); |
|
1434 | - $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1435 | - $price_option_spans = ''; |
|
1436 | - //setup pricetypes for selector |
|
1437 | - foreach ($price_types as $price_type) { |
|
1438 | - $all_price_types[] = array( |
|
1439 | - 'id' => $price_type->ID(), |
|
1440 | - 'text' => $price_type->get('PRT_name'), |
|
1441 | - ); |
|
1416 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = false) |
|
1417 | + { |
|
1418 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1419 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( |
|
1420 | + array( |
|
1421 | + 'OR' => array( |
|
1422 | + 'PBT_ID' => '2', |
|
1423 | + 'PBT_ID*' => '3' |
|
1424 | + ) |
|
1425 | + ) |
|
1426 | + )); |
|
1427 | + $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1428 | + $all_price_types = $default && empty($price) ? array( |
|
1429 | + array( |
|
1430 | + 'id' => 0, |
|
1431 | + 'text' => __('Select Modifier', 'event_espresso') |
|
1432 | + ) |
|
1433 | + ) : array(); |
|
1434 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1435 | + $price_option_spans = ''; |
|
1436 | + //setup pricetypes for selector |
|
1437 | + foreach ($price_types as $price_type) { |
|
1438 | + $all_price_types[] = array( |
|
1439 | + 'id' => $price_type->ID(), |
|
1440 | + 'text' => $price_type->get('PRT_name'), |
|
1441 | + ); |
|
1442 | 1442 | |
1443 | - //while we're in the loop let's setup the option spans used by js |
|
1444 | - $spanargs = array( |
|
1445 | - 'PRT_ID' => $price_type->ID(), |
|
1446 | - 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
|
1447 | - 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
|
1448 | - ); |
|
1449 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, true); |
|
1450 | - } |
|
1451 | - |
|
1452 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1453 | - $main_name = $select_name; |
|
1454 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1455 | - |
|
1456 | - $template_args = array( |
|
1457 | - 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1458 | - 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1459 | - 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, |
|
1460 | - $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1461 | - 'main_name' => $main_name, |
|
1462 | - 'selected_price_type_id' => $selected_price_type_id, |
|
1463 | - 'price_option_spans' => $price_option_spans, |
|
1464 | - 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1465 | - 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1466 | - 'disabled' => $disabled |
|
1467 | - ); |
|
1468 | - |
|
1469 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', |
|
1470 | - $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1471 | - |
|
1472 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1473 | - |
|
1474 | - return EEH_Template::display_template($template, $template_args, true); |
|
1475 | - } |
|
1443 | + //while we're in the loop let's setup the option spans used by js |
|
1444 | + $spanargs = array( |
|
1445 | + 'PRT_ID' => $price_type->ID(), |
|
1446 | + 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
|
1447 | + 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
|
1448 | + ); |
|
1449 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, true); |
|
1450 | + } |
|
1451 | + |
|
1452 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1453 | + $main_name = $select_name; |
|
1454 | + $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1455 | + |
|
1456 | + $template_args = array( |
|
1457 | + 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1458 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1459 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, |
|
1460 | + $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1461 | + 'main_name' => $main_name, |
|
1462 | + 'selected_price_type_id' => $selected_price_type_id, |
|
1463 | + 'price_option_spans' => $price_option_spans, |
|
1464 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1465 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1466 | + 'disabled' => $disabled |
|
1467 | + ); |
|
1468 | + |
|
1469 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', |
|
1470 | + $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1471 | + |
|
1472 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1473 | + |
|
1474 | + return EEH_Template::display_template($template, $template_args, true); |
|
1475 | + } |
|
1476 | 1476 | |
1477 | 1477 | |
1478 | - protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) |
|
1479 | - { |
|
1480 | - $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1481 | - $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1482 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1483 | - $template_args = array( |
|
1484 | - 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1485 | - 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1486 | - 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1487 | - 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1488 | - 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(true), |
|
1489 | - 'tkt_status_class' => '', |
|
1490 | - ); |
|
1491 | - |
|
1492 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', |
|
1493 | - $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1494 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1495 | - |
|
1496 | - return EEH_Template::display_template($template, $template_args, true); |
|
1497 | - } |
|
1478 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) |
|
1479 | + { |
|
1480 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1481 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1482 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1483 | + $template_args = array( |
|
1484 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1485 | + 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
|
1486 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1487 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1488 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(true), |
|
1489 | + 'tkt_status_class' => '', |
|
1490 | + ); |
|
1491 | + |
|
1492 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', |
|
1493 | + $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1494 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1495 | + |
|
1496 | + return EEH_Template::display_template($template, $template_args, true); |
|
1497 | + } |
|
1498 | 1498 | |
1499 | 1499 | |
1500 | - protected function _get_ticket_js_structure($all_dtts, $all_tickets) |
|
1501 | - { |
|
1502 | - $template_args = array( |
|
1503 | - 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', null, true, $all_dtts), |
|
1504 | - 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', null, array(), array(), |
|
1505 | - true), |
|
1506 | - 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', null, |
|
1507 | - true, null), |
|
1508 | - 'default_price_rows' => '', |
|
1509 | - 'default_base_price_amount' => 0, |
|
1510 | - 'default_base_price_name' => '', |
|
1511 | - 'default_base_price_description' => '', |
|
1512 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', |
|
1513 | - null, true), |
|
1514 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', null, array(), |
|
1515 | - array(), true), |
|
1516 | - 'existing_available_datetime_tickets_list' => '', |
|
1517 | - 'existing_available_ticket_datetimes_list' => '', |
|
1518 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', |
|
1519 | - null, null, array(), true), |
|
1520 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', |
|
1521 | - null, null, array(), true) |
|
1522 | - ); |
|
1523 | - |
|
1524 | - $tktrow = 1; |
|
1525 | - foreach ($all_tickets as $ticket) { |
|
1526 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', |
|
1527 | - $tktrow, null, $ticket, array(), true); |
|
1528 | - $tktrow++; |
|
1529 | - } |
|
1530 | - |
|
1531 | - |
|
1532 | - $dttrow = 1; |
|
1533 | - foreach ($all_dtts as $dtt) { |
|
1534 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, |
|
1535 | - 'TICKETNUM', $dtt, null, array(), true); |
|
1536 | - $dttrow++; |
|
1537 | - } |
|
1538 | - |
|
1539 | - $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
|
1540 | - $prcrow = 1; |
|
1541 | - foreach ($default_prices as $price) { |
|
1542 | - if ($price->is_base_price()) { |
|
1543 | - $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
|
1544 | - $template_args['default_base_price_name'] = $price->get('PRC_name'); |
|
1545 | - $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
|
1546 | - $prcrow++; |
|
1547 | - continue; |
|
1548 | - } |
|
1549 | - $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? false : true; |
|
1550 | - $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? false : true; |
|
1551 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, true, |
|
1552 | - null, $show_trash, $show_create); |
|
1553 | - $prcrow++; |
|
1554 | - } |
|
1555 | - |
|
1556 | - $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', |
|
1557 | - $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1558 | - |
|
1559 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1560 | - |
|
1561 | - return EEH_Template::display_template($template, $template_args, true); |
|
1562 | - } |
|
1500 | + protected function _get_ticket_js_structure($all_dtts, $all_tickets) |
|
1501 | + { |
|
1502 | + $template_args = array( |
|
1503 | + 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', null, true, $all_dtts), |
|
1504 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', null, array(), array(), |
|
1505 | + true), |
|
1506 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', null, |
|
1507 | + true, null), |
|
1508 | + 'default_price_rows' => '', |
|
1509 | + 'default_base_price_amount' => 0, |
|
1510 | + 'default_base_price_name' => '', |
|
1511 | + 'default_base_price_description' => '', |
|
1512 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', |
|
1513 | + null, true), |
|
1514 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', null, array(), |
|
1515 | + array(), true), |
|
1516 | + 'existing_available_datetime_tickets_list' => '', |
|
1517 | + 'existing_available_ticket_datetimes_list' => '', |
|
1518 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', |
|
1519 | + null, null, array(), true), |
|
1520 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', |
|
1521 | + null, null, array(), true) |
|
1522 | + ); |
|
1523 | + |
|
1524 | + $tktrow = 1; |
|
1525 | + foreach ($all_tickets as $ticket) { |
|
1526 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', |
|
1527 | + $tktrow, null, $ticket, array(), true); |
|
1528 | + $tktrow++; |
|
1529 | + } |
|
1530 | + |
|
1531 | + |
|
1532 | + $dttrow = 1; |
|
1533 | + foreach ($all_dtts as $dtt) { |
|
1534 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, |
|
1535 | + 'TICKETNUM', $dtt, null, array(), true); |
|
1536 | + $dttrow++; |
|
1537 | + } |
|
1538 | + |
|
1539 | + $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
|
1540 | + $prcrow = 1; |
|
1541 | + foreach ($default_prices as $price) { |
|
1542 | + if ($price->is_base_price()) { |
|
1543 | + $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
|
1544 | + $template_args['default_base_price_name'] = $price->get('PRC_name'); |
|
1545 | + $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
|
1546 | + $prcrow++; |
|
1547 | + continue; |
|
1548 | + } |
|
1549 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? false : true; |
|
1550 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? false : true; |
|
1551 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, true, |
|
1552 | + null, $show_trash, $show_create); |
|
1553 | + $prcrow++; |
|
1554 | + } |
|
1555 | + |
|
1556 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', |
|
1557 | + $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1558 | + |
|
1559 | + $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1560 | + |
|
1561 | + return EEH_Template::display_template($template, $template_args, true); |
|
1562 | + } |
|
1563 | 1563 | |
1564 | 1564 | |
1565 | 1565 | } //end class espresso_events_Pricing_Hooks |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'context' => 'normal' |
74 | 74 | ), |
75 | 75 | |
76 | - );/**/ |
|
76 | + ); /**/ |
|
77 | 77 | |
78 | 78 | $this->_remove_metaboxes = array( |
79 | 79 | 0 => array( |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
104 | 104 | |
105 | 105 | //validate format strings |
106 | - $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
106 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
107 | 107 | if (is_array($format_validation)) { |
108 | - $msg = '<p>' . sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', |
|
108 | + $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', |
|
109 | 109 | 'event_espresso'), |
110 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']) . '</p><ul>'; |
|
110 | + $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>'; |
|
111 | 111 | foreach ($format_validation as $error) { |
112 | - $msg .= '<li>' . $error . '</li>'; |
|
112 | + $msg .= '<li>'.$error.'</li>'; |
|
113 | 113 | } |
114 | - $msg .= '</ul></p><p>' . sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', |
|
115 | - 'event_espresso'), '<span style="color:#D54E21;">', '</span>') . '</p>'; |
|
114 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', |
|
115 | + 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
116 | 116 | EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
117 | 117 | $this->_date_format_strings = array( |
118 | 118 | 'date' => 'Y-m-d', |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | $this->_scripts_styles = array( |
125 | 125 | 'registers' => array( |
126 | 126 | 'ee-tickets-datetimes-css' => array( |
127 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
127 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
128 | 128 | 'type' => 'css' |
129 | 129 | ), |
130 | 130 | 'ee-dtt-ticket-metabox' => array( |
131 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
131 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
132 | 132 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
133 | 133 | ) |
134 | 134 | ), |
@@ -147,19 +147,19 @@ discard block |
||
147 | 147 | 'event_espresso'), |
148 | 148 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', |
149 | 149 | 'event_espresso'), |
150 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', |
|
151 | - 'event_espresso') . '</button>', |
|
150 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', |
|
151 | + 'event_espresso').'</button>', |
|
152 | 152 | 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', |
153 | 153 | 'event_espresso'), |
154 | 154 | 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', |
155 | 155 | 'event_espresso'), |
156 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', |
|
157 | - 'event_espresso') . '</button>' |
|
156 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', |
|
157 | + 'event_espresso').'</button>' |
|
158 | 158 | ), |
159 | 159 | 'DTT_ERROR_MSG' => array( |
160 | 160 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
161 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', |
|
162 | - 'event_espresso') . '</button></div>' |
|
161 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', |
|
162 | + 'event_espresso').'</button></div>' |
|
163 | 163 | ), |
164 | 164 | 'DTT_OVERSELL_WARNING' => array( |
165 | 165 | 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ), |
170 | 170 | 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], |
171 | 171 | $this->_date_format_strings['time']), |
172 | - 'DTT_START_OF_WEEK' => array('dayValue' => (int)get_option('start_of_week')) |
|
172 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
173 | 173 | ) |
174 | 174 | ) |
175 | 175 | ); |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | |
230 | 230 | foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
231 | 231 | //trim all values to ensure any excess whitespace is removed. |
232 | - $dtt = array_map( |
|
233 | - function ($datetime_data) { |
|
232 | + $dtt = array_map( |
|
233 | + function($datetime_data) { |
|
234 | 234 | return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
235 | 235 | }, |
236 | 236 | $dtt |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | // trim inputs to ensure any excess whitespace is removed. |
368 | 368 | $tkt = array_map( |
369 | - function ($ticket_data) { |
|
369 | + function($ticket_data) { |
|
370 | 370 | return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
371 | 371 | }, |
372 | 372 | $tkt |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
376 | 376 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
377 | - $ticket_price = isset($tkt['TKT_price']) ? round((float)$tkt['TKT_price'], 3) : 0; |
|
377 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
378 | 378 | |
379 | 379 | //note incoming base price needs converted from localized value. |
380 | 380 | $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if (empty($tkt['TKT_start_date'])) { |
389 | 389 | //lets' use now in the set timezone. |
390 | 390 | $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
391 | - $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
391 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | if (empty($tkt['TKT_end_date'])) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * set the TKT_end_date to the first datetime attached to the ticket. |
397 | 397 | */ |
398 | 398 | $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
399 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time']); |
|
399 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | $TKT_values = array( |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | // first let's add datetimes |
627 | 627 | if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
628 | 628 | foreach ($added_datetimes as $row_id) { |
629 | - $row_id = (int)$row_id; |
|
629 | + $row_id = (int) $row_id; |
|
630 | 630 | if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
631 | 631 | $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
632 | 632 | // Is this an existing ticket (has an ID) and does it have any sold? |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | // then remove datetimes |
642 | 642 | if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
643 | 643 | foreach ($removed_datetimes as $row_id) { |
644 | - $row_id = (int)$row_id; |
|
644 | + $row_id = (int) $row_id; |
|
645 | 645 | // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
646 | 646 | // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
647 | 647 | if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
@@ -946,9 +946,9 @@ discard block |
||
946 | 946 | $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
947 | 947 | |
948 | 948 | //sort $all_tickets by order |
949 | - usort($all_tickets, function ($a, $b) { |
|
950 | - $a_order = (int)$a->get('TKT_order'); |
|
951 | - $b_order = (int)$b->get('TKT_order'); |
|
949 | + usort($all_tickets, function($a, $b) { |
|
950 | + $a_order = (int) $a->get('TKT_order'); |
|
951 | + $b_order = (int) $b->get('TKT_order'); |
|
952 | 952 | if ($a_order == $b_order) { |
953 | 953 | return 0; |
954 | 954 | } |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | } |
974 | 974 | |
975 | 975 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
976 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
976 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
977 | 977 | EEH_Template::display_template($template, $main_template_args); |
978 | 978 | |
979 | 979 | return; |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | $all_tickets, $default), |
996 | 996 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
997 | 997 | ); |
998 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
998 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
999 | 999 | |
1000 | 1000 | return EEH_Template::display_template($template, $dtt_display_template_args, true); |
1001 | 1001 | } |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
1030 | 1030 | 'DTT_name' => $default ? '' : $dtt->name(), |
1031 | 1031 | 'DTT_description' => $default ? '' : $dtt->description(), |
1032 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1033 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1032 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1033 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1034 | 1034 | 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
1035 | 1035 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
1036 | 1036 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', |
1051 | 1051 | $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
1052 | 1052 | |
1053 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
1053 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
1054 | 1054 | |
1055 | 1055 | return EEH_Template::display_template($template, $template_args, true); |
1056 | 1056 | } |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', |
1087 | 1087 | $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
1088 | 1088 | |
1089 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
1089 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
1090 | 1090 | |
1091 | 1091 | return EEH_Template::display_template($template, $template_args, true); |
1092 | 1092 | } |
@@ -1104,14 +1104,14 @@ discard block |
||
1104 | 1104 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
1105 | 1105 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
1106 | 1106 | 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
1107 | - 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1107 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
1108 | 1108 | ); |
1109 | 1109 | |
1110 | 1110 | //filter template args |
1111 | 1111 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', |
1112 | 1112 | $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
1113 | 1113 | |
1114 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1114 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1115 | 1115 | |
1116 | 1116 | return EEH_Template::display_template($template, $template_args, true); |
1117 | 1117 | } |
@@ -1166,9 +1166,9 @@ discard block |
||
1166 | 1166 | |
1167 | 1167 | //breaking out complicated condition for ticket_status |
1168 | 1168 | if ($default) { |
1169 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1169 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
1170 | 1170 | } else { |
1171 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1171 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | //breaking out complicated condition for TKT_taxable |
@@ -1189,9 +1189,9 @@ discard block |
||
1189 | 1189 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
1190 | 1190 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
1191 | 1191 | 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', |
1192 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1192 | + $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1193 | 1193 | 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', |
1194 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']), |
|
1194 | + $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1195 | 1195 | 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, false, |
1196 | 1196 | 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, false, |
1197 | 1197 | 'sentence') : $ticket->ticket_status(true), |
@@ -1249,9 +1249,9 @@ discard block |
||
1249 | 1249 | //handle rows that should NOT be empty |
1250 | 1250 | if (empty($template_args['TKT_start_date'])) { |
1251 | 1251 | //if empty then the start date will be now. |
1252 | - $template_args['TKT_start_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'], |
|
1252 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], |
|
1253 | 1253 | current_time('timestamp')); |
1254 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1254 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | if (empty($template_args['TKT_end_date'])) { |
@@ -1262,13 +1262,13 @@ discard block |
||
1262 | 1262 | |
1263 | 1263 | if ( ! empty($earliest_dtt)) { |
1264 | 1264 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', |
1265 | - $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']); |
|
1265 | + $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1266 | 1266 | } else { |
1267 | 1267 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1268 | - $template_args['TKT_end_date'] = date($this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'], |
|
1268 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], |
|
1269 | 1269 | mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
1270 | 1270 | } |
1271 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1271 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | //generate ticket_datetime items |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, |
1300 | 1300 | $this->_is_creating_event); |
1301 | 1301 | |
1302 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1302 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1303 | 1303 | |
1304 | 1304 | return EEH_Template::display_template($template, $template_args, true); |
1305 | 1305 | } |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | protected function _get_tax_rows($tktrow, $ticket) |
1309 | 1309 | { |
1310 | 1310 | $tax_rows = ''; |
1311 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1311 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1312 | 1312 | $template_args = array(); |
1313 | 1313 | $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
1314 | 1314 | foreach ($taxes as $tax) { |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, |
1378 | 1378 | $this->_is_creating_event); |
1379 | 1379 | |
1380 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1380 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1381 | 1381 | |
1382 | 1382 | return EEH_Template::display_template($template, $template_args, true); |
1383 | 1383 | } |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | 'price_selected_operator' => '+', |
1405 | 1405 | 'price_selected_is_percent' => 0 |
1406 | 1406 | ); |
1407 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1407 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1408 | 1408 | |
1409 | 1409 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', |
1410 | 1410 | $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = false) |
1417 | 1417 | { |
1418 | - $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1418 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1419 | 1419 | $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( |
1420 | 1420 | array( |
1421 | 1421 | 'OR' => array( |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | ) |
1425 | 1425 | ) |
1426 | 1426 | )); |
1427 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1427 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1428 | 1428 | $all_price_types = $default && empty($price) ? array( |
1429 | 1429 | array( |
1430 | 1430 | 'id' => 0, |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | |
1452 | 1452 | $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
1453 | 1453 | $main_name = $select_name; |
1454 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1454 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1455 | 1455 | |
1456 | 1456 | $template_args = array( |
1457 | 1457 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', |
1470 | 1470 | $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
1471 | 1471 | |
1472 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1472 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1473 | 1473 | |
1474 | 1474 | return EEH_Template::display_template($template, $template_args, true); |
1475 | 1475 | } |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | |
1492 | 1492 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', |
1493 | 1493 | $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
1494 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1494 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1495 | 1495 | |
1496 | 1496 | return EEH_Template::display_template($template, $template_args, true); |
1497 | 1497 | } |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', |
1557 | 1557 | $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
1558 | 1558 | |
1559 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1559 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1560 | 1560 | |
1561 | 1561 | return EEH_Template::display_template($template, $template_args, true); |
1562 | 1562 | } |