From 0517a2f24a105969d804f421721d1a9b793e2079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=C3=ADna=20Vysko=C4=8Dilov=C3=A1?= Date: Mon, 15 Jan 2024 16:02:23 +0100 Subject: [PATCH] support for packing slips (#69) --- ...ices-and-packing-slips-for-woocommerce.php | 44 +++++++++++++++++++ readme.txt | 9 +++- woolab-ic-dic.php | 5 ++- 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 includes/compatibility/pdf-invoices-and-packing-slips-for-woocommerce.php diff --git a/includes/compatibility/pdf-invoices-and-packing-slips-for-woocommerce.php b/includes/compatibility/pdf-invoices-and-packing-slips-for-woocommerce.php new file mode 100644 index 0000000..8d6f638 --- /dev/null +++ b/includes/compatibility/pdf-invoices-and-packing-slips-for-woocommerce.php @@ -0,0 +1,44 @@ +" if there is no phone number in the order, otherwise no "
" is added. + $order = wc_get_order($order_id); + + $phone = $order->get_billing_phone(); + $dic = $order->get_meta('_billing_dic'); + $ic = $order->get_meta('_billing_ic'); + $ic_dph = $order->get_meta('_billing_dic_dph'); + + if ($phone) { + $html .= '
'; + } + + if ($ic) { + $html .= __('Business ID', 'woolab-ic-dic') . ': ' . $ic . '
'; + } + if ($dic) { + $html .= __('Tax ID', 'woolab-ic-dic') . ': ' . $dic . '
'; + } + if ($ic_dph) { + $html .= __('VAT reg. no.', 'woolab-ic-dic') . ': ' . $ic_dph . '
'; + } + + // Remove the last
to keep the same look. + $html = preg_replace('/$/', '', $html); + + return $html; +} +add_filter('apifw_ps_custom_billing_fields', 'woolab_icdic_apifw_ps_custom_billing_fields', 10, 2); \ No newline at end of file diff --git a/readme.txt b/readme.txt index af7adce..b246a66 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: vyskoczilova Tags: woocommerce, DIČ, IČO, IČ, IČ DPH, česky, česká, české, cz, Czech, zobrazení, úprava, VAT, number, Company, identification, tax, eshop, e-shop, ecommerce, e-commerce, commerce, woothemes, wordpress woocommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, additional, fields, variable, download, downloadable, digital, inventory, fakturační, billing, shipping, adresa, address, woo commerce, order, objednávka, admin, backend Requires at least: 4.6 Tested up to: 6.4 -Stable tag: 1.8.1 +Stable tag: 1.8.2 Requires PHP: 7.3 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -37,7 +37,8 @@ Supports both PHP 7.3+ & PHP 8.0+. === Compatibility === * [Kybernaut Mailstep](https://kybernaut.cz/pluginy/kybernaut-mailstep/) * [WooCommerce SuperFaktura](https://wordpress.org/plugins/woocommerce-superfaktura/) -* [WooCommerce PDF Invoices & Packing Slips](https://cs.wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/) +* [WooCommerce PDF Invoices & Packing Slips for WooCommerce](https://cs.wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/) by WP Overnight +* [WooCommerce PDF Invoices and Packing Slips for WooCommerce](https://wordpress.org/plugins/pdf-invoices-and-packing-slips-for-woocommerce/) by Acowebs * [WooCommerce Sequential Order Numbers](https://cs.wordpress.org/plugins/woocommerce-sequential-order-numbers/) * [Woo Checkout Field Editor Pro](https://cs.wordpress.org/plugins/woo-checkout-field-editor-pro/) * [Fluid Checkout for WooCommerce - Lite](https://wordpress.org/plugins/fluid-checkout/) @@ -129,6 +130,10 @@ Either post it on [GitHub](https://github.com/vyskoczilova/kybernaut-ic-dic) or == Changelog == += 1.8.2 (2024-01-09) = + +* Feature: added support for [WooCommerce PDF Invoices and Packing Slips for WooCommerce](https://wordpress.org/plugins/pdf-invoices-and-packing-slips-for-woocommerce/) by Acowebs (sponsored by [tuningmotocyklov.sk](https://www.tuningmotocyklov.sk)) + = 1.8.1 (2024-01-05) = * Fix: Bump minimum PHP compatibility to 7.3 (will be increased soon to 8.0). diff --git a/woolab-ic-dic.php b/woolab-ic-dic.php index 8e90581..2321281 100644 --- a/woolab-ic-dic.php +++ b/woolab-ic-dic.php @@ -3,7 +3,7 @@ Plugin Name: Kybernaut IC DIC Plugin URI: https://kybernaut.cz/pluginy/kybernaut-ic-dic Description: Adds Czech Company & VAT numbers (IČO & DIČ) to WooCommerce billing fields and verifies if data are correct. - Version: 1.8.2-alfa + Version: 1.8.2 Author: Karolína Vyskočilová Author URI: https://kybernaut.cz Text Domain: woolab-ic-dic @@ -33,7 +33,7 @@ define( 'WOOLAB_IC_DIC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'WOOLAB_IC_DIC_ABSPATH', dirname( __FILE__ ) . '/' ); define( 'WOOLAB_IC_DIC_URL', plugin_dir_url( __FILE__ ) ); -define( 'WOOLAB_IC_DIC_VERSION', '1.8.2-alfa' ); +define( 'WOOLAB_IC_DIC_VERSION', '1.8.2' ); // Check if WooCommerce active function woolab_icdic_init() { @@ -81,6 +81,7 @@ function woolab_icdic_plugin_admin_notice() { include_once( WOOLAB_IC_DIC_ABSPATH . 'includes/settings.php'); // Compatibility include_once( WOOLAB_IC_DIC_ABSPATH . 'includes/compatibility/superfaktura.php'); + include_once( WOOLAB_IC_DIC_ABSPATH . 'includes/compatibility/pdf-invoices-and-packing-slips-for-woocommerce.php'); // include_once( WOOLAB_IC_DIC_ABSPATH . 'includes/compatibility/fluidcheckout.php'); don't apply globally. add_filter( 'woocommerce_billing_fields' , 'woolab_icdic_billing_fields', 10, 2 );