WooCommerce PDF Invoices - Version 2.2.9

Version Description

  • June 22, 2015 =

  • Added: Client billing phone number

  • Added: Option to display including tax

  • Added: Discount not showing while 0.00

  • Added: Formatted invoice number to download button

  • Fixed: Tax showing correct label

Download this release

Release Info

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

Code changes from version 2.2.8 to 2.2.9

admin/classes/be-woocommerce-pdf-invoices.php CHANGED
@@ -430,7 +430,7 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
430
  $url = admin_url( 'admin-ajax.php?action=bewpi_download_invoice&order_id=' . $order->id . '&nonce=' . wp_create_nonce( 'bewpi_download_invoice' ) );
431
  $actions['invoice'] = array(
432
  'url' => $url,
433
- 'name' => __( 'Download invoice (PDF)', $this->textdomain )
434
  );
435
  }
436
  return $actions;
430
  $url = admin_url( 'admin-ajax.php?action=bewpi_download_invoice&order_id=' . $order->id . '&nonce=' . wp_create_nonce( 'bewpi_download_invoice' ) );
431
  $actions['invoice'] = array(
432
  'url' => $url,
433
+ 'name' => sprintf( __( 'Invoice %s (PDF)', $this->textdomain ), $invoice->get_formatted_number() )
434
  );
435
  }
436
  return $actions;
admin/classes/bewpi-template-settings.php CHANGED
@@ -123,6 +123,19 @@ if ( ! class_exists( 'BEWPI_Template_Settings' ) ) {
123
  'required'
124
  )
125
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  // Header section
127
  array(
128
  'id' => 'bewpi-company-name',
123
  'required'
124
  )
125
  ),
126
+ array(
127
+ 'id' => 'bewpi-display-prices-incl-tax',
128
+ 'name' => $this->prefix . 'display_prices_incl_tax',
129
+ 'title' => '',
130
+ 'callback' => array( &$this, 'input_callback' ),
131
+ 'page' => $this->settings_key,
132
+ 'section' => 'general',
133
+ 'type' => 'checkbox',
134
+ 'desc' => __( 'Display prices including tax', $this->textdomain )
135
+ . "<br/><div class='bewpi-notes'>" . __( 'Subtotal will be including tax and excluding discount and shipping.', $this->textdomain ) . "</div>",
136
+ 'class' => 'bewpi-display-prices-incl-tax-option-title',
137
+ 'default' => 0
138
+ ),
139
  // Header section
140
  array(
141
  'id' => 'bewpi-company-name',
bootstrap.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /**
4
- * @version 2.2.8
5
  * @package WooCommerce PDF Invoices
6
  * @author baaaaas
7
  *
@@ -9,7 +9,7 @@
9
  * Plugin Name: WooCommerce PDF Invoices
10
  * Plugin URI:
11
  * Description: Automatically or manually create and send PDF Invoices for WooCommerce orders and connect with Dropbox, Google Drive, OneDrive or Egnyte.
12
- * Version: 2.2.8
13
  * Author: baaaaas
14
  * Author URI:
15
  * License: GPL-2.0+
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) )
22
  die( 'Access denied.' );
23
 
24
  if ( ! defined( 'BEWPI_VERSION' ) )
25
- define( 'BEWPI_VERSION', '2.2.8' );
26
 
27
  if ( ! defined( 'BEWPI_URL' ) )
28
  define( 'BEWPI_URL', plugins_url( '', __FILE__ ) . '/' );
1
  <?php
2
 
3
  /**
4
+ * @version 2.2.9
5
  * @package WooCommerce PDF Invoices
6
  * @author baaaaas
7
  *
9
  * Plugin Name: WooCommerce PDF Invoices
10
  * Plugin URI:
11
  * Description: Automatically or manually create and send PDF Invoices for WooCommerce orders and connect with Dropbox, Google Drive, OneDrive or Egnyte.
12
+ * Version: 2.2.9
13
  * Author: baaaaas
14
  * Author URI:
15
  * License: GPL-2.0+
22
  die( 'Access denied.' );
23
 
24
  if ( ! defined( 'BEWPI_VERSION' ) )
25
+ define( 'BEWPI_VERSION', '2.2.9' );
26
 
27
  if ( ! defined( 'BEWPI_URL' ) )
28
  define( 'BEWPI_URL', plugins_url( '', __FILE__ ) . '/' );
includes/classes/bewpi-invoice.php CHANGED
@@ -341,6 +341,14 @@ if ( ! class_exists( 'BEWPI_Invoice' ) ) {
341
  return $total;
342
  }
343
 
 
 
 
 
 
 
 
 
344
  /**
345
  * Get the header html
346
  * @return string
341
  return $total;
342
  }
343
 
344
+ /**
345
+ * Get the subtotal without discount and shipping, but including tax.
346
+ * @return mixed|void
347
+ */
348
+ public function get_subtotal_incl_tax() {
349
+ return $this->order->get_subtotal() + $this->order->get_total_tax();
350
+ }
351
+
352
  /**
353
  * Get the header html
354
  * @return string
includes/views/templates/micro/body.php CHANGED
@@ -153,10 +153,13 @@
153
  <td class="align-right item-total" width="">
154
  <?php
155
  if ( isset( $item['line_total'] ) ) {
 
 
156
  if ( isset( $item['line_subtotal'] ) && $item['line_subtotal'] != $item['line_total'] ) {
157
- echo '<del>' . wc_price( $item['line_subtotal'], array( 'currency' => $this->order->get_order_currency() ) ) . '</del> ';
158
  }
159
- echo wc_price( $item['line_total'], array( 'currency' => $this->order->get_order_currency() ) );
 
160
  }
161
 
162
  if ( $refunded = $this->order->get_total_refunded_for_item( $item_id ) ) {
@@ -171,8 +174,16 @@
171
  <td colspan="<?php echo $this->number_of_columns; ?>"></td>
172
  </tr>
173
  <!-- Table footers -->
 
 
 
 
 
 
 
 
174
  <!-- Discount -->
175
- <?php if( $this->template_options['bewpi_show_discount'] ) { ?>
176
  <tr class="discount after-products">
177
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
178
  <td colspan="<?php echo $this->colspan['right_left']; ?>"><?php _e( 'Discount', $this->textdomain ); ?></td>
@@ -188,7 +199,7 @@
188
  </tr>
189
  <?php } ?>
190
  <!-- Subtotal -->
191
- <?php if( $this->template_options['bewpi_show_subtotal'] ) { ?>
192
  <tr class="subtotal after-products">
193
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
194
  <td colspan="<?php echo $this->colspan['right_left']; ?>"><?php _e( 'Subtotal', $this->textdomain ); ?></td>
@@ -215,17 +226,18 @@
215
  </tr>
216
  <?php endforeach; ?>
217
  <!-- Tax -->
218
- <?php if( $this->template_options['bewpi_show_tax'] && wc_tax_enabled() ) {
219
  foreach ( $this->order->get_tax_totals() as $code => $tax ) : ?>
220
  <tr class="after-products">
221
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
222
  <td colspan="<?php echo $this->colspan['right_left']; ?>">
223
- <?php echo __( 'VAT', $this->textdomain ) . ' ' . WC_Tax::get_rate_percent( $tax->rate_id ); ?>
 
224
  </td>
225
  <td colspan="<?php echo $this->colspan['right_right']; ?>" class="align-right"><?php echo $tax->formatted_amount; ?></td>
226
  </tr>
227
  <?php endforeach; ?>
228
- <?php } ?>
229
  <!-- Total -->
230
  <tr class="after-products">
231
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
153
  <td class="align-right item-total" width="">
154
  <?php
155
  if ( isset( $item['line_total'] ) ) {
156
+ $incl_tax = (bool)$this->template_options[ 'bewpi_display_prices_incl_tax' ];
157
+
158
  if ( isset( $item['line_subtotal'] ) && $item['line_subtotal'] != $item['line_total'] ) {
159
+ echo '<del>' . wc_price( $this->order->get_line_total( $item, $incl_tax, true ), array( 'currency' => $this->order->get_order_currency() ) ) . '</del> ';
160
  }
161
+
162
+ echo wc_price( $this->order->get_line_total( $item, $incl_tax, true ), array( 'currency' => $this->order->get_order_currency() ) );
163
  }
164
 
165
  if ( $refunded = $this->order->get_total_refunded_for_item( $item_id ) ) {
174
  <td colspan="<?php echo $this->number_of_columns; ?>"></td>
175
  </tr>
176
  <!-- Table footers -->
177
+ <!-- Subtotal -->
178
+ <?php if( $this->template_options['bewpi_show_subtotal'] && (bool)$this->template_options[ 'bewpi_display_prices_incl_tax' ] ) { ?>
179
+ <tr class="subtotal after-products">
180
+ <td colspan="<?php echo $this->colspan['left']; ?>"></td>
181
+ <td colspan="<?php echo $this->colspan['right_left']; ?>"><?php _e( 'Subtotal', $this->textdomain ); ?></td>
182
+ <td colspan="<?php echo $this->colspan['right_right']; ?>" class="align-right"><?php echo wc_price( $this->get_subtotal_incl_tax(), array( 'currency' => $this->order->get_order_currency() ) ); ?></td>
183
+ </tr>
184
+ <?php } ?>
185
  <!-- Discount -->
186
+ <?php if( $this->template_options['bewpi_show_discount'] && $this->order->get_total_discount() !== 0.00 ) { ?>
187
  <tr class="discount after-products">
188
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
189
  <td colspan="<?php echo $this->colspan['right_left']; ?>"><?php _e( 'Discount', $this->textdomain ); ?></td>
199
  </tr>
200
  <?php } ?>
201
  <!-- Subtotal -->
202
+ <?php if( $this->template_options['bewpi_show_subtotal'] && ! (bool)$this->template_options[ 'bewpi_display_prices_incl_tax' ] ) { ?>
203
  <tr class="subtotal after-products">
204
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
205
  <td colspan="<?php echo $this->colspan['right_left']; ?>"><?php _e( 'Subtotal', $this->textdomain ); ?></td>
226
  </tr>
227
  <?php endforeach; ?>
228
  <!-- Tax -->
229
+ <?php if( $this->template_options['bewpi_show_tax'] && wc_tax_enabled() ) :
230
  foreach ( $this->order->get_tax_totals() as $code => $tax ) : ?>
231
  <tr class="after-products">
232
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
233
  <td colspan="<?php echo $this->colspan['right_left']; ?>">
234
+ <?php //echo __( 'VAT', $this->textdomain ) . ' ' . WC_Tax::get_rate_percent( $tax->rate_id ); ?>
235
+ <?php echo $tax->label; ?>
236
  </td>
237
  <td colspan="<?php echo $this->colspan['right_right']; ?>" class="align-right"><?php echo $tax->formatted_amount; ?></td>
238
  </tr>
239
  <?php endforeach; ?>
240
+ <?php endif; ?>
241
  <!-- Total -->
242
  <tr class="after-products">
243
  <td colspan="<?php echo $this->colspan['left']; ?>"></td>
includes/views/templates/micro/header.php CHANGED
@@ -11,7 +11,8 @@
11
  <tr>
12
  <td class="address small-font">
13
  <b><?php _e( 'Invoice to', $this->textdomain ); ?></b><br/>
14
- <?php echo $this->order->get_formatted_billing_address(); ?>
 
15
  </td>
16
  <td class="address small-font">
17
  <b><?php _e( 'Ship to', $this->textdomain ); ?></b><br/>
11
  <tr>
12
  <td class="address small-font">
13
  <b><?php _e( 'Invoice to', $this->textdomain ); ?></b><br/>
14
+ <?php echo $this->order->get_formatted_billing_address(); ?><br/>
15
+ <?php echo $this->order->billing_phone; ?>
16
  </td>
17
  <td class="address small-font">
18
  <b><?php _e( 'Ship to', $this->textdomain ); ?></b><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.5
6
  Tested up to: 4.2
7
- Stable tag: 2.2.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,14 @@ The manual installation method involves downloading our plugin and uploading it
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
 
 
69
  = 2.2.8 - May 15, 2015 =
70
 
71
  - Fixed: BEWPI_TEMPLATES_DIR not defined
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.5
6
  Tested up to: 4.2
7
+ Stable tag: 2.2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
 
67
  == Changelog ==
68
 
69
+ = 2.2.9 - June 22, 2015 =
70
+
71
+ - Added: Client billing phone number
72
+ - Added: Option to display including tax
73
+ - Added: Discount not showing while 0.00
74
+ - Added: Formatted invoice number to download button
75
+ - Fixed: Tax showing correct label
76
+
77
  = 2.2.8 - May 15, 2015 =
78
 
79
  - Fixed: BEWPI_TEMPLATES_DIR not defined