@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function venue_location($content) |
| 172 | 172 | { |
| 173 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
| 173 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
@@ -185,16 +185,16 @@ discard block |
||
| 185 | 185 | // get some style |
| 186 | 186 | if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
| 187 | 187 | // first check theme folder |
| 188 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
| 188 | + if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) { |
|
| 189 | 189 | wp_register_style( |
| 190 | 190 | $this->theme, |
| 191 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
| 191 | + get_stylesheet_directory_uri().$this->theme.'/style.css', |
|
| 192 | 192 | array('dashicons', 'espresso_default') |
| 193 | 193 | ); |
| 194 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
| 194 | + } elseif (is_readable(EE_TEMPLATES.$this->theme.'/style.css')) { |
|
| 195 | 195 | wp_register_style( |
| 196 | 196 | $this->theme, |
| 197 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
| 197 | + EE_TEMPLATES_URL.$this->theme.'/style.css', |
|
| 198 | 198 | array('dashicons', 'espresso_default') |
| 199 | 199 | ); |
| 200 | 200 | } |
@@ -28,178 +28,178 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class EED_Venues_Archive extends EED_Module |
| 30 | 30 | { |
| 31 | - /** |
|
| 32 | - * @return EED_Venues_Archive |
|
| 33 | - */ |
|
| 34 | - public static function instance() |
|
| 35 | - { |
|
| 36 | - return parent::get_instance(__CLASS__); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
| 42 | - * |
|
| 43 | - * @return void |
|
| 44 | - * @throws InvalidArgumentException |
|
| 45 | - * @throws InvalidDataTypeException |
|
| 46 | - * @throws InvalidInterfaceException |
|
| 47 | - */ |
|
| 48 | - public static function set_hooks() |
|
| 49 | - { |
|
| 50 | - /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
| 51 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
| 52 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
| 53 | - ); |
|
| 54 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
| 55 | - EE_Config::register_route( |
|
| 56 | - $custom_post_types['espresso_venues']['plural_slug'], |
|
| 57 | - 'Venues_Archive', |
|
| 58 | - 'run' |
|
| 59 | - ); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
| 64 | - * |
|
| 65 | - * @access public |
|
| 66 | - * @return void |
|
| 67 | - */ |
|
| 68 | - public static function set_hooks_admin() |
|
| 69 | - { |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * run - initial module setup |
|
| 75 | - * |
|
| 76 | - * @access public |
|
| 77 | - * @param \WP $WP |
|
| 78 | - */ |
|
| 79 | - public function run($WP) |
|
| 80 | - { |
|
| 81 | - // check what template is loaded |
|
| 82 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
| 83 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * template_include |
|
| 89 | - * |
|
| 90 | - * @access public |
|
| 91 | - * @param string $template |
|
| 92 | - * @return string |
|
| 93 | - */ |
|
| 94 | - public function template_include($template) |
|
| 95 | - { |
|
| 96 | - // not a custom template? |
|
| 97 | - if ( |
|
| 98 | - EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
| 99 | - ->get_selected_template() != 'archive-espresso_venues.php' |
|
| 100 | - ) { |
|
| 101 | - EEH_Template::load_espresso_theme_functions(); |
|
| 102 | - // then add extra event data via hooks |
|
| 103 | - add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
| 104 | - // don't know if theme uses the_excerpt |
|
| 105 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
| 106 | - // or the_content |
|
| 107 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
| 108 | - // don't display entry meta because the existing theme will take care of that |
|
| 109 | - add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
| 110 | - } |
|
| 111 | - return $template; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * the_title |
|
| 117 | - * |
|
| 118 | - * @access public |
|
| 119 | - * @param string $title |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 122 | - public function the_title($title = '') |
|
| 123 | - { |
|
| 124 | - return $title; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * venue_details |
|
| 130 | - * |
|
| 131 | - * @access public |
|
| 132 | - * @param string $content |
|
| 133 | - * @return string |
|
| 134 | - */ |
|
| 135 | - public function venue_details($content) |
|
| 136 | - { |
|
| 137 | - global $post; |
|
| 138 | - if ( |
|
| 139 | - $post->post_type == 'espresso_venues' |
|
| 140 | - && ! post_password_required() |
|
| 141 | - ) { |
|
| 142 | - // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
| 143 | - // it uses the_content() for displaying the $post->post_content |
|
| 144 | - // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
| 145 | - // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
| 146 | - remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
| 147 | - remove_filter('the_content', array($this, 'venue_details'), 100); |
|
| 148 | - // add filters we want |
|
| 149 | - add_filter('the_content', array($this, 'venue_location'), 110); |
|
| 150 | - add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
| 151 | - // now load our template |
|
| 152 | - $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
| 153 | - // now add our filter back in, plus some others |
|
| 154 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
| 155 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
| 156 | - // remove other filters we added so they won't get applied to the next post |
|
| 157 | - remove_filter('the_content', array($this, 'venue_location'), 110); |
|
| 158 | - remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
| 159 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
| 160 | - } |
|
| 161 | - return ! empty($template) ? $template : $content; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * venue_location |
|
| 167 | - * |
|
| 168 | - * @access public |
|
| 169 | - * @param string $content |
|
| 170 | - * @return string |
|
| 171 | - */ |
|
| 172 | - public function venue_location($content) |
|
| 173 | - { |
|
| 174 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * wp_enqueue_scripts |
|
| 180 | - * |
|
| 181 | - * @access public |
|
| 182 | - * @return void |
|
| 183 | - */ |
|
| 184 | - public function wp_enqueue_scripts() |
|
| 185 | - { |
|
| 186 | - // get some style |
|
| 187 | - if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
| 188 | - // first check theme folder |
|
| 189 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
| 190 | - wp_register_style( |
|
| 191 | - $this->theme, |
|
| 192 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
| 193 | - array('dashicons', 'espresso_default') |
|
| 194 | - ); |
|
| 195 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
| 196 | - wp_register_style( |
|
| 197 | - $this->theme, |
|
| 198 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
| 199 | - array('dashicons', 'espresso_default') |
|
| 200 | - ); |
|
| 201 | - } |
|
| 202 | - wp_enqueue_style($this->theme); |
|
| 203 | - } |
|
| 204 | - } |
|
| 31 | + /** |
|
| 32 | + * @return EED_Venues_Archive |
|
| 33 | + */ |
|
| 34 | + public static function instance() |
|
| 35 | + { |
|
| 36 | + return parent::get_instance(__CLASS__); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
| 42 | + * |
|
| 43 | + * @return void |
|
| 44 | + * @throws InvalidArgumentException |
|
| 45 | + * @throws InvalidDataTypeException |
|
| 46 | + * @throws InvalidInterfaceException |
|
| 47 | + */ |
|
| 48 | + public static function set_hooks() |
|
| 49 | + { |
|
| 50 | + /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
| 51 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
| 52 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
| 53 | + ); |
|
| 54 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
| 55 | + EE_Config::register_route( |
|
| 56 | + $custom_post_types['espresso_venues']['plural_slug'], |
|
| 57 | + 'Venues_Archive', |
|
| 58 | + 'run' |
|
| 59 | + ); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
| 64 | + * |
|
| 65 | + * @access public |
|
| 66 | + * @return void |
|
| 67 | + */ |
|
| 68 | + public static function set_hooks_admin() |
|
| 69 | + { |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * run - initial module setup |
|
| 75 | + * |
|
| 76 | + * @access public |
|
| 77 | + * @param \WP $WP |
|
| 78 | + */ |
|
| 79 | + public function run($WP) |
|
| 80 | + { |
|
| 81 | + // check what template is loaded |
|
| 82 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
| 83 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * template_include |
|
| 89 | + * |
|
| 90 | + * @access public |
|
| 91 | + * @param string $template |
|
| 92 | + * @return string |
|
| 93 | + */ |
|
| 94 | + public function template_include($template) |
|
| 95 | + { |
|
| 96 | + // not a custom template? |
|
| 97 | + if ( |
|
| 98 | + EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
| 99 | + ->get_selected_template() != 'archive-espresso_venues.php' |
|
| 100 | + ) { |
|
| 101 | + EEH_Template::load_espresso_theme_functions(); |
|
| 102 | + // then add extra event data via hooks |
|
| 103 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
| 104 | + // don't know if theme uses the_excerpt |
|
| 105 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
| 106 | + // or the_content |
|
| 107 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
| 108 | + // don't display entry meta because the existing theme will take care of that |
|
| 109 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
| 110 | + } |
|
| 111 | + return $template; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * the_title |
|
| 117 | + * |
|
| 118 | + * @access public |
|
| 119 | + * @param string $title |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | + public function the_title($title = '') |
|
| 123 | + { |
|
| 124 | + return $title; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * venue_details |
|
| 130 | + * |
|
| 131 | + * @access public |
|
| 132 | + * @param string $content |
|
| 133 | + * @return string |
|
| 134 | + */ |
|
| 135 | + public function venue_details($content) |
|
| 136 | + { |
|
| 137 | + global $post; |
|
| 138 | + if ( |
|
| 139 | + $post->post_type == 'espresso_venues' |
|
| 140 | + && ! post_password_required() |
|
| 141 | + ) { |
|
| 142 | + // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
| 143 | + // it uses the_content() for displaying the $post->post_content |
|
| 144 | + // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
| 145 | + // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
| 146 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
| 147 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
| 148 | + // add filters we want |
|
| 149 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
| 150 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
| 151 | + // now load our template |
|
| 152 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
| 153 | + // now add our filter back in, plus some others |
|
| 154 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
| 155 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
| 156 | + // remove other filters we added so they won't get applied to the next post |
|
| 157 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
| 158 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
| 159 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
| 160 | + } |
|
| 161 | + return ! empty($template) ? $template : $content; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * venue_location |
|
| 167 | + * |
|
| 168 | + * @access public |
|
| 169 | + * @param string $content |
|
| 170 | + * @return string |
|
| 171 | + */ |
|
| 172 | + public function venue_location($content) |
|
| 173 | + { |
|
| 174 | + return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * wp_enqueue_scripts |
|
| 180 | + * |
|
| 181 | + * @access public |
|
| 182 | + * @return void |
|
| 183 | + */ |
|
| 184 | + public function wp_enqueue_scripts() |
|
| 185 | + { |
|
| 186 | + // get some style |
|
| 187 | + if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
| 188 | + // first check theme folder |
|
| 189 | + if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
| 190 | + wp_register_style( |
|
| 191 | + $this->theme, |
|
| 192 | + get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
| 193 | + array('dashicons', 'espresso_default') |
|
| 194 | + ); |
|
| 195 | + } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
| 196 | + wp_register_style( |
|
| 197 | + $this->theme, |
|
| 198 | + EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
| 199 | + array('dashicons', 'espresso_default') |
|
| 200 | + ); |
|
| 201 | + } |
|
| 202 | + wp_enqueue_style($this->theme); |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | 205 | } |
@@ -1,225 +1,225 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Default_Line_Item_Display_Strategy |
|
| 5 | - * |
|
| 6 | - * Description |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
| 5 | + * |
|
| 6 | + * Description |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * total amount of tax to apply |
|
| 20 | - * @type float $_tax_rate |
|
| 21 | - */ |
|
| 22 | - private $_tax_rate = 0; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * total amount including tax we can bill for at this time |
|
| 26 | - * @type float $_grand_total |
|
| 27 | - */ |
|
| 28 | - private $_grand_total = 0.00; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * total number of items being billed for |
|
| 32 | - * @type int $_total_items |
|
| 33 | - */ |
|
| 34 | - private $_total_items = 0; |
|
| 35 | - |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @return float |
|
| 40 | - */ |
|
| 41 | - public function grand_total() |
|
| 42 | - { |
|
| 43 | - return $this->_grand_total; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @return int |
|
| 50 | - */ |
|
| 51 | - public function total_items() |
|
| 52 | - { |
|
| 53 | - return $this->_total_items; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @param EE_Line_Item $line_item |
|
| 60 | - * @param array $options |
|
| 61 | - * @return mixed |
|
| 62 | - */ |
|
| 63 | - public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
| 64 | - { |
|
| 65 | - |
|
| 66 | - $html = ''; |
|
| 67 | - // set some default options and merge with incoming |
|
| 68 | - $default_options = array( |
|
| 69 | - 'show_desc' => true, // TRUE FALSE |
|
| 70 | - 'odd' => false |
|
| 71 | - ); |
|
| 72 | - $options = array_merge($default_options, (array) $options); |
|
| 73 | - |
|
| 74 | - switch ($line_item->type()) { |
|
| 75 | - case EEM_Line_Item::type_line_item: |
|
| 76 | - // item row |
|
| 77 | - $html .= $this->_item_row($line_item, $options); |
|
| 78 | - // got any kids? |
|
| 79 | - foreach ($line_item->children() as $child_line_item) { |
|
| 80 | - $this->display_line_item($child_line_item, $options); |
|
| 81 | - } |
|
| 82 | - break; |
|
| 83 | - |
|
| 84 | - case EEM_Line_Item::type_sub_line_item: |
|
| 85 | - $html .= $this->_sub_item_row($line_item, $options); |
|
| 86 | - break; |
|
| 87 | - |
|
| 88 | - case EEM_Line_Item::type_sub_total: |
|
| 89 | - break; |
|
| 90 | - |
|
| 91 | - case EEM_Line_Item::type_tax: |
|
| 92 | - $this->_tax_rate += $line_item->percent(); |
|
| 93 | - break; |
|
| 94 | - |
|
| 95 | - case EEM_Line_Item::type_tax_sub_total: |
|
| 96 | - foreach ($line_item->children() as $child_line_item) { |
|
| 97 | - if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
| 98 | - // recursively feed children back into this method |
|
| 99 | - $this->display_line_item($child_line_item, $options); |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - break; |
|
| 103 | - |
|
| 104 | - case EEM_Line_Item::type_total: |
|
| 105 | - // get all child line items |
|
| 106 | - $children = $line_item->children(); |
|
| 107 | - if ($options['set_tax_rate'] === true) { |
|
| 108 | - // loop thru tax child line items just to determine tax rate |
|
| 109 | - foreach ($children as $child_line_item) { |
|
| 110 | - if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
| 111 | - // recursively feed children back into this method |
|
| 112 | - $this->display_line_item($child_line_item, $options); |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - } else { |
|
| 116 | - // now loop thru all non-tax child line items |
|
| 117 | - foreach ($children as $child_line_item) { |
|
| 118 | - if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
| 119 | - // recursively feed children back into this method |
|
| 120 | - $html .= $this->display_line_item($child_line_item, $options); |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - break; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - return $html; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * _total_row |
|
| 134 | - * |
|
| 135 | - * @param EE_Line_Item $line_item |
|
| 136 | - * @param array $options |
|
| 137 | - * @return mixed |
|
| 138 | - */ |
|
| 139 | - private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
| 140 | - { |
|
| 141 | - // start of row |
|
| 142 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
| 143 | - $html = EEH_HTML::tr('', '', $row_class); |
|
| 144 | - // name && desc |
|
| 145 | - $name_and_desc = apply_filters( |
|
| 146 | - 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
|
| 147 | - $line_item->name(), |
|
| 148 | - $line_item |
|
| 149 | - ); |
|
| 150 | - $name_and_desc .= apply_filters( |
|
| 151 | - 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
|
| 152 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
| 153 | - $line_item, |
|
| 154 | - $options |
|
| 155 | - ); |
|
| 156 | - if ($line_item->is_taxable()) { |
|
| 157 | - $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
| 158 | - ? esc_html__('* price includes taxes', 'event_espresso') |
|
| 159 | - : esc_html__('* price does not include taxes', 'event_espresso'); |
|
| 160 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
|
| 161 | - . $ticket_price_includes_taxes |
|
| 162 | - . '</span>'; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - // name td |
|
| 166 | - $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
| 167 | - // quantity td |
|
| 168 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
| 169 | - $tax_rate = $line_item->is_taxable() |
|
| 170 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
| 171 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
| 172 | - : 1; |
|
| 173 | - // price td |
|
| 174 | - $unit_price = apply_filters( |
|
| 175 | - 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__unit_price', |
|
| 176 | - EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false), |
|
| 177 | - $line_item, |
|
| 178 | - $tax_rate |
|
| 179 | - ); |
|
| 180 | - $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
| 181 | - // total td |
|
| 182 | - $total = apply_filters( |
|
| 183 | - 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__total', |
|
| 184 | - EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false), |
|
| 185 | - $line_item, |
|
| 186 | - $tax_rate |
|
| 187 | - ); |
|
| 188 | - $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
| 189 | - // end of row |
|
| 190 | - $html .= EEH_HTML::trx(); |
|
| 191 | - |
|
| 192 | - return $html; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * _sub_item_row |
|
| 199 | - * |
|
| 200 | - * @param EE_Line_Item $line_item |
|
| 201 | - * @param array $options |
|
| 202 | - * @return mixed |
|
| 203 | - */ |
|
| 204 | - private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
| 205 | - { |
|
| 206 | - // start of row |
|
| 207 | - $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
| 208 | - // name && desc |
|
| 209 | - $name_and_desc = $line_item->name(); |
|
| 210 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
| 211 | - // name td |
|
| 212 | - $html .= EEH_HTML::td(/*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item'); |
|
| 213 | - // discount/surcharge td |
|
| 214 | - if ($line_item->is_percent()) { |
|
| 215 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
| 216 | - } else { |
|
| 217 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
| 218 | - } |
|
| 219 | - // total td |
|
| 220 | - $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
| 221 | - // end of row |
|
| 222 | - $html .= EEH_HTML::trx(); |
|
| 223 | - return $html; |
|
| 224 | - } |
|
| 18 | + /** |
|
| 19 | + * total amount of tax to apply |
|
| 20 | + * @type float $_tax_rate |
|
| 21 | + */ |
|
| 22 | + private $_tax_rate = 0; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * total amount including tax we can bill for at this time |
|
| 26 | + * @type float $_grand_total |
|
| 27 | + */ |
|
| 28 | + private $_grand_total = 0.00; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * total number of items being billed for |
|
| 32 | + * @type int $_total_items |
|
| 33 | + */ |
|
| 34 | + private $_total_items = 0; |
|
| 35 | + |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @return float |
|
| 40 | + */ |
|
| 41 | + public function grand_total() |
|
| 42 | + { |
|
| 43 | + return $this->_grand_total; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @return int |
|
| 50 | + */ |
|
| 51 | + public function total_items() |
|
| 52 | + { |
|
| 53 | + return $this->_total_items; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @param EE_Line_Item $line_item |
|
| 60 | + * @param array $options |
|
| 61 | + * @return mixed |
|
| 62 | + */ |
|
| 63 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
| 64 | + { |
|
| 65 | + |
|
| 66 | + $html = ''; |
|
| 67 | + // set some default options and merge with incoming |
|
| 68 | + $default_options = array( |
|
| 69 | + 'show_desc' => true, // TRUE FALSE |
|
| 70 | + 'odd' => false |
|
| 71 | + ); |
|
| 72 | + $options = array_merge($default_options, (array) $options); |
|
| 73 | + |
|
| 74 | + switch ($line_item->type()) { |
|
| 75 | + case EEM_Line_Item::type_line_item: |
|
| 76 | + // item row |
|
| 77 | + $html .= $this->_item_row($line_item, $options); |
|
| 78 | + // got any kids? |
|
| 79 | + foreach ($line_item->children() as $child_line_item) { |
|
| 80 | + $this->display_line_item($child_line_item, $options); |
|
| 81 | + } |
|
| 82 | + break; |
|
| 83 | + |
|
| 84 | + case EEM_Line_Item::type_sub_line_item: |
|
| 85 | + $html .= $this->_sub_item_row($line_item, $options); |
|
| 86 | + break; |
|
| 87 | + |
|
| 88 | + case EEM_Line_Item::type_sub_total: |
|
| 89 | + break; |
|
| 90 | + |
|
| 91 | + case EEM_Line_Item::type_tax: |
|
| 92 | + $this->_tax_rate += $line_item->percent(); |
|
| 93 | + break; |
|
| 94 | + |
|
| 95 | + case EEM_Line_Item::type_tax_sub_total: |
|
| 96 | + foreach ($line_item->children() as $child_line_item) { |
|
| 97 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
| 98 | + // recursively feed children back into this method |
|
| 99 | + $this->display_line_item($child_line_item, $options); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + break; |
|
| 103 | + |
|
| 104 | + case EEM_Line_Item::type_total: |
|
| 105 | + // get all child line items |
|
| 106 | + $children = $line_item->children(); |
|
| 107 | + if ($options['set_tax_rate'] === true) { |
|
| 108 | + // loop thru tax child line items just to determine tax rate |
|
| 109 | + foreach ($children as $child_line_item) { |
|
| 110 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
| 111 | + // recursively feed children back into this method |
|
| 112 | + $this->display_line_item($child_line_item, $options); |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + } else { |
|
| 116 | + // now loop thru all non-tax child line items |
|
| 117 | + foreach ($children as $child_line_item) { |
|
| 118 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
| 119 | + // recursively feed children back into this method |
|
| 120 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + break; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + return $html; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * _total_row |
|
| 134 | + * |
|
| 135 | + * @param EE_Line_Item $line_item |
|
| 136 | + * @param array $options |
|
| 137 | + * @return mixed |
|
| 138 | + */ |
|
| 139 | + private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
| 140 | + { |
|
| 141 | + // start of row |
|
| 142 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
| 143 | + $html = EEH_HTML::tr('', '', $row_class); |
|
| 144 | + // name && desc |
|
| 145 | + $name_and_desc = apply_filters( |
|
| 146 | + 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
|
| 147 | + $line_item->name(), |
|
| 148 | + $line_item |
|
| 149 | + ); |
|
| 150 | + $name_and_desc .= apply_filters( |
|
| 151 | + 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
|
| 152 | + ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
| 153 | + $line_item, |
|
| 154 | + $options |
|
| 155 | + ); |
|
| 156 | + if ($line_item->is_taxable()) { |
|
| 157 | + $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
| 158 | + ? esc_html__('* price includes taxes', 'event_espresso') |
|
| 159 | + : esc_html__('* price does not include taxes', 'event_espresso'); |
|
| 160 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
|
| 161 | + . $ticket_price_includes_taxes |
|
| 162 | + . '</span>'; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + // name td |
|
| 166 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
| 167 | + // quantity td |
|
| 168 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
| 169 | + $tax_rate = $line_item->is_taxable() |
|
| 170 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
| 171 | + ? 1 + ( $this->_tax_rate / 100 ) |
|
| 172 | + : 1; |
|
| 173 | + // price td |
|
| 174 | + $unit_price = apply_filters( |
|
| 175 | + 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__unit_price', |
|
| 176 | + EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false), |
|
| 177 | + $line_item, |
|
| 178 | + $tax_rate |
|
| 179 | + ); |
|
| 180 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
| 181 | + // total td |
|
| 182 | + $total = apply_filters( |
|
| 183 | + 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__total', |
|
| 184 | + EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false), |
|
| 185 | + $line_item, |
|
| 186 | + $tax_rate |
|
| 187 | + ); |
|
| 188 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
| 189 | + // end of row |
|
| 190 | + $html .= EEH_HTML::trx(); |
|
| 191 | + |
|
| 192 | + return $html; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * _sub_item_row |
|
| 199 | + * |
|
| 200 | + * @param EE_Line_Item $line_item |
|
| 201 | + * @param array $options |
|
| 202 | + * @return mixed |
|
| 203 | + */ |
|
| 204 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
| 205 | + { |
|
| 206 | + // start of row |
|
| 207 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
| 208 | + // name && desc |
|
| 209 | + $name_and_desc = $line_item->name(); |
|
| 210 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
| 211 | + // name td |
|
| 212 | + $html .= EEH_HTML::td(/*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item'); |
|
| 213 | + // discount/surcharge td |
|
| 214 | + if ($line_item->is_percent()) { |
|
| 215 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
| 216 | + } else { |
|
| 217 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
| 218 | + } |
|
| 219 | + // total td |
|
| 220 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
| 221 | + // end of row |
|
| 222 | + $html .= EEH_HTML::trx(); |
|
| 223 | + return $html; |
|
| 224 | + } |
|
| 225 | 225 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $html = ''; |
| 67 | 67 | // set some default options and merge with incoming |
| 68 | 68 | $default_options = array( |
| 69 | - 'show_desc' => true, // TRUE FALSE |
|
| 69 | + 'show_desc' => true, // TRUE FALSE |
|
| 70 | 70 | 'odd' => false |
| 71 | 71 | ); |
| 72 | 72 | $options = array_merge($default_options, (array) $options); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ); |
| 150 | 150 | $name_and_desc .= apply_filters( |
| 151 | 151 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
| 152 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
| 152 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
| 153 | 153 | $line_item, |
| 154 | 154 | $options |
| 155 | 155 | ); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
| 169 | 169 | $tax_rate = $line_item->is_taxable() |
| 170 | 170 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
| 171 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
| 171 | + ? 1 + ($this->_tax_rate / 100) |
|
| 172 | 172 | : 1; |
| 173 | 173 | // price td |
| 174 | 174 | $unit_price = apply_filters( |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | $html = EEH_HTML::tr('', 'item sub-item-row'); |
| 208 | 208 | // name && desc |
| 209 | 209 | $name_and_desc = $line_item->name(); |
| 210 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
| 210 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
| 211 | 211 | // name td |
| 212 | 212 | $html .= EEH_HTML::td(/*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item'); |
| 213 | 213 | // discount/surcharge td |
| 214 | 214 | if ($line_item->is_percent()) { |
| 215 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
| 215 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
| 216 | 216 | } else { |
| 217 | 217 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
| 218 | 218 | } |
@@ -16,314 +16,314 @@ |
||
| 16 | 16 | class StatsGatherer |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - const COUNT_ALL_EVENTS = 'event'; |
|
| 20 | - const COUNT_ACTIVE_EVENTS = 'active_event'; |
|
| 21 | - const COUNT_DATETIMES = 'datetime'; |
|
| 22 | - const COUNT_TICKETS = 'ticket'; |
|
| 23 | - const COUNT_DATETIMES_SOLD = 'datetime_sold'; |
|
| 24 | - const COUNT_TICKETS_FREE = 'free_ticket'; |
|
| 25 | - const COUNT_TICKETS_PAID = 'paid_ticket'; |
|
| 26 | - const COUNT_TICKETS_SOLD = 'ticket_sold'; |
|
| 27 | - const COUNT_REGISTRATIONS_APPROVED = 'registrations_approved'; |
|
| 28 | - const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved'; |
|
| 29 | - const COUNT_REGISTRATIONS_PENDING = 'registrations_pending'; |
|
| 30 | - const COUNT_REGISTRATIONS_INCOMPLETE = 'registrations_incomplete'; |
|
| 31 | - const COUNT_REGISTRATIONS_ALL = 'registrations_all'; |
|
| 32 | - const COUNT_REGISTRATIONS_CANCELLED = 'registrations_cancelled'; |
|
| 33 | - const COUNT_REGISTRATIONS_DECLINED = 'registrations_declined'; |
|
| 34 | - const SUM_TRANSACTIONS_COMPLETE_TOTAL = 'transactions_complete_total_sum'; |
|
| 35 | - const SUM_TRANSACTIONS_ALL_PAID = 'transactions_all_paid'; |
|
| 36 | - const INFO_SITE_CURRENCY = 'site_currency'; |
|
| 19 | + const COUNT_ALL_EVENTS = 'event'; |
|
| 20 | + const COUNT_ACTIVE_EVENTS = 'active_event'; |
|
| 21 | + const COUNT_DATETIMES = 'datetime'; |
|
| 22 | + const COUNT_TICKETS = 'ticket'; |
|
| 23 | + const COUNT_DATETIMES_SOLD = 'datetime_sold'; |
|
| 24 | + const COUNT_TICKETS_FREE = 'free_ticket'; |
|
| 25 | + const COUNT_TICKETS_PAID = 'paid_ticket'; |
|
| 26 | + const COUNT_TICKETS_SOLD = 'ticket_sold'; |
|
| 27 | + const COUNT_REGISTRATIONS_APPROVED = 'registrations_approved'; |
|
| 28 | + const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved'; |
|
| 29 | + const COUNT_REGISTRATIONS_PENDING = 'registrations_pending'; |
|
| 30 | + const COUNT_REGISTRATIONS_INCOMPLETE = 'registrations_incomplete'; |
|
| 31 | + const COUNT_REGISTRATIONS_ALL = 'registrations_all'; |
|
| 32 | + const COUNT_REGISTRATIONS_CANCELLED = 'registrations_cancelled'; |
|
| 33 | + const COUNT_REGISTRATIONS_DECLINED = 'registrations_declined'; |
|
| 34 | + const SUM_TRANSACTIONS_COMPLETE_TOTAL = 'transactions_complete_total_sum'; |
|
| 35 | + const SUM_TRANSACTIONS_ALL_PAID = 'transactions_all_paid'; |
|
| 36 | + const INFO_SITE_CURRENCY = 'site_currency'; |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var EEM_Payment_Method |
|
| 41 | - */ |
|
| 42 | - private $payment_method_model; |
|
| 39 | + /** |
|
| 40 | + * @var EEM_Payment_Method |
|
| 41 | + */ |
|
| 42 | + private $payment_method_model; |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var EEM_Event |
|
| 47 | - */ |
|
| 48 | - private $event_model; |
|
| 45 | + /** |
|
| 46 | + * @var EEM_Event |
|
| 47 | + */ |
|
| 48 | + private $event_model; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var EEM_Datetime |
|
| 52 | - */ |
|
| 53 | - private $datetime_model; |
|
| 50 | + /** |
|
| 51 | + * @var EEM_Datetime |
|
| 52 | + */ |
|
| 53 | + private $datetime_model; |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var EEM_Ticket |
|
| 58 | - */ |
|
| 59 | - private $ticket_model; |
|
| 56 | + /** |
|
| 57 | + * @var EEM_Ticket |
|
| 58 | + */ |
|
| 59 | + private $ticket_model; |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @var EEM_Registration |
|
| 64 | - */ |
|
| 65 | - private $registration_model; |
|
| 62 | + /** |
|
| 63 | + * @var EEM_Registration |
|
| 64 | + */ |
|
| 65 | + private $registration_model; |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @var EEM_Transaction |
|
| 70 | - */ |
|
| 71 | - private $transaction_model; |
|
| 68 | + /** |
|
| 69 | + * @var EEM_Transaction |
|
| 70 | + */ |
|
| 71 | + private $transaction_model; |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * @var EE_Config |
|
| 76 | - */ |
|
| 77 | - private $config; |
|
| 74 | + /** |
|
| 75 | + * @var EE_Config |
|
| 76 | + */ |
|
| 77 | + private $config; |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * StatsGatherer constructor. |
|
| 82 | - * |
|
| 83 | - * @param EEM_Payment_Method $payment_method_model |
|
| 84 | - * @param EEM_Event $event_model |
|
| 85 | - * @param EEM_Datetime $datetime_model |
|
| 86 | - * @param EEM_Ticket $ticket_model |
|
| 87 | - * @param EEM_Registration $registration_model |
|
| 88 | - * @param EEM_Transaction $transaction_model |
|
| 89 | - * @param EE_Config $config |
|
| 90 | - */ |
|
| 91 | - public function __construct( |
|
| 92 | - EEM_Payment_Method $payment_method_model, |
|
| 93 | - EEM_Event $event_model, |
|
| 94 | - EEM_Datetime $datetime_model, |
|
| 95 | - EEM_Ticket $ticket_model, |
|
| 96 | - EEM_Registration $registration_model, |
|
| 97 | - EEM_Transaction $transaction_model, |
|
| 98 | - EE_Config $config |
|
| 99 | - ) { |
|
| 100 | - $this->payment_method_model = $payment_method_model; |
|
| 101 | - $this->event_model = $event_model; |
|
| 102 | - $this->datetime_model = $datetime_model; |
|
| 103 | - $this->ticket_model = $ticket_model; |
|
| 104 | - $this->registration_model = $registration_model; |
|
| 105 | - $this->transaction_model = $transaction_model; |
|
| 106 | - $this->config = $config; |
|
| 107 | - } |
|
| 80 | + /** |
|
| 81 | + * StatsGatherer constructor. |
|
| 82 | + * |
|
| 83 | + * @param EEM_Payment_Method $payment_method_model |
|
| 84 | + * @param EEM_Event $event_model |
|
| 85 | + * @param EEM_Datetime $datetime_model |
|
| 86 | + * @param EEM_Ticket $ticket_model |
|
| 87 | + * @param EEM_Registration $registration_model |
|
| 88 | + * @param EEM_Transaction $transaction_model |
|
| 89 | + * @param EE_Config $config |
|
| 90 | + */ |
|
| 91 | + public function __construct( |
|
| 92 | + EEM_Payment_Method $payment_method_model, |
|
| 93 | + EEM_Event $event_model, |
|
| 94 | + EEM_Datetime $datetime_model, |
|
| 95 | + EEM_Ticket $ticket_model, |
|
| 96 | + EEM_Registration $registration_model, |
|
| 97 | + EEM_Transaction $transaction_model, |
|
| 98 | + EE_Config $config |
|
| 99 | + ) { |
|
| 100 | + $this->payment_method_model = $payment_method_model; |
|
| 101 | + $this->event_model = $event_model; |
|
| 102 | + $this->datetime_model = $datetime_model; |
|
| 103 | + $this->ticket_model = $ticket_model; |
|
| 104 | + $this->registration_model = $registration_model; |
|
| 105 | + $this->transaction_model = $transaction_model; |
|
| 106 | + $this->config = $config; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Return the stats array for PUE UXIP stats. |
|
| 112 | - * |
|
| 113 | - * @return array |
|
| 114 | - */ |
|
| 115 | - public function stats() |
|
| 116 | - { |
|
| 117 | - global $wp_version; |
|
| 118 | - $stats = $this->paymentMethodStats(); |
|
| 119 | - // a-ok so let's setup our stats. |
|
| 120 | - $stats = array_merge($stats, array( |
|
| 121 | - 'is_multisite' => is_multisite() && is_main_site(), |
|
| 122 | - 'active_theme' => $this->getActiveThemeStat(), |
|
| 123 | - 'ee4_all_events_count' => $this->getCountFor(self::COUNT_ALL_EVENTS), |
|
| 124 | - 'ee4_active_events_count' => $this->getCountFor(self::COUNT_ACTIVE_EVENTS), |
|
| 125 | - 'all_dtts_count' => $this->getCountFor(self::COUNT_DATETIMES), |
|
| 126 | - 'dtt_sold' => $this->getCountFor(self::COUNT_DATETIMES_SOLD), |
|
| 127 | - 'all_tkt_count' => $this->getCountFor(self::COUNT_TICKETS), |
|
| 128 | - 'free_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_FREE), |
|
| 129 | - 'paid_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_PAID), |
|
| 130 | - 'tkt_sold' => $this->getCountFor(self::COUNT_TICKETS_SOLD), |
|
| 131 | - 'approve_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED), |
|
| 132 | - 'pending_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING), |
|
| 133 | - 'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED), |
|
| 134 | - 'incomplete_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE), |
|
| 135 | - 'cancelled_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED), |
|
| 136 | - 'declined_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED), |
|
| 137 | - 'all_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL), |
|
| 138 | - 'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL), |
|
| 139 | - 'all_transaction_paid_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID), |
|
| 140 | - self::INFO_SITE_CURRENCY => $this->config->currency instanceof EE_Currency_Config |
|
| 141 | - ? $this->config->currency->code |
|
| 142 | - : 'unknown', |
|
| 143 | - 'phpversion' => implode( |
|
| 144 | - '.', |
|
| 145 | - array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION) |
|
| 146 | - ), |
|
| 147 | - 'wpversion' => $wp_version, |
|
| 148 | - 'active_addons' => $this->getActiveAddons(), |
|
| 149 | - )); |
|
| 150 | - // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
|
| 151 | - return array_filter($stats, function ($value) { |
|
| 152 | - return $value !== null; |
|
| 153 | - }); |
|
| 154 | - } |
|
| 110 | + /** |
|
| 111 | + * Return the stats array for PUE UXIP stats. |
|
| 112 | + * |
|
| 113 | + * @return array |
|
| 114 | + */ |
|
| 115 | + public function stats() |
|
| 116 | + { |
|
| 117 | + global $wp_version; |
|
| 118 | + $stats = $this->paymentMethodStats(); |
|
| 119 | + // a-ok so let's setup our stats. |
|
| 120 | + $stats = array_merge($stats, array( |
|
| 121 | + 'is_multisite' => is_multisite() && is_main_site(), |
|
| 122 | + 'active_theme' => $this->getActiveThemeStat(), |
|
| 123 | + 'ee4_all_events_count' => $this->getCountFor(self::COUNT_ALL_EVENTS), |
|
| 124 | + 'ee4_active_events_count' => $this->getCountFor(self::COUNT_ACTIVE_EVENTS), |
|
| 125 | + 'all_dtts_count' => $this->getCountFor(self::COUNT_DATETIMES), |
|
| 126 | + 'dtt_sold' => $this->getCountFor(self::COUNT_DATETIMES_SOLD), |
|
| 127 | + 'all_tkt_count' => $this->getCountFor(self::COUNT_TICKETS), |
|
| 128 | + 'free_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_FREE), |
|
| 129 | + 'paid_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_PAID), |
|
| 130 | + 'tkt_sold' => $this->getCountFor(self::COUNT_TICKETS_SOLD), |
|
| 131 | + 'approve_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED), |
|
| 132 | + 'pending_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING), |
|
| 133 | + 'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED), |
|
| 134 | + 'incomplete_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE), |
|
| 135 | + 'cancelled_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED), |
|
| 136 | + 'declined_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED), |
|
| 137 | + 'all_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL), |
|
| 138 | + 'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL), |
|
| 139 | + 'all_transaction_paid_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID), |
|
| 140 | + self::INFO_SITE_CURRENCY => $this->config->currency instanceof EE_Currency_Config |
|
| 141 | + ? $this->config->currency->code |
|
| 142 | + : 'unknown', |
|
| 143 | + 'phpversion' => implode( |
|
| 144 | + '.', |
|
| 145 | + array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION) |
|
| 146 | + ), |
|
| 147 | + 'wpversion' => $wp_version, |
|
| 148 | + 'active_addons' => $this->getActiveAddons(), |
|
| 149 | + )); |
|
| 150 | + // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
|
| 151 | + return array_filter($stats, function ($value) { |
|
| 152 | + return $value !== null; |
|
| 153 | + }); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * @param string $which enum (@see constants prefixed with COUNT) |
|
| 158 | - * @return int|null |
|
| 159 | - */ |
|
| 160 | - private function getCountFor($which) |
|
| 161 | - { |
|
| 162 | - try { |
|
| 163 | - switch ($which) { |
|
| 164 | - case self::COUNT_ALL_EVENTS: |
|
| 165 | - $count = $this->event_model->count(); |
|
| 166 | - break; |
|
| 167 | - case self::COUNT_TICKETS: |
|
| 168 | - $count = $this->ticket_model->count(); |
|
| 169 | - break; |
|
| 170 | - case self::COUNT_DATETIMES: |
|
| 171 | - $count = $this->datetime_model->count(); |
|
| 172 | - break; |
|
| 173 | - case self::COUNT_ACTIVE_EVENTS: |
|
| 174 | - $count = $this->event_model->get_active_events(array(), true); |
|
| 175 | - break; |
|
| 176 | - case self::COUNT_DATETIMES_SOLD: |
|
| 177 | - $count = $this->datetime_model->sum(array(), 'DTT_sold'); |
|
| 178 | - break; |
|
| 179 | - case self::COUNT_TICKETS_FREE: |
|
| 180 | - $count = $this->ticket_model->count(array( |
|
| 181 | - array( |
|
| 182 | - 'TKT_price' => 0, |
|
| 183 | - ), |
|
| 184 | - )); |
|
| 185 | - break; |
|
| 186 | - case self::COUNT_TICKETS_PAID: |
|
| 187 | - $count = $this->ticket_model->count(array( |
|
| 188 | - array( |
|
| 189 | - 'TKT_price' => array('>', 0), |
|
| 190 | - ), |
|
| 191 | - )); |
|
| 192 | - break; |
|
| 193 | - case self::COUNT_TICKETS_SOLD: |
|
| 194 | - $count = $this->ticket_model->sum(array(), 'TKT_sold'); |
|
| 195 | - break; |
|
| 196 | - case self::COUNT_REGISTRATIONS_ALL: |
|
| 197 | - $count = $this->registration_model->count(); |
|
| 198 | - break; |
|
| 199 | - case self::COUNT_REGISTRATIONS_CANCELLED: |
|
| 200 | - $count = $this->registration_model->count( |
|
| 201 | - array( |
|
| 202 | - array( |
|
| 203 | - 'STS_ID' => EEM_Registration::status_id_cancelled, |
|
| 204 | - ), |
|
| 205 | - ) |
|
| 206 | - ); |
|
| 207 | - break; |
|
| 208 | - case self::COUNT_REGISTRATIONS_INCOMPLETE: |
|
| 209 | - $count = $this->registration_model->count( |
|
| 210 | - array( |
|
| 211 | - array( |
|
| 212 | - 'STS_ID' => EEM_Registration::status_id_incomplete, |
|
| 213 | - ), |
|
| 214 | - ) |
|
| 215 | - ); |
|
| 216 | - break; |
|
| 217 | - case self::COUNT_REGISTRATIONS_NOT_APPROVED: |
|
| 218 | - $count = $this->registration_model->count( |
|
| 219 | - array( |
|
| 220 | - array( |
|
| 221 | - 'STS_ID' => EEM_Registration::status_id_not_approved, |
|
| 222 | - ), |
|
| 223 | - ) |
|
| 224 | - ); |
|
| 225 | - break; |
|
| 226 | - case self::COUNT_REGISTRATIONS_DECLINED: |
|
| 227 | - $count = $this->registration_model->count( |
|
| 228 | - array( |
|
| 229 | - array( |
|
| 230 | - 'STS_ID' => EEM_Registration::status_id_declined, |
|
| 231 | - ), |
|
| 232 | - ) |
|
| 233 | - ); |
|
| 234 | - break; |
|
| 235 | - case self::COUNT_REGISTRATIONS_PENDING: |
|
| 236 | - $count = $this->registration_model->count( |
|
| 237 | - array( |
|
| 238 | - array( |
|
| 239 | - 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
| 240 | - ), |
|
| 241 | - ) |
|
| 242 | - ); |
|
| 243 | - break; |
|
| 244 | - case self::COUNT_REGISTRATIONS_APPROVED: |
|
| 245 | - $count = $this->registration_model->count( |
|
| 246 | - array( |
|
| 247 | - array( |
|
| 248 | - 'STS_ID' => EEM_Registration::status_id_approved, |
|
| 249 | - ), |
|
| 250 | - ) |
|
| 251 | - ); |
|
| 252 | - break; |
|
| 253 | - case self::SUM_TRANSACTIONS_COMPLETE_TOTAL: |
|
| 254 | - $count = $this->transaction_model->sum( |
|
| 255 | - array( |
|
| 256 | - array( |
|
| 257 | - 'STS_ID' => EEM_Transaction::complete_status_code, |
|
| 258 | - ), |
|
| 259 | - ), |
|
| 260 | - 'TXN_total' |
|
| 261 | - ); |
|
| 262 | - break; |
|
| 263 | - case self::SUM_TRANSACTIONS_ALL_PAID: |
|
| 264 | - $count = $this->transaction_model->sum( |
|
| 265 | - array(), |
|
| 266 | - 'TXN_paid' |
|
| 267 | - ); |
|
| 268 | - break; |
|
| 269 | - default: |
|
| 270 | - $count = null; |
|
| 271 | - break; |
|
| 272 | - } |
|
| 273 | - } catch (Exception $e) { |
|
| 274 | - $count = null; |
|
| 275 | - } |
|
| 276 | - return $count; |
|
| 277 | - } |
|
| 156 | + /** |
|
| 157 | + * @param string $which enum (@see constants prefixed with COUNT) |
|
| 158 | + * @return int|null |
|
| 159 | + */ |
|
| 160 | + private function getCountFor($which) |
|
| 161 | + { |
|
| 162 | + try { |
|
| 163 | + switch ($which) { |
|
| 164 | + case self::COUNT_ALL_EVENTS: |
|
| 165 | + $count = $this->event_model->count(); |
|
| 166 | + break; |
|
| 167 | + case self::COUNT_TICKETS: |
|
| 168 | + $count = $this->ticket_model->count(); |
|
| 169 | + break; |
|
| 170 | + case self::COUNT_DATETIMES: |
|
| 171 | + $count = $this->datetime_model->count(); |
|
| 172 | + break; |
|
| 173 | + case self::COUNT_ACTIVE_EVENTS: |
|
| 174 | + $count = $this->event_model->get_active_events(array(), true); |
|
| 175 | + break; |
|
| 176 | + case self::COUNT_DATETIMES_SOLD: |
|
| 177 | + $count = $this->datetime_model->sum(array(), 'DTT_sold'); |
|
| 178 | + break; |
|
| 179 | + case self::COUNT_TICKETS_FREE: |
|
| 180 | + $count = $this->ticket_model->count(array( |
|
| 181 | + array( |
|
| 182 | + 'TKT_price' => 0, |
|
| 183 | + ), |
|
| 184 | + )); |
|
| 185 | + break; |
|
| 186 | + case self::COUNT_TICKETS_PAID: |
|
| 187 | + $count = $this->ticket_model->count(array( |
|
| 188 | + array( |
|
| 189 | + 'TKT_price' => array('>', 0), |
|
| 190 | + ), |
|
| 191 | + )); |
|
| 192 | + break; |
|
| 193 | + case self::COUNT_TICKETS_SOLD: |
|
| 194 | + $count = $this->ticket_model->sum(array(), 'TKT_sold'); |
|
| 195 | + break; |
|
| 196 | + case self::COUNT_REGISTRATIONS_ALL: |
|
| 197 | + $count = $this->registration_model->count(); |
|
| 198 | + break; |
|
| 199 | + case self::COUNT_REGISTRATIONS_CANCELLED: |
|
| 200 | + $count = $this->registration_model->count( |
|
| 201 | + array( |
|
| 202 | + array( |
|
| 203 | + 'STS_ID' => EEM_Registration::status_id_cancelled, |
|
| 204 | + ), |
|
| 205 | + ) |
|
| 206 | + ); |
|
| 207 | + break; |
|
| 208 | + case self::COUNT_REGISTRATIONS_INCOMPLETE: |
|
| 209 | + $count = $this->registration_model->count( |
|
| 210 | + array( |
|
| 211 | + array( |
|
| 212 | + 'STS_ID' => EEM_Registration::status_id_incomplete, |
|
| 213 | + ), |
|
| 214 | + ) |
|
| 215 | + ); |
|
| 216 | + break; |
|
| 217 | + case self::COUNT_REGISTRATIONS_NOT_APPROVED: |
|
| 218 | + $count = $this->registration_model->count( |
|
| 219 | + array( |
|
| 220 | + array( |
|
| 221 | + 'STS_ID' => EEM_Registration::status_id_not_approved, |
|
| 222 | + ), |
|
| 223 | + ) |
|
| 224 | + ); |
|
| 225 | + break; |
|
| 226 | + case self::COUNT_REGISTRATIONS_DECLINED: |
|
| 227 | + $count = $this->registration_model->count( |
|
| 228 | + array( |
|
| 229 | + array( |
|
| 230 | + 'STS_ID' => EEM_Registration::status_id_declined, |
|
| 231 | + ), |
|
| 232 | + ) |
|
| 233 | + ); |
|
| 234 | + break; |
|
| 235 | + case self::COUNT_REGISTRATIONS_PENDING: |
|
| 236 | + $count = $this->registration_model->count( |
|
| 237 | + array( |
|
| 238 | + array( |
|
| 239 | + 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
| 240 | + ), |
|
| 241 | + ) |
|
| 242 | + ); |
|
| 243 | + break; |
|
| 244 | + case self::COUNT_REGISTRATIONS_APPROVED: |
|
| 245 | + $count = $this->registration_model->count( |
|
| 246 | + array( |
|
| 247 | + array( |
|
| 248 | + 'STS_ID' => EEM_Registration::status_id_approved, |
|
| 249 | + ), |
|
| 250 | + ) |
|
| 251 | + ); |
|
| 252 | + break; |
|
| 253 | + case self::SUM_TRANSACTIONS_COMPLETE_TOTAL: |
|
| 254 | + $count = $this->transaction_model->sum( |
|
| 255 | + array( |
|
| 256 | + array( |
|
| 257 | + 'STS_ID' => EEM_Transaction::complete_status_code, |
|
| 258 | + ), |
|
| 259 | + ), |
|
| 260 | + 'TXN_total' |
|
| 261 | + ); |
|
| 262 | + break; |
|
| 263 | + case self::SUM_TRANSACTIONS_ALL_PAID: |
|
| 264 | + $count = $this->transaction_model->sum( |
|
| 265 | + array(), |
|
| 266 | + 'TXN_paid' |
|
| 267 | + ); |
|
| 268 | + break; |
|
| 269 | + default: |
|
| 270 | + $count = null; |
|
| 271 | + break; |
|
| 272 | + } |
|
| 273 | + } catch (Exception $e) { |
|
| 274 | + $count = null; |
|
| 275 | + } |
|
| 276 | + return $count; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - /** |
|
| 280 | - * Return the active theme. |
|
| 281 | - * |
|
| 282 | - * @return false|string |
|
| 283 | - */ |
|
| 284 | - private function getActiveThemeStat() |
|
| 285 | - { |
|
| 286 | - $theme = wp_get_theme(); |
|
| 287 | - return $theme->get('Name'); |
|
| 288 | - } |
|
| 279 | + /** |
|
| 280 | + * Return the active theme. |
|
| 281 | + * |
|
| 282 | + * @return false|string |
|
| 283 | + */ |
|
| 284 | + private function getActiveThemeStat() |
|
| 285 | + { |
|
| 286 | + $theme = wp_get_theme(); |
|
| 287 | + return $theme->get('Name'); |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * @return array |
|
| 292 | - */ |
|
| 293 | - private function paymentMethodStats() |
|
| 294 | - { |
|
| 295 | - $payment_method_stats = array(); |
|
| 296 | - try { |
|
| 297 | - $active_payment_methods = $this->payment_method_model->get_all_active( |
|
| 298 | - null, |
|
| 299 | - array('group_by' => 'PMD_type') |
|
| 300 | - ); |
|
| 301 | - if ($active_payment_methods) { |
|
| 302 | - foreach ($active_payment_methods as $payment_method) { |
|
| 303 | - $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - } catch (Exception $e) { |
|
| 307 | - // do nothing just prevents fatals. |
|
| 308 | - } |
|
| 309 | - return $payment_method_stats; |
|
| 310 | - } |
|
| 290 | + /** |
|
| 291 | + * @return array |
|
| 292 | + */ |
|
| 293 | + private function paymentMethodStats() |
|
| 294 | + { |
|
| 295 | + $payment_method_stats = array(); |
|
| 296 | + try { |
|
| 297 | + $active_payment_methods = $this->payment_method_model->get_all_active( |
|
| 298 | + null, |
|
| 299 | + array('group_by' => 'PMD_type') |
|
| 300 | + ); |
|
| 301 | + if ($active_payment_methods) { |
|
| 302 | + foreach ($active_payment_methods as $payment_method) { |
|
| 303 | + $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + } catch (Exception $e) { |
|
| 307 | + // do nothing just prevents fatals. |
|
| 308 | + } |
|
| 309 | + return $payment_method_stats; |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | 312 | |
| 313 | - /** |
|
| 314 | - * Return a list of active EE add-ons and their versions. |
|
| 315 | - * |
|
| 316 | - * @return string |
|
| 317 | - */ |
|
| 318 | - private function getActiveAddons() |
|
| 319 | - { |
|
| 320 | - $activeAddons = []; |
|
| 321 | - $addOns = EE_Registry::instance()->addons; |
|
| 322 | - if (! empty($addOns)) { |
|
| 323 | - foreach ($addOns as $addon) { |
|
| 324 | - $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - return implode(',', $activeAddons); |
|
| 328 | - } |
|
| 313 | + /** |
|
| 314 | + * Return a list of active EE add-ons and their versions. |
|
| 315 | + * |
|
| 316 | + * @return string |
|
| 317 | + */ |
|
| 318 | + private function getActiveAddons() |
|
| 319 | + { |
|
| 320 | + $activeAddons = []; |
|
| 321 | + $addOns = EE_Registry::instance()->addons; |
|
| 322 | + if (! empty($addOns)) { |
|
| 323 | + foreach ($addOns as $addon) { |
|
| 324 | + $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + return implode(',', $activeAddons); |
|
| 328 | + } |
|
| 329 | 329 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | 'active_addons' => $this->getActiveAddons(), |
| 149 | 149 | )); |
| 150 | 150 | // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
| 151 | - return array_filter($stats, function ($value) { |
|
| 151 | + return array_filter($stats, function($value) { |
|
| 152 | 152 | return $value !== null; |
| 153 | 153 | }); |
| 154 | 154 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | ); |
| 301 | 301 | if ($active_payment_methods) { |
| 302 | 302 | foreach ($active_payment_methods as $payment_method) { |
| 303 | - $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
| 303 | + $payment_method_stats[$payment_method->name().'_active_payment_method'] = 1; |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | } catch (Exception $e) { |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | { |
| 320 | 320 | $activeAddons = []; |
| 321 | 321 | $addOns = EE_Registry::instance()->addons; |
| 322 | - if (! empty($addOns)) { |
|
| 322 | + if ( ! empty($addOns)) { |
|
| 323 | 323 | foreach ($addOns as $addon) { |
| 324 | - $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
| 324 | + $activeAddons[] = $addon->name().'@'.$addon->version(); |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | return implode(',', $activeAddons); |
@@ -14,12 +14,12 @@ 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(); |
| 21 | 21 | preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
| 22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 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); |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
| 73 | 73 | // echo "$version_string can be migrated from"; |
| 74 | 74 | return true; |
| 75 | - } elseif (! $version_string) { |
|
| 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; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function schema_changes_before_migration() |
| 91 | 91 | { |
| 92 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 92 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
| 93 | 93 | $now_in_mysql = current_time('mysql', true); |
| 94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
| 95 | 95 | $table_name = 'esp_answer'; |
| 96 | 96 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 97 | 97 | REG_ID int(10) unsigned NOT NULL, |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | ), |
| 686 | 686 | ); |
| 687 | 687 | global $wpdb; |
| 688 | - $country_table = $wpdb->prefix . "esp_country"; |
|
| 688 | + $country_table = $wpdb->prefix."esp_country"; |
|
| 689 | 689 | $country_format = array( |
| 690 | 690 | "CNT_ISO" => '%s', |
| 691 | 691 | "CNT_ISO3" => '%s', |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | foreach ($newer_countries as $country) { |
| 706 | 706 | $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
| 707 | 707 | $countries = $wpdb->get_var($SQL); |
| 708 | - if (! $countries) { |
|
| 708 | + if ( ! $countries) { |
|
| 709 | 709 | $wpdb->insert( |
| 710 | 710 | $country_table, |
| 711 | 711 | array_combine(array_keys($country_format), $country), |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
| 733 | 733 | ); |
| 734 | 734 | global $wpdb; |
| 735 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
| 735 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
| 736 | 736 | $currency_format = array( |
| 737 | 737 | "CUR_code" => '%s', |
| 738 | 738 | "CUR_single" => '%s', |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | foreach ($newer_currencies as $currency) { |
| 746 | 746 | $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
| 747 | 747 | $countries = $wpdb->get_var($SQL); |
| 748 | - if (! $countries) { |
|
| 748 | + if ( ! $countries) { |
|
| 749 | 749 | $wpdb->insert( |
| 750 | 750 | $currency_table, |
| 751 | 751 | array_combine(array_keys($currency_format), $currency), |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
| 11 | 11 | $class_to_filepath = array(); |
| 12 | 12 | foreach ($stages as $filepath) { |
| 13 | - $matches = array(); |
|
| 14 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 13 | + $matches = array(); |
|
| 14 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 15 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 16 | 16 | } |
| 17 | 17 | // give addons a chance to autoload their stages too |
| 18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -34,71 +34,71 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base |
| 36 | 36 | { |
| 37 | - /** |
|
| 38 | - * return EE_DMS_Core_4_8_0 |
|
| 39 | - * |
|
| 40 | - * @param TableManager $table_manager |
|
| 41 | - * @param TableAnalysis $table_analysis |
|
| 42 | - */ |
|
| 43 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
| 44 | - { |
|
| 45 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
| 46 | - $this->_priority = 10; |
|
| 47 | - $this->_migration_stages = array( |
|
| 48 | - new EE_DMS_4_8_0_pretax_totals(), |
|
| 49 | - new EE_DMS_4_8_0_event_subtotals(), |
|
| 50 | - ); |
|
| 51 | - parent::__construct($table_manager, $table_analysis); |
|
| 52 | - } |
|
| 37 | + /** |
|
| 38 | + * return EE_DMS_Core_4_8_0 |
|
| 39 | + * |
|
| 40 | + * @param TableManager $table_manager |
|
| 41 | + * @param TableAnalysis $table_analysis |
|
| 42 | + */ |
|
| 43 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
| 44 | + { |
|
| 45 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
| 46 | + $this->_priority = 10; |
|
| 47 | + $this->_migration_stages = array( |
|
| 48 | + new EE_DMS_4_8_0_pretax_totals(), |
|
| 49 | + new EE_DMS_4_8_0_event_subtotals(), |
|
| 50 | + ); |
|
| 51 | + parent::__construct($table_manager, $table_analysis); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Because this is being done at basically the same time as the MER-ready branch |
|
| 58 | - * of core, it's possible people might have installed MEr-ready branch first, |
|
| 59 | - * and then this one, in which case we still want to perform this migration, |
|
| 60 | - * even though the version might not have increased |
|
| 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 (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
| 56 | + /** |
|
| 57 | + * Because this is being done at basically the same time as the MER-ready branch |
|
| 58 | + * of core, it's possible people might have installed MEr-ready branch first, |
|
| 59 | + * and then this one, in which case we still want to perform this migration, |
|
| 60 | + * even though the version might not have increased |
|
| 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 (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
| 69 | 69 | // echo "$version_string can be migrated from"; |
| 70 | - return true; |
|
| 71 | - } elseif (! $version_string) { |
|
| 70 | + return true; |
|
| 71 | + } elseif (! $version_string) { |
|
| 72 | 72 | // echo "no version string provided: $version_string"; |
| 73 | - // no version string provided... this must be pre 4.3 |
|
| 74 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 75 | - } else { |
|
| 73 | + // no version string provided... this must be pre 4.3 |
|
| 74 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 75 | + } else { |
|
| 76 | 76 | // echo "$version_string doesnt apply"; |
| 77 | - return false; |
|
| 78 | - } |
|
| 79 | - } |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @return bool |
|
| 85 | - */ |
|
| 86 | - public function schema_changes_before_migration() |
|
| 87 | - { |
|
| 88 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 89 | - $now_in_mysql = current_time('mysql', true); |
|
| 90 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 91 | - $table_name = 'esp_answer'; |
|
| 92 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 83 | + /** |
|
| 84 | + * @return bool |
|
| 85 | + */ |
|
| 86 | + public function schema_changes_before_migration() |
|
| 87 | + { |
|
| 88 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 89 | + $now_in_mysql = current_time('mysql', true); |
|
| 90 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 91 | + $table_name = 'esp_answer'; |
|
| 92 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 93 | 93 | REG_ID int(10) unsigned NOT NULL, |
| 94 | 94 | QST_ID int(10) unsigned NOT NULL, |
| 95 | 95 | ANS_value text NOT NULL, |
| 96 | 96 | PRIMARY KEY (ANS_ID), |
| 97 | 97 | KEY REG_ID (REG_ID), |
| 98 | 98 | KEY QST_ID (QST_ID)"; |
| 99 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 100 | - $table_name = 'esp_attendee_meta'; |
|
| 101 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 99 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 100 | + $table_name = 'esp_attendee_meta'; |
|
| 101 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 102 | 102 | ATT_ID bigint(20) unsigned NOT NULL, |
| 103 | 103 | ATT_fname varchar(45) NOT NULL, |
| 104 | 104 | ATT_lname varchar(45) NOT NULL, |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | PRIMARY KEY (ATTM_ID), |
| 114 | 114 | KEY ATT_ID (ATT_ID), |
| 115 | 115 | KEY ATT_email (ATT_email(191))"; |
| 116 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 117 | - $table_name = 'esp_country'; |
|
| 118 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
| 116 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 117 | + $table_name = 'esp_country'; |
|
| 118 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
| 119 | 119 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
| 120 | 120 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
| 121 | 121 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -131,25 +131,25 @@ discard block |
||
| 131 | 131 | CNT_is_EU tinyint(1) DEFAULT '0', |
| 132 | 132 | CNT_active tinyint(1) DEFAULT '0', |
| 133 | 133 | PRIMARY KEY (CNT_ISO)"; |
| 134 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 135 | - $table_name = 'esp_currency'; |
|
| 136 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
| 134 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 135 | + $table_name = 'esp_currency'; |
|
| 136 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
| 137 | 137 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
| 138 | 138 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
| 139 | 139 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
| 140 | 140 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
| 141 | 141 | CUR_active tinyint(1) DEFAULT '0', |
| 142 | 142 | PRIMARY KEY (CUR_code)"; |
| 143 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 144 | - $table_name = 'esp_currency_payment_method'; |
|
| 145 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 143 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 144 | + $table_name = 'esp_currency_payment_method'; |
|
| 145 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 146 | 146 | CUR_code varchar(6) collate utf8_bin NOT NULL, |
| 147 | 147 | PMD_ID int(11) NOT NULL, |
| 148 | 148 | PRIMARY KEY (CPM_ID), |
| 149 | 149 | KEY PMD_ID (PMD_ID)"; |
| 150 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 151 | - $table_name = 'esp_datetime'; |
|
| 152 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 150 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 151 | + $table_name = 'esp_datetime'; |
|
| 152 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 153 | 153 | EVT_ID bigint(20) unsigned NOT NULL, |
| 154 | 154 | DTT_name varchar(255) NOT NULL DEFAULT '', |
| 155 | 155 | DTT_description text NOT NULL, |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | KEY DTT_EVT_start (DTT_EVT_start), |
| 166 | 166 | KEY EVT_ID (EVT_ID), |
| 167 | 167 | KEY DTT_is_primary (DTT_is_primary)"; |
| 168 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 169 | - $table_name = 'esp_event_meta'; |
|
| 170 | - $sql = " |
|
| 168 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 169 | + $table_name = 'esp_event_meta'; |
|
| 170 | + $sql = " |
|
| 171 | 171 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
| 172 | 172 | EVT_ID bigint(20) unsigned NOT NULL, |
| 173 | 173 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -183,34 +183,34 @@ discard block |
||
| 183 | 183 | EVT_donations tinyint(1) NULL, |
| 184 | 184 | PRIMARY KEY (EVTM_ID), |
| 185 | 185 | KEY EVT_ID (EVT_ID)"; |
| 186 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 187 | - $table_name = 'esp_event_question_group'; |
|
| 188 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 186 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 187 | + $table_name = 'esp_event_question_group'; |
|
| 188 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 189 | 189 | EVT_ID bigint(20) unsigned NOT NULL, |
| 190 | 190 | QSG_ID int(10) unsigned NOT NULL, |
| 191 | 191 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 192 | 192 | PRIMARY KEY (EQG_ID), |
| 193 | 193 | KEY EVT_ID (EVT_ID), |
| 194 | 194 | KEY QSG_ID (QSG_ID)"; |
| 195 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 196 | - $table_name = 'esp_event_venue'; |
|
| 197 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 195 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 196 | + $table_name = 'esp_event_venue'; |
|
| 197 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 198 | 198 | EVT_ID bigint(20) unsigned NOT NULL, |
| 199 | 199 | VNU_ID bigint(20) unsigned NOT NULL, |
| 200 | 200 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 201 | 201 | PRIMARY KEY (EVV_ID)"; |
| 202 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 203 | - $table_name = 'esp_extra_meta'; |
|
| 204 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 202 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 203 | + $table_name = 'esp_extra_meta'; |
|
| 204 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 205 | 205 | OBJ_ID int(11) DEFAULT NULL, |
| 206 | 206 | EXM_type varchar(45) DEFAULT NULL, |
| 207 | 207 | EXM_key varchar(45) DEFAULT NULL, |
| 208 | 208 | EXM_value text, |
| 209 | 209 | PRIMARY KEY (EXM_ID), |
| 210 | 210 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
| 211 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 212 | - $table_name = 'esp_extra_join'; |
|
| 213 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 211 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 212 | + $table_name = 'esp_extra_join'; |
|
| 213 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 214 | 214 | EXJ_first_model_id varchar(6) NOT NULL, |
| 215 | 215 | EXJ_first_model_name varchar(20) NOT NULL, |
| 216 | 216 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | PRIMARY KEY (EXJ_ID), |
| 219 | 219 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
| 220 | 220 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
| 221 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 222 | - $table_name = 'esp_line_item'; |
|
| 223 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 221 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 222 | + $table_name = 'esp_line_item'; |
|
| 223 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 224 | 224 | LIN_code varchar(245) NOT NULL DEFAULT '', |
| 225 | 225 | TXN_ID int(11) DEFAULT NULL, |
| 226 | 226 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -239,9 +239,9 @@ discard block |
||
| 239 | 239 | PRIMARY KEY (LIN_ID), |
| 240 | 240 | KEY LIN_code (LIN_code(191)), |
| 241 | 241 | KEY TXN_ID (TXN_ID)"; |
| 242 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 243 | - $table_name = 'esp_log'; |
|
| 244 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 242 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 243 | + $table_name = 'esp_log'; |
|
| 244 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 245 | 245 | LOG_time datetime DEFAULT NULL, |
| 246 | 246 | OBJ_ID varchar(45) DEFAULT NULL, |
| 247 | 247 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -252,18 +252,18 @@ discard block |
||
| 252 | 252 | KEY LOG_time (LOG_time), |
| 253 | 253 | KEY OBJ (OBJ_type,OBJ_ID), |
| 254 | 254 | KEY LOG_type (LOG_type)"; |
| 255 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 256 | - $table_name = 'esp_message_template'; |
|
| 257 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 255 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 256 | + $table_name = 'esp_message_template'; |
|
| 257 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 258 | 258 | GRP_ID int(10) unsigned NOT NULL, |
| 259 | 259 | MTP_context varchar(50) NOT NULL, |
| 260 | 260 | MTP_template_field varchar(30) NOT NULL, |
| 261 | 261 | MTP_content text NOT NULL, |
| 262 | 262 | PRIMARY KEY (MTP_ID), |
| 263 | 263 | KEY GRP_ID (GRP_ID)"; |
| 264 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 265 | - $table_name = 'esp_message_template_group'; |
|
| 266 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 264 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 265 | + $table_name = 'esp_message_template_group'; |
|
| 266 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 267 | 267 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
| 268 | 268 | MTP_name varchar(245) NOT NULL DEFAULT '', |
| 269 | 269 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -275,17 +275,17 @@ discard block |
||
| 275 | 275 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
| 276 | 276 | PRIMARY KEY (GRP_ID), |
| 277 | 277 | KEY MTP_user_id (MTP_user_id)"; |
| 278 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 279 | - $table_name = 'esp_event_message_template'; |
|
| 280 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 278 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 279 | + $table_name = 'esp_event_message_template'; |
|
| 280 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 281 | 281 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 282 | 282 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
| 283 | 283 | PRIMARY KEY (EMT_ID), |
| 284 | 284 | KEY EVT_ID (EVT_ID), |
| 285 | 285 | KEY GRP_ID (GRP_ID)"; |
| 286 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 287 | - $table_name = 'esp_payment'; |
|
| 288 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 286 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 287 | + $table_name = 'esp_payment'; |
|
| 288 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 289 | 289 | TXN_ID int(10) unsigned DEFAULT NULL, |
| 290 | 290 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
| 291 | 291 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -302,9 +302,9 @@ discard block |
||
| 302 | 302 | PRIMARY KEY (PAY_ID), |
| 303 | 303 | KEY PAY_timestamp (PAY_timestamp), |
| 304 | 304 | KEY TXN_ID (TXN_ID)"; |
| 305 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 306 | - $table_name = 'esp_payment_method'; |
|
| 307 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 305 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 306 | + $table_name = 'esp_payment_method'; |
|
| 307 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 308 | 308 | PMD_type varchar(124) DEFAULT NULL, |
| 309 | 309 | PMD_name varchar(255) DEFAULT NULL, |
| 310 | 310 | PMD_desc text, |
@@ -320,32 +320,32 @@ discard block |
||
| 320 | 320 | PRIMARY KEY (PMD_ID), |
| 321 | 321 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
| 322 | 322 | KEY PMD_type (PMD_type)"; |
| 323 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 324 | - $table_name = "esp_ticket_price"; |
|
| 325 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 323 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 324 | + $table_name = "esp_ticket_price"; |
|
| 325 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 326 | 326 | TKT_ID int(10) unsigned NOT NULL, |
| 327 | 327 | PRC_ID int(10) unsigned NOT NULL, |
| 328 | 328 | PRIMARY KEY (TKP_ID), |
| 329 | 329 | KEY TKT_ID (TKT_ID), |
| 330 | 330 | KEY PRC_ID (PRC_ID)"; |
| 331 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 332 | - $table_name = "esp_datetime_ticket"; |
|
| 333 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 331 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 332 | + $table_name = "esp_datetime_ticket"; |
|
| 333 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 334 | 334 | DTT_ID int(10) unsigned NOT NULL, |
| 335 | 335 | TKT_ID int(10) unsigned NOT NULL, |
| 336 | 336 | PRIMARY KEY (DTK_ID), |
| 337 | 337 | KEY DTT_ID (DTT_ID), |
| 338 | 338 | KEY TKT_ID (TKT_ID)"; |
| 339 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 340 | - $table_name = "esp_ticket_template"; |
|
| 341 | - $sql = "TTM_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_template"; |
|
| 341 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 342 | 342 | TTM_name varchar(45) NOT NULL, |
| 343 | 343 | TTM_description text, |
| 344 | 344 | TTM_file varchar(45), |
| 345 | 345 | PRIMARY KEY (TTM_ID)"; |
| 346 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 347 | - $table_name = 'esp_question'; |
|
| 348 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 346 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 347 | + $table_name = 'esp_question'; |
|
| 348 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 349 | 349 | QST_display_text text NOT NULL, |
| 350 | 350 | QST_admin_label varchar(255) NOT NULL, |
| 351 | 351 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -359,18 +359,18 @@ discard block |
||
| 359 | 359 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
| 360 | 360 | PRIMARY KEY (QST_ID), |
| 361 | 361 | KEY QST_order (QST_order)'; |
| 362 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 363 | - $table_name = 'esp_question_group_question'; |
|
| 364 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 362 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 363 | + $table_name = 'esp_question_group_question'; |
|
| 364 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 365 | 365 | QSG_ID int(10) unsigned NOT NULL, |
| 366 | 366 | QST_ID int(10) unsigned NOT NULL, |
| 367 | 367 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
| 368 | 368 | PRIMARY KEY (QGQ_ID), |
| 369 | 369 | KEY QST_ID (QST_ID), |
| 370 | 370 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
| 371 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 372 | - $table_name = 'esp_question_option'; |
|
| 373 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 371 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 372 | + $table_name = 'esp_question_option'; |
|
| 373 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 374 | 374 | QSO_value varchar(255) NOT NULL, |
| 375 | 375 | QSO_desc text NOT NULL, |
| 376 | 376 | QST_ID int(10) unsigned NOT NULL, |
@@ -380,9 +380,9 @@ discard block |
||
| 380 | 380 | PRIMARY KEY (QSO_ID), |
| 381 | 381 | KEY QST_ID (QST_ID), |
| 382 | 382 | KEY QSO_order (QSO_order)"; |
| 383 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 384 | - $table_name = 'esp_registration'; |
|
| 385 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 383 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 384 | + $table_name = 'esp_registration'; |
|
| 385 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 386 | 386 | EVT_ID bigint(20) unsigned NOT NULL, |
| 387 | 387 | ATT_ID bigint(20) unsigned NOT NULL, |
| 388 | 388 | TXN_ID int(10) unsigned NOT NULL, |
@@ -406,18 +406,18 @@ discard block |
||
| 406 | 406 | KEY TKT_ID (TKT_ID), |
| 407 | 407 | KEY EVT_ID (EVT_ID), |
| 408 | 408 | KEY STS_ID (STS_ID)"; |
| 409 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 410 | - $table_name = 'esp_registration_payment'; |
|
| 411 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 409 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 410 | + $table_name = 'esp_registration_payment'; |
|
| 411 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 412 | 412 | REG_ID int(10) unsigned NOT NULL, |
| 413 | 413 | PAY_ID int(10) unsigned NULL, |
| 414 | 414 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
| 415 | 415 | PRIMARY KEY (RPY_ID), |
| 416 | 416 | KEY REG_ID (REG_ID), |
| 417 | 417 | KEY PAY_ID (PAY_ID)"; |
| 418 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 419 | - $table_name = 'esp_checkin'; |
|
| 420 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 418 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 419 | + $table_name = 'esp_checkin'; |
|
| 420 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 421 | 421 | REG_ID int(10) unsigned NOT NULL, |
| 422 | 422 | DTT_ID int(10) unsigned NOT NULL, |
| 423 | 423 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -425,9 +425,9 @@ discard block |
||
| 425 | 425 | PRIMARY KEY (CHK_ID), |
| 426 | 426 | KEY REG_ID (REG_ID), |
| 427 | 427 | KEY DTT_ID (DTT_ID)"; |
| 428 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 429 | - $table_name = 'esp_state'; |
|
| 430 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 428 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 429 | + $table_name = 'esp_state'; |
|
| 430 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 431 | 431 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
| 432 | 432 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
| 433 | 433 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | PRIMARY KEY (STA_ID), |
| 436 | 436 | KEY STA_abbrev (STA_abbrev), |
| 437 | 437 | KEY CNT_ISO (CNT_ISO)"; |
| 438 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 439 | - $table_name = 'esp_status'; |
|
| 440 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
| 438 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 439 | + $table_name = 'esp_status'; |
|
| 440 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
| 441 | 441 | STS_code varchar(45) NOT NULL, |
| 442 | 442 | STS_type varchar(45) NOT NULL, |
| 443 | 443 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -445,9 +445,9 @@ discard block |
||
| 445 | 445 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
| 446 | 446 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
| 447 | 447 | KEY STS_type (STS_type)"; |
| 448 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 449 | - $table_name = 'esp_transaction'; |
|
| 450 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 448 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 449 | + $table_name = 'esp_transaction'; |
|
| 450 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 451 | 451 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 452 | 452 | TXN_total decimal(10,3) DEFAULT '0.00', |
| 453 | 453 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -459,9 +459,9 @@ discard block |
||
| 459 | 459 | PRIMARY KEY (TXN_ID), |
| 460 | 460 | KEY TXN_timestamp (TXN_timestamp), |
| 461 | 461 | KEY STS_ID (STS_ID)"; |
| 462 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 463 | - $table_name = 'esp_venue_meta'; |
|
| 464 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 462 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 463 | + $table_name = 'esp_venue_meta'; |
|
| 464 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 465 | 465 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 466 | 466 | VNU_address varchar(255) DEFAULT NULL, |
| 467 | 467 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | KEY VNU_ID (VNU_ID), |
| 481 | 481 | KEY STA_ID (STA_ID), |
| 482 | 482 | KEY CNT_ISO (CNT_ISO)"; |
| 483 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 484 | - // modified tables |
|
| 485 | - $table_name = "esp_price"; |
|
| 486 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 483 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 484 | + // modified tables |
|
| 485 | + $table_name = "esp_price"; |
|
| 486 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 487 | 487 | PRT_ID tinyint(3) unsigned NOT NULL, |
| 488 | 488 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
| 489 | 489 | PRC_name varchar(245) NOT NULL, |
@@ -496,9 +496,9 @@ discard block |
||
| 496 | 496 | PRC_parent int(10) unsigned DEFAULT 0, |
| 497 | 497 | PRIMARY KEY (PRC_ID), |
| 498 | 498 | KEY PRT_ID (PRT_ID)"; |
| 499 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 500 | - $table_name = "esp_price_type"; |
|
| 501 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 499 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 500 | + $table_name = "esp_price_type"; |
|
| 501 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 502 | 502 | PRT_name varchar(45) NOT NULL, |
| 503 | 503 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
| 504 | 504 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -507,9 +507,9 @@ discard block |
||
| 507 | 507 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 508 | 508 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
| 509 | 509 | PRIMARY KEY (PRT_ID)"; |
| 510 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 511 | - $table_name = "esp_ticket"; |
|
| 512 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 510 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 511 | + $table_name = "esp_ticket"; |
|
| 512 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 513 | 513 | TTM_ID int(10) unsigned NOT NULL, |
| 514 | 514 | TKT_name varchar(245) NOT NULL DEFAULT '', |
| 515 | 515 | TKT_description text NOT NULL, |
@@ -531,9 +531,9 @@ discard block |
||
| 531 | 531 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 532 | 532 | PRIMARY KEY (TKT_ID), |
| 533 | 533 | KEY TKT_start_date (TKT_start_date)"; |
| 534 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 535 | - $table_name = 'esp_question_group'; |
|
| 536 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 534 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 535 | + $table_name = 'esp_question_group'; |
|
| 536 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 537 | 537 | QSG_name varchar(255) NOT NULL, |
| 538 | 538 | QSG_identifier varchar(100) NOT NULL, |
| 539 | 539 | QSG_desc text NULL, |
@@ -546,223 +546,223 @@ discard block |
||
| 546 | 546 | PRIMARY KEY (QSG_ID), |
| 547 | 547 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
| 548 | 548 | KEY QSG_order (QSG_order)'; |
| 549 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 550 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
| 551 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 552 | - // (because many need to convert old string states to foreign keys into the states table) |
|
| 553 | - $script_4_1_defaults->insert_default_states(); |
|
| 554 | - $script_4_1_defaults->insert_default_countries(); |
|
| 555 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
| 556 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
| 557 | - $script_4_5_defaults->insert_default_price_types(); |
|
| 558 | - $script_4_5_defaults->insert_default_prices(); |
|
| 559 | - $script_4_5_defaults->insert_default_tickets(); |
|
| 560 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
| 561 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
| 562 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
| 563 | - $script_4_6_defaults->insert_default_currencies(); |
|
| 564 | - $this->verify_new_countries(); |
|
| 565 | - $this->verify_new_currencies(); |
|
| 566 | - return true; |
|
| 567 | - } |
|
| 549 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 550 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
| 551 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 552 | + // (because many need to convert old string states to foreign keys into the states table) |
|
| 553 | + $script_4_1_defaults->insert_default_states(); |
|
| 554 | + $script_4_1_defaults->insert_default_countries(); |
|
| 555 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
| 556 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
| 557 | + $script_4_5_defaults->insert_default_price_types(); |
|
| 558 | + $script_4_5_defaults->insert_default_prices(); |
|
| 559 | + $script_4_5_defaults->insert_default_tickets(); |
|
| 560 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
| 561 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
| 562 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
| 563 | + $script_4_6_defaults->insert_default_currencies(); |
|
| 564 | + $this->verify_new_countries(); |
|
| 565 | + $this->verify_new_currencies(); |
|
| 566 | + return true; |
|
| 567 | + } |
|
| 568 | 568 | |
| 569 | 569 | |
| 570 | 570 | |
| 571 | - /** |
|
| 572 | - * @return boolean |
|
| 573 | - */ |
|
| 574 | - public function schema_changes_after_migration() |
|
| 575 | - { |
|
| 576 | - $this->fix_non_default_taxes(); |
|
| 577 | - // this is actually the same as the last DMS |
|
| 578 | - /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
| 579 | - $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
| 580 | - return $script_4_7_defaults->schema_changes_after_migration(); |
|
| 581 | - } |
|
| 571 | + /** |
|
| 572 | + * @return boolean |
|
| 573 | + */ |
|
| 574 | + public function schema_changes_after_migration() |
|
| 575 | + { |
|
| 576 | + $this->fix_non_default_taxes(); |
|
| 577 | + // this is actually the same as the last DMS |
|
| 578 | + /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
| 579 | + $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
| 580 | + return $script_4_7_defaults->schema_changes_after_migration(); |
|
| 581 | + } |
|
| 582 | 582 | |
| 583 | 583 | |
| 584 | 584 | |
| 585 | - public function migration_page_hooks() |
|
| 586 | - { |
|
| 587 | - } |
|
| 585 | + public function migration_page_hooks() |
|
| 586 | + { |
|
| 587 | + } |
|
| 588 | 588 | |
| 589 | 589 | |
| 590 | 590 | |
| 591 | - /** |
|
| 592 | - * verifies each of the new countries exists that somehow we missed in 4.1 |
|
| 593 | - */ |
|
| 594 | - public function verify_new_countries() |
|
| 595 | - { |
|
| 596 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
| 597 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
| 598 | - // currency symbols: http://www.xe.com/symbols.php |
|
| 599 | - // 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 |
|
| 600 | - // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
| 601 | - $newer_countries = array( |
|
| 602 | - array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
| 603 | - array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
| 604 | - array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
| 605 | - array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
| 606 | - array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
| 607 | - array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
| 608 | - array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
| 609 | - array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
| 610 | - array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
| 611 | - array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
| 612 | - array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
| 613 | - array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
| 614 | - array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
| 615 | - array( |
|
| 616 | - 'BQ', |
|
| 617 | - 'BES', |
|
| 618 | - 0, |
|
| 619 | - 'Bonaire, Saint Eustatius and Saba', |
|
| 620 | - 'USD', |
|
| 621 | - 'Dollar', |
|
| 622 | - 'Dollars', |
|
| 623 | - '$', |
|
| 624 | - 1, |
|
| 625 | - 2, |
|
| 626 | - '+599', |
|
| 627 | - 0, |
|
| 628 | - 0, |
|
| 629 | - ), |
|
| 630 | - array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
| 631 | - array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
| 632 | - array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
| 633 | - array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
| 634 | - array( |
|
| 635 | - 'HM', |
|
| 636 | - 'HMD', |
|
| 637 | - 0, |
|
| 638 | - 'Heard Island and McDonald Islands', |
|
| 639 | - 'AUD', |
|
| 640 | - 'Dollar', |
|
| 641 | - 'Dollars', |
|
| 642 | - '$', |
|
| 643 | - 1, |
|
| 644 | - 2, |
|
| 645 | - '+891', |
|
| 646 | - 0, |
|
| 647 | - 0, |
|
| 648 | - ), |
|
| 649 | - array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
| 650 | - array( |
|
| 651 | - 'GS', |
|
| 652 | - 'SGS', |
|
| 653 | - 0, |
|
| 654 | - 'South Georgia and the South Sandwich Islands', |
|
| 655 | - 'GBP', |
|
| 656 | - 'Pound', |
|
| 657 | - 'Pounds', |
|
| 658 | - '£', |
|
| 659 | - 1, |
|
| 660 | - 2, |
|
| 661 | - '+500', |
|
| 662 | - 0, |
|
| 663 | - 0, |
|
| 664 | - ), |
|
| 665 | - array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
| 666 | - array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
| 667 | - array( |
|
| 668 | - 'UM', |
|
| 669 | - 'UMI', |
|
| 670 | - 0, |
|
| 671 | - 'United States Minor Outlying Islands', |
|
| 672 | - 'USD', |
|
| 673 | - 'Dollar', |
|
| 674 | - 'Dollars', |
|
| 675 | - '$', |
|
| 676 | - 1, |
|
| 677 | - 2, |
|
| 678 | - '+1', |
|
| 679 | - 0, |
|
| 680 | - 0, |
|
| 681 | - ), |
|
| 682 | - ); |
|
| 683 | - global $wpdb; |
|
| 684 | - $country_table = $wpdb->prefix . "esp_country"; |
|
| 685 | - $country_format = array( |
|
| 686 | - "CNT_ISO" => '%s', |
|
| 687 | - "CNT_ISO3" => '%s', |
|
| 688 | - "RGN_ID" => '%d', |
|
| 689 | - "CNT_name" => '%s', |
|
| 690 | - "CNT_cur_code" => '%s', |
|
| 691 | - "CNT_cur_single" => '%s', |
|
| 692 | - "CNT_cur_plural" => '%s', |
|
| 693 | - "CNT_cur_sign" => '%s', |
|
| 694 | - "CNT_cur_sign_b4" => '%d', |
|
| 695 | - "CNT_cur_dec_plc" => '%d', |
|
| 696 | - "CNT_tel_code" => '%s', |
|
| 697 | - "CNT_is_EU" => '%d', |
|
| 698 | - "CNT_active" => '%d', |
|
| 699 | - ); |
|
| 700 | - if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
| 701 | - foreach ($newer_countries as $country) { |
|
| 702 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
| 703 | - $countries = $wpdb->get_var($SQL); |
|
| 704 | - if (! $countries) { |
|
| 705 | - $wpdb->insert( |
|
| 706 | - $country_table, |
|
| 707 | - array_combine(array_keys($country_format), $country), |
|
| 708 | - $country_format |
|
| 709 | - ); |
|
| 710 | - } |
|
| 711 | - } |
|
| 712 | - } |
|
| 713 | - } |
|
| 591 | + /** |
|
| 592 | + * verifies each of the new countries exists that somehow we missed in 4.1 |
|
| 593 | + */ |
|
| 594 | + public function verify_new_countries() |
|
| 595 | + { |
|
| 596 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
| 597 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
| 598 | + // currency symbols: http://www.xe.com/symbols.php |
|
| 599 | + // 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 |
|
| 600 | + // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
| 601 | + $newer_countries = array( |
|
| 602 | + array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
| 603 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
| 604 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
| 605 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
| 606 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
| 607 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
| 608 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
| 609 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
| 610 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
| 611 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
| 612 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
| 613 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
| 614 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
| 615 | + array( |
|
| 616 | + 'BQ', |
|
| 617 | + 'BES', |
|
| 618 | + 0, |
|
| 619 | + 'Bonaire, Saint Eustatius and Saba', |
|
| 620 | + 'USD', |
|
| 621 | + 'Dollar', |
|
| 622 | + 'Dollars', |
|
| 623 | + '$', |
|
| 624 | + 1, |
|
| 625 | + 2, |
|
| 626 | + '+599', |
|
| 627 | + 0, |
|
| 628 | + 0, |
|
| 629 | + ), |
|
| 630 | + array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
| 631 | + array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
| 632 | + array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
| 633 | + array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
| 634 | + array( |
|
| 635 | + 'HM', |
|
| 636 | + 'HMD', |
|
| 637 | + 0, |
|
| 638 | + 'Heard Island and McDonald Islands', |
|
| 639 | + 'AUD', |
|
| 640 | + 'Dollar', |
|
| 641 | + 'Dollars', |
|
| 642 | + '$', |
|
| 643 | + 1, |
|
| 644 | + 2, |
|
| 645 | + '+891', |
|
| 646 | + 0, |
|
| 647 | + 0, |
|
| 648 | + ), |
|
| 649 | + array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
| 650 | + array( |
|
| 651 | + 'GS', |
|
| 652 | + 'SGS', |
|
| 653 | + 0, |
|
| 654 | + 'South Georgia and the South Sandwich Islands', |
|
| 655 | + 'GBP', |
|
| 656 | + 'Pound', |
|
| 657 | + 'Pounds', |
|
| 658 | + '£', |
|
| 659 | + 1, |
|
| 660 | + 2, |
|
| 661 | + '+500', |
|
| 662 | + 0, |
|
| 663 | + 0, |
|
| 664 | + ), |
|
| 665 | + array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
| 666 | + array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
| 667 | + array( |
|
| 668 | + 'UM', |
|
| 669 | + 'UMI', |
|
| 670 | + 0, |
|
| 671 | + 'United States Minor Outlying Islands', |
|
| 672 | + 'USD', |
|
| 673 | + 'Dollar', |
|
| 674 | + 'Dollars', |
|
| 675 | + '$', |
|
| 676 | + 1, |
|
| 677 | + 2, |
|
| 678 | + '+1', |
|
| 679 | + 0, |
|
| 680 | + 0, |
|
| 681 | + ), |
|
| 682 | + ); |
|
| 683 | + global $wpdb; |
|
| 684 | + $country_table = $wpdb->prefix . "esp_country"; |
|
| 685 | + $country_format = array( |
|
| 686 | + "CNT_ISO" => '%s', |
|
| 687 | + "CNT_ISO3" => '%s', |
|
| 688 | + "RGN_ID" => '%d', |
|
| 689 | + "CNT_name" => '%s', |
|
| 690 | + "CNT_cur_code" => '%s', |
|
| 691 | + "CNT_cur_single" => '%s', |
|
| 692 | + "CNT_cur_plural" => '%s', |
|
| 693 | + "CNT_cur_sign" => '%s', |
|
| 694 | + "CNT_cur_sign_b4" => '%d', |
|
| 695 | + "CNT_cur_dec_plc" => '%d', |
|
| 696 | + "CNT_tel_code" => '%s', |
|
| 697 | + "CNT_is_EU" => '%d', |
|
| 698 | + "CNT_active" => '%d', |
|
| 699 | + ); |
|
| 700 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
| 701 | + foreach ($newer_countries as $country) { |
|
| 702 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
| 703 | + $countries = $wpdb->get_var($SQL); |
|
| 704 | + if (! $countries) { |
|
| 705 | + $wpdb->insert( |
|
| 706 | + $country_table, |
|
| 707 | + array_combine(array_keys($country_format), $country), |
|
| 708 | + $country_format |
|
| 709 | + ); |
|
| 710 | + } |
|
| 711 | + } |
|
| 712 | + } |
|
| 713 | + } |
|
| 714 | 714 | |
| 715 | 715 | |
| 716 | 716 | |
| 717 | - /** |
|
| 718 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
| 719 | - */ |
|
| 720 | - public function verify_new_currencies() |
|
| 721 | - { |
|
| 722 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
| 723 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
| 724 | - // currency symbols: http://www.xe.com/symbols.php |
|
| 725 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
| 726 | - // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
| 727 | - $newer_currencies = array( |
|
| 728 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
| 729 | - ); |
|
| 730 | - global $wpdb; |
|
| 731 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
| 732 | - $currency_format = array( |
|
| 733 | - "CUR_code" => '%s', |
|
| 734 | - "CUR_single" => '%s', |
|
| 735 | - "CUR_plural" => '%s', |
|
| 736 | - "CUR_sign" => '%s', |
|
| 737 | - "CUR_dec_plc" => '%d', |
|
| 738 | - "CUR_active" => '%d', |
|
| 739 | - ); |
|
| 740 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
| 741 | - foreach ($newer_currencies as $currency) { |
|
| 742 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
| 743 | - $countries = $wpdb->get_var($SQL); |
|
| 744 | - if (! $countries) { |
|
| 745 | - $wpdb->insert( |
|
| 746 | - $currency_table, |
|
| 747 | - array_combine(array_keys($currency_format), $currency), |
|
| 748 | - $currency_format |
|
| 749 | - ); |
|
| 750 | - } |
|
| 751 | - } |
|
| 752 | - } |
|
| 753 | - } |
|
| 717 | + /** |
|
| 718 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
| 719 | + */ |
|
| 720 | + public function verify_new_currencies() |
|
| 721 | + { |
|
| 722 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
| 723 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
| 724 | + // currency symbols: http://www.xe.com/symbols.php |
|
| 725 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
| 726 | + // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
| 727 | + $newer_currencies = array( |
|
| 728 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
| 729 | + ); |
|
| 730 | + global $wpdb; |
|
| 731 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
| 732 | + $currency_format = array( |
|
| 733 | + "CUR_code" => '%s', |
|
| 734 | + "CUR_single" => '%s', |
|
| 735 | + "CUR_plural" => '%s', |
|
| 736 | + "CUR_sign" => '%s', |
|
| 737 | + "CUR_dec_plc" => '%d', |
|
| 738 | + "CUR_active" => '%d', |
|
| 739 | + ); |
|
| 740 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
| 741 | + foreach ($newer_currencies as $currency) { |
|
| 742 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
| 743 | + $countries = $wpdb->get_var($SQL); |
|
| 744 | + if (! $countries) { |
|
| 745 | + $wpdb->insert( |
|
| 746 | + $currency_table, |
|
| 747 | + array_combine(array_keys($currency_format), $currency), |
|
| 748 | + $currency_format |
|
| 749 | + ); |
|
| 750 | + } |
|
| 751 | + } |
|
| 752 | + } |
|
| 753 | + } |
|
| 754 | 754 | |
| 755 | 755 | |
| 756 | 756 | |
| 757 | - /** |
|
| 758 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
| 759 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
| 760 | - * we should be able to stop doing this in 4.9 |
|
| 761 | - */ |
|
| 762 | - public function fix_non_default_taxes() |
|
| 763 | - { |
|
| 764 | - global $wpdb; |
|
| 765 | - $query = $wpdb->prepare("UPDATE |
|
| 757 | + /** |
|
| 758 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
| 759 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
| 760 | + * we should be able to stop doing this in 4.9 |
|
| 761 | + */ |
|
| 762 | + public function fix_non_default_taxes() |
|
| 763 | + { |
|
| 764 | + global $wpdb; |
|
| 765 | + $query = $wpdb->prepare("UPDATE |
|
| 766 | 766 | {$wpdb->prefix}esp_price p INNER JOIN |
| 767 | 767 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
| 768 | 768 | SET |
@@ -771,6 +771,6 @@ discard block |
||
| 771 | 771 | p.PRC_is_default = 0 AND |
| 772 | 772 | pt.PBT_ID = %d |
| 773 | 773 | ", EEM_Price_Type::base_type_tax); |
| 774 | - $wpdb->query($query); |
|
| 775 | - } |
|
| 774 | + $wpdb->query($query); |
|
| 775 | + } |
|
| 776 | 776 | } |
@@ -11,13 +11,13 @@ 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 | -if (! empty($stages)) { |
|
| 16 | +if ( ! empty($stages)) { |
|
| 17 | 17 | foreach ($stages as $filepath) { |
| 18 | 18 | $matches = array(); |
| 19 | 19 | preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
| 20 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 20 | + $class_to_filepath[$matches[1]] = $filepath; |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | // give addons a chance to autoload their stages too |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | if (version_compare($version_string, '4.3.0.decaf', '<') && version_compare($version_string, '4.2.0.decaf', '>=')) { |
| 57 | 57 | // echo "$version_string can be migrated fro"; |
| 58 | 58 | return true; |
| 59 | - } elseif (! $version_string) { |
|
| 59 | + } elseif ( ! $version_string) { |
|
| 60 | 60 | // echo "no version string provided: $version_string"; |
| 61 | 61 | // no version string provided... this must be pre 4.2 |
| 62 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 62 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
| 63 | 63 | } else { |
| 64 | 64 | // echo "$version_string doesnt apply"; |
| 65 | 65 | return false; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function schema_changes_before_migration() |
| 72 | 72 | { |
| 73 | 73 | // relies on 4.1's EEH_Activation::create_table |
| 74 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 74 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
| 75 | 75 | $table_name = 'esp_answer'; |
| 76 | 76 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 77 | 77 | REG_ID int(10) unsigned NOT NULL, |
@@ -474,11 +474,11 @@ discard block |
||
| 474 | 474 | public function insert_default_tickets() |
| 475 | 475 | { |
| 476 | 476 | global $wpdb; |
| 477 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
| 477 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
| 478 | 478 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
| 479 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
| 479 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
| 480 | 480 | $tickets_exist = $wpdb->get_var($SQL); |
| 481 | - if (! $tickets_exist) { |
|
| 481 | + if ( ! $tickets_exist) { |
|
| 482 | 482 | $SQL = "INSERT INTO $ticket_table |
| 483 | 483 | ( 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 |
| 484 | 484 | ( 1, 0, '" |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | $wpdb->query($SQL); |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
| 491 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
| 492 | 492 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
| 493 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
| 493 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
| 494 | 494 | $ticket_prc_exist = $wpdb->get_var($SQL); |
| 495 | - if (! $ticket_prc_exist) { |
|
| 495 | + if ( ! $ticket_prc_exist) { |
|
| 496 | 496 | $SQL = "INSERT INTO $ticket_price_table |
| 497 | 497 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
| 498 | 498 | ( 1, 1, 1 ) |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | $stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*'); |
| 17 | 17 | $class_to_filepath = array(); |
| 18 | 18 | if (! empty($stages)) { |
| 19 | - foreach ($stages as $filepath) { |
|
| 20 | - $matches = array(); |
|
| 21 | - preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 23 | - } |
|
| 19 | + foreach ($stages as $filepath) { |
|
| 20 | + $matches = array(); |
|
| 21 | + preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 22 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | // give addons a chance to autoload their stages too |
| 26 | 26 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath); |
@@ -30,56 +30,56 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base |
| 32 | 32 | { |
| 33 | - /** |
|
| 34 | - * EE_DMS_Core_4_3_0 constructor. |
|
| 35 | - * |
|
| 36 | - * @param TableManager $table_manager |
|
| 37 | - * @param TableAnalysis $table_analysis |
|
| 38 | - */ |
|
| 39 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
| 40 | - { |
|
| 41 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.3.0", "event_espresso"); |
|
| 42 | - $this->_priority = 10; |
|
| 43 | - $this->_migration_stages = array( |
|
| 44 | - new EE_DMS_4_3_0_question_option_order(), |
|
| 45 | - new EE_DMS_4_3_0_event_message_templates(), |
|
| 46 | - ); |
|
| 47 | - parent::__construct($table_manager, $table_analysis); |
|
| 48 | - } |
|
| 33 | + /** |
|
| 34 | + * EE_DMS_Core_4_3_0 constructor. |
|
| 35 | + * |
|
| 36 | + * @param TableManager $table_manager |
|
| 37 | + * @param TableAnalysis $table_analysis |
|
| 38 | + */ |
|
| 39 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
| 40 | + { |
|
| 41 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.3.0", "event_espresso"); |
|
| 42 | + $this->_priority = 10; |
|
| 43 | + $this->_migration_stages = array( |
|
| 44 | + new EE_DMS_4_3_0_question_option_order(), |
|
| 45 | + new EE_DMS_4_3_0_event_message_templates(), |
|
| 46 | + ); |
|
| 47 | + parent::__construct($table_manager, $table_analysis); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | - public function can_migrate_from_version($version_array) |
|
| 53 | - { |
|
| 54 | - $version_string = $version_array['Core']; |
|
| 55 | - if (version_compare($version_string, '4.3.0.decaf', '<') && version_compare($version_string, '4.2.0.decaf', '>=')) { |
|
| 52 | + public function can_migrate_from_version($version_array) |
|
| 53 | + { |
|
| 54 | + $version_string = $version_array['Core']; |
|
| 55 | + if (version_compare($version_string, '4.3.0.decaf', '<') && version_compare($version_string, '4.2.0.decaf', '>=')) { |
|
| 56 | 56 | // echo "$version_string can be migrated fro"; |
| 57 | - return true; |
|
| 58 | - } elseif (! $version_string) { |
|
| 57 | + return true; |
|
| 58 | + } elseif (! $version_string) { |
|
| 59 | 59 | // echo "no version string provided: $version_string"; |
| 60 | - // no version string provided... this must be pre 4.2 |
|
| 61 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 62 | - } else { |
|
| 60 | + // no version string provided... this must be pre 4.2 |
|
| 61 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 62 | + } else { |
|
| 63 | 63 | // echo "$version_string doesnt apply"; |
| 64 | - return false; |
|
| 65 | - } |
|
| 66 | - } |
|
| 64 | + return false; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - public function schema_changes_before_migration() |
|
| 71 | - { |
|
| 72 | - // relies on 4.1's EEH_Activation::create_table |
|
| 73 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 74 | - $table_name = 'esp_answer'; |
|
| 75 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 70 | + public function schema_changes_before_migration() |
|
| 71 | + { |
|
| 72 | + // relies on 4.1's EEH_Activation::create_table |
|
| 73 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 74 | + $table_name = 'esp_answer'; |
|
| 75 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 76 | 76 | REG_ID int(10) unsigned NOT NULL, |
| 77 | 77 | QST_ID int(10) unsigned NOT NULL, |
| 78 | 78 | ANS_value text NOT NULL, |
| 79 | 79 | PRIMARY KEY (ANS_ID)"; |
| 80 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 81 | - $table_name = 'esp_attendee_meta'; |
|
| 82 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 80 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 81 | + $table_name = 'esp_attendee_meta'; |
|
| 82 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 83 | 83 | ATT_ID bigint(20) unsigned NOT NULL, |
| 84 | 84 | ATT_fname varchar(45) NOT NULL, |
| 85 | 85 | ATT_lname varchar(45) NOT NULL, |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | KEY ATT_fname (ATT_fname), |
| 96 | 96 | KEY ATT_lname (ATT_lname), |
| 97 | 97 | KEY ATT_email (ATT_email(191))"; |
| 98 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 99 | - $table_name = 'esp_country'; |
|
| 100 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
| 98 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 99 | + $table_name = 'esp_country'; |
|
| 100 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
| 101 | 101 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
| 102 | 102 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
| 103 | 103 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | CNT_is_EU tinyint(1) DEFAULT '0', |
| 114 | 114 | CNT_active tinyint(1) DEFAULT '0', |
| 115 | 115 | PRIMARY KEY (CNT_ISO)"; |
| 116 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 117 | - $table_name = 'esp_datetime'; |
|
| 118 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 116 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 117 | + $table_name = 'esp_datetime'; |
|
| 118 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 119 | 119 | EVT_ID bigint(20) unsigned NOT NULL, |
| 120 | 120 | DTT_name varchar(255) NOT NULL DEFAULT '', |
| 121 | 121 | DTT_description text NOT NULL, |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | PRIMARY KEY (DTT_ID), |
| 131 | 131 | KEY EVT_ID (EVT_ID), |
| 132 | 132 | KEY DTT_is_primary (DTT_is_primary)"; |
| 133 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 134 | - $table_name = 'esp_event_meta'; |
|
| 135 | - $sql = " |
|
| 133 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 134 | + $table_name = 'esp_event_meta'; |
|
| 135 | + $sql = " |
|
| 136 | 136 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
| 137 | 137 | EVT_ID bigint(20) unsigned NOT NULL, |
| 138 | 138 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -147,31 +147,31 @@ discard block |
||
| 147 | 147 | EVT_external_URL varchar(200) NULL, |
| 148 | 148 | EVT_donations tinyint(1) NULL, |
| 149 | 149 | PRIMARY KEY (EVTM_ID)"; |
| 150 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 151 | - $table_name = 'esp_event_question_group'; |
|
| 152 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 150 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 151 | + $table_name = 'esp_event_question_group'; |
|
| 152 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 153 | 153 | EVT_ID bigint(20) unsigned NOT NULL, |
| 154 | 154 | QSG_ID int(10) unsigned NOT NULL, |
| 155 | 155 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 156 | 156 | PRIMARY KEY (EQG_ID)"; |
| 157 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 158 | - $table_name = 'esp_event_venue'; |
|
| 159 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 157 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 158 | + $table_name = 'esp_event_venue'; |
|
| 159 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 160 | 160 | EVT_ID bigint(20) unsigned NOT NULL, |
| 161 | 161 | VNU_ID bigint(20) unsigned NOT NULL, |
| 162 | 162 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 163 | 163 | PRIMARY KEY (EVV_ID)"; |
| 164 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 165 | - $table_name = 'esp_extra_meta'; |
|
| 166 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 164 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 165 | + $table_name = 'esp_extra_meta'; |
|
| 166 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 167 | 167 | OBJ_ID int(11) DEFAULT NULL, |
| 168 | 168 | EXM_type varchar(45) DEFAULT NULL, |
| 169 | 169 | EXM_key varchar(45) DEFAULT NULL, |
| 170 | 170 | EXM_value text, |
| 171 | 171 | PRIMARY KEY (EXM_ID)"; |
| 172 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 173 | - $table_name = 'esp_line_item'; |
|
| 174 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 172 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 173 | + $table_name = 'esp_line_item'; |
|
| 174 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 175 | 175 | LIN_code varchar(245) NOT NULL DEFAULT '', |
| 176 | 176 | TXN_ID int(11) DEFAULT NULL, |
| 177 | 177 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -187,19 +187,19 @@ discard block |
||
| 187 | 187 | OBJ_ID int(11) DEFAULT NULL, |
| 188 | 188 | OBJ_type varchar(45)DEFAULT NULL, |
| 189 | 189 | PRIMARY KEY (LIN_ID)"; |
| 190 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 191 | - $table_name = 'esp_message_template'; |
|
| 192 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 190 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 191 | + $table_name = 'esp_message_template'; |
|
| 192 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 193 | 193 | GRP_ID int(10) unsigned NOT NULL, |
| 194 | 194 | MTP_context varchar(50) NOT NULL, |
| 195 | 195 | MTP_template_field varchar(30) NOT NULL, |
| 196 | 196 | MTP_content text NOT NULL, |
| 197 | 197 | PRIMARY KEY (MTP_ID), |
| 198 | 198 | KEY GRP_ID (GRP_ID)"; |
| 199 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 200 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
| 201 | - $table_name = 'esp_message_template_group'; |
|
| 202 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 199 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 200 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
| 201 | + $table_name = 'esp_message_template_group'; |
|
| 202 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 203 | 203 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
| 204 | 204 | MTP_name varchar(245) NOT NULL DEFAULT '', |
| 205 | 205 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -211,17 +211,17 @@ discard block |
||
| 211 | 211 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
| 212 | 212 | PRIMARY KEY (GRP_ID), |
| 213 | 213 | KEY MTP_user_id (MTP_user_id)"; |
| 214 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 215 | - $table_name = 'esp_event_message_template'; |
|
| 216 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 214 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 215 | + $table_name = 'esp_event_message_template'; |
|
| 216 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 217 | 217 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 218 | 218 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
| 219 | 219 | PRIMARY KEY (EMT_ID), |
| 220 | 220 | KEY EVT_ID (EVT_ID), |
| 221 | 221 | KEY GRP_ID (GRP_ID)"; |
| 222 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 223 | - $table_name = 'esp_payment'; |
|
| 224 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 222 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 223 | + $table_name = 'esp_payment'; |
|
| 224 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 225 | 225 | TXN_ID int(10) unsigned DEFAULT NULL, |
| 226 | 226 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
| 227 | 227 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | PRIMARY KEY (PAY_ID), |
| 238 | 238 | KEY TXN_ID (TXN_ID), |
| 239 | 239 | KEY PAY_timestamp (PAY_timestamp)"; |
| 240 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 241 | - $table_name = "esp_ticket"; |
|
| 242 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 240 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 241 | + $table_name = "esp_ticket"; |
|
| 242 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 243 | 243 | TTM_ID int(10) unsigned NOT NULL, |
| 244 | 244 | TKT_name varchar(245) NOT NULL DEFAULT '', |
| 245 | 245 | 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(10) 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(10) 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(20) unsigned NULL, |
| 316 | 316 | QST_deleted tinyint(1) 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(10) 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(10) 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,25 +329,25 @@ 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(10) 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(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 335 | 335 | QSG_ID int(10) unsigned NOT NULL, |
| 336 | 336 | QST_ID int(10) unsigned NOT NULL, |
| 337 | 337 | QGQ_order int(10) 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(10) 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(10) 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(10) unsigned NOT NULL, |
| 345 | 345 | QSO_order int(10) unsigned NOT NULL DEFAULT 0, |
| 346 | 346 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 347 | 347 | PRIMARY KEY (QSO_ID)"; |
| 348 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 349 | - $table_name = 'esp_registration'; |
|
| 350 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 348 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 349 | + $table_name = 'esp_registration'; |
|
| 350 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 351 | 351 | EVT_ID bigint(20) unsigned NOT NULL, |
| 352 | 352 | ATT_ID bigint(20) unsigned NOT NULL, |
| 353 | 353 | TXN_ID int(10) unsigned NOT NULL, |
@@ -370,25 +370,25 @@ discard block |
||
| 370 | 370 | KEY STS_ID (STS_ID), |
| 371 | 371 | KEY REG_url_link (REG_url_link), |
| 372 | 372 | KEY REG_code (REG_code)"; |
| 373 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 374 | - $table_name = 'esp_checkin'; |
|
| 375 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 373 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 374 | + $table_name = 'esp_checkin'; |
|
| 375 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 376 | 376 | REG_ID int(10) unsigned NOT NULL, |
| 377 | 377 | DTT_ID int(10) unsigned NOT NULL, |
| 378 | 378 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
| 379 | 379 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 380 | 380 | PRIMARY KEY (CHK_ID)"; |
| 381 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 382 | - $table_name = 'esp_state'; |
|
| 383 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 381 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 382 | + $table_name = 'esp_state'; |
|
| 383 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 384 | 384 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
| 385 | 385 | STA_abbrev varchar(6) COLLATE utf8_bin NOT NULL, |
| 386 | 386 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
| 387 | 387 | STA_active tinyint(1) DEFAULT '1', |
| 388 | 388 | PRIMARY KEY (STA_ID)"; |
| 389 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 390 | - $table_name = 'esp_status'; |
|
| 391 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
| 389 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 390 | + $table_name = 'esp_status'; |
|
| 391 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
| 392 | 392 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
| 393 | 393 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
| 394 | 394 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -396,9 +396,9 @@ discard block |
||
| 396 | 396 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
| 397 | 397 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
| 398 | 398 | KEY STS_type (STS_type)"; |
| 399 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 400 | - $table_name = 'esp_transaction'; |
|
| 401 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 399 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 400 | + $table_name = 'esp_transaction'; |
|
| 401 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 402 | 402 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 403 | 403 | TXN_total decimal(10,3) DEFAULT '0.00', |
| 404 | 404 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | PRIMARY KEY (TXN_ID), |
| 409 | 409 | KEY TXN_timestamp (TXN_timestamp), |
| 410 | 410 | KEY STS_ID (STS_ID)"; |
| 411 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 412 | - $table_name = 'esp_venue_meta'; |
|
| 413 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 411 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 412 | + $table_name = 'esp_venue_meta'; |
|
| 413 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 414 | 414 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 415 | 415 | VNU_address varchar(255) DEFAULT NULL, |
| 416 | 416 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -428,77 +428,77 @@ discard block |
||
| 428 | 428 | PRIMARY KEY (VNUM_ID), |
| 429 | 429 | KEY STA_ID (STA_ID), |
| 430 | 430 | KEY CNT_ISO (CNT_ISO)"; |
| 431 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 432 | - $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 433 | - // setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
| 434 | - // (because many need to convert old string states to foreign keys into the states table) |
|
| 435 | - $script_with_defaults->insert_default_states(); |
|
| 436 | - $script_with_defaults->insert_default_countries(); |
|
| 437 | - // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
| 438 | - $script_with_defaults->insert_default_price_types(); |
|
| 439 | - $script_with_defaults->insert_default_prices(); |
|
| 440 | - // but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's |
|
| 441 | - $this->insert_default_tickets(); |
|
| 442 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
| 443 | - EE_Config::instance()->update_espresso_config(false, true); |
|
| 444 | - return true; |
|
| 445 | - } |
|
| 431 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 432 | + $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 433 | + // setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
| 434 | + // (because many need to convert old string states to foreign keys into the states table) |
|
| 435 | + $script_with_defaults->insert_default_states(); |
|
| 436 | + $script_with_defaults->insert_default_countries(); |
|
| 437 | + // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
| 438 | + $script_with_defaults->insert_default_price_types(); |
|
| 439 | + $script_with_defaults->insert_default_prices(); |
|
| 440 | + // but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's |
|
| 441 | + $this->insert_default_tickets(); |
|
| 442 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
| 443 | + EE_Config::instance()->update_espresso_config(false, true); |
|
| 444 | + return true; |
|
| 445 | + } |
|
| 446 | 446 | |
| 447 | 447 | |
| 448 | 448 | |
| 449 | - /** |
|
| 450 | - * @return boolean |
|
| 451 | - */ |
|
| 452 | - public function schema_changes_after_migration() |
|
| 453 | - { |
|
| 454 | - return true; |
|
| 455 | - } |
|
| 449 | + /** |
|
| 450 | + * @return boolean |
|
| 451 | + */ |
|
| 452 | + public function schema_changes_after_migration() |
|
| 453 | + { |
|
| 454 | + return true; |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | |
| 459 | - public function migration_page_hooks() |
|
| 460 | - { |
|
| 461 | - } |
|
| 459 | + public function migration_page_hooks() |
|
| 460 | + { |
|
| 461 | + } |
|
| 462 | 462 | |
| 463 | 463 | |
| 464 | 464 | |
| 465 | - /** |
|
| 466 | - * insert DEFAULT ticket |
|
| 467 | - * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field |
|
| 468 | - * |
|
| 469 | - * @access public |
|
| 470 | - * @static |
|
| 471 | - * @return void |
|
| 472 | - */ |
|
| 473 | - public function insert_default_tickets() |
|
| 474 | - { |
|
| 475 | - global $wpdb; |
|
| 476 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
| 477 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
| 478 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
| 479 | - $tickets_exist = $wpdb->get_var($SQL); |
|
| 480 | - if (! $tickets_exist) { |
|
| 481 | - $SQL = "INSERT INTO $ticket_table |
|
| 465 | + /** |
|
| 466 | + * insert DEFAULT ticket |
|
| 467 | + * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field |
|
| 468 | + * |
|
| 469 | + * @access public |
|
| 470 | + * @static |
|
| 471 | + * @return void |
|
| 472 | + */ |
|
| 473 | + public function insert_default_tickets() |
|
| 474 | + { |
|
| 475 | + global $wpdb; |
|
| 476 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
| 477 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
| 478 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
| 479 | + $tickets_exist = $wpdb->get_var($SQL); |
|
| 480 | + if (! $tickets_exist) { |
|
| 481 | + $SQL = "INSERT INTO $ticket_table |
|
| 482 | 482 | ( 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 |
| 483 | 483 | ( 1, 0, '" |
| 484 | - . esc_html__("Free Ticket", "event_espresso") |
|
| 485 | - . "', '', 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);"; |
|
| 486 | - $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
| 487 | - $wpdb->query($SQL); |
|
| 488 | - } |
|
| 489 | - } |
|
| 490 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
| 491 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
| 492 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
| 493 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
| 494 | - if (! $ticket_prc_exist) { |
|
| 495 | - $SQL = "INSERT INTO $ticket_price_table |
|
| 484 | + . esc_html__("Free Ticket", "event_espresso") |
|
| 485 | + . "', '', 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);"; |
|
| 486 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
| 487 | + $wpdb->query($SQL); |
|
| 488 | + } |
|
| 489 | + } |
|
| 490 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
| 491 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
| 492 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
| 493 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
| 494 | + if (! $ticket_prc_exist) { |
|
| 495 | + $SQL = "INSERT INTO $ticket_price_table |
|
| 496 | 496 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
| 497 | 497 | ( 1, 1, 1 ) |
| 498 | 498 | "; |
| 499 | - $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
| 500 | - $wpdb->query($SQL); |
|
| 501 | - } |
|
| 502 | - } |
|
| 503 | - } |
|
| 499 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
| 500 | + $wpdb->query($SQL); |
|
| 501 | + } |
|
| 502 | + } |
|
| 503 | + } |
|
| 504 | 504 | } |
@@ -12,13 +12,13 @@ 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 | -if (! empty($stages)) { |
|
| 17 | +if ( ! empty($stages)) { |
|
| 18 | 18 | foreach ($stages as $filepath) { |
| 19 | 19 | $matches = array(); |
| 20 | 20 | preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
| 21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 21 | + $class_to_filepath[$matches[1]] = $filepath; |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | // give addons a chance to autoload their stages too |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | if (version_compare($version_string, '4.2.0.decaf', '<') && version_compare($version_string, '4.1.0.decaf', '>=')) { |
| 58 | 58 | // echo "$version_string can be migrated fro"; |
| 59 | 59 | return true; |
| 60 | - } elseif (! $version_string) { |
|
| 60 | + } elseif ( ! $version_string) { |
|
| 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; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function schema_changes_before_migration() |
| 74 | 74 | { |
| 75 | 75 | // relies on 4.1's EEH_Activation::create_table |
| 76 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 76 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
| 77 | 77 | $table_name = 'esp_answer'; |
| 78 | 78 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 79 | 79 | REG_ID int(10) unsigned NOT NULL, |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*'); |
| 18 | 18 | $class_to_filepath = array(); |
| 19 | 19 | if (! empty($stages)) { |
| 20 | - foreach ($stages as $filepath) { |
|
| 21 | - $matches = array(); |
|
| 22 | - preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 23 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 24 | - } |
|
| 20 | + foreach ($stages as $filepath) { |
|
| 21 | + $matches = array(); |
|
| 22 | + preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 23 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 24 | + } |
|
| 25 | 25 | } |
| 26 | 26 | // give addons a chance to autoload their stages too |
| 27 | 27 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath); |
@@ -31,57 +31,57 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * EE_DMS_Core_4_2_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 = esc_html__("Data Update to Event Espresso 4.2.0", "event_espresso"); |
|
| 43 | - $this->_priority = 10; |
|
| 44 | - $this->_migration_stages = array( |
|
| 45 | - new EE_DMS_4_2_0_question_group_questions(), |
|
| 46 | - new EE_DMS_4_2_0_datetime_fields(), |
|
| 47 | - ); |
|
| 48 | - parent::__construct($table_manager, $table_analysis); |
|
| 49 | - } |
|
| 34 | + /** |
|
| 35 | + * EE_DMS_Core_4_2_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 = esc_html__("Data Update to Event Espresso 4.2.0", "event_espresso"); |
|
| 43 | + $this->_priority = 10; |
|
| 44 | + $this->_migration_stages = array( |
|
| 45 | + new EE_DMS_4_2_0_question_group_questions(), |
|
| 46 | + new EE_DMS_4_2_0_datetime_fields(), |
|
| 47 | + ); |
|
| 48 | + parent::__construct($table_manager, $table_analysis); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | - public function can_migrate_from_version($version_array) |
|
| 54 | - { |
|
| 55 | - $version_string = $version_array['Core']; |
|
| 56 | - if (version_compare($version_string, '4.2.0.decaf', '<') && version_compare($version_string, '4.1.0.decaf', '>=')) { |
|
| 53 | + public function can_migrate_from_version($version_array) |
|
| 54 | + { |
|
| 55 | + $version_string = $version_array['Core']; |
|
| 56 | + if (version_compare($version_string, '4.2.0.decaf', '<') && version_compare($version_string, '4.1.0.decaf', '>=')) { |
|
| 57 | 57 | // echo "$version_string can be migrated fro"; |
| 58 | - return true; |
|
| 59 | - } elseif (! $version_string) { |
|
| 58 | + return true; |
|
| 59 | + } elseif (! $version_string) { |
|
| 60 | 60 | // echo "no version string provided: $version_string"; |
| 61 | - // no version string provided... this must be pre 4.1 |
|
| 62 | - // because since 4.1 we're |
|
| 63 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 64 | - } else { |
|
| 61 | + // no version string provided... this must be pre 4.1 |
|
| 62 | + // because since 4.1 we're |
|
| 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 schema_changes_before_migration() |
|
| 73 | - { |
|
| 74 | - // relies on 4.1's EEH_Activation::create_table |
|
| 75 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 76 | - $table_name = 'esp_answer'; |
|
| 77 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 72 | + public function schema_changes_before_migration() |
|
| 73 | + { |
|
| 74 | + // relies on 4.1's EEH_Activation::create_table |
|
| 75 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 76 | + $table_name = 'esp_answer'; |
|
| 77 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 78 | 78 | REG_ID int(10) unsigned NOT NULL, |
| 79 | 79 | QST_ID int(10) unsigned NOT NULL, |
| 80 | 80 | ANS_value text NOT NULL, |
| 81 | 81 | PRIMARY KEY (ANS_ID)"; |
| 82 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 83 | - $table_name = 'esp_attendee_meta'; |
|
| 84 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 82 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 83 | + $table_name = 'esp_attendee_meta'; |
|
| 84 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 85 | 85 | ATT_ID bigint(20) unsigned NOT NULL, |
| 86 | 86 | ATT_fname varchar(45) NOT NULL, |
| 87 | 87 | ATT_lname varchar(45) NOT NULL, |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | KEY ATT_fname (ATT_fname), |
| 98 | 98 | KEY ATT_lname (ATT_lname), |
| 99 | 99 | KEY ATT_email (ATT_email(191))"; |
| 100 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 101 | - $table_name = 'esp_country'; |
|
| 102 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
| 100 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 101 | + $table_name = 'esp_country'; |
|
| 102 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
| 103 | 103 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
| 104 | 104 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
| 105 | 105 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | CNT_is_EU tinyint(1) DEFAULT '0', |
| 116 | 116 | CNT_active tinyint(1) DEFAULT '0', |
| 117 | 117 | PRIMARY KEY (CNT_ISO)"; |
| 118 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 119 | - $table_name = 'esp_datetime'; |
|
| 120 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 118 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 119 | + $table_name = 'esp_datetime'; |
|
| 120 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 121 | 121 | EVT_ID bigint(20) unsigned NOT NULL, |
| 122 | 122 | DTT_name varchar(255) NOT NULL DEFAULT '', |
| 123 | 123 | DTT_description text NOT NULL, |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | PRIMARY KEY (DTT_ID), |
| 133 | 133 | KEY EVT_ID (EVT_ID), |
| 134 | 134 | KEY DTT_is_primary (DTT_is_primary)"; |
| 135 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 136 | - $table_name = 'esp_event_meta'; |
|
| 137 | - $sql = " |
|
| 135 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 136 | + $table_name = 'esp_event_meta'; |
|
| 137 | + $sql = " |
|
| 138 | 138 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
| 139 | 139 | EVT_ID bigint(20) unsigned NOT NULL, |
| 140 | 140 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -149,31 +149,31 @@ discard block |
||
| 149 | 149 | EVT_external_URL varchar(200) NULL, |
| 150 | 150 | EVT_donations tinyint(1) NULL, |
| 151 | 151 | PRIMARY KEY (EVTM_ID)"; |
| 152 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 153 | - $table_name = 'esp_event_question_group'; |
|
| 154 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 152 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 153 | + $table_name = 'esp_event_question_group'; |
|
| 154 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 155 | 155 | EVT_ID bigint(20) unsigned NOT NULL, |
| 156 | 156 | QSG_ID int(10) unsigned NOT NULL, |
| 157 | 157 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 158 | 158 | PRIMARY KEY (EQG_ID)"; |
| 159 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 160 | - $table_name = 'esp_event_venue'; |
|
| 161 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 159 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 160 | + $table_name = 'esp_event_venue'; |
|
| 161 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 162 | 162 | EVT_ID bigint(20) unsigned NOT NULL, |
| 163 | 163 | VNU_ID bigint(20) unsigned NOT NULL, |
| 164 | 164 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 165 | 165 | PRIMARY KEY (EVV_ID)"; |
| 166 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 167 | - $table_name = 'esp_extra_meta'; |
|
| 168 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 166 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 167 | + $table_name = 'esp_extra_meta'; |
|
| 168 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 169 | 169 | OBJ_ID int(11) DEFAULT NULL, |
| 170 | 170 | EXM_type varchar(45) DEFAULT NULL, |
| 171 | 171 | EXM_key varchar(45) DEFAULT NULL, |
| 172 | 172 | EXM_value text, |
| 173 | 173 | PRIMARY KEY (EXM_ID)"; |
| 174 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 175 | - $table_name = 'esp_line_item'; |
|
| 176 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 174 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 175 | + $table_name = 'esp_line_item'; |
|
| 176 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 177 | 177 | LIN_code varchar(245) NOT NULL DEFAULT '', |
| 178 | 178 | TXN_ID int(11) DEFAULT NULL, |
| 179 | 179 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -189,18 +189,18 @@ discard block |
||
| 189 | 189 | OBJ_ID int(11) DEFAULT NULL, |
| 190 | 190 | OBJ_type varchar(45)DEFAULT NULL, |
| 191 | 191 | PRIMARY KEY (LIN_ID)"; |
| 192 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 193 | - $table_name = 'esp_message_template'; |
|
| 194 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 192 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 193 | + $table_name = 'esp_message_template'; |
|
| 194 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 195 | 195 | GRP_ID int(10) unsigned NOT NULL, |
| 196 | 196 | MTP_context varchar(50) NOT NULL, |
| 197 | 197 | MTP_template_field varchar(30) NOT NULL, |
| 198 | 198 | MTP_content text NOT NULL, |
| 199 | 199 | PRIMARY KEY (MTP_ID), |
| 200 | 200 | KEY GRP_ID (GRP_ID)"; |
| 201 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 202 | - $table_name = 'esp_message_template_group'; |
|
| 203 | - $sql = "GRP_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_group'; |
|
| 203 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 204 | 204 | EVT_ID bigint(20) unsigned DEFAULT NULL, |
| 205 | 205 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
| 206 | 206 | MTP_messenger varchar(30) NOT NULL, |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | PRIMARY KEY (GRP_ID), |
| 213 | 213 | KEY EVT_ID (EVT_ID), |
| 214 | 214 | KEY MTP_user_id (MTP_user_id)"; |
| 215 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 216 | - $table_name = 'esp_payment'; |
|
| 217 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 215 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 216 | + $table_name = 'esp_payment'; |
|
| 217 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 218 | 218 | TXN_ID int(10) unsigned DEFAULT NULL, |
| 219 | 219 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
| 220 | 220 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | PRIMARY KEY (PAY_ID), |
| 231 | 231 | KEY TXN_ID (TXN_ID), |
| 232 | 232 | KEY PAY_timestamp (PAY_timestamp)"; |
| 233 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 234 | - $table_name = "esp_ticket"; |
|
| 235 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 233 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 234 | + $table_name = "esp_ticket"; |
|
| 235 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 236 | 236 | TTM_ID int(10) unsigned NOT NULL, |
| 237 | 237 | TKT_name varchar(245) NOT NULL DEFAULT '', |
| 238 | 238 | TKT_description text NOT NULL, |
@@ -251,28 +251,28 @@ discard block |
||
| 251 | 251 | TKT_parent int(10) unsigned DEFAULT '0', |
| 252 | 252 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 253 | 253 | PRIMARY KEY (TKT_ID)"; |
| 254 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 255 | - $table_name = "esp_ticket_price"; |
|
| 256 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 254 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 255 | + $table_name = "esp_ticket_price"; |
|
| 256 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 257 | 257 | TKT_ID int(10) unsigned NOT NULL, |
| 258 | 258 | PRC_ID int(10) unsigned NOT NULL, |
| 259 | 259 | PRIMARY KEY (TKP_ID)"; |
| 260 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 261 | - $table_name = "esp_datetime_ticket"; |
|
| 262 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 260 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 261 | + $table_name = "esp_datetime_ticket"; |
|
| 262 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 263 | 263 | DTT_ID int(10) unsigned NOT NULL, |
| 264 | 264 | TKT_ID int(10) unsigned NOT NULL, |
| 265 | 265 | PRIMARY KEY (DTK_ID)"; |
| 266 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 267 | - $table_name = "esp_ticket_template"; |
|
| 268 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 266 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 267 | + $table_name = "esp_ticket_template"; |
|
| 268 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 269 | 269 | TTM_name varchar(45) NOT NULL, |
| 270 | 270 | TTM_description text, |
| 271 | 271 | TTM_file varchar(45), |
| 272 | 272 | PRIMARY KEY (TTM_ID)"; |
| 273 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 274 | - $table_name = "esp_price"; |
|
| 275 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 273 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 274 | + $table_name = "esp_price"; |
|
| 275 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 276 | 276 | PRT_ID tinyint(3) unsigned NOT NULL, |
| 277 | 277 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
| 278 | 278 | PRC_name varchar(245) NOT NULL, |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | PRC_order tinyint(3) unsigned NOT NULL DEFAULT '0', |
| 284 | 284 | PRC_parent int(10) unsigned DEFAULT 0, |
| 285 | 285 | PRIMARY KEY (PRC_ID)"; |
| 286 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 287 | - $table_name = "esp_price_type"; |
|
| 288 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 286 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 287 | + $table_name = "esp_price_type"; |
|
| 288 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 289 | 289 | PRT_name varchar(45) NOT NULL, |
| 290 | 290 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
| 291 | 291 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 294 | 294 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
| 295 | 295 | PRIMARY KEY (PRT_ID)"; |
| 296 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 297 | - $table_name = 'esp_question'; |
|
| 298 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 296 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 297 | + $table_name = 'esp_question'; |
|
| 298 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 299 | 299 | QST_display_text text NOT NULL, |
| 300 | 300 | QST_admin_label varchar(255) NOT NULL, |
| 301 | 301 | QST_system varchar(25) DEFAULT NULL, |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | QST_wp_user bigint(20) unsigned NULL, |
| 308 | 308 | QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 309 | 309 | PRIMARY KEY (QST_ID)'; |
| 310 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 311 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
| 312 | - $table_name = 'esp_question_group'; |
|
| 313 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 310 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 311 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
| 312 | + $table_name = 'esp_question_group'; |
|
| 313 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 314 | 314 | QSG_name varchar(255) NOT NULL, |
| 315 | 315 | QSG_identifier varchar(100) NOT NULL, |
| 316 | 316 | QSG_desc text NULL, |
@@ -321,24 +321,24 @@ discard block |
||
| 321 | 321 | QSG_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 322 | 322 | PRIMARY KEY (QSG_ID), |
| 323 | 323 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
| 324 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 325 | - $table_name = 'esp_question_group_question'; |
|
| 326 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 324 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 325 | + $table_name = 'esp_question_group_question'; |
|
| 326 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 327 | 327 | QSG_ID int(10) unsigned NOT NULL, |
| 328 | 328 | QST_ID int(10) unsigned NOT NULL, |
| 329 | 329 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
| 330 | 330 | PRIMARY KEY (QGQ_ID) "; |
| 331 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 332 | - $table_name = 'esp_question_option'; |
|
| 333 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 331 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 332 | + $table_name = 'esp_question_option'; |
|
| 333 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 334 | 334 | QSO_value varchar(255) NOT NULL, |
| 335 | 335 | QSO_desc text NOT NULL, |
| 336 | 336 | QST_ID int(10) unsigned NOT NULL, |
| 337 | 337 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 338 | 338 | PRIMARY KEY (QSO_ID)"; |
| 339 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 340 | - $table_name = 'esp_registration'; |
|
| 341 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 339 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 340 | + $table_name = 'esp_registration'; |
|
| 341 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 342 | 342 | EVT_ID bigint(20) unsigned NOT NULL, |
| 343 | 343 | ATT_ID bigint(20) unsigned NOT NULL, |
| 344 | 344 | TXN_ID int(10) unsigned NOT NULL, |
@@ -361,25 +361,25 @@ discard block |
||
| 361 | 361 | KEY STS_ID (STS_ID), |
| 362 | 362 | KEY REG_url_link (REG_url_link), |
| 363 | 363 | KEY REG_code (REG_code)"; |
| 364 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 365 | - $table_name = 'esp_checkin'; |
|
| 366 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 364 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 365 | + $table_name = 'esp_checkin'; |
|
| 366 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 367 | 367 | REG_ID int(10) unsigned NOT NULL, |
| 368 | 368 | DTT_ID int(10) unsigned NOT NULL, |
| 369 | 369 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
| 370 | 370 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 371 | 371 | PRIMARY KEY (CHK_ID)"; |
| 372 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 373 | - $table_name = 'esp_state'; |
|
| 374 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 372 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 373 | + $table_name = 'esp_state'; |
|
| 374 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 375 | 375 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
| 376 | 376 | STA_abbrev varchar(6) COLLATE utf8_bin NOT NULL, |
| 377 | 377 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
| 378 | 378 | STA_active tinyint(1) DEFAULT '1', |
| 379 | 379 | PRIMARY KEY (STA_ID)"; |
| 380 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 381 | - $table_name = 'esp_status'; |
|
| 382 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
| 380 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 381 | + $table_name = 'esp_status'; |
|
| 382 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
| 383 | 383 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
| 384 | 384 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
| 385 | 385 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -387,9 +387,9 @@ discard block |
||
| 387 | 387 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
| 388 | 388 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
| 389 | 389 | KEY STS_type (STS_type)"; |
| 390 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 391 | - $table_name = 'esp_transaction'; |
|
| 392 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 390 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 391 | + $table_name = 'esp_transaction'; |
|
| 392 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 393 | 393 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 394 | 394 | TXN_total decimal(10,3) DEFAULT '0.00', |
| 395 | 395 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | PRIMARY KEY (TXN_ID), |
| 400 | 400 | KEY TXN_timestamp (TXN_timestamp), |
| 401 | 401 | KEY STS_ID (STS_ID)"; |
| 402 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 403 | - $table_name = 'esp_venue_meta'; |
|
| 404 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 402 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 403 | + $table_name = 'esp_venue_meta'; |
|
| 404 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 405 | 405 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 406 | 406 | VNU_address varchar(255) DEFAULT NULL, |
| 407 | 407 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -419,36 +419,36 @@ discard block |
||
| 419 | 419 | PRIMARY KEY (VNUM_ID), |
| 420 | 420 | KEY STA_ID (STA_ID), |
| 421 | 421 | KEY CNT_ISO (CNT_ISO)"; |
| 422 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 423 | - $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 424 | - // setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
| 425 | - // (because many need to convert old string states to foreign keys into the states table) |
|
| 426 | - $script_with_defaults->insert_default_states(); |
|
| 427 | - $script_with_defaults->insert_default_countries(); |
|
| 428 | - // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
| 429 | - $script_with_defaults->insert_default_price_types(); |
|
| 430 | - $script_with_defaults->insert_default_prices(); |
|
| 431 | - $script_with_defaults->insert_default_tickets(); |
|
| 432 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
| 433 | - EE_Config::instance()->update_espresso_config(false, true); |
|
| 434 | - return true; |
|
| 435 | - } |
|
| 422 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 423 | + $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 424 | + // setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
| 425 | + // (because many need to convert old string states to foreign keys into the states table) |
|
| 426 | + $script_with_defaults->insert_default_states(); |
|
| 427 | + $script_with_defaults->insert_default_countries(); |
|
| 428 | + // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
| 429 | + $script_with_defaults->insert_default_price_types(); |
|
| 430 | + $script_with_defaults->insert_default_prices(); |
|
| 431 | + $script_with_defaults->insert_default_tickets(); |
|
| 432 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
| 433 | + EE_Config::instance()->update_espresso_config(false, true); |
|
| 434 | + return true; |
|
| 435 | + } |
|
| 436 | 436 | |
| 437 | 437 | |
| 438 | 438 | |
| 439 | - /** |
|
| 440 | - * We COULD clean up the esp_question.QST_order field here. We'll leave it for now |
|
| 441 | - * |
|
| 442 | - * @return boolean |
|
| 443 | - */ |
|
| 444 | - public function schema_changes_after_migration() |
|
| 445 | - { |
|
| 446 | - return true; |
|
| 447 | - } |
|
| 439 | + /** |
|
| 440 | + * We COULD clean up the esp_question.QST_order field here. We'll leave it for now |
|
| 441 | + * |
|
| 442 | + * @return boolean |
|
| 443 | + */ |
|
| 444 | + public function schema_changes_after_migration() |
|
| 445 | + { |
|
| 446 | + return true; |
|
| 447 | + } |
|
| 448 | 448 | |
| 449 | 449 | |
| 450 | 450 | |
| 451 | - public function migration_page_hooks() |
|
| 452 | - { |
|
| 453 | - } |
|
| 451 | + public function migration_page_hooks() |
|
| 452 | + { |
|
| 453 | + } |
|
| 454 | 454 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | // first get registrations just for this attendee. |
| 81 | 81 | $att = $data->att_obj; |
| 82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
| 83 | 83 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
| 84 | 84 | ? array($data->reg_obj) : $registrations_on_attendee; |
| 85 | 85 | $tkts = array(); |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | // tickets will be tickets for all registrations on this attendee. |
| 102 | 102 | foreach ($registrations_on_attendee as $reg) { |
| 103 | 103 | if ($reg instanceof EE_Registration) { |
| 104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 105 | - $data->registrations[ $reg->ID() ] |
|
| 106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 107 | - ) ]['tkt_obj'] : null; |
|
| 104 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 105 | + $data->registrations[$reg->ID()] |
|
| 106 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
| 107 | + )]['tkt_obj'] : null; |
|
| 108 | 108 | if ($ticket instanceof EE_Ticket) { |
| 109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 109 | + $tkts[$ticket->ID()] = $ticket; |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | // data will be tickets for this event for this recipient. |
| 124 | 124 | foreach ($registrations_on_attendee as $reg) { |
| 125 | 125 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
| 126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 127 | - $data->registrations[ $reg->ID() ] |
|
| 128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 129 | - ) ]['tkt_obj'] : null; |
|
| 126 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 127 | + $data->registrations[$reg->ID()] |
|
| 128 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
| 129 | + )]['tkt_obj'] : null; |
|
| 130 | 130 | if ($ticket instanceof EE_Ticket) { |
| 131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 131 | + $tkts[$ticket->ID()] = $ticket; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | // first get registrations just for this attendee. |
| 172 | 172 | $att = $data->att_obj; |
| 173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
| 174 | 174 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
| 175 | 175 | ? array($data->reg_obj) |
| 176 | 176 | : $registrations_on_attendee; |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | // dtts will be datetimes for all registrations on this attendee |
| 186 | 186 | foreach ($registrations_on_attendee as $reg) { |
| 187 | 187 | if ($reg instanceof EE_Registration) { |
| 188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 189 | - $data->registrations[ $reg->ID() ] |
|
| 190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
| 191 | - ) ]['dtt_objs'] : array(); |
|
| 188 | + $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 189 | + $data->registrations[$reg->ID()] |
|
| 190 | + ) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID( |
|
| 191 | + )]['dtt_objs'] : array(); |
|
| 192 | 192 | $dtt_objs = (array) $dtt_objs; |
| 193 | 193 | foreach ($dtt_objs as $dtt_obj) { |
| 194 | 194 | if ($dtt_obj instanceof EE_Datetime) { |
| 195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 195 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -208,19 +208,19 @@ discard block |
||
| 208 | 208 | // data will be datetimes for this event for this recipient |
| 209 | 209 | foreach ($registrations_on_attendee as $reg) { |
| 210 | 210 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
| 211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 212 | - $data->registrations[ $reg->ID() ] |
|
| 213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 214 | - ) ]['tkt_obj'] : null; |
|
| 211 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 212 | + $data->registrations[$reg->ID()] |
|
| 213 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
| 214 | + )]['tkt_obj'] : null; |
|
| 215 | 215 | if ($ticket instanceof EE_Ticket) { |
| 216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
| 217 | - $data->tickets[ $ticket->ID() ] |
|
| 218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
| 219 | - ) ]['dtt_objs'] : array(); |
|
| 216 | + $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array( |
|
| 217 | + $data->tickets[$ticket->ID()] |
|
| 218 | + ) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID( |
|
| 219 | + )]['dtt_objs'] : array(); |
|
| 220 | 220 | $dtt_objs = (array) $dtt_objs; |
| 221 | 221 | foreach ($dtt_objs as $dtt_obj) { |
| 222 | 222 | if ($dtt_obj instanceof EE_Datetime) { |
| 223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 223 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -18,225 +18,225 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class EE_Recipient_List_Shortcodes extends EE_Shortcodes |
| 20 | 20 | { |
| 21 | - public function __construct() |
|
| 22 | - { |
|
| 23 | - parent::__construct(); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - protected function _init_props() |
|
| 28 | - { |
|
| 29 | - $this->label = esc_html__('Recipient List Shortcodes', 'event_espresso'); |
|
| 30 | - $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
| 31 | - $this->_shortcodes = array( |
|
| 32 | - '[RECIPIENT_TICKET_LIST]' => esc_html__( |
|
| 33 | - 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
| 34 | - 'event_espresso' |
|
| 35 | - ), |
|
| 36 | - '[RECIPIENT_DATETIME_LIST]' => esc_html__( |
|
| 37 | - 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
| 38 | - 'event_espresso' |
|
| 39 | - ), |
|
| 40 | - ); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - protected function _parser($shortcode) |
|
| 45 | - { |
|
| 46 | - switch ($shortcode) { |
|
| 47 | - case '[RECIPIENT_TICKET_LIST]': |
|
| 48 | - return $this->_get_recipient_ticket_list(); |
|
| 49 | - break; |
|
| 50 | - |
|
| 51 | - case '[RECIPIENT_DATETIME_LIST]': |
|
| 52 | - return $this->_get_recipient_datetime_list(); |
|
| 53 | - break; |
|
| 54 | - } |
|
| 55 | - return ''; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 64 | - private function _get_recipient_ticket_list() |
|
| 65 | - { |
|
| 66 | - $this->_validate_list_requirements(); |
|
| 67 | - |
|
| 68 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 69 | - return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
| 70 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 71 | - return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
| 72 | - } else { |
|
| 73 | - return ''; |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
| 79 | - { |
|
| 80 | - // first get registrations just for this attendee. |
|
| 81 | - $att = $data->att_obj; |
|
| 82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 83 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 84 | - ? array($data->reg_obj) : $registrations_on_attendee; |
|
| 85 | - $tkts = array(); |
|
| 86 | - |
|
| 87 | - // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
| 88 | - // which means we want to get tickets for all events this addressee is a part of. |
|
| 89 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 90 | - $valid_shortcodes = array( |
|
| 91 | - 'ticket', |
|
| 92 | - 'event_list', |
|
| 93 | - 'attendee_list', |
|
| 94 | - 'datetime_list', |
|
| 95 | - 'registration_details', |
|
| 96 | - 'attendee', |
|
| 97 | - 'recipient_details', |
|
| 98 | - ); |
|
| 99 | - $template = $this->_data['template']; |
|
| 100 | - |
|
| 101 | - // tickets will be tickets for all registrations on this attendee. |
|
| 102 | - foreach ($registrations_on_attendee as $reg) { |
|
| 103 | - if ($reg instanceof EE_Registration) { |
|
| 104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 105 | - $data->registrations[ $reg->ID() ] |
|
| 106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 107 | - ) ]['tkt_obj'] : null; |
|
| 108 | - if ($ticket instanceof EE_Ticket) { |
|
| 109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
| 116 | - $event = $this->_data['data']; |
|
| 117 | - if ($event instanceof EE_Event) { |
|
| 118 | - $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
| 119 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
| 120 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
| 121 | - // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
| 122 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
| 123 | - // data will be tickets for this event for this recipient. |
|
| 124 | - foreach ($registrations_on_attendee as $reg) { |
|
| 125 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 127 | - $data->registrations[ $reg->ID() ] |
|
| 128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 129 | - ) ]['tkt_obj'] : null; |
|
| 130 | - if ($ticket instanceof EE_Ticket) { |
|
| 131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - $tkt_parsed = ''; |
|
| 138 | - foreach ($tkts as $ticket) { |
|
| 139 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
| 140 | - $template, |
|
| 141 | - $ticket, |
|
| 142 | - $valid_shortcodes, |
|
| 143 | - $this->_extra_data |
|
| 144 | - ); |
|
| 145 | - } |
|
| 146 | - return $tkt_parsed; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
| 152 | - * |
|
| 153 | - * @return string |
|
| 154 | - */ |
|
| 155 | - private function _get_recipient_datetime_list() |
|
| 156 | - { |
|
| 157 | - $this->_validate_list_requirements(); |
|
| 158 | - |
|
| 159 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 160 | - return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
| 161 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 162 | - return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
| 163 | - } else { |
|
| 164 | - return ''; |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
| 170 | - { |
|
| 171 | - // first get registrations just for this attendee. |
|
| 172 | - $att = $data->att_obj; |
|
| 173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 174 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 175 | - ? array($data->reg_obj) |
|
| 176 | - : $registrations_on_attendee; |
|
| 177 | - $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
| 178 | - $template = ''; |
|
| 179 | - $dtts = array(); |
|
| 180 | - |
|
| 181 | - // setup valid shortcodes depending on what the status of the $this->_data property is |
|
| 182 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 183 | - $template = $this->_data['template']; |
|
| 184 | - |
|
| 185 | - // dtts will be datetimes for all registrations on this attendee |
|
| 186 | - foreach ($registrations_on_attendee as $reg) { |
|
| 187 | - if ($reg instanceof EE_Registration) { |
|
| 188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 189 | - $data->registrations[ $reg->ID() ] |
|
| 190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
| 191 | - ) ]['dtt_objs'] : array(); |
|
| 192 | - $dtt_objs = (array) $dtt_objs; |
|
| 193 | - foreach ($dtt_objs as $dtt_obj) { |
|
| 194 | - if ($dtt_obj instanceof EE_Datetime) { |
|
| 195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
| 203 | - $event = $this->_data['data']; |
|
| 204 | - if ($event instanceof EE_Event) { |
|
| 205 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
| 206 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
| 207 | - |
|
| 208 | - // data will be datetimes for this event for this recipient |
|
| 209 | - foreach ($registrations_on_attendee as $reg) { |
|
| 210 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 212 | - $data->registrations[ $reg->ID() ] |
|
| 213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 214 | - ) ]['tkt_obj'] : null; |
|
| 215 | - if ($ticket instanceof EE_Ticket) { |
|
| 216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
| 217 | - $data->tickets[ $ticket->ID() ] |
|
| 218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
| 219 | - ) ]['dtt_objs'] : array(); |
|
| 220 | - $dtt_objs = (array) $dtt_objs; |
|
| 221 | - foreach ($dtt_objs as $dtt_obj) { |
|
| 222 | - if ($dtt_obj instanceof EE_Datetime) { |
|
| 223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 224 | - } |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - $dtt_parsed = ''; |
|
| 232 | - foreach ($dtts as $datetime) { |
|
| 233 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
| 234 | - $template, |
|
| 235 | - $datetime, |
|
| 236 | - $valid_shortcodes, |
|
| 237 | - $this->_extra_data |
|
| 238 | - ); |
|
| 239 | - } |
|
| 240 | - return $dtt_parsed; |
|
| 241 | - } |
|
| 21 | + public function __construct() |
|
| 22 | + { |
|
| 23 | + parent::__construct(); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + protected function _init_props() |
|
| 28 | + { |
|
| 29 | + $this->label = esc_html__('Recipient List Shortcodes', 'event_espresso'); |
|
| 30 | + $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
| 31 | + $this->_shortcodes = array( |
|
| 32 | + '[RECIPIENT_TICKET_LIST]' => esc_html__( |
|
| 33 | + 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
| 34 | + 'event_espresso' |
|
| 35 | + ), |
|
| 36 | + '[RECIPIENT_DATETIME_LIST]' => esc_html__( |
|
| 37 | + 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
| 38 | + 'event_espresso' |
|
| 39 | + ), |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + protected function _parser($shortcode) |
|
| 45 | + { |
|
| 46 | + switch ($shortcode) { |
|
| 47 | + case '[RECIPIENT_TICKET_LIST]': |
|
| 48 | + return $this->_get_recipient_ticket_list(); |
|
| 49 | + break; |
|
| 50 | + |
|
| 51 | + case '[RECIPIENT_DATETIME_LIST]': |
|
| 52 | + return $this->_get_recipient_datetime_list(); |
|
| 53 | + break; |
|
| 54 | + } |
|
| 55 | + return ''; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | + private function _get_recipient_ticket_list() |
|
| 65 | + { |
|
| 66 | + $this->_validate_list_requirements(); |
|
| 67 | + |
|
| 68 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 69 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
| 70 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 71 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
| 72 | + } else { |
|
| 73 | + return ''; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
| 79 | + { |
|
| 80 | + // first get registrations just for this attendee. |
|
| 81 | + $att = $data->att_obj; |
|
| 82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 83 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 84 | + ? array($data->reg_obj) : $registrations_on_attendee; |
|
| 85 | + $tkts = array(); |
|
| 86 | + |
|
| 87 | + // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
| 88 | + // which means we want to get tickets for all events this addressee is a part of. |
|
| 89 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 90 | + $valid_shortcodes = array( |
|
| 91 | + 'ticket', |
|
| 92 | + 'event_list', |
|
| 93 | + 'attendee_list', |
|
| 94 | + 'datetime_list', |
|
| 95 | + 'registration_details', |
|
| 96 | + 'attendee', |
|
| 97 | + 'recipient_details', |
|
| 98 | + ); |
|
| 99 | + $template = $this->_data['template']; |
|
| 100 | + |
|
| 101 | + // tickets will be tickets for all registrations on this attendee. |
|
| 102 | + foreach ($registrations_on_attendee as $reg) { |
|
| 103 | + if ($reg instanceof EE_Registration) { |
|
| 104 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 105 | + $data->registrations[ $reg->ID() ] |
|
| 106 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 107 | + ) ]['tkt_obj'] : null; |
|
| 108 | + if ($ticket instanceof EE_Ticket) { |
|
| 109 | + $tkts[ $ticket->ID() ] = $ticket; |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
| 116 | + $event = $this->_data['data']; |
|
| 117 | + if ($event instanceof EE_Event) { |
|
| 118 | + $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
| 119 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
| 120 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
| 121 | + // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
| 122 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
| 123 | + // data will be tickets for this event for this recipient. |
|
| 124 | + foreach ($registrations_on_attendee as $reg) { |
|
| 125 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 126 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 127 | + $data->registrations[ $reg->ID() ] |
|
| 128 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 129 | + ) ]['tkt_obj'] : null; |
|
| 130 | + if ($ticket instanceof EE_Ticket) { |
|
| 131 | + $tkts[ $ticket->ID() ] = $ticket; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + $tkt_parsed = ''; |
|
| 138 | + foreach ($tkts as $ticket) { |
|
| 139 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
| 140 | + $template, |
|
| 141 | + $ticket, |
|
| 142 | + $valid_shortcodes, |
|
| 143 | + $this->_extra_data |
|
| 144 | + ); |
|
| 145 | + } |
|
| 146 | + return $tkt_parsed; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
| 152 | + * |
|
| 153 | + * @return string |
|
| 154 | + */ |
|
| 155 | + private function _get_recipient_datetime_list() |
|
| 156 | + { |
|
| 157 | + $this->_validate_list_requirements(); |
|
| 158 | + |
|
| 159 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 160 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
| 161 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 162 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
| 163 | + } else { |
|
| 164 | + return ''; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
| 170 | + { |
|
| 171 | + // first get registrations just for this attendee. |
|
| 172 | + $att = $data->att_obj; |
|
| 173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 174 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 175 | + ? array($data->reg_obj) |
|
| 176 | + : $registrations_on_attendee; |
|
| 177 | + $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
| 178 | + $template = ''; |
|
| 179 | + $dtts = array(); |
|
| 180 | + |
|
| 181 | + // setup valid shortcodes depending on what the status of the $this->_data property is |
|
| 182 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 183 | + $template = $this->_data['template']; |
|
| 184 | + |
|
| 185 | + // dtts will be datetimes for all registrations on this attendee |
|
| 186 | + foreach ($registrations_on_attendee as $reg) { |
|
| 187 | + if ($reg instanceof EE_Registration) { |
|
| 188 | + $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 189 | + $data->registrations[ $reg->ID() ] |
|
| 190 | + ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
| 191 | + ) ]['dtt_objs'] : array(); |
|
| 192 | + $dtt_objs = (array) $dtt_objs; |
|
| 193 | + foreach ($dtt_objs as $dtt_obj) { |
|
| 194 | + if ($dtt_obj instanceof EE_Datetime) { |
|
| 195 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
| 203 | + $event = $this->_data['data']; |
|
| 204 | + if ($event instanceof EE_Event) { |
|
| 205 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
| 206 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
| 207 | + |
|
| 208 | + // data will be datetimes for this event for this recipient |
|
| 209 | + foreach ($registrations_on_attendee as $reg) { |
|
| 210 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 211 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 212 | + $data->registrations[ $reg->ID() ] |
|
| 213 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 214 | + ) ]['tkt_obj'] : null; |
|
| 215 | + if ($ticket instanceof EE_Ticket) { |
|
| 216 | + $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
| 217 | + $data->tickets[ $ticket->ID() ] |
|
| 218 | + ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
| 219 | + ) ]['dtt_objs'] : array(); |
|
| 220 | + $dtt_objs = (array) $dtt_objs; |
|
| 221 | + foreach ($dtt_objs as $dtt_obj) { |
|
| 222 | + if ($dtt_obj instanceof EE_Datetime) { |
|
| 223 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 224 | + } |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + $dtt_parsed = ''; |
|
| 232 | + foreach ($dtts as $datetime) { |
|
| 233 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
| 234 | + $template, |
|
| 235 | + $datetime, |
|
| 236 | + $valid_shortcodes, |
|
| 237 | + $this->_extra_data |
|
| 238 | + ); |
|
| 239 | + } |
|
| 240 | + return $dtt_parsed; |
|
| 241 | + } |
|
| 242 | 242 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | $text .= '<span class="drk-grey-text">'; |
| 71 | 71 | $text .= '<span class="dashicons dashicons-calendar"></span>'; |
| 72 | 72 | $text .= $datetime->name(); |
| 73 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
| 73 | + $text .= ' ( '.$datetime->start_date().' )'; |
|
| 74 | 74 | $text .= '</span></h3>'; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -22,57 +22,57 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class DateFilterHeader extends AdminPageHeaderDecorator |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * @var EEM_Datetime $datetime_model |
|
| 27 | - */ |
|
| 28 | - private $datetime_model; |
|
| 25 | + /** |
|
| 26 | + * @var EEM_Datetime $datetime_model |
|
| 27 | + */ |
|
| 28 | + private $datetime_model; |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * DateFilterHeader constructor. |
|
| 33 | - * |
|
| 34 | - * @param RequestInterface $request |
|
| 35 | - * @param EEM_Datetime $datetime_model |
|
| 36 | - */ |
|
| 37 | - public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
| 38 | - { |
|
| 39 | - parent::__construct($request); |
|
| 40 | - $this->datetime_model = $datetime_model; |
|
| 41 | - } |
|
| 31 | + /** |
|
| 32 | + * DateFilterHeader constructor. |
|
| 33 | + * |
|
| 34 | + * @param RequestInterface $request |
|
| 35 | + * @param EEM_Datetime $datetime_model |
|
| 36 | + */ |
|
| 37 | + public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
| 38 | + { |
|
| 39 | + parent::__construct($request); |
|
| 40 | + $this->datetime_model = $datetime_model; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @param string $text |
|
| 46 | - * @return string |
|
| 47 | - * @throws EE_Error |
|
| 48 | - * @throws InvalidDataTypeException |
|
| 49 | - * @throws InvalidInterfaceException |
|
| 50 | - * @throws InvalidArgumentException |
|
| 51 | - * @throws ReflectionException |
|
| 52 | - * @since 4.10.2.p |
|
| 53 | - */ |
|
| 54 | - public function getHeaderText($text = '') |
|
| 55 | - { |
|
| 56 | - $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
| 57 | - $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID, 'int'); |
|
| 58 | - if ($DTT_ID) { |
|
| 59 | - $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
| 60 | - if ($datetime instanceof EE_Datetime && $text !== '') { |
|
| 61 | - // remove the closing h3 heading tag if it exists |
|
| 62 | - $text = str_replace( |
|
| 63 | - '</h3>', |
|
| 64 | - '', |
|
| 65 | - $text |
|
| 66 | - ); |
|
| 67 | - $text .= ' '; |
|
| 68 | - $text .= '<span class="drk-grey-text">'; |
|
| 69 | - $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
| 70 | - $text .= $datetime->name(); |
|
| 71 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
| 72 | - $text .= '</span></h3>'; |
|
| 73 | - } |
|
| 74 | - } |
|
| 44 | + /** |
|
| 45 | + * @param string $text |
|
| 46 | + * @return string |
|
| 47 | + * @throws EE_Error |
|
| 48 | + * @throws InvalidDataTypeException |
|
| 49 | + * @throws InvalidInterfaceException |
|
| 50 | + * @throws InvalidArgumentException |
|
| 51 | + * @throws ReflectionException |
|
| 52 | + * @since 4.10.2.p |
|
| 53 | + */ |
|
| 54 | + public function getHeaderText($text = '') |
|
| 55 | + { |
|
| 56 | + $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
| 57 | + $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID, 'int'); |
|
| 58 | + if ($DTT_ID) { |
|
| 59 | + $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
| 60 | + if ($datetime instanceof EE_Datetime && $text !== '') { |
|
| 61 | + // remove the closing h3 heading tag if it exists |
|
| 62 | + $text = str_replace( |
|
| 63 | + '</h3>', |
|
| 64 | + '', |
|
| 65 | + $text |
|
| 66 | + ); |
|
| 67 | + $text .= ' '; |
|
| 68 | + $text .= '<span class="drk-grey-text">'; |
|
| 69 | + $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
| 70 | + $text .= $datetime->name(); |
|
| 71 | + $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
| 72 | + $text .= '</span></h3>'; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return $text; |
|
| 77 | - } |
|
| 76 | + return $text; |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -59,13 +59,13 @@ |
||
| 59 | 59 | 'event_espresso' |
| 60 | 60 | ), |
| 61 | 61 | '<h3 style="line-height:1.5em;">', |
| 62 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
| 62 | + '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
| 63 | 63 | array( |
| 64 | 64 | 'action' => 'edit_attendee', |
| 65 | 65 | 'post' => $ATT_ID, |
| 66 | 66 | ), |
| 67 | 67 | REG_ADMIN_URL |
| 68 | - ) . '">' . $attendee->full_name() . '</a>', |
|
| 68 | + ).'">'.$attendee->full_name().'</a>', |
|
| 69 | 69 | '</h3>' |
| 70 | 70 | ); |
| 71 | 71 | } |
@@ -19,55 +19,55 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class AttendeeFilterHeader extends AdminPageHeaderDecorator |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var EEM_Attendee $attendee_model |
|
| 24 | - */ |
|
| 25 | - private $attendee_model; |
|
| 22 | + /** |
|
| 23 | + * @var EEM_Attendee $attendee_model |
|
| 24 | + */ |
|
| 25 | + private $attendee_model; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * AttendeeFilterHeader constructor. |
|
| 30 | - * |
|
| 31 | - * @param RequestInterface $request |
|
| 32 | - * @param EEM_Attendee $attendee_model |
|
| 33 | - */ |
|
| 34 | - public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
| 35 | - { |
|
| 36 | - parent::__construct($request); |
|
| 37 | - $this->attendee_model = $attendee_model; |
|
| 38 | - } |
|
| 28 | + /** |
|
| 29 | + * AttendeeFilterHeader constructor. |
|
| 30 | + * |
|
| 31 | + * @param RequestInterface $request |
|
| 32 | + * @param EEM_Attendee $attendee_model |
|
| 33 | + */ |
|
| 34 | + public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
| 35 | + { |
|
| 36 | + parent::__construct($request); |
|
| 37 | + $this->attendee_model = $attendee_model; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @param string $text |
|
| 43 | - * @return string |
|
| 44 | - * @throws EE_Error |
|
| 45 | - * @since 4.10.2.p |
|
| 46 | - */ |
|
| 47 | - public function getHeaderText($text = '') |
|
| 48 | - { |
|
| 49 | - $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
| 50 | - $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID, 'int'); |
|
| 51 | - if ($ATT_ID) { |
|
| 52 | - $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
| 53 | - if ($attendee instanceof EE_Attendee) { |
|
| 54 | - $text .= sprintf( |
|
| 55 | - esc_html__( |
|
| 56 | - '%1$s Viewing registrations for %2$s%3$s', |
|
| 57 | - 'event_espresso' |
|
| 58 | - ), |
|
| 59 | - '<h3 style="line-height:1.5em;">', |
|
| 60 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
| 61 | - array( |
|
| 62 | - 'action' => 'edit_attendee', |
|
| 63 | - 'post' => $ATT_ID, |
|
| 64 | - ), |
|
| 65 | - REG_ADMIN_URL |
|
| 66 | - ) . '">' . $attendee->full_name() . '</a>', |
|
| 67 | - '</h3>' |
|
| 68 | - ); |
|
| 69 | - } |
|
| 70 | - } |
|
| 71 | - return $text; |
|
| 72 | - } |
|
| 41 | + /** |
|
| 42 | + * @param string $text |
|
| 43 | + * @return string |
|
| 44 | + * @throws EE_Error |
|
| 45 | + * @since 4.10.2.p |
|
| 46 | + */ |
|
| 47 | + public function getHeaderText($text = '') |
|
| 48 | + { |
|
| 49 | + $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
| 50 | + $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID, 'int'); |
|
| 51 | + if ($ATT_ID) { |
|
| 52 | + $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
| 53 | + if ($attendee instanceof EE_Attendee) { |
|
| 54 | + $text .= sprintf( |
|
| 55 | + esc_html__( |
|
| 56 | + '%1$s Viewing registrations for %2$s%3$s', |
|
| 57 | + 'event_espresso' |
|
| 58 | + ), |
|
| 59 | + '<h3 style="line-height:1.5em;">', |
|
| 60 | + '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
| 61 | + array( |
|
| 62 | + 'action' => 'edit_attendee', |
|
| 63 | + 'post' => $ATT_ID, |
|
| 64 | + ), |
|
| 65 | + REG_ADMIN_URL |
|
| 66 | + ) . '">' . $attendee->full_name() . '</a>', |
|
| 67 | + '</h3>' |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + return $text; |
|
| 72 | + } |
|
| 73 | 73 | } |