WooCommerce PDF Invoices - Version 3.0.5

Version Description

  • May 31, 2019 =

  • Fixed: Sequential invoice numbering not incrementing.

Download this release

Release Info

Developer baaaaas
Plugin Icon 128x128 WooCommerce PDF Invoices
Version 3.0.5
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.5

bootstrap.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: WooCommerce PDF Invoices
4
* Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
5
* Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
6
- * Version: 3.0.2
7
* Author: Bas Elbers
8
* Author URI: http://wcpdfinvoices.com
9
* License: GPL-2.0+
@@ -11,12 +11,12 @@
11
* Text Domain: woocommerce-pdf-invoices
12
* Domain Path: /lang
13
* WC requires at least: 3.0.0
14
- * WC tested up to: 3.6.2
15
*/
16
17
defined( 'ABSPATH' ) || exit;
18
19
- define( 'WPI_VERSION', '3.0.2' );
20
21
/**
22
* Load WooCommerce PDF Invoices plugin.
3
* Plugin Name: WooCommerce PDF Invoices
4
* Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
5
* Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
6
+ * Version: 3.0.5
7
* Author: Bas Elbers
8
* Author URI: http://wcpdfinvoices.com
9
* License: GPL-2.0+
11
* Text Domain: woocommerce-pdf-invoices
12
* Domain Path: /lang
13
* WC requires at least: 3.0.0
14
+ * WC tested up to: 3.6.4
15
*/
16
17
defined( 'ABSPATH' ) || exit;
18
19
+ define( 'WPI_VERSION', '3.0.5' );
20
21
/**
22
* Load WooCommerce PDF Invoices plugin.
includes/abstracts/abstract-invoice.php CHANGED
@@ -67,8 +67,8 @@ abstract class BEWPI_Abstract_Invoice extends BEWPI_Abstract_Document {
67
*/
68
public function __construct( $order_id ) {
69
parent::__construct();
70
$this->number = get_post_meta( $order_id, '_bewpi_invoice_number', true );
71
- $this->date = apply_filters( 'wpi_invoice_date', get_post_meta( $order_id, '_bewpi_invoice_date', true ), $this );
72
$this->year = date_i18n( 'Y', strtotime( $this->date ) );
73
$this->full_path = self::exists( $order_id );
74
$this->filename = basename( $this->full_path );
@@ -293,7 +293,7 @@ abstract class BEWPI_Abstract_Invoice extends BEWPI_Abstract_Document {
293
}
294
295
if ( empty( $this->date ) ) {
296
- $this->date = current_time( 'mysql' );
297
}
298
299
$pdf_path = $this->get_rel_pdf_path() . '/' . $this->get_formatted_number() . '.pdf';
67
*/
68
public function __construct( $order_id ) {
69
parent::__construct();
70
+ $this->date = get_post_meta( $order_id, '_bewpi_invoice_date', true );
71
$this->number = get_post_meta( $order_id, '_bewpi_invoice_number', true );
72
$this->year = date_i18n( 'Y', strtotime( $this->date ) );
73
$this->full_path = self::exists( $order_id );
74
$this->filename = basename( $this->full_path );
293
}
294
295
if ( empty( $this->date ) ) {
296
+ $this->date = apply_filters( 'wpi_invoice_date', current_time( 'mysql' ), $this );
297
}
298
299
$pdf_path = $this->get_rel_pdf_path() . '/' . $this->get_formatted_number() . '.pdf';
includes/admin/class-admin-notices.php CHANGED
@@ -57,7 +57,7 @@ class BEWPI_Admin_Notices {
57
}
58
59
if ( wp_verify_nonce( sanitize_key( $_POST['nonce'] ), $action ) ) {
60
- set_site_transient( WPI()::PREFIX . $action, 1 );
61
}
62
}
63
57
}
58
59
if ( wp_verify_nonce( sanitize_key( $_POST['nonce'] ), $action ) ) {
60
+ set_site_transient( WPI()->get_plugin_prefix() . $action, 1 );
61
}
62
}
63
includes/admin/settings/class-template.php CHANGED
@@ -144,7 +144,7 @@ class BEWPI_Template_Settings extends BEWPI_Abstract_Settings {
144
'section' => 'general',
145
'type' => 'text',
146
'desc' => sprintf( __( '<a href="%s">Format</a> of invoice date and order date.', 'woocommerce-pdf-invoices' ), 'http://php.net/manual/en/datetime.formats.date.php' ),
147
- 'default' => get_option( 'date_format' ),
148
'attrs' => array( 'required' ),
149
),
150
array(
@@ -234,8 +234,8 @@ class BEWPI_Template_Settings extends BEWPI_Abstract_Settings {
234
'page' => $this->settings_key,
235
'section' => 'header',
236
'type' => 'text',
237
- 'desc' => sprintf( __( 'Allowed HTML tags: %s.', 'woocommerce-pdf-invoices' ), self::formatted_html_tags() ),
238
- 'default' => '',
239
),
240
array(
241
'id' => 'bewpi-company-details',
144
'section' => 'general',
145
'type' => 'text',
146
'desc' => sprintf( __( '<a href="%s">Format</a> of invoice date and order date.', 'woocommerce-pdf-invoices' ), 'http://php.net/manual/en/datetime.formats.date.php' ),
147
+ 'default' => 'Y-m-d H:i:s',
148
'attrs' => array( 'required' ),
149
),
150
array(
234
'page' => $this->settings_key,
235
'section' => 'header',
236
'type' => 'text',
237
+ 'desc' => sprintf( __( 'Allowed HTML tags: %s. Since WooCommerce +3.0 this setting is ignored and the WooCommerce store address is used.', 'woocommerce-pdf-invoices' ), self::formatted_html_tags() ),
238
+ 'default' => BEWPI_WC_Core_Compatibility::is_wc_version_gte_3_0() ? WPI()->get_formatted_base_address() : '',
239
),
240
array(
241
'id' => 'bewpi-company-details',
includes/templates/invoice/simple/minimal/header.php CHANGED
@@ -14,12 +14,6 @@
14
* @package WooCommerce_PDF_Invoices/Templates
15
* @version 0.0.1
16
*/
17
-
18
- $templater = WPI()->templater();
19
- $invoice = $templater->invoice;
20
- $company_phone = WPI()->get_option( 'template', 'company_phone' );
21
- $company_email_address = WPI()->get_option( 'template', 'company_email_address' );
22
- $company_vat_id = WPI()->get_option( 'template', 'company_vat_id' );
23
?>
24
25
<table cellpadding="0" cellspacing="0">
@@ -35,25 +29,7 @@ $company_vat_id = WPI()->get_option( 'template', 'company_vat_id' );
35
</td>
36
37
<td>
38
- <?php
39
- if ( BEWPI_WC_Core_Compatibility::is_wc_version_gte_3_0() ) {
40
- echo WPI()->get_formatted_base_address();
41
- } else {
42
- echo nl2br( WPI()->get_option( 'template', 'company_address' ) ) . '<br>';
43
- }
44
-
45
- if ( ! empty( $company_phone ) ) {
46
- echo sprintf( __( 'Phone: %s', 'woocommerce-pdf-invoices' ), $company_phone ) . '<br>';
47
- }
48
-
49
- if ( ! empty( $company_email_address ) ) {
50
- echo sprintf( __( 'Email: %s', 'woocommerce-pdf-invoices' ), $company_email_address ) . '<br>';
51
- }
52
-
53
- if ( ! empty( $company_vat_id ) ) {
54
- printf( __( 'VAT ID: %s', 'woocommerce-pdf-invoices' ), $company_vat_id );
55
- }
56
- ?>
57
</td>
58
</tr>
59
</table>
14
* @package WooCommerce_PDF_Invoices/Templates
15
* @version 0.0.1
16
*/
17
?>
18
19
<table cellpadding="0" cellspacing="0">
29
</td>
30
31
<td>
32
+ <?php echo WPI()->get_formatted_company_address(); ?>
33
</td>
34
</tr>
35
</table>
includes/templates/packing-slip/simple/minimal/body.php CHANGED
@@ -42,6 +42,12 @@ $color = $templater->get_option( 'bewpi_color_theme' );
42
printf( '<br />' );
43
printf( __( 'Shipping Method: %s', 'woocommerce-pdf-invoices' ), $shipping_method );
44
}
45
?>
46
</td>
47
42
printf( '<br />' );
43
printf( __( 'Shipping Method: %s', 'woocommerce-pdf-invoices' ), $shipping_method );
44
}
45
+
46
+ $payment_method = $order->get_payment_method_title();
47
+ if ( $payment_method ) {
48
+ printf( '<br />' );
49
+ printf( __( 'Payment Method: %s', 'woocommerce-pdf-invoices' ), $payment_method );
50
+ }
51
?>
52
</td>
53
includes/templates/packing-slip/simple/minimal/header.php CHANGED
@@ -14,10 +14,6 @@
14
* @package WooCommerce_PDF_Invoices/Templates
15
* @version 0.0.1
16
*/
17
-
18
- $company_phone = WPI()->get_option( 'template', 'company_phone' );
19
- $company_email_address = WPI()->get_option( 'template', 'company_email_address' );
20
- $company_vat_id = WPI()->get_option( 'template', 'company_vat_id' );
21
?>
22
23
<table>
@@ -33,25 +29,7 @@ $company_vat_id = WPI()->get_option( 'template', 'company_vat_id' );
33
</td>
34
35
<td>
36
- <?php
37
- if ( BEWPI_WC_Core_Compatibility::is_wc_version_gte_3_0() ) {
38
- echo WPI()->get_formatted_base_address();
39
- } else {
40
- echo nl2br( WPI()->get_option( 'template', 'company_address' ) ) . '<br>';
41
- }
42
-
43
- if ( ! empty( $company_phone ) ) {
44
- echo sprintf( __( 'Phone: %s', 'woocommerce-pdf-invoices' ), $company_phone ) . '<br>';
45
- }
46
-
47
- if ( ! empty( $company_email_address ) ) {
48
- echo sprintf( __( 'Email: %s', 'woocommerce-pdf-invoices' ), $company_email_address ) . '<br>';
49
- }
50
-
51
- if ( ! empty( $company_vat_id ) ) {
52
- printf( __( 'VAT ID: %s', 'woocommerce-pdf-invoices' ), $company_vat_id );
53
- }
54
- ?>
55
</td>
56
</tr>
57
</table>
14
* @package WooCommerce_PDF_Invoices/Templates
15
* @version 0.0.1
16
*/
17
?>
18
19
<table>
29
</td>
30
31
<td>
32
+ <?php echo WPI()->get_formatted_company_address(); ?>
33
</td>
34
</tr>
35
</table>
includes/woocommerce-pdf-invoices.php CHANGED
@@ -44,13 +44,6 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
44
*/
45
public $settings = array();
46
47
- /**
48
- * Prefix.
49
- *
50
- * @var string.
51
- */
52
- private $prefix = 'wpi_';
53
-
54
/**
55
* Main BE_WooCommerce_PDF_Invoices instance.
56
*
@@ -763,7 +756,7 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
763
}
764
765
// display button to view invoice in debug mode.
766
- if ( (bool) WPI()->get_option( 'general', 'mpdf_debug' ) ) {
767
$this->show_invoice_button( __( 'Debug', 'woocommerce-pdf-invoices' ), $post->ID, 'debug', array(
768
'class="button grant_access order-page invoice wpi"',
769
'target="_blank"',
@@ -1034,12 +1027,12 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
1034
}
1035
1036
/**
1037
- * Get prefix.
1038
*
1039
* @return string
1040
*/
1041
- public function get_prefix() {
1042
- return $this->prefix;
1043
}
1044
1045
/**
@@ -1058,7 +1051,7 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
1058
*/
1059
public function get_formatted_base_address() {
1060
$address = array(
1061
- 'company' => WPI()->get_option( 'template', 'company_name' ),
1062
'address_1' => WC()->countries->get_base_address(),
1063
'address_2' => WC()->countries->get_base_address_2(),
1064
'city' => WC()->countries->get_base_city(),
@@ -1070,6 +1063,37 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
1070
return WC()->countries->get_formatted_address( $address ) . '<br>';
1071
}
1072
1073
/**
1074
* Templater instance.
1075
*
44
*/
45
public $settings = array();
46
47
/**
48
* Main BE_WooCommerce_PDF_Invoices instance.
49
*
756
}
757
758
// display button to view invoice in debug mode.
759
+ if ( (bool) WPI()->get_option( 'debug', 'mpdf_debug' ) ) {
760
$this->show_invoice_button( __( 'Debug', 'woocommerce-pdf-invoices' ), $post->ID, 'debug', array(
761
'class="button grant_access order-page invoice wpi"',
762
'target="_blank"',
1027
}
1028
1029
/**
1030
+ * Get plugin prefix.
1031
*
1032
* @return string
1033
*/
1034
+ public function get_plugin_prefix() {
1035
+ return self::PREFIX;
1036
}
1037
1038
/**
1051
*/
1052
public function get_formatted_base_address() {
1053
$address = array(
1054
+ 'company' => self::get_option( 'template', 'company_name' ),
1055
'address_1' => WC()->countries->get_base_address(),
1056
'address_2' => WC()->countries->get_base_address_2(),
1057
'city' => WC()->countries->get_base_city(),
1063
return WC()->countries->get_formatted_address( $address ) . '<br>';
1064
}
1065
1066
+ /**
1067
+ * Get formatted company address.
1068
+ *
1069
+ * @return string
1070
+ */
1071
+ public function get_formatted_company_address() {
1072
+ $company_phone = self::get_option( 'template', 'company_phone' );
1073
+ $company_email_address = self::get_option( 'template', 'company_email_address' );
1074
+ $company_vat_id = self::get_option( 'template', 'company_vat_id' );
1075
+
1076
+ if ( BEWPI_WC_Core_Compatibility::is_wc_version_gte_3_0() ) {
1077
+ $formatted_company_address = self::get_formatted_base_address();
1078
+ } else {
1079
+ $formatted_company_address = nl2br( self::get_option( 'template', 'company_address' ) ) . '<br>';
1080
+ }
1081
+
1082
+ if ( ! empty( $company_phone ) ) {
1083
+ $formatted_company_address .= sprintf( __( 'Phone: %s', 'woocommerce-pdf-invoices' ), $company_phone ) . '<br>';
1084
+ }
1085
+
1086
+ if ( ! empty( $company_email_address ) ) {
1087
+ $formatted_company_address .= sprintf( __( 'Email: %s', 'woocommerce-pdf-invoices' ), $company_email_address ) . '<br>';
1088
+ }
1089
+
1090
+ if ( ! empty( $company_vat_id ) ) {
1091
+ $formatted_company_address .= sprintf( __( 'VAT ID: %s', 'woocommerce-pdf-invoices' ), $company_vat_id );
1092
+ }
1093
+
1094
+ return $formatted_company_address;
1095
+ }
1096
+
1097
/**
1098
* Templater instance.
1099
*
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: baaaaas
3
Donate link:
4
Tags: woocommerce pdf invoices, invoice, packing slips, delivery note, packing list, shipping list, generate, pdf, woocommerce, attachment, email, customer invoice, processing, vat, tax, sequential, number, dropbox, google drive, onedrive, egnyte, cloud, storage
5
Requires at least: 4.0
6
- Tested up to: 5.1
7
- Stable tag: 3.0.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -344,6 +344,20 @@ Since version 2.9.4 the plugin removed the ability to update the PDF invoice whe
344
345
== Changelog ==
346
347
= 3.0.2 - April 25, 2019 =
348
349
- Fixed: Using order number as invoice number.
3
Donate link:
4
Tags: woocommerce pdf invoices, invoice, packing slips, delivery note, packing list, shipping list, generate, pdf, woocommerce, attachment, email, customer invoice, processing, vat, tax, sequential, number, dropbox, google drive, onedrive, egnyte, cloud, storage
5
Requires at least: 4.0
6
+ Tested up to: 5.2
7
+ Stable tag: 3.0.5
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
344
345
== Changelog ==
346
347
+ = 3.0.5 - May 31, 2019 =
348
+
349
+ - Fixed: Sequential invoice numbering not incrementing.
350
+
351
+ = 3.0.4 - May 21, 2019 =
352
+
353
+ - Fixed: Moving get_formatted_base_address() to WPI() instance.
354
+
355
+ = 3.0.3 - May 20, 2019 =
356
+
357
+ - Improved: Renamed 'wpi_invoice_date' filter to 'wpi_invoice_custom_date'.
358
+ - Fixed: Debug button not showing on edit order page.
359
+ - Fixed: Accessing constant directly from function causing syntax errors.
360
+
361
= 3.0.2 - April 25, 2019 =
362
363
- Fixed: Using order number as invoice number.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
5
require_once __DIR__ . '/composer/autoload_real.php';
6
7
- return ComposerAutoloaderInit2dfb663e276989d32c4a979db3885f92::getLoader();
4
5
require_once __DIR__ . '/composer/autoload_real.php';
6
7
+ return ComposerAutoloaderInit45cf95829fd07145c60ebe1d126688a8::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
5
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
7
- return ComposerAutoloaderInit5162be7df6bd906625bdc568b9222fb4::getLoader();
4
5
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
7
+ return ComposerAutoloaderInit0f02450610b8e9fc1a93d22bdebc9db9::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
3
// autoload_real.php @generated by Composer
4
5
- class ComposerAutoloaderInit2dfb663e276989d32c4a979db3885f92
6
{
7
private static $loader;
8
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit2dfb663e276989d32c4a979db3885f92
19
return self::$loader;
20
}
21
22
- spl_autoload_register(array('ComposerAutoloaderInit2dfb663e276989d32c4a979db3885f92', 'loadClassLoader'), true, true);
23
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit2dfb663e276989d32c4a979db3885f92', 'loadClassLoader'));
25
26
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
if ($useStaticLoader) {
28
require_once __DIR__ . '/autoload_static.php';
29
30
- call_user_func(\Composer\Autoload\ComposerStaticInit2dfb663e276989d32c4a979db3885f92::getInitializer($loader));
31
} else {
32
$map = require __DIR__ . '/autoload_namespaces.php';
33
foreach ($map as $namespace => $path) {
2
3
// autoload_real.php @generated by Composer
4
5
+ class ComposerAutoloaderInit45cf95829fd07145c60ebe1d126688a8
6
{
7
private static $loader;
8
19
return self::$loader;
20
}
21
22
+ spl_autoload_register(array('ComposerAutoloaderInit45cf95829fd07145c60ebe1d126688a8', 'loadClassLoader'), true, true);
23
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit45cf95829fd07145c60ebe1d126688a8', 'loadClassLoader'));
25
26
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
if ($useStaticLoader) {
28
require_once __DIR__ . '/autoload_static.php';
29
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit45cf95829fd07145c60ebe1d126688a8::getInitializer($loader));
31
} else {
32
$map = require __DIR__ . '/autoload_namespaces.php';
33
foreach ($map as $namespace => $path) {
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
3
// autoload_real_52.php generated by xrstf/composer-php52
4
5
- class ComposerAutoloaderInit5162be7df6bd906625bdc568b9222fb4 {
6
private static $loader;
7
8
public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit5162be7df6bd906625bdc568b9222fb4 {
19
return self::$loader;
20
}
21
22
- spl_autoload_register(array('ComposerAutoloaderInit5162be7df6bd906625bdc568b9222fb4', 'loadClassLoader'), true /*, true */);
23
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5162be7df6bd906625bdc568b9222fb4', 'loadClassLoader'));
25
26
$vendorDir = dirname(dirname(__FILE__));
27
$baseDir = dirname($vendorDir);
2
3
// autoload_real_52.php generated by xrstf/composer-php52
4
5
+ class ComposerAutoloaderInit0f02450610b8e9fc1a93d22bdebc9db9 {
6
private static $loader;
7
8
public static function loadClassLoader($class) {
19
return self::$loader;
20
}
21
22
+ spl_autoload_register(array('ComposerAutoloaderInit0f02450610b8e9fc1a93d22bdebc9db9', 'loadClassLoader'), true /*, true */);
23
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0f02450610b8e9fc1a93d22bdebc9db9', 'loadClassLoader'));
25
26
$vendorDir = dirname(dirname(__FILE__));
27
$baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
5
namespace Composer\Autoload;
6
7
- class ComposerStaticInit2dfb663e276989d32c4a979db3885f92
8
{
9
public static $prefixesPsr0 = array (
10
'x' =>
@@ -73,8 +73,8 @@ class ComposerStaticInit2dfb663e276989d32c4a979db3885f92
73
public static function getInitializer(ClassLoader $loader)
74
{
75
return \Closure::bind(function () use ($loader) {
76
- $loader->prefixesPsr0 = ComposerStaticInit2dfb663e276989d32c4a979db3885f92::$prefixesPsr0;
77
- $loader->classMap = ComposerStaticInit2dfb663e276989d32c4a979db3885f92::$classMap;
78
79
}, null, ClassLoader::class);
80
}
4
5
namespace Composer\Autoload;
6
7
+ class ComposerStaticInit45cf95829fd07145c60ebe1d126688a8
8
{
9
public static $prefixesPsr0 = array (
10
'x' =>
73
public static function getInitializer(ClassLoader $loader)
74
{
75
return \Closure::bind(function () use ($loader) {
76
+ $loader->prefixesPsr0 = ComposerStaticInit45cf95829fd07145c60ebe1d126688a8::$prefixesPsr0;
77
+ $loader->classMap = ComposerStaticInit45cf95829fd07145c60ebe1d126688a8::$classMap;
78
79
}, null, ClassLoader::class);
80
}