Skip to content

Commit

Permalink
Merge pull request #24 from LinkNacional/dev
Browse files Browse the repository at this point in the history
1.1.4 - corrigir erro na listagem de faturas quando pedido referente a fatura não existe
  • Loading branch information
brunoferreiralkn authored Jun 7, 2023
2 parents 52a15f5 + 7945f3c commit adb6047
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v1.1.4 - 07/06/23
- Fix invoices table error when the invoice order is deleted.

### v1.1.3
- Payment methods bug correction;

Expand Down
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.linknacional.com/wordpress/plugins/
Tags: woocommerce, invoice, payment
Requires at least: 5.7
Tested up to: 6.1
Stable tag: 1.1.3
Stable tag: 1.1.4
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -64,6 +64,9 @@ The Invoice Payment for WooCommerce plugin is now live and working.

== Changelog ==

= 1.1.4 =
* Fix invoices table error when the invoice order is deleted.

= 1.1.3 =
* Payment methods bug correction;

Expand Down
15 changes: 15 additions & 0 deletions admin/class-wc-invoice-payment-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,21 @@ public function prepare_items() {
$search_term = isset($_POST['s']) ? sanitize_text_field($_POST['s']) : '';
$invoiceList = get_option('lkn_wcip_invoices', []);

// Deletes invoices that have no order.
$invoicesWithExistingOrder = array_filter(
$invoiceList,
function ($invoiceId): bool {
$orderExists = wc_get_order($invoiceId) !== false;

return $orderExists;
}
);

if (count($invoiceList) !== count($invoicesWithExistingOrder)) {
$invoiceList = $invoicesWithExistingOrder;
update_option('lkn_wcip_invoices', $invoiceList);
}

$per_page = 10;
$current_page = $this->get_pagenum();
$total_items = count($invoiceList);
Expand Down
4 changes: 2 additions & 2 deletions wc-invoice-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: Invoice Payment for WooCommerce
* Plugin URI: https://www.linknacional.com/wordpress/plugins/
* Description: Invoice payment generation and management for WooCommerce.
* Version: 1.1.3
* Version: 1.1.4
* Author: Link Nacional
* Author URI: https://www.linknacional.com/
* License: GPL-2.0+
Expand All @@ -34,7 +34,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define('WC_PAYMENT_INVOICE_VERSION', '1.1.3');
define('WC_PAYMENT_INVOICE_VERSION', '1.1.4');
define('WC_PAYMENT_INVOICE_TRANSLATION_PATH', plugin_dir_path(__FILE__) . 'languages/');

/**
Expand Down

0 comments on commit adb6047

Please sign in to comment.