WooCommerce PDF Invoices & Packing Slips - Version 2.7.3

Version Description

  • New: Support for line breaks in invoice notes
  • Fix: Only pass opened edit fields when regenerating document
  • Fix: Words in table headers could be broken up
  • Deprecated: legacy translations (pre-2.0) are no longer read automatically (can be enabled in the Status tab)
Download this release

Release Info

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

Code changes from version 2.7.2 to 2.7.3

assets/js/order-script.js CHANGED
@@ -92,10 +92,12 @@ jQuery(document).ready(function($) {
92
  // create an object with the form inputs data
93
  form_inputs_data = {};
94
  $form.find(':input').each( function() {
95
- name = $(this).attr("name");
96
- name = name.split('[', 1)[0]; // for credit-note array []
97
- value = $(this).val();
98
- form_inputs_data[name] = value;
 
 
99
  } );
100
 
101
  // convert data to json string
92
  // create an object with the form inputs data
93
  form_inputs_data = {};
94
  $form.find(':input').each( function() {
95
+ if (!$(this).is(':disabled')) {
96
+ name = $(this).attr("name");
97
+ name = name.split('[', 1)[0]; // for credit-note array []
98
+ value = $(this).val();
99
+ form_inputs_data[name] = value;
100
+ }
101
  } );
102
 
103
  // convert data to json string
includes/class-wcpdf-admin.php CHANGED
@@ -425,7 +425,7 @@ class Admin {
425
  <p class="form-field form-field-wide">
426
  <label for="_wcpdf_invoice_date"><?php _e( 'Invoice Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
427
  <?php if ( $invoice->exists() && !empty($invoice_date) ) : ?>
428
- <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}" />
429
  <?php else : ?>
430
  <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" />
431
  <?php endif; ?>
@@ -816,7 +816,8 @@ class Admin {
816
  'b' => array(),
817
  );
818
  // sanitize
819
- $data['notes'] = wp_kses( stripslashes($form_data['_wcpdf_'.$document_slug.'_notes']), $allowed_html );
 
820
  }
821
 
822
  return $data;
425
  <p class="form-field form-field-wide">
426
  <label for="_wcpdf_invoice_date"><?php _e( 'Invoice Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></label>
427
  <?php if ( $invoice->exists() && !empty($invoice_date) ) : ?>
428
+ <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" 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 $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}" disabled="disabled" />
429
  <?php else : ?>
430
  <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" />
431
  <?php endif; ?>
816
  'b' => array(),
817
  );
818
  // sanitize
819
+ $notes = sanitize_textarea_field( wp_kses( $form_data['_wcpdf_'.$document_slug.'_notes'], $allowed_html ) );
820
+ $data['notes'] = nl2br( $notes );
821
  }
822
 
823
  return $data;
includes/class-wcpdf-settings-debug.php CHANGED
@@ -201,6 +201,18 @@ class Settings_Debug {
201
  'description' => __( "Legacy mode ensures compatibility with templates and filters from previous versions.", 'woocommerce-pdf-invoices-packing-slips' ),
202
  )
203
  ),
 
 
 
 
 
 
 
 
 
 
 
 
204
  array(
205
  'type' => 'setting',
206
  'id' => 'guest_access',
201
  'description' => __( "Legacy mode ensures compatibility with templates and filters from previous versions.", 'woocommerce-pdf-invoices-packing-slips' ),
202
  )
203
  ),
204
+ array(
205
+ 'type' => 'setting',
206
+ 'id' => 'legacy_textdomain',
207
+ 'title' => __( 'Legacy textdomain fallback', 'woocommerce-pdf-invoices-packing-slips' ),
208
+ 'callback' => 'checkbox',
209
+ 'section' => 'debug_settings',
210
+ 'args' => array(
211
+ 'option_name' => $option_name,
212
+ 'id' => 'legacy_textdomain',
213
+ 'description' => __( "Legacy textdomain fallback ensures compatibility with translation files from versions prior to 2017-05-15.", 'woocommerce-pdf-invoices-packing-slips' ),
214
+ )
215
+ ),
216
  array(
217
  'type' => 'setting',
218
  'id' => 'guest_access',
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.6
7
  Requires PHP: 5.3
8
- Stable tag: 2.7.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -102,6 +102,12 @@ There's a setting on the Status tab of the settings page that allows you to togg
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
 
105
  = 2.7.2 =
106
  * Fix: Update invoice number and date when regenerating document from edit mode
107
  * Fix: Prevent infinite loop when temporary folder is not writable
5
  Requires at least: 3.5
6
  Tested up to: 5.6
7
  Requires PHP: 5.3
8
+ Stable tag: 2.7.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
102
 
103
  == Changelog ==
104
 
105
+ = 2.7.3 =
106
+ * New: Support for line breaks in invoice notes
107
+ * Fix: Only pass opened edit fields when regenerating document
108
+ * Fix: Words in table headers could be broken up
109
+ * Deprecated: legacy translations (pre-2.0) are no longer read automatically (can be enabled in the Status tab)
110
+
111
  = 2.7.2 =
112
  * Fix: Update invoice number and date when regenerating document from edit mode
113
  * Fix: Prevent infinite loop when temporary folder is not writable
templates/Simple/style.css CHANGED
@@ -73,7 +73,6 @@ table {
73
  th, td {
74
  vertical-align: top;
75
  text-align: left;
76
- word-wrap: break-word;
77
  }
78
 
79
  table.container {
@@ -123,6 +122,10 @@ table.order-data-addresses {
123
  margin-bottom: 10mm;
124
  }
125
 
 
 
 
 
126
  td.order-data {
127
  width: 40%;
128
  }
73
  th, td {
74
  vertical-align: top;
75
  text-align: left;
 
76
  }
77
 
78
  table.container {
122
  margin-bottom: 10mm;
123
  }
124
 
125
+ table.order-data-addresses td.address {
126
+ word-wrap: break-word;
127
+ }
128
+
129
  td.order-data {
130
  width: 40%;
131
  }
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.7.2
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
@@ -21,9 +21,10 @@ if ( !class_exists( 'WPO_WCPDF' ) ) :
21
 
22
  class WPO_WCPDF {
23
 
24
- public $version = '2.7.2';
25
  public $plugin_basename;
26
  public $legacy_mode;
 
27
 
28
  protected static $_instance = null;
29
 
@@ -49,10 +50,14 @@ class WPO_WCPDF {
49
 
50
  // load the localisation & classes
51
  add_action( 'plugins_loaded', array( $this, 'translations' ) );
52
- add_filter( 'load_textdomain_mofile', array( $this, 'textdomain_fallback' ), 10, 2 );
53
  add_action( 'plugins_loaded', array( $this, 'load_classes' ), 9 );
54
  add_action( 'in_plugin_update_message-'.$this->plugin_basename, array( $this, 'in_plugin_update_message' ) );
55
  add_action( 'admin_notices', array( $this, 'nginx_detected' ) );
 
 
 
 
 
56
  }
57
 
58
  /**
@@ -219,12 +224,22 @@ class WPO_WCPDF {
219
  */
220
  public function legacy_mode_enabled() {
221
  if (!isset($this->legacy_mode)) {
222
- $debug_settings = get_option( 'wpo_wcpdf_settings_debug' );
223
  $this->legacy_mode = isset($debug_settings['legacy_mode']);
224
  }
225
  return $this->legacy_mode;
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
228
 
229
  /**
230
  * Check if woocommerce is activated
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.7.3
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.7.3';
25
  public $plugin_basename;
26
  public $legacy_mode;
27
+ public $legacy_textdomain;
28
 
29
  protected static $_instance = null;
30
 
50
 
51
  // load the localisation & classes
52
  add_action( 'plugins_loaded', array( $this, 'translations' ) );
 
53
  add_action( 'plugins_loaded', array( $this, 'load_classes' ), 9 );
54
  add_action( 'in_plugin_update_message-'.$this->plugin_basename, array( $this, 'in_plugin_update_message' ) );
55
  add_action( 'admin_notices', array( $this, 'nginx_detected' ) );
56
+
57
+ // legacy textdomain fallback
58
+ if ( $this->legacy_textdomain_enabled() === true ) {
59
+ add_filter( 'load_textdomain_mofile', array( $this, 'textdomain_fallback' ), 10, 2 );
60
+ }
61
  }
62
 
63
  /**
224
  */
225
  public function legacy_mode_enabled() {
226
  if (!isset($this->legacy_mode)) {
227
+ $debug_settings = get_option( 'wpo_wcpdf_settings_debug', array() );
228
  $this->legacy_mode = isset($debug_settings['legacy_mode']);
229
  }
230
  return $this->legacy_mode;
231
  }
232
 
233
+ /**
234
+ * Check if legacy textdomain fallback is enabled
235
+ */
236
+ public function legacy_textdomain_enabled() {
237
+ if (!isset($this->legacy_textdomain)) {
238
+ $debug_settings = get_option( 'wpo_wcpdf_settings_debug', array() );
239
+ $this->legacy_textdomain = isset($debug_settings['legacy_textdomain']);
240
+ }
241
+ return $this->legacy_textdomain;
242
+ }
243
 
244
  /**
245
  * Check if woocommerce is activated