Version Description
- April 29, 2016 =
- Added: Option to change the title of the invoice
- Fixed: Invoice not attached to email
- Fixed: Shortcode error when no order_id is given
Download this release
Release Info
Developer | baaaaas |
Plugin | WooCommerce PDF Invoices |
Version | 2.4.6 |
Comparing to | |
See all releases |
Code changes from version 2.4.5 to 2.4.6
- bootstrap.php +2 -2
- includes/abstracts/abstract-bewpi-document.php +0 -7
- includes/abstracts/abstract-bewpi-invoice.php +0 -2
- includes/admin/settings/class-bewpi-admin-settings-template.php +11 -0
- includes/be-woocommerce-pdf-invoices.php +26 -12
- includes/templates/invoices/simple/micro/body.php +1 -1
- readme.txt +6 -1
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: 2.4.
|
7 |
* Author: Bas Elbers
|
8 |
* Author URI: http://wcpdfinvoices.com
|
9 |
* License: GPL-2.0+
|
@@ -19,7 +19,7 @@ function bewpi_plugins_loaded() {
|
|
19 |
|
20 |
$wp_upload_dir = wp_upload_dir();
|
21 |
|
22 |
-
define( 'BEWPI_VERSION', '2.4.
|
23 |
define( 'BEWPI_URL', plugins_url( '', __FILE__ ) . '/' );
|
24 |
define( 'BEWPI_DIR', plugin_dir_path( __FILE__ ) . '/' );
|
25 |
define( 'BEWPI_TEMPLATES_DIR', plugin_dir_path( __FILE__ ) . 'includes/templates/' );
|
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: 2.4.6
|
7 |
* Author: Bas Elbers
|
8 |
* Author URI: http://wcpdfinvoices.com
|
9 |
* License: GPL-2.0+
|
19 |
|
20 |
$wp_upload_dir = wp_upload_dir();
|
21 |
|
22 |
+
define( 'BEWPI_VERSION', '2.4.6' );
|
23 |
define( 'BEWPI_URL', plugins_url( '', __FILE__ ) . '/' );
|
24 |
define( 'BEWPI_DIR', plugin_dir_path( __FILE__ ) . '/' );
|
25 |
define( 'BEWPI_TEMPLATES_DIR', plugin_dir_path( __FILE__ ) . 'includes/templates/' );
|
includes/abstracts/abstract-bewpi-document.php
CHANGED
@@ -27,9 +27,6 @@ if ( ! class_exists( 'BEWPI_Abstract_Document' ) ) {
|
|
27 |
*/
|
28 |
protected $template_options;
|
29 |
|
30 |
-
/**
|
31 |
-
* @param $order
|
32 |
-
*/
|
33 |
public function __construct() {
|
34 |
$this->general_options = get_option( 'bewpi_general_settings' );
|
35 |
$this->template_options = get_option( 'bewpi_template_settings' );
|
@@ -98,10 +95,6 @@ if ( ! class_exists( 'BEWPI_Abstract_Document' ) ) {
|
|
98 |
$mpdf->Output( $filename, $dest );
|
99 |
}
|
100 |
|
101 |
-
/**
|
102 |
-
* Get the invoice if exist and show.
|
103 |
-
* @param $download
|
104 |
-
*/
|
105 |
public function view() {
|
106 |
if ( $this->general_options[ 'bewpi_view_pdf' ] === 'browser' ) {
|
107 |
header( 'Content-type: application/pdf' );
|
27 |
*/
|
28 |
protected $template_options;
|
29 |
|
|
|
|
|
|
|
30 |
public function __construct() {
|
31 |
$this->general_options = get_option( 'bewpi_general_settings' );
|
32 |
$this->template_options = get_option( 'bewpi_template_settings' );
|
95 |
$mpdf->Output( $filename, $dest );
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
98 |
public function view() {
|
99 |
if ( $this->general_options[ 'bewpi_view_pdf' ] === 'browser' ) {
|
100 |
header( 'Content-type: application/pdf' );
|
includes/abstracts/abstract-bewpi-invoice.php
CHANGED
@@ -322,8 +322,6 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
|
|
322 |
|
323 |
do_action("bewpi_before_invoice_content", $this->order->id);
|
324 |
|
325 |
-
$test = __('Invoice', 'woocommerce-pdf-invoices');
|
326 |
-
|
327 |
if ($this->exists()) {
|
328 |
// delete postmeta and PDF
|
329 |
$this->delete();
|
322 |
|
323 |
do_action("bewpi_before_invoice_content", $this->order->id);
|
324 |
|
|
|
|
|
325 |
if ($this->exists()) {
|
326 |
// delete postmeta and PDF
|
327 |
$this->delete();
|
includes/admin/settings/class-bewpi-admin-settings-template.php
CHANGED
@@ -205,6 +205,17 @@ if ( ! class_exists( 'BEWPI_Template_Settings' ) ) {
|
|
205 |
'default' => ''
|
206 |
),
|
207 |
// Body
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
array(
|
209 |
'id' => 'bewpi-intro-text',
|
210 |
'name' => $this->prefix . 'intro_text',
|
205 |
'default' => ''
|
206 |
),
|
207 |
// Body
|
208 |
+
array(
|
209 |
+
'id' => 'bewpi-title',
|
210 |
+
'name' => $this->prefix . 'title',
|
211 |
+
'title' => __( 'Title', 'woocommerce-pdf-invoices' ),
|
212 |
+
'callback' => array( &$this, 'input_callback' ),
|
213 |
+
'page' => $this->settings_key,
|
214 |
+
'section' => 'body',
|
215 |
+
'type' => 'text',
|
216 |
+
'desc' => __( 'Change the name of the invoice.', 'woocommerce-pdf-invoices' ),
|
217 |
+
'default' => __( 'Invoice', 'woocommerce-pdf-invoices' )
|
218 |
+
),
|
219 |
array(
|
220 |
'id' => 'bewpi-intro-text',
|
221 |
'name' => $this->prefix . 'intro_text',
|
includes/be-woocommerce-pdf-invoices.php
CHANGED
@@ -149,10 +149,15 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
|
|
149 |
}
|
150 |
|
151 |
public function bewpi_download_invoice_func( $atts ) {
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
if ( $invoice->exists() && $invoice->is_download_allowed( $order->post_status ) ) {
|
158 |
$url = admin_url( 'admin-ajax.php?bewpi_action=view&post=' . $order->id . '&nonce=' . wp_create_nonce( 'view' ) );
|
@@ -355,21 +360,30 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
|
|
355 |
$attachments = apply_filters( 'bewpi_email_attachments', $attachments, $status, $order );
|
356 |
|
357 |
$general_options = get_option( 'bewpi_general_settings' );
|
358 |
-
|
359 |
-
|
360 |
-
|
|
|
361 |
|
362 |
-
$payment_methods = apply_filters('bewpi_attach_invoice_excluded_payment_methods', array()
|
363 |
-
if(in_array($order->payment_method, $payment_methods))
|
|
|
364 |
return $attachments;
|
365 |
}
|
366 |
|
367 |
$invoice = new BEWPI_Invoice( $order->id );
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
// only add to attachments if it isn't already added.
|
372 |
-
if
|
|
|
373 |
$attachments[] = $full_path;
|
374 |
}
|
375 |
|
149 |
}
|
150 |
|
151 |
public function bewpi_download_invoice_func( $atts ) {
|
152 |
+
if(!isset($atts["order_id"]))
|
153 |
+
{
|
154 |
+
return;
|
155 |
+
}
|
156 |
+
|
157 |
+
$order_id = $atts["order_id"];
|
158 |
+
$order = wc_get_order( $order_id );
|
159 |
+
$title = $atts[ 'title' ];
|
160 |
+
$invoice = new BEWPI_Invoice( $order->id );
|
161 |
|
162 |
if ( $invoice->exists() && $invoice->is_download_allowed( $order->post_status ) ) {
|
163 |
$url = admin_url( 'admin-ajax.php?bewpi_action=view&post=' . $order->id . '&nonce=' . wp_create_nonce( 'view' ) );
|
360 |
$attachments = apply_filters( 'bewpi_email_attachments', $attachments, $status, $order );
|
361 |
|
362 |
$general_options = get_option( 'bewpi_general_settings' );
|
363 |
+
if($status !== $general_options["bewpi_email_type"] && (!$general_options['bewpi_new_order'] && $status === "new_order"))
|
364 |
+
{
|
365 |
+
return $attachments;
|
366 |
+
}
|
367 |
|
368 |
+
$payment_methods = apply_filters('bewpi_attach_invoice_excluded_payment_methods', array());
|
369 |
+
if(in_array($order->payment_method, $payment_methods))
|
370 |
+
{
|
371 |
return $attachments;
|
372 |
}
|
373 |
|
374 |
$invoice = new BEWPI_Invoice( $order->id );
|
375 |
+
if($invoice->exists())
|
376 |
+
{
|
377 |
+
$full_path = $invoice->get_full_path();
|
378 |
+
}
|
379 |
+
else
|
380 |
+
{
|
381 |
+
$full_path = $invoice->save("F");
|
382 |
+
}
|
383 |
|
384 |
// only add to attachments if it isn't already added.
|
385 |
+
if(!in_array($full_path, $attachments))
|
386 |
+
{
|
387 |
$attachments[] = $full_path;
|
388 |
}
|
389 |
|
includes/templates/invoices/simple/micro/body.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<tbody>
|
20 |
<tr>
|
21 |
<td class="invoice-details">
|
22 |
-
<h1 class="title"><?php
|
23 |
<span class="number" style="color: <?php echo $this->template_options['bewpi_color_theme']; ?>;"><?php echo $this->get_formatted_number(); ?></span><br/>
|
24 |
<span><?php echo $this->get_formatted_invoice_date(); ?></span><br/><br/>
|
25 |
<span><?php printf( __( 'Order Number: %s', 'woocommerce-pdf-invoices' ), $this->order->get_order_number() ); ?></span><br/>
|
19 |
<tbody>
|
20 |
<tr>
|
21 |
<td class="invoice-details">
|
22 |
+
<h1 class="title"><?php echo $this->template_options['bewpi_title']; ?></h1>
|
23 |
<span class="number" style="color: <?php echo $this->template_options['bewpi_color_theme']; ?>;"><?php echo $this->get_formatted_number(); ?></span><br/>
|
24 |
<span><?php echo $this->get_formatted_invoice_date(); ?></span><br/><br/>
|
25 |
<span><?php printf( __( 'Order Number: %s', 'woocommerce-pdf-invoices' ), $this->order->get_order_number() ); ?></span><br/>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: woocommerce pdf invoices, invoice, generate, pdf, woocommerce, attachment, email, completed order, customer invoice, processing order, attach, automatic, vat, rate, sequential, number
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.5
|
7 |
-
Stable tag: 2.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -218,6 +218,11 @@ add_filter('bewpi_allowed_roles_to_download_invoice', 'bewpi_allowed_roles_to_do
|
|
218 |
|
219 |
== Changelog ==
|
220 |
|
|
|
|
|
|
|
|
|
|
|
221 |
= 2.4.5 - April 15, 2016 =
|
222 |
|
223 |
- Added: Filter 'bewpi_allowed_roles_to_download_invoice' (check FAQ)
|
4 |
Tags: woocommerce pdf invoices, invoice, generate, pdf, woocommerce, attachment, email, completed order, customer invoice, processing order, attach, automatic, vat, rate, sequential, number
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.5
|
7 |
+
Stable tag: 2.4.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
218 |
|
219 |
== Changelog ==
|
220 |
|
221 |
+
= 2.4.6 - April 29, 2016 =
|
222 |
+
- Added: Option to change the title of the invoice
|
223 |
+
- Fixed: Invoice not attached to email
|
224 |
+
- Fixed: Shortcode error when no order_id is given
|
225 |
+
|
226 |
= 2.4.5 - April 15, 2016 =
|
227 |
|
228 |
- Added: Filter 'bewpi_allowed_roles_to_download_invoice' (check FAQ)
|