WooCommerce PDF Invoices & Packing Slips - Version 2.0.9

Version Description

  • Feature: use [invoice_date="ymd"] in invoice number prefix or suffix to include a specific date format in the invoice number
  • Fix: Postmeta table prefix for invoice counter
  • Fix: 0% tax rates
Download this release

Release Info

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

Code changes from version 2.0.8 to 2.0.9

includes/class-wcpdf-admin.php CHANGED
@@ -43,9 +43,10 @@ class Admin {
43
 
44
  $invoice_count = $this->get_invoice_count();
45
  if ( $invoice_count > 100 ) {
 
46
  ?>
47
  <div class="notice notice-info is-dismissible wpo-wcpdf-review-notice">
48
- <h3><?php _e( 'Wow, you have created more than 100 invoices with our plugin!', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
49
  <p><?php _e( 'It would mean a lot to us if you would quickly give our plugin a 5-star rating. Help us spread the word and boost our motivation!', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
50
  <ul>
51
  <li><a href="https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/?rate=5#new-post" class="button"><?php _e( 'Yes you deserve it!', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></a></li>
@@ -62,7 +63,7 @@ class Admin {
62
 
63
  public function get_invoice_count() {
64
  global $wpdb;
65
- $invoice_count = $wpdb->get_var("SELECT count(*) FROM `wp_postmeta` WHERE `meta_key` = '_wcpdf_invoice_number'");
66
  return (int) $invoice_count;
67
  }
68
 
43
 
44
  $invoice_count = $this->get_invoice_count();
45
  if ( $invoice_count > 100 ) {
46
+ $rounded_count = (int) substr( (string) $invoice_count, 0, 1 ) * pow( 10, strlen( (string) $invoice_count ) - 1);
47
  ?>
48
  <div class="notice notice-info is-dismissible wpo-wcpdf-review-notice">
49
+ <h3><?php printf( __( 'Wow, you have created more than %d invoices with our plugin!', 'woocommerce-pdf-invoices-packing-slips' ), $rounded_count ); ?></h3>
50
  <p><?php _e( 'It would mean a lot to us if you would quickly give our plugin a 5-star rating. Help us spread the word and boost our motivation!', 'woocommerce-pdf-invoices-packing-slips' ); ?></p>
51
  <ul>
52
  <li><a href="https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/?rate=5#new-post" class="button"><?php _e( 'Yes you deserve it!', 'woocommerce-pdf-invoices-packing-slips' ); ?></span></a></li>
63
 
64
  public function get_invoice_count() {
65
  global $wpdb;
66
+ $invoice_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM {$wpdb->postmeta} WHERE meta_key = %s", '_wcpdf_invoice_number' ) );
67
  return (int) $invoice_count;
68
  }
69
 
includes/documents/abstract-wcpdf-order-document-methods.php CHANGED
@@ -496,7 +496,7 @@ abstract class Order_Document_Methods extends Order_Document {
496
 
497
  $line_taxes = $line_tax_data['subtotal'];
498
  foreach ( $line_taxes as $tax_id => $tax ) {
499
- if ( !empty($tax) ) {
500
  $tax_rates[] = $this->get_tax_rate_by_id( $tax_id ) . ' %';
501
  }
502
  }
496
 
497
  $line_taxes = $line_tax_data['subtotal'];
498
  foreach ( $line_taxes as $tax_id => $tax ) {
499
+ if ( isset($tax) && $tax !== '' ) {
500
  $tax_rates[] = $this->get_tax_rate_by_id( $tax_id ) . ' %';
501
  }
502
  }
includes/documents/class-wcpdf-document-number.php CHANGED
@@ -145,6 +145,23 @@ class Document_Number {
145
  $value = str_replace("[{$document->slug}_year]", $document_year, $value);
146
  $value = str_replace("[{$document->slug}_month]", $document_month, $value);
147
  $value = str_replace("[{$document->slug}_day]", $document_day, $value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  $formats[$key] = $value;
149
  }
150
 
145
  $value = str_replace("[{$document->slug}_year]", $document_year, $value);
146
  $value = str_replace("[{$document->slug}_month]", $document_month, $value);
147
  $value = str_replace("[{$document->slug}_day]", $document_day, $value);
148
+
149
+ // replace date tag in the form [invoice_date="{$date_format}"] or [order_date="{$date_format}"]
150
+ $date_types = array( 'order', $document->slug );
151
+ foreach ($date_types as $date_type) {
152
+ if ( strpos($value, "[{$date_type}_date=") !== false ) {
153
+ preg_match_all("/\[{$date_type}_date=\"(.*?)\"\]/", $value, $document_date_tags);
154
+ if (!empty($document_date_tags[1])) {
155
+ foreach ($document_date_tags[1] as $match_id => $date_format) {
156
+ if ($date_type == 'order') {
157
+ $value = str_replace($document_date_tags[0][$match_id], $order_date->date_i18n( $date_format ), $value);
158
+ } else {
159
+ $value = str_replace($document_date_tags[0][$match_id], $document_date->date_i18n( $date_format ), $value);
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
  $formats[$key] = $value;
166
  }
167
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-
4
  Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice, packing slip, export, email, bulk, automatic
5
  Requires at least: 3.5
6
  Tested up to: 4.8
7
- Stable tag: 2.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -93,15 +93,22 @@ There's a setting on the Status tab of the settings page that allows you to togg
93
 
94
  == Screenshots ==
95
 
96
- 1. General settings page
97
- 2. Template settings page
98
- 3. Simple invoice PDF
99
- 4. Simple packing slip PDF
 
 
100
 
101
  == Changelog ==
102
 
103
  **2.0 is a BIG update! Make a full site backup before upgrading**
104
 
 
 
 
 
 
105
  = 2.0.8 =
106
  * Feature: Add support for Bedrock / alternative folder structures
107
  * Dev: Filter for merged documents
@@ -610,5 +617,5 @@ There's a setting on the Status tab of the settings page that allows you to togg
610
 
611
  == Upgrade Notice ==
612
 
613
- = 2.0.8 =
614
  **2.0 is a BIG update! Make a full site backup before upgrading!**
4
  Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice, packing slip, export, email, bulk, automatic
5
  Requires at least: 3.5
6
  Tested up to: 4.8
7
+ Stable tag: 2.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
93
 
94
  == Screenshots ==
95
 
96
+ 1. Simple invoice PDF
97
+ 2. Simple packing slip PDF
98
+ 3. Quickly print individual invoices or packing slips from the order list
99
+ 4. Print invoices or packing slips in bulk
100
+ 5. Attach invoices to any WooCommerce email
101
+ 6. Set shop name, address, header logo, etc.
102
 
103
  == Changelog ==
104
 
105
  **2.0 is a BIG update! Make a full site backup before upgrading**
106
 
107
+ = 2.0.9 =
108
+ * Feature: use `[invoice_date="ymd"]` in invoice number prefix or suffix to include a specific date format in the invoice number
109
+ * Fix: Postmeta table prefix for invoice counter
110
+ * Fix: 0% tax rates
111
+
112
  = 2.0.8 =
113
  * Feature: Add support for Bedrock / alternative folder structures
114
  * Dev: Filter for merged documents
617
 
618
  == Upgrade Notice ==
619
 
620
+ = 2.0.9 =
621
  **2.0 is a BIG update! Make a full site backup before upgrading!**
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
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.0.8
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
@@ -19,7 +19,7 @@ if ( !class_exists( 'WPO_WCPDF' ) ) :
19
 
20
  class WPO_WCPDF {
21
 
22
- public $version = '2.0.8';
23
  public $plugin_basename;
24
  public $legacy_mode;
25
 
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.0.9
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
19
 
20
  class WPO_WCPDF {
21
 
22
+ public $version = '2.0.9';
23
  public $plugin_basename;
24
  public $legacy_mode;
25