From 97a596b22c2256ad5a1e7c7dacda001759aa16eb Mon Sep 17 00:00:00 2001 From: Saul Morales Date: Mon, 7 Oct 2024 09:49:20 -0500 Subject: [PATCH] Fixed spaces field dni Added filter wc_siigo_integration_country_code --- includes/class-integration-siigo-wc.php | 6 +++++- integration-siigo-woo.php | 4 ++-- readme.txt | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/class-integration-siigo-wc.php b/includes/class-integration-siigo-wc.php index f76be65..490a93f 100644 --- a/includes/class-integration-siigo-wc.php +++ b/includes/class-integration-siigo-wc.php @@ -214,7 +214,10 @@ public static function generate_invoice($order_id, $previous_status, $next_statu $type_document = $billing_type_document ?: $shipping_type_document ? : $classic_type_document; $dni = $billing_dni ?: $shipping_dni ?: $classic_dni; + $dni = trim($dni); + $country_code = $order->get_billing_country() ?: $order->get_shipping_country(); + $country_code = apply_filters('wc_siigo_integration_country_code', $country_code); $state = $order->get_billing_state() ?: $order->get_shipping_state(); $city = $order->get_billing_city() ?: $order->get_shipping_city(); $states_dane = include(dirname(__FILE__) . '/states-dane.php'); @@ -225,6 +228,7 @@ public static function generate_invoice($order_id, $previous_status, $next_statu $address = $order->get_billing_address_1() ?: $order->get_shipping_address_1(); $address = apply_filters('wc_siigo_integration_address', $address); + if(!$country_code) throw new Exception('País no encontrado'); if(!$state_code) throw new Exception('Departamento no encontrado'); if(!$city_code) throw new Exception('Ciudad no encontrada'); @@ -262,7 +266,7 @@ public static function generate_invoice($order_id, $previous_status, $next_statu "address" => [ "address" => $address, "city" => [ - "country_code" => $order->get_billing_country() ?: $order->get_shipping_country(), + "country_code" => $country_code, "state_code" => $state_code, "city_code" => $city_code ], diff --git a/integration-siigo-woo.php b/integration-siigo-woo.php index 507d57d..d9e4cee 100644 --- a/integration-siigo-woo.php +++ b/integration-siigo-woo.php @@ -2,7 +2,7 @@ /** * Plugin Name: Integration Siigo Woocommerce * Description: Integración del sistama contable y de facturación Siigo para Woocoommerce - * Version: 0.0.16 + * Version: 0.0.17 * Author: Saul Morales Pacheco * Author URI: https://saulmoralespa.com * License: GNU General Public License v3.0 @@ -17,7 +17,7 @@ } if(!defined('INTEGRATION_SIIGO_WC_SMP_VERSION')){ - define('INTEGRATION_SIIGO_WC_SMP_VERSION', '0.0.16'); + define('INTEGRATION_SIIGO_WC_SMP_VERSION', '0.0.17'); } add_action( 'plugins_loaded', 'integration_siigo_wc_smp_init'); diff --git a/readme.txt b/readme.txt index fd2af10..942fdaf 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: commerce, e-commerce, commerce, WordPress ecommerce, store, sales, sell, s Requires at least: 6.0 Tested up to: 6.6.1 Requires PHP: 8.1 -Stable tag: 0.0.16 +Stable tag: 0.0.17 License: GNU General Public License v3.0 License URI: https://www.gnu.org/licenses/gpl-3.0.html