WooCommerce PDF Invoices & Packing Slips - Version 2.11.1

Version Description

  • Fix: Errors were incorrectly logged after installation when no invoices had been created yet
  • Fix: Button styles in order backend
Download this release

Release Info

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

Code changes from version 2.11.0 to 2.11.1

assets/css/order-styles.css CHANGED
@@ -14,7 +14,8 @@
14
  .wpo_wcpdf-actions a.button.exists::after {
15
  font-family: Dashicons;
16
  content: "\f147";
17
- font-size: 16px;
 
18
  margin-left: 4px;
19
  color: #2aad2a;
20
  vertical-align: middle;
14
  .wpo_wcpdf-actions a.button.exists::after {
15
  font-family: Dashicons;
16
  content: "\f147";
17
+ font-size: 125%;
18
+ line-height: 80%;
19
  margin-left: 4px;
20
  color: #2aad2a;
21
  vertical-align: middle;
assets/css/order-styles.min.css CHANGED
@@ -1 +1 @@
1
- .type-shop_order .column-wc_actions a.button.wpo_wcpdf{padding:3px 2px 1px 1px!important}.type-shop_order .column-wc_actions a.button.wpo_wcpdf.exists::after{content:"\f147";position:absolute;font-size:16px;left:7px;color:#2aad2a}.wpo_wcpdf-actions a.button.exists::after{font-family:Dashicons;content:"\f147";font-size:16px;margin-left:4px;color:#2aad2a;vertical-align:middle}.type-shop_order .column-order_actions a.button.wpo_wcpdf img,.type-shop_order .column-wc_actions a.button.wpo_wcpdf img{width:16px}.widefat .column-pdf_invoice_number{width:110px}@media screen and (max-width:782px){.wp-list-table .column-pdf_invoice_number,.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-pdf_invoice_number:not(.check-column){display:none}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-pdf_invoice_number{padding:3px 8px 3px 35%}}#wpo_wcpdf-data-input-box>.inside{margin:0;padding:10px 0;background-color:#f8f8f8}#wpo_wcpdf-data-input-box h4{font-size:14px;line-height:1.4;margin:0}#wpo_wcpdf-data-input-box p{margin:.5em 0}#wpo_wcpdf-data-input-box .form-field input{width:auto}.wcpdf-data-fields{margin-left:10px;margin-right:10px;margin-bottom:10px;background-color:#fff;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgba(0,0,0,.04)}.wcpdf-data-fields:last-child{margin-bottom:0}.wcpdf-data-fields .read-only{height:auto;display:block;padding:10px}.wcpdf-data-fields .editable,.wcpdf-data-fields .editable-notes{height:auto;display:none;padding:10px}.wcpdf-data-fields h4{padding:10px;border-bottom:1px solid #dfdfdf}.wcpdf-data-fields h4 .dashicons:first-of-type{margin-left:20px!important}.wcpdf-data-fields .wpo-wcpdf-delete-document,.wcpdf-data-fields .wpo-wcpdf-edit-date-number,.wcpdf-data-fields .wpo-wcpdf-edit-document-notes,.wcpdf-data-fields .wpo-wcpdf-regenerate-document{opacity:.5}.wcpdf-data-fields .wpo-wcpdf-delete-document:hover,.wcpdf-data-fields .wpo-wcpdf-edit-date-number:hover,.wcpdf-data-fields .wpo-wcpdf-edit-document-notes:hover,.wcpdf-data-fields .wpo-wcpdf-regenerate-document:hover{opacity:1;cursor:pointer}.wcpdf-data-fields .wpo-wcpdf-document-buttons{display:none;padding:10px;border-top:1px solid #dfdfdf}.wcpdf-data-fields h4 .wcpdf-regenerate-spin{opacity:1;-webkit-animation:spin 1.6s linear infinite;animation:spin 1.6s linear infinite;pointer-events:none}@-webkit-keyframes wcpdf-regenerate-spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(-360deg)}}@keyframes wcpdf-regenerate-spin{0%{transform:rotate(0)}100%{transform:rotate(-360deg)}}
1
+ .type-shop_order .column-wc_actions a.button.wpo_wcpdf{padding:3px 2px 1px 1px!important}.type-shop_order .column-wc_actions a.button.wpo_wcpdf.exists::after{content:"\f147";position:absolute;font-size:16px;left:7px;color:#2aad2a}.wpo_wcpdf-actions a.button.exists::after{font-family:Dashicons;content:"\f147";font-size:125%;line-height:80%;margin-left:4px;color:#2aad2a;vertical-align:middle}.type-shop_order .column-order_actions a.button.wpo_wcpdf img,.type-shop_order .column-wc_actions a.button.wpo_wcpdf img{width:16px}.widefat .column-pdf_invoice_number{width:110px}@media screen and (max-width:782px){.wp-list-table .column-pdf_invoice_number,.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-pdf_invoice_number:not(.check-column){display:none}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-pdf_invoice_number{padding:3px 8px 3px 35%}}#wpo_wcpdf-data-input-box>.inside{margin:0;padding:10px 0;background-color:#f8f8f8}#wpo_wcpdf-data-input-box h4{font-size:14px;line-height:1.4;margin:0}#wpo_wcpdf-data-input-box p{margin:.5em 0}#wpo_wcpdf-data-input-box .form-field input{width:auto}.wcpdf-data-fields{margin-left:10px;margin-right:10px;margin-bottom:10px;background-color:#fff;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgba(0,0,0,.04)}.wcpdf-data-fields:last-child{margin-bottom:0}.wcpdf-data-fields .read-only{height:auto;display:block;padding:10px}.wcpdf-data-fields .editable,.wcpdf-data-fields .editable-notes{height:auto;display:none;padding:10px}.wcpdf-data-fields h4{padding:10px;border-bottom:1px solid #dfdfdf}.wcpdf-data-fields h4 .dashicons:first-of-type{margin-left:20px!important}.wcpdf-data-fields .wpo-wcpdf-delete-document,.wcpdf-data-fields .wpo-wcpdf-edit-date-number,.wcpdf-data-fields .wpo-wcpdf-edit-document-notes,.wcpdf-data-fields .wpo-wcpdf-regenerate-document{opacity:.5}.wcpdf-data-fields .wpo-wcpdf-delete-document:hover,.wcpdf-data-fields .wpo-wcpdf-edit-date-number:hover,.wcpdf-data-fields .wpo-wcpdf-edit-document-notes:hover,.wcpdf-data-fields .wpo-wcpdf-regenerate-document:hover{opacity:1;cursor:pointer}.wcpdf-data-fields .wpo-wcpdf-document-buttons{display:none;padding:10px;border-top:1px solid #dfdfdf}.wcpdf-data-fields h4 .wcpdf-regenerate-spin{opacity:1;-webkit-animation:spin 1.6s linear infinite;animation:spin 1.6s linear infinite;pointer-events:none}@-webkit-keyframes wcpdf-regenerate-spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(-360deg)}}@keyframes wcpdf-regenerate-spin{0%{transform:rotate(0)}100%{transform:rotate(-360deg)}}
includes/documents/abstract-wcpdf-order-document.php CHANGED
@@ -1026,7 +1026,7 @@ abstract class Order_Document {
1026
  */
1027
  public function maybe_retire_number_store( $date, $store_base_name, $method ) {
1028
  global $wpdb;
1029
- $wpdb->hide_errors(); // if we encounter errors, we'll log them instead
1030
 
1031
  $default_table_name = $this->get_number_store_table_default_name( $store_base_name, $method );
1032
  $now = new \WC_DateTime( 'now', new \DateTimeZone( 'UTC' ) );
@@ -1035,7 +1035,7 @@ abstract class Order_Document {
1035
  $requested_year = intval( $date->date_i18n( 'Y' ) );
1036
 
1037
  // nothing to retire if requested year matches current store year or if current store year is not in the past
1038
- if ( $requested_year == $current_store_year || ! ( $current_store_year < $current_year ) ) {
1039
  return $current_store_year;
1040
  }
1041
 
@@ -1077,6 +1077,10 @@ abstract class Order_Document {
1077
  }
1078
  }
1079
 
 
 
 
 
1080
  // current store year has been updated to current year, returning this means no year suffix has to be used
1081
  return $current_year;
1082
  }
@@ -1089,21 +1093,31 @@ abstract class Order_Document {
1089
  */
1090
  public function get_number_store_year( $table_name ) {
1091
  global $wpdb;
1092
- $wpdb->hide_errors(); // if we encounter errors, we'll log them instead
1093
 
1094
  $current_year = date_i18n( 'Y' );
1095
  $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'") == $table_name;
1096
  if( $table_exists ) {
1097
  // get year for the last row
1098
  $year = $wpdb->get_var( "SELECT YEAR(date) FROM {$table_name} ORDER BY id DESC LIMIT 1" );
 
1099
  if( ! $year ) {
1100
- wcpdf_log_error( sprintf( __( 'An error occurred while trying to get the current year from the %s table: %s', 'woocommerce-pdf-invoices-packing-slips' ), $table_name, $wpdb->last_error ) );
1101
  $year = $current_year;
 
 
 
 
 
 
1102
  }
1103
  } else {
1104
  $year = $current_year;
1105
  }
1106
 
 
 
 
 
1107
  return intval( $year );
1108
  }
1109
 
1026
  */
1027
  public function maybe_retire_number_store( $date, $store_base_name, $method ) {
1028
  global $wpdb;
1029
+ $was_showing_errors = $wpdb->hide_errors(); // if we encounter errors, we'll log them instead
1030
 
1031
  $default_table_name = $this->get_number_store_table_default_name( $store_base_name, $method );
1032
  $now = new \WC_DateTime( 'now', new \DateTimeZone( 'UTC' ) );
1035
  $requested_year = intval( $date->date_i18n( 'Y' ) );
1036
 
1037
  // nothing to retire if requested year matches current store year or if current store year is not in the past
1038
+ if ( empty( $current_store_year ) || $requested_year == $current_store_year || ! ( $current_store_year < $current_year ) ) {
1039
  return $current_store_year;
1040
  }
1041
 
1077
  }
1078
  }
1079
 
1080
+ if( $was_showing_errors ) {
1081
+ $wpdb->show_errors();
1082
+ }
1083
+
1084
  // current store year has been updated to current year, returning this means no year suffix has to be used
1085
  return $current_year;
1086
  }
1093
  */
1094
  public function get_number_store_year( $table_name ) {
1095
  global $wpdb;
1096
+ $was_showing_errors = $wpdb->hide_errors(); // if we encounter errors, we'll log them instead
1097
 
1098
  $current_year = date_i18n( 'Y' );
1099
  $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'") == $table_name;
1100
  if( $table_exists ) {
1101
  // get year for the last row
1102
  $year = $wpdb->get_var( "SELECT YEAR(date) FROM {$table_name} ORDER BY id DESC LIMIT 1" );
1103
+ // default to currenty year if no results
1104
  if( ! $year ) {
 
1105
  $year = $current_year;
1106
+ // if we don't get a result, this could either mean there's an error,
1107
+ // OR that the first number simply has not been created yet (=no rows)
1108
+ // we only log when there's an actual error
1109
+ if( ! empty( $wpdb->last_error ) ) {
1110
+ wcpdf_log_error( sprintf( __( 'An error occurred while trying to get the current year from the %s table: %s', 'woocommerce-pdf-invoices-packing-slips' ), $table_name, $wpdb->last_error ) );
1111
+ }
1112
  }
1113
  } else {
1114
  $year = $current_year;
1115
  }
1116
 
1117
+ if( $was_showing_errors ) {
1118
+ $wpdb->show_errors();
1119
+ }
1120
+
1121
  return intval( $year );
1122
  }
1123
 
includes/documents/class-wcpdf-sequential-number-store.php CHANGED
@@ -45,7 +45,7 @@ class Sequential_Number_Store {
45
  global $wpdb;
46
  $this->store_name = $store_name;
47
  $this->method = $method;
48
- $this->table_name = apply_filters( "wpo_wcpdf_number_store_table_name", "{$wpdb->prefix}wcpdf_{$store_name}", $store_name, $method ); // i.e. wp_wcpdf_invoice_number_2021
49
 
50
  $this->init();
51
  }
45
  global $wpdb;
46
  $this->store_name = $store_name;
47
  $this->method = $method;
48
+ $this->table_name = apply_filters( "wpo_wcpdf_number_store_table_name", "{$wpdb->prefix}wcpdf_{$store_name}", $store_name, $method ); // e.g. wp_wcpdf_invoice_number
49
 
50
  $this->init();
51
  }
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.8
7
  Requires PHP: 7.1
8
- Stable tag: 2.11.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.11.0 =
106
  * New: Use year-based number stores for future and past years to handle yearly resets more reliably
107
  * Fix: PHP iconv fallback for custom PHP builds without this function
5
  Requires at least: 3.5
6
  Tested up to: 5.8
7
  Requires PHP: 7.1
8
+ Stable tag: 2.11.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.11.1 =
106
+ * Fix: Errors were incorrectly logged after installation when no invoices had been created yet
107
+ * Fix: Button styles in order backend
108
+
109
  = 2.11.0 =
110
  * New: Use year-based number stores for future and past years to handle yearly resets more reliably
111
  * Fix: PHP iconv fallback for custom PHP builds without this function
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.11.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.11.0';
25
  public $plugin_basename;
26
  public $legacy_mode;
27
  public $legacy_textdomain;
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.11.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.11.1';
25
  public $plugin_basename;
26
  public $legacy_mode;
27
  public $legacy_textdomain;