diff --git a/resources/pot/retailcrm-es_ES.pot b/resources/pot/retailcrm-es_ES.pot index 9def175..243f9d5 100644 --- a/resources/pot/retailcrm-es_ES.pot +++ b/resources/pot/retailcrm-es_ES.pot @@ -276,3 +276,13 @@ msgstr "Presionando el botón «Exportar» puedes descargar a todos los pedidos msgid "Debug information" msgstr "Información Debug" + +msgid "Debug mode" +msgstr "Modo de depuración" + +msgid "Enable debug mode in module" +msgstr "Activar el modo de depuración en el módulo" + +msgid "Is required to enable debug mode for advanced logs" +msgstr "Se requiere el modo de depuración para habilitar el registro avanzado de logs" + diff --git a/resources/pot/retailcrm-ru_RU.pot b/resources/pot/retailcrm-ru_RU.pot index db5fc0b..d7708ed 100644 --- a/resources/pot/retailcrm-ru_RU.pot +++ b/resources/pot/retailcrm-ru_RU.pot @@ -286,5 +286,14 @@ msgstr "Вы можете экспортировать все заказы и к msgid "Debug information" msgstr "Отладочная информация" +msgid "Debug mode" +msgstr "Режим отладки" + +msgid "Enable debug mode in module" +msgstr "Активировать режим отладки в модуле" + +msgid "Is required to enable debug mode for advanced logs" +msgstr "Требуется включить режим отладки для расширенного логирования" + diff --git a/src/assets/js/retailcrm-cron-info.js b/src/assets/js/retailcrm-cron-info.js index e13189f..44d10d0 100644 --- a/src/assets/js/retailcrm-cron-info.js +++ b/src/assets/js/retailcrm-cron-info.js @@ -1,7 +1,7 @@ jQuery(function () { function RetailcrmCronInfo() { - this.title = jQuery('h2[id="woocommerce_integration-retailcrm_16"]').get(0); + this.title = jQuery('.debug_info_options').get(0) if (typeof this.title === 'undefined') { return false; diff --git a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php index 05dc1a0..ac71d42 100644 --- a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php +++ b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php @@ -533,14 +533,21 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'type' => 'checkbox' ); + $this->form_fields['debug_mode'] = array( + 'label' => __('Enable debug mode in module', 'retailcrm'), + 'title' => __('Debug mode', 'retailcrm'), + 'description' => __('Is required to enable debug mode for advanced logs', 'retailcrm'), + 'class' => 'checkbox', + 'type' => 'checkbox' + ); + /** * Debug information */ $this->form_fields[] = array( 'title' => __('Debug information', 'retailcrm'), 'type' => 'heading', - 'description' => '', - 'id' => 'cron_info_options' + 'class' => 'debug_info_options' ); } } @@ -760,6 +767,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'title' => __('Simla.com', 'retailcrm') ) ); + $wp_admin_bar->add_menu( array( 'id' => 'retailcrm_ajax_generate_icml', @@ -769,6 +777,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'class' => 'retailcrm_ajax_generate_icml' ) ); + $wp_admin_bar->add_menu( array( 'id' => 'retailcrm_ajax_generate_setings', diff --git a/src/include/class-wc-retailcrm-base.php b/src/include/class-wc-retailcrm-base.php index d409db6..c24f9c1 100644 --- a/src/include/class-wc-retailcrm-base.php +++ b/src/include/class-wc-retailcrm-base.php @@ -118,6 +118,7 @@ if (!class_exists('WC_Retailcrm_Base')) { add_action('retailcrm_deactivate', array($this, 'deactivate')); } + /** * Init settings fields */ @@ -127,6 +128,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $this->init_settings(); } + /** * @param $settings * @@ -165,6 +167,7 @@ if (!class_exists('WC_Retailcrm_Base')) { return $settings; } + public function generate_icml() { /* @@ -219,6 +222,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $retailcrm_history->getHistory(); } + /** * @param int $order_id */ @@ -227,6 +231,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $this->orders->orderCreate($order_id); } + /** * Load stock from retailCRM */ @@ -236,6 +241,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $inventories->updateQuantity(); } + /** * Upload selected orders * @@ -246,6 +252,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $this->uploader->uploadSelectedOrders(); } + /** * Upload archive customers and order to retailCRM */ @@ -261,6 +268,7 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** * Create customer in retailCRM * @@ -322,6 +330,7 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** * Edit customer in retailCRM * @param int $customer_id @@ -339,6 +348,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $this->customers->updateCustomer($customer_id); } + /** * Create order in retailCRM from admin panel * @@ -351,6 +361,7 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** * Edit order in retailCRM * @@ -367,6 +378,7 @@ if (!class_exists('WC_Retailcrm_Base')) { $this->orders->updateOrder($order_id); } + /** * Init google analytics code */ @@ -380,6 +392,7 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** * Google analytics send code */ @@ -393,6 +406,7 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** * Daemon collector */ @@ -406,6 +420,7 @@ if (!class_exists('WC_Retailcrm_Base')) { } } + /** * Initialize online consultant */ @@ -560,6 +575,7 @@ if (!class_exists('WC_Retailcrm_Base')) { return false; } + /** * Deactivate module in marketplace retailCRM * @@ -574,6 +590,7 @@ if (!class_exists('WC_Retailcrm_Base')) { delete_option('retailcrm_active_in_crm'); } + /** * @param $settings * diff --git a/src/include/functions.php b/src/include/functions.php index 21e6495..4127c60 100644 --- a/src/include/functions.php +++ b/src/include/functions.php @@ -105,8 +105,12 @@ function retailcrm_get_wc_product($id, $settings) { * @return bool */ function retailcrm_is_debug() { - return (defined('WP_DEBUG') && WP_DEBUG == true) - || (defined('RCRM_DEBUG') && RCRM_DEBUG == true); + + $options = get_option(WC_Retailcrm_Base::$option_key); + + if (isset($options['debug_mode']) === true && $options['debug_mode'] === WC_Retailcrm_Base::YES) { + return true; + } } /** diff --git a/src/languages/retailcrm-es_ES.mo b/src/languages/retailcrm-es_ES.mo index ddc6e38..0eeef13 100644 Binary files a/src/languages/retailcrm-es_ES.mo and b/src/languages/retailcrm-es_ES.mo differ diff --git a/src/languages/retailcrm-ru_RU.mo b/src/languages/retailcrm-ru_RU.mo index 83db6ec..bd19454 100644 Binary files a/src/languages/retailcrm-ru_RU.mo and b/src/languages/retailcrm-ru_RU.mo differ