WooCommerce PDF Invoices & Packing Slips - Version 2.4.1

Version Description

  • Fix: Creating invoices for draft orders would crash plugin
  • Tweak: Include time in default invoice date
Download this release

Release Info

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

Code changes from version 2.4.0 to 2.4.1

includes/class-wcpdf-admin.php CHANGED
@@ -20,7 +20,7 @@ class Admin {
20
  add_action( 'admin_footer', array( $this, 'bulk_actions' ) );
21
  add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'search_fields' ) );
22
 
23
- add_action( 'woocommerce_process_shop_order_meta', array( $this,'save_invoice_number_date' ), 10, 2 );
24
 
25
  // manually send emails
26
  // WooCommerce core processes order actions at priority 50
@@ -408,7 +408,7 @@ class Admin {
408
  <?php if ( $invoice->exists() && !empty($invoice_date) ) : ?>
409
  <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" value="<?php echo $invoice_date->date_i18n( 'Y-m-d' ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" disabled="disabled"/>@<input type="number" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" min="0" max="23" size="2" value="<?php echo $invoice_date->date_i18n( 'H' ) ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" min="0" max="59" size="2" value="<?php echo $invoice_date->date_i18n( 'i' ); ?>" pattern="[0-5]{1}[0-9]{1}" />
410
  <?php else : ?>
411
- <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" disabled="disabled" value="<?php echo date_i18n( 'Y-m-d' ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="number" class="hour" disabled="disabled" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" min="0" max="23" size="2" value="" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" min="0" max="59" size="2" value="" pattern="[0-5]{1}[0-9]{1}" disabled="disabled" />
412
  <?php endif; ?>
413
  </p>
414
  </div>
20
  add_action( 'admin_footer', array( $this, 'bulk_actions' ) );
21
  add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'search_fields' ) );
22
 
23
+ add_action( 'woocommerce_process_shop_order_meta', array( $this,'save_invoice_number_date' ), 35, 2 );
24
 
25
  // manually send emails
26
  // WooCommerce core processes order actions at priority 50
408
  <?php if ( $invoice->exists() && !empty($invoice_date) ) : ?>
409
  <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" value="<?php echo $invoice_date->date_i18n( 'Y-m-d' ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" disabled="disabled"/>@<input type="number" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" min="0" max="23" size="2" value="<?php echo $invoice_date->date_i18n( 'H' ) ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" min="0" max="59" size="2" value="<?php echo $invoice_date->date_i18n( 'i' ); ?>" pattern="[0-5]{1}[0-9]{1}" />
410
  <?php else : ?>
411
+ <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" disabled="disabled" value="<?php echo date_i18n( 'Y-m-d' ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="number" class="hour" disabled="disabled" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" min="0" max="23" size="2" value="<?php echo date_i18n( 'H' ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" min="0" max="59" size="2" value="<?php echo date_i18n( 'i' ); ?>" pattern="[0-5]{1}[0-9]{1}" disabled="disabled" />
412
  <?php endif; ?>
413
  </p>
414
  </div>
includes/documents/class-wcpdf-document-number.php CHANGED
@@ -117,6 +117,11 @@ class Document_Number {
117
 
118
  // get dates
119
  $order_date = WCX_Order::get_prop( $order, 'date_created' );
 
 
 
 
 
120
  $document_date = $document->get_date();
121
  // fallback to order date if no document date available
122
  if (empty($document_date)) {
117
 
118
  // get dates
119
  $order_date = WCX_Order::get_prop( $order, 'date_created' );
120
+ // order date can be empty when order is being saved, fallback to current time
121
+ if ( empty( $order_date ) && function_exists('wc_string_to_datetime') ) {
122
+ $order_date = wc_string_to_datetime( date_i18n('Y-m-d H:i:s') );
123
+ }
124
+
125
  $document_date = $document->get_date();
126
  // fallback to order date if no document date available
127
  if (empty($document_date)) {
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.3
7
  Requires PHP: 5.3
8
- Stable tag: 2.4.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -102,6 +102,10 @@ There's a setting on the Status tab of the settings page that allows you to togg
102
 
103
  == Changelog ==
104
 
 
 
 
 
105
  = 2.4.0 =
106
  * Feature: Option to use order number & date for invoice number & date
107
  * Fix: prevent errors during update when WC not active
5
  Requires at least: 3.5
6
  Tested up to: 5.3
7
  Requires PHP: 5.3
8
+ Stable tag: 2.4.1
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.1 =
106
+ * Fix: Creating invoices for draft orders would crash plugin
107
+ * Tweak: Include time in default invoice date
108
+
109
  = 2.4.0 =
110
  * Feature: Option to use order number & date for invoice number & date
111
  * Fix: prevent errors during update when WC not active
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.0
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.0';
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.1
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.1';
25
  public $plugin_basename;
26
  public $legacy_mode;
27