WooCommerce PDF Invoices & Packing Slips - Version 2.4.9

Version Description

  • Fix: Backwards compatibility with WooCommerce 2.6
  • Fix: Description of the setting to disable invoice for free orders
  • Changed: shorter my account button text ("Invoice" instead of "Download Invoice (PDF)")
Download this release

Release Info

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

Code changes from version 2.4.8 to 2.4.9

includes/class-wcpdf-frontend.php CHANGED
@@ -52,15 +52,9 @@ class Frontend {
52
 
53
  // Check if invoice has been created already or if status allows download (filter your own array of allowed statuses)
54
  if ( $invoice_allowed || in_array(WCX_Order::get_status( $order ), apply_filters( 'wpo_wcpdf_myaccount_allowed_order_statuses', array() ) ) ) {
55
- $document_title = array_filter( $invoice->get_setting( 'title', array() ) );
56
- if ( !empty($document_title) ) {
57
- $button_text = sprintf ( __( 'Download %s (PDF)', 'woocommerce-pdf-invoices-packing-slips' ), $invoice->get_title() );
58
- } else {
59
- $button_text = __( 'Download invoice (PDF)', 'woocommerce-pdf-invoices-packing-slips' );
60
- }
61
  $actions['invoice'] = array(
62
  'url' => $pdf_url,
63
- 'name' => apply_filters( 'wpo_wcpdf_myaccount_button_text', $button_text, $invoice )
64
  );
65
  }
66
  }
52
 
53
  // Check if invoice has been created already or if status allows download (filter your own array of allowed statuses)
54
  if ( $invoice_allowed || in_array(WCX_Order::get_status( $order ), apply_filters( 'wpo_wcpdf_myaccount_allowed_order_statuses', array() ) ) ) {
 
 
 
 
 
 
55
  $actions['invoice'] = array(
56
  'url' => $pdf_url,
57
+ 'name' => apply_filters( 'wpo_wcpdf_myaccount_button_text', $invoice->get_title(), $invoice )
58
  );
59
  }
60
  }
includes/documents/abstract-wcpdf-order-document-methods.php CHANGED
@@ -354,9 +354,9 @@ abstract class Order_Document_Methods extends Order_Document {
354
 
355
  if ( $include_system_notes === false ) {
356
  foreach ($notes as $key => $note) {
357
- if ( $note->added_by == 'system' ) {
358
- unset($notes[$key]);
359
- }
360
  }
361
  }
362
 
@@ -599,16 +599,17 @@ abstract class Order_Document_Methods extends Order_Document {
599
  */
600
  public function get_tax_rate( $item, $order, $force_calculation = false ) {
601
  if ( version_compare( WOOCOMMERCE_VERSION, '3.0', '>=' ) ) {
602
- $tax_data_container = ( $item['type'] == 'line_item' ) ? 'line_tax_data' : 'taxes';
603
- $tax_data_key = ( $item['type'] == 'line_item' ) ? 'subtotal' : 'total';
604
- $line_total_key = ( $item['type'] == 'line_item' ) ? 'line_total' : 'total';
605
- $line_tax_key = ( $item['type'] == 'shipping' ) ? 'total_tax' : 'line_tax';
606
 
607
  $tax_class = isset($item['tax_class']) ? $item['tax_class'] : '';
608
  $line_tax = $item[$line_tax_key];
609
- $line_total = $item[$line_total_key];
610
- $line_tax_data = $item[$tax_data_container];
611
  } else {
 
612
  $tax_class = $item['tax_class'];
613
  $line_total = $item['line_total'];
614
  $line_tax = $item['line_tax'];
354
 
355
  if ( $include_system_notes === false ) {
356
  foreach ($notes as $key => $note) {
357
+ if ( $note->added_by == 'system' ) {
358
+ unset($notes[$key]);
359
+ }
360
  }
361
  }
362
 
599
  */
600
  public function get_tax_rate( $item, $order, $force_calculation = false ) {
601
  if ( version_compare( WOOCOMMERCE_VERSION, '3.0', '>=' ) ) {
602
+ $tax_data_container = ( $item['type'] == 'line_item' ) ? 'line_tax_data' : 'taxes';
603
+ $tax_data_key = ( $item['type'] == 'line_item' ) ? 'subtotal' : 'total';
604
+ $line_total_key = ( $item['type'] == 'line_item' ) ? 'line_total' : 'total';
605
+ $line_tax_key = ( $item['type'] == 'shipping' ) ? 'total_tax' : 'line_tax';
606
 
607
  $tax_class = isset($item['tax_class']) ? $item['tax_class'] : '';
608
  $line_tax = $item[$line_tax_key];
609
+ $line_total = $item[$line_total_key];
610
+ $line_tax_data = $item[$tax_data_container];
611
  } else {
612
+ $tax_data_key = ( $item['type'] == 'line_item' ) ? 'subtotal' : 'total';
613
  $tax_class = $item['tax_class'];
614
  $line_total = $item['line_total'];
615
  $line_tax = $item['line_tax'];
includes/documents/abstract-wcpdf-order-document.php CHANGED
@@ -651,7 +651,7 @@ abstract class Order_Document {
651
  }
652
 
653
  // clean up special characters
654
- if ( function_exists('utf8_decode') && function_exists('mb_convert_encoding') ) {
655
  $html = utf8_decode(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
656
  }
657
 
651
  }
652
 
653
  // clean up special characters
654
+ if ( apply_filters( 'wpo_wcpdf_convert_encoding', function_exists('utf8_decode') && function_exists('mb_convert_encoding') ) ) {
655
  $html = utf8_decode(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
656
  }
657
 
includes/documents/class-wcpdf-invoice.php CHANGED
@@ -371,13 +371,13 @@ class Invoice extends Order_Document_Methods {
371
  array(
372
  'type' => 'setting',
373
  'id' => 'disable_free',
374
- 'title' => __( 'Disable for free products', 'woocommerce-pdf-invoices-packing-slips' ),
375
  'callback' => 'checkbox',
376
  'section' => 'invoice',
377
  'args' => array(
378
  'option_name' => $option_name,
379
  'id' => 'disable_free',
380
- 'description' => __( "Disable automatic creation/attachment when only free products are ordered", 'woocommerce-pdf-invoices-packing-slips' ),
381
  )
382
  ),
383
  array(
371
  array(
372
  'type' => 'setting',
373
  'id' => 'disable_free',
374
+ 'title' => __( 'Disable for free orders', 'woocommerce-pdf-invoices-packing-slips' ),
375
  'callback' => 'checkbox',
376
  'section' => 'invoice',
377
  'args' => array(
378
  'option_name' => $option_name,
379
  'id' => 'disable_free',
380
+ 'description' => sprintf(__( "Disable automatic creation/attachment when the order total is %s", 'woocommerce-pdf-invoices-packing-slips' ), wc_price( 0 ) ),
381
  )
382
  ),
383
  array(
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: 5.4
7
  Requires PHP: 5.3
8
- Stable tag: 2.4.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -102,6 +102,11 @@ There's a setting on the Status tab of the settings page that allows you to togg
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
105
  = 2.4.8 =
106
  * Dev: Added `wpo_wcpdf_pdf_data` filter for direct loading of PDF data
107
  * Dev: Added `is_bulk` property to bulk documents
5
  Requires at least: 3.5
6
  Tested up to: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 2.4.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
102
 
103
  == Changelog ==
104
 
105
+ = 2.4.9 =
106
+ * Fix: Backwards compatibility with WooCommerce 2.6
107
+ * Fix: Description of the setting to disable invoice for free orders
108
+ * Changed: shorter my account button text ("Invoice" instead of "Download Invoice (PDF)")
109
+
110
  = 2.4.8 =
111
  * Dev: Added `wpo_wcpdf_pdf_data` filter for direct loading of PDF data
112
  * Dev: Added `is_bulk` property to bulk documents
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.4.8
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.4.8';
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.4.9
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.4.9';
25
  public $plugin_basename;
26
  public $legacy_mode;
27