Version Description
- Tweak: include plugin version in style/script includes
- Tweak: upload code cleanup
- Fix: Parent invoice number (for Credit Notes in professional extension)
Download this release
Release Info
Developer | pomegranate |
Plugin | WooCommerce PDF Invoices & Packing Slips |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- includes/class-wcpdf-settings.php +13 -2
- includes/class-wcpdf-writepanels.php +18 -3
- includes/wcpdf-extensions.php +2 -1
- js/media-upload.js +18 -18
- readme.txt +7 -2
- woocommerce-pdf-invoices-packingslips.php +10 -4
includes/class-wcpdf-settings.php
CHANGED
@@ -57,8 +57,19 @@ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Settings' ) ) {
|
|
57 |
if( $hook != $this->options_page_hook )
|
58 |
return;
|
59 |
|
60 |
-
wp_enqueue_script(
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
wp_enqueue_media();
|
63 |
}
|
64 |
|
57 |
if( $hook != $this->options_page_hook )
|
58 |
return;
|
59 |
|
60 |
+
wp_enqueue_script(
|
61 |
+
'wcpdf-upload-js',
|
62 |
+
plugins_url( 'js/media-upload.js' , dirname(__FILE__) ),
|
63 |
+
array( 'jquery' ),
|
64 |
+
WooCommerce_PDF_Invoices::$version
|
65 |
+
);
|
66 |
+
|
67 |
+
wp_enqueue_style(
|
68 |
+
'wpo-wcpdf',
|
69 |
+
WooCommerce_PDF_Invoices::$plugin_url . 'css/style.css',
|
70 |
+
array(),
|
71 |
+
WooCommerce_PDF_Invoices::$version
|
72 |
+
);
|
73 |
wp_enqueue_media();
|
74 |
}
|
75 |
|
includes/class-wcpdf-writepanels.php
CHANGED
@@ -43,9 +43,19 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices_Writepanels' ) ) {
|
|
43 |
|
44 |
if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
|
45 |
// WC 2.1 or newer (MP6) is used: bigger buttons
|
46 |
-
wp_enqueue_style(
|
|
|
|
|
|
|
|
|
|
|
47 |
} else {
|
48 |
-
wp_enqueue_style(
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
}
|
@@ -56,7 +66,12 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices_Writepanels' ) ) {
|
|
56 |
*/
|
57 |
public function add_scripts() {
|
58 |
if( $this->is_order_edit_page() ) {
|
59 |
-
wp_enqueue_script(
|
|
|
|
|
|
|
|
|
|
|
60 |
wp_localize_script(
|
61 |
'wpo-wcpdf',
|
62 |
'wpo_wcpdf_ajax',
|
43 |
|
44 |
if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
|
45 |
// WC 2.1 or newer (MP6) is used: bigger buttons
|
46 |
+
wp_enqueue_style(
|
47 |
+
'wpo-wcpdf',
|
48 |
+
WooCommerce_PDF_Invoices::$plugin_url . 'css/style-wc21.css',
|
49 |
+
array(),
|
50 |
+
WooCommerce_PDF_Invoices::$version
|
51 |
+
);
|
52 |
} else {
|
53 |
+
wp_enqueue_style(
|
54 |
+
'wpo-wcpdf',
|
55 |
+
WooCommerce_PDF_Invoices::$plugin_url . 'css/style.css',
|
56 |
+
array(),
|
57 |
+
WooCommerce_PDF_Invoices::$version
|
58 |
+
);
|
59 |
}
|
60 |
|
61 |
}
|
66 |
*/
|
67 |
public function add_scripts() {
|
68 |
if( $this->is_order_edit_page() ) {
|
69 |
+
wp_enqueue_script(
|
70 |
+
'wpo-wcpdf',
|
71 |
+
WooCommerce_PDF_Invoices::$plugin_url . 'js/script.js',
|
72 |
+
array( 'jquery' ),
|
73 |
+
WooCommerce_PDF_Invoices::$version
|
74 |
+
);
|
75 |
wp_localize_script(
|
76 |
'wpo-wcpdf',
|
77 |
'wpo_wcpdf_ajax',
|
includes/wcpdf-extensions.php
CHANGED
@@ -25,7 +25,8 @@ jQuery(document).ready(function() {
|
|
25 |
<?php _e( 'Supercharge WooCommerce PDF Invoices & Packing Slips with the following features:', 'wpo_wcpdf' ); ?>
|
26 |
<ul>
|
27 |
<li><?php _e( 'Email/print/download <b>PDF Credit Notes & Proforma invoices</b>', 'wpo_wcpdf' ); ?></li>
|
28 |
-
<li><?php _e( '
|
|
|
29 |
<li><?php _e( 'Use <b>separate numbering systems</b> and/or format for proforma invoices and credit notes or utilize the main invoice numbering system', 'wpo_wcpdf' ); ?></li>
|
30 |
<li><?php _e( '<b>Customize</b> the <b>shipping & billing address</b> format to include additional custom fields, font sizes etc. without the need to create a custom template.', 'wpo_wcpdf' ); ?></li>
|
31 |
<li><?php _e( 'Use the plugin in multilingual <b>WPML</b> setups', 'wpo_wcpdf' ); ?></li>
|
25 |
<?php _e( 'Supercharge WooCommerce PDF Invoices & Packing Slips with the following features:', 'wpo_wcpdf' ); ?>
|
26 |
<ul>
|
27 |
<li><?php _e( 'Email/print/download <b>PDF Credit Notes & Proforma invoices</b>', 'wpo_wcpdf' ); ?></li>
|
28 |
+
<li><?php _e( 'Send out a separate <b>notification email</b> with (or without) PDF invoices/packing slips, for example to a drop-shipper or a supplier.', 'wpo_wcpdf' ); ?></li>
|
29 |
+
<li><?php _e( 'Attach <b>up to 3 static files</b> (for example a terms & conditions document) to the WooCommerce emails of your choice.', 'wpo_wcpdf' ); ?></li>
|
30 |
<li><?php _e( 'Use <b>separate numbering systems</b> and/or format for proforma invoices and credit notes or utilize the main invoice numbering system', 'wpo_wcpdf' ); ?></li>
|
31 |
<li><?php _e( '<b>Customize</b> the <b>shipping & billing address</b> format to include additional custom fields, font sizes etc. without the need to create a custom template.', 'wpo_wcpdf' ); ?></li>
|
32 |
<li><?php _e( 'Use the plugin in multilingual <b>WPML</b> setups', 'wpo_wcpdf' ); ?></li>
|
js/media-upload.js
CHANGED
@@ -6,15 +6,15 @@ jQuery(document).ready(function($) {
|
|
6 |
// Uploading files
|
7 |
var file_frame;
|
8 |
|
9 |
-
|
10 |
|
11 |
// get input field id from data-input_id
|
12 |
-
input_id = '#'
|
13 |
-
input_id_class = '.'
|
14 |
-
input_id_clean =
|
15 |
|
16 |
// get remove button text
|
17 |
-
remove_button_text =
|
18 |
|
19 |
event.preventDefault();
|
20 |
|
@@ -27,9 +27,9 @@ jQuery(document).ready(function($) {
|
|
27 |
|
28 |
// Create the media frame.
|
29 |
file_frame = wp.media.frames.file_frame = wp.media({
|
30 |
-
title:
|
31 |
button: {
|
32 |
-
text:
|
33 |
},
|
34 |
multiple: false // Set to true to allow multiple files to be selected
|
35 |
});
|
@@ -40,15 +40,15 @@ jQuery(document).ready(function($) {
|
|
40 |
attachment = file_frame.state().get('selection').first().toJSON();
|
41 |
|
42 |
// set the value of the input field to the attachment id
|
43 |
-
|
44 |
|
45 |
-
if (
|
46 |
-
|
47 |
} else {
|
48 |
// show image & remove button
|
49 |
attachment_img = '<img src="'+attachment.url+'" style="display:block" id="img-'+input_id_clean+'"/>';
|
50 |
remove_button = '<span class="button wpo_remove_image_button" data-input_id="'+input_id_clean+'">'+remove_button_text+'</span>';
|
51 |
-
|
52 |
|
53 |
}
|
54 |
});
|
@@ -57,16 +57,16 @@ jQuery(document).ready(function($) {
|
|
57 |
file_frame.open();
|
58 |
});
|
59 |
|
60 |
-
|
61 |
|
62 |
|
63 |
// get input field from data-input_id
|
64 |
-
input_id = '#'
|
65 |
-
img_id = '#img-'
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
});
|
72 |
});
|
6 |
// Uploading files
|
7 |
var file_frame;
|
8 |
|
9 |
+
$('.wpo_upload_image_button').live('click', function( event ){
|
10 |
|
11 |
// get input field id from data-input_id
|
12 |
+
input_id = '#'+$( this ).data( 'input_id' );
|
13 |
+
input_id_class = '.'+$( this ).data( 'input_id' );
|
14 |
+
input_id_clean = $( this ).data( 'input_id' );
|
15 |
|
16 |
// get remove button text
|
17 |
+
remove_button_text = $( this ).data( 'remove_button_text' );
|
18 |
|
19 |
event.preventDefault();
|
20 |
|
27 |
|
28 |
// Create the media frame.
|
29 |
file_frame = wp.media.frames.file_frame = wp.media({
|
30 |
+
title: $( this ).data( 'uploader_title' ),
|
31 |
button: {
|
32 |
+
text: $( this ).data( 'uploader_button_text' ),
|
33 |
},
|
34 |
multiple: false // Set to true to allow multiple files to be selected
|
35 |
});
|
40 |
attachment = file_frame.state().get('selection').first().toJSON();
|
41 |
|
42 |
// set the value of the input field to the attachment id
|
43 |
+
$( input_id ).val(attachment.id);
|
44 |
|
45 |
+
if ($( '#img-'+input_id_clean ).length){
|
46 |
+
$( '#img-'+input_id_clean ).attr("src", attachment.url );
|
47 |
} else {
|
48 |
// show image & remove button
|
49 |
attachment_img = '<img src="'+attachment.url+'" style="display:block" id="img-'+input_id_clean+'"/>';
|
50 |
remove_button = '<span class="button wpo_remove_image_button" data-input_id="'+input_id_clean+'">'+remove_button_text+'</span>';
|
51 |
+
$( input_id ).before(attachment_img+remove_button);
|
52 |
|
53 |
}
|
54 |
});
|
57 |
file_frame.open();
|
58 |
});
|
59 |
|
60 |
+
$('.wpo_remove_image_button').live('click', function( event ){
|
61 |
|
62 |
|
63 |
// get input field from data-input_id
|
64 |
+
input_id = '#'+$( this ).data( 'input_id' );
|
65 |
+
img_id = '#img-'+$( this ).data( 'input_id' );
|
66 |
|
67 |
+
$( input_id ).val('');
|
68 |
+
$( img_id ).remove();
|
69 |
+
$( this ).remove();
|
70 |
+
$( '.attachment-resolution' ).remove();
|
71 |
});
|
72 |
});
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: pomegranate
|
|
3 |
Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice, packing slip, export, email, bulk, automatic
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.1
|
6 |
-
Stable tag: 1.5.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -248,6 +248,11 @@ This usually only happens on batch actions. PDF creation is a memory intensive j
|
|
248 |
|
249 |
== Changelog ==
|
250 |
|
|
|
|
|
|
|
|
|
|
|
251 |
= 1.5.3 =
|
252 |
* Feature: add original order date value to order date filter
|
253 |
* Feature: Work with line_tax_data when available
|
@@ -475,5 +480,5 @@ This usually only happens on batch actions. PDF creation is a memory intensive j
|
|
475 |
|
476 |
== Upgrade Notice ==
|
477 |
|
478 |
-
= 1.5.
|
479 |
Version 1.5 changes where temporary files are stored - everything is now stored centrally in the WP uploads folder. For backwards compatibility, this feature is turned off by default, but we recommend to use the new folders. Check the plugin Status panel for more information!
|
3 |
Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice, packing slip, export, email, bulk, automatic
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.1
|
6 |
+
Stable tag: 1.5.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
248 |
|
249 |
== Changelog ==
|
250 |
|
251 |
+
= 1.5.4 =
|
252 |
+
* Tweak: include plugin version in style/script includes
|
253 |
+
* Tweak: upload code cleanup
|
254 |
+
* Fix: Parent invoice number (for Credit Notes in professional extension)
|
255 |
+
|
256 |
= 1.5.3 =
|
257 |
* Feature: add original order date value to order date filter
|
258 |
* Feature: Work with line_tax_data when available
|
480 |
|
481 |
== Upgrade Notice ==
|
482 |
|
483 |
+
= 1.5.4 =
|
484 |
Version 1.5 changes where temporary files are stored - everything is now stored centrally in the WP uploads folder. For backwards compatibility, this feature is turned off by default, but we recommend to use the new folders. Check the plugin Status panel for more information!
|
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: 1.5.
|
7 |
* Author: Ewout Fernhout
|
8 |
* Author URI: http://www.wpovernight.com
|
9 |
* License: GPLv2 or later
|
@@ -33,7 +33,7 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
|
|
33 |
self::$plugin_basename = plugin_basename(__FILE__);
|
34 |
self::$plugin_url = plugin_dir_url(self::$plugin_basename);
|
35 |
self::$plugin_path = trailingslashit(dirname(__FILE__));
|
36 |
-
self::$version = '1.5.
|
37 |
|
38 |
// load the localisation & classes
|
39 |
add_action( 'plugins_loaded', array( $this, 'translations' ) ); // or use init?
|
@@ -477,7 +477,7 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
|
|
477 |
}
|
478 |
|
479 |
/**
|
480 |
-
* Return/Show order number
|
481 |
*/
|
482 |
public function get_order_number() {
|
483 |
// try parent first
|
@@ -501,7 +501,13 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
|
|
501 |
* Return/Show invoice number
|
502 |
*/
|
503 |
public function get_invoice_number() {
|
504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
return $invoice_number;
|
506 |
}
|
507 |
public function invoice_number() {
|
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: 1.5.4
|
7 |
* Author: Ewout Fernhout
|
8 |
* Author URI: http://www.wpovernight.com
|
9 |
* License: GPLv2 or later
|
33 |
self::$plugin_basename = plugin_basename(__FILE__);
|
34 |
self::$plugin_url = plugin_dir_url(self::$plugin_basename);
|
35 |
self::$plugin_path = trailingslashit(dirname(__FILE__));
|
36 |
+
self::$version = '1.5.4';
|
37 |
|
38 |
// load the localisation & classes
|
39 |
add_action( 'plugins_loaded', array( $this, 'translations' ) ); // or use init?
|
477 |
}
|
478 |
|
479 |
/**
|
480 |
+
* Return/Show order number
|
481 |
*/
|
482 |
public function get_order_number() {
|
483 |
// try parent first
|
501 |
* Return/Show invoice number
|
502 |
*/
|
503 |
public function get_invoice_number() {
|
504 |
+
// try parent first
|
505 |
+
if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
|
506 |
+
$invoice_number = $this->export->get_invoice_number( $parent_order_id );
|
507 |
+
} else {
|
508 |
+
$invoice_number = $this->export->get_invoice_number( $this->export->order->id );
|
509 |
+
}
|
510 |
+
|
511 |
return $invoice_number;
|
512 |
}
|
513 |
public function invoice_number() {
|