WooCommerce PDF Invoices - Version 2.0.5

Version Description

  • March 30, 2015 =

  • Fixed: Invoice number type doesn't get saved.

  • Improved: WPI_Invoice class code.

Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

admin/classes/woocommerce-pdf-invoices.php CHANGED
@@ -287,11 +287,11 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
287
  private function show_invoice_number_info($date, $number) {
288
  echo '<table class="invoice-info" width="100%">
289
  <tr>
290
- <td>Invoiced on:</td>
291
  <td align="right"><b>' . $date . '</b></td>
292
  </tr>
293
  <tr>
294
- <td>Invoice number:</td>
295
  <td align="right"><b>' . $number . '</b></td>
296
  </tr>
297
  </table>';
@@ -329,11 +329,10 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
329
 
330
  if( $invoice->exists() ) {
331
  $this->show_invoice_number_info($invoice->get_formatted_date(), $invoice->get_formatted_invoice_number());
332
- $this->show_invoice_button('View invoice', $post->ID, 'view', 'View', array('class="invoice-btn"') );
333
- $this->show_invoice_button('Cancel invoice', $post->ID, 'cancel', 'Cancel', array('class="invoice-btn"', 'onclick="return confirm(\'Are you sure to delete the invoice?\')"' ) );
334
  } else {
335
- $invoice->delete_all_post_meta();
336
- $this->show_invoice_button('Create invoice', $post->ID, 'create', 'Create', array('class="invoice-btn"') );
337
  }
338
  }
339
  }
287
  private function show_invoice_number_info($date, $number) {
288
  echo '<table class="invoice-info" width="100%">
289
  <tr>
290
+ <td>' . __('Invoiced on:', $this->textdomain ) . '</td>
291
  <td align="right"><b>' . $date . '</b></td>
292
  </tr>
293
  <tr>
294
+ <td>' . __('Invoice number:', $this->textdomain ) . '</td>
295
  <td align="right"><b>' . $number . '</b></td>
296
  </tr>
297
  </table>';
329
 
330
  if( $invoice->exists() ) {
331
  $this->show_invoice_number_info($invoice->get_formatted_date(), $invoice->get_formatted_invoice_number());
332
+ $this->show_invoice_button( __( 'View invoice', $this->textdomain ), $post->ID, 'view', __( 'View', $this->textdomain ), array('class="invoice-btn"') );
333
+ $this->show_invoice_button( __( 'Cancel invoice', $this->textdomain ), $post->ID, 'cancel', __( 'Cancel', $this->textdomain ), array('class="invoice-btn"', 'onclick="return confirm(\'' . __( 'Are you sure to delete the invoice?', $this->textdomain ) . '\')"' ) );
334
  } else {
335
+ $this->show_invoice_button( __( 'Create invoice', $this->textdomain ), $post->ID, 'create', __( 'Create', $this->textdomain ), array('class="invoice-btn"') );
 
336
  }
337
  }
338
  }
admin/classes/wpi-template-settings.php CHANGED
@@ -256,8 +256,8 @@ if ( ! class_exists( 'WPI_Template_Settings' ) ) {
256
  public function invoice_number_type_option() {
257
  ?>
258
  <select id="invoice-number-type-option" name="<?php echo $this->settings_key; ?>[invoice_number_type]">
259
- <option value="woocommerce_order_number" <?php selected($this->settings['invoice_number_type'], 'woocommerce_order_number'); ?>>WooCommerce order number</option>
260
- <option value="sequential_number" <?php selected($this->settings['invoice_number_type'], 'sequential_number'); ?>>Sequential number</option>
261
  </select>
262
  <?php
263
  }
@@ -542,6 +542,18 @@ if ( ! class_exists( 'WPI_Template_Settings' ) ) {
542
  );
543
  }
544
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  // Validate next invoice number
546
  if( isset( $input['next_invoice_number'] ) ) {
547
  if ($this->is_valid_int($input['next_invoice_number'])) {
256
  public function invoice_number_type_option() {
257
  ?>
258
  <select id="invoice-number-type-option" name="<?php echo $this->settings_key; ?>[invoice_number_type]">
259
+ <option value="woocommerce_order_number" <?php selected($this->settings['invoice_number_type'], 'woocommerce_order_number'); ?>><?php _e( 'WooCommerce order number', $this->textdomain ); ?></option>
260
+ <option value="sequential_number" <?php selected($this->settings['invoice_number_type'], 'sequential_number'); ?>><?php _e( 'Sequential number', $this->textdomain ); ?></option>
261
  </select>
262
  <?php
263
  }
542
  );
543
  }
544
 
545
+ if( isset( $input['invoice_number_type'] ) ) {
546
+ if ($this->is_valid_str($input['invoice_number_type'])) {
547
+ $output['invoice_number_type'] = $input['invoice_number_type'];
548
+ } else {
549
+ add_settings_error(
550
+ esc_attr($this->settings_key),
551
+ 'invalid-invoice-number-type',
552
+ __('Invalid type of invoice number.', $this->textdomain)
553
+ );
554
+ }
555
+ }
556
+
557
  // Validate next invoice number
558
  if( isset( $input['next_invoice_number'] ) ) {
559
  if ($this->is_valid_int($input['next_invoice_number'])) {
admin/views/invoice-sample.php DELETED
@@ -1,238 +0,0 @@
1
- <style>
2
- /* Page template CSS */
3
- #post-2 header, #post-2 footer {
4
- display: none;
5
- }
6
- /* Invoice template 1 CSS */
7
- #body {
8
- padding: 40px 40px 60px;
9
- color: #5A5E61;
10
- }
11
- .row {
12
- width: 100%;
13
- margin-bottom: 20px;
14
- }
15
- .logo .left, .logo .right, .logo .center {
16
- float: left;
17
- }
18
- .logo .center {
19
- width: 55%;
20
- margin: 0 auto;
21
- }
22
- .logo .left, .logo .right {
23
- width: 15%;
24
- }
25
- .logo .right {
26
- float: right;
27
- }
28
- #company-logo {
29
- margin: 0 auto;
30
- height: 150px;
31
- line-height: 150px;
32
- width: 150px;
33
- font-size: 18px;
34
- background-color: #57C56F;
35
- color: white;
36
- text-align: center;
37
- }
38
- #company-logo span {
39
- vertical-align: middle;
40
- line-height: 14px;
41
- font-weight: bold;
42
- }
43
- .company-address {
44
- text-align: right;
45
- padding-right: 40px;
46
- }
47
- .intro, .coupon, .title, #invoice-number {
48
- text-align: center;
49
- }
50
- .intro {
51
- font-size: 18px;
52
- }
53
- #expires, #invoice-number{
54
- font-size: 12px;
55
- }
56
- .coupon {
57
- padding-left: 40px;
58
- padding-right: 40px;
59
- background-color: #F8F8F8;
60
- color: #32373B;
61
- }
62
- #coupon-code {
63
- margin: 0 auto;
64
- border: 1px dashed #F8F8F8;
65
- padding: 10px;
66
- background-color: #52AF68;
67
- color: white;
68
- font-weight: bold;
69
- }
70
- .title {
71
- margin: 0;
72
- padding: 20px;
73
- color: white;
74
- background-color: #52AF68;
75
- }
76
- .title h1 {
77
- margin: 0; padding: 0;
78
- }
79
- #invoice-number {
80
- padding: 20px;
81
- background-color: #387747;
82
- color: white;
83
- font-size: 16px;
84
- }
85
- table {
86
- padding: 20px;
87
- width: 100%;
88
- background-color: #F8F8F8;
89
- }
90
- td, th {
91
- padding: 10px;
92
- text-align: right;
93
- font-weight: bold;
94
- vertical-align: middle;
95
- font-size: 14px;
96
- text-transform: uppercase;
97
- }
98
- tr.border-bottom td, tr.border-bottom th, td.border-bottom {
99
- border-bottom: 1px solid #E4E7E9;
100
- }
101
- .align-left { text-align: left; }
102
- .align-center { text-align: center; }
103
- .normalcase { text-transform: none; }
104
- .uppercase { text-transform: uppercase; }
105
- .circle { border-radius: 50%; }
106
- .product td {
107
- color: black;
108
- }
109
- .product td, .total {
110
- font-weight: bold;
111
- font-size: 16px;
112
- }
113
- .discount td, .subtotal td, .tax td, .shipping td {
114
- font-weight: normal;
115
- font-size: 12px;
116
- }
117
- .payment-method {
118
- font-size: 12px;
119
- font-weight: normal;
120
- }
121
- /*#footer {
122
- position: absolute;
123
- bottom: 0;
124
- width: 100%;
125
- font-size: 14px;
126
- }
127
- .questions, .company-address {
128
- padding: 40px;
129
- }
130
- .questions {
131
- width: 40%;
132
- float: left;
133
- }
134
- .questions p {
135
- margin: 0;
136
- }*/
137
- </style>
138
- <div id="body">
139
- <div class="row logo">
140
- <div class="left"></div>
141
- <div class="center">
142
- <div id="company-logo" class="circle"><span>Your Logo</span></div>
143
- </div>
144
- <div class="company-address right">
145
- <span class="uppercase"><strong>Company</strong></span><br/>
146
- Street<br/>
147
- City<br/>
148
- Country
149
- </div>
150
- </div>
151
- <div class="row intro">
152
- <h1>Thank you!</h1>
153
- <p>
154
- Thanks for shopping with us today.<br/>
155
- You'll find your invoice below.
156
- </p>
157
- </div>
158
- <!-- COUPON -->
159
- <div class="row coupon">
160
- <h3>20% off next purchase</h3>
161
- <p>
162
- For being a regular customer, here's a little something from <br/>
163
- us. Use the coupon code to get 20% off your next order!
164
- </p>
165
- <div id="coupon-code">
166
- c0up0n_c0d3
167
- </div>
168
- <p id="expires">
169
- <strong>Expires on: 1st January 2015</strong>
170
- </p>
171
- </div>
172
- <div class="row invoice">
173
- <div class="title">
174
- <h1>Your Invoice</h1>
175
- <span id="invoice-date" class="uppercase">25th dec 2014</span>
176
- </div>
177
- <div id="invoice-number">
178
- Invoice Number: 11342
179
- </div>
180
- <table class="products">
181
- <thead>
182
- <tr class="border-bottom">
183
- <th class="align-left">Description</th>
184
- <th class="align-center">Quantity</th>
185
- <th>Unit price</th>
186
- <th>Total</th>
187
- </tr>
188
- </thead>
189
- <tbody>
190
- <tr class="product border-bottom">
191
- <td class="align-left normalcase">Awesome Widget</td>
192
- <td class="align-center">1</td>
193
- <td>8.09</td>
194
- <td>8.09</td>
195
- </tr>
196
- <tr class="discount">
197
- <td colspan="2"></td>
198
- <td class="border-bottom">Discount</td>
199
- <td class="border-bottom">0.00</td>
200
- </tr>
201
- <tr class="subtotal">
202
- <td colspan="2"></td>
203
- <td class="border-bottom">Subtotal</td>
204
- <td class="border-bottom">8.09</td>
205
- </tr>
206
- <tr class="tax">
207
- <td colspan="2"></td>
208
- <td class="border-bottom">Tax 21%</td>
209
- <td class="border-bottom">1.70</td>
210
- </tr>
211
- <tr class="shipping">
212
- <td colspan="2"></td>
213
- <td class="border-bottom">Shipping</td>
214
- <td class="border-bottom normalcase">Free Shipping</td>
215
- </tr>
216
- <tr>
217
- <td class="payment-method align-left normalcase" colspan="2">Paid with Visa:<br/>**** **** **** 1234</td>
218
- <td class="total border-bottom">Total</td>
219
- <td class="total border-bottom">9.79</td>
220
- </tr>
221
- </tbody>
222
- </table>
223
- </div>
224
-
225
- <!--<div id="footer">
226
- <div class="questions">
227
- <span><strong>Questions?</strong></span>
228
- <p>
229
- No problem. You can get in touch with us on Facebook and Twitter and we'll get back to you as soon as we can.
230
- </p>
231
- </div>
232
- <div class="company-address">
233
- <span><strong>Company</strong></span><br/>
234
- Street<br/>
235
- City<br/>
236
- Country
237
- </div>
238
- </div>-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/img/my-company-logo-blue.png DELETED
Binary file
assets/img/my-company-logo.png DELETED
Binary file
assets/screenshot-1.png DELETED
Binary file
assets/screenshot-2.png DELETED
Binary file
assets/screenshot-3.png DELETED
Binary file
assets/screenshot-4.png DELETED
Binary file
assets/screenshot-5.png DELETED
Binary file
assets/screenshot-6.png DELETED
Binary file
bootstrap.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /**
4
- * @version 2.0.4
5
  * @package WooCommerce PDF Invoices
6
  * @author baaaaas
7
  *
@@ -9,7 +9,7 @@
9
  * Plugin Name: WooCommerce PDF Invoices
10
  * Plugin URI:
11
  * Description: Generates customized PDF invoices and automatically attaches it to a WooCommerce email type of your choice. Now sending invoices to your Google Drive, Egnyte, Dropbox or OneDrive and it's all FREE!
12
- * Version: 2.0.4
13
  * Author: baaaaas
14
  * Author URI:
15
  * License: GPL-2.0+
@@ -33,6 +33,7 @@ require_once( WPI_DIR . 'admin/classes/woocommerce-pdf-invoices.php' );
33
  require_once( WPI_DIR . 'admin/classes/wpi-settings.php' );
34
  require_once( WPI_DIR . 'admin/classes/wpi-general-settings.php' );
35
  require_once( WPI_DIR . 'admin/classes/wpi-template-settings.php' );
 
36
  require_once( WPI_DIR . 'includes/classes/wpi-invoice.php' );
37
 
38
  if ( class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
1
  <?php
2
 
3
  /**
4
+ * @version 2.0.5
5
  * @package WooCommerce PDF Invoices
6
  * @author baaaaas
7
  *
9
  * Plugin Name: WooCommerce PDF Invoices
10
  * Plugin URI:
11
  * Description: Generates customized PDF invoices and automatically attaches it to a WooCommerce email type of your choice. Now sending invoices to your Google Drive, Egnyte, Dropbox or OneDrive and it's all FREE!
12
+ * Version: 2.0.5
13
  * Author: baaaaas
14
  * Author URI:
15
  * License: GPL-2.0+
33
  require_once( WPI_DIR . 'admin/classes/wpi-settings.php' );
34
  require_once( WPI_DIR . 'admin/classes/wpi-general-settings.php' );
35
  require_once( WPI_DIR . 'admin/classes/wpi-template-settings.php' );
36
+ require_once( WPI_DIR . 'includes/classes/wpi-document.php' );
37
  require_once( WPI_DIR . 'includes/classes/wpi-invoice.php' );
38
 
39
  if ( class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
includes/classes/wpi-document.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ if ( ! class_exists( 'WPI_Document' ) ) {
7
+
8
+ class WPI_Document{
9
+
10
+ /**
11
+ * @var
12
+ */
13
+ protected $order;
14
+
15
+ /**
16
+ * Textdomain from the plugin.
17
+ * @var
18
+ */
19
+ protected $textdomain = 'be-woocommerce-pdf-invoices';
20
+
21
+ /**
22
+ * All settings from general tab.
23
+ * @var array
24
+ */
25
+ protected $general_settings;
26
+
27
+ /**
28
+ * All settings from template tab.
29
+ * @var array
30
+ */
31
+ protected $template_settings;
32
+
33
+ /**
34
+ * Path to invoice in tmp dir.
35
+ * @var
36
+ */
37
+ protected $file;
38
+
39
+ /**
40
+ * @param $order
41
+ */
42
+ public function __construct( $order ) {
43
+
44
+ $this->order = $order;
45
+
46
+ $this->general_settings = (array)get_option('general_settings');
47
+
48
+ $this->template_settings = (array)get_option('template_settings');
49
+
50
+ }
51
+
52
+ /**
53
+ * Generates the invoice with MPDF lib.
54
+ * @param $dest
55
+ * @return string
56
+ */
57
+ public function generate($dest) {
58
+ if( !$this->exists() ) {
59
+
60
+ $this->delete_all_post_meta();
61
+
62
+ $last_invoice_number = $this->template_settings['last_invoice_number'];
63
+
64
+ // Get the up following invoice number
65
+ $next_invoice_number = $this->get_next_invoice_number($last_invoice_number);
66
+
67
+ if ($this->template_settings['invoice_number_type'] == 'sequential_number') {
68
+
69
+ // Create new invoice number and insert into database.
70
+ $this->create_invoice_number($next_invoice_number);
71
+
72
+ // Get the new invoice number from db.
73
+ $this->number = $this->get_invoice_number();
74
+
75
+ } else {
76
+
77
+ $this->number = $this->order->id;
78
+
79
+ }
80
+
81
+ $this->template_settings['last_invoice_number'] = $this->number;
82
+
83
+ $this->formatted_number = $this->format_invoice_number();
84
+
85
+ update_option('template_settings', $this->template_settings);
86
+
87
+ $this->date = $this->create_formatted_date();
88
+
89
+ // Go generate
90
+ set_time_limit(0);
91
+ include WPI_DIR . "lib/mpdf/mpdf.php";
92
+
93
+ $mpdf = new mPDF('', 'A4', 0, '', 17, 17, 20, 50, 0, 0, '');
94
+ $mpdf->useOnlyCoreFonts = true; // false is default
95
+ $mpdf->SetTitle(($this->template_settings['company_name'] != "") ? $this->template_settings['company_name'] . " - Invoice" : "Invoice");
96
+ $mpdf->SetAuthor(($this->template_settings['company_name'] != "") ? $this->template_settings['company_name'] : "");
97
+ $mpdf->showWatermarkText = false;
98
+ $mpdf->SetDisplayMode('fullpage');
99
+ $mpdf->useSubstitutions = false;
100
+
101
+ ob_start();
102
+
103
+ require_once $this->get_template();
104
+
105
+ $html = ob_get_contents();
106
+
107
+ ob_end_clean();
108
+
109
+ $footer = $this->get_footer();
110
+
111
+ $mpdf->SetHTMLFooter($footer);
112
+
113
+ $mpdf->WriteHTML($html);
114
+
115
+ $file = WPI_TMP_DIR . $this->formatted_number . ".pdf";
116
+
117
+ $mpdf->Output($file, $dest);
118
+
119
+ return $file;
120
+
121
+ } else {
122
+ die('Invoice already exists.');
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Get the invoice if exist and show.
128
+ * @param $download
129
+ */
130
+ public function view_invoice($download) {
131
+ if ($this->exists()) {
132
+ $file = WPI_TMP_DIR . $this->formatted_number . ".pdf";
133
+ $filename = $this->formatted_number . ".pdf";
134
+
135
+ if ($download) {
136
+ header('Content-type: application / pdf');
137
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
138
+ header('Content-Transfer-Encoding: binary');
139
+ header('Content-Length: ' . filesize($file));
140
+ header('Accept-Ranges: bytes');
141
+ } else {
142
+ header('Content-type: application/pdf');
143
+ header('Content-Disposition: inline; filename="' . $filename . '"');
144
+ header('Content-Transfer-Encoding: binary');
145
+ header('Accept-Ranges: bytes');
146
+ }
147
+
148
+ @readfile($file);
149
+ exit;
150
+
151
+ } else {
152
+ die('No invoice found.');
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Delete invoice from tmp dir.
158
+ */
159
+ public function delete() {
160
+ if ($this->exists()) {
161
+ unlink($this->file);
162
+ }
163
+ $this->delete_all_post_meta();
164
+ }
165
+
166
+ /**
167
+ * Checks if the invoice exists.
168
+ * @return bool
169
+ */
170
+ public function exists() {
171
+ $this->file = WPI_TMP_DIR . $this->get_formatted_invoice_number() . ".pdf";
172
+ return file_exists($this->file);
173
+ }
174
+
175
+ /**
176
+ * Gets the file path.
177
+ * @return mixed
178
+ */
179
+ public function get_file() {
180
+ return $this->file;
181
+ }
182
+
183
+ /**
184
+ * Gets the template from template dir.
185
+ * @return string
186
+ */
187
+ private function get_template() {
188
+ return WPI_TEMPLATES_DIR . $this->template_settings['template'];
189
+ }
190
+ }
191
+ }
includes/classes/wpi-invoice.php CHANGED
@@ -9,71 +9,49 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
9
  * Makes the invoice.
10
  * Class WPI_Invoice
11
  */
12
- class WPI_Invoice {
13
 
14
  /*
15
  * WooCommerce order
16
  */
17
- private $order;
18
-
19
- /**
20
- * Textdomain from the plugin.
21
- * @var
22
- */
23
- private $textdomain;
24
-
25
- /**
26
- * All settings from general tab.
27
- * @var array
28
- */
29
- private $general_settings;
30
-
31
- /**
32
- * All settings from template tab.
33
- * @var array
34
- */
35
- private $template_settings;
36
 
37
  /**
38
  * Invoice number
39
  * @var
40
  */
41
- private $number;
42
 
43
  /**
44
  * Formatted invoice number with prefix and/or suffix
45
  * @var
46
  */
47
- private $formatted_number;
48
 
49
  /**
50
  * Invoice number database meta key
51
  * @var string
52
  */
53
- private $invoice_number_meta_key = '_bewpi_invoice_number';
54
-
55
- /**
56
- * Path to invoice in tmp dir.
57
- * @var
58
- */
59
- private $file;
60
 
61
  /**
62
  * Creation date.
63
  * @var
64
  */
65
- private $date;
66
 
67
  /**
68
  * Initialize invoice with WooCommerce order and plugin textdomain.
69
  * @param string $order
70
  * @param $textdomain
71
  */
72
- public function __construct($order, $textdomain = 'be-woocommerce-pdf-invoices') {
73
- $this->order = $order;
74
- $this->textdomain = $textdomain;
75
- $this->general_settings = (array)get_option('general_settings');
76
- $this->template_settings = (array)get_option('template_settings');
 
 
77
 
78
  $this->init();
79
  }
@@ -82,21 +60,18 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
82
  * Gets all the existing invoice data from database or creates new invoice number.
83
  */
84
  private function init() {
85
- if ($this->template_settings['invoice_number_type'] == 'sequential_number') {
86
- $this->number = get_post_meta($this->order->id, '_bewpi_invoice_number', true);
87
- } else {
88
- $this->number = $this->order->id;
89
- }
90
-
91
  $this->formatted_number = get_post_meta($this->order->id, '_bewpi_formatted_invoice_number', true);
92
- $this->date = get_post_meta($this->order->id, '_bewpi_invoice_date', true);
93
  }
94
 
95
  /**
96
  * Gets next invoice number based on the user input.
97
  * @param $order_id
98
  */
99
- function get_next_invoice_number($last_invoice_number) {
100
  // Check if it has been the first of january.
101
  if ($this->template_settings['reset_invoice_number']) {
102
  $last_year = $this->template_settings['last_invoiced_year'];
@@ -126,7 +101,7 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
126
  * Create invoice date
127
  * @return bool|string
128
  */
129
- public function create_formatted_date() {
130
  $date_format = $this->template_settings['invoice_date_format'];
131
  //$date = DateTime::createFromFormat('Y-m-d H:i:s', $this->order->order_date);
132
  //$date = date( $date_format );
@@ -149,7 +124,7 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
149
  * @param $order_id
150
  * @param $number
151
  */
152
- function create_invoice_number($next_number) {
153
  global $wpdb;
154
 
155
  // attempt the query up to 3 times for a much higher success rate if it fails (due to Deadlock)
@@ -175,7 +150,7 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
175
  * Format the invoice number with prefix and/or suffix.
176
  * @return mixed
177
  */
178
- private function format_invoice_number() {
179
  $invoice_number_format = $this->template_settings['invoice_format'];
180
  $digit_str = "%0" . $this->template_settings['invoice_number_digits'] . "s";
181
  $this->number = sprintf($digit_str, $this->number);
@@ -193,138 +168,17 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
193
  /**
194
  * When an invoice gets generated again then the post meta needs to get deleted.
195
  */
196
- public function delete_all_post_meta() {
197
  delete_post_meta( $this->order->id, '_bewpi_invoice_number' );
198
  delete_post_meta( $this->order->id, '_bewpi_formatted_invoice_number' );
199
  delete_post_meta( $this->order->id, '_bewpi_invoice_date' );
200
  }
201
 
202
- /**
203
- * Generates the invoice with MPDF lib.
204
- * @param $dest
205
- * @return string
206
- */
207
- public function generate($dest) {
208
- if( !$this->exists() ) {
209
-
210
- $last_invoice_number = $this->template_settings['last_invoice_number'];
211
-
212
- // Get the up following invoice number
213
- $next_invoice_number = $this->get_next_invoice_number($last_invoice_number);
214
-
215
- if ($this->template_settings['invoice_number_type'] == 'sequential_number') {
216
-
217
- // Create new invoice number and insert into database.
218
- $this->create_invoice_number($next_invoice_number);
219
-
220
- // Get the new invoice number from db.
221
- $this->number = $this->get_invoice_number();
222
-
223
- } else {
224
-
225
- $this->number = $this->order->id;
226
-
227
- }
228
-
229
- $this->template_settings['last_invoice_number'] = $this->number;
230
-
231
- $this->formatted_number = $this->format_invoice_number();
232
-
233
- update_option('template_settings', $this->template_settings);
234
-
235
- $this->date = $this->create_formatted_date();
236
-
237
- // Go generate
238
- set_time_limit(0);
239
- include WPI_DIR . "lib/mpdf/mpdf.php";
240
-
241
- $mpdf = new mPDF('', 'A4', 0, '', 17, 17, 20, 50, 0, 0, '');
242
- $mpdf->useOnlyCoreFonts = true; // false is default
243
- $mpdf->SetTitle(($this->template_settings['company_name'] != "") ? $this->template_settings['company_name'] . " - Invoice" : "Invoice");
244
- $mpdf->SetAuthor(($this->template_settings['company_name'] != "") ? $this->template_settings['company_name'] : "");
245
- $mpdf->showWatermarkText = false;
246
- $mpdf->SetDisplayMode('fullpage');
247
- $mpdf->useSubstitutions = false;
248
-
249
- ob_start();
250
-
251
- require_once $this->get_template();
252
-
253
- $html = ob_get_contents();
254
-
255
- ob_end_clean();
256
-
257
- $footer = $this->get_footer();
258
-
259
- $mpdf->SetHTMLFooter($footer);
260
-
261
- $mpdf->WriteHTML($html);
262
-
263
- $file = WPI_TMP_DIR . $this->formatted_number . ".pdf";
264
-
265
- $mpdf->Output($file, $dest);
266
-
267
- return $file;
268
-
269
- } else {
270
- die('Invoice already exists.');
271
- }
272
- }
273
-
274
- /**
275
- * Get the invoice if exist and show.
276
- * @param $download
277
- */
278
- public function view_invoice($download) {
279
- if ($this->exists()) {
280
- $file = WPI_TMP_DIR . $this->formatted_number . ".pdf";
281
- $filename = $this->formatted_number . ".pdf";
282
-
283
- if ($download) {
284
- header('Content-type: application / pdf');
285
- header('Content-Disposition: attachment; filename="' . $filename . '"');
286
- header('Content-Transfer-Encoding: binary');
287
- header('Content-Length: ' . filesize($file));
288
- header('Accept-Ranges: bytes');
289
- } else {
290
- header('Content-type: application/pdf');
291
- header('Content-Disposition: inline; filename="' . $filename . '"');
292
- header('Content-Transfer-Encoding: binary');
293
- header('Accept-Ranges: bytes');
294
- }
295
-
296
- @readfile($file);
297
- exit;
298
-
299
- } else {
300
- die('No invoice found.');
301
- }
302
- }
303
-
304
- /**
305
- * Delete invoice from tmp dir.
306
- */
307
- public function delete() {
308
- if ($this->exists()) {
309
- unlink($this->file);
310
- $this->delete_all_post_meta();
311
- }
312
- }
313
-
314
- /**
315
- * Checks if the invoice exists.
316
- * @return bool
317
- */
318
- public function exists() {
319
- $this->file = WPI_TMP_DIR . $this->get_formatted_invoice_number() . ".pdf";
320
- return file_exists($this->file);
321
- }
322
-
323
  /**
324
  * Returns MPDF footer.
325
  * @return string
326
  */
327
- function get_footer() {
328
  ob_start(); ?>
329
 
330
  <table class="foot">
@@ -369,7 +223,7 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
369
  * @param $order_id
370
  * @return mixed
371
  */
372
- function get_invoice_number() {
373
  global $wpdb;
374
 
375
  $results = $wpdb->get_results(
@@ -412,22 +266,6 @@ if ( ! class_exists( 'WPI_Invoice' ) ) {
412
  return date("Y", strtotime($this->order->order_date));
413
  }
414
 
415
- /**
416
- * Gets the template from template dir.
417
- * @return string
418
- */
419
- private function get_template() {
420
- return WPI_TEMPLATES_DIR . $this->template_settings['template'];
421
- }
422
-
423
- /**
424
- * Gets the file path.
425
- * @return mixed
426
- */
427
- public function get_file() {
428
- return $this->file;
429
- }
430
-
431
  /**
432
  * Get total with or without refunds
433
  */
9
  * Makes the invoice.
10
  * Class WPI_Invoice
11
  */
12
+ class WPI_Invoice extends WPI_Document{
13
 
14
  /*
15
  * WooCommerce order
16
  */
17
+ public $order;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  /**
20
  * Invoice number
21
  * @var
22
  */
23
+ protected $number;
24
 
25
  /**
26
  * Formatted invoice number with prefix and/or suffix
27
  * @var
28
  */
29
+ protected $formatted_number;
30
 
31
  /**
32
  * Invoice number database meta key
33
  * @var string
34
  */
35
+ protected $invoice_number_meta_key = '_bewpi_invoice_number';
 
 
 
 
 
 
36
 
37
  /**
38
  * Creation date.
39
  * @var
40
  */
41
+ protected $date;
42
 
43
  /**
44
  * Initialize invoice with WooCommerce order and plugin textdomain.
45
  * @param string $order
46
  * @param $textdomain
47
  */
48
+ public function __construct( $order ) {
49
+
50
+ parent::__construct( $order );
51
+
52
+ // Init if the invoice already exists.
53
+ if( get_post_meta( $this->order->id, '_bewpi_invoice_date', true ) === '' )
54
+ return;
55
 
56
  $this->init();
57
  }
60
  * Gets all the existing invoice data from database or creates new invoice number.
61
  */
62
  private function init() {
63
+ ( $this->template_settings['invoice_number_type'] === 'sequential_number' )
64
+ ? $this->number = get_post_meta($this->order->id, '_bewpi_invoice_number', true)
65
+ : $this->number = $this->order->id;
 
 
 
66
  $this->formatted_number = get_post_meta($this->order->id, '_bewpi_formatted_invoice_number', true);
67
+ $this->date = get_post_meta( $this->order->id, '_bewpi_invoice_date', true );
68
  }
69
 
70
  /**
71
  * Gets next invoice number based on the user input.
72
  * @param $order_id
73
  */
74
+ protected function get_next_invoice_number( $last_invoice_number ) {
75
  // Check if it has been the first of january.
76
  if ($this->template_settings['reset_invoice_number']) {
77
  $last_year = $this->template_settings['last_invoiced_year'];
101
  * Create invoice date
102
  * @return bool|string
103
  */
104
+ protected function create_formatted_date() {
105
  $date_format = $this->template_settings['invoice_date_format'];
106
  //$date = DateTime::createFromFormat('Y-m-d H:i:s', $this->order->order_date);
107
  //$date = date( $date_format );
124
  * @param $order_id
125
  * @param $number
126
  */
127
+ protected function create_invoice_number($next_number) {
128
  global $wpdb;
129
 
130
  // attempt the query up to 3 times for a much higher success rate if it fails (due to Deadlock)
150
  * Format the invoice number with prefix and/or suffix.
151
  * @return mixed
152
  */
153
+ protected function format_invoice_number() {
154
  $invoice_number_format = $this->template_settings['invoice_format'];
155
  $digit_str = "%0" . $this->template_settings['invoice_number_digits'] . "s";
156
  $this->number = sprintf($digit_str, $this->number);
168
  /**
169
  * When an invoice gets generated again then the post meta needs to get deleted.
170
  */
171
+ protected function delete_all_post_meta() {
172
  delete_post_meta( $this->order->id, '_bewpi_invoice_number' );
173
  delete_post_meta( $this->order->id, '_bewpi_formatted_invoice_number' );
174
  delete_post_meta( $this->order->id, '_bewpi_invoice_date' );
175
  }
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  /**
178
  * Returns MPDF footer.
179
  * @return string
180
  */
181
+ protected function get_footer() {
182
  ob_start(); ?>
183
 
184
  <table class="foot">
223
  * @param $order_id
224
  * @return mixed
225
  */
226
+ public function get_invoice_number() {
227
  global $wpdb;
228
 
229
  $results = $wpdb->get_results(
266
  return date("Y", strtotime($this->order->order_date));
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  /**
270
  * Get total with or without refunds
271
  */
includes/views/templates/invoice-flat.php DELETED
@@ -1,281 +0,0 @@
1
- <style>
2
- /* Page template CSS */
3
- #post-2 header, #post-2 footer {
4
- display: none;
5
- }
6
- h4 {
7
- color: #32373A;
8
- border-bottom: 2px solid #E4E7E9;
9
- padding: 0 0 3px 0; margin: 0;
10
- text-transform: uppercase;
11
- }
12
- p {
13
- margin: 8px 0 0 0; padding: 0 ;
14
- }
15
- /* Invoice template 1 CSS */
16
- #container {
17
- min-height: 100%;
18
- position: relative;
19
- color: #32373A;
20
- }
21
- #body {
22
- padding: 40px 40px 0;
23
- }
24
- .row {
25
- width: 100%;
26
- margin-bottom: 30px;
27
- }
28
- .logo {
29
- width: 100%;
30
- display: table;
31
- }
32
- .logo-wrapper {
33
- display: table-cell;
34
- text-align: center;
35
- vertical-align: middle;
36
- font-size: 18px;
37
- }
38
- .company-logo {
39
- max-height: 150px;
40
- }
41
- .coupon, .title, #invoice-number {
42
- text-align: center;
43
- }
44
- .intro {
45
- font-size: 16px;
46
- text-align: center;
47
- }
48
- #expires {
49
- font-size: 12px;
50
- }
51
- .coupon {
52
- padding-left: 40px;
53
- padding-right: 40px;
54
- background-color: #F8F8F8;
55
- color: #32373B;
56
- }
57
- #coupon-code {
58
- margin: 0 auto;
59
- border: 1px dashed #F8F8F8;
60
- padding: 10px;
61
- background-color: #52AF68;
62
- color: white;
63
- font-weight: bold;
64
- }
65
- .title {
66
- margin: 0;
67
- padding: 20px;
68
- color: white;
69
- background-color: #52AF68;
70
- }
71
- .title h1, .title span {
72
- margin: 0; padding: 0;
73
- }
74
- #invoice-number {
75
- padding: 20px;
76
- background-color: #387747;
77
- color: white;
78
- font-size: 14px;
79
- }
80
- table.products {
81
- padding: 20px 20px;
82
- width: 100%;
83
- background-color: #F8F8F8;
84
- /*margin-bottom: 20px;*/
85
- }
86
- td, th {
87
- padding: 10px;
88
- text-align: right;
89
- font-weight: bold;
90
- vertical-align: middle;
91
- font-size: 14px;
92
- text-transform: uppercase;
93
- }
94
- tr.border-bottom td, td.border-bottom {
95
- border-bottom: 1px solid #E4E7E9;
96
- }
97
- tr.border-bottom th {
98
- border-bottom: 3px solid #E4E7E9;
99
- }
100
- .align-left { text-align: left; }
101
- .align-center { text-align: center; }
102
- .align-right { text-align: right; }
103
- .normalcase { text-transform: none; }
104
- .uppercase { text-transform: uppercase; }
105
- .circle { border-radius: 50%; }
106
- .two-column { width: 40%; text-transform: uppercase; padding: 20px 30px; background-color: #F8F8F8; }
107
- .one-column { width: 100%; padding: 20px 30px; background-color: #F8F8F8; }
108
- .left { float: left; text-align: left; }
109
- .right { float: right; text-align: right; }
110
- .border-bottom-non-product { border-bottom: 2px solid #E4E7E9; }
111
- .product td {
112
- font-weight: normal;
113
- }
114
- .total {
115
- border-bottom: 3px solid #E4E7E9;
116
- }
117
- .discount td, .subtotal td, .tax td, .shipping td, .total td {
118
- font-weight: bold;
119
- }
120
- .payment-method{
121
- font-size: 12px;
122
- font-weight: normal;
123
- }
124
- .payment-method {
125
- vertical-align: middle;
126
- }
127
- #footer {
128
- width: 100%;
129
- font-size: 14px;
130
- background-color: #3A3F43;
131
- color: white;
132
- padding: 40px;
133
- }
134
- .questions {
135
- float: left;
136
- width: 40%;
137
- }
138
- .company-address {
139
- float: right;
140
- text-align: right;
141
- width: 35%;
142
- }
143
- </style>
144
- <div id="container">
145
- <div id="body">
146
- <div class="row logo">
147
- <div class="logo-wrapper">
148
- <!--<div id="company-logo" class="circle uppercase"><span>My company</span></div>-->
149
- <?php if( $this->template_settings['company_logo'] != "" ) { ?>
150
- <img class="company-logo" src="<?php echo $this->template_settings['company_logo']; ?>" alt="Company logo"/>
151
- <?php } else { ?>
152
- <div class="company-logo"><?php echo $this->template_settings['company_name']; ?></div>
153
- <?php } ?>
154
- </div>
155
- </div>
156
- <div class="row intro">
157
- <?php echo $this->template_settings['intro_text']; ?>
158
- </div>
159
- <div class="row">
160
- <div class="two-column left">
161
- <h4>Billing address</h4>
162
- <p class="normalcase">
163
- <?php echo $this->order->get_formatted_billing_address(); ?>
164
- </p>
165
- </div>
166
- <div class="two-column right">
167
- <h4>Shipping address</h4>
168
- <p class="normalcase">
169
- <?php echo $this->order->get_formatted_shipping_address(); ?>
170
- </p>
171
- </div>
172
- </div>
173
- <!-- COUPON -->
174
- <!--<div class="row coupon">
175
- <h3>20% off next purchase</h3>
176
- <p>
177
- For being a regular customer, here's a little something from <br/>
178
- us. Use the coupon code to get 20% off your next order!
179
- </p>
180
- <div id="coupon-code">
181
- c0up0n_c0d3
182
- </div>
183
- <p id="expires">
184
- <strong>Expires on: 1st January 2015</strong>
185
- </p>
186
- </div>-->
187
- <div class="row invoice">
188
- <div class="title">
189
- <h1>Your Invoice</h1>
190
- <span id="invoice-date" class="uppercase"><?php echo $this->get_formatted_date(); ?></span>
191
- </div>
192
- <div id="invoice-number">
193
- Invoice Number: <?php echo $this->get_formatted_invoice_number(); ?>
194
- </div>
195
- <table class="products">
196
- <thead>
197
- <tr class="border-bottom">
198
- <th class="align-left">Description</th>
199
- <?php if( $this->template_settings['show_sku'] ) { $colspan = 3; ?>
200
- <th class="align-center uppercase">SKU</th>
201
- <?php } else { $colspan = 2; } ?>
202
- <th class="align-center">Quantity</th>
203
- <th>Unit price</th>
204
- <th>Total</th>
205
- </tr>
206
- </thead>
207
- <tbody>
208
- <?php foreach( $this->order->get_items( 'line_item' ) as $item ) {
209
- $product = wc_get_product( $item['product_id'] ); ?>
210
- <tr class="product border-bottom">
211
- <td class="align-left normalcase"><?php echo $product->get_title(); ?></td>
212
- <?php if( $this->template_settings['show_sku'] ) { ?>
213
- <td class="align-center uppercase"><?php echo $product->get_sku(); ?></td>
214
- <?php } ?>
215
- <td class="align-center"><?php echo $item['qty']; ?></td>
216
- <td><?php echo wc_price( $product->get_price_excluding_tax() ); ?></td>
217
- <td><?php echo wc_price( $product->get_price_excluding_tax( $item['qty'] ) ); ?></td>
218
- </tr>
219
- <?php } ?>
220
- <?php if( $this->template_settings['show_discount'] && $this->order->get_total_discount != 0 ) { ?>
221
- <tr class="discount">
222
- <td colspan="<?php echo $colspan; ?>"></td>
223
- <td class="border-bottom-non-product">Discount</td>
224
- <td class="border-bottom-non-product"><?php echo wc_price( $this->order->get_total_discount() ); ?></td>
225
- </tr>
226
- <?php } ?>
227
- <?php if( $this->template_settings['show_shipping'] ) { ?>
228
- <tr class="shipping">
229
- <td colspan="<?php echo $colspan; ?>"></td>
230
- <td class="border-bottom-non-product">Shipping</td>
231
- <td class="border-bottom-non-product normalcase"><?php echo wc_price( $this->order->get_total_shipping() ); ?></td>
232
- </tr>
233
- <?php } ?>
234
- <?php if( $this->template_settings['show_subtotal'] ) { ?>
235
- <tr class="subtotal">
236
- <td colspan="<?php echo $colspan; ?>"></td>
237
- <td class="border-bottom-non-product">Subtotal</td>
238
- <td class="border-bottom-non-product"><?php echo wc_price( $this->order->get_subtotal() ); ?></td>
239
- </tr>
240
- <?php } ?>
241
- <?php if( $this->template_settings['show_tax'] ) { ?>
242
- <tr class="tax">
243
- <td colspan="<?php echo $colspan; ?>"></td>
244
- <td class="border-bottom-non-product">Tax</td>
245
- <td class="border-bottom-non-product"><?php echo wc_price( $this->order->get_total_tax() ); ?></td>
246
- </tr>
247
- <?php } ?>
248
- <tr>
249
- <td class="payment-method align-left normalcase" colspan="<?php echo $colspan; ?>">Payment via <?php echo $this->order->payment_method_title; ?></td>
250
- <td class="total">Total</td>
251
- <td class="total"><?php echo wc_price( $this->order->get_total() ); ?></td>
252
- </tr>
253
- </tbody>
254
- </table>
255
- </div>
256
- <?php if( count($this->order->get_customer_order_notes()) > 0 ) { ?>
257
- <div class="row one-column align-center order-notes">
258
- <h4>Order notes</h4>
259
- <p>
260
- <?php
261
- foreach( $this->order->get_customer_order_notes() as $note ) {
262
- echo $note->comment_content . "<br/>";
263
- }
264
- ?>
265
- </p>
266
- </div>
267
- <?php } ?>
268
- </div>
269
- <div id="footer">
270
- <div class="questions">
271
- <!--<span><strong>Questions?</strong></span>
272
- <p>
273
- No problem. You can get in touch with us on Facebook and Twitter and we'll get back to you as soon as we can.
274
- </p>-->
275
- </div>
276
- <div class="company-address normalcase">
277
- <?php echo nl2br( $this->template_settings['company_address'] ); ?>
278
- <?php echo nl2br( $this->template_settings['company_details'] ); ?>
279
- </div>
280
- </div>
281
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/be-woocommerce-pdf-invoices-nl_NL.mo CHANGED
Binary file
lang/be-woocommerce-pdf-invoices-nl_NL.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices\n"
4
- "POT-Creation-Date: 2015-03-30 16:10+0100\n"
5
- "PO-Revision-Date: 2015-03-30 16:11+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: nl_NL\n"
@@ -36,6 +36,42 @@ msgstr "Facturen"
36
  msgid "PDF Invoice"
37
  msgstr "PDF Factuur"
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  #: admin/classes/wpi-general-settings.php:74
40
  msgid "General Settings"
41
  msgstr "Algemene Opties"
@@ -88,7 +124,7 @@ msgstr "Ongeldig type Email."
88
 
89
  #: admin/classes/wpi-general-settings.php:197
90
  #: admin/classes/wpi-general-settings.php:210
91
- #: admin/classes/wpi-template-settings.php:630
92
  msgid "Please don't try to change the values."
93
  msgstr "Probeer de waardes niet te wijzigen a.u.b."
94
 
@@ -203,6 +239,14 @@ msgstr ""
203
  msgid "Remove logo"
204
  msgstr "Verwijder logo"
205
 
 
 
 
 
 
 
 
 
206
  #: admin/classes/wpi-template-settings.php:352
207
  msgid "Invoice number to use for next invoice."
208
  msgstr "Factuurnummer te gebruiken voor de volgende factuur."
@@ -251,43 +295,47 @@ msgstr "Ongeldige bedsrijfsnaam."
251
  msgid "Invalid input into one of the textarea's."
252
  msgstr "Ongeldige invoer in een van de textarea's."
253
 
254
- #: admin/classes/wpi-template-settings.php:553
 
 
 
 
255
  msgid "Invalid (next) invoice number."
256
  msgstr "Ongeldig (eerstvolgend) factuurnummer."
257
 
258
- #: admin/classes/wpi-template-settings.php:574
259
  msgid "Invalid invoice number digits."
260
  msgstr "Ongeldige factuurnummer cijfers."
261
 
262
- #: admin/classes/wpi-template-settings.php:596
263
  msgid "The [number] placeholder is required as invoice number format."
264
  msgstr "De aanduiding [number] is vereist."
265
 
266
- #: admin/classes/wpi-template-settings.php:603
267
  msgid "Invalid invoice number format."
268
  msgstr "Ongeldig factuurnummer format."
269
 
270
- #: admin/classes/wpi-template-settings.php:641
271
  msgid "Invalid date format."
272
  msgstr "Ongeldige datumnotatie."
273
 
274
- #: admin/classes/wpi-template-settings.php:670
275
  msgid "File is invalid and contains either '..' or './'."
276
  msgstr "Bestand is niet valide en bevat ofwel '..' of './'."
277
 
278
- #: admin/classes/wpi-template-settings.php:677
279
  msgid "File is invalid and contains ':' after the first character."
280
  msgstr "Bestand is niet valide en bevat ':' na het eerste teken."
281
 
282
- #: admin/classes/wpi-template-settings.php:686
283
  msgid "Please upload image with extension jpg, jpeg or png."
284
  msgstr "Gelieve te uploaden een afbeelding met extensie jpg, jpeg of png."
285
 
286
- #: includes/classes/wpi-invoice.php:340
287
  msgid "Customer note"
288
  msgstr "Opmerking klant"
289
 
290
- #: includes/classes/wpi-invoice.php:353
291
  #, php-format
292
  msgid "%sPayment%s via"
293
  msgstr "%sBetaling%s met"
@@ -342,9 +390,6 @@ msgstr "BTW"
342
  #~ msgid "Show invoice"
343
  #~ msgstr "Toon factuur"
344
 
345
- #~ msgid "Create invoice"
346
- #~ msgstr "Maak factuur"
347
-
348
  #~ msgid "%sFormat%s of the date."
349
  #~ msgstr "%sFormat%s van de datum."
350
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices\n"
4
+ "POT-Creation-Date: 2015-03-30 18:25+0100\n"
5
+ "PO-Revision-Date: 2015-03-30 18:26+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: nl_NL\n"
36
  msgid "PDF Invoice"
37
  msgstr "PDF Factuur"
38
 
39
+ #: admin/classes/woocommerce-pdf-invoices.php:290
40
+ msgid "Invoiced on:"
41
+ msgstr "Gefactureerd op:"
42
+
43
+ #: admin/classes/woocommerce-pdf-invoices.php:294
44
+ msgid "Invoice number:"
45
+ msgstr "Factuurnummer:"
46
+
47
+ #: admin/classes/woocommerce-pdf-invoices.php:332
48
+ msgid "View invoice"
49
+ msgstr "Toon factuur"
50
+
51
+ #: admin/classes/woocommerce-pdf-invoices.php:332
52
+ msgid "View"
53
+ msgstr "Bekijk"
54
+
55
+ #: admin/classes/woocommerce-pdf-invoices.php:333
56
+ msgid "Cancel invoice"
57
+ msgstr "Factuur annuleren"
58
+
59
+ #: admin/classes/woocommerce-pdf-invoices.php:333
60
+ msgid "Cancel"
61
+ msgstr "Annuleer"
62
+
63
+ #: admin/classes/woocommerce-pdf-invoices.php:333
64
+ msgid "Are you sure to delete the invoice?"
65
+ msgstr "Weet u zeker dat u de factuur wilt verwijderen?"
66
+
67
+ #: admin/classes/woocommerce-pdf-invoices.php:335
68
+ msgid "Create invoice"
69
+ msgstr "Maak factuur"
70
+
71
+ #: admin/classes/woocommerce-pdf-invoices.php:335
72
+ msgid "Create"
73
+ msgstr "Aanmaken"
74
+
75
  #: admin/classes/wpi-general-settings.php:74
76
  msgid "General Settings"
77
  msgstr "Algemene Opties"
124
 
125
  #: admin/classes/wpi-general-settings.php:197
126
  #: admin/classes/wpi-general-settings.php:210
127
+ #: admin/classes/wpi-template-settings.php:642
128
  msgid "Please don't try to change the values."
129
  msgstr "Probeer de waardes niet te wijzigen a.u.b."
130
 
239
  msgid "Remove logo"
240
  msgstr "Verwijder logo"
241
 
242
+ #: admin/classes/wpi-template-settings.php:259
243
+ msgid "WooCommerce order number"
244
+ msgstr "WooCommerce ordernummer"
245
+
246
+ #: admin/classes/wpi-template-settings.php:260
247
+ msgid "Sequential number"
248
+ msgstr "Volgnummer"
249
+
250
  #: admin/classes/wpi-template-settings.php:352
251
  msgid "Invoice number to use for next invoice."
252
  msgstr "Factuurnummer te gebruiken voor de volgende factuur."
295
  msgid "Invalid input into one of the textarea's."
296
  msgstr "Ongeldige invoer in een van de textarea's."
297
 
298
+ #: admin/classes/wpi-template-settings.php:552
299
+ msgid "Invalid type of invoice number."
300
+ msgstr "Ongeldig type factuurnummer."
301
+
302
+ #: admin/classes/wpi-template-settings.php:565
303
  msgid "Invalid (next) invoice number."
304
  msgstr "Ongeldig (eerstvolgend) factuurnummer."
305
 
306
+ #: admin/classes/wpi-template-settings.php:586
307
  msgid "Invalid invoice number digits."
308
  msgstr "Ongeldige factuurnummer cijfers."
309
 
310
+ #: admin/classes/wpi-template-settings.php:608
311
  msgid "The [number] placeholder is required as invoice number format."
312
  msgstr "De aanduiding [number] is vereist."
313
 
314
+ #: admin/classes/wpi-template-settings.php:615
315
  msgid "Invalid invoice number format."
316
  msgstr "Ongeldig factuurnummer format."
317
 
318
+ #: admin/classes/wpi-template-settings.php:653
319
  msgid "Invalid date format."
320
  msgstr "Ongeldige datumnotatie."
321
 
322
+ #: admin/classes/wpi-template-settings.php:682
323
  msgid "File is invalid and contains either '..' or './'."
324
  msgstr "Bestand is niet valide en bevat ofwel '..' of './'."
325
 
326
+ #: admin/classes/wpi-template-settings.php:689
327
  msgid "File is invalid and contains ':' after the first character."
328
  msgstr "Bestand is niet valide en bevat ':' na het eerste teken."
329
 
330
+ #: admin/classes/wpi-template-settings.php:698
331
  msgid "Please upload image with extension jpg, jpeg or png."
332
  msgstr "Gelieve te uploaden een afbeelding met extensie jpg, jpeg of png."
333
 
334
+ #: includes/classes/wpi-invoice.php:194
335
  msgid "Customer note"
336
  msgstr "Opmerking klant"
337
 
338
+ #: includes/classes/wpi-invoice.php:207
339
  #, php-format
340
  msgid "%sPayment%s via"
341
  msgstr "%sBetaling%s met"
390
  #~ msgid "Show invoice"
391
  #~ msgstr "Toon factuur"
392
 
 
 
 
393
  #~ msgid "%sFormat%s of the date."
394
  #~ msgstr "%sFormat%s van de datum."
395
 
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.1.1
7
- Stable tag: 2.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -67,6 +67,11 @@ The manual installation method involves downloading our plugin and uploading it
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
70
  = 2.0.4 - March 30, 2015 =
71
 
72
  - Added: Option to use WC order number as invoice number
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.1.1
7
+ Stable tag: 2.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
67
 
68
  == Changelog ==
69
 
70
+ = 2.0.5 - March 30, 2015 =
71
+
72
+ - Fixed: Invoice number type doesn't get saved.
73
+ - Improved: WPI_Invoice class code.
74
+
75
  = 2.0.4 - March 30, 2015 =
76
 
77
  - Added: Option to use WC order number as invoice number