WooCommerce PDF Invoices - Version 2.8.0

Version Description

  • April 19, 2017 =

  • Added: Packing Slip PDF document (for 'Minimal' template, not 'Micro').

  • Fixed: 'Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given'.

Download this release

Release Info

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

Code changes from version 2.7.3 to 2.8.0

assets/css/admin.css CHANGED
@@ -52,6 +52,16 @@ form.bewpi-settings-form {
52
  height: 2em !important;
53
  width: 2em;
54
  }
 
 
 
 
 
 
 
 
 
 
55
  .bewpi-admin-order-create-invoice-btn button {
56
  display: none;
57
  }
52
  height: 2em !important;
53
  width: 2em;
54
  }
55
+ .bewpi-admin-order-create-packing-slip-btn {
56
+ background-image: url(../images/packing-slip-icon.png) !important;
57
+ background-repeat: no-repeat !important;
58
+ background-position: center center !important;
59
+ text-indent: -9999px;
60
+ position: relative;
61
+ padding: 0 !important;
62
+ height: 2em !important;
63
+ width: 2em;
64
+ }
65
  .bewpi-admin-order-create-invoice-btn button {
66
  display: none;
67
  }
assets/images/packing-slip-icon.png ADDED
Binary file
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.7.3
7
  * Author: Bas Elbers
8
  * Author URI: http://wcpdfinvoices.com
9
  * License: GPL-2.0+
@@ -19,9 +19,9 @@ if ( ! defined( 'ABSPATH' ) ) {
19
  /**
20
  * @deprecated instead use WPI_VERSION.
21
  */
22
- define( 'BEWPI_VERSION', '2.7.3' );
23
 
24
- define( 'WPI_VERSION', '2.7.3' );
25
 
26
  /**
27
  * Load WooCommerce PDF Invoices plugin.
@@ -70,18 +70,16 @@ function _bewpi_on_plugin_update() {
70
  $current_version = get_site_option( 'bewpi_version' );
71
  if ( WPI_VERSION !== $current_version ) {
72
 
 
 
 
 
 
 
73
  // version 2.6.1- need to be updated with new email options and postmeta.
74
  if ( version_compare( $current_version, '2.6.1' ) <= 0 ) {
75
- // temporary change max execution time to higher value to prevent internal server errors.
76
- $max_execution_time = (int) ini_get( 'max_execution_time' );
77
- if ( 0 !== $max_execution_time ) {
78
- set_time_limit( 360 );
79
- }
80
-
81
  update_email_type_options();
82
  update_postmeta();
83
-
84
- set_time_limit( $max_execution_time );
85
  }
86
 
87
  // version 2.7.0- uploads folder changed to uploads/woocommerce-pdf-invoices.
@@ -96,6 +94,8 @@ function _bewpi_on_plugin_update() {
96
  rename( BEWPI_CUSTOM_TEMPLATES_INVOICES_DIR, $upload_dir['basedir'] . '/bewpi-templates/invoice' );
97
  }
98
 
 
 
99
  update_site_option( 'bewpi_version', WPI_VERSION );
100
  }
101
  }
@@ -254,5 +254,4 @@ function _bewpi_on_plugin_activation() {
254
 
255
  update_site_option( 'bewpi_version', WPI_VERSION );
256
  }
257
-
258
  register_activation_hook( __FILE__, '_bewpi_on_plugin_activation' );
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.8.0
7
  * Author: Bas Elbers
8
  * Author URI: http://wcpdfinvoices.com
9
  * License: GPL-2.0+
19
  /**
20
  * @deprecated instead use WPI_VERSION.
21
  */
22
+ define( 'BEWPI_VERSION', '2.8.0' );
23
 
24
+ define( 'WPI_VERSION', '2.8.0' );
25
 
26
  /**
27
  * Load WooCommerce PDF Invoices plugin.
70
  $current_version = get_site_option( 'bewpi_version' );
71
  if ( WPI_VERSION !== $current_version ) {
72
 
73
+ // temporary change max execution time to higher value to prevent internal server errors.
74
+ $max_execution_time = (int) ini_get( 'max_execution_time' );
75
+ if ( 0 !== $max_execution_time ) {
76
+ set_time_limit( 360 );
77
+ }
78
+
79
  // version 2.6.1- need to be updated with new email options and postmeta.
80
  if ( version_compare( $current_version, '2.6.1' ) <= 0 ) {
 
 
 
 
 
 
81
  update_email_type_options();
82
  update_postmeta();
 
 
83
  }
84
 
85
  // version 2.7.0- uploads folder changed to uploads/woocommerce-pdf-invoices.
94
  rename( BEWPI_CUSTOM_TEMPLATES_INVOICES_DIR, $upload_dir['basedir'] . '/bewpi-templates/invoice' );
95
  }
96
 
97
+ set_time_limit( $max_execution_time );
98
+
99
  update_site_option( 'bewpi_version', WPI_VERSION );
100
  }
101
  }
254
 
255
  update_site_option( 'bewpi_version', WPI_VERSION );
256
  }
 
257
  register_activation_hook( __FILE__, '_bewpi_on_plugin_activation' );
includes/abstracts/abstract-bewpi-document.php CHANGED
@@ -89,9 +89,8 @@ if ( ! class_exists( 'BEWPI_Abstract_Document' ) ) {
89
  * Generate document.
90
  *
91
  * @param string $destination Destination mode for file.
92
- * @param bool $is_paid WooCommerce order paid status.
93
  */
94
- protected function generate( $destination, $is_paid ) {
95
  $order_id = bewpi_get_id( $this->order );
96
 
97
  do_action( 'bewpi_before_invoice_content', $order_id );
@@ -139,8 +138,8 @@ if ( ! class_exists( 'BEWPI_Abstract_Document' ) ) {
139
  $mpdf->company_logo = file_get_contents( $image_path );
140
  }
141
 
142
- // show paid watermark.
143
- if ( (bool) $this->template_options['bewpi_show_payment_status'] && $is_paid && ! $is_new_template ) {
144
  $mpdf->SetWatermarkText( __( 'Paid', 'woocommerce-pdf-invoices' ) );
145
  $mpdf->showWatermarkText = true;
146
  $mpdf->watermarkTextAlpha = '0.2';
@@ -263,6 +262,32 @@ if ( ! class_exists( 'BEWPI_Abstract_Document' ) ) {
263
  return $this->full_path;
264
  }
265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  /**
267
  * Check if pdf exists within uploads folder.
268
  *
89
  * Generate document.
90
  *
91
  * @param string $destination Destination mode for file.
 
92
  */
93
+ public function generate( $destination = 'F' ) {
94
  $order_id = bewpi_get_id( $this->order );
95
 
96
  do_action( 'bewpi_before_invoice_content', $order_id );
138
  $mpdf->company_logo = file_get_contents( $image_path );
139
  }
140
 
141
+ // Show legacy paid watermark.
142
+ if ( strpos( $this->template_options['bewpi_template_name'], 'micro' ) !== false && $this->template_options['bewpi_show_payment_status'] && strpos( $this->type, 'invoice' ) !== false && $this->order->is_paid() ) {
143
  $mpdf->SetWatermarkText( __( 'Paid', 'woocommerce-pdf-invoices' ) );
144
  $mpdf->showWatermarkText = true;
145
  $mpdf->watermarkTextAlpha = '0.2';
262
  return $this->full_path;
263
  }
264
 
265
+ /**
266
+ * Date format from user option or get default WordPress date format.
267
+ *
268
+ * @return string
269
+ */
270
+ public function get_date_format() {
271
+ $date_format = $this->template_options['bewpi_date_format'];
272
+ if ( ! empty( $date_format ) ) {
273
+ return (string) $date_format;
274
+ }
275
+
276
+ return (string) get_option( 'date_format' );
277
+ }
278
+
279
+ /**
280
+ * Order date formatted with user option format and localized.
281
+ *
282
+ * @return string
283
+ */
284
+ public function get_formatted_order_date() {
285
+ // WC backwards compatibility.
286
+ $order_date = method_exists( 'WC_Order', 'get_date_created' ) ? $this->order->get_date_created() : $this->order->order_date;
287
+
288
+ return date_i18n( $this->get_date_format(), strtotime( $order_date ) );
289
+ }
290
+
291
  /**
292
  * Check if pdf exists within uploads folder.
293
  *
includes/abstracts/abstract-bewpi-invoice.php CHANGED
@@ -116,20 +116,6 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
116
  return apply_filters( 'bewpi_formatted_invoice_number', $formatted_invoice_number, $this->type );
117
  }
118
 
119
- /**
120
- * Date format from user option or get default WordPress date format.
121
- *
122
- * @return string
123
- */
124
- public function get_date_format() {
125
- $date_format = $this->template_options['bewpi_date_format'];
126
- if ( ! empty( $date_format ) ) {
127
- return (string) $date_format;
128
- }
129
-
130
- return (string) get_option( 'date_format' );
131
- }
132
-
133
  /**
134
  * Format and localize (MySQL) invoice date.
135
  *
@@ -139,18 +125,6 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
139
  return date_i18n( $this->get_date_format(), strtotime( $this->date ) );
140
  }
141
 
142
- /**
143
- * Order date formatted with user option format and localized.
144
- *
145
- * @return string
146
- */
147
- public function get_formatted_order_date() {
148
- // WC backwards compatibility.
149
- $order_date = method_exists( 'WC_Order', 'get_date_created' ) ? $this->order->get_date_created() : $this->order->order_date;
150
-
151
- return date_i18n( $this->get_date_format(), strtotime( $order_date ) );
152
- }
153
-
154
  /**
155
  * Delete invoice PDF files.
156
  *
@@ -295,6 +269,17 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
295
  return intval( $wpdb->get_var( $query ) ); // db call ok; no-cache ok. WPCS: unprepared SQL OK.
296
  }
297
 
 
 
 
 
 
 
 
 
 
 
 
298
  /**
299
  * Save invoice.
300
  *
@@ -302,7 +287,7 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
302
  *
303
  * @return string
304
  */
305
- public function save( $destination = 'F' ) {
306
  // WC backwards compatibility.
307
  $order_id = bewpi_get_id( $this->order );
308
 
@@ -333,7 +318,7 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
333
 
334
  do_action( 'bewpi_before_document_generation', $this->type, $order_id );
335
 
336
- parent::generate( $destination, $this->order->is_paid() );
337
 
338
  return $this->full_path;
339
  }
@@ -347,7 +332,7 @@ if ( ! class_exists( 'BEWPI_Abstract_Invoice' ) ) {
347
  */
348
  public function update( $destination = 'F' ) {
349
  parent::delete( $this->full_path );
350
- parent::generate( $destination, $this->order->is_paid() );
351
 
352
  return $this->full_path;
353
  }
116
  return apply_filters( 'bewpi_formatted_invoice_number', $formatted_invoice_number, $this->type );
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * Format and localize (MySQL) invoice date.
121
  *
125
  return date_i18n( $this->get_date_format(), strtotime( $this->date ) );
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  /**
129
  * Delete invoice PDF files.
130
  *
269
  return intval( $wpdb->get_var( $query ) ); // db call ok; no-cache ok. WPCS: unprepared SQL OK.
270
  }
271
 
272
+ /**
273
+ * Backwards compatibility.
274
+ *
275
+ * @deprecated Use `generate()` instead.
276
+ *
277
+ * @param string $destination pdf generation mode.
278
+ */
279
+ public function save( $destination = 'F' ) {
280
+ $this->generate( $destination );
281
+ }
282
+
283
  /**
284
  * Save invoice.
285
  *
287
  *
288
  * @return string
289
  */
290
+ public function generate( $destination = 'F' ) {
291
  // WC backwards compatibility.
292
  $order_id = bewpi_get_id( $this->order );
293
 
318
 
319
  do_action( 'bewpi_before_document_generation', $this->type, $order_id );
320
 
321
+ parent::generate( $destination );
322
 
323
  return $this->full_path;
324
  }
332
  */
333
  public function update( $destination = 'F' ) {
334
  parent::delete( $this->full_path );
335
+ parent::generate( $destination );
336
 
337
  return $this->full_path;
338
  }
includes/be-woocommerce-pdf-invoices.php CHANGED
@@ -261,6 +261,10 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
261
 
262
  // verify nonce.
263
  $action = sanitize_key( $_GET['bewpi_action'] );
 
 
 
 
264
  $nonce = sanitize_key( $_GET['nonce'] );
265
  if ( ! wp_verify_nonce( $nonce, $action ) ) {
266
  wp_die( 'Invalid request.' );
@@ -325,12 +329,16 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
325
  $full_path = $invoice->update();
326
  BEWPI_Invoice::view( $full_path );
327
  break;
 
 
 
 
328
  case 'cancel':
329
  BEWPI_Invoice::delete( $order_id );
330
  break;
331
  case 'create':
332
  $invoice = new BEWPI_Invoice( $order_id );
333
- $invoice->save();
334
  break;
335
  }
336
 
@@ -512,7 +520,7 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
512
  $order_id = bewpi_get_id( $order );
513
  $invoice = new BEWPI_Invoice( $order_id );
514
  if ( ! $invoice->exists( $order_id ) ) {
515
- $full_path = $invoice->save();
516
  } else {
517
  $full_path = $invoice->update();
518
  }
261
 
262
  // verify nonce.
263
  $action = sanitize_key( $_GET['bewpi_action'] );
264
+ if ( 'view' !== $action ) {
265
+ return;
266
+ }
267
+
268
  $nonce = sanitize_key( $_GET['nonce'] );
269
  if ( ! wp_verify_nonce( $nonce, $action ) ) {
270
  wp_die( 'Invalid request.' );
329
  $full_path = $invoice->update();
330
  BEWPI_Invoice::view( $full_path );
331
  break;
332
+ case 'view_packing_slip':
333
+ $packing_slip = new BEWPI_Packing_Slip( $order_id );
334
+ $packing_slip->generate( 'D' );
335
+ break;
336
  case 'cancel':
337
  BEWPI_Invoice::delete( $order_id );
338
  break;
339
  case 'create':
340
  $invoice = new BEWPI_Invoice( $order_id );
341
+ $invoice->generate();
342
  break;
343
  }
344
 
520
  $order_id = bewpi_get_id( $order );
521
  $invoice = new BEWPI_Invoice( $order_id );
522
  if ( ! $invoice->exists( $order_id ) ) {
523
+ $full_path = $invoice->generate();
524
  } else {
525
  $full_path = $invoice->update();
526
  }
includes/class-bewpi-invoice.php CHANGED
@@ -35,6 +35,8 @@ if ( ! class_exists( 'BEWPI_Invoice' ) ) {
35
  * Formatted custom order subtotal.
36
  * Shipping including or excluding tax.
37
  *
 
 
38
  * @return string
39
  */
40
  public function get_formatted_subtotal() {
@@ -52,6 +54,8 @@ if ( ! class_exists( 'BEWPI_Invoice' ) ) {
52
  /**
53
  * Formatted custom order total.
54
  *
 
 
55
  * @return string
56
  */
57
  public function get_formatted_total() {
35
  * Formatted custom order subtotal.
36
  * Shipping including or excluding tax.
37
  *
38
+ * @deprecated No longer used within template files. Custom templates should be replaced.
39
+ *
40
  * @return string
41
  */
42
  public function get_formatted_subtotal() {
54
  /**
55
  * Formatted custom order total.
56
  *
57
+ * @deprecated No longer used within template files. Custom templates should be replaced.
58
+ *
59
  * @return string
60
  */
61
  public function get_formatted_total() {
includes/class-bewpi-packing-slip.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BEWPI_Packing_Slip class.
4
+ *
5
+ * @author Bas Elbers
6
+ * @category Class
7
+ * @package BE_WooCommerce_PDF_Invoices/Class
8
+ * @version 0.0.1
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ if ( ! class_exists( 'BEWPI_Packing_Slip' ) ) {
16
+ /**
17
+ * Class BEWPI_Packing_Slip.
18
+ */
19
+ class BEWPI_Packing_Slip extends BEWPI_Abstract_Document {
20
+ /**
21
+ * BEWPI_Packing_Slip constructor.
22
+ *
23
+ * @param int $order_id WooCommerce Order ID.
24
+ */
25
+ public function __construct( $order_id ) {
26
+ $this->order = wc_get_order( $order_id );
27
+ $this->type = 'packing-slip/simple';
28
+ $this->filename = apply_filters( 'bewpi_pdf_packing_slip_filename', sprintf( 'packing-slip-%s.pdf', bewpi_get_id( $this->order ) ), $this );
29
+ BEWPI()->templater()->set_packing_slip( $this );
30
+ parent::__construct();
31
+ }
32
+
33
+ /**
34
+ * Initialize packing slips hooks.
35
+ */
36
+ public static function init_hooks() {
37
+ add_action( 'woocommerce_admin_order_actions_end', array( __CLASS__, 'add_packing_slip_pdf' ) );
38
+ }
39
+
40
+ /**
41
+ * Add packing slip link to 'Shop Order' page.
42
+ *
43
+ * @param WC_Order $order WooCommerce order object.
44
+ */
45
+ public static function add_packing_slip_pdf( $order ) {
46
+ $order_id = bewpi_get_id( $order );
47
+
48
+ // View Packing Slip.
49
+ $action = 'view_packing_slip';
50
+ $url = wp_nonce_url( add_query_arg( array(
51
+ 'post' => $order_id,
52
+ 'action' => 'edit',
53
+ 'bewpi_action' => $action,
54
+ ), admin_url( 'post.php' ) ), $action, 'nonce' );
55
+
56
+ $url = apply_filters( 'bewpi_pdf_packing_slip_url', $url, $order_id, $action );
57
+
58
+ printf( '<a href="%1$s" title="%2$s" class="button tips bewpi-admin-order-create-packing-slip-btn" target="_blank">%2$s</a>', $url, __( 'View packing slip', 'woocommerce-pdf-invoices' ) );
59
+ }
60
+ }
61
+
62
+ BEWPI_Packing_Slip::init_hooks();
63
+ }
includes/class-bewpi-template.php CHANGED
@@ -29,6 +29,13 @@ class BEWPI_Template {
29
  */
30
  public $invoice;
31
 
 
 
 
 
 
 
 
32
  /**
33
  * Template directories.
34
  *
@@ -95,7 +102,7 @@ class BEWPI_Template {
95
  }
96
 
97
  if ( count( $template ) === 0 ) {
98
- BEWPI()->logger()->warning( sprintf( 'PDF generation aborted. Template not found in %1$s:%2$s', __FILE__, __LINE__ ) );
99
  }
100
 
101
  return $template;
@@ -220,4 +227,13 @@ class BEWPI_Template {
220
  public function set_invoice( $invoice ) {
221
  $this->invoice = $invoice;
222
  }
 
 
 
 
 
 
 
 
 
223
  }
29
  */
30
  public $invoice;
31
 
32
+ /**
33
+ * WooCommerce PDF Invoices packing slip.
34
+ *
35
+ * @var BEWPI_Packing_Slip.
36
+ */
37
+ public $packing_slip;
38
+
39
  /**
40
  * Template directories.
41
  *
102
  }
103
 
104
  if ( count( $template ) === 0 ) {
105
+ BEWPI()->logger()->error( sprintf( 'PDF generation aborted. Template not found in %1$s:%2$s', __FILE__, __LINE__ ) );
106
  }
107
 
108
  return $template;
227
  public function set_invoice( $invoice ) {
228
  $this->invoice = $invoice;
229
  }
230
+
231
+ /**
232
+ * Set invoice.
233
+ *
234
+ * @param BEWPI_Packing_Slip $packing_slip WooCommerce PDF Invoices invoice object.
235
+ */
236
+ public function set_packing_slip( $packing_slip ) {
237
+ $this->packing_slip = $packing_slip;
238
+ }
239
  }
includes/functions.php CHANGED
@@ -15,7 +15,7 @@ function bewpi_get_id( $order ) {
15
  }
16
 
17
  if ( $reflection->hasProperty( 'id' ) ) {
18
- return $reflection->getProperty( 'id' )->getValue();
19
  }
20
 
21
  return false;
15
  }
16
 
17
  if ( $reflection->hasProperty( 'id' ) ) {
18
+ return $reflection->getProperty( 'id' )->getValue( $order );
19
  }
20
 
21
  return false;
includes/templates/packing-slip/simple/minimal/body.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PDF packing slip template body.
4
+ *
5
+ * This template can be overridden by copying it to youruploadsfolder/woocommerce-pdf-invoices/templates/packing-slip/simple/yourtemplatename/body.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce PDF Invoices will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @author Bas Elbers
14
+ * @package WooCommerce_PDF_Invoices/Templates
15
+ * @version 0.0.1
16
+ */
17
+
18
+ $templater = BEWPI()->templater();
19
+ $order = $templater->order;
20
+ $formatted_shipping_address = $order->get_formatted_shipping_address();
21
+ $formatted_billing_address = $order->get_formatted_billing_address();
22
+ $line_items = $order->get_items( 'line_item' );
23
+ $color = $templater->get_option( 'bewpi_color_theme' );
24
+ ?>
25
+
26
+ <div class="title">
27
+ <div>
28
+ <h2><?php _e( 'Packing Slip', 'woocommerce-pdf-invoices' ); ?></h2>
29
+ </div>
30
+ <div class="watermark"></div>
31
+ </div>
32
+ <table cellpadding="0" cellspacing="0">
33
+ <tr class="information">
34
+ <td width="50%">
35
+ <?php echo nl2br( $templater->get_option( 'bewpi_company_address' ) ); ?>
36
+ </td>
37
+
38
+ <td>
39
+ <?php
40
+ if ( $templater->get_option( 'bewpi_show_ship_to' ) && ! empty( $formatted_shipping_address ) && $formatted_shipping_address !== $formatted_billing_address && ! $templater->has_only_virtual_products( $line_items ) ) {
41
+ printf( '<strong>%s</strong><br />', __( 'Ship to:', 'woocommerce-pdf-invoices' ) );
42
+ echo $formatted_shipping_address;
43
+ }
44
+ ?>
45
+ </td>
46
+
47
+ <td>
48
+ <?php echo $formatted_billing_address; ?>
49
+ </td>
50
+ </tr>
51
+ </table>
52
+ <table cellpadding="0" cellspacing="0">
53
+ <thead>
54
+ <tr class="heading" bgcolor="<?php echo $color; ?>;">
55
+ <th>
56
+ <?php _e( 'Product', 'woocommerce-pdf-invoices' ); ?>
57
+ </th>
58
+
59
+ <th>
60
+ <?php _e( 'Qty', 'woocommerce-pdf-invoices' ); ?>
61
+ </th>
62
+ </tr>
63
+ </thead>
64
+ <tbody>
65
+ <?php
66
+ foreach ( $line_items as $item_id => $item ) {
67
+ $product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
68
+ ?>
69
+
70
+ <tr class="item">
71
+ <td width="75%">
72
+ <?php
73
+ $is_visible = $product && $product->is_visible();
74
+
75
+ echo $item['name'];
76
+
77
+ do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
78
+
79
+ $order->display_item_meta( $item );
80
+ $order->display_item_downloads( $item );
81
+
82
+ do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
83
+ ?>
84
+ </td>
85
+
86
+ <td width="25%">
87
+ <?php echo $item['qty']; ?>
88
+ </td>
89
+ </tr>
90
+
91
+ <?php } ?>
92
+ </tbody>
93
+ </table>
94
+
95
+ <table class="notes" cellpadding="0" cellspacing="0">
96
+ <tr>
97
+ <td>
98
+ <?php
99
+ // Customer notes.
100
+ if ( $templater->get_option( 'bewpi_show_customer_notes' ) ) {
101
+ // Note added by customer.
102
+ $customer_note = method_exists( 'WC_Order', 'get_customer_note' ) ? $order->get_customer_note() : $order->customer_note;
103
+ if ( $customer_note ) {
104
+ printf( '<strong>' . __( 'Note from customer: %s', 'woocommerce-pdf-invoices' ) . '</strong><br />', nl2br( $customer_note ) );
105
+ }
106
+
107
+ // Notes added by administrator on 'Edit Order' page.
108
+ foreach ( $order->get_customer_order_notes() as $custom_order_note ) {
109
+ printf( '<strong>' . __( 'Note to customer: %s', 'woocommerce-pdf-invoices' ) . '</strong><br />', nl2br( $custom_order_note->comment_content ) );
110
+ }
111
+ }
112
+ ?>
113
+ </td>
114
+ </tr>
115
+ </table>
includes/templates/packing-slip/simple/minimal/footer.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PDF packing slip footer template that will be visible on every page.
4
+ *
5
+ * This template can be overridden by copying it to youruploadsfolder/woocommerce-pdf-invoices/templates/packing-slip/simple/yourtemplatename/footer.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce PDF Invoices will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @author Bas Elbers
14
+ * @package WooCommerce_PDF_Invoices/Templates
15
+ * @version 0.0.1
16
+ */
17
+
18
+ ?>
19
+
20
+ <table class="footer" cellpadding="0" cellspacing="0">
21
+ <tr>
22
+ <td>
23
+ <?php printf( __( '%1$s of %2$s', 'woocommerce-pdf-invoices' ), '{PAGENO}', '{nbpg}' ); ?>
24
+ </td>
25
+ </tr>
26
+ </table>
includes/templates/packing-slip/simple/minimal/header.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PDF packing slip header template that will be visible on every page.
4
+ *
5
+ * This template can be overridden by copying it to youruploadsfolder/woocommerce-pdf-invoices/templates/packing-slip/simple/yourtemplatename/header.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce PDF Invoices will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @author Bas Elbers
14
+ * @package WooCommerce_PDF_Invoices/Templates
15
+ * @version 0.0.1
16
+ */
17
+
18
+ $templater = BEWPI()->templater();
19
+ $document = $templater->packing_slip;
20
+ $order = $templater->order;
21
+ ?>
22
+
23
+ <table cellpadding="0" cellspacing="0">
24
+ <tr class="top">
25
+ <td>
26
+ <?php
27
+ if ( $templater->get_logo_url() ) {
28
+ printf( '<img src="var:company_logo" style="max-height:100px;"/>' );
29
+ } else {
30
+ printf( '<h2>%s</h2>', esc_html( $templater->get_option( 'bewpi_company_name' ) ) );
31
+ }
32
+ ?>
33
+ </td>
34
+
35
+ <td>
36
+ <?php
37
+ printf( __( 'Order Date: %s', 'woocommerce-pdf-invoices' ), $document->get_formatted_order_date() );
38
+ printf( '<br />' );
39
+ printf( __( 'Order Number: %s', 'woocommerce-pdf-invoices' ), $order->get_order_number() );
40
+
41
+ $shipping_method = $order->get_shipping_method();
42
+ if ( $shipping_method ) {
43
+ printf( '<br />' );
44
+ printf( __( 'Shipping Method: %s', 'woocommerce-pdf-invoices' ), $shipping_method );
45
+ }
46
+ ?>
47
+ </td>
48
+ </tr>
49
+ </table>
includes/templates/packing-slip/simple/minimal/style.css ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ table, tr, td, div, p {
2
+ /*border:1px solid black;*/
3
+ }
4
+
5
+ h1, h2, h3, h4, h5, h6{
6
+ padding:0;
7
+ margin:0;
8
+ }
9
+
10
+ table, div {
11
+ font-family: opensans, Arial, sans-serif;
12
+ }
13
+
14
+ table {
15
+ width: 100%;
16
+ line-height: normal;
17
+ color: #555;
18
+ font-size: 12px;
19
+ margin-left: 60px; /* Document margin */
20
+ margin-right: 60px; /* Document margin */
21
+ }
22
+
23
+ table td, table th {
24
+ padding:5px;
25
+ vertical-align:top;
26
+ line-height: inherit;
27
+ }
28
+
29
+ table tr.top td {
30
+ padding-top: 40px;
31
+ }
32
+
33
+ /* Top information */
34
+ table tr.top td:nth-child(2){
35
+ text-align:right;
36
+ }
37
+
38
+ div.title div {
39
+ padding: 5px;
40
+ width: 40%;
41
+ float: left;
42
+ margin-left: 60px; /* Document margin */
43
+ line-height: 55px;
44
+ }
45
+
46
+ table tr.information td {
47
+ padding-bottom: 20px;
48
+ }
49
+
50
+ /* Customer billing address */
51
+ table tr.information td:nth-child(3){
52
+ text-align: right;
53
+ }
54
+
55
+ table tr.heading th {
56
+ font-weight: bold;
57
+ text-align: left;
58
+ color: #FFFFFF;
59
+ }
60
+
61
+ table tr.item td{
62
+ border-bottom: 1px solid #eee;
63
+ }
64
+
65
+ table.notes {
66
+ margin-top: 40px;
67
+ }
68
+
69
+ table.footer {
70
+ padding-top: 20px;
71
+ padding-bottom: 20px; /* Document margin */
72
+ width: 100%;
73
+ }
74
+
75
+ table.footer tr td {
76
+ padding: 5px;
77
+ vertical-align: bottom;
78
+ }
79
+
80
+ table.footer tr td {
81
+ text-align: right;
82
+ }
readme.txt CHANGED
@@ -1,26 +1,27 @@
1
  === Plugin Name ===
2
  Contributors: baaaaas
3
  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: 4.0
6
  Tested up to: 4.7
7
- Stable tag: 2.7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
12
 
13
  == Description ==
14
  *Invoicing can be time consuming. Well, not anymore! WooCommerce PDF Invoices automates the invoicing process by generating and sending it to your customers.*
15
 
16
- This WooCommerce plugin generates PDF invoices, attaches it to WooCommerce email types of your choice and sends invoices to your customers and Dropbox, Google Drive, OneDrive or Egnyte. The clean and customizable template will definitely suit your needs.
17
 
18
  = Main features =
19
  - Automatic PDF invoice generation and attachment.
20
  - Manually create or delete PDF invoice.
21
  - Attach PDF invoice to multiple WooCommerce email types of your choice.
 
22
  - Connect with Google Drive, Egnyte, Dropbox or OneDrive.
23
- - Clean PDF Invoice template with with many customization options.
24
  - WooCommerce order numbering or built-in sequential invoice numbering.
25
  - Many invoice and date format customization options.
26
  - Advanced items table with refunds, discounts, different item tax rates columns and more.
@@ -34,7 +35,7 @@ This WooCommerce plugin generates PDF invoices, attaches it to WooCommerce email
34
  > - Bulk generate PDF invoices<br />
35
  > - Bulk export and/or download PDF invoices<br />
36
  > - Periodically bill by generating and sending global invoices<br />
37
- > - Add additional PDF files to customer invoices.<br />
38
  > - Send customer invoices directly to multiple recipients like suppliers.<br />
39
  > - Compatible with [WooCommerce Subscriptions](http://www.woothemes.com/products/woocommerce-subscriptions) plugin emails.<br /><br />
40
  > [Upgrade to WooCommerce PDF Invoices Premium >>](http://wcpdfinvoices.com)
@@ -233,18 +234,23 @@ Important: A custom template is required to add a custom field to the PDF invoic
233
 
234
  == Changelog ==
235
 
236
- = 2.7.3 - April, 18, 2017 =
 
 
 
 
 
237
 
238
  - Improved: `setup_directories()` running on every (admin) request by only running when `WPI_UPLOADS_DIR` does not exists.
239
  - Fixed: 'Call to undefined function bewpi_get_id()' by dumping Composer autoloading.
240
  - Fixed: `GLOB_BRACE` unsupported on some systems.
241
 
242
- = 2.7.2 - April, 18, 2017 =
243
 
244
  - Added: Filter 'bewpi_my_account_pdf_name' to change the name of the PDF button on My Account page.
245
  - Fixed: 'Fatal error: Call to a member function get_id() on null' by checking object type in method `add_emailitin_as_recipient()`.
246
 
247
- = 2.7.1 - April, 14, 2017 =
248
 
249
  - Fixed: 'PHP Fatal error: Call to undefined method WC_Order::get_id()'.
250
 
1
  === Plugin Name ===
2
  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: 4.7
7
+ Stable tag: 2.8.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Automatically generate and attach customizable PDF Invoices and PDF Packing Slips for WooCommerce emails and directly send to Dropbox, Google Drive, OneDrive or Egnyte.
12
 
13
  == Description ==
14
  *Invoicing can be time consuming. Well, not anymore! WooCommerce PDF Invoices automates the invoicing process by generating and sending it to your customers.*
15
 
16
+ This WooCommerce plugin generates PDF invoices and PDF packing slips, attaches it to WooCommerce email types of your choice and sends invoices to your customers' Dropbox, Google Drive, OneDrive or Egnyte. Choose between multiple clean and customizable templates.
17
 
18
  = Main features =
19
  - Automatic PDF invoice generation and attachment.
20
  - Manually create or delete PDF invoice.
21
  - Attach PDF invoice to multiple WooCommerce email types of your choice.
22
+ - Generate PDF packing slips.
23
  - Connect with Google Drive, Egnyte, Dropbox or OneDrive.
24
+ - Multiple clean and highly customizable PDF Invoice templates.
25
  - WooCommerce order numbering or built-in sequential invoice numbering.
26
  - Many invoice and date format customization options.
27
  - Advanced items table with refunds, discounts, different item tax rates columns and more.
35
  > - Bulk generate PDF invoices<br />
36
  > - Bulk export and/or download PDF invoices<br />
37
  > - Periodically bill by generating and sending global invoices<br />
38
+ > - Add additional PDF files to PDF invoices.<br />
39
  > - Send customer invoices directly to multiple recipients like suppliers.<br />
40
  > - Compatible with [WooCommerce Subscriptions](http://www.woothemes.com/products/woocommerce-subscriptions) plugin emails.<br /><br />
41
  > [Upgrade to WooCommerce PDF Invoices Premium >>](http://wcpdfinvoices.com)
234
 
235
  == Changelog ==
236
 
237
+ = 2.8.0 - April 19, 2017 =
238
+
239
+ - Added: Packing Slip PDF document (for 'Minimal' template, not 'Micro').
240
+ - Fixed: 'Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given'.
241
+
242
+ = 2.7.3 - April 18, 2017 =
243
 
244
  - Improved: `setup_directories()` running on every (admin) request by only running when `WPI_UPLOADS_DIR` does not exists.
245
  - Fixed: 'Call to undefined function bewpi_get_id()' by dumping Composer autoloading.
246
  - Fixed: `GLOB_BRACE` unsupported on some systems.
247
 
248
+ = 2.7.2 - April 18, 2017 =
249
 
250
  - Added: Filter 'bewpi_my_account_pdf_name' to change the name of the PDF button on My Account page.
251
  - Fixed: 'Fatal error: Call to a member function get_id() on null' by checking object type in method `add_emailitin_as_recipient()`.
252
 
253
+ = 2.7.1 - April 14, 2017 =
254
 
255
  - Fixed: 'PHP Fatal error: Call to undefined method WC_Order::get_id()'.
256
 
vendor/composer/autoload_classmap.php CHANGED
@@ -13,6 +13,7 @@ return array(
13
  'BEWPI_Debug_Log' => $baseDir . '/includes/class-bewpi-debug-log.php',
14
  'BEWPI_General_Settings' => $baseDir . '/includes/admin/settings/class-bewpi-admin-settings-general.php',
15
  'BEWPI_Invoice' => $baseDir . '/includes/class-bewpi-invoice.php',
 
16
  'BEWPI_Template' => $baseDir . '/includes/class-bewpi-template.php',
17
  'BEWPI_Template_Settings' => $baseDir . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
18
  'BE_WooCommerce_PDF_Invoices' => $baseDir . '/includes/be-woocommerce-pdf-invoices.php',
13
  'BEWPI_Debug_Log' => $baseDir . '/includes/class-bewpi-debug-log.php',
14
  'BEWPI_General_Settings' => $baseDir . '/includes/admin/settings/class-bewpi-admin-settings-general.php',
15
  'BEWPI_Invoice' => $baseDir . '/includes/class-bewpi-invoice.php',
16
+ 'BEWPI_Packing_Slip' => $baseDir . '/includes/class-bewpi-packing-slip.php',
17
  'BEWPI_Template' => $baseDir . '/includes/class-bewpi-template.php',
18
  'BEWPI_Template_Settings' => $baseDir . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
19
  'BE_WooCommerce_PDF_Invoices' => $baseDir . '/includes/be-woocommerce-pdf-invoices.php',
vendor/composer/autoload_files.php CHANGED
@@ -15,5 +15,6 @@ return array(
15
  'f798df9b845b97a741a5b3bbafe9e9f1' => $baseDir . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
16
  '2aa17abb7be824ad60f94dca0ef59d51' => $baseDir . '/includes/admin/class-bewpi-admin-notices.php',
17
  '9c9b10e3be7550d98e5e0377df7ba50d' => $baseDir . '/includes/class-bewpi-invoice.php',
 
18
  '29ca3fefdeda79188a43887aba75af97' => $baseDir . '/includes/class-bewpi-template.php',
19
  );
15
  'f798df9b845b97a741a5b3bbafe9e9f1' => $baseDir . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
16
  '2aa17abb7be824ad60f94dca0ef59d51' => $baseDir . '/includes/admin/class-bewpi-admin-notices.php',
17
  '9c9b10e3be7550d98e5e0377df7ba50d' => $baseDir . '/includes/class-bewpi-invoice.php',
18
+ '4e885c35f3a0b931cbfa9ff495af0785' => $baseDir . '/includes/class-bewpi-packing-slip.php',
19
  '29ca3fefdeda79188a43887aba75af97' => $baseDir . '/includes/class-bewpi-template.php',
20
  );
vendor/composer/autoload_static.php CHANGED
@@ -16,6 +16,7 @@ class ComposerStaticInit94c7f0816fa203ee4c190ff0bde4f23b
16
  'f798df9b845b97a741a5b3bbafe9e9f1' => __DIR__ . '/../..' . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
17
  '2aa17abb7be824ad60f94dca0ef59d51' => __DIR__ . '/../..' . '/includes/admin/class-bewpi-admin-notices.php',
18
  '9c9b10e3be7550d98e5e0377df7ba50d' => __DIR__ . '/../..' . '/includes/class-bewpi-invoice.php',
 
19
  '29ca3fefdeda79188a43887aba75af97' => __DIR__ . '/../..' . '/includes/class-bewpi-template.php',
20
  );
21
 
@@ -27,6 +28,7 @@ class ComposerStaticInit94c7f0816fa203ee4c190ff0bde4f23b
27
  'BEWPI_Debug_Log' => __DIR__ . '/../..' . '/includes/class-bewpi-debug-log.php',
28
  'BEWPI_General_Settings' => __DIR__ . '/../..' . '/includes/admin/settings/class-bewpi-admin-settings-general.php',
29
  'BEWPI_Invoice' => __DIR__ . '/../..' . '/includes/class-bewpi-invoice.php',
 
30
  'BEWPI_Template' => __DIR__ . '/../..' . '/includes/class-bewpi-template.php',
31
  'BEWPI_Template_Settings' => __DIR__ . '/../..' . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
32
  'BE_WooCommerce_PDF_Invoices' => __DIR__ . '/../..' . '/includes/be-woocommerce-pdf-invoices.php',
16
  'f798df9b845b97a741a5b3bbafe9e9f1' => __DIR__ . '/../..' . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
17
  '2aa17abb7be824ad60f94dca0ef59d51' => __DIR__ . '/../..' . '/includes/admin/class-bewpi-admin-notices.php',
18
  '9c9b10e3be7550d98e5e0377df7ba50d' => __DIR__ . '/../..' . '/includes/class-bewpi-invoice.php',
19
+ '4e885c35f3a0b931cbfa9ff495af0785' => __DIR__ . '/../..' . '/includes/class-bewpi-packing-slip.php',
20
  '29ca3fefdeda79188a43887aba75af97' => __DIR__ . '/../..' . '/includes/class-bewpi-template.php',
21
  );
22
 
28
  'BEWPI_Debug_Log' => __DIR__ . '/../..' . '/includes/class-bewpi-debug-log.php',
29
  'BEWPI_General_Settings' => __DIR__ . '/../..' . '/includes/admin/settings/class-bewpi-admin-settings-general.php',
30
  'BEWPI_Invoice' => __DIR__ . '/../..' . '/includes/class-bewpi-invoice.php',
31
+ 'BEWPI_Packing_Slip' => __DIR__ . '/../..' . '/includes/class-bewpi-packing-slip.php',
32
  'BEWPI_Template' => __DIR__ . '/../..' . '/includes/class-bewpi-template.php',
33
  'BEWPI_Template_Settings' => __DIR__ . '/../..' . '/includes/admin/settings/class-bewpi-admin-settings-template.php',
34
  'BE_WooCommerce_PDF_Invoices' => __DIR__ . '/../..' . '/includes/be-woocommerce-pdf-invoices.php',