WooCommerce PDF Invoices & Packing Slips - Version 1.2.13

Version Description

  • Feature: added filter for custom email attachment condition (wpo_wcpdf_custom_email_condition)
  • Fix: warning for tax implode
Download this release

Release Info

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

Code changes from version 1.2.12 to 1.2.13

includes/class-wcpdf-export.php CHANGED
@@ -236,15 +236,15 @@ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
236
  /**
237
  * Attach invoice to completed order or customer invoice email
238
  */
239
- public function attach_pdf_to_email ( $attachments, $status , $order ) {
240
- if (!isset($this->general_settings['email_pdf']))
241
  return;
 
242
 
243
  // clear temp folder (from http://stackoverflow.com/a/13468943/1446634)
244
  $tmp_path = WooCommerce_PDF_Invoices::$plugin_path . 'tmp/';
245
  array_map('unlink', ( glob( $tmp_path.'*' ) ? glob( $tmp_path.'*' ) : array() ) );
246
 
247
-
248
  // Relevant (default) statuses:
249
  // new_order
250
  // customer_invoice
@@ -260,7 +260,12 @@ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
260
  }
261
  }
262
 
263
- if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) {
 
 
 
 
 
264
  // create pdf data
265
  $invoice = $this->get_pdf( 'invoice', (array) $order->id );
266
 
@@ -497,9 +502,9 @@ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
497
  if (empty($tax_rates)) {
498
  // one last try: manually calculate
499
  if ( $line_total != 0) {
500
- $tax_rates = round( ($line_tax / $line_total)*100, 1 ).'%';
501
  } else {
502
- $tax_rates = '-';
503
  }
504
  }
505
 
236
  /**
237
  * Attach invoice to completed order or customer invoice email
238
  */
239
+ public function attach_pdf_to_email ( $attachments, $status, $order ) {
240
+ if (!isset($this->general_settings['email_pdf']) || !isset( $status ) ) {
241
  return;
242
+ }
243
 
244
  // clear temp folder (from http://stackoverflow.com/a/13468943/1446634)
245
  $tmp_path = WooCommerce_PDF_Invoices::$plugin_path . 'tmp/';
246
  array_map('unlink', ( glob( $tmp_path.'*' ) ? glob( $tmp_path.'*' ) : array() ) );
247
 
 
248
  // Relevant (default) statuses:
249
  // new_order
250
  // customer_invoice
260
  }
261
  }
262
 
263
+ if ( !( apply_filters('wpo_wcpdf_custom_email_condition', true, $order, $status ) ) ) {
264
+ // use this filter to add an extra condition - return false to disable the PDF attachment
265
+ return;
266
+ }
267
+
268
+ if( in_array( $status, $allowed_statuses ) ) {
269
  // create pdf data
270
  $invoice = $this->get_pdf( 'invoice', (array) $order->id );
271
 
502
  if (empty($tax_rates)) {
503
  // one last try: manually calculate
504
  if ( $line_total != 0) {
505
+ $tax_rates[] = round( ($line_tax / $line_total)*100, 1 ).'%';
506
  } else {
507
+ $tax_rates[] = '-';
508
  }
509
  }
510
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: pomegranate
3
  Tags: woocommerce, print, pdf, bulk, packing slips, invoices, delivery notes, invoice, packing slip, export, email
4
  Requires at least: 3.5 and WooCommerce 2.0
5
  Tested up to: 3.8.1 and WooCommerce 2.1
6
- Stable tag: 1.2.12
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -168,8 +168,11 @@ This usually only happens on batch actions. PDF creation is a memory intensive j
168
 
169
  == Changelog ==
170
 
171
- = 1.2.12 =
 
172
  * Fix: warning for tax implode
 
 
173
  * Fix: hyperlink underline (was more like a strikethrough)
174
 
175
  = 1.2.11 =
@@ -265,4 +268,4 @@ This usually only happens on batch actions. PDF creation is a memory intensive j
265
  * Tweak: Variation data is now displayed by default
266
 
267
  = 1.0.0 =
268
- * First release
3
  Tags: woocommerce, print, pdf, bulk, packing slips, invoices, delivery notes, invoice, packing slip, export, email
4
  Requires at least: 3.5 and WooCommerce 2.0
5
  Tested up to: 3.8.1 and WooCommerce 2.1
6
+ Stable tag: 1.2.13
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
168
 
169
  == Changelog ==
170
 
171
+ = 1.2.13 =
172
+ * Feature: added filter for custom email attachment condition (wpo_wcpdf_custom_email_condition)
173
  * Fix: warning for tax implode
174
+
175
+ = 1.2.12 =
176
  * Fix: hyperlink underline (was more like a strikethrough)
177
 
178
  = 1.2.11 =
268
  * Tweak: Variation data is now displayed by default
269
 
270
  = 1.0.0 =
271
+ * First release
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: 1.2.12
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
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: 1.2.13
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later