WooCommerce PDF Invoices & Packing Slips - Version 2.1.10

Version Description

  • Feature: Include invoice number and date in WooCommerce data remover and exporter
  • Fix: Row class for Chained Products compatibility
  • Fix: Improved compatibility with Advanced Custom Fields
  • Fix: Setting for diabling for free invoices should be applied even when other plugins are applying rules
Download this release

Release Info

Developer pomegranate
Plugin Icon 128x128 WooCommerce PDF Invoices & Packing Slips
Version 2.1.10
Comparing to
See all releases

Code changes from version 2.1.9 to 2.1.10

includes/class-wcpdf-main.php CHANGED
@@ -16,7 +16,7 @@ class Main {
16
  function __construct() {
17
  add_action( 'wp_ajax_generate_wpo_wcpdf', array($this, 'generate_pdf_ajax' ) );
18
  add_filter( 'woocommerce_email_attachments', array( $this, 'attach_pdf_to_email' ), 99, 3 );
19
- add_filter( 'wpo_wcpdf_custom_attachment_condition', array( $this, 'disable_free_attachment'), 10, 4 );
20
 
21
  if ( isset(WPO_WCPDF()->settings->debug_settings['enable_debug']) ) {
22
  $this->enable_debug();
@@ -40,6 +40,12 @@ class Main {
40
 
41
  // scheduled attachments cleanup (following settings on Status tab)
42
  add_action( 'wp_scheduled_delete', array( $this, 'attachments_cleanup') );
 
 
 
 
 
 
43
  }
44
 
45
  /**
@@ -509,6 +515,45 @@ class Main {
509
  }
510
  }
511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  /**
513
  * Enable PHP error output
514
  */
16
  function __construct() {
17
  add_action( 'wp_ajax_generate_wpo_wcpdf', array($this, 'generate_pdf_ajax' ) );
18
  add_filter( 'woocommerce_email_attachments', array( $this, 'attach_pdf_to_email' ), 99, 3 );
19
+ add_filter( 'wpo_wcpdf_custom_attachment_condition', array( $this, 'disable_free_attachment'), 1001, 4 );
20
 
21
  if ( isset(WPO_WCPDF()->settings->debug_settings['enable_debug']) ) {
22
  $this->enable_debug();
40
 
41
  // scheduled attachments cleanup (following settings on Status tab)
42
  add_action( 'wp_scheduled_delete', array( $this, 'attachments_cleanup') );
43
+
44
+ // remove private data
45
+ add_action( 'woocommerce_privacy_remove_order_personal_data_meta', array( $this, 'remove_order_personal_data_meta' ), 10, 1 );
46
+ add_action( 'woocommerce_privacy_remove_order_personal_data', array( $this, 'remove_order_personal_data' ), 10, 1 );
47
+ // export private data
48
+ add_action( 'woocommerce_privacy_export_order_personal_data_meta', array( $this, 'export_order_personal_data_meta' ), 10, 1 );
49
  }
50
 
51
  /**
515
  }
516
  }
517
 
518
+ /**
519
+ * Remove all invoice data when requested
520
+ */
521
+ public function remove_order_personal_data_meta( $meta_to_remove ) {
522
+ $wcpdf_private_meta = array(
523
+ '_wcpdf_invoice_number' => 'numeric_id',
524
+ '_wcpdf_invoice_number_data' => 'array',
525
+ '_wcpdf_invoice_date' => 'timestamp',
526
+ '_wcpdf_invoice_date_formatted' => 'date',
527
+ );
528
+ return $meta_to_remove + $wcpdf_private_meta;
529
+ }
530
+
531
+ /**
532
+ * Remove references to order in number store tables when removing WC data
533
+ */
534
+ public function remove_order_personal_data( $order ) {
535
+ global $wpdb;
536
+ // remove order ID from number stores
537
+ $number_stores = apply_filters( "wpo_wcpdf_privacy_number_stores", array( 'invoice_number' ) );
538
+ foreach ( $number_stores as $store_name ) {
539
+ $order_id = $order->get_id();
540
+ $table_name = apply_filters( "wpo_wcpdf_number_store_table_name", "{$wpdb->prefix}wcpdf_{$store_name}", $store_name, 'auto_increment' ); // i.e. wp_wcpdf_invoice_number
541
+ $wpdb->query( "UPDATE $table_name SET order_id = 0 WHERE order_id = $order_id" );
542
+ }
543
+ }
544
+
545
+ /**
546
+ * Export all invoice data when requested
547
+ */
548
+ public function export_order_personal_data_meta( $meta_to_export ) {
549
+ $private_address_meta = array(
550
+ // _wcpdf_invoice_number_data & _wcpdf_invoice_date are duplicates of the below and therefor not included
551
+ '_wcpdf_invoice_number' => __( 'Invoice Number', 'woocommerce-pdf-invoices-packing-slips' ),
552
+ '_wcpdf_invoice_date_formatted' => __( 'Invoice Date', 'woocommerce-pdf-invoices-packing-slips' ),
553
+ );
554
+ return $meta_to_export + $private_address_meta;
555
+ }
556
+
557
  /**
558
  * Enable PHP error output
559
  */
includes/compatibility/class-wcpdf-compatibility-third-party-plugins.php CHANGED
@@ -32,7 +32,7 @@ class Third_Party_Plugins {
32
  }
33
 
34
  // WooCommerce Chained Products compatibility (add row classes)
35
- if ( class_exists('SA_WC_Chained_Products') ) {
36
  add_filter( 'wpo_wcpdf_item_row_class', array( $this, 'add_chained_product_class' ), 10, 4 );
37
  }
38
 
32
  }
33
 
34
  // WooCommerce Chained Products compatibility (add row classes)
35
+ if ( class_exists('SA_WC_Chained_Products') || class_exists('WC_Chained_Products') ) {
36
  add_filter( 'wpo_wcpdf_item_row_class', array( $this, 'add_chained_product_class' ), 10, 4 );
37
  }
38
 
includes/documents/abstract-wcpdf-order-document-methods.php CHANGED
@@ -189,8 +189,8 @@ abstract class Order_Document_Methods extends Order_Document {
189
  if ( !$this->is_order_prop( $field_name ) ) {
190
  $custom_field = WCX_Order::get_meta( $this->order, $field_name, true );
191
  }
192
- // if not found, try prefixed with underscore
193
- if ( !$custom_field && substr( $field_name, 0, 1 ) !== '_' && !$this->is_order_prop( "_{$field_name}" ) ) {
194
  $custom_field = WCX_Order::get_meta( $this->order, "_{$field_name}", true );
195
  }
196
 
189
  if ( !$this->is_order_prop( $field_name ) ) {
190
  $custom_field = WCX_Order::get_meta( $this->order, $field_name, true );
191
  }
192
+ // if not found, try prefixed with underscore (not when ACF is active!)
193
+ if ( !$custom_field && substr( $field_name, 0, 1 ) !== '_' && !$this->is_order_prop( "_{$field_name}" ) && !class_exists('ACF') ) {
194
  $custom_field = WCX_Order::get_meta( $this->order, "_{$field_name}", true );
195
  }
196
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice,
5
  Requires at least: 3.5
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
- Stable tag: 2.1.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -103,6 +103,12 @@ There's a setting on the Status tab of the settings page that allows you to togg
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
 
106
  = 2.1.9 =
107
  * Feature: Automatic cleanup of temporary attachments folder (settings in Status tab)
108
  * Fix: prevent infinite loop on sites without uploads folder
@@ -258,5 +264,5 @@ There's a setting on the Status tab of the settings page that allows you to togg
258
 
259
  == Upgrade Notice ==
260
 
261
- = 2.1.9 =
262
  2.X is a BIG update! Make a full site backup before upgrading if you were using version 1.X!
5
  Requires at least: 3.5
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
+ Stable tag: 2.1.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
103
 
104
  == Changelog ==
105
 
106
+ = 2.1.10 =
107
+ * Feature: Include invoice number and date in WooCommerce data remover and exporter
108
+ * Fix: Row class for Chained Products compatibility
109
+ * Fix: Improved compatibility with Advanced Custom Fields
110
+ * Fix: Setting for diabling for free invoices should be applied even when other plugins are applying rules
111
+
112
  = 2.1.9 =
113
  * Feature: Automatic cleanup of temporary attachments folder (settings in Status tab)
114
  * Fix: prevent infinite loop on sites without uploads folder
264
 
265
  == Upgrade Notice ==
266
 
267
+ = 2.1.10 =
268
  2.X is a BIG update! Make a full site backup before upgrading if you were using version 1.X!
woocommerce-pdf-invoices-packingslips.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
  * Plugin URI: http://www.wpovernight.com
5
  * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
- * Version: 2.1.9
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
@@ -21,7 +21,7 @@ if ( !class_exists( 'WPO_WCPDF' ) ) :
21
 
22
  class WPO_WCPDF {
23
 
24
- public $version = '2.1.9';
25
  public $plugin_basename;
26
  public $legacy_mode;
27
 
3
  * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
  * Plugin URI: http://www.wpovernight.com
5
  * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
+ * Version: 2.1.10
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
21
 
22
  class WPO_WCPDF {
23
 
24
+ public $version = '2.1.10';
25
  public $plugin_basename;
26
  public $legacy_mode;
27