diff --git a/resources/pot/retailcrm-es_ES.pot b/resources/pot/retailcrm-es_ES.pot index e845cea..b2e7d42 100644 --- a/resources/pot/retailcrm-es_ES.pot +++ b/resources/pot/retailcrm-es_ES.pot @@ -31,24 +31,24 @@ msgstr "https://wordpress.org/plugins/woo-retailcrm/" msgid "WooCommerce Simla.com" msgstr "WooCommerce Simla.com" -msgid "This functionality allows to upload orders to Simla.com differentially." -msgstr "Esta función permite la subida selectiva de los pedidos al Simla.com." +msgid "Orders" +msgstr "Pedidos" -msgid "Uploading orders by identifiers." -msgstr "Subida de los pedidos por identificadores." +msgid "Customers" +msgstr "Clientes" -msgid "Enter orders identifiers separated by a comma." -msgstr "Introduce los identificadores de pedidos separados por coma." +msgid "This functionality allows to upload orders to Simla.com differentially" +msgstr "Esta función permite la subida selectiva de los pedidos al Simla.com" + +msgid "Uploading orders by identifiers" +msgstr "Subida de los pedidos por identificadores" + +msgid "Enter orders identifiers separated by a comma, but no more than 50" +msgstr "Introduce los identificadores de pedidos separados por coma, pero no más de 50" msgid "Orders identifiers" msgstr "Los identificadores de pedidos" -msgid "Order identifier" -msgstr "Los identif de pedido" - -msgid "Upload the order by ID" -msgstr "Subir el pedido por ID" - msgid "Orders were uploaded" msgstr "Los pedidos están subidos" @@ -70,8 +70,8 @@ msgstr "Introduce el enlace del Simla.com correcto" msgid "The selected API version is unavailable" msgstr "La versión de API elegida no está disponible" -msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com." -msgstr "Esta función permite generar los catálogos de pedidos ICML para subida al Simla.com." +msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com" +msgstr "Esta función permite generar los catálogos de pedidos ICML para subida al Simla.com" msgid "Generating ICML" msgstr "Generando ICML" @@ -86,7 +86,7 @@ msgid "Settings" msgstr "Ajustes" msgid "Uploading the existing customers and orders to Simla.com" -msgstr "Subida de los clientes existentes y pedidos al Simla.com." +msgstr "Subida de los clientes existentes y pedidos al Simla.com" msgid "Uploading all customers and orders" msgstr "Subir todos los clientes y pedidos" @@ -104,7 +104,7 @@ msgid "UA tracking code" msgstr "El código de seguimiento UA" msgid "Enable this setting for uploading data to UA" -msgstr "Activa esta opción para subir los datos al UA." +msgstr "Activa esta opción para subir los datos al UA" msgid "UA" msgstr "UA" @@ -115,8 +115,8 @@ msgstr "Activar UA" msgid "UA settings" msgstr "Ajustes de UA" -msgid "Enable this setting if you would like to get information on leftover stocks from Simla.com to the website." -msgstr "Active esta opción si quiere recibir la información del stock de los productos desde Simla.com a la página web." +msgid "Enable this setting if you would like to get information on leftover stocks from Simla.com to the website" +msgstr "Active esta opción si quiere recibir la información del stock de los productos desde Simla.com a la página web" msgid "Stock balance" msgstr "El stock" @@ -166,11 +166,11 @@ msgstr "Ajustes de API" msgid "Enter your API key. You can find it in the administration section of Simla.com" msgstr "Introduce la llave API. Puede encontrarla en apartado administrativo del Simla.com" -msgid "Enter with your API URL (https://yourdomain.simla.com)." -msgstr "Introduce enlace de API (https://yourdomain.simla.com)." +msgid "Enter API of URL (https://yourdomain.simla.com)" +msgstr "Introduce enlace de API (https://yourdomain.simla.com)" -msgid "Integration with Simla.com management system." -msgstr "La integración con el sistema de gestión del Simla.com ." +msgid "Integration with Simla.com management system" +msgstr "La integración con el sistema de gestión del Simla.com" msgid "Every 15 minutes" msgstr "Cada 15 minutos" @@ -259,8 +259,8 @@ msgstr "Se abrirá una ventana de chat con este contacto en WhatsApp" msgid "Introduce the correct phone number" msgstr "Introduce el número de teléfono correcto" -msgid "You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open." -msgstr "Presionando el botón «Exportar» puedes descargar a todos los pedidos y clientes de CMS a Simla.com. Este proceso puede llevar mucho tiempo y es necesario mantener abierta la pestaña hasta que termine el proceso." +msgid "You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open" +msgstr "Presionando el botón «Exportar» puedes descargar a todos los pedidos y clientes de CMS a Simla.com. Este proceso puede llevar mucho tiempo y es necesario mantener abierta la pestaña hasta que termine el proceso" msgid "Debug information" msgstr "Información Debug" diff --git a/resources/pot/retailcrm-ru_RU.pot b/resources/pot/retailcrm-ru_RU.pot index bb47344..2c4e3f7 100644 --- a/resources/pot/retailcrm-ru_RU.pot +++ b/resources/pot/retailcrm-ru_RU.pot @@ -31,6 +31,12 @@ msgstr "https://wordpress.org/plugins/woo-retailcrm/" msgid "WooCommerce Simla.com" msgstr "WooCommerce Simla.com" +msgid "Orders" +msgstr "Заказы" + +msgid "Customers" +msgstr "Клиенты" + msgid "Activate history uploads" msgstr "Активировать загрузку истории изменений" @@ -40,24 +46,18 @@ msgstr "Загрузка данных из Simla.com" msgid "Generating ICML catalog by wp-cron" msgstr "Генерация ICML каталога товаров с помощью wp-cron" -msgid "This functionality allows to upload orders to Simla.com differentially." +msgid "This functionality allows to upload orders to Simla.com differentially" msgstr "Эта функция позволяет производить выборочную выгрузку заказов в Simla.com" -msgid "Uploading orders by identifiers." +msgid "Uploading orders by identifiers" msgstr "Выгрузка заказов по идентификаторам" -msgid "Enter orders identifiers separated by a comma." -msgstr "Введите идентификаторы заказов через запятую" +msgid "Enter orders identifiers separated by a comma, but no more than 50" +msgstr "Введите идентификаторы заказов через запятую, но не более 50" msgid "Orders identifiers" msgstr "Идентификаторы заказов" -msgid "Order identifier" -msgstr "Идентификатор заказа" - -msgid "Upload the order by ID" -msgstr "Выгрузить заказ по идентификатору" - msgid "Orders were uploaded" msgstr "Заказы были выгружены" @@ -79,7 +79,7 @@ msgstr "Введите корректный адрес Simla.com" msgid "The selected API version is unavailable" msgstr "Выбранная версия API недоступна" -msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com." +msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com" msgstr "Эта функция позволяет сгенерировать ICML каталог товаров для выгрузки в Simla.com" msgid "Generating ICML" @@ -124,8 +124,8 @@ msgstr "Активировать UA" msgid "UA settings" msgstr "Настройки UA" -msgid "Enable this setting if you would like to get information on leftover stocks from Simla.com to the website." -msgstr "Активируйте данную настройку, если хотите получать остатки по товарам из Simla.com на сайт." +msgid "Enable this setting if you would like to get information on leftover stocks from Simla.com to the website" +msgstr "Активируйте данную настройку, если хотите получать остатки по товарам из Simla.com на сайт" msgid "Stock balance" msgstr "Остатки" @@ -173,12 +173,12 @@ msgid "API settings" msgstr "Настройки API" msgid "Enter your API key. You can find it in the administration section of Simla.com" -msgstr "Введите API ключ. Вы можете найти его в административном разделе Simla.com." +msgstr "Введите API ключ. Вы можете найти его в административном разделе Simla.com" -msgid "Enter API of URL (https://yourdomain.simla.com)." -msgstr "Введите API URL (https://yourdomain.simla.com)." +msgid "Enter API of URL (https://yourdomain.simla.com)" +msgstr "Введите API URL (https://yourdomain.simla.com)" -msgid "Integration with Simla.com management system." +msgid "Integration with Simla.com management system" msgstr "Интеграция с системой управления Simla.com" msgid "Every 15 minutes" @@ -268,8 +268,8 @@ msgstr "Будет открыт чат в WhatsApp с данным контак msgid "Introduce the correct phone number" msgstr "Введите корректный номер телефона" -msgid "You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open." -msgstr "Вы можете экспортировать все заказы и клиентов из CMS в Simla.com, нажав кнопку «Выгрузить». Этот процесс может занять много времени, и до его завершения необходимо держать вкладку открытой." +msgid "You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open" +msgstr "Вы можете экспортировать все заказы и клиентов из CMS в Simla.com, нажав кнопку «Выгрузить». Этот процесс может занять много времени, и до его завершения необходимо держать вкладку открытой" msgid "Debug information" msgstr "Отладочная информация" diff --git a/src/assets/css/progress-bar.css b/src/assets/css/progress-bar.css index 7cdc528..5b05629 100644 --- a/src/assets/css/progress-bar.css +++ b/src/assets/css/progress-bar.css @@ -10,7 +10,7 @@ .retail-progress__loader { width: 0; border-radius: 18px; - background: #6427D6; + background: #4169e1; color: white; text-align: center; padding: 0 30px; @@ -28,6 +28,6 @@ .retail-count-data-upload { margin-bottom: 20px; size: 30px; - color: #6427D6; + color: #4169e1; font-weight: bold; -} +} \ No newline at end of file diff --git a/src/assets/css/progress-bar.min.css b/src/assets/css/progress-bar.min.css index dfd9da6..b8539e1 100644 --- a/src/assets/css/progress-bar.min.css +++ b/src/assets/css/progress-bar.min.css @@ -1 +1 @@ -.retail-progress{border-radius:18px;border:1px solid rgba(122,122,122,0.15);width:400px;height:18px;overflow:hidden;transition:height .25s ease}.retail-progress__loader{width:0;border-radius:18px;background:#6427D6;color:#fff;text-align:center;padding:0 30px;font-size:18px;font-weight:600;transition:width .4s ease-in;line-height:18px;box-sizing:border-box}.retail-hidden{display:none!important}.retail-count-data-upload{margin-bottom:20px;size:30px;color:#6427D6;font-weight:700} \ No newline at end of file +.retail-progress{border-radius:18px;border:1px solid rgba(122,122,122,.15);width:400px;height:18px;overflow:hidden;transition:height .25s ease}.retail-progress__loader{width:0;border-radius:18px;background:#4169e1;color:#fff;text-align:center;padding:0 30px;font-size:18px;font-weight:600;transition:width .4s ease-in;line-height:18px;box-sizing:border-box}.retail-hidden{display:none!important}.retail-count-data-upload{margin-bottom:20px;size:30px;color:#4169e1;font-weight:700} \ No newline at end of file diff --git a/src/assets/js/retailcrm-export.js b/src/assets/js/retailcrm-export.js index 15e2156..31d856d 100644 --- a/src/assets/js/retailcrm-export.js +++ b/src/assets/js/retailcrm-export.js @@ -2,6 +2,7 @@ jQuery(function () { function RetailcrmExportForm() { this.submitButton = jQuery('button[id="export-orders-submit"]').get(0); + this.selectedOrdersButton = jQuery('button[id="export_selected_orders_btn"]').get(0); jQuery(this.submitButton).after('
@@ -27,7 +27,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration { $this->id = 'integration-retailcrm'; $this->method_title = __('Simla.com', 'retailcrm'); - $this->method_description = __('Integration with Simla.com management system.', 'retailcrm'); + $this->method_description = __('Integration with Simla.com management system', 'retailcrm'); static::$option_key = $this->get_option_key(); @@ -38,7 +38,6 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration } } - /** * @codeCoverageIgnore */ @@ -61,34 +60,6 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration plugin_id . $this->id . '_single_order'; - ?> - - array( 'title' => __( 'API of URL', 'retailcrm' ), 'type' => 'text', - 'description' => __( 'Enter API of URL (https://yourdomain.simla.com).', 'retailcrm' ), + 'description' => __( 'Enter API of URL (https://yourdomain.simla.com)', 'retailcrm' ), 'desc_tip' => true, 'default' => '' ), @@ -326,7 +297,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'title' => __('Stock balance', 'retailcrm'), 'class' => 'checkbox', 'type' => 'checkbox', - 'description' => __('Enable this setting if you would like to get information on leftover stocks from Simla.com to the website.', 'retailcrm') + 'description' => __('Enable this setting if you would like to get information on leftover stocks from Simla.com to the website', 'retailcrm') ); /** @@ -397,11 +368,29 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'label' => __('Upload', 'retailcrm'), 'title' => __('Uploading all customers and orders', 'retailcrm'), 'type' => 'button', - 'description' => __('You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open.', 'retailcrm'), + 'description' => __('You can export all orders and customers from CMS to Simla.com by clicking the «Upload» button. This process can take much time and before it is completed, you need to keep the tab open', 'retailcrm'), 'desc_tip' => true, 'id' => 'export-orders-submit' ); + $this->form_fields['export_selected_orders_ids'] = array( + 'label' => __('Orders identifiers', 'retailcrm'), + 'title' => __('Orders identifiers', 'retailcrm'), + 'type' => 'text', + 'description' => __('Enter orders identifiers separated by a comma, but no more than 50', 'retailcrm'), + 'desc_tip' => true, + 'id' => 'export_selected_orders_ids' + ); + + $this->form_fields['export_selected_orders_btn'] = array( + 'label' => __('Upload', 'retailcrm'), + 'title' => __('Uploading orders by identifiers', 'retailcrm'), + 'type' => 'button', + 'description' => __('This functionality allows to upload orders to Simla.com differentially', 'retailcrm'), + 'desc_tip' => true, + 'id' => 'export_selected_orders_btn' + ); + /** * WhatsApp options */ @@ -449,7 +438,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'label' => __('Generate now', 'retailcrm'), 'title' => __('Generating ICML', 'retailcrm'), 'type' => 'button', - 'description' => __('This functionality allows to generate ICML products catalog for uploading to Simla.com.', 'retailcrm'), + 'description' => __('This functionality allows to generate ICML products catalog for uploading to Simla.com', 'retailcrm'), 'desc_tip' => true, 'id' => 'icml-retailcrm' ); @@ -461,32 +450,6 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'type' => 'checkbox' ); - /** - * Upload single order - */ - $this->form_field[] = array( - 'title' => __('Upload the order by ID', 'retailcrm'), - 'type' => 'title', - 'description' => '', - 'id' => 'order_options' - ); - - $this->form_fields['single_order'] = array( - 'label' => __('Order identifier', 'retailcrm'), - 'title' => __('Orders identifiers', 'retailcrm'), - 'type' => 'input', - 'description' => __('Enter orders identifiers separated by a comma.', 'retailcrm'), - 'desc_tip' => true - ); - - $this->form_fields[] = array( - 'label' => __('Upload', 'retailcrm'), - 'title' => __('Uploading orders by identifiers.', 'retailcrm'), - 'type' => 'button', - 'description' => __('This functionality allows to upload orders to CRM differentially.', 'retailcrm'), - 'desc_tip' => true, - 'id' => 'single_order_btn' - ); $this->form_fields['history'] = array( 'label' => __('Activate history uploads', 'retailcrm'), diff --git a/src/include/class-wc-retailcrm-base.php b/src/include/class-wc-retailcrm-base.php index 90fcef1..19b4f0b 100644 --- a/src/include/class-wc-retailcrm-base.php +++ b/src/include/class-wc-retailcrm-base.php @@ -79,7 +79,7 @@ if (!class_exists('WC_Retailcrm_Base')) { add_action('wp_ajax_cron_info', array($this, 'get_cron_info'), 99); add_action('wp_ajax_content_upload', array($this, 'count_upload_data'), 99); add_action('wp_ajax_generate_icml', array($this, 'generate_icml')); - add_action('wp_ajax_order_upload', array($this, 'order_upload')); + add_action('wp_ajax_upload_selected_orders', array($this, 'upload_selected_orders')); add_action('admin_print_footer_scripts', array($this, 'ajax_generate_icml'), 99); add_action('admin_print_footer_scripts', array($this, 'ajax_selected_order'), 99); add_action('woocommerce_created_customer', array($this, 'create_customer'), 10, 1); @@ -241,7 +241,7 @@ if (!class_exists('WC_Retailcrm_Base')) { * * @return void */ - public function order_upload() + public function upload_selected_orders() { $this->uploader->uploadSelectedOrders(); } @@ -523,10 +523,18 @@ if (!class_exists('WC_Retailcrm_Base')) { */ public function count_upload_data() { + $translate = array( + 'tr_order' => __('Orders', 'retailcrm'), + 'tr_customer' => __('Customers', 'retailcrm'), + 'tr_empty_field' => __('The field cannot be empty, enter the order ID', 'retailcrm'), + 'tr_successful' => __('Orders were uploaded', 'retailcrm'), + ); + echo json_encode( array( 'count_orders' => $this->uploader->getCountOrders(), - 'count_users' => $this->uploader->getCountUsers() + 'count_users' => $this->uploader->getCountUsers(), + 'translate' => $translate, ) ); diff --git a/src/include/class-wc-retailcrm-uploader.php b/src/include/class-wc-retailcrm-uploader.php index cdf25ca..a8611f8 100644 --- a/src/include/class-wc-retailcrm-uploader.php +++ b/src/include/class-wc-retailcrm-uploader.php @@ -59,12 +59,10 @@ if (class_exists('WC_Retailcrm_Uploader') === false) { */ public function uploadSelectedOrders() { - $response = filter_input(INPUT_GET, 'order_ids_retailcrm'); - - if (false === empty($response)) { - $ids = array_unique(explode(',', $response)); - - if (false === empty($ids)) { + if (!empty($_GET['order_ids_retailcrm'])) { + $ids = array_unique(explode(',', $_GET['order_ids_retailcrm'])); + + if (!empty($ids)) { $this->uploadArchiveOrders(0, $ids); } } @@ -76,7 +74,7 @@ if (class_exists('WC_Retailcrm_Uploader') === false) { * @param int $page Number page uploads. * @param array $ids Ids orders upload. * - * @return array|null + * @return void|null * @throws Exception Invalid argument exception. */ public function uploadArchiveOrders($page, $ids = array()) @@ -101,8 +99,6 @@ if (class_exists('WC_Retailcrm_Uploader') === false) { } $this->logOrdersUploadErrors($uploadErrors); - - return array(); } /** diff --git a/src/languages/retailcrm-es_ES.mo b/src/languages/retailcrm-es_ES.mo index 192eaa7..88c78be 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 84ba1a6..dff5094 100644 Binary files a/src/languages/retailcrm-ru_RU.mo and b/src/languages/retailcrm-ru_RU.mo differ diff --git a/tests/test-wc-retailcrm-base.php b/tests/test-wc-retailcrm-base.php index 35a63ea..e5fb277 100644 --- a/tests/test-wc-retailcrm-base.php +++ b/tests/test-wc-retailcrm-base.php @@ -80,7 +80,8 @@ class WC_Retailcrm_Base_Test extends WC_Retailcrm_Test_Case_Helper $this->assertArrayHasKey('whatsapp_location_icon', $this->baseRetailcrm->form_fields); $this->assertArrayHasKey('whatsapp_number', $this->baseRetailcrm->form_fields); $this->assertArrayHasKey('icml', $this->baseRetailcrm->form_fields); - $this->assertArrayHasKey('single_order', $this->baseRetailcrm->form_fields); + $this->assertArrayHasKey('export_selected_orders_ids', $this->baseRetailcrm->form_fields); + $this->assertArrayHasKey('export_selected_orders_btn', $this->baseRetailcrm->form_fields); $this->assertArrayHasKey('history', $this->baseRetailcrm->form_fields); $this->assertArrayHasKey('deactivate_update_order', $this->baseRetailcrm->form_fields); $this->assertArrayHasKey('bind_by_sku', $this->baseRetailcrm->form_fields); diff --git a/tests/test-wc-retailcrm-uploader.php b/tests/test-wc-retailcrm-uploader.php index 782d3d1..0b14a44 100644 --- a/tests/test-wc-retailcrm-uploader.php +++ b/tests/test-wc-retailcrm-uploader.php @@ -78,11 +78,20 @@ class WC_Retailcrm_Uploader_Test extends WC_Retailcrm_Test_Case_Helper $retailcrm_uploader = $this->getRetailcrmUploader($retailcrm); $data = $retailcrm_uploader->uploadArchiveOrders(0); - if ($retailcrm) { - $this->assertInternalType('array', $data); - } else { - $this->assertEquals(null, $data); - } + $this->assertEquals(null, $data); + } + + /** + * @param $retailcrm + * @dataProvider dataProviderApiClient + */ + public function test_upload_selected_orders() + { + $_GET['order_ids_retailcrm'] = '123, 345, 456'; + $retailcrm_uploader = $this->getRetailcrmUploader($this->apiMock); + $uploadSelectedOrders = $retailcrm_uploader->uploadSelectedOrders(); + + $this->assertEquals(null, $uploadSelectedOrders); } public function test_get_count_orders_upload()