From 7948f09513dbe7faa292b977526e5a244c0b0bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laerte=20Guimar=C3=A3es?= <31661772+laerte-guimaraes@users.noreply.github.com> Date: Thu, 30 Jan 2020 11:53:57 -0300 Subject: [PATCH] =?UTF-8?q?Remove=20exibi=C3=A7=C3=A3o=20dos=20campos=20pa?= =?UTF-8?q?ra=20assinatura=20Vindi=20quando=20o=20WCS=20est=C3=A1=20desabi?= =?UTF-8?q?litado=20(#140)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Exibe/Oulta campos do plano de assinatura Vindi de acordo com o status do Plugin WCS * Versionamento --- CHANGELOG.md | 7 +++++++ readme.txt | 5 ++++- vindi-woocommerce-subscriptions.php | 30 ++++++++++++++++++++--------- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0903be..478e49a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,17 @@ # Notas das versões +## [5.5.3 - 30/01/2020](https://github.com/vindi/vindi-woocommerce-subscriptions/releases/tag/5.5.3) + +### Corrigido +- Remove exibição dos campos para assinatura Vindi quando o Woocommerce Subscriptions não está habilitado + + ## [5.5.2 - 09/01/2020](https://github.com/vindi/vindi-woocommerce-subscriptions/releases/tag/5.5.2) ### Corrigido - Corrige exibição de datas no plugin + ## [5.5.1 - 04/06/2019](https://github.com/vindi/vindi-woocommerce-subscriptions/releases/tag/5.5.1) ### Ajustado diff --git a/readme.txt b/readme.txt index bb8e187..7a15578 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Requires at least: 4.4 Tested up to: 5.2.1 WC requires at least: 3.0.0 WC tested up to: 3.6.4 -Stable Tag: 5.5.2 +Stable Tag: 5.5.3 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -27,6 +27,9 @@ Para dúvidas e suporte técnico, entre em contato com a equipe Vindi através d == Changelog == += 5.5.3 - 30/01/2020 = +- Remove exibição dos campos para assinatura Vindi quando o Woocommerce Subscriptions não está habilitado + = 5.5.2 - 09/01/2020 = - Corrige exibição de datas no plugin diff --git a/vindi-woocommerce-subscriptions.php b/vindi-woocommerce-subscriptions.php index 6103387..99ce3d4 100755 --- a/vindi-woocommerce-subscriptions.php +++ b/vindi-woocommerce-subscriptions.php @@ -3,7 +3,7 @@ * Plugin Name: Vindi Woocommerce * Plugin URI: * Description: Adiciona o gateway de pagamentos da Vindi para o WooCommerce. - * Version: 5.5.2 + * Version: 5.5.3 * Author: Vindi * Author URI: https://www.vindi.com.br * Requires at least: 4.4 @@ -39,7 +39,7 @@ class Vindi_WooCommerce_Subscriptions /** * @var string */ - const VERSION = '5.5.2'; + const VERSION = '5.5.3'; /** * @var string @@ -126,13 +126,7 @@ public function __construct() &$this, 'add_admin_scripts' )); - add_action('woocommerce_product_options_general_product_data', - array(&$this, 'simple_subscription_custom_fields') - ); - - add_action('woocommerce_product_after_variable_attributes', - array(&$this, 'variable_subscription_custom_fields') - , 10, 3); + $this->set_vindi_subscription_fields(); add_action('woocommerce_process_product_meta', array(&$this, 'save_subscription_meta') @@ -151,6 +145,24 @@ public function __construct() } } + /** + * Enable/Disable Vindi subscription fields according to WCS + */ + public function set_vindi_subscription_fields() + { + if ($this->settings->dependency->wc_subscriptions_are_activated()) { + add_action('woocommerce_product_options_general_product_data', + array(&$this, 'simple_subscription_custom_fields')); + add_action('woocommerce_product_after_variable_attributes', + array(&$this, 'variable_subscription_custom_fields'), 10, 3); + } else { + remove_action('woocommerce_product_options_general_product_data', + array(&$this, 'simple_subscription_custom_fields')); + remove_action('woocommerce_product_after_variable_attributes', + array(&$this, 'variable_subscription_custom_fields'), 10, 3); + } + } + /** * Set supported intervals number for subscription plans */