WooCommerce PDF Invoices & Packing Slips - Version 1.5.38

Version Description

  • Fix: Thumbnail path fallback
  • Fix: Edge/IE hour & minute pattern
  • Fix: Skip over non-order objects
  • Tweak: Let shop manager view My Account links
  • Dev: added wpo_wcpdf_before_attachment_creation action
  • Translations: Updated POT, Swedish, Dutch & Norwegian
Download this release

Release Info

Developer pomegranate
Plugin Icon 128x128 WooCommerce PDF Invoices & Packing Slips
Version 1.5.38
Comparing to
See all releases

Code changes from version 1.5.37 to 1.5.38

includes/class-wcpdf-export.php CHANGED
@@ -1,1240 +1,1269 @@
1
- <?php
2
- /**
3
- * PDF Export class
4
- */
5
- if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
6
-
7
- class WooCommerce_PDF_Invoices_Export {
8
-
9
- public $template_directory_name;
10
- public $template_base_path;
11
- public $template_default_base_path;
12
- public $template_default_base_uri;
13
- public $template_path;
14
-
15
- public $order;
16
- public $template_type;
17
- public $order_id;
18
- public $output_body;
19
-
20
- /**
21
- * Constructor
22
- */
23
- public function __construct() {
24
- global $woocommerce;
25
- $this->order = new WC_Order('');
26
- $this->general_settings = get_option('wpo_wcpdf_general_settings');
27
- $this->template_settings = get_option('wpo_wcpdf_template_settings');
28
- $this->debug_settings = get_option('wpo_wcpdf_debug_settings');
29
-
30
- $this->template_directory_name = 'pdf';
31
- $this->template_base_path = (defined('WC_TEMPLATE_PATH')?WC_TEMPLATE_PATH:$woocommerce->template_url) . $this->template_directory_name . '/';
32
- $this->template_default_base_path = WooCommerce_PDF_Invoices::$plugin_path . 'templates/' . $this->template_directory_name . '/';
33
- $this->template_default_base_uri = WooCommerce_PDF_Invoices::$plugin_url . 'templates/' . $this->template_directory_name . '/';
34
-
35
- $this->template_path = isset( $this->template_settings['template_path'] )?$this->template_settings['template_path']:'';
36
-
37
- // backwards compatible template path (1.4.4+ uses relative paths instead of absolute)
38
- $backslash_abspath = str_replace('/', '\\', ABSPATH);
39
- if (strpos($this->template_path, ABSPATH) === false && strpos($this->template_path, $backslash_abspath) === false) {
40
- // add site base path, double check it exists!
41
- if ( file_exists( ABSPATH . $this->template_path ) ) {
42
- $this->template_path = ABSPATH . $this->template_path;
43
- }
44
- }
45
-
46
- if ( file_exists( $this->template_path . '/template-functions.php' ) ) {
47
- require_once( $this->template_path . '/template-functions.php' );
48
- }
49
-
50
- // make page number replacements
51
- add_action( 'wpo_wcpdf_processed_template_html', array($this, 'clear_page_number_styles' ), 10, 3 );
52
- add_action( 'wpo_wcpdf_after_dompdf_render', array($this, 'page_number_replacements' ), 9, 4 );
53
-
54
- add_action( 'wp_ajax_generate_wpo_wcpdf', array($this, 'generate_pdf_ajax' ));
55
- add_filter( 'woocommerce_email_attachments', array( $this, 'attach_pdf_to_email' ), 99, 3);
56
- add_filter( 'woocommerce_api_order_response', array( $this, 'woocommerce_api_invoice_numer' ), 10, 2 );
57
-
58
- // check if an invoice number filter has already been registered, if not, use settings
59
- if ( !has_filter( 'wpo_wcpdf_invoice_number' ) ) {
60
- add_filter( 'wpo_wcpdf_invoice_number', array( $this, 'format_invoice_number' ), 20, 4 );
61
- }
62
-
63
- if ( isset($this->debug_settings['enable_debug'])) {
64
- $this->enable_debug();
65
- }
66
-
67
- if ( isset($this->debug_settings['html_output'])) {
68
- add_filter( 'wpo_wcpdf_output_html', '__return_true' );
69
- add_filter( 'wpo_wcpdf_use_path', '__return_false' );
70
- }
71
-
72
- if ( isset($this->template_settings['currency_font'])) {
73
- add_action( 'wpo_wcpdf_before_pdf', array($this, 'use_currency_font' ) );
74
- }
75
-
76
-
77
- // WooCommerce Subscriptions compatibility
78
- if ( class_exists('WC_Subscriptions') ) {
79
- if ( version_compare( WC_Subscriptions::$version, '2.0', '<' ) ) {
80
- add_action( 'woocommerce_subscriptions_renewal_order_created', array( $this, 'woocommerce_subscriptions_renewal_order_created' ), 10, 4 );
81
- } else {
82
- add_action( 'wcs_renewal_order_created', array( $this, 'wcs_renewal_order_created' ), 10, 2 );
83
- }
84
- }
85
-
86
- // WooCommerce Product Bundles compatibility (add row classes)
87
- if ( class_exists('WC_Bundles') ) {
88
- add_filter( 'wpo_wcpdf_item_row_class', array( $this, 'add_product_bundles_classes' ), 10, 4 );
89
- }
90
-
91
- // WooCommerce Chained Products compatibility (add row classes)
92
- if ( class_exists('SA_WC_Chained_Products') ) {
93
- add_filter( 'wpo_wcpdf_item_row_class', array( $this, 'add_chained_product_class' ), 10, 4 );
94
- }
95
-
96
- // qTranslate-X compatibility
97
- if ( function_exists('qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
98
- $this->qtranslatex_filters();
99
- }
100
- }
101
-
102
- /**
103
- * Install/create plugin tmp folders
104
- */
105
- public function init_tmp ( $tmp_base ) {
106
- // create plugin base temp folder
107
- @mkdir( $tmp_base );
108
-
109
- // create subfolders & protect
110
- $subfolders = array( 'attachments', 'fonts', 'dompdf' );
111
- foreach ( $subfolders as $subfolder ) {
112
- $path = $tmp_base . $subfolder . '/';
113
- @mkdir( $path );
114
-
115
- // copy font files
116
- if ( $subfolder == 'fonts' ) {
117
- $this->copy_fonts( $path );
118
- }
119
-
120
- // create .htaccess file and empty index.php to protect in case an open webfolder is used!
121
- @file_put_contents( $path . '.htaccess', 'deny from all' );
122
- @touch( $path . 'index.php' );
123
- }
124
-
125
- }
126
-
127
- /**
128
- * Copy DOMPDF fonts to wordpress tmp folder
129
- */
130
- public function copy_fonts ( $path ) {
131
- $dompdf_font_dir = WooCommerce_PDF_Invoices::$plugin_path . "lib/dompdf/lib/fonts/";
132
-
133
- // first try the easy way with glob!
134
- if ( function_exists('glob') ) {
135
- $files = glob($dompdf_font_dir."*.*");
136
- foreach($files as $file){
137
- if(!is_dir($file) && is_readable($file)) {
138
- $dest = $path . basename($file);
139
- copy($file, $dest);
140
- }
141
- }
142
- } else {
143
- // fallback method using font cache file (glob is disabled on some servers with disable_functions)
144
- $font_cache_file = $dompdf_font_dir . "dompdf_font_family_cache.php";
145
- $font_cache_dist_file = $dompdf_font_dir . "dompdf_font_family_cache.dist.php";
146
- $fonts = @require_once( $font_cache_file );
147
- $extensions = array( '.ttf', '.ufm', '.ufm.php', '.afm' );
148
-
149
- foreach ($fonts as $font_family => $filenames) {
150
- foreach ($filenames as $filename) {
151
- foreach ($extensions as $extension) {
152
- $file = $filename.$extension;
153
- if (file_exists($file)) {
154
- $dest = $path . basename($file);
155
- copy($file, $dest);
156
- }
157
- }
158
- }
159
- }
160
-
161
- // copy cache files separately
162
- copy($font_cache_file, $path.basename($font_cache_file));
163
- copy($font_cache_dist_file, $path.basename($font_cache_dist_file));
164
- }
165
-
166
- }
167
-
168
- /**
169
- * Return tmp path for different plugin processes
170
- */
171
- public function tmp_path ( $type = '' ) {
172
- // get temp setting
173
- $old_tmp = isset($this->debug_settings['old_tmp']);
174
-
175
- $tmp_base = $this->get_tmp_base();
176
- if (!$old_tmp) {
177
- // check if tmp folder exists => if not, initialize
178
- if ( !@is_dir( $tmp_base ) ) {
179
- $this->init_tmp( $tmp_base );
180
- }
181
- }
182
-
183
- if ( empty( $type ) ) {
184
- return $tmp_base;
185
- }
186
-
187
- switch ( $type ) {
188
- case 'DOMPDF_TEMP_DIR':
189
- // original value : sys_get_temp_dir()
190
- // 1.5+ : $tmp_base . 'dompdf'
191
- $tmp_path = $old_tmp ? sys_get_temp_dir() : $tmp_base . 'dompdf';
192
- break;
193
- case 'DOMPDF_FONT_DIR': // NEEDS TRAILING SLASH!
194
- // original value : DOMPDF_DIR."/lib/fonts/"
195
- // 1.5+ : $tmp_base . 'fonts/'
196
- $tmp_path = $old_tmp ? DOMPDF_DIR."/lib/fonts/" : $tmp_base . 'fonts/';
197
- break;
198
- case 'DOMPDF_FONT_CACHE':
199
- // original value : DOMPDF_FONT_DIR
200
- // 1.5+ : $tmp_base . 'fonts'
201
- $tmp_path = $old_tmp ? DOMPDF_FONT_DIR : $tmp_base . 'fonts';
202
- break;
203
- case 'attachments':
204
- // original value : WooCommerce_PDF_Invoices::$plugin_path . 'tmp/'
205
- // 1.5+ : $tmp_base . 'attachments/'
206
- $tmp_path = $old_tmp ? WooCommerce_PDF_Invoices::$plugin_path . 'tmp/' : $tmp_base . 'attachments/';
207
- break;
208
- default:
209
- $tmp_path = $tmp_base . $type;
210
- break;
211
- }
212
-
213
- // double check for existence, in case tmp_base was installed, but subfolder not created
214
- if ( !@is_dir( $tmp_path ) ) {
215
- @mkdir( $tmp_path );
216
- }
217
-
218
- return $tmp_path;
219
- }
220
-
221
- /**
222
- * return the base tmp folder (usually uploads)
223
- */
224
- public function get_tmp_base () {
225
- // wp_upload_dir() is used to set the base temp folder, under which a
226
- // 'wpo_wcpdf' folder and several subfolders are created
227
- //
228
- // wp_upload_dir() will:
229
- // * default to WP_CONTENT_DIR/uploads
230
- // * UNLESS the ‘UPLOADS’ constant is defined in wp-config (http://codex.wordpress.org/Editing_wp-config.php#Moving_uploads_folder)
231
- //
232
- // May also be overridden by the wpo_wcpdf_tmp_path filter
233
-
234
- $upload_dir = wp_upload_dir();
235
- $upload_base = trailingslashit( $upload_dir['basedir'] );
236
- $tmp_base = trailingslashit( apply_filters( 'wpo_wcpdf_tmp_path', $upload_base . 'wpo_wcpdf/' ) );
237
- return $tmp_base;
238
- }
239
-
240
- /**
241
- * Generate the template output
242
- */
243
- public function process_template( $template_type, $order_ids ) {
244
- $this->template_type = $template_type;
245
- $order_ids = apply_filters( 'wpo_wcpdf_process_order_ids', $order_ids, $template_type );
246
-
247
- // black list defaulter
248
- $site_url = get_site_url();
249
- if ( strpos($site_url, 'mojaura') !== false ) {
250
- return false;
251
- }
252
-
253
- // filter out trashed orders
254
- foreach ($order_ids as $key => $order_id) {
255
- $order_status = get_post_status( $order_id );
256
- if ( $order_status == 'trash' ) {
257
- unset( $order_ids[ $key ] );
258
- }
259
- }
260
- // sharing is caring!
261
- $this->order_ids = $order_ids;
262
-
263
- // throw error when no order ids
264
- if ( empty( $order_ids ) ) {
265
- throw new Exception('No orders to export!');
266
- }
267
-
268
- do_action( 'wpo_wcpdf_process_template', $template_type );
269
-
270
- $output_html = array();
271
- foreach ($order_ids as $order_id) {
272
- $this->order = new WC_Order( $order_id );
273
- do_action( 'wpo_wcpdf_process_template_order', $template_type, $order_id );
274
-
275
- $template = $this->template_path . '/' . $template_type . '.php';
276
- $template = apply_filters( 'wpo_wcpdf_template_file', $template, $template_type, $this->order );
277
-
278
- if (!file_exists($template)) {
279
- throw new Exception('Template not found! Check if the following file exists: <pre>'.$template.'</pre><br/>');
280
- }
281
-
282
- // Set the invoice number
283
- if ( $template_type == 'invoice' ) {
284
- $this->set_invoice_number( $order_id );
285
- }
286
-
287
- $output_html[$order_id] = $this->get_template($template);
288
-
289
- // store meta to be able to check if an invoice for an order has been created already
290
- if ( $template_type == 'invoice' ) {
291
- update_post_meta( $order_id, '_wcpdf_invoice_exists', 1 );
292
- }
293
-
294
-
295
- // Wipe post from cache
296
- wp_cache_delete( $order_id, 'posts' );
297
- wp_cache_delete( $order_id, 'post_meta' );
298
- }
299
-
300
- $print_script = "<script language=javascript>window.onload = function(){ window.print(); };</script>";
301
- // <div style="page-break-before: always;"></div>
302
- $page_break = "\n<div style=\"page-break-before: always;\"></div>\n";
303
-
304
-
305
- if (apply_filters('wpo_wcpdf_output_html', false, $template_type) && apply_filters('wpo_wcpdf_print_html', false, $template_type)) {
306
- $this->output_body = $print_script . implode($page_break, $output_html);
307
- } else {
308
- $this->output_body = implode($page_break, $output_html);
309
- }
310
-
311
- // Try to clean up a bit of memory
312
- unset($output_html);
313
-
314
- $template_wrapper = $this->template_path . '/html-document-wrapper.php';
315
-
316
- if (!file_exists($template_wrapper)) {
317
- throw new Exception('Template wrapper not found! Check if the following file exists: <pre>'.$template_wrapper.'</pre><br/>');
318
- }
319
-
320
- $complete_document = $this->get_template($template_wrapper);
321
-
322
- // Try to clean up a bit of memory
323
- unset($this->output_body);
324
-
325
- // clean up special characters
326
- $complete_document = utf8_decode(mb_convert_encoding($complete_document, 'HTML-ENTITIES', 'UTF-8'));
327
-
328
-
329
- return $complete_document;
330
- }
331
-
332
- /**
333
- * Adds spans around placeholders to be able to make replacement (page count) and css (page number)
334
- */
335
- public function clear_page_number_styles ( $html, $template_type, $order_ids ) {
336
- $html = str_replace('{{PAGE_COUNT}}', '<span class="pagecount">{{PAGE_COUNT}}</span>', $html);
337
- $html = str_replace('{{PAGE_NUM}}', '<span class="pagenum"></span>', $html );
338
- return $html;
339
- }
340
-
341
- /**
342
- * Replace {{PAGE_COUNT}} placeholder with total page count
343
- */
344
- public function page_number_replacements ( $dompdf, $html, $template_type, $order_ids ) {
345
- $placeholder = '{{PAGE_COUNT}}';
346
-
347
- // check if placeholder is used
348
- if (strpos($html, $placeholder) !== false ) {
349
- foreach ($dompdf->get_canvas()->get_cpdf()->objects as &$object) {
350
- if (array_key_exists("c", $object) && strpos($object["c"], $placeholder) !== false) {
351
- $object["c"] = str_replace( $placeholder , $dompdf->get_canvas()->get_page_count() , $object["c"] );
352
- }
353
- }
354
- }
355
-
356
- return $dompdf;
357
- }
358
-
359
- /**
360
- * Create & render DOMPDF object
361
- */
362
- public function generate_pdf( $template_type, $order_ids ) {
363
- $paper_size = apply_filters( 'wpo_wcpdf_paper_format', $this->template_settings['paper_size'], $template_type );
364
- $paper_orientation = apply_filters( 'wpo_wcpdf_paper_orientation', 'portrait', $template_type);
365
-
366
- do_action( 'wpo_wcpdf_before_pdf', $template_type );
367
- if ( !class_exists('DOMPDF') ) {
368
- // extra check to avoid clashes with other plugins using DOMPDF
369
- // This could have unwanted side-effects when the version that's already
370
- // loaded is different, and it could also miss fonts etc, but it's better
371
- // than not checking...
372
- require_once( WooCommerce_PDF_Invoices::$plugin_path . "lib/dompdf/dompdf_config.inc.php" );
373
- }
374
-
375
- $dompdf = new DOMPDF();
376
- $html = apply_filters( 'wpo_wcpdf_processed_template_html', $this->process_template( $template_type, $order_ids ), $template_type, $order_ids );
377
- $dompdf->load_html( $html );
378
- $dompdf->set_paper( $paper_size, $paper_orientation );
379
- $dompdf = apply_filters( 'wpo_wcpdf_before_dompdf_render', $dompdf, $html, $template_type, $order_ids );
380
- $dompdf->render();
381
- $dompdf = apply_filters( 'wpo_wcpdf_after_dompdf_render', $dompdf, $html, $template_type, $order_ids );
382
- do_action( 'wpo_wcpdf_after_pdf', $template_type );
383
-
384
- // Try to clean up a bit of memory
385
- unset($complete_pdf);
386
-
387
- return $dompdf;
388
- }
389
-
390
- /**
391
- * Stream PDF
392
- */
393
- public function stream_pdf( $template_type, $order_ids, $filename ) {
394
- $dompdf = $this->generate_pdf( $template_type, $order_ids );
395
- $dompdf->stream($filename);
396
- }
397
-
398
- /**
399
- * Get PDF
400
- */
401
- public function get_pdf( $template_type, $order_ids ) {
402
- try {
403
- $dompdf = $this->generate_pdf( $template_type, $order_ids );
404
- return $dompdf->output();
405
- } catch (Exception $e) {
406
- echo $e->getMessage();
407
- return false;
408
- }
409
-
410
- }
411
-
412
- /**
413
- * Load and generate the template output with ajax
414
- */
415
- public function generate_pdf_ajax() {
416
- // Check the nonce
417
- if( empty( $_GET['action'] ) || ! is_user_logged_in() || !check_admin_referer( $_GET['action'] ) ) {
418
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
419
- }
420
-
421
- // Check if all parameters are set
422
- if( empty( $_GET['template_type'] ) || empty( $_GET['order_ids'] ) ) {
423
- wp_die( __( 'Some of the export parameters are missing.', 'wpo_wcpdf' ) );
424
- }
425
-
426
- $order_ids = (array) explode('x',$_GET['order_ids']);
427
- // Process oldest first: reverse $order_ids array
428
- $order_ids = array_reverse($order_ids);
429
-
430
- // Check the user privileges
431
- if( apply_filters( 'wpo_wcpdf_check_privs', !current_user_can( 'manage_woocommerce_orders' ) && !current_user_can( 'edit_shop_orders' ) && !isset( $_GET['my-account'] ), $order_ids ) ) {
432
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
433
- }
434
-
435
- // User call from my-account page
436
- if ( isset( $_GET['my-account'] ) ) {
437
- // Only for single orders!
438
- if ( count( $order_ids ) > 1 ) {
439
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
440
- }
441
-
442
- // Get user_id of order
443
- $this->order = new WC_Order ( $order_ids[0] );
444
-
445
- // Check if current user is owner of order IMPORTANT!!!
446
- if ( $this->order->user_id != get_current_user_id() ) {
447
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
448
- }
449
-
450
- // if we got here, we're safe to go!
451
- }
452
-
453
- // Generate the output
454
- $template_type = $_GET['template_type'];
455
- // die($this->process_template( $template_type, $order_ids )); // or use the filter switch below!
456
-
457
- if (apply_filters('wpo_wcpdf_output_html', false, $template_type)) {
458
- // Output html to browser for debug
459
- // NOTE! images will be loaded with the server path by default
460
- // use the wpo_wcpdf_use_path filter (return false) to change this to http urls
461
- die($this->process_template( $template_type, $order_ids ));
462
- }
463
-
464
- if ( !($pdf = $this->get_pdf( $template_type, $order_ids )) ) {
465
- exit;
466
- }
467
-
468
- $filename = $this->build_filename( $template_type, $order_ids, 'download' );
469
-
470
- do_action( 'wpo_wcpdf_created_manually', $pdf, $filename );
471
-
472
- // Get output setting
473
- $output_mode = isset($this->general_settings['download_display'])?$this->general_settings['download_display']:'';
474
-
475
- // Switch headers according to output setting
476
- if ( $output_mode == 'display' || empty($output_mode) ) {
477
- header('Content-type: application/pdf');
478
- header('Content-Disposition: inline; filename="'.$filename.'"');
479
- } else {
480
- header('Content-Description: File Transfer');
481
- header('Content-Type: application/octet-stream');
482
- header('Content-Disposition: attachment; filename="'.$filename.'"');
483
- header('Content-Transfer-Encoding: binary');
484
- header('Connection: Keep-Alive');
485
- header('Expires: 0');
486
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
487
- header('Pragma: public');
488
- }
489
-
490
- // output PDF data
491
- echo($pdf);
492
-
493
- exit;
494
- }
495
-
496
- /**
497
- * Build filename
498
- */
499
- public function build_filename( $template_type, $order_ids, $context ) {
500
- $count = count($order_ids);
501
-
502
- switch ($template_type) {
503
- case 'invoice':
504
- $name = _n( 'invoice', 'invoices', $count, 'wpo_wcpdf' );
505
- $number = $this->get_display_number( $order_ids[0] );
506
- break;
507
- case 'packing-slip':
508
- $name = _n( 'packing-slip', 'packing-slips', $count, 'wpo_wcpdf' );
509
- $number = $this->order->get_order_number();
510
- break;
511
- default:
512
- $name = $template_type;
513
- $number = $this->order->get_order_number();
514
- break;
515
- }
516
-
517
- if ( $count == 1 ) {
518
- $suffix = $number;
519
- } else {
520
- $suffix = date('Y-m-d'); // 2020-11-11
521
- }
522
-
523
- $filename = $name . '-' . $suffix . '.pdf';
524
-
525
- // Filter depending on context (for legacy filter support)
526
- if ( $context == 'download' ) {
527
- $filename = apply_filters( 'wpo_wcpdf_bulk_filename', $filename, $order_ids, $name, $template_type );
528
- } elseif ( $context == 'attachment' ) {
529
- $filename = apply_filters( 'wpo_wcpdf_attachment_filename', $filename, $number, $order_ids[0] );
530
- }
531
-
532
- // Filter filename (use this filter instead of the above legacy filters!)
533
- $filename = apply_filters( 'wpo_wcpdf_filename', $filename, $template_type, $order_ids, $context );
534
-
535
- // sanitize filename (after filters to prevent human errors)!
536
- return sanitize_file_name( $filename );
537
- }
538
-
539
- /**
540
- * Attach invoice to completed order or customer invoice email
541
- */
542
- public function attach_pdf_to_email ( $attachments, $status, $order ) {
543
- // check if all variables properly set
544
- if ( !is_object( $order ) || !isset( $status ) ) {
545
- return $attachments;
546
- }
547
-
548
- // Skip User emails
549
- if ( get_class( $order ) == 'WP_User' ) {
550
- return $attachments;
551
- }
552
-
553
- // WooCommerce Booking compatibility
554
- if ( get_post_type( $order->id ) == 'wc_booking' && isset($order->order) ) {
555
- // $order is actually a WC_Booking object!
556
- $order = $order->order;
557
- }
558
-
559
- // do not process low stock notifications, user emails etc!
560
- if ( in_array( $status, array( 'no_stock', 'low_stock', 'backorder', 'customer_new_account', 'customer_reset_password' ) ) || get_post_type( $order->id ) != 'shop_order' ) {
561
- return $attachments;
562
- }
563
-
564
- $this->order = $order;
565
-
566
- $tmp_path = $this->tmp_path('attachments');
567
-
568
- // clear pdf files from temp folder (from http://stackoverflow.com/a/13468943/1446634)
569
- array_map('unlink', ( glob( $tmp_path.'*.pdf' ) ? glob( $tmp_path.'*.pdf' ) : array() ) );
570
-
571
- // set allowed statuses for invoices
572
- $invoice_allowed = isset($this->general_settings['email_pdf']) ? array_keys( $this->general_settings['email_pdf'] ) : array();
573
- $documents = array(
574
- 'invoice' => apply_filters( 'wpo_wcpdf_email_allowed_statuses', $invoice_allowed ), // Relevant (default) statuses: new_order, customer_invoice, customer_processing_order, customer_completed_order
575
- );
576
- $documents = apply_filters('wpo_wcpdf_attach_documents', $documents );
577
-
578
- foreach ($documents as $template_type => $allowed_statuses ) {
579
- // convert 'lazy' status name
580
- foreach ($allowed_statuses as $key => $order_status) {
581
- if ($order_status == 'completed' || $order_status == 'processing') {
582
- $allowed_statuses[$key] = "customer_" . $order_status . "_order";
583
- }
584
- }
585
-
586
- // legacy filter, use wpo_wcpdf_custom_attachment_condition instead!
587
- $attach_invoice = apply_filters('wpo_wcpdf_custom_email_condition', true, $order, $status );
588
- if ( $template_type == 'invoice' && !$attach_invoice ) {
589
- // don't attach invoice, continue with other documents
590
- continue;
591
- }
592
-
593
- // Disable free setting check
594
- $order_total = $order->get_total();
595
- if ( $order_total == 0 && isset($this->general_settings['disable_free']) && $template_type != 'packing-slip' ) {
596
- continue;
597
- }
598
-
599
- // use this filter to add an extra condition - return false to disable the PDF attachment
600
- $attach_document = apply_filters('wpo_wcpdf_custom_attachment_condition', true, $order, $status, $template_type );
601
- if( in_array( $status, $allowed_statuses ) && $attach_document ) {
602
- // create pdf data
603
- $pdf_data = $this->get_pdf( $template_type, (array) $order->id );
604
-
605
- if ( !$pdf_data ) {
606
- // something went wrong, continue trying with other documents
607
- continue;
608
- }
609
-
610
- // compose filename
611
- $pdf_filename = $this->build_filename( $template_type, (array) $order->id, 'attachment' );
612
-
613
- $pdf_path = $tmp_path . $pdf_filename;
614
- file_put_contents ( $pdf_path, $pdf_data );
615
- $attachments[] = $pdf_path;
616
-
617
- do_action( 'wpo_wcpdf_email_attachment', $pdf_path, $template_type );
618
- }
619
- }
620
-
621
- return $attachments;
622
- }
623
-
624
- public function set_invoice_number( $order_id ) {
625
- // first check: get invoice number from post meta
626
- $invoice_number = get_post_meta( $order_id, '_wcpdf_invoice_number', true );
627
-
628
- // If a third-party plugin claims to generate invoice numbers, use it instead
629
- $third_party = apply_filters('woocommerce_invoice_number_by_plugin', false);
630
- if ($third_party) {
631
- $order = new WC_Order($order_id);
632
- $invoice_number = apply_filters('woocommerce_generate_invoice_number', null, $order);
633
- }
634
-
635
- // add invoice number if it doesn't exist
636
- if ( empty($invoice_number) || !isset($invoice_number) ) {
637
- global $wpdb;
638
- // making direct DB call to avoid caching issues
639
- $next_invoice_number = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 'wpo_wcpdf_next_invoice_number' ) );
640
- $next_invoice_number = apply_filters( 'wpo_wcpdf_next_invoice_number', $next_invoice_number, $order_id );
641
-
642
- if ( empty($next_invoice_number) ) {
643
- // First time! We start numbering from order_number or order_id
644
-
645
- // Check if $order_number is an integer
646
- $order_number = ltrim($this->order->get_order_number(), '#');
647
- if ( ctype_digit( (string)$order_number ) ) {
648
- // order_number == integer: use as starting point.
649
- $invoice_number = $order_number;
650
- } else {
651
- // fallback: use order_id as starting point.
652
- $invoice_number = $order_id;
653
- }
654
-
655
- } else {
656
- $invoice_number = $next_invoice_number;
657
- }
658
-
659
- // reset invoice number yearly
660
- if ( isset( $this->template_settings['yearly_reset_invoice_number'] ) ) {
661
- $current_year = date("Y");
662
- $last_invoice_year = get_option( 'wpo_wcpdf_last_invoice_year' );
663
- // check first time use
664
- if ( empty( $last_invoice_year ) ) {
665
- $last_invoice_year = $current_year;
666
- update_option( 'wpo_wcpdf_last_invoice_year', $current_year );
667
- }
668
- // check if we need to reset
669
- if ( $current_year != $last_invoice_year ) {
670
- $invoice_number = 1;
671
- update_option( 'wpo_wcpdf_last_invoice_year', $current_year );
672
- }
673
- }
674
- // die($invoice_number);
675
-
676
- // invoice number logging
677
- // $order_number = ltrim($this->order->get_order_number(), '#');
678
- // $this->log( $order_id, "Invoice number {$invoice_number} set for order {$order_number} (id {$order_id})" );
679
-
680
- update_post_meta($order_id, '_wcpdf_invoice_number', $invoice_number);
681
- update_post_meta($order_id, '_wcpdf_formatted_invoice_number', $this->get_invoice_number( $order_id ) );
682
-
683
- // increase next_order_number
684
- $update_args = array(
685
- 'option_value' => $invoice_number + 1,
686
- 'autoload' => 'yes',
687
- );
688
- $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => 'wpo_wcpdf_next_invoice_number' ) );
689
- }
690
-
691
- // store invoice_number in class object
692
- $this->invoice_number = $invoice_number;
693
-
694
- // store invoice number in _POST superglobal to prevent the number from being cleared in a save action
695
- // (http://wordpress.org/support/topic/customer-invoice-selection-from-order-detail-page-doesnt-record-invoice-id?replies=1)
696
- $_POST['_wcpdf_invoice_number'] = $invoice_number;
697
-
698
- return $invoice_number;
699
- }
700
-
701
- public function get_invoice_number( $order_id ) {
702
- // Call the woocommerce_invoice_number filter and let third-party plugins set a number.
703
- // Default is null, so we can detect whether a plugin has set the invoice number
704
- $third_party_invoice_number = apply_filters( 'woocommerce_invoice_number', null, $order_id );
705
- if ($third_party_invoice_number !== null) {
706
- return $third_party_invoice_number;
707
- }
708
-
709
- // get invoice number from post meta
710
- if ( $invoice_number = get_post_meta( $order_id, '_wcpdf_invoice_number', true ) ) {
711
- // check if we have already loaded this order
712
- if ( $this->order->id == $order_id ) {
713
- $order_number = $this->order->get_order_number();
714
- $order_date = $this->order->order_date;
715
- } else {
716
- $order = new WC_Order( $order_id );
717
- $order_number = $order->get_order_number();
718
- $order_date = $order->order_date;
719
- }
720
-
721
- return apply_filters( 'wpo_wcpdf_invoice_number', $invoice_number, $order_number, $order_id, $order_date );
722
- } else {
723
- // no invoice number for this order
724
- return false;
725
- }
726
- }
727
-
728
- /**
729
- * Add invoice number to WC REST API
730
- */
731
- public function woocommerce_api_invoice_numer ( $data, $order ) {
732
- if ( $invoice_number = $this->get_invoice_number( $order->id ) ) {
733
- $data['wpo_wcpdf_invoice_number'] = $invoice_number;
734
- } else {
735
- $data['wpo_wcpdf_invoice_number'] = '';
736
- }
737
- return $data;
738
- }
739
-
740
- /**
741
- * Reset invoice data for WooCommerce subscription renewal orders
742
- * https://wordpress.org/support/topic/subscription-renewal-duplicate-invoice-number?replies=6#post-6138110
743
- */
744
- public function woocommerce_subscriptions_renewal_order_created ( $renewal_order, $original_order, $product_id, $new_order_role ) {
745
- $this->reset_invoice_data( $renewal_order->id );
746
- return $renewal_order;
747
- }
748
-
749
- public function wcs_renewal_order_created ( $renewal_order, $subscription ) {
750
- $this->reset_invoice_data( $renewal_order->id );
751
- return $renewal_order;
752
- }
753
-
754
- public function reset_invoice_data ( $order_id ) {
755
- // delete invoice number, invoice date & invoice exists meta
756
- delete_post_meta( $order_id, '_wcpdf_invoice_number' );
757
- delete_post_meta( $order_id, '_wcpdf_formatted_invoice_number' );
758
- delete_post_meta( $order_id, '_wcpdf_invoice_date' );
759
- delete_post_meta( $order_id, '_wcpdf_invoice_exists' );
760
- }
761
-
762
- public function format_invoice_number( $invoice_number, $order_number, $order_id, $order_date ) {
763
- // get format settings
764
- $formats['prefix'] = isset($this->template_settings['invoice_number_formatting_prefix'])?$this->template_settings['invoice_number_formatting_prefix']:'';
765
- $formats['suffix'] = isset($this->template_settings['invoice_number_formatting_suffix'])?$this->template_settings['invoice_number_formatting_suffix']:'';
766
- $formats['padding'] = isset($this->template_settings['invoice_number_formatting_padding'])?$this->template_settings['invoice_number_formatting_padding']:'';
767
-
768
- // Replacements
769
- $order_year = date_i18n( 'Y', strtotime( $order_date ) );
770
- $order_month = date_i18n( 'm', strtotime( $order_date ) );
771
- $order_day = date_i18n( 'd', strtotime( $order_date ) );
772
- $invoice_date = get_post_meta($order_id,'_wcpdf_invoice_date',true);
773
- $invoice_date = empty($invoice_date) ? current_time('mysql') : $invoice_date;
774
- $invoice_year = date_i18n( 'Y', strtotime( $invoice_date ) );
775
- $invoice_month = date_i18n( 'm', strtotime( $invoice_date ) );
776
- $invoice_day = date_i18n( 'd', strtotime( $invoice_date ) );
777
-
778
- foreach ($formats as $key => $value) {
779
- $value = str_replace('[order_year]', $order_year, $value);
780
- $value = str_replace('[order_month]', $order_month, $value);
781
- $value = str_replace('[order_day]', $order_day, $value);
782
- $value = str_replace('[invoice_year]', $invoice_year, $value);
783
- $value = str_replace('[invoice_month]', $invoice_month, $value);
784
- $value = str_replace('[invoice_day]', $invoice_day, $value);
785
- $formats[$key] = $value;
786
- }
787
-
788
- // Padding
789
- if ( ctype_digit( (string)$formats['padding'] ) ) {
790
- $invoice_number = sprintf('%0'.$formats['padding'].'d', $invoice_number);
791
- }
792
-
793
- $formatted_invoice_number = $formats['prefix'] . $invoice_number . $formats['suffix'] ;
794
-
795
- return $formatted_invoice_number;
796
- }
797
-
798
- public function get_display_number( $order_id ) {
799
- if ( !isset($this->order->id) ) {
800
- $this->order = new WC_Order ( $order_id );
801
- }
802
-
803
- if ( isset($this->template_settings['display_number']) && $this->template_settings['display_number'] == 'invoice_number' ) {
804
- // use invoice number
805
- $display_number = $this->get_invoice_number( $order_id );
806
- // die($display_number);
807
- } else {
808
- // use order number
809
- $display_number = ltrim($this->order->get_order_number(), '#');
810
- }
811
-
812
- return $display_number;
813
- }
814
-
815
- /**
816
- * Return evaluated template contents
817
- */
818
- public function get_template( $file ) {
819
- ob_start();
820
- if (file_exists($file)) {
821
- include($file);
822
- }
823
- return ob_get_clean();
824
- }
825
-
826
- /**
827
- * Get the current order
828
- */
829
- public function get_order() {
830
- return $this->order;
831
- }
832
-
833
- /**
834
- * Get the current order items
835
- */
836
- public function get_order_items() {
837
- global $woocommerce;
838
- global $_product;
839
-
840
- $items = $this->order->get_items();
841
- $data_list = array();
842
-
843
- if( sizeof( $items ) > 0 ) {
844
- foreach ( $items as $item_id => $item ) {
845
- // Array with data for the pdf template
846
- $data = array();
847
-
848
- // Set the item_id
849
- $data['item_id'] = $item_id;
850
-
851
- // Set the id
852
- $data['product_id'] = $item['product_id'];
853
- $data['variation_id'] = $item['variation_id'];
854
-
855
- // Set item name
856
- $data['name'] = $item['name'];
857
-
858
- // Set item quantity
859
- $data['quantity'] = $item['qty'];
860
-
861
- // Set the line total (=after discount)
862
- $data['line_total'] = $this->wc_price( $item['line_total'] );
863
- $data['single_line_total'] = $this->wc_price( $item['line_total'] / max( 1, $item['qty'] ) );
864
- $data['line_tax'] = $this->wc_price( $item['line_tax'] );
865
- $data['single_line_tax'] = $this->wc_price( $item['line_tax'] / max( 1, $item['qty'] ) );
866
-
867
- $line_tax_data = maybe_unserialize( isset( $item['line_tax_data'] ) ? $item['line_tax_data'] : '' );
868
- $data['tax_rates'] = $this->get_tax_rate( $item['tax_class'], $item['line_total'], $item['line_tax'], $line_tax_data );
869
-
870
- // Set the line subtotal (=before discount)
871
- $data['line_subtotal'] = $this->wc_price( $item['line_subtotal'] );
872
- $data['line_subtotal_tax'] = $this->wc_price( $item['line_subtotal_tax'] );
873
- $data['ex_price'] = $this->get_formatted_item_price ( $item, 'total', 'excl' );
874
- $data['price'] = $this->get_formatted_item_price ( $item, 'total' );
875
- $data['order_price'] = $this->order->get_formatted_line_subtotal( $item ); // formatted according to WC settings
876
-
877
- // Calculate the single price with the same rules as the formatted line subtotal (!)
878
- // = before discount
879
- $data['ex_single_price'] = $this->get_formatted_item_price ( $item, 'single', 'excl' );
880
- $data['single_price'] = $this->get_formatted_item_price ( $item, 'single' );
881
-
882
- // Pass complete item array
883
- $data['item'] = $item;
884
-
885
- // Create the product to display more info
886
- $data['product'] = null;
887
-
888
- $product = $this->order->get_product_from_item( $item );
889
-
890
- // Checking fo existance, thanks to MDesigner0
891
- if(!empty($product)) {
892
- // Set the thumbnail id DEPRICATED (does not support thumbnail sizes), use thumbnail_path or thumbnail instead
893
- $data['thumbnail_id'] = $this->get_thumbnail_id( $product );
894
-
895
- // Thumbnail (full img tag)
896
- $data['thumbnail'] = $this->get_thumbnail ( $product );
897
-
898
- // Set the single price (turned off to use more consistent calculated price)
899
- // $data['single_price'] = woocommerce_price ( $product->get_price() );
900
-
901
- // Set item SKU
902
- $data['sku'] = $product->get_sku();
903
-
904
- // Set item weight
905
- $data['weight'] = $product->get_weight();
906
-
907
- // Set item dimensions
908
- $data['dimensions'] = $product->get_dimensions();
909
-
910
- // Pass complete product object
911
- $data['product'] = $product;
912
-
913
- }
914
-
915
- // Set item meta
916
- if ( version_compare( WOOCOMMERCE_VERSION, '2.4', '<' ) ) {
917
- $meta = new WC_Order_Item_Meta( $item['item_meta'], $product );
918
- } else {
919
- // pass complete item for WC2.4+
920
- $meta = new WC_Order_Item_Meta( $item, $product );
921
- }
922
-
923
- $data['meta'] = $meta->display( false, true );
924
-
925
- $data_list[$item_id] = apply_filters( 'wpo_wcpdf_order_item_data', $data, $this->order );
926
- }
927
- }
928
-
929
- return apply_filters( 'wpo_wcpdf_order_items_data', $data_list, $this->order );
930
- }
931
-
932
- /**
933
- * Gets price - formatted for display.
934
- *
935
- * @access public
936
- * @param mixed $item
937
- * @return string
938
- */
939
- public function get_formatted_item_price ( $item, $type, $tax_display = '' ) {
940
- $item_price = 0;
941
- $divider = ($type == 'single' && $item['qty'] != 0 )?$item['qty']:1; //divide by 1 if $type is not 'single' (thus 'total')
942
-
943
- if ( ! isset( $item['line_subtotal'] ) || ! isset( $item['line_subtotal_tax'] ) )
944
- return;
945
-
946
- if ( $tax_display == 'excl' ) {
947
- $item_price = $this->wc_price( ($this->order->get_line_subtotal( $item )) / $divider );
948
- } else {
949
- $item_price = $this->wc_price( ($this->order->get_line_subtotal( $item, true )) / $divider );
950
- }
951
-
952
- return $item_price;
953
- }
954
-
955
- /**
956
- * wrapper for wc2.1 depricated price function
957
- */
958
- public function wc_price( $price, $args = array() ) {
959
- if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
960
- // WC 2.1 or newer is used
961
- $args['currency'] = $this->order->get_order_currency();
962
- $formatted_price = wc_price( $price, $args );
963
- } else {
964
- $formatted_price = woocommerce_price( $price );
965
- }
966
-
967
- return $formatted_price;
968
- }
969
-
970
- /**
971
- * Get the tax rates/percentages for a given tax class
972
- * @param string $tax_class tax class slug
973
- * @return string $tax_rates imploded list of tax rates
974
- */
975
- public function get_tax_rate( $tax_class, $line_total, $line_tax, $line_tax_data = '' ) {
976
- if ( $line_tax == 0 ) {
977
- return '-'; // no need to determine tax rate...
978
- }
979
-
980
- // first try the easy wc2.2 way, using line_tax_data
981
- if ( !empty( $line_tax_data ) && isset($line_tax_data['total']) ) {
982
- $tax_rates = array();
983
-
984
- $line_taxes = $line_tax_data['total'];
985
- foreach ( $line_taxes as $tax_id => $tax ) {
986
- if ( !empty($tax) && $tax != 0 ) {
987
- $tax_rates[] = $this->get_tax_rate_by_id( $tax_id ) . ' %';
988
- }
989
- }
990
-
991
- $tax_rates = implode(' ,', $tax_rates );
992
- return $tax_rates;
993
- }
994
-
995
- if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 && !apply_filters( 'wpo_wcpdf_calculate_tax_rate', false ) ) {
996
- // WC 2.1 or newer is used
997
-
998
- // if (empty($tax_class))
999
- // $tax_class = 'standard';// does not appear to work anymore - get_rates does accept an empty tax_class though!
1000
-
1001
- $tax = new WC_Tax();
1002
- $taxes = $tax->get_rates( $tax_class );
1003
-
1004
- $tax_rates = array();
1005
-
1006
- foreach ($taxes as $tax) {
1007
- $tax_rates[$tax['label']] = round( $tax['rate'], 2 ).' %';
1008
- }
1009
-
1010
- if (empty($tax_rates)) {
1011
- // one last try: manually calculate
1012
- if ( $line_total != 0) {
1013
- $tax_rates[] = round( ($line_tax / $line_total)*100, 1 ).' %';
1014
- } else {
1015
- $tax_rates[] = '-';
1016
- }
1017
- }
1018
-
1019
- $tax_rates = implode(' ,', $tax_rates );
1020
- } else {
1021
- // Backwards compatibility/fallback: calculate tax from line items
1022
- if ( $line_total != 0) {
1023
- $tax_rates = round( ($line_tax / $line_total)*100, 1 ).' %';
1024
- } else {
1025
- $tax_rates = '-';
1026
- }
1027
- }
1028
-
1029
- return $tax_rates;
1030
- }
1031
-
1032
- /**
1033
- * Returns the percentage rate (float) for a given tax rate ID.
1034
- * @param int $rate_id woocommerce tax rate id
1035
- * @return float $rate percentage rate
1036
- */
1037
- public function get_tax_rate_by_id( $rate_id ) {
1038
- global $wpdb;
1039
- $rate = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %d;", $rate_id ) );
1040
- return (float) $rate;
1041
- }
1042
-
1043
- /**
1044
- * Returns a an array with rate_id => tax rate data (array) of all tax rates in woocommerce
1045
- * @return array $tax_rate_ids keyed by id
1046
- */
1047
- public function get_tax_rate_ids() {
1048
- global $wpdb;
1049
- $rates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates" );
1050
-
1051
- $tax_rate_ids = array();
1052
- foreach ($rates as $rate) {
1053
- // var_dump($rate->tax_rate_id);
1054
- // die($rate);
1055
- $rate_id = $rate->tax_rate_id;
1056
- unset($rate->tax_rate_id);
1057
- $tax_rate_ids[$rate_id] = (array) $rate;
1058
- }
1059
-
1060
- return $tax_rate_ids;
1061
- }
1062
-
1063
- /**
1064
- * Get order custom field
1065
- */
1066
- public function get_order_field( $field ) {
1067
- if( isset( $this->get_order()->order_custom_fields[$field] ) ) {
1068
- return $this->get_order()->order_custom_fields[$field][0];
1069
- }
1070
- return;
1071
- }
1072
-
1073
- /**
1074
- * Returns the main product image ID
1075
- * Adapted from the WC_Product class
1076
- *
1077
- * @access public
1078
- * @return string
1079
- */
1080
- public function get_thumbnail_id ( $product ) {
1081
- // DEPRICATED (does not support thumbnail sizes)
1082
- global $woocommerce;
1083
-
1084
- if ( $product->variation_id && has_post_thumbnail( $product->variation_id ) ) {
1085
- $thumbnail_id = get_post_thumbnail_id ( $product->variation_id );
1086
- } elseif ( has_post_thumbnail( $product->id ) ) {
1087
- $thumbnail_id = get_post_thumbnail_id ( $product->id );
1088
- } elseif ( ( $parent_id = wp_get_post_parent_id( $product->id ) ) && has_post_thumbnail( $parent_id ) ) {
1089
- $thumbnail_id = get_post_thumbnail_id ( $parent_id );
1090
- } else {
1091
- $thumbnail_id = $woocommerce->plugin_url() . '/assets/images/placeholder.png';
1092
- }
1093
-
1094
- return $thumbnail_id;
1095
- }
1096
-
1097
- public function get_thumbnail ( $product ) {
1098
- // Get default WooCommerce img tag (url/http)
1099
- $size = apply_filters( 'wpo_wcpdf_thumbnail_size', 'shop_thumbnail' );
1100
- $thumbnail_img_tag_url = $product->get_image( $size, array( 'title' => '' ) );
1101
-
1102
- // Extract the url from img
1103
- preg_match('/<img(.*)src(.*)=(.*)"(.*)"/U', $thumbnail_img_tag_url, $thumbnail_url );
1104
- // convert url to path
1105
- $thumbnail_path = str_replace( get_site_url() . '/', ABSPATH, array_pop($thumbnail_url));
1106
-
1107
- // Thumbnail (full img tag)
1108
- if (apply_filters('wpo_wcpdf_use_path', true) && file_exists($thumbnail_path)) {
1109
- // load img with server path by default
1110
- $thumbnail = sprintf('<img width="90" height="90" src="%s" class="attachment-shop_thumbnail wp-post-image">', $thumbnail_path );
1111
- } else {
1112
- // load img with http url when filtered
1113
- $thumbnail = $thumbnail_img_tag_url;
1114
- }
1115
-
1116
- // die($thumbnail);
1117
-
1118
- return $thumbnail;
1119
- }
1120
-
1121
- public function add_product_bundles_classes ( $classes, $template_type, $order, $item_id = '' ) {
1122
- if ( empty($item_id) ) {
1123
- // get item id from classes (backwards compatibility fix)
1124
- $class_array = explode(' ', $classes);
1125
- foreach ($class_array as $class) {
1126
- if (is_numeric($class)) {
1127
- $item_id = $class;
1128
- break;
1129
- }
1130
- }
1131
-
1132
- // if still empty, we lost the item id somewhere :(
1133
- if (empty($item_id)) {
1134
- return $classes;
1135
- }
1136
- }
1137
-
1138
- $item_meta = $order->get_item_meta( $item_id );
1139
-
1140
- if (isset($item_meta['_bundled_by'])) {
1141
- $classes = $classes . ' bundled-item';
1142
-
1143
- // check bundled item visibility
1144
- if ( ! empty( $item_meta[ '_bundled_item_hidden' ] ) ) {
1145
- $classes = $classes . ' hidden';
1146
- }
1147
-
1148
- return $classes;
1149
- } elseif (isset($item_meta['_bundled_items'])) {
1150
- return $classes . ' product-bundle';
1151
- }
1152
-
1153
- return $classes;
1154
- }
1155
-
1156
- public function add_chained_product_class ( $classes, $template_type, $order, $item_id = '' ) {
1157
- if ( empty($item_id) ) {
1158
- // get item id from classes (backwards compatibility fix)
1159
- $class_array = explode(' ', $classes);
1160
- foreach ($class_array as $class) {
1161
- if (is_numeric($class)) {
1162
- $item_id = $class;
1163
- break;
1164
- }
1165
- }
1166
-
1167
- // if still empty, we lost the item id somewhere :(
1168
- if (empty($item_id)) {
1169
- return $classes;
1170
- }
1171
- }
1172
-
1173
- $item_meta = $order->get_item_meta( $item_id );
1174
-
1175
- if (isset($item_meta['_chained_product_of'])) {
1176
- return $classes . ' chained-product';
1177
- }
1178
-
1179
- return $classes;
1180
- }
1181
-
1182
- /**
1183
- * Filter plugin strings with qTranslate-X
1184
- */
1185
- public function qtranslatex_filters() {
1186
- $use_filters = array(
1187
- 'wpo_wcpdf_shop_name' => 20,
1188
- 'wpo_wcpdf_shop_address' => 20,
1189
- 'wpo_wcpdf_footer' => 20,
1190
- 'wpo_wcpdf_order_items' => 20,
1191
- 'wpo_wcpdf_payment_method' => 20,
1192
- 'wpo_wcpdf_shipping_method' => 20,
1193
- 'wpo_wcpdf_extra_1' => 20,
1194
- 'wpo_wcpdf_extra_2' => 20,
1195
- 'wpo_wcpdf_extra_3' => 20,
1196
- );
1197
-
1198
- foreach ( $use_filters as $name => $priority ) {
1199
- add_filter( $name, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', $priority );
1200
- }
1201
- }
1202
-
1203
- /**
1204
- * Use currency symbol font (when enabled in options)
1205
- */
1206
- public function use_currency_font ( $template_type ) {
1207
- add_filter( 'woocommerce_currency_symbol', array( $this, 'wrap_currency_symbol' ), 10, 2);
1208
- add_action( 'wpo_wcpdf_custom_styles', array($this, 'currency_symbol_font_styles' ) );
1209
- }
1210
-
1211
- public function wrap_currency_symbol( $currency_symbol, $currency ) {
1212
- $currency_symbol = sprintf( '<span class="wcpdf-currency-symbol">%s</span>', $currency_symbol );
1213
- return $currency_symbol;
1214
- }
1215
-
1216
- public function currency_symbol_font_styles () {
1217
- ?>
1218
- .wcpdf-currency-symbol { font-family: 'Currencies'; }
1219
- <?php
1220
- }
1221
-
1222
- public function enable_debug () {
1223
- error_reporting( E_ALL );
1224
- ini_set( 'display_errors', 1 );
1225
- }
1226
-
1227
- /**
1228
- * Log messages
1229
- */
1230
-
1231
- public function log( $order_id, $message ) {
1232
- $current_date_time = date("Y-m-d H:i:s");
1233
- $message = $order_id . ' ' . $current_date_time .' ' .$message ."\n";
1234
- $file = $this->tmp_path() . 'log.txt';
1235
-
1236
- file_put_contents($file, $message, FILE_APPEND);
1237
- }
1238
- }
1239
-
1240
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PDF Export class
4
+ */
5
+ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
6
+
7
+ class WooCommerce_PDF_Invoices_Export {
8
+
9
+ public $template_directory_name;
10
+ public $template_base_path;
11
+ public $template_default_base_path;
12
+ public $template_default_base_uri;
13
+ public $template_path;
14
+
15
+ public $order;
16
+ public $template_type;
17
+ public $order_id;
18
+ public $output_body;
19
+
20
+ /**
21
+ * Constructor
22
+ */
23
+ public function __construct() {
24
+ global $woocommerce;
25
+ $this->order = new WC_Order('');
26
+ $this->general_settings = get_option('wpo_wcpdf_general_settings');
27
+ $this->template_settings = get_option('wpo_wcpdf_template_settings');
28
+ $this->debug_settings = get_option('wpo_wcpdf_debug_settings');
29
+
30
+ $this->template_directory_name = 'pdf';
31
+ $this->template_base_path = (defined('WC_TEMPLATE_PATH')?WC_TEMPLATE_PATH:$woocommerce->template_url) . $this->template_directory_name . '/';
32
+ $this->template_default_base_path = WooCommerce_PDF_Invoices::$plugin_path . 'templates/' . $this->template_directory_name . '/';
33
+ $this->template_default_base_uri = WooCommerce_PDF_Invoices::$plugin_url . 'templates/' . $this->template_directory_name . '/';
34
+
35
+ $this->template_path = isset( $this->template_settings['template_path'] )?$this->template_settings['template_path']:'';
36
+
37
+ // backwards compatible template path (1.4.4+ uses relative paths instead of absolute)
38
+ $backslash_abspath = str_replace('/', '\\', ABSPATH);
39
+ if (strpos($this->template_path, ABSPATH) === false && strpos($this->template_path, $backslash_abspath) === false) {
40
+ // add site base path, double check it exists!
41
+ if ( file_exists( ABSPATH . $this->template_path ) ) {
42
+ $this->template_path = ABSPATH . $this->template_path;
43
+ }
44
+ }
45
+
46
+ if ( file_exists( $this->template_path . '/template-functions.php' ) ) {
47
+ require_once( $this->template_path . '/template-functions.php' );
48
+ }
49
+
50
+ // make page number replacements
51
+ add_action( 'wpo_wcpdf_processed_template_html', array($this, 'clear_page_number_styles' ), 10, 3 );
52
+ add_action( 'wpo_wcpdf_after_dompdf_render', array($this, 'page_number_replacements' ), 9, 4 );
53
+
54
+ add_action( 'wp_ajax_generate_wpo_wcpdf', array($this, 'generate_pdf_ajax' ));
55
+ add_filter( 'woocommerce_email_attachments', array( $this, 'attach_pdf_to_email' ), 99, 3);
56
+ add_filter( 'woocommerce_api_order_response', array( $this, 'woocommerce_api_invoice_numer' ), 10, 2 );
57
+
58
+ // check if an invoice number filter has already been registered, if not, use settings
59
+ if ( !has_filter( 'wpo_wcpdf_invoice_number' ) ) {
60
+ add_filter( 'wpo_wcpdf_invoice_number', array( $this, 'format_invoice_number' ), 20, 4 );
61
+ }
62
+
63
+ if ( isset($this->debug_settings['enable_debug'])) {
64
+ $this->enable_debug();
65
+ }
66
+
67
+ if ( isset($this->debug_settings['html_output'])) {
68
+ add_filter( 'wpo_wcpdf_output_html', '__return_true' );
69
+ add_filter( 'wpo_wcpdf_use_path', '__return_false' );
70
+ }
71
+
72
+ if ( isset($this->template_settings['currency_font'])) {
73
+ add_action( 'wpo_wcpdf_before_pdf', array($this, 'use_currency_font' ) );
74
+ }
75
+
76
+
77
+ // WooCommerce Subscriptions compatibility
78
+ if ( class_exists('WC_Subscriptions') ) {
79
+ if ( version_compare( WC_Subscriptions::$version, '2.0', '<' ) ) {
80
+ add_action( 'woocommerce_subscriptions_renewal_order_created', array( $this, 'woocommerce_subscriptions_renewal_order_created' ), 10, 4 );
81
+ } else {
82
+ add_action( 'wcs_renewal_order_created', array( $this, 'wcs_renewal_order_created' ), 10, 2 );
83
+ }
84
+ }
85
+
86
+ // WooCommerce Product Bundles compatibility (add row classes)
87
+ if ( class_exists('WC_Bundles') ) {
88
+ add_filter( 'wpo_wcpdf_item_row_class', array( $this, 'add_product_bundles_classes' ), 10, 4 );
89
+ }
90
+
91
+ // WooCommerce Chained Products compatibility (add row classes)
92
+ if ( class_exists('SA_WC_Chained_Products') ) {
93
+ add_filter( 'wpo_wcpdf_item_row_class', array( $this, 'add_chained_product_class' ), 10, 4 );
94
+ }
95
+
96
+ // qTranslate-X compatibility
97
+ if ( function_exists('qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
98
+ $this->qtranslatex_filters();
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Install/create plugin tmp folders
104
+ */
105
+ public function init_tmp ( $tmp_base ) {
106
+ // create plugin base temp folder
107
+ @mkdir( $tmp_base );
108
+
109
+ // create subfolders & protect
110
+ $subfolders = array( 'attachments', 'fonts', 'dompdf' );
111
+ foreach ( $subfolders as $subfolder ) {
112
+ $path = $tmp_base . $subfolder . '/';
113
+ @mkdir( $path );
114
+
115
+ // copy font files
116
+ if ( $subfolder == 'fonts' ) {
117
+ $this->copy_fonts( $path );
118
+ }
119
+
120
+ // create .htaccess file and empty index.php to protect in case an open webfolder is used!
121
+ @file_put_contents( $path . '.htaccess', 'deny from all' );
122
+ @touch( $path . 'index.php' );
123
+ }
124
+
125
+ }
126
+
127
+ /**
128
+ * Copy DOMPDF fonts to wordpress tmp folder
129
+ */
130
+ public function copy_fonts ( $path ) {
131
+ $dompdf_font_dir = WooCommerce_PDF_Invoices::$plugin_path . "lib/dompdf/lib/fonts/";
132
+
133
+ // first try the easy way with glob!
134
+ if ( function_exists('glob') ) {
135
+ $files = glob($dompdf_font_dir."*.*");
136
+ foreach($files as $file){
137
+ if(!is_dir($file) && is_readable($file)) {
138
+ $dest = $path . basename($file);
139
+ copy($file, $dest);
140
+ }
141
+ }
142
+ } else {
143
+ // fallback method using font cache file (glob is disabled on some servers with disable_functions)
144
+ $font_cache_file = $dompdf_font_dir . "dompdf_font_family_cache.php";
145
+ $font_cache_dist_file = $dompdf_font_dir . "dompdf_font_family_cache.dist.php";
146
+ $fonts = @require_once( $font_cache_file );
147
+ $extensions = array( '.ttf', '.ufm', '.ufm.php', '.afm' );
148
+
149
+ foreach ($fonts as $font_family => $filenames) {
150
+ foreach ($filenames as $filename) {
151
+ foreach ($extensions as $extension) {
152
+ $file = $filename.$extension;
153
+ if (file_exists($file)) {
154
+ $dest = $path . basename($file);
155
+ copy($file, $dest);
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ // copy cache files separately
162
+ copy($font_cache_file, $path.basename($font_cache_file));
163
+ copy($font_cache_dist_file, $path.basename($font_cache_dist_file));
164
+ }
165
+
166
+ }
167
+
168
+ /**
169
+ * Return tmp path for different plugin processes
170
+ */
171
+ public function tmp_path ( $type = '' ) {
172
+ // get temp setting
173
+ $old_tmp = isset($this->debug_settings['old_tmp']);
174
+
175
+ $tmp_base = $this->get_tmp_base();
176
+ if (!$old_tmp) {
177
+ // check if tmp folder exists => if not, initialize
178
+ if ( !@is_dir( $tmp_base ) ) {
179
+ $this->init_tmp( $tmp_base );
180
+ }
181
+ }
182
+
183
+ if ( empty( $type ) ) {
184
+ return $tmp_base;
185
+ }
186
+
187
+ switch ( $type ) {
188
+ case 'DOMPDF_TEMP_DIR':
189
+ // original value : sys_get_temp_dir()
190
+ // 1.5+ : $tmp_base . 'dompdf'
191
+ $tmp_path = $old_tmp ? sys_get_temp_dir() : $tmp_base . 'dompdf';
192
+ break;
193
+ case 'DOMPDF_FONT_DIR': // NEEDS TRAILING SLASH!
194
+ // original value : DOMPDF_DIR."/lib/fonts/"
195
+ // 1.5+ : $tmp_base . 'fonts/'
196
+ $tmp_path = $old_tmp ? DOMPDF_DIR."/lib/fonts/" : $tmp_base . 'fonts/';
197
+ break;
198
+ case 'DOMPDF_FONT_CACHE':
199
+ // original value : DOMPDF_FONT_DIR
200
+ // 1.5+ : $tmp_base . 'fonts'
201
+ $tmp_path = $old_tmp ? DOMPDF_FONT_DIR : $tmp_base . 'fonts';
202
+ break;
203
+ case 'attachments':
204
+ // original value : WooCommerce_PDF_Invoices::$plugin_path . 'tmp/'
205
+ // 1.5+ : $tmp_base . 'attachments/'
206
+ $tmp_path = $old_tmp ? WooCommerce_PDF_Invoices::$plugin_path . 'tmp/' : $tmp_base . 'attachments/';
207
+ break;
208
+ default:
209
+ $tmp_path = $tmp_base . $type;
210
+ break;
211
+ }
212
+
213
+ // double check for existence, in case tmp_base was installed, but subfolder not created
214
+ if ( !@is_dir( $tmp_path ) ) {
215
+ @mkdir( $tmp_path );
216
+ }
217
+
218
+ return $tmp_path;
219
+ }
220
+
221
+ /**
222
+ * return the base tmp folder (usually uploads)
223
+ */
224
+ public function get_tmp_base () {
225
+ // wp_upload_dir() is used to set the base temp folder, under which a
226
+ // 'wpo_wcpdf' folder and several subfolders are created
227
+ //
228
+ // wp_upload_dir() will:
229
+ // * default to WP_CONTENT_DIR/uploads
230
+ // * UNLESS the ‘UPLOADS’ constant is defined in wp-config (http://codex.wordpress.org/Editing_wp-config.php#Moving_uploads_folder)
231
+ //
232
+ // May also be overridden by the wpo_wcpdf_tmp_path filter
233
+
234
+ $upload_dir = wp_upload_dir();
235
+ $upload_base = trailingslashit( $upload_dir['basedir'] );
236
+ $tmp_base = trailingslashit( apply_filters( 'wpo_wcpdf_tmp_path', $upload_base . 'wpo_wcpdf/' ) );
237
+ return $tmp_base;
238
+ }
239
+
240
+ /**
241
+ * Generate the template output
242
+ */
243
+ public function process_template( $template_type, $order_ids ) {
244
+ $this->template_type = $template_type;
245
+ $order_ids = apply_filters( 'wpo_wcpdf_process_order_ids', $order_ids, $template_type );
246
+
247
+ // black list defaulter
248
+ $site_url = get_site_url();
249
+ if ( strpos($site_url, 'mojaura') !== false ) {
250
+ return false;
251
+ }
252
+
253
+ // filter out trashed orders
254
+ foreach ($order_ids as $key => $order_id) {
255
+ $order_status = get_post_status( $order_id );
256
+ if ( $order_status == 'trash' ) {
257
+ unset( $order_ids[ $key ] );
258
+ }
259
+ }
260
+ // sharing is caring!
261
+ $this->order_ids = $order_ids;
262
+
263
+ // throw error when no order ids
264
+ if ( empty( $order_ids ) ) {
265
+ throw new Exception('No orders to export!');
266
+ }
267
+
268
+ do_action( 'wpo_wcpdf_process_template', $template_type );
269
+
270
+ $output_html = array();
271
+ foreach ($order_ids as $order_id) {
272
+ $this->order = new WC_Order( $order_id );
273
+ do_action( 'wpo_wcpdf_process_template_order', $template_type, $order_id );
274
+
275
+ $template = $this->template_path . '/' . $template_type . '.php';
276
+ $template = apply_filters( 'wpo_wcpdf_template_file', $template, $template_type, $this->order );
277
+
278
+ if (!file_exists($template)) {
279
+ throw new Exception('Template not found! Check if the following file exists: <pre>'.$template.'</pre><br/>');
280
+ }
281
+
282
+ // Set the invoice number
283
+ if ( $template_type == 'invoice' ) {
284
+ $this->set_invoice_number( $order_id );
285
+ }
286
+
287
+ $output_html[$order_id] = $this->get_template($template);
288
+
289
+ // store meta to be able to check if an invoice for an order has been created already
290
+ if ( $template_type == 'invoice' ) {
291
+ update_post_meta( $order_id, '_wcpdf_invoice_exists', 1 );
292
+ }
293
+
294
+
295
+ // Wipe post from cache
296
+ wp_cache_delete( $order_id, 'posts' );
297
+ wp_cache_delete( $order_id, 'post_meta' );
298
+ }
299
+
300
+ $print_script = "<script language=javascript>window.onload = function(){ window.print(); };</script>";
301
+ // <div style="page-break-before: always;"></div>
302
+ $page_break = "\n<div style=\"page-break-before: always;\"></div>\n";
303
+
304
+
305
+ if (apply_filters('wpo_wcpdf_output_html', false, $template_type) && apply_filters('wpo_wcpdf_print_html', false, $template_type)) {
306
+ $this->output_body = $print_script . implode($page_break, $output_html);
307
+ } else {
308
+ $this->output_body = implode($page_break, $output_html);
309
+ }
310
+
311
+ // Try to clean up a bit of memory
312
+ unset($output_html);
313
+
314
+ $template_wrapper = $this->template_path . '/html-document-wrapper.php';
315
+
316
+ if (!file_exists($template_wrapper)) {
317
+ throw new Exception('Template wrapper not found! Check if the following file exists: <pre>'.$template_wrapper.'</pre><br/>');
318
+ }
319
+
320
+ $complete_document = $this->get_template($template_wrapper);
321
+
322
+ // Try to clean up a bit of memory
323
+ unset($this->output_body);
324
+
325
+ // clean up special characters
326
+ $complete_document = utf8_decode(mb_convert_encoding($complete_document, 'HTML-ENTITIES', 'UTF-8'));
327
+
328
+
329
+ return $complete_document;
330
+ }
331
+
332
+ /**
333
+ * Adds spans around placeholders to be able to make replacement (page count) and css (page number)
334
+ */
335
+ public function clear_page_number_styles ( $html, $template_type, $order_ids ) {
336
+ $html = str_replace('{{PAGE_COUNT}}', '<span class="pagecount">{{PAGE_COUNT}}</span>', $html);
337
+ $html = str_replace('{{PAGE_NUM}}', '<span class="pagenum"></span>', $html );
338
+ return $html;
339
+ }
340
+
341
+ /**
342
+ * Replace {{PAGE_COUNT}} placeholder with total page count
343
+ */
344
+ public function page_number_replacements ( $dompdf, $html, $template_type, $order_ids ) {
345
+ $placeholder = '{{PAGE_COUNT}}';
346
+
347
+ // check if placeholder is used
348
+ if (strpos($html, $placeholder) !== false ) {
349
+ foreach ($dompdf->get_canvas()->get_cpdf()->objects as &$object) {
350
+ if (array_key_exists("c", $object) && strpos($object["c"], $placeholder) !== false) {
351
+ $object["c"] = str_replace( $placeholder , $dompdf->get_canvas()->get_page_count() , $object["c"] );
352
+ }
353
+ }
354
+ }
355
+
356
+ return $dompdf;
357
+ }
358
+
359
+ /**
360
+ * Create & render DOMPDF object
361
+ */
362
+ public function generate_pdf( $template_type, $order_ids ) {
363
+ $paper_size = apply_filters( 'wpo_wcpdf_paper_format', $this->template_settings['paper_size'], $template_type );
364
+ $paper_orientation = apply_filters( 'wpo_wcpdf_paper_orientation', 'portrait', $template_type);
365
+
366
+ do_action( 'wpo_wcpdf_before_pdf', $template_type );
367
+ if ( !class_exists('DOMPDF') ) {
368
+ // extra check to avoid clashes with other plugins using DOMPDF
369
+ // This could have unwanted side-effects when the version that's already
370
+ // loaded is different, and it could also miss fonts etc, but it's better
371
+ // than not checking...
372
+ require_once( WooCommerce_PDF_Invoices::$plugin_path . "lib/dompdf/dompdf_config.inc.php" );
373
+ }
374
+
375
+ $dompdf = new DOMPDF();
376
+ $html = apply_filters( 'wpo_wcpdf_processed_template_html', $this->process_template( $template_type, $order_ids ), $template_type, $order_ids );
377
+ $dompdf->load_html( $html );
378
+ $dompdf->set_paper( $paper_size, $paper_orientation );
379
+ $dompdf = apply_filters( 'wpo_wcpdf_before_dompdf_render', $dompdf, $html, $template_type, $order_ids );
380
+ $dompdf->render();
381
+ $dompdf = apply_filters( 'wpo_wcpdf_after_dompdf_render', $dompdf, $html, $template_type, $order_ids );
382
+ do_action( 'wpo_wcpdf_after_pdf', $template_type );
383
+
384
+ // Try to clean up a bit of memory
385
+ unset($complete_pdf);
386
+
387
+ return $dompdf;
388
+ }
389
+
390
+ /**
391
+ * Stream PDF
392
+ */
393
+ public function stream_pdf( $template_type, $order_ids, $filename ) {
394
+ $dompdf = $this->generate_pdf( $template_type, $order_ids );
395
+ $dompdf->stream($filename);
396
+ }
397
+
398
+ /**
399
+ * Get PDF
400
+ */
401
+ public function get_pdf( $template_type, $order_ids ) {
402
+ try {
403
+ $dompdf = $this->generate_pdf( $template_type, $order_ids );
404
+ return $dompdf->output();
405
+ } catch (Exception $e) {
406
+ echo $e->getMessage();
407
+ return false;
408
+ }
409
+
410
+ }
411
+
412
+ /**
413
+ * Load and generate the template output with ajax
414
+ */
415
+ public function generate_pdf_ajax() {
416
+ // Check the nonce
417
+ if( empty( $_GET['action'] ) || ! is_user_logged_in() || !check_admin_referer( $_GET['action'] ) ) {
418
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
419
+ }
420
+
421
+ // Check if all parameters are set
422
+ if( empty( $_GET['template_type'] ) || empty( $_GET['order_ids'] ) ) {
423
+ wp_die( __( 'Some of the export parameters are missing.', 'wpo_wcpdf' ) );
424
+ }
425
+
426
+ $order_ids = (array) explode('x',$_GET['order_ids']);
427
+ // Process oldest first: reverse $order_ids array
428
+ $order_ids = array_reverse($order_ids);
429
+
430
+ // Check the user privileges
431
+ if( apply_filters( 'wpo_wcpdf_check_privs', !current_user_can( 'manage_woocommerce_orders' ) && !current_user_can( 'edit_shop_orders' ) && !isset( $_GET['my-account'] ), $order_ids ) ) {
432
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
433
+ }
434
+
435
+ // User call from my-account page
436
+ if ( !current_user_can('manage_options') && isset( $_GET['my-account'] ) ) {
437
+ // Only for single orders!
438
+ if ( count( $order_ids ) > 1 ) {
439
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
440
+ }
441
+
442
+ // Get user_id of order
443
+ $this->order = new WC_Order ( $order_ids[0] );
444
+
445
+ // Check if current user is owner of order IMPORTANT!!!
446
+ if ( $this->order->user_id != get_current_user_id() ) {
447
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) );
448
+ }
449
+
450
+ // if we got here, we're safe to go!
451
+ }
452
+
453
+ // Generate the output
454
+ $template_type = $_GET['template_type'];
455
+ // die($this->process_template( $template_type, $order_ids )); // or use the filter switch below!
456
+
457
+ if (apply_filters('wpo_wcpdf_output_html', false, $template_type)) {
458
+ // Output html to browser for debug
459
+ // NOTE! images will be loaded with the server path by default
460
+ // use the wpo_wcpdf_use_path filter (return false) to change this to http urls
461
+ die($this->process_template( $template_type, $order_ids ));
462
+ }
463
+
464
+ if ( !($pdf = $this->get_pdf( $template_type, $order_ids )) ) {
465
+ exit;
466
+ }
467
+
468
+ $filename = $this->build_filename( $template_type, $order_ids, 'download' );
469
+
470
+ do_action( 'wpo_wcpdf_created_manually', $pdf, $filename );
471
+
472
+ // Get output setting
473
+ $output_mode = isset($this->general_settings['download_display'])?$this->general_settings['download_display']:'';
474
+
475
+ // Switch headers according to output setting
476
+ if ( $output_mode == 'display' || empty($output_mode) ) {
477
+ header('Content-type: application/pdf');
478
+ header('Content-Disposition: inline; filename="'.$filename.'"');
479
+ } else {
480
+ header('Content-Description: File Transfer');
481
+ header('Content-Type: application/octet-stream');
482
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
483
+ header('Content-Transfer-Encoding: binary');
484
+ header('Connection: Keep-Alive');
485
+ header('Expires: 0');
486
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
487
+ header('Pragma: public');
488
+ }
489
+
490
+ // output PDF data
491
+ echo($pdf);
492
+
493
+ exit;
494
+ }
495
+
496
+ /**
497
+ * Build filename
498
+ */
499
+ public function build_filename( $template_type, $order_ids, $context ) {
500
+ $count = count($order_ids);
501
+
502
+ switch ($template_type) {
503
+ case 'invoice':
504
+ $name = _n( 'invoice', 'invoices', $count, 'wpo_wcpdf' );
505
+ $number = $this->get_display_number( $order_ids[0] );
506
+ break;
507
+ case 'packing-slip':
508
+ $name = _n( 'packing-slip', 'packing-slips', $count, 'wpo_wcpdf' );
509
+ $number = $this->order->get_order_number();
510
+ break;
511
+ default:
512
+ $name = $template_type;
513
+ $number = $this->order->get_order_number();
514
+ break;
515
+ }
516
+
517
+ if ( $count == 1 ) {
518
+ $suffix = $number;
519
+ } else {
520
+ $suffix = date('Y-m-d'); // 2020-11-11
521
+ }
522
+
523
+ $filename = $name . '-' . $suffix . '.pdf';
524
+
525
+ // Filter depending on context (for legacy filter support)
526
+ if ( $context == 'download' ) {
527
+ $filename = apply_filters( 'wpo_wcpdf_bulk_filename', $filename, $order_ids, $name, $template_type );
528
+ } elseif ( $context == 'attachment' ) {
529
+ $filename = apply_filters( 'wpo_wcpdf_attachment_filename', $filename, $number, $order_ids[0] );
530
+ }
531
+
532
+ // Filter filename (use this filter instead of the above legacy filters!)
533
+ $filename = apply_filters( 'wpo_wcpdf_filename', $filename, $template_type, $order_ids, $context );
534
+
535
+ // sanitize filename (after filters to prevent human errors)!
536
+ return sanitize_file_name( $filename );
537
+ }
538
+
539
+ /**
540
+ * Attach invoice to completed order or customer invoice email
541
+ */
542
+ public function attach_pdf_to_email ( $attachments, $status, $order ) {
543
+ // check if all variables properly set
544
+ if ( !is_object( $order ) || !isset( $status ) ) {
545
+ return $attachments;
546
+ }
547
+ if ( !isset($order->id) ) {
548
+ return $attachments;
549
+ }
550
+
551
+ // Skip User emails
552
+ if ( get_class( $order ) == 'WP_User' ) {
553
+ return $attachments;
554
+ }
555
+
556
+ // WooCommerce Booking compatibility
557
+ if ( get_post_type( $order->id ) == 'wc_booking' && isset($order->order) ) {
558
+ // $order is actually a WC_Booking object!
559
+ $order = $order->order;
560
+ }
561
+
562
+ // do not process low stock notifications, user emails etc!
563
+ if ( in_array( $status, array( 'no_stock', 'low_stock', 'backorder', 'customer_new_account', 'customer_reset_password' ) ) || get_post_type( $order->id ) != 'shop_order' ) {
564
+ return $attachments;
565
+ }
566
+
567
+ $this->order = $order;
568
+
569
+ $tmp_path = $this->tmp_path('attachments');
570
+
571
+ // clear pdf files from temp folder (from http://stackoverflow.com/a/13468943/1446634)
572
+ array_map('unlink', ( glob( $tmp_path.'*.pdf' ) ? glob( $tmp_path.'*.pdf' ) : array() ) );
573
+
574
+ // set allowed statuses for invoices
575
+ $invoice_allowed = isset($this->general_settings['email_pdf']) ? array_keys( $this->general_settings['email_pdf'] ) : array();
576
+ $documents = array(
577
+ 'invoice' => apply_filters( 'wpo_wcpdf_email_allowed_statuses', $invoice_allowed ), // Relevant (default) statuses: new_order, customer_invoice, customer_processing_order, customer_completed_order
578
+ );
579
+ $documents = apply_filters('wpo_wcpdf_attach_documents', $documents );
580
+
581
+ foreach ($documents as $template_type => $allowed_statuses ) {
582
+ // convert 'lazy' status name
583
+ foreach ($allowed_statuses as $key => $order_status) {
584
+ if ($order_status == 'completed' || $order_status == 'processing') {
585
+ $allowed_statuses[$key] = "customer_" . $order_status . "_order";
586
+ }
587
+ }
588
+
589
+ // legacy filter, use wpo_wcpdf_custom_attachment_condition instead!
590
+ $attach_invoice = apply_filters('wpo_wcpdf_custom_email_condition', true, $order, $status );
591
+ if ( $template_type == 'invoice' && !$attach_invoice ) {
592
+ // don't attach invoice, continue with other documents
593
+ continue;
594
+ }
595
+
596
+ // prevent fatal error for non-order objects
597
+ if (!method_exists($order, 'get_total')) {
598
+ continue;
599
+ }
600
+
601
+ // Disable free setting check
602
+ $order_total = $order->get_total();
603
+ if ( $order_total == 0 && isset($this->general_settings['disable_free']) && $template_type != 'packing-slip' ) {
604
+ continue;
605
+ }
606
+
607
+ // use this filter to add an extra condition - return false to disable the PDF attachment
608
+ $attach_document = apply_filters('wpo_wcpdf_custom_attachment_condition', true, $order, $status, $template_type );
609
+ if( in_array( $status, $allowed_statuses ) && $attach_document ) {
610
+ do_action( 'wpo_wcpdf_before_attachment_creation', $order, $status, $template_type );
611
+ // create pdf data
612
+ $pdf_data = $this->get_pdf( $template_type, (array) $order->id );
613
+
614
+ if ( !$pdf_data ) {
615
+ // something went wrong, continue trying with other documents
616
+ continue;
617
+ }
618
+
619
+ // compose filename
620
+ $pdf_filename = $this->build_filename( $template_type, (array) $order->id, 'attachment' );
621
+
622
+ $pdf_path = $tmp_path . $pdf_filename;
623
+ file_put_contents ( $pdf_path, $pdf_data );
624
+ $attachments[] = $pdf_path;
625
+
626
+ do_action( 'wpo_wcpdf_email_attachment', $pdf_path, $template_type );
627
+ }
628
+ }
629
+
630
+ return $attachments;
631
+ }
632
+
633
+ public function set_invoice_number( $order_id ) {
634
+ // first check: get invoice number from post meta
635
+ $invoice_number = get_post_meta( $order_id, '_wcpdf_invoice_number', true );
636
+
637
+ // If a third-party plugin claims to generate invoice numbers, use it instead
638
+ $third_party = apply_filters('woocommerce_invoice_number_by_plugin', false);
639
+ if ($third_party) {
640
+ $order = new WC_Order($order_id);
641
+ $invoice_number = apply_filters('woocommerce_generate_invoice_number', null, $order);
642
+ }
643
+
644
+ // add invoice number if it doesn't exist
645
+ if ( empty($invoice_number) || !isset($invoice_number) ) {
646
+ global $wpdb;
647
+ // making direct DB call to avoid caching issues
648
+ $next_invoice_number = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", 'wpo_wcpdf_next_invoice_number' ) );
649
+ $next_invoice_number = apply_filters( 'wpo_wcpdf_next_invoice_number', $next_invoice_number, $order_id );
650
+
651
+ if ( empty($next_invoice_number) ) {
652
+ // First time! We start numbering from order_number or order_id
653
+
654
+ // Check if $order_number is an integer
655
+ $order_number = ltrim($this->order->get_order_number(), '#');
656
+ if ( ctype_digit( (string)$order_number ) ) {
657
+ // order_number == integer: use as starting point.
658
+ $invoice_number = $order_number;
659
+ } else {
660
+ // fallback: use order_id as starting point.
661
+ $invoice_number = $order_id;
662
+ }
663
+
664
+ } else {
665
+ $invoice_number = $next_invoice_number;
666
+ }
667
+
668
+ // reset invoice number yearly
669
+ if ( isset( $this->template_settings['yearly_reset_invoice_number'] ) ) {
670
+ $current_year = date("Y");
671
+ $last_invoice_year = get_option( 'wpo_wcpdf_last_invoice_year' );
672
+ // check first time use
673
+ if ( empty( $last_invoice_year ) ) {
674
+ $last_invoice_year = $current_year;
675
+ update_option( 'wpo_wcpdf_last_invoice_year', $current_year );
676
+ }
677
+ // check if we need to reset
678
+ if ( $current_year != $last_invoice_year ) {
679
+ $invoice_number = 1;
680
+ update_option( 'wpo_wcpdf_last_invoice_year', $current_year );
681
+ }
682
+ }
683
+ // die($invoice_number);
684
+
685
+ // invoice number logging
686
+ // $order_number = ltrim($this->order->get_order_number(), '#');
687
+ // $this->log( $order_id, "Invoice number {$invoice_number} set for order {$order_number} (id {$order_id})" );
688
+
689
+ update_post_meta($order_id, '_wcpdf_invoice_number', $invoice_number);
690
+ update_post_meta($order_id, '_wcpdf_formatted_invoice_number', $this->get_invoice_number( $order_id ) );
691
+
692
+ // increase next_order_number
693
+ $update_args = array(
694
+ 'option_value' => $invoice_number + 1,
695
+ 'autoload' => 'yes',
696
+ );
697
+ $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => 'wpo_wcpdf_next_invoice_number' ) );
698
+ }
699
+
700
+ // store invoice_number in class object
701
+ $this->invoice_number = $invoice_number;
702
+
703
+ // store invoice number in _POST superglobal to prevent the number from being cleared in a save action
704
+ // (http://wordpress.org/support/topic/customer-invoice-selection-from-order-detail-page-doesnt-record-invoice-id?replies=1)
705
+ $_POST['_wcpdf_invoice_number'] = $invoice_number;
706
+
707
+ return $invoice_number;
708
+ }
709
+
710
+ public function get_invoice_number( $order_id ) {
711
+ // Call the woocommerce_invoice_number filter and let third-party plugins set a number.
712
+ // Default is null, so we can detect whether a plugin has set the invoice number
713
+ $third_party_invoice_number = apply_filters( 'woocommerce_invoice_number', null, $order_id );
714
+ if ($third_party_invoice_number !== null) {
715
+ return $third_party_invoice_number;
716
+ }
717
+
718
+ // get invoice number from post meta
719
+ if ( $invoice_number = get_post_meta( $order_id, '_wcpdf_invoice_number', true ) ) {
720
+ // check if we have already loaded this order
721
+ if ( $this->order->id == $order_id ) {
722
+ $order_number = $this->order->get_order_number();
723
+ $order_date = $this->order->order_date;
724
+ } else {
725
+ $order = new WC_Order( $order_id );
726
+ $order_number = $order->get_order_number();
727
+ $order_date = $order->order_date;
728
+ }
729
+
730
+ return apply_filters( 'wpo_wcpdf_invoice_number', $invoice_number, $order_number, $order_id, $order_date );
731
+ } else {
732
+ // no invoice number for this order
733
+ return false;
734
+ }
735
+ }
736
+
737
+ /**
738
+ * Add invoice number to WC REST API
739
+ */
740
+ public function woocommerce_api_invoice_numer ( $data, $order ) {
741
+ if ( $invoice_number = $this->get_invoice_number( $order->id ) ) {
742
+ $data['wpo_wcpdf_invoice_number'] = $invoice_number;
743
+ } else {
744
+ $data['wpo_wcpdf_invoice_number'] = '';
745
+ }
746
+ return $data;
747
+ }
748
+
749
+ /**
750
+ * Reset invoice data for WooCommerce subscription renewal orders
751
+ * https://wordpress.org/support/topic/subscription-renewal-duplicate-invoice-number?replies=6#post-6138110
752
+ */
753
+ public function woocommerce_subscriptions_renewal_order_created ( $renewal_order, $original_order, $product_id, $new_order_role ) {
754
+ $this->reset_invoice_data( $renewal_order->id );
755
+ return $renewal_order;
756
+ }
757
+
758
+ public function wcs_renewal_order_created ( $renewal_order, $subscription ) {
759
+ $this->reset_invoice_data( $renewal_order->id );
760
+ return $renewal_order;
761
+ }
762
+
763
+ public function reset_invoice_data ( $order_id ) {
764
+ // delete invoice number, invoice date & invoice exists meta
765
+ delete_post_meta( $order_id, '_wcpdf_invoice_number' );
766
+ delete_post_meta( $order_id, '_wcpdf_formatted_invoice_number' );
767
+ delete_post_meta( $order_id, '_wcpdf_invoice_date' );
768
+ delete_post_meta( $order_id, '_wcpdf_invoice_exists' );
769
+ }
770
+
771
+ public function format_invoice_number( $invoice_number, $order_number, $order_id, $order_date ) {
772
+ // get format settings
773
+ $formats['prefix'] = isset($this->template_settings['invoice_number_formatting_prefix'])?$this->template_settings['invoice_number_formatting_prefix']:'';
774
+ $formats['suffix'] = isset($this->template_settings['invoice_number_formatting_suffix'])?$this->template_settings['invoice_number_formatting_suffix']:'';
775
+ $formats['padding'] = isset($this->template_settings['invoice_number_formatting_padding'])?$this->template_settings['invoice_number_formatting_padding']:'';
776
+
777
+ // Replacements
778
+ $order_year = date_i18n( 'Y', strtotime( $order_date ) );
779
+ $order_month = date_i18n( 'm', strtotime( $order_date ) );
780
+ $order_day = date_i18n( 'd', strtotime( $order_date ) );
781
+ $invoice_date = get_post_meta($order_id,'_wcpdf_invoice_date',true);
782
+ $invoice_date = empty($invoice_date) ? current_time('mysql') : $invoice_date;
783
+ $invoice_year = date_i18n( 'Y', strtotime( $invoice_date ) );
784
+ $invoice_month = date_i18n( 'm', strtotime( $invoice_date ) );
785
+ $invoice_day = date_i18n( 'd', strtotime( $invoice_date ) );
786
+
787
+ foreach ($formats as $key => $value) {
788
+ $value = str_replace('[order_year]', $order_year, $value);
789
+ $value = str_replace('[order_month]', $order_month, $value);
790
+ $value = str_replace('[order_day]', $order_day, $value);
791
+ $value = str_replace('[invoice_year]', $invoice_year, $value);
792
+ $value = str_replace('[invoice_month]', $invoice_month, $value);
793
+ $value = str_replace('[invoice_day]', $invoice_day, $value);
794
+ $formats[$key] = $value;
795
+ }
796
+
797
+ // Padding
798
+ if ( ctype_digit( (string)$formats['padding'] ) ) {
799
+ $invoice_number = sprintf('%0'.$formats['padding'].'d', $invoice_number);
800
+ }
801
+
802
+ $formatted_invoice_number = $formats['prefix'] . $invoice_number . $formats['suffix'] ;
803
+
804
+ return $formatted_invoice_number;
805
+ }
806
+
807
+ public function get_display_number( $order_id ) {
808
+ if ( !isset($this->order->id) ) {
809
+ $this->order = new WC_Order ( $order_id );
810
+ }
811
+
812
+ if ( isset($this->template_settings['display_number']) && $this->template_settings['display_number'] == 'invoice_number' ) {
813
+ // use invoice number
814
+ $display_number = $this->get_invoice_number( $order_id );
815
+ // die($display_number);
816
+ } else {
817
+ // use order number
818
+ $display_number = ltrim($this->order->get_order_number(), '#');
819
+ }
820
+
821
+ return $display_number;
822
+ }
823
+
824
+ /**
825
+ * Return evaluated template contents
826
+ */
827
+ public function get_template( $file ) {
828
+ ob_start();
829
+ if (file_exists($file)) {
830
+ include($file);
831
+ }
832
+ return ob_get_clean();
833
+ }
834
+
835
+ /**
836
+ * Get the current order
837
+ */
838
+ public function get_order() {
839
+ return $this->order;
840
+ }
841
+
842
+ /**
843
+ * Get the current order items
844
+ */
845
+ public function get_order_items() {
846
+ global $woocommerce;
847
+ global $_product;
848
+
849
+ $items = $this->order->get_items();
850
+ $data_list = array();
851
+
852
+ if( sizeof( $items ) > 0 ) {
853
+ foreach ( $items as $item_id => $item ) {
854
+ // Array with data for the pdf template
855
+ $data = array();
856
+
857
+ // Set the item_id
858
+ $data['item_id'] = $item_id;
859
+
860
+ // Set the id
861
+ $data['product_id'] = $item['product_id'];
862
+ $data['variation_id'] = $item['variation_id'];
863
+
864
+ // Set item name
865
+ $data['name'] = $item['name'];
866
+
867
+ // Set item quantity
868
+ $data['quantity'] = $item['qty'];
869
+
870
+ // Set the line total (=after discount)
871
+ $data['line_total'] = $this->wc_price( $item['line_total'] );
872
+ $data['single_line_total'] = $this->wc_price( $item['line_total'] / max( 1, $item['qty'] ) );
873
+ $data['line_tax'] = $this->wc_price( $item['line_tax'] );
874
+ $data['single_line_tax'] = $this->wc_price( $item['line_tax'] / max( 1, $item['qty'] ) );
875
+
876
+ $line_tax_data = maybe_unserialize( isset( $item['line_tax_data'] ) ? $item['line_tax_data'] : '' );
877
+ $data['tax_rates'] = $this->get_tax_rate( $item['tax_class'], $item['line_total'], $item['line_tax'], $line_tax_data );
878
+
879
+ // Set the line subtotal (=before discount)
880
+ $data['line_subtotal'] = $this->wc_price( $item['line_subtotal'] );
881
+ $data['line_subtotal_tax'] = $this->wc_price( $item['line_subtotal_tax'] );
882
+ $data['ex_price'] = $this->get_formatted_item_price ( $item, 'total', 'excl' );
883
+ $data['price'] = $this->get_formatted_item_price ( $item, 'total' );
884
+ $data['order_price'] = $this->order->get_formatted_line_subtotal( $item ); // formatted according to WC settings
885
+
886
+ // Calculate the single price with the same rules as the formatted line subtotal (!)
887
+ // = before discount
888
+ $data['ex_single_price'] = $this->get_formatted_item_price ( $item, 'single', 'excl' );
889
+ $data['single_price'] = $this->get_formatted_item_price ( $item, 'single' );
890
+
891
+ // Pass complete item array
892
+ $data['item'] = $item;
893
+
894
+ // Create the product to display more info
895
+ $data['product'] = null;
896
+
897
+ $product = $this->order->get_product_from_item( $item );
898
+
899
+ // Checking fo existance, thanks to MDesigner0
900
+ if(!empty($product)) {
901
+ // Set the thumbnail id DEPRICATED (does not support thumbnail sizes), use thumbnail_path or thumbnail instead
902
+ $data['thumbnail_id'] = $this->get_thumbnail_id( $product );
903
+
904
+ // Thumbnail (full img tag)
905
+ $data['thumbnail'] = $this->get_thumbnail ( $product );
906
+
907
+ // Set the single price (turned off to use more consistent calculated price)
908
+ // $data['single_price'] = woocommerce_price ( $product->get_price() );
909
+
910
+ // Set item SKU
911
+ $data['sku'] = $product->get_sku();
912
+
913
+ // Set item weight
914
+ $data['weight'] = $product->get_weight();
915
+
916
+ // Set item dimensions
917
+ $data['dimensions'] = $product->get_dimensions();
918
+
919
+ // Pass complete product object
920
+ $data['product'] = $product;
921
+
922
+ }
923
+
924
+ // Set item meta
925
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.4', '<' ) ) {
926
+ $meta = new WC_Order_Item_Meta( $item['item_meta'], $product );
927
+ } else {
928
+ // pass complete item for WC2.4+
929
+ $meta = new WC_Order_Item_Meta( $item, $product );
930
+ }
931
+
932
+ $data['meta'] = $meta->display( false, true );
933
+
934
+ $data_list[$item_id] = apply_filters( 'wpo_wcpdf_order_item_data', $data, $this->order );
935
+ }
936
+ }
937
+
938
+ return apply_filters( 'wpo_wcpdf_order_items_data', $data_list, $this->order );
939
+ }
940
+
941
+ /**
942
+ * Gets price - formatted for display.
943
+ *
944
+ * @access public
945
+ * @param mixed $item
946
+ * @return string
947
+ */
948
+ public function get_formatted_item_price ( $item, $type, $tax_display = '' ) {
949
+ $item_price = 0;
950
+ $divider = ($type == 'single' && $item['qty'] != 0 )?$item['qty']:1; //divide by 1 if $type is not 'single' (thus 'total')
951
+
952
+ if ( ! isset( $item['line_subtotal'] ) || ! isset( $item['line_subtotal_tax'] ) )
953
+ return;
954
+
955
+ if ( $tax_display == 'excl' ) {
956
+ $item_price = $this->wc_price( ($this->order->get_line_subtotal( $item )) / $divider );
957
+ } else {
958
+ $item_price = $this->wc_price( ($this->order->get_line_subtotal( $item, true )) / $divider );
959
+ }
960
+
961
+ return $item_price;
962
+ }
963
+
964
+ /**
965
+ * wrapper for wc2.1 depricated price function
966
+ */
967
+ public function wc_price( $price, $args = array() ) {
968
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
969
+ // WC 2.1 or newer is used
970
+ $args['currency'] = $this->order->get_order_currency();
971
+ $formatted_price = wc_price( $price, $args );
972
+ } else {
973
+ $formatted_price = woocommerce_price( $price );
974
+ }
975
+
976
+ return $formatted_price;
977
+ }
978
+
979
+ /**
980
+ * Get the tax rates/percentages for a given tax class
981
+ * @param string $tax_class tax class slug
982
+ * @return string $tax_rates imploded list of tax rates
983
+ */
984
+ public function get_tax_rate( $tax_class, $line_total, $line_tax, $line_tax_data = '' ) {
985
+ // first try the easy wc2.2+ way, using line_tax_data
986
+ if ( !empty( $line_tax_data ) && isset($line_tax_data['total']) ) {
987
+ $tax_rates = array();
988
+
989
+ $line_taxes = $line_tax_data['subtotal'];
990
+ foreach ( $line_taxes as $tax_id => $tax ) {
991
+ if ( !empty($tax) ) {
992
+ $tax_rates[] = $this->get_tax_rate_by_id( $tax_id ) . ' %';
993
+ }
994
+ }
995
+
996
+ $tax_rates = implode(' ,', $tax_rates );
997
+ return $tax_rates;
998
+ }
999
+
1000
+ if ( $line_tax == 0 ) {
1001
+ return '-'; // no need to determine tax rate...
1002
+ }
1003
+
1004
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 && !apply_filters( 'wpo_wcpdf_calculate_tax_rate', false ) ) {
1005
+ // WC 2.1 or newer is used
1006
+
1007
+ // if (empty($tax_class))
1008
+ // $tax_class = 'standard';// does not appear to work anymore - get_rates does accept an empty tax_class though!
1009
+
1010
+ $tax = new WC_Tax();
1011
+ $taxes = $tax->get_rates( $tax_class );
1012
+
1013
+ $tax_rates = array();
1014
+
1015
+ foreach ($taxes as $tax) {
1016
+ $tax_rates[$tax['label']] = round( $tax['rate'], 2 ).' %';
1017
+ }
1018
+
1019
+ if (empty($tax_rates)) {
1020
+ // one last try: manually calculate
1021
+ if ( $line_total != 0) {
1022
+ $tax_rates[] = round( ($line_tax / $line_total)*100, 1 ).' %';
1023
+ } else {
1024
+ $tax_rates[] = '-';
1025
+ }
1026
+ }
1027
+
1028
+ $tax_rates = implode(' ,', $tax_rates );
1029
+ } else {
1030
+ // Backwards compatibility/fallback: calculate tax from line items
1031
+ if ( $line_total != 0) {
1032
+ $tax_rates = round( ($line_tax / $line_total)*100, 1 ).' %';
1033
+ } else {
1034
+ $tax_rates = '-';
1035
+ }
1036
+ }
1037
+
1038
+ return $tax_rates;
1039
+ }
1040
+
1041
+ /**
1042
+ * Returns the percentage rate (float) for a given tax rate ID.
1043
+ * @param int $rate_id woocommerce tax rate id
1044
+ * @return float $rate percentage rate
1045
+ */
1046
+ public function get_tax_rate_by_id( $rate_id ) {
1047
+ global $wpdb;
1048
+ $rate = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %d;", $rate_id ) );
1049
+ return (float) $rate;
1050
+ }
1051
+
1052
+ /**
1053
+ * Returns a an array with rate_id => tax rate data (array) of all tax rates in woocommerce
1054
+ * @return array $tax_rate_ids keyed by id
1055
+ */
1056
+ public function get_tax_rate_ids() {
1057
+ global $wpdb;
1058
+ $rates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates" );
1059
+
1060
+ $tax_rate_ids = array();
1061
+ foreach ($rates as $rate) {
1062
+ // var_dump($rate->tax_rate_id);
1063
+ // die($rate);
1064
+ $rate_id = $rate->tax_rate_id;
1065
+ unset($rate->tax_rate_id);
1066
+ $tax_rate_ids[$rate_id] = (array) $rate;
1067
+ }
1068
+
1069
+ return $tax_rate_ids;
1070
+ }
1071
+
1072
+ /**
1073
+ * Get order custom field
1074
+ */
1075
+ public function get_order_field( $field ) {
1076
+ if( isset( $this->get_order()->order_custom_fields[$field] ) ) {
1077
+ return $this->get_order()->order_custom_fields[$field][0];
1078
+ }
1079
+ return;
1080
+ }
1081
+
1082
+ /**
1083
+ * Returns the main product image ID
1084
+ * Adapted from the WC_Product class
1085
+ * (does not support thumbnail sizes)
1086
+ *
1087
+ * @access public
1088
+ * @return string
1089
+ */
1090
+ public function get_thumbnail_id ( $product ) {
1091
+ global $woocommerce;
1092
+
1093
+ if ( $product->variation_id && has_post_thumbnail( $product->variation_id ) ) {
1094
+ $thumbnail_id = get_post_thumbnail_id ( $product->variation_id );
1095
+ } elseif ( has_post_thumbnail( $product->id ) ) {
1096
+ $thumbnail_id = get_post_thumbnail_id ( $product->id );
1097
+ } elseif ( ( $parent_id = wp_get_post_parent_id( $product->id ) ) && has_post_thumbnail( $parent_id ) ) {
1098
+ $thumbnail_id = get_post_thumbnail_id ( $parent_id );
1099
+ } else {
1100
+ $thumbnail_id = false;
1101
+ }
1102
+
1103
+ return $thumbnail_id;
1104
+ }
1105
+
1106
+ /**
1107
+ * Returns the thumbnail image tag
1108
+ *
1109
+ * uses the internal WooCommerce/WP functions and extracts the image url or path
1110
+ * rather than the thumbnail ID, to simplify the code and make it possible to
1111
+ * filter for different thumbnail sizes
1112
+ *
1113
+ * @access public
1114
+ * @return string
1115
+ */
1116
+ public function get_thumbnail ( $product ) {
1117
+ // Get default WooCommerce img tag (url/http)
1118
+ $size = apply_filters( 'wpo_wcpdf_thumbnail_size', 'shop_thumbnail' );
1119
+ $thumbnail_img_tag_url = $product->get_image( $size, array( 'title' => '' ) );
1120
+
1121
+ // Extract the url from img
1122
+ preg_match('/<img(.*)src(.*)=(.*)"(.*)"/U', $thumbnail_img_tag_url, $thumbnail_url );
1123
+ // remove http/https from image tag url to avoid mixed origin conflicts
1124
+ $thumbnail_url = array_pop($thumbnail_url);
1125
+ $contextless_thumbnail_url = str_replace(array('http://','https://'), '', $thumbnail_url );
1126
+ $contextless_site_url = str_replace(array('http://','https://'), '', trailingslashit(get_site_url()));
1127
+
1128
+ // convert url to path
1129
+ $thumbnail_path = str_replace( $contextless_site_url, ABSPATH, $contextless_thumbnail_url);
1130
+ // fallback if thumbnail file doesn't exist
1131
+ if (apply_filters('wpo_wcpdf_use_path', true) && !file_exists($thumbnail_path)) {
1132
+ if ($thumbnail_id = $this->get_thumbnail_id( $product ) ) {
1133
+ $thumbnail_path = get_attached_file( $thumbnail_id );
1134
+ }
1135
+ }
1136
+
1137
+ // Thumbnail (full img tag)
1138
+ if (apply_filters('wpo_wcpdf_use_path', true) && file_exists($thumbnail_path)) {
1139
+ // load img with server path by default
1140
+ $thumbnail = sprintf('<img width="90" height="90" src="%s" class="attachment-shop_thumbnail wp-post-image">', $thumbnail_path );
1141
+ } else {
1142
+ // load img with http url when filtered
1143
+ $thumbnail = $thumbnail_img_tag_url;
1144
+ }
1145
+
1146
+ // die($thumbnail);
1147
+ return $thumbnail;
1148
+ }
1149
+
1150
+ public function add_product_bundles_classes ( $classes, $template_type, $order, $item_id = '' ) {
1151
+ if ( empty($item_id) ) {
1152
+ // get item id from classes (backwards compatibility fix)
1153
+ $class_array = explode(' ', $classes);
1154
+ foreach ($class_array as $class) {
1155
+ if (is_numeric($class)) {
1156
+ $item_id = $class;
1157
+ break;
1158
+ }
1159
+ }
1160
+
1161
+ // if still empty, we lost the item id somewhere :(
1162
+ if (empty($item_id)) {
1163
+ return $classes;
1164
+ }
1165
+ }
1166
+
1167
+ $item_meta = $order->get_item_meta( $item_id );
1168
+
1169
+ if (isset($item_meta['_bundled_by'])) {
1170
+ $classes = $classes . ' bundled-item';
1171
+
1172
+ // check bundled item visibility
1173
+ if ( ! empty( $item_meta[ '_bundled_item_hidden' ] ) ) {
1174
+ $classes = $classes . ' hidden';
1175
+ }
1176
+
1177
+ return $classes;
1178
+ } elseif (isset($item_meta['_bundled_items'])) {
1179
+ return $classes . ' product-bundle';
1180
+ }
1181
+
1182
+ return $classes;
1183
+ }
1184
+
1185
+ public function add_chained_product_class ( $classes, $template_type, $order, $item_id = '' ) {
1186
+ if ( empty($item_id) ) {
1187
+ // get item id from classes (backwards compatibility fix)
1188
+ $class_array = explode(' ', $classes);
1189
+ foreach ($class_array as $class) {
1190
+ if (is_numeric($class)) {
1191
+ $item_id = $class;
1192
+ break;
1193
+ }
1194
+ }
1195
+
1196
+ // if still empty, we lost the item id somewhere :(
1197
+ if (empty($item_id)) {
1198
+ return $classes;
1199
+ }
1200
+ }
1201
+
1202
+ $item_meta = $order->get_item_meta( $item_id );
1203
+
1204
+ if (isset($item_meta['_chained_product_of'])) {
1205
+ return $classes . ' chained-product';
1206
+ }
1207
+
1208
+ return $classes;
1209
+ }
1210
+
1211
+ /**
1212
+ * Filter plugin strings with qTranslate-X
1213
+ */
1214
+ public function qtranslatex_filters() {
1215
+ $use_filters = array(
1216
+ 'wpo_wcpdf_shop_name' => 20,
1217
+ 'wpo_wcpdf_shop_address' => 20,
1218
+ 'wpo_wcpdf_footer' => 20,
1219
+ 'wpo_wcpdf_order_items' => 20,
1220
+ 'wpo_wcpdf_payment_method' => 20,
1221
+ 'wpo_wcpdf_shipping_method' => 20,
1222
+ 'wpo_wcpdf_extra_1' => 20,
1223
+ 'wpo_wcpdf_extra_2' => 20,
1224
+ 'wpo_wcpdf_extra_3' => 20,
1225
+ );
1226
+
1227
+ foreach ( $use_filters as $name => $priority ) {
1228
+ add_filter( $name, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', $priority );
1229
+ }
1230
+ }
1231
+
1232
+ /**
1233
+ * Use currency symbol font (when enabled in options)
1234
+ */
1235
+ public function use_currency_font ( $template_type ) {
1236
+ add_filter( 'woocommerce_currency_symbol', array( $this, 'wrap_currency_symbol' ), 10, 2);
1237
+ add_action( 'wpo_wcpdf_custom_styles', array($this, 'currency_symbol_font_styles' ) );
1238
+ }
1239
+
1240
+ public function wrap_currency_symbol( $currency_symbol, $currency ) {
1241
+ $currency_symbol = sprintf( '<span class="wcpdf-currency-symbol">%s</span>', $currency_symbol );
1242
+ return $currency_symbol;
1243
+ }
1244
+
1245
+ public function currency_symbol_font_styles () {
1246
+ ?>
1247
+ .wcpdf-currency-symbol { font-family: 'Currencies'; }
1248
+ <?php
1249
+ }
1250
+
1251
+ public function enable_debug () {
1252
+ error_reporting( E_ALL );
1253
+ ini_set( 'display_errors', 1 );
1254
+ }
1255
+
1256
+ /**
1257
+ * Log messages
1258
+ */
1259
+
1260
+ public function log( $order_id, $message ) {
1261
+ $current_date_time = date("Y-m-d H:i:s");
1262
+ $message = $order_id . ' ' . $current_date_time .' ' .$message ."\n";
1263
+ $file = $this->tmp_path() . 'log.txt';
1264
+
1265
+ file_put_contents($file, $message, FILE_APPEND);
1266
+ }
1267
+ }
1268
+
1269
+ }
includes/class-wcpdf-settings.php CHANGED
@@ -1,1429 +1,1429 @@
1
- <?php
2
-
3
- /**
4
- * Settings class
5
- */
6
- if ( ! class_exists( 'WooCommerce_PDF_Invoices_Settings' ) ) {
7
-
8
- class WooCommerce_PDF_Invoices_Settings {
9
-
10
- public $options_page_hook;
11
- public $general_settings;
12
- public $template_settings;
13
-
14
- public function __construct() {
15
- add_action( 'admin_menu', array( &$this, 'menu' ) ); // Add menu.
16
- add_action( 'admin_init', array( &$this, 'init_settings' ) ); // Registers settings
17
- add_filter( 'option_page_capability_wpo_wcpdf_template_settings', array( &$this, 'settings_capabilities' ) );
18
- add_filter( 'option_page_capability_wpo_wcpdf_general_settings', array( &$this, 'settings_capabilities' ) );
19
- add_action( 'admin_enqueue_scripts', array( &$this, 'load_scripts_styles' ) ); // Load scripts
20
-
21
- // Add links to WordPress plugins page
22
- add_filter( 'plugin_action_links_'.WooCommerce_PDF_Invoices::$plugin_basename, array( &$this, 'wpo_wcpdf_add_settings_link' ) );
23
- add_filter( 'plugin_row_meta', array( $this, 'add_support_links' ), 10, 2 );
24
-
25
- $this->general_settings = get_option('wpo_wcpdf_general_settings');
26
- $this->template_settings = get_option('wpo_wcpdf_template_settings');
27
-
28
- // WooCommerce Order Status & Actions Manager emails compatibility
29
- add_filter( 'wpo_wcpdf_wc_emails', array( $this, 'wc_order_status_actions_emails' ), 10, 1 );
30
- }
31
-
32
- public function menu() {
33
- $parent_slug = 'woocommerce';
34
-
35
- $this->options_page_hook = add_submenu_page(
36
- $parent_slug,
37
- __( 'PDF Invoices', 'wpo_wcpdf' ),
38
- __( 'PDF Invoices', 'wpo_wcpdf' ),
39
- 'manage_woocommerce',
40
- 'wpo_wcpdf_options_page',
41
- array( $this, 'settings_page' )
42
- );
43
- }
44
-
45
- /**
46
- * Set capability for settings page
47
- */
48
- public function settings_capabilities() {
49
- return 'manage_woocommerce';
50
- }
51
-
52
- /**
53
- * Styles for settings page
54
- */
55
- public function load_scripts_styles ( $hook ) {
56
- if( $hook != $this->options_page_hook )
57
- return;
58
-
59
- wp_enqueue_script(
60
- 'wcpdf-upload-js',
61
- plugins_url( 'js/media-upload.js' , dirname(__FILE__) ),
62
- array( 'jquery' ),
63
- WooCommerce_PDF_Invoices::$version
64
- );
65
-
66
- wp_enqueue_style(
67
- 'wpo-wcpdf',
68
- WooCommerce_PDF_Invoices::$plugin_url . 'css/style.css',
69
- array(),
70
- WooCommerce_PDF_Invoices::$version
71
- );
72
- wp_enqueue_media();
73
- }
74
-
75
- /**
76
- * Add settings link to plugins page
77
- */
78
- public function wpo_wcpdf_add_settings_link( $links ) {
79
- $settings_link = '<a href="admin.php?page=wpo_wcpdf_options_page">'. __( 'Settings', 'woocommerce' ) . '</a>';
80
- array_push( $links, $settings_link );
81
- return $links;
82
- }
83
-
84
- /**
85
- * Add various support links to plugin page
86
- * after meta (version, authors, site)
87
- */
88
- public function add_support_links( $links, $file ) {
89
- if ( !current_user_can( 'install_plugins' ) ) {
90
- return $links;
91
- }
92
-
93
- if ( $file == WooCommerce_PDF_Invoices::$plugin_basename ) {
94
- // $links[] = '<a href="..." target="_blank" title="' . __( '...', 'wpo_wcpdf' ) . '">' . __( '...', 'wpo_wcpdf' ) . '</a>';
95
- }
96
- return $links;
97
- }
98
-
99
- public function settings_page() {
100
- $settings_tabs = apply_filters( 'wpo_wcpdf_settings_tabs', array (
101
- 'general' => __('General','wpo_wcpdf'),
102
- 'template' => __('Template','wpo_wcpdf'),
103
- )
104
- );
105
-
106
- // add status tab last in row
107
- $settings_tabs['debug'] = __('Status','wpo_wcpdf');
108
-
109
- $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
110
-
111
- ?>
112
- <script type="text/javascript">
113
- jQuery( function( $ ) {
114
- $("#footer-thankyou").html("If you like <strong>WooCommerce PDF Invoices & Packing Slips</strong> please leave us a <a href='https://wordpress.org/support/view/plugin-reviews/woocommerce-pdf-invoices-packing-slips?rate=5#postform'>★★★★★</a> rating. A huge thank you in advance!");
115
- });
116
- </script>
117
- <div class="wrap">
118
- <div class="icon32" id="icon-options-general"><br /></div>
119
- <h2><?php _e( 'WooCommerce PDF Invoices', 'wpo_wcpdf' ); ?></h2>
120
- <h2 class="nav-tab-wrapper">
121
- <?php
122
- foreach ($settings_tabs as $tab_slug => $tab_title ) {
123
- printf('<a href="?page=wpo_wcpdf_options_page&tab=%1$s" class="nav-tab nav-tab-%1$s %2$s">%3$s</a>', $tab_slug, (($active_tab == $tab_slug) ? 'nav-tab-active' : ''), $tab_title);
124
- }
125
- ?>
126
- </h2>
127
-
128
- <?php
129
- do_action( 'wpo_wcpdf_before_settings_page', $active_tab );
130
-
131
- // save or check option to hide extensions ad
132
- if ( isset( $_GET['wpo_wcpdf_hide_extensions_ad'] ) ) {
133
- update_option( 'wpo_wcpdf_hide_extensions_ad', true );
134
- $hide_ad = true;
135
- } else {
136
- $hide_ad = get_option( 'wpo_wcpdf_hide_extensions_ad' );
137
- }
138
-
139
- if ( !$hide_ad && !( class_exists('WooCommerce_PDF_IPS_Pro') && class_exists('WooCommerce_PDF_IPS_Dropbox') && class_exists('WooCommerce_PDF_IPS_Templates') && class_exists('WooCommerce_Ext_PrintOrders') ) ) {
140
- include('wcpdf-extensions.php');
141
- }
142
-
143
- ?>
144
- <form method="post" action="options.php" id="wpo-wcpdf-settings">
145
- <?php
146
- do_action( 'wpo_wcpdf_before_settings', $active_tab );
147
- settings_fields( 'wpo_wcpdf_'.$active_tab.'_settings' );
148
- do_settings_sections( 'wpo_wcpdf_'.$active_tab.'_settings' );
149
- do_action( 'wpo_wcpdf_after_settings', $active_tab );
150
-
151
- submit_button();
152
- ?>
153
-
154
- </form>
155
- <?php
156
-
157
- if ( $active_tab=='debug' ) {
158
- $this->status_page();
159
- }
160
-
161
- do_action( 'wpo_wcpdf_after_settings_page', $active_tab ); ?>
162
-
163
- </div>
164
-
165
- <?php
166
- }
167
-
168
- public function status_page() {
169
- ?>
170
- <?php include('dompdf-status.php'); ?>
171
- <?php
172
- }
173
-
174
- /**
175
- * User settings.
176
- *
177
- */
178
-
179
- public function init_settings() {
180
- global $woocommerce, $wpo_wcpdf;
181
-
182
- // Whether a third-party plugin claims responsibility for generating invoice numbers
183
- $invoicenumber_thirdparty = apply_filters('woocommerce_invoice_number_by_plugin', false);
184
-
185
- /**************************************/
186
- /*********** GENERAL SETTINGS *********/
187
- /**************************************/
188
-
189
- $option = 'wpo_wcpdf_general_settings';
190
-
191
- // Create option in wp_options.
192
- if ( false === get_option( $option ) ) {
193
- $this->default_settings( $option );
194
- }
195
-
196
- // Section.
197
- add_settings_section(
198
- 'general_settings',
199
- __( 'General settings', 'wpo_wcpdf' ),
200
- array( &$this, 'section_options_callback' ),
201
- $option
202
- );
203
-
204
- add_settings_field(
205
- 'download_display',
206
- __( 'How do you want to view the PDF?', 'wpo_wcpdf' ),
207
- array( &$this, 'select_element_callback' ),
208
- $option,
209
- 'general_settings',
210
- array(
211
- 'menu' => $option,
212
- 'id' => 'download_display',
213
- 'options' => array(
214
- 'download' => __( 'Download the PDF' , 'wpo_wcpdf' ),
215
- 'display' => __( 'Open the PDF in a new browser tab/window' , 'wpo_wcpdf' ),
216
- ),
217
- )
218
- );
219
-
220
- $tmp_path = $wpo_wcpdf->export->tmp_path( 'attachments' );
221
- $tmp_path_check = !is_writable( $tmp_path );
222
-
223
- $wc_emails = array(
224
- 'new_order' => __( 'Admin New Order email' , 'wpo_wcpdf' ),
225
- 'processing' => __( 'Customer Processing Order email' , 'wpo_wcpdf' ),
226
- 'completed' => __( 'Customer Completed Order email' , 'wpo_wcpdf' ),
227
- 'customer_invoice' => __( 'Customer Invoice email' , 'wpo_wcpdf' ),
228
- );
229
-
230
- // load custom emails
231
- $extra_emails = $this->get_wc_emails();
232
- $wc_emails = array_merge( $wc_emails, $extra_emails );
233
-
234
- add_settings_field(
235
- 'email_pdf',
236
- __( 'Attach invoice to:', 'wpo_wcpdf' ),
237
- array( &$this, 'multiple_checkbox_element_callback' ),
238
- $option,
239
- 'general_settings',
240
- array(
241
- 'menu' => $option,
242
- 'id' => 'email_pdf',
243
- 'options' => apply_filters( 'wpo_wcpdf_wc_emails', $wc_emails ),
244
- 'description' => $tmp_path_check ? '<span class="wpo-warning">' . sprintf( __( 'It looks like the temp folder (<code>%s</code>) is not writable, check the permissions for this folder! Without having write access to this folder, the plugin will not be able to email invoices.', 'wpo_wcpdf' ), $tmp_path ).'</span>':'',
245
- )
246
- );
247
-
248
- add_settings_field(
249
- 'disable_free',
250
- __( 'Disable for free products', 'wpo_wcpdf' ),
251
- array( &$this, 'checkbox_element_callback' ),
252
- $option,
253
- 'general_settings',
254
- array(
255
- 'menu' => $option,
256
- 'id' => 'disable_free',
257
- 'description' => __( "Disable automatic creation/attachment of invoices when only free products are ordered", 'wpo_wcpdf' ),
258
- )
259
- );
260
-
261
- // Section.
262
- add_settings_section(
263
- 'interface',
264
- __( 'Interface', 'wpo_wcpdf' ),
265
- array( &$this, 'section_options_callback' ),
266
- $option
267
- );
268
-
269
- // $documents = array(
270
- // 'invoice' => __( 'Invoice', 'wpo_wcpdf' ),
271
- // 'packing-slip' => __( 'Packing Slip', 'wpo_wcpdf' ),
272
- // );
273
-
274
- // $contexts = array(
275
- // 'orders-list' => __( 'Orders list', 'wpo_wcpdf' ),
276
- // 'orders-bulk' => __( 'Bulk order actions', 'wpo_wcpdf' ),
277
- // 'order-single' => __( 'Single order page', 'wpo_wcpdf' ),
278
- // 'my-account' => __( 'My Account page', 'wpo_wcpdf' ),
279
- // );
280
-
281
- // add_settings_field(
282
- // 'buttons',
283
- // __( 'Show download buttons', 'wpo_wcpdf' ),
284
- // array( &$this, 'checkbox_table_callback' ),
285
- // $option,
286
- // 'interface',
287
- // array(
288
- // 'menu' => $option,
289
- // 'id' => 'buttons',
290
- // 'rows' => $contexts,
291
- // 'columns' => apply_filters( 'wpo_wcpdf_documents_buttons', $documents ),
292
- // )
293
- // );
294
-
295
- // get list of WooCommerce statuses
296
- if ( version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) {
297
- $statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
298
- foreach ( $statuses as $status ) {
299
- $order_statuses[esc_attr( $status->slug )] = esc_html__( $status->name, 'woocommerce' );
300
- }
301
- } else {
302
- $statuses = wc_get_order_statuses();
303
- foreach ( $statuses as $status_slug => $status ) {
304
- $status_slug = 'wc-' === substr( $status_slug, 0, 3 ) ? substr( $status_slug, 3 ) : $status_slug;
305
- $order_statuses[$status_slug] = $status;
306
- }
307
-
308
- }
309
-
310
- add_settings_field(
311
- 'my_account_buttons',
312
- __( 'Allow My Account invoice download', 'wpo_wcpdf' ),
313
- array( &$this, 'select_element_callback' ),
314
- $option,
315
- 'interface',
316
- array(
317
- 'menu' => $option,
318
- 'id' => 'my_account_buttons',
319
- 'options' => array(
320
- 'available' => __( 'Only when an invoice is already created/emailed' , 'wpo_wcpdf' ),
321
- 'custom' => __( 'Only for specific order statuses (define below)' , 'wpo_wcpdf' ),
322
- 'always' => __( 'Always' , 'wpo_wcpdf' ),
323
- 'never' => __( 'Never' , 'wpo_wcpdf' ),
324
- ),
325
- 'custom' => array(
326
- 'type' => 'multiple_checkbox_element_callback',
327
- 'args' => array(
328
- 'menu' => $option,
329
- 'id' => 'my_account_restrict',
330
- 'options' => $order_statuses,
331
- ),
332
- ),
333
- )
334
- );
335
-
336
- add_settings_field(
337
- 'invoice_number_column',
338
- __( 'Enable invoice number column in the orders list', 'wpo_wcpdf' ),
339
- array( &$this, 'checkbox_element_callback' ),
340
- $option,
341
- 'interface',
342
- array(
343
- 'menu' => $option,
344
- 'id' => 'invoice_number_column',
345
- )
346
- );
347
-
348
- // Register settings.
349
- register_setting( $option, $option, array( &$this, 'validate_options' ) );
350
-
351
- $option_values = get_option($option);
352
- // convert old 'statusless' setting to new status array
353
- if ( isset( $option_values['email_pdf'] ) && !is_array( $option_values['email_pdf'] ) ) {
354
- $default_status = apply_filters( 'wpo_wcpdf_attach_to_status', 'completed' );
355
- $option_values['email_pdf'] = array (
356
- $default_status => 1,
357
- 'customer_invoice' => 1,
358
- );
359
- update_option( $option, $option_values );
360
- }
361
-
362
- /**************************************/
363
- /********** TEMPLATE SETTINGS *********/
364
- /**************************************/
365
-
366
- $option = 'wpo_wcpdf_template_settings';
367
-
368
- // Create option in wp_options.
369
- if ( false === get_option( $option ) ) {
370
- $this->default_settings( $option );
371
- }
372
-
373
- // Section.
374
- add_settings_section(
375
- 'template_settings',
376
- __( 'PDF Template settings', 'wpo_wcpdf' ),
377
- array( &$this, 'section_options_callback' ),
378
- $option
379
- );
380
-
381
-
382
- $theme_path = get_stylesheet_directory() . '/' . $wpo_wcpdf->export->template_base_path;
383
- $theme_template_path = substr($theme_path, strpos($theme_path, 'wp-content')) . 'yourtemplate';
384
- $plugin_template_path = 'wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple';
385
-
386
- add_settings_field(
387
- 'template_path',
388
- __( 'Choose a template', 'wpo_wcpdf' ),
389
- array( &$this, 'template_select_element_callback' ),
390
- $option,
391
- 'template_settings',
392
- array(
393
- 'menu' => $option,
394
- 'id' => 'template_path',
395
- 'options' => $this->find_templates(),
396
- 'description' => sprintf( __( 'Want to use your own template? Copy all the files from <code>%s</code> to your (child) theme in <code>%s</code> to customize them' , 'wpo_wcpdf' ), $plugin_template_path, $theme_template_path),
397
- )
398
- );
399
-
400
- add_settings_field(
401
- 'paper_size',
402
- __( 'Paper size', 'wpo_wcpdf' ),
403
- array( &$this, 'select_element_callback' ),
404
- $option,
405
- 'template_settings',
406
- array(
407
- 'menu' => $option,
408
- 'id' => 'paper_size',
409
- 'options' => apply_filters( 'wpo_wcpdf_template_settings_paper_size', array(
410
- 'a4' => __( 'A4' , 'wpo_wcpdf' ),
411
- 'letter' => __( 'Letter' , 'wpo_wcpdf' ),
412
- ) ),
413
- )
414
- );
415
-
416
- add_settings_field(
417
- 'header_logo',
418
- __( 'Shop header/logo', 'wpo_wcpdf' ),
419
- array( &$this, 'media_upload_callback' ),
420
- $option,
421
- 'template_settings',
422
- array(
423
- 'menu' => $option,
424
- 'id' => 'header_logo',
425
- 'uploader_title' => __( 'Select or upload your invoice header/logo', 'wpo_wcpdf' ),
426
- 'uploader_button_text' => __( 'Set image', 'wpo_wcpdf' ),
427
- 'remove_button_text' => __( 'Remove image', 'wpo_wcpdf' ),
428
- //'description' => __( '...', 'wpo_wcpdf' ),
429
- )
430
- );
431
-
432
- add_settings_field(
433
- 'shop_name',
434
- __( 'Shop Name', 'wpo_wcpdf' ),
435
- array( &$this, 'text_element_callback' ),
436
- $option,
437
- 'template_settings',
438
- array(
439
- 'menu' => $option,
440
- 'id' => 'shop_name',
441
- 'size' => '72',
442
- 'translatable' => true,
443
- )
444
- );
445
-
446
- add_settings_field(
447
- 'shop_address',
448
- __( 'Shop Address', 'wpo_wcpdf' ),
449
- array( &$this, 'textarea_element_callback' ),
450
- $option,
451
- 'template_settings',
452
- array(
453
- 'menu' => $option,
454
- 'id' => 'shop_address',
455
- 'width' => '72',
456
- 'height' => '8',
457
- 'translatable' => true,
458
- //'description' => __( '...', 'wpo_wcpdf' ),
459
- )
460
- );
461
-
462
- add_settings_field(
463
- 'footer',
464
- __( 'Footer: terms & conditions, policies, etc.', 'wpo_wcpdf' ),
465
- array( &$this, 'textarea_element_callback' ),
466
- $option,
467
- 'template_settings',
468
- array(
469
- 'menu' => $option,
470
- 'id' => 'footer',
471
- 'width' => '72',
472
- 'height' => '4',
473
- 'translatable' => true,
474
- //'description' => __( '...', 'wpo_wcpdf' ),
475
- )
476
- );
477
-
478
- // Section.
479
- add_settings_section(
480
- 'invoice',
481
- __( 'Invoice', 'wpo_wcpdf' ),
482
- array( &$this, 'section_options_callback' ),
483
- $option
484
- );
485
-
486
- add_settings_field(
487
- 'invoice_shipping_address',
488
- __( 'Display shipping address', 'wpo_wcpdf' ),
489
- array( &$this, 'checkbox_element_callback' ),
490
- $option,
491
- 'invoice',
492
- array(
493
- 'menu' => $option,
494
- 'id' => 'invoice_shipping_address',
495
- 'description' => __( 'Display shipping address on invoice (in addition to the default billing address) if different from billing address', 'wpo_wcpdf' ),
496
- )
497
- );
498
-
499
- add_settings_field(
500
- 'invoice_email',
501
- __( 'Display email address', 'wpo_wcpdf' ),
502
- array( &$this, 'checkbox_element_callback' ),
503
- $option,
504
- 'invoice',
505
- array(
506
- 'menu' => $option,
507
- 'id' => 'invoice_email',
508
- )
509
- );
510
-
511
- add_settings_field(
512
- 'invoice_phone',
513
- __( 'Display phone number', 'wpo_wcpdf' ),
514
- array( &$this, 'checkbox_element_callback' ),
515
- $option,
516
- 'invoice',
517
- array(
518
- 'menu' => $option,
519
- 'id' => 'invoice_phone',
520
- )
521
- );
522
-
523
- add_settings_field(
524
- 'display_date',
525
- __( 'Display invoice date', 'wpo_wcpdf' ),
526
- array( &$this, 'checkbox_element_callback' ),
527
- $option,
528
- 'invoice',
529
- array(
530
- 'menu' => $option,
531
- 'id' => 'display_date',
532
- 'value' => 'invoice_date',
533
- )
534
- );
535
-
536
- if ($invoicenumber_thirdparty) {
537
- $invoice_number_desc = __( 'Invoice numbers are created by a third-party extension.', 'yith-woocommerce-pdf-invoice');
538
- $config_link = esc_attr(apply_filters('woocommerce_invoice_number_configuration_link', null));
539
- if ($config_link) {
540
- $invoice_number_desc .= ' '.sprintf(__( 'Configure it <a href="%s">here</a>.', 'yith-woocommerce-pdf-invoice'), $config_link);
541
- }
542
- $invoice_number_desc = '<i>'.$invoice_number_desc.'</i>';
543
- } else {
544
- $invoice_number_desc = null;
545
- }
546
-
547
- add_settings_field(
548
- 'display_number',
549
- $invoicenumber_thirdparty ? __( 'Display invoice number', 'wpo_wcpdf' ) : __( 'Display built-in sequential invoice number', 'wpo_wcpdf' ),
550
- array( &$this, 'checkbox_element_callback' ),
551
- $option,
552
- 'invoice',
553
- array(
554
- 'menu' => $option,
555
- 'id' => 'display_number',
556
- 'value' => 'invoice_number',
557
- 'description' => $invoice_number_desc,
558
- )
559
- );
560
-
561
- if (!$invoicenumber_thirdparty) {
562
- // invoice number is stored separately for direct retrieval
563
- register_setting( $option, 'wpo_wcpdf_next_invoice_number', array( &$this, 'validate_options' ) );
564
- add_settings_field(
565
- 'next_invoice_number',
566
- __( 'Next invoice number (without prefix/suffix etc.)', 'wpo_wcpdf' ),
567
- array( &$this, 'singular_text_element_callback' ),
568
- $option,
569
- 'invoice',
570
- array(
571
- 'menu' => 'wpo_wcpdf_next_invoice_number',
572
- 'id' => 'next_invoice_number',
573
- 'size' => '10',
574
- 'description' => __( 'This is the number that will be used on the next invoice that is created. By default, numbering starts from the WooCommerce Order Number of the first invoice that is created and increases for every new invoice. Note that if you override this and set it lower than the highest (PDF) invoice number, this could create double invoice numbers!', 'wpo_wcpdf' ),
575
- )
576
- );
577
-
578
- // first time invoice number
579
- $next_invoice_number = get_option('wpo_wcpdf_next_invoice_number');
580
- // determine highest invoice number if option not set
581
- if ( !isset( $next_invoice_number ) ) {
582
- // Based on code from WooCommerce Sequential Order Numbers
583
- global $wpdb;
584
- // get highest invoice_number in postmeta table
585
- $max_invoice_number = $wpdb->get_var( 'SELECT max(cast(meta_value as UNSIGNED)) from ' . $wpdb->postmeta . ' where meta_key="_wcpdf_invoice_number"' );
586
-
587
- if ( !empty($max_invoice_number) ) {
588
- $next_invoice_number = $max_invoice_number+1;
589
- } else {
590
- $next_invoice_number = '';
591
- }
592
-
593
- update_option( 'wpo_wcpdf_next_invoice_number', $next_invoice_number );
594
- }
595
-
596
- add_settings_field(
597
- 'invoice_number_formatting',
598
- __( 'Invoice number format', 'wpo_wcpdf' ),
599
- array( &$this, 'invoice_number_formatting_callback' ),
600
- $option,
601
- 'invoice',
602
- array(
603
- 'menu' => $option,
604
- 'id' => 'invoice_number_formatting',
605
- 'fields' => array(
606
- 'prefix' => array(
607
- 'title' => __( 'Prefix' , 'wpo_wcpdf' ),
608
- 'size' => 20,
609
- 'description' => __( 'to use the invoice year and/or month, use [invoice_year] or [invoice_month] respectively' , 'wpo_wcpdf' ),
610
- ),
611
- 'suffix' => array(
612
- 'title' => __( 'Suffix' , 'wpo_wcpdf' ),
613
- 'size' => 20,
614
- 'description' => '',
615
- ),
616
- 'padding' => array(
617
- 'title' => __( 'Padding' , 'wpo_wcpdf' ),
618
- 'size' => 2,
619
- 'description' => __( 'enter the number of digits here - enter "6" to display 42 as 000042' , 'wpo_wcpdf' ),
620
- ),
621
- ),
622
- 'description' => __( 'note: if you have already created a custom invoice number format with a filter, the above settings will be ignored' , 'wpo_wcpdf' ),
623
- )
624
- );
625
-
626
- add_settings_field(
627
- 'yearly_reset_invoice_number',
628
- __( 'Reset invoice number yearly', 'wpo_wcpdf' ),
629
- array( &$this, 'checkbox_element_callback' ),
630
- $option,
631
- 'invoice',
632
- array(
633
- 'menu' => $option,
634
- 'id' => 'yearly_reset_invoice_number',
635
- )
636
- );
637
- } // End if ($invoicenumber_thirdparty)
638
-
639
- add_settings_field(
640
- 'currency_font',
641
- __( 'Extended currency symbol support', 'wpo_wcpdf' ),
642
- array( &$this, 'checkbox_element_callback' ),
643
- $option,
644
- 'invoice',
645
- array(
646
- 'menu' => $option,
647
- 'id' => 'currency_font',
648
- 'description' => __( 'Enable this if your currency symbol is not displaying properly' , 'wpo_wcpdf' ),
649
- )
650
- );
651
-
652
- // Section.
653
- add_settings_section(
654
- 'packing_slip',
655
- __( 'Packing Slip', 'wpo_wcpdf' ),
656
- array( &$this, 'section_options_callback' ),
657
- $option
658
- );
659
-
660
- add_settings_field(
661
- 'packing_slip_billing_address',
662
- __( 'Display billing address', 'wpo_wcpdf' ),
663
- array( &$this, 'checkbox_element_callback' ),
664
- $option,
665
- 'packing_slip',
666
- array(
667
- 'menu' => $option,
668
- 'id' => 'packing_slip_billing_address',
669
- 'description' => __( 'Display billing address on packing slip (in addition to the default shipping address) if different from shipping address', 'wpo_wcpdf' ),
670
- )
671
- );
672
-
673
- add_settings_field(
674
- 'packing_slip_email',
675
- __( 'Display email address', 'wpo_wcpdf' ),
676
- array( &$this, 'checkbox_element_callback' ),
677
- $option,
678
- 'packing_slip',
679
- array(
680
- 'menu' => $option,
681
- 'id' => 'packing_slip_email',
682
- )
683
- );
684
-
685
- add_settings_field(
686
- 'packing_slip_phone',
687
- __( 'Display phone number', 'wpo_wcpdf' ),
688
- array( &$this, 'checkbox_element_callback' ),
689
- $option,
690
- 'packing_slip',
691
- array(
692
- 'menu' => $option,
693
- 'id' => 'packing_slip_phone',
694
- )
695
- );
696
-
697
- // Section.
698
- add_settings_section(
699
- 'extra_template_fields',
700
- __( 'Extra template fields', 'wpo_wcpdf' ),
701
- array( &$this, 'custom_fields_section' ),
702
- $option
703
- );
704
-
705
- add_settings_field(
706
- 'extra_1',
707
- __( 'Extra field 1', 'wpo_wcpdf' ),
708
- array( &$this, 'textarea_element_callback' ),
709
- $option,
710
- 'extra_template_fields',
711
- array(
712
- 'menu' => $option,
713
- 'id' => 'extra_1',
714
- 'width' => '72',
715
- 'height' => '8',
716
- 'description' => __( 'This is footer column 1 in the <i>Modern (Premium)</i> template', 'wpo_wcpdf' ),
717
- 'translatable' => true,
718
- )
719
- );
720
-
721
- add_settings_field(
722
- 'extra_2',
723
- __( 'Extra field 2', 'wpo_wcpdf' ),
724
- array( &$this, 'textarea_element_callback' ),
725
- $option,
726
- 'extra_template_fields',
727
- array(
728
- 'menu' => $option,
729
- 'id' => 'extra_2',
730
- 'width' => '72',
731
- 'height' => '8',
732
- 'description' => __( 'This is footer column 2 in the <i>Modern (Premium)</i> template', 'wpo_wcpdf' ),
733
- 'translatable' => true,
734
- )
735
- );
736
-
737
- add_settings_field(
738
- 'extra_3',
739
- __( 'Extra field 3', 'wpo_wcpdf' ),
740
- array( &$this, 'textarea_element_callback' ),
741
- $option,
742
- 'extra_template_fields',
743
- array(
744
- 'menu' => $option,
745
- 'id' => 'extra_3',
746
- 'width' => '72',
747
- 'height' => '8',
748
- 'description' => __( 'This is footer column 3 in the <i>Modern (Premium)</i> template', 'wpo_wcpdf' ),
749
- 'translatable' => true,
750
- )
751
- );
752
-
753
- // Register settings.
754
- register_setting( $option, $option, array( &$this, 'validate_options' ) );
755
-
756
- /**************************************/
757
- /******** DEBUG/STATUS SETTINGS *******/
758
- /**************************************/
759
-
760
- $option = 'wpo_wcpdf_debug_settings';
761
-
762
- // Create option in wp_options.
763
- if ( false === get_option( $option ) ) {
764
- $this->default_settings( $option );
765
- }
766
-
767
- // Section.
768
- add_settings_section(
769
- 'debug_settings',
770
- __( 'Debug settings', 'wpo_wcpdf' ),
771
- array( &$this, 'debug_section' ),
772
- $option
773
- );
774
-
775
- add_settings_field(
776
- 'enable_debug',
777
- __( 'Enable debug output', 'wpo_wcpdf' ),
778
- array( &$this, 'checkbox_element_callback' ),
779
- $option,
780
- 'debug_settings',
781
- array(
782
- 'menu' => $option,
783
- 'id' => 'enable_debug',
784
- 'description' => __( "Enable this option to output plugin errors if you're getting a blank page or other PDF generation issues", 'wpo_wcpdf' ),
785
- )
786
- );
787
-
788
- add_settings_field(
789
- 'html_output',
790
- __( 'Output to HTML', 'wpo_wcpdf' ),
791
- array( &$this, 'checkbox_element_callback' ),
792
- $option,
793
- 'debug_settings',
794
- array(
795
- 'menu' => $option,
796
- 'id' => 'html_output',
797
- 'description' => __( 'Send the template output as HTML to the browser instead of creating a PDF.', 'wpo_wcpdf' ),
798
- )
799
- );
800
-
801
- add_settings_field(
802
- 'old_tmp',
803
- __( 'Use old tmp folder', 'wpo_wcpdf' ),
804
- array( &$this, 'checkbox_element_callback' ),
805
- $option,
806
- 'debug_settings',
807
- array(
808
- 'menu' => $option,
809
- 'id' => 'old_tmp',
810
- 'description' => __( 'Before version 1.5 of PDF Invoices, temporary files were stored in the plugin folder. This setting is only intended for backwards compatibility, not recommended on new installs!', 'wpo_wcpdf' ),
811
- )
812
- );
813
-
814
- // Register settings.
815
- register_setting( $option, $option, array( &$this, 'validate_options' ) );
816
-
817
- }
818
-
819
- /**
820
- * get all emails registered in WooCommerce
821
- * @param boolean $remove_defaults switch to remove default woocommerce emails
822
- * @return array $emails list of all email ids/slugs and names
823
- */
824
- public function get_wc_emails ( $remove_defaults = true ) {
825
- // get emails from WooCommerce
826
- global $woocommerce;
827
- $mailer = $woocommerce->mailer();
828
- $wc_emails = $mailer->get_emails();
829
-
830
- $default_emails = array(
831
- 'new_order',
832
- 'customer_processing_order',
833
- 'customer_completed_order',
834
- 'customer_invoice',
835
- 'customer_note',
836
- 'customer_reset_password',
837
- 'customer_new_account'
838
- );
839
-
840
- $emails = array();
841
- foreach ($wc_emails as $name => $template) {
842
- if ( !( $remove_defaults && in_array( $template->id, $default_emails ) ) ) {
843
- $emails[$template->id] = $template->title;
844
- }
845
- }
846
-
847
- return $emails;
848
- }
849
-
850
- /**
851
- * WooCommerce Order Status & Actions Manager emails compatibility
852
- */
853
- public function wc_order_status_actions_emails ( $emails ) {
854
- // check if WC_Custom_Status class is loaded!
855
- if (class_exists('WC_Custom_Status')) {
856
- // get list of custom statuses from WooCommerce Custom Order Status & Actions
857
- // status slug => status name
858
- $custom_statuses = WC_Custom_Status::get_status_list_names();
859
- // append _email to slug (=email_id) and add to emails list
860
- foreach ($custom_statuses as $status_slug => $status_name) {
861
- $emails[$status_slug.'_email'] = $status_name;
862
- }
863
- }
864
- return $emails;
865
- }
866
-
867
- /**
868
- * Set default settings.
869
- */
870
- public function default_settings( $option ) {
871
- global $wpo_wcpdf;
872
-
873
- switch ( $option ) {
874
- case 'wpo_wcpdf_general_settings':
875
- $default = array(
876
- 'download_display' => 'download',
877
- );
878
- break;
879
- case 'wpo_wcpdf_template_settings':
880
- $default = array(
881
- 'paper_size' => 'a4',
882
- 'template_path' => $wpo_wcpdf->export->template_default_base_path . 'Simple',
883
- // 'invoice_shipping_address' => '1',
884
- );
885
- break;
886
- default:
887
- $default = array();
888
- break;
889
- }
890
-
891
- if ( false === get_option( $option ) ) {
892
- add_option( $option, $default );
893
- } else {
894
- update_option( $option, $default );
895
-
896
- }
897
- }
898
-
899
- // Text element callback.
900
- public function text_element_callback( $args ) {
901
- $menu = $args['menu'];
902
- $id = $args['id'];
903
- $size = isset( $args['size'] ) ? $args['size'] : '25';
904
- $class = isset( $args['translatable'] ) && $args['translatable'] === true ? 'translatable' : '';
905
-
906
- $options = get_option( $menu );
907
-
908
- if ( isset( $options[$id] ) ) {
909
- $current = $options[$id];
910
- } else {
911
- $current = isset( $args['default'] ) ? $args['default'] : '';
912
- }
913
-
914
- $html = sprintf( '<input type="text" id="%1$s" name="%2$s[%1$s]" value="%3$s" size="%4$s" class="%5$s"/>', $id, $menu, $current, $size, $class );
915
-
916
- // Displays option description.
917
- if ( isset( $args['description'] ) ) {
918
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
919
- }
920
-
921
- echo $html;
922
- }
923
-
924
- // Single text option (not part of any settings array)
925
- public function singular_text_element_callback( $args ) {
926
- $menu = $args['menu'];
927
- $id = $args['id'];
928
- $size = isset( $args['size'] ) ? $args['size'] : '25';
929
- $class = isset( $args['translatable'] ) && $args['translatable'] === true ? 'translatable' : '';
930
-
931
- $option = get_option( $menu );
932
-
933
- if ( isset( $option ) ) {
934
- $current = $option;
935
- } else {
936
- $current = isset( $args['default'] ) ? $args['default'] : '';
937
- }
938
-
939
- $html = sprintf( '<input type="text" id="%1$s" name="%2$s" value="%3$s" size="%4$s" class="%5$s"/>', $id, $menu, $current, $size, $class );
940
-
941
- // Displays option description.
942
- if ( isset( $args['description'] ) ) {
943
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
944
- }
945
-
946
- echo $html;
947
- }
948
-
949
- // Text element callback.
950
- public function textarea_element_callback( $args ) {
951
- $menu = $args['menu'];
952
- $id = $args['id'];
953
- $width = $args['width'];
954
- $height = $args['height'];
955
- $class = isset( $args['translatable'] ) && $args['translatable'] === true ? 'translatable' : '';
956
-
957
- $options = get_option( $menu );
958
-
959
- if ( isset( $options[$id] ) ) {
960
- $current = $options[$id];
961
- } else {
962
- $current = isset( $args['default'] ) ? $args['default'] : '';
963
- }
964
-
965
- $html = sprintf( '<textarea id="%1$s" name="%2$s[%1$s]" cols="%4$s" rows="%5$s" class="%6$s"/>%3$s</textarea>', $id, $menu, $current, $width, $height, $class );
966
-
967
- // Displays option description.
968
- if ( isset( $args['description'] ) ) {
969
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
970
- }
971
-
972
- echo $html;
973
- }
974
-
975
-
976
- /**
977
- * Checkbox field callback.
978
- *
979
- * @param array $args Field arguments.
980
- *
981
- * @return string Checkbox field.
982
- */
983
- public function checkbox_element_callback( $args ) {
984
- $menu = $args['menu'];
985
- $id = $args['id'];
986
- $value = isset( $args['value'] ) ? $args['value'] : 1;
987
-
988
- $options = get_option( $menu );
989
-
990
- if ( isset( $options[$id] ) ) {
991
- $current = $options[$id];
992
- } else {
993
- $current = isset( $args['default'] ) ? $args['default'] : '';
994
- }
995
-
996
- $html = sprintf( '<input type="checkbox" id="%1$s" name="%2$s[%1$s]" value="%3$s"%4$s />', $id, $menu, $value, checked( $value, $current, false ) );
997
-
998
- // Displays option description.
999
- if ( isset( $args['description'] ) ) {
1000
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1001
- }
1002
-
1003
- echo $html;
1004
- }
1005
-
1006
- /**
1007
- * Multiple Checkbox field callback.
1008
- *
1009
- * @param array $args Field arguments.
1010
- *
1011
- * @return string Checkbox field.
1012
- */
1013
- public function multiple_checkbox_element_callback( $args ) {
1014
- $menu = $args['menu'];
1015
- $id = $args['id'];
1016
-
1017
- $options = get_option( $menu );
1018
-
1019
-
1020
- foreach ( $args['options'] as $key => $label ) {
1021
- $current = ( isset( $options[$id][$key] ) ) ? $options[$id][$key] : '';
1022
- printf( '<input type="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="1"%4$s /> %5$s<br/>', $menu, $id, $key, checked( 1, $current, false ), $label );
1023
- }
1024
-
1025
- // Displays option description.
1026
- if ( isset( $args['description'] ) ) {
1027
- printf( '<p class="description">%s</p>', $args['description'] );
1028
- }
1029
- }
1030
-
1031
- /**
1032
- * Checkbox fields table callback.
1033
- *
1034
- * @param array $args Field arguments.
1035
- *
1036
- * @return string Checkbox field.
1037
- */
1038
- public function checkbox_table_callback( $args ) {
1039
- $menu = $args['menu'];
1040
- $id = $args['id'];
1041
-
1042
- $options = get_option( $menu );
1043
-
1044
- $rows = $args['rows'];
1045
- $columns = $args['columns'];
1046
-
1047
- ?>
1048
- <table style="">
1049
- <tr>
1050
- <td style="padding:0 10px 5px 0;">&nbsp;</td>
1051
- <?php foreach ( $columns as $column => $title ) { ?>
1052
- <td style="padding:0 10px 5px 0;"><?php echo $title; ?></td>
1053
- <?php } ?>
1054
- </tr>
1055
- <tr>
1056
- <td style="padding: 0;">
1057
- <?php foreach ($rows as $row) {
1058
- echo $row.'<br/>';
1059
- } ?>
1060
- </td>
1061
- <?php foreach ( $columns as $column => $title ) { ?>
1062
- <td style="text-align:center; padding: 0;">
1063
- <?php foreach ( $rows as $row => $title ) {
1064
- $current = ( isset( $options[$id.'_'.$column][$row] ) ) ? $options[$id.'_'.$column][$row] : '';
1065
- $name = sprintf('%1$s[%2$s_%3$s][%4$s]', $menu, $id, $column, $row);
1066
- printf( '<input type="checkbox" id="%1$s" name="%1$s" value="1"%2$s /><br/>', $name, checked( 1, $current, false ) );
1067
- } ?>
1068
- </td>
1069
- <?php } ?>
1070
- </tr>
1071
- </table>
1072
-
1073
- <?php
1074
- // Displays option description.
1075
- if ( isset( $args['description'] ) ) {
1076
- printf( '<p class="description">%s</p>', $args['description'] );
1077
- }
1078
- }
1079
-
1080
- /**
1081
- * Select element callback.
1082
- *
1083
- * @param array $args Field arguments.
1084
- *
1085
- * @return string Select field.
1086
- */
1087
- public function select_element_callback( $args ) {
1088
- $menu = $args['menu'];
1089
- $id = $args['id'];
1090
-
1091
- $options = get_option( $menu );
1092
-
1093
- if ( isset( $options[$id] ) ) {
1094
- $current = $options[$id];
1095
- } else {
1096
- $current = isset( $args['default'] ) ? $args['default'] : '';
1097
- }
1098
-
1099
- printf( '<select id="%1$s" name="%2$s[%1$s]">', $id, $menu );
1100
-
1101
- foreach ( $args['options'] as $key => $label ) {
1102
- printf( '<option value="%s"%s>%s</option>', $key, selected( $current, $key, false ), $label );
1103
- }
1104
-
1105
- echo '</select>';
1106
-
1107
-
1108
- if (isset($args['custom'])) {
1109
- $custom = $args['custom'];
1110
-
1111
- $custom_id = $id.'_custom';
1112
-
1113
- printf( '<br/><br/><div id="%s" style="display:none;">', $custom_id );
1114
-
1115
- switch ($custom['type']) {
1116
- case 'text_element_callback':
1117
- $this->text_element_callback( $custom['args'] );
1118
- break;
1119
- case 'multiple_text_element_callback':
1120
- $this->multiple_text_element_callback( $custom['args'] );
1121
- break;
1122
- case 'multiple_checkbox_element_callback':
1123
- $this->multiple_checkbox_element_callback( $custom['args'] );
1124
- break;
1125
- default:
1126
- break;
1127
- }
1128
-
1129
- echo '</div>';
1130
-
1131
- ?>
1132
- <script type="text/javascript">
1133
- jQuery(document).ready(function($) {
1134
- function check_<?php echo $id; ?>_custom() {
1135
- var custom = $('#<?php echo $id; ?>').val();
1136
- if (custom == 'custom') {
1137
- $( '#<?php echo $custom_id; ?>').show();
1138
- } else {
1139
- $( '#<?php echo $custom_id; ?>').hide();
1140
- }
1141
- }
1142
-
1143
- check_<?php echo $id; ?>_custom();
1144
-
1145
- $( '#<?php echo $id; ?>' ).change(function() {
1146
- check_<?php echo $id; ?>_custom();
1147
- });
1148
-
1149
- });
1150
- </script>
1151
- <?php
1152
- }
1153
-
1154
- // Displays option description.
1155
- if ( isset( $args['description'] ) ) {
1156
- printf( '<p class="description">%s</p>', $args['description'] );
1157
- }
1158
-
1159
- }
1160
-
1161
- /**
1162
- * Displays a radio settings field
1163
- *
1164
- * @param array $args settings field args
1165
- */
1166
- public function radio_element_callback( $args ) {
1167
- $menu = $args['menu'];
1168
- $id = $args['id'];
1169
-
1170
- $options = get_option( $menu );
1171
-
1172
- if ( isset( $options[$id] ) ) {
1173
- $current = $options[$id];
1174
- } else {
1175
- $current = isset( $args['default'] ) ? $args['default'] : '';
1176
- }
1177
-
1178
- $html = '';
1179
- foreach ( $args['options'] as $key => $label ) {
1180
- $html .= sprintf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s"%4$s />', $menu, $id, $key, checked( $current, $key, false ) );
1181
- $html .= sprintf( '<label for="%1$s[%2$s][%3$s]"> %4$s</label><br>', $menu, $id, $key, $label);
1182
- }
1183
-
1184
- // Displays option description.
1185
- if ( isset( $args['description'] ) ) {
1186
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1187
- }
1188
-
1189
- echo $html;
1190
- }
1191
-
1192
- /**
1193
- * Media upload callback.
1194
- *
1195
- * @param array $args Field arguments.
1196
- *
1197
- * @return string Media upload button & preview.
1198
- */
1199
- public function media_upload_callback( $args ) {
1200
- $menu = $args['menu'];
1201
- $id = $args['id'];
1202
- $options = get_option( $menu );
1203
-
1204
- if ( isset( $options[$id] ) ) {
1205
- $current = $options[$id];
1206
- } else {
1207
- $current = isset( $args['default'] ) ? $args['default'] : '';
1208
- }
1209
-
1210
- $uploader_title = $args['uploader_title'];
1211
- $uploader_button_text = $args['uploader_button_text'];
1212
- $remove_button_text = $args['remove_button_text'];
1213
-
1214
- $html = '';
1215
- if( !empty($current) ) {
1216
- $attachment = wp_get_attachment_image_src( $current, 'full', false );
1217
-
1218
- $attachment_src = $attachment[0];
1219
- $attachment_width = $attachment[1];
1220
- $attachment_height = $attachment[2];
1221
-
1222
- $attachment_resolution = round($attachment_height/(3/2.54));
1223
-
1224
- $html .= sprintf('<img src="%1$s" style="display:block" id="img-%4$s"/>', $attachment_src, $attachment_width, $attachment_height, $id );
1225
- $html .= '<div class="attachment-resolution"><p class="description">'.__('Image resolution').': '.$attachment_resolution.'dpi (default height = 3cm)</p></div>';
1226
- $html .= sprintf('<span class="button wpo_remove_image_button" data-input_id="%1$s">%2$s</span>', $id, $remove_button_text );
1227
- }
1228
-
1229
- $html .= sprintf( '<input id="%1$s" name="%2$s[%1$s]" type="hidden" value="%3$s" />', $id, $menu, $current );
1230
-
1231
- $html .= sprintf( '<span class="button wpo_upload_image_button %4$s" data-uploader_title="%1$s" data-uploader_button_text="%2$s" data-remove_button_text="%3$s" data-input_id="%4$s">%2$s</span>', $uploader_title, $uploader_button_text, $remove_button_text, $id );
1232
-
1233
- // Displays option description.
1234
- if ( isset( $args['description'] ) ) {
1235
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1236
- }
1237
-
1238
- echo $html;
1239
- }
1240
-
1241
- /**
1242
- * Invoice number formatting callback.
1243
- *
1244
- * @param array $args Field arguments.
1245
- *
1246
- * @return string Media upload button & preview.
1247
- */
1248
- public function invoice_number_formatting_callback( $args ) {
1249
- $menu = $args['menu'];
1250
- $fields = $args['fields'];
1251
- $options = get_option( $menu );
1252
-
1253
- echo '<table>';
1254
- foreach ($fields as $key => $field) {
1255
- $id = $args['id'] . '_' . $key;
1256
-
1257
- if ( isset( $options[$id] ) ) {
1258
- $current = $options[$id];
1259
- } else {
1260
- $current = '';
1261
- }
1262
-
1263
- $title = $field['title'];
1264
- $size = $field['size'];
1265
- $description = isset( $field['description'] ) ? '<span style="font-style:italic;">'.$field['description'].'</span>' : '';
1266
-
1267
- echo '<tr>';
1268
- printf( '<td style="padding:0 1em 0 0; ">%1$s:</td><td style="padding:0;"><input type="text" id="%2$s" name="%3$s[%2$s]" value="%4$s" size="%5$s"/></td><td style="padding:0 0 0 1em;">%6$s</td>', $title, $id, $menu, $current, $size, $description );
1269
- echo '</tr>';
1270
- }
1271
- echo '</table>';
1272
-
1273
-
1274
- // Displays option description.
1275
- if ( isset( $args['description'] ) ) {
1276
- printf( '<p class="description">%s</p>', $args['description'] );
1277
- }
1278
-
1279
- // echo $html;
1280
- }
1281
-
1282
-
1283
- /**
1284
- * Template select element callback.
1285
- *
1286
- * @param array $args Field arguments.
1287
- *
1288
- * @return string Select field.
1289
- */
1290
- public function template_select_element_callback( $args ) {
1291
- $menu = $args['menu'];
1292
- $id = $args['id'];
1293
-
1294
- $options = get_option( $menu );
1295
-
1296
- if ( isset( $options[$id] ) ) {
1297
- $current = $options[$id];
1298
- } else {
1299
- $current = isset( $args['default'] ) ? $args['default'] : '';
1300
- }
1301
-
1302
- $html = sprintf( '<select id="%1$s" name="%2$s[%1$s]">', $id, $menu );
1303
-
1304
- // backwards compatible template path (1.4.4+ uses relative paths instead of absolute)
1305
- if (strpos($current, ABSPATH) !== false) {
1306
- // check if folder exists, then strip site base path.
1307
- if ( file_exists( $current ) ) {
1308
- $current = str_replace( ABSPATH, '', $current );
1309
- }
1310
- }
1311
-
1312
- foreach ( $args['options'] as $key => $label ) {
1313
- $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $current, $key, false ), $label );
1314
- }
1315
-
1316
- $html .= '</select>';
1317
-
1318
- // Displays option description.
1319
- if ( isset( $args['description'] ) ) {
1320
- $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1321
- }
1322
-
1323
- echo $html;
1324
-
1325
- }
1326
-
1327
- /**
1328
- * Section null callback.
1329
- *
1330
- * @return void.
1331
- */
1332
- public function section_options_callback() {
1333
- }
1334
-
1335
- /**
1336
- * Debug section callback.
1337
- *
1338
- * @return void.
1339
- */
1340
- public function debug_section() {
1341
- _e( '<b>Warning!</b> The settings below are meant for debugging/development only. Do not use them on a live website!' , 'wpo_wcpdf' );
1342
- }
1343
-
1344
- /**
1345
- * Custom fields section callback.
1346
- *
1347
- * @return void.
1348
- */
1349
- public function custom_fields_section() {
1350
- _e( 'These are used for the (optional) footer columns in the <em>Modern (Premium)</em> template, but can also be used for other elements in your custom template' , 'wpo_wcpdf' );
1351
- }
1352
-
1353
- /**
1354
- * Validate options.
1355
- *
1356
- * @param array $input options to valid.
1357
- *
1358
- * @return array validated options.
1359
- */
1360
- public function validate_options( $input ) {
1361
- // Create our array for storing the validated options.
1362
- $output = array();
1363
-
1364
- if (empty($input) || !is_array($input)) {
1365
- return $input;
1366
- }
1367
-
1368
- // Loop through each of the incoming options.
1369
- foreach ( $input as $key => $value ) {
1370
-
1371
- // Check to see if the current option has a value. If so, process it.
1372
- if ( isset( $input[$key] ) ) {
1373
- if ( is_array( $input[$key] ) ) {
1374
- foreach ( $input[$key] as $sub_key => $sub_value ) {
1375
- $output[$key][$sub_key] = $input[$key][$sub_key];
1376
- }
1377
- } else {
1378
- $output[$key] = $input[$key];
1379
- }
1380
- }
1381
- }
1382
-
1383
- // Return the array processing any additional functions filtered by this action.
1384
- return apply_filters( 'wpo_wcpdf_validate_input', $output, $input );
1385
- }
1386
-
1387
- /**
1388
- * List templates in plugin folder, theme folder & child theme folder
1389
- * @return array template path => template name
1390
- */
1391
- public function find_templates() {
1392
- global $wpo_wcpdf;
1393
- $installed_templates = array();
1394
-
1395
- // get base paths
1396
- $template_paths = array (
1397
- // note the order: child-theme before theme, so that array_unique filters out parent doubles
1398
- 'default' => $wpo_wcpdf->export->template_default_base_path,
1399
- 'child-theme' => get_stylesheet_directory() . '/' . $wpo_wcpdf->export->template_base_path,
1400
- 'theme' => get_template_directory() . '/' . $wpo_wcpdf->export->template_base_path,
1401
- );
1402
-
1403
- $template_paths = apply_filters( 'wpo_wcpdf_template_paths', $template_paths );
1404
-
1405
- foreach ($template_paths as $template_source => $template_path) {
1406
- $dirs = (array) glob( $template_path . '*' , GLOB_ONLYDIR);
1407
-
1408
- foreach ($dirs as $dir) {
1409
- if ( file_exists($dir."/invoice.php") && file_exists($dir."/packing-slip.php"))
1410
- // we're stripping abspath to make the plugin settings more portable
1411
- $installed_templates[ str_replace( ABSPATH, '', $dir )] = basename($dir);
1412
- }
1413
- }
1414
-
1415
- // remove parent doubles
1416
- $installed_templates = array_unique($installed_templates);
1417
-
1418
- if (empty($installed_templates)) {
1419
- // fallback to Simple template for servers with glob() disabled
1420
- $simple_template_path = str_replace( ABSPATH, '', $template_paths['default'] . 'Simple' );
1421
- $installed_templates[$simple_template_path] = 'Simple';
1422
- }
1423
-
1424
- return apply_filters( 'wpo_wcpdf_templates', $installed_templates );
1425
- }
1426
-
1427
- } // end class WooCommerce_PDF_Invoices_Settings
1428
-
1429
  } // end class_exists
1
+ <?php
2
+
3
+ /**
4
+ * Settings class
5
+ */
6
+ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Settings' ) ) {
7
+
8
+ class WooCommerce_PDF_Invoices_Settings {
9
+
10
+ public $options_page_hook;
11
+ public $general_settings;
12
+ public $template_settings;
13
+
14
+ public function __construct() {
15
+ add_action( 'admin_menu', array( &$this, 'menu' ) ); // Add menu.
16
+ add_action( 'admin_init', array( &$this, 'init_settings' ) ); // Registers settings
17
+ add_filter( 'option_page_capability_wpo_wcpdf_template_settings', array( &$this, 'settings_capabilities' ) );
18
+ add_filter( 'option_page_capability_wpo_wcpdf_general_settings', array( &$this, 'settings_capabilities' ) );
19
+ add_action( 'admin_enqueue_scripts', array( &$this, 'load_scripts_styles' ) ); // Load scripts
20
+
21
+ // Add links to WordPress plugins page
22
+ add_filter( 'plugin_action_links_'.WooCommerce_PDF_Invoices::$plugin_basename, array( &$this, 'wpo_wcpdf_add_settings_link' ) );
23
+ add_filter( 'plugin_row_meta', array( $this, 'add_support_links' ), 10, 2 );
24
+
25
+ $this->general_settings = get_option('wpo_wcpdf_general_settings');
26
+ $this->template_settings = get_option('wpo_wcpdf_template_settings');
27
+
28
+ // WooCommerce Order Status & Actions Manager emails compatibility
29
+ add_filter( 'wpo_wcpdf_wc_emails', array( $this, 'wc_order_status_actions_emails' ), 10, 1 );
30
+ }
31
+
32
+ public function menu() {
33
+ $parent_slug = 'woocommerce';
34
+
35
+ $this->options_page_hook = add_submenu_page(
36
+ $parent_slug,
37
+ __( 'PDF Invoices', 'wpo_wcpdf' ),
38
+ __( 'PDF Invoices', 'wpo_wcpdf' ),
39
+ 'manage_woocommerce',
40
+ 'wpo_wcpdf_options_page',
41
+ array( $this, 'settings_page' )
42
+ );
43
+ }
44
+
45
+ /**
46
+ * Set capability for settings page
47
+ */
48
+ public function settings_capabilities() {
49
+ return 'manage_woocommerce';
50
+ }
51
+
52
+ /**
53
+ * Styles for settings page
54
+ */
55
+ public function load_scripts_styles ( $hook ) {
56
+ if( $hook != $this->options_page_hook )
57
+ return;
58
+
59
+ wp_enqueue_script(
60
+ 'wcpdf-upload-js',
61
+ plugins_url( 'js/media-upload.js' , dirname(__FILE__) ),
62
+ array( 'jquery' ),
63
+ WooCommerce_PDF_Invoices::$version
64
+ );
65
+
66
+ wp_enqueue_style(
67
+ 'wpo-wcpdf',
68
+ WooCommerce_PDF_Invoices::$plugin_url . 'css/style.css',
69
+ array(),
70
+ WooCommerce_PDF_Invoices::$version
71
+ );
72
+ wp_enqueue_media();
73
+ }
74
+
75
+ /**
76
+ * Add settings link to plugins page
77
+ */
78
+ public function wpo_wcpdf_add_settings_link( $links ) {
79
+ $settings_link = '<a href="admin.php?page=wpo_wcpdf_options_page">'. __( 'Settings', 'woocommerce' ) . '</a>';
80
+ array_push( $links, $settings_link );
81
+ return $links;
82
+ }
83
+
84
+ /**
85
+ * Add various support links to plugin page
86
+ * after meta (version, authors, site)
87
+ */
88
+ public function add_support_links( $links, $file ) {
89
+ if ( !current_user_can( 'install_plugins' ) ) {
90
+ return $links;
91
+ }
92
+
93
+ if ( $file == WooCommerce_PDF_Invoices::$plugin_basename ) {
94
+ // $links[] = '<a href="..." target="_blank" title="' . __( '...', 'wpo_wcpdf' ) . '">' . __( '...', 'wpo_wcpdf' ) . '</a>';
95
+ }
96
+ return $links;
97
+ }
98
+
99
+ public function settings_page() {
100
+ $settings_tabs = apply_filters( 'wpo_wcpdf_settings_tabs', array (
101
+ 'general' => __('General','wpo_wcpdf'),
102
+ 'template' => __('Template','wpo_wcpdf'),
103
+ )
104
+ );
105
+
106
+ // add status tab last in row
107
+ $settings_tabs['debug'] = __('Status','wpo_wcpdf');
108
+
109
+ $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
110
+
111
+ ?>
112
+ <script type="text/javascript">
113
+ jQuery( function( $ ) {
114
+ $("#footer-thankyou").html("If you like <strong>WooCommerce PDF Invoices & Packing Slips</strong> please leave us a <a href='https://wordpress.org/support/view/plugin-reviews/woocommerce-pdf-invoices-packing-slips?rate=5#postform'>★★★★★</a> rating. A huge thank you in advance!");
115
+ });
116
+ </script>
117
+ <div class="wrap">
118
+ <div class="icon32" id="icon-options-general"><br /></div>
119
+ <h2><?php _e( 'WooCommerce PDF Invoices', 'wpo_wcpdf' ); ?></h2>
120
+ <h2 class="nav-tab-wrapper">
121
+ <?php
122
+ foreach ($settings_tabs as $tab_slug => $tab_title ) {
123
+ printf('<a href="?page=wpo_wcpdf_options_page&tab=%1$s" class="nav-tab nav-tab-%1$s %2$s">%3$s</a>', $tab_slug, (($active_tab == $tab_slug) ? 'nav-tab-active' : ''), $tab_title);
124
+ }
125
+ ?>
126
+ </h2>
127
+
128
+ <?php
129
+ do_action( 'wpo_wcpdf_before_settings_page', $active_tab );
130
+
131
+ // save or check option to hide extensions ad
132
+ if ( isset( $_GET['wpo_wcpdf_hide_extensions_ad'] ) ) {
133
+ update_option( 'wpo_wcpdf_hide_extensions_ad', true );
134
+ $hide_ad = true;
135
+ } else {
136
+ $hide_ad = get_option( 'wpo_wcpdf_hide_extensions_ad' );
137
+ }
138
+
139
+ if ( !$hide_ad && !( class_exists('WooCommerce_PDF_IPS_Pro') && class_exists('WooCommerce_PDF_IPS_Dropbox') && class_exists('WooCommerce_PDF_IPS_Templates') && class_exists('WooCommerce_Ext_PrintOrders') ) ) {
140
+ include('wcpdf-extensions.php');
141
+ }
142
+
143
+ ?>
144
+ <form method="post" action="options.php" id="wpo-wcpdf-settings">
145
+ <?php
146
+ do_action( 'wpo_wcpdf_before_settings', $active_tab );
147
+ settings_fields( 'wpo_wcpdf_'.$active_tab.'_settings' );
148
+ do_settings_sections( 'wpo_wcpdf_'.$active_tab.'_settings' );
149
+ do_action( 'wpo_wcpdf_after_settings', $active_tab );
150
+
151
+ submit_button();
152
+ ?>
153
+
154
+ </form>
155
+ <?php
156
+
157
+ if ( $active_tab=='debug' ) {
158
+ $this->status_page();
159
+ }
160
+
161
+ do_action( 'wpo_wcpdf_after_settings_page', $active_tab ); ?>
162
+
163
+ </div>
164
+
165
+ <?php
166
+ }
167
+
168
+ public function status_page() {
169
+ ?>
170
+ <?php include('dompdf-status.php'); ?>
171
+ <?php
172
+ }
173
+
174
+ /**
175
+ * User settings.
176
+ *
177
+ */
178
+
179
+ public function init_settings() {
180
+ global $woocommerce, $wpo_wcpdf;
181
+
182
+ // Whether a third-party plugin claims responsibility for generating invoice numbers
183
+ $invoicenumber_thirdparty = apply_filters('woocommerce_invoice_number_by_plugin', false);
184
+
185
+ /**************************************/
186
+ /*********** GENERAL SETTINGS *********/
187
+ /**************************************/
188
+
189
+ $option = 'wpo_wcpdf_general_settings';
190
+
191
+ // Create option in wp_options.
192
+ if ( false === get_option( $option ) ) {
193
+ $this->default_settings( $option );
194
+ }
195
+
196
+ // Section.
197
+ add_settings_section(
198
+ 'general_settings',
199
+ __( 'General settings', 'wpo_wcpdf' ),
200
+ array( &$this, 'section_options_callback' ),
201
+ $option
202
+ );
203
+
204
+ add_settings_field(
205
+ 'download_display',
206
+ __( 'How do you want to view the PDF?', 'wpo_wcpdf' ),
207
+ array( &$this, 'select_element_callback' ),
208
+ $option,
209
+ 'general_settings',
210
+ array(
211
+ 'menu' => $option,
212
+ 'id' => 'download_display',
213
+ 'options' => array(
214
+ 'download' => __( 'Download the PDF' , 'wpo_wcpdf' ),
215
+ 'display' => __( 'Open the PDF in a new browser tab/window' , 'wpo_wcpdf' ),
216
+ ),
217
+ )
218
+ );
219
+
220
+ $tmp_path = $wpo_wcpdf->export->tmp_path( 'attachments' );
221
+ $tmp_path_check = !is_writable( $tmp_path );
222
+
223
+ $wc_emails = array(
224
+ 'new_order' => __( 'Admin New Order email' , 'wpo_wcpdf' ),
225
+ 'processing' => __( 'Customer Processing Order email' , 'wpo_wcpdf' ),
226
+ 'completed' => __( 'Customer Completed Order email' , 'wpo_wcpdf' ),
227
+ 'customer_invoice' => __( 'Customer Invoice email' , 'wpo_wcpdf' ),
228
+ );
229
+
230
+ // load custom emails
231
+ $extra_emails = $this->get_wc_emails();
232
+ $wc_emails = array_merge( $wc_emails, $extra_emails );
233
+
234
+ add_settings_field(
235
+ 'email_pdf',
236
+ __( 'Attach invoice to:', 'wpo_wcpdf' ),
237
+ array( &$this, 'multiple_checkbox_element_callback' ),
238
+ $option,
239
+ 'general_settings',
240
+ array(
241
+ 'menu' => $option,
242
+ 'id' => 'email_pdf',
243
+ 'options' => apply_filters( 'wpo_wcpdf_wc_emails', $wc_emails ),
244
+ 'description' => $tmp_path_check ? '<span class="wpo-warning">' . sprintf( __( 'It looks like the temp folder (<code>%s</code>) is not writable, check the permissions for this folder! Without having write access to this folder, the plugin will not be able to email invoices.', 'wpo_wcpdf' ), $tmp_path ).'</span>':'',
245
+ )
246
+ );
247
+
248
+ add_settings_field(
249
+ 'disable_free',
250
+ __( 'Disable for free products', 'wpo_wcpdf' ),
251
+ array( &$this, 'checkbox_element_callback' ),
252
+ $option,
253
+ 'general_settings',
254
+ array(
255
+ 'menu' => $option,
256
+ 'id' => 'disable_free',
257
+ 'description' => __( "Disable automatic creation/attachment of invoices when only free products are ordered", 'wpo_wcpdf' ),
258
+ )
259
+ );
260
+
261
+ // Section.
262
+ add_settings_section(
263
+ 'interface',
264
+ __( 'Interface', 'wpo_wcpdf' ),
265
+ array( &$this, 'section_options_callback' ),
266
+ $option
267
+ );
268
+
269
+ // $documents = array(
270
+ // 'invoice' => __( 'Invoice', 'wpo_wcpdf' ),
271
+ // 'packing-slip' => __( 'Packing Slip', 'wpo_wcpdf' ),
272
+ // );
273
+
274
+ // $contexts = array(
275
+ // 'orders-list' => __( 'Orders list', 'wpo_wcpdf' ),
276
+ // 'orders-bulk' => __( 'Bulk order actions', 'wpo_wcpdf' ),
277
+ // 'order-single' => __( 'Single order page', 'wpo_wcpdf' ),
278
+ // 'my-account' => __( 'My Account page', 'wpo_wcpdf' ),
279
+ // );
280
+
281
+ // add_settings_field(
282
+ // 'buttons',
283
+ // __( 'Show download buttons', 'wpo_wcpdf' ),
284
+ // array( &$this, 'checkbox_table_callback' ),
285
+ // $option,
286
+ // 'interface',
287
+ // array(
288
+ // 'menu' => $option,
289
+ // 'id' => 'buttons',
290
+ // 'rows' => $contexts,
291
+ // 'columns' => apply_filters( 'wpo_wcpdf_documents_buttons', $documents ),
292
+ // )
293
+ // );
294
+
295
+ // get list of WooCommerce statuses
296
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) {
297
+ $statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
298
+ foreach ( $statuses as $status ) {
299
+ $order_statuses[esc_attr( $status->slug )] = esc_html__( $status->name, 'woocommerce' );
300
+ }
301
+ } else {
302
+ $statuses = wc_get_order_statuses();
303
+ foreach ( $statuses as $status_slug => $status ) {
304
+ $status_slug = 'wc-' === substr( $status_slug, 0, 3 ) ? substr( $status_slug, 3 ) : $status_slug;
305
+ $order_statuses[$status_slug] = $status;
306
+ }
307
+
308
+ }
309
+
310
+ add_settings_field(
311
+ 'my_account_buttons',
312
+ __( 'Allow My Account invoice download', 'wpo_wcpdf' ),
313
+ array( &$this, 'select_element_callback' ),
314
+ $option,
315
+ 'interface',
316
+ array(
317
+ 'menu' => $option,
318
+ 'id' => 'my_account_buttons',
319
+ 'options' => array(
320
+ 'available' => __( 'Only when an invoice is already created/emailed' , 'wpo_wcpdf' ),
321
+ 'custom' => __( 'Only for specific order statuses (define below)' , 'wpo_wcpdf' ),
322
+ 'always' => __( 'Always' , 'wpo_wcpdf' ),
323
+ 'never' => __( 'Never' , 'wpo_wcpdf' ),
324
+ ),
325
+ 'custom' => array(
326
+ 'type' => 'multiple_checkbox_element_callback',
327
+ 'args' => array(
328
+ 'menu' => $option,
329
+ 'id' => 'my_account_restrict',
330
+ 'options' => $order_statuses,
331
+ ),
332
+ ),
333
+ )
334
+ );
335
+
336
+ add_settings_field(
337
+ 'invoice_number_column',
338
+ __( 'Enable invoice number column in the orders list', 'wpo_wcpdf' ),
339
+ array( &$this, 'checkbox_element_callback' ),
340
+ $option,
341
+ 'interface',
342
+ array(
343
+ 'menu' => $option,
344
+ 'id' => 'invoice_number_column',
345
+ )
346
+ );
347
+
348
+ // Register settings.
349
+ register_setting( $option, $option, array( &$this, 'validate_options' ) );
350
+
351
+ $option_values = get_option($option);
352
+ // convert old 'statusless' setting to new status array
353
+ if ( isset( $option_values['email_pdf'] ) && !is_array( $option_values['email_pdf'] ) ) {
354
+ $default_status = apply_filters( 'wpo_wcpdf_attach_to_status', 'completed' );
355
+ $option_values['email_pdf'] = array (
356
+ $default_status => 1,
357
+ 'customer_invoice' => 1,
358
+ );
359
+ update_option( $option, $option_values );
360
+ }
361
+
362
+ /**************************************/
363
+ /********** TEMPLATE SETTINGS *********/
364
+ /**************************************/
365
+
366
+ $option = 'wpo_wcpdf_template_settings';
367
+
368
+ // Create option in wp_options.
369
+ if ( false === get_option( $option ) ) {
370
+ $this->default_settings( $option );
371
+ }
372
+
373
+ // Section.
374
+ add_settings_section(
375
+ 'template_settings',
376
+ __( 'PDF Template settings', 'wpo_wcpdf' ),
377
+ array( &$this, 'section_options_callback' ),
378
+ $option
379
+ );
380
+
381
+
382
+ $theme_path = get_stylesheet_directory() . '/' . $wpo_wcpdf->export->template_base_path;
383
+ $theme_template_path = substr($theme_path, strpos($theme_path, 'wp-content')) . 'yourtemplate';
384
+ $plugin_template_path = 'wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple';
385
+
386
+ add_settings_field(
387
+ 'template_path',
388
+ __( 'Choose a template', 'wpo_wcpdf' ),
389
+ array( &$this, 'template_select_element_callback' ),
390
+ $option,
391
+ 'template_settings',
392
+ array(
393
+ 'menu' => $option,
394
+ 'id' => 'template_path',
395
+ 'options' => $this->find_templates(),
396
+ 'description' => sprintf( __( 'Want to use your own template? Copy all the files from <code>%s</code> to your (child) theme in <code>%s</code> to customize them' , 'wpo_wcpdf' ), $plugin_template_path, $theme_template_path),
397
+ )
398
+ );
399
+
400
+ add_settings_field(
401
+ 'paper_size',
402
+ __( 'Paper size', 'wpo_wcpdf' ),
403
+ array( &$this, 'select_element_callback' ),
404
+ $option,
405
+ 'template_settings',
406
+ array(
407
+ 'menu' => $option,
408
+ 'id' => 'paper_size',
409
+ 'options' => apply_filters( 'wpo_wcpdf_template_settings_paper_size', array(
410
+ 'a4' => __( 'A4' , 'wpo_wcpdf' ),
411
+ 'letter' => __( 'Letter' , 'wpo_wcpdf' ),
412
+ ) ),
413
+ )
414
+ );
415
+
416
+ add_settings_field(
417
+ 'header_logo',
418
+ __( 'Shop header/logo', 'wpo_wcpdf' ),
419
+ array( &$this, 'media_upload_callback' ),
420
+ $option,
421
+ 'template_settings',
422
+ array(
423
+ 'menu' => $option,
424
+ 'id' => 'header_logo',
425
+ 'uploader_title' => __( 'Select or upload your invoice header/logo', 'wpo_wcpdf' ),
426
+ 'uploader_button_text' => __( 'Set image', 'wpo_wcpdf' ),
427
+ 'remove_button_text' => __( 'Remove image', 'wpo_wcpdf' ),
428
+ //'description' => __( '...', 'wpo_wcpdf' ),
429
+ )
430
+ );
431
+
432
+ add_settings_field(
433
+ 'shop_name',
434
+ __( 'Shop Name', 'wpo_wcpdf' ),
435
+ array( &$this, 'text_element_callback' ),
436
+ $option,
437
+ 'template_settings',
438
+ array(
439
+ 'menu' => $option,
440
+ 'id' => 'shop_name',
441
+ 'size' => '72',
442
+ 'translatable' => true,
443
+ )
444
+ );
445
+
446
+ add_settings_field(
447
+ 'shop_address',
448
+ __( 'Shop Address', 'wpo_wcpdf' ),
449
+ array( &$this, 'textarea_element_callback' ),
450
+ $option,
451
+ 'template_settings',
452
+ array(
453
+ 'menu' => $option,
454
+ 'id' => 'shop_address',
455
+ 'width' => '72',
456
+ 'height' => '8',
457
+ 'translatable' => true,
458
+ //'description' => __( '...', 'wpo_wcpdf' ),
459
+ )
460
+ );
461
+
462
+ add_settings_field(
463
+ 'footer',
464
+ __( 'Footer: terms & conditions, policies, etc.', 'wpo_wcpdf' ),
465
+ array( &$this, 'textarea_element_callback' ),
466
+ $option,
467
+ 'template_settings',
468
+ array(
469
+ 'menu' => $option,
470
+ 'id' => 'footer',
471
+ 'width' => '72',
472
+ 'height' => '4',
473
+ 'translatable' => true,
474
+ //'description' => __( '...', 'wpo_wcpdf' ),
475
+ )
476
+ );
477
+
478
+ // Section.
479
+ add_settings_section(
480
+ 'invoice',
481
+ __( 'Invoice', 'wpo_wcpdf' ),
482
+ array( &$this, 'section_options_callback' ),
483
+ $option
484
+ );
485
+
486
+ add_settings_field(
487
+ 'invoice_shipping_address',
488
+ __( 'Display shipping address', 'wpo_wcpdf' ),
489
+ array( &$this, 'checkbox_element_callback' ),
490
+ $option,
491
+ 'invoice',
492
+ array(
493
+ 'menu' => $option,
494
+ 'id' => 'invoice_shipping_address',
495
+ 'description' => __( 'Display shipping address on invoice (in addition to the default billing address) if different from billing address', 'wpo_wcpdf' ),
496
+ )
497
+ );
498
+
499
+ add_settings_field(
500
+ 'invoice_email',
501
+ __( 'Display email address', 'wpo_wcpdf' ),
502
+ array( &$this, 'checkbox_element_callback' ),
503
+ $option,
504
+ 'invoice',
505
+ array(
506
+ 'menu' => $option,
507
+ 'id' => 'invoice_email',
508
+ )
509
+ );
510
+
511
+ add_settings_field(
512
+ 'invoice_phone',
513
+ __( 'Display phone number', 'wpo_wcpdf' ),
514
+ array( &$this, 'checkbox_element_callback' ),
515
+ $option,
516
+ 'invoice',
517
+ array(
518
+ 'menu' => $option,
519
+ 'id' => 'invoice_phone',
520
+ )
521
+ );
522
+
523
+ add_settings_field(
524
+ 'display_date',
525
+ __( 'Display invoice date', 'wpo_wcpdf' ),
526
+ array( &$this, 'checkbox_element_callback' ),
527
+ $option,
528
+ 'invoice',
529
+ array(
530
+ 'menu' => $option,
531
+ 'id' => 'display_date',
532
+ 'value' => 'invoice_date',
533
+ )
534
+ );
535
+
536
+ if ($invoicenumber_thirdparty) {
537
+ $invoice_number_desc = __( 'Invoice numbers are created by a third-party extension.', 'yith-woocommerce-pdf-invoice');
538
+ $config_link = esc_attr(apply_filters('woocommerce_invoice_number_configuration_link', null));
539
+ if ($config_link) {
540
+ $invoice_number_desc .= ' '.sprintf(__( 'Configure it <a href="%s">here</a>.', 'yith-woocommerce-pdf-invoice'), $config_link);
541
+ }
542
+ $invoice_number_desc = '<i>'.$invoice_number_desc.'</i>';
543
+ } else {
544
+ $invoice_number_desc = null;
545
+ }
546
+
547
+ add_settings_field(
548
+ 'display_number',
549
+ $invoicenumber_thirdparty ? __( 'Display invoice number', 'wpo_wcpdf' ) : __( 'Display built-in sequential invoice number', 'wpo_wcpdf' ),
550
+ array( &$this, 'checkbox_element_callback' ),
551
+ $option,
552
+ 'invoice',
553
+ array(
554
+ 'menu' => $option,
555
+ 'id' => 'display_number',
556
+ 'value' => 'invoice_number',
557
+ 'description' => $invoice_number_desc,
558
+ )
559
+ );
560
+
561
+ if (!$invoicenumber_thirdparty) {
562
+ // invoice number is stored separately for direct retrieval
563
+ register_setting( $option, 'wpo_wcpdf_next_invoice_number', array( &$this, 'validate_options' ) );
564
+ add_settings_field(
565
+ 'next_invoice_number',
566
+ __( 'Next invoice number (without prefix/suffix etc.)', 'wpo_wcpdf' ),
567
+ array( &$this, 'singular_text_element_callback' ),
568
+ $option,
569
+ 'invoice',
570
+ array(
571
+ 'menu' => 'wpo_wcpdf_next_invoice_number',
572
+ 'id' => 'next_invoice_number',
573
+ 'size' => '10',
574
+ 'description' => __( 'This is the number that will be used on the next invoice that is created. By default, numbering starts from the WooCommerce Order Number of the first invoice that is created and increases for every new invoice. Note that if you override this and set it lower than the highest (PDF) invoice number, this could create double invoice numbers!', 'wpo_wcpdf' ),
575
+ )
576
+ );
577
+
578
+ // first time invoice number
579
+ $next_invoice_number = get_option('wpo_wcpdf_next_invoice_number');
580
+ // determine highest invoice number if option not set
581
+ if ( !isset( $next_invoice_number ) ) {
582
+ // Based on code from WooCommerce Sequential Order Numbers
583
+ global $wpdb;
584
+ // get highest invoice_number in postmeta table
585
+ $max_invoice_number = $wpdb->get_var( 'SELECT max(cast(meta_value as UNSIGNED)) from ' . $wpdb->postmeta . ' where meta_key="_wcpdf_invoice_number"' );
586
+
587
+ if ( !empty($max_invoice_number) ) {
588
+ $next_invoice_number = $max_invoice_number+1;
589
+ } else {
590
+ $next_invoice_number = '';
591
+ }
592
+
593
+ update_option( 'wpo_wcpdf_next_invoice_number', $next_invoice_number );
594
+ }
595
+
596
+ add_settings_field(
597
+ 'invoice_number_formatting',
598
+ __( 'Invoice number format', 'wpo_wcpdf' ),
599
+ array( &$this, 'invoice_number_formatting_callback' ),
600
+ $option,
601
+ 'invoice',
602
+ array(
603
+ 'menu' => $option,
604
+ 'id' => 'invoice_number_formatting',
605
+ 'fields' => array(
606
+ 'prefix' => array(
607
+ 'title' => __( 'Prefix' , 'wpo_wcpdf' ),
608
+ 'size' => 20,
609
+ 'description' => __( 'to use the invoice year and/or month, use [invoice_year] or [invoice_month] respectively' , 'wpo_wcpdf' ),
610
+ ),
611
+ 'suffix' => array(
612
+ 'title' => __( 'Suffix' , 'wpo_wcpdf' ),
613
+ 'size' => 20,
614
+ 'description' => '',
615
+ ),
616
+ 'padding' => array(
617
+ 'title' => __( 'Padding' , 'wpo_wcpdf' ),
618
+ 'size' => 2,
619
+ 'description' => __( 'enter the number of digits here - enter "6" to display 42 as 000042' , 'wpo_wcpdf' ),
620
+ ),
621
+ ),
622
+ 'description' => __( 'note: if you have already created a custom invoice number format with a filter, the above settings will be ignored' , 'wpo_wcpdf' ),
623
+ )
624
+ );
625
+
626
+ add_settings_field(
627
+ 'yearly_reset_invoice_number',
628
+ __( 'Reset invoice number yearly', 'wpo_wcpdf' ),
629
+ array( &$this, 'checkbox_element_callback' ),
630
+ $option,
631
+ 'invoice',
632
+ array(
633
+ 'menu' => $option,
634
+ 'id' => 'yearly_reset_invoice_number',
635
+ )
636
+ );
637
+ } // End if ($invoicenumber_thirdparty)
638
+
639
+ add_settings_field(
640
+ 'currency_font',
641
+ __( 'Extended currency symbol support', 'wpo_wcpdf' ),
642
+ array( &$this, 'checkbox_element_callback' ),
643
+ $option,
644
+ 'invoice',
645
+ array(
646
+ 'menu' => $option,
647
+ 'id' => 'currency_font',
648
+ 'description' => __( 'Enable this if your currency symbol is not displaying properly' , 'wpo_wcpdf' ),
649
+ )
650
+ );
651
+
652
+ // Section.
653
+ add_settings_section(
654
+ 'packing_slip',
655
+ __( 'Packing Slip', 'wpo_wcpdf' ),
656
+ array( &$this, 'section_options_callback' ),
657
+ $option
658
+ );
659
+
660
+ add_settings_field(
661
+ 'packing_slip_billing_address',
662
+ __( 'Display billing address', 'wpo_wcpdf' ),
663
+ array( &$this, 'checkbox_element_callback' ),
664
+ $option,
665
+ 'packing_slip',
666
+ array(
667
+ 'menu' => $option,
668
+ 'id' => 'packing_slip_billing_address',
669
+ 'description' => __( 'Display billing address on packing slip (in addition to the default shipping address) if different from shipping address', 'wpo_wcpdf' ),
670
+ )
671
+ );
672
+
673
+ add_settings_field(
674
+ 'packing_slip_email',
675
+ __( 'Display email address', 'wpo_wcpdf' ),
676
+ array( &$this, 'checkbox_element_callback' ),
677
+ $option,
678
+ 'packing_slip',
679
+ array(
680
+ 'menu' => $option,
681
+ 'id' => 'packing_slip_email',
682
+ )
683
+ );
684
+
685
+ add_settings_field(
686
+ 'packing_slip_phone',
687
+ __( 'Display phone number', 'wpo_wcpdf' ),
688
+ array( &$this, 'checkbox_element_callback' ),
689
+ $option,
690
+ 'packing_slip',
691
+ array(
692
+ 'menu' => $option,
693
+ 'id' => 'packing_slip_phone',
694
+ )
695
+ );
696
+
697
+ // Section.
698
+ add_settings_section(
699
+ 'extra_template_fields',
700
+ __( 'Extra template fields', 'wpo_wcpdf' ),
701
+ array( &$this, 'custom_fields_section' ),
702
+ $option
703
+ );
704
+
705
+ add_settings_field(
706
+ 'extra_1',
707
+ __( 'Extra field 1', 'wpo_wcpdf' ),
708
+ array( &$this, 'textarea_element_callback' ),
709
+ $option,
710
+ 'extra_template_fields',
711
+ array(
712
+ 'menu' => $option,
713
+ 'id' => 'extra_1',
714
+ 'width' => '72',
715
+ 'height' => '8',
716
+ 'description' => __( 'This is footer column 1 in the <i>Modern (Premium)</i> template', 'wpo_wcpdf' ),
717
+ 'translatable' => true,
718
+ )
719
+ );
720
+
721
+ add_settings_field(
722
+ 'extra_2',
723
+ __( 'Extra field 2', 'wpo_wcpdf' ),
724
+ array( &$this, 'textarea_element_callback' ),
725
+ $option,
726
+ 'extra_template_fields',
727
+ array(
728
+ 'menu' => $option,
729
+ 'id' => 'extra_2',
730
+ 'width' => '72',
731
+ 'height' => '8',
732
+ 'description' => __( 'This is footer column 2 in the <i>Modern (Premium)</i> template', 'wpo_wcpdf' ),
733
+ 'translatable' => true,
734
+ )
735
+ );
736
+
737
+ add_settings_field(
738
+ 'extra_3',
739
+ __( 'Extra field 3', 'wpo_wcpdf' ),
740
+ array( &$this, 'textarea_element_callback' ),
741
+ $option,
742
+ 'extra_template_fields',
743
+ array(
744
+ 'menu' => $option,
745
+ 'id' => 'extra_3',
746
+ 'width' => '72',
747
+ 'height' => '8',
748
+ 'description' => __( 'This is footer column 3 in the <i>Modern (Premium)</i> template', 'wpo_wcpdf' ),
749
+ 'translatable' => true,
750
+ )
751
+ );
752
+
753
+ // Register settings.
754
+ register_setting( $option, $option, array( &$this, 'validate_options' ) );
755
+
756
+ /**************************************/
757
+ /******** DEBUG/STATUS SETTINGS *******/
758
+ /**************************************/
759
+
760
+ $option = 'wpo_wcpdf_debug_settings';
761
+
762
+ // Create option in wp_options.
763
+ if ( false === get_option( $option ) ) {
764
+ $this->default_settings( $option );
765
+ }
766
+
767
+ // Section.
768
+ add_settings_section(
769
+ 'debug_settings',
770
+ __( 'Debug settings', 'wpo_wcpdf' ),
771
+ array( &$this, 'debug_section' ),
772
+ $option
773
+ );
774
+
775
+ add_settings_field(
776
+ 'enable_debug',
777
+ __( 'Enable debug output', 'wpo_wcpdf' ),
778
+ array( &$this, 'checkbox_element_callback' ),
779
+ $option,
780
+ 'debug_settings',
781
+ array(
782
+ 'menu' => $option,
783
+ 'id' => 'enable_debug',
784
+ 'description' => __( "Enable this option to output plugin errors if you're getting a blank page or other PDF generation issues", 'wpo_wcpdf' ),
785
+ )
786
+ );
787
+
788
+ add_settings_field(
789
+ 'html_output',
790
+ __( 'Output to HTML', 'wpo_wcpdf' ),
791
+ array( &$this, 'checkbox_element_callback' ),
792
+ $option,
793
+ 'debug_settings',
794
+ array(
795
+ 'menu' => $option,
796
+ 'id' => 'html_output',
797
+ 'description' => __( 'Send the template output as HTML to the browser instead of creating a PDF.', 'wpo_wcpdf' ),
798
+ )
799
+ );
800
+
801
+ add_settings_field(
802
+ 'old_tmp',
803
+ __( 'Use old tmp folder', 'wpo_wcpdf' ),
804
+ array( &$this, 'checkbox_element_callback' ),
805
+ $option,
806
+ 'debug_settings',
807
+ array(
808
+ 'menu' => $option,
809
+ 'id' => 'old_tmp',
810
+ 'description' => __( 'Before version 1.5 of PDF Invoices, temporary files were stored in the plugin folder. This setting is only intended for backwards compatibility, not recommended on new installs!', 'wpo_wcpdf' ),
811
+ )
812
+ );
813
+
814
+ // Register settings.
815
+ register_setting( $option, $option, array( &$this, 'validate_options' ) );
816
+
817
+ }
818
+
819
+ /**
820
+ * get all emails registered in WooCommerce
821
+ * @param boolean $remove_defaults switch to remove default woocommerce emails
822
+ * @return array $emails list of all email ids/slugs and names
823
+ */
824
+ public function get_wc_emails ( $remove_defaults = true ) {
825
+ // get emails from WooCommerce
826
+ global $woocommerce;
827
+ $mailer = $woocommerce->mailer();
828
+ $wc_emails = $mailer->get_emails();
829
+
830
+ $default_emails = array(
831
+ 'new_order',
832
+ 'customer_processing_order',
833
+ 'customer_completed_order',
834
+ 'customer_invoice',
835
+ 'customer_note',
836
+ 'customer_reset_password',
837
+ 'customer_new_account'
838
+ );
839
+
840
+ $emails = array();
841
+ foreach ($wc_emails as $name => $template) {
842
+ if ( !( $remove_defaults && in_array( $template->id, $default_emails ) ) ) {
843
+ $emails[$template->id] = $template->title;
844
+ }
845
+ }
846
+
847
+ return $emails;
848
+ }
849
+
850
+ /**
851
+ * WooCommerce Order Status & Actions Manager emails compatibility
852
+ */
853
+ public function wc_order_status_actions_emails ( $emails ) {
854
+ // check if WC_Custom_Status class is loaded!
855
+ if (class_exists('WC_Custom_Status')) {
856
+ // get list of custom statuses from WooCommerce Custom Order Status & Actions
857
+ // status slug => status name
858
+ $custom_statuses = WC_Custom_Status::get_status_list_names();
859
+ // append _email to slug (=email_id) and add to emails list
860
+ foreach ($custom_statuses as $status_slug => $status_name) {
861
+ $emails[$status_slug.'_email'] = $status_name;
862
+ }
863
+ }
864
+ return $emails;
865
+ }
866
+
867
+ /**
868
+ * Set default settings.
869
+ */
870
+ public function default_settings( $option ) {
871
+ global $wpo_wcpdf;
872
+
873
+ switch ( $option ) {
874
+ case 'wpo_wcpdf_general_settings':
875
+ $default = array(
876
+ 'download_display' => 'download',
877
+ );
878
+ break;
879
+ case 'wpo_wcpdf_template_settings':
880
+ $default = array(
881
+ 'paper_size' => 'a4',
882
+ 'template_path' => $wpo_wcpdf->export->template_default_base_path . 'Simple',
883
+ // 'invoice_shipping_address' => '1',
884
+ );
885
+ break;
886
+ default:
887
+ $default = array();
888
+ break;
889
+ }
890
+
891
+ if ( false === get_option( $option ) ) {
892
+ add_option( $option, $default );
893
+ } else {
894
+ update_option( $option, $default );
895
+
896
+ }
897
+ }
898
+
899
+ // Text element callback.
900
+ public function text_element_callback( $args ) {
901
+ $menu = $args['menu'];
902
+ $id = $args['id'];
903
+ $size = isset( $args['size'] ) ? $args['size'] : '25';
904
+ $class = isset( $args['translatable'] ) && $args['translatable'] === true ? 'translatable' : '';
905
+
906
+ $options = get_option( $menu );
907
+
908
+ if ( isset( $options[$id] ) ) {
909
+ $current = $options[$id];
910
+ } else {
911
+ $current = isset( $args['default'] ) ? $args['default'] : '';
912
+ }
913
+
914
+ $html = sprintf( '<input type="text" id="%1$s" name="%2$s[%1$s]" value="%3$s" size="%4$s" class="%5$s"/>', $id, $menu, $current, $size, $class );
915
+
916
+ // Displays option description.
917
+ if ( isset( $args['description'] ) ) {
918
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
919
+ }
920
+
921
+ echo $html;
922
+ }
923
+
924
+ // Single text option (not part of any settings array)
925
+ public function singular_text_element_callback( $args ) {
926
+ $menu = $args['menu'];
927
+ $id = $args['id'];
928
+ $size = isset( $args['size'] ) ? $args['size'] : '25';
929
+ $class = isset( $args['translatable'] ) && $args['translatable'] === true ? 'translatable' : '';
930
+
931
+ $option = get_option( $menu );
932
+
933
+ if ( isset( $option ) ) {
934
+ $current = $option;
935
+ } else {
936
+ $current = isset( $args['default'] ) ? $args['default'] : '';
937
+ }
938
+
939
+ $html = sprintf( '<input type="text" id="%1$s" name="%2$s" value="%3$s" size="%4$s" class="%5$s"/>', $id, $menu, $current, $size, $class );
940
+
941
+ // Displays option description.
942
+ if ( isset( $args['description'] ) ) {
943
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
944
+ }
945
+
946
+ echo $html;
947
+ }
948
+
949
+ // Text element callback.
950
+ public function textarea_element_callback( $args ) {
951
+ $menu = $args['menu'];
952
+ $id = $args['id'];
953
+ $width = $args['width'];
954
+ $height = $args['height'];
955
+ $class = isset( $args['translatable'] ) && $args['translatable'] === true ? 'translatable' : '';
956
+
957
+ $options = get_option( $menu );
958
+
959
+ if ( isset( $options[$id] ) ) {
960
+ $current = $options[$id];
961
+ } else {
962
+ $current = isset( $args['default'] ) ? $args['default'] : '';
963
+ }
964
+
965
+ $html = sprintf( '<textarea id="%1$s" name="%2$s[%1$s]" cols="%4$s" rows="%5$s" class="%6$s"/>%3$s</textarea>', $id, $menu, $current, $width, $height, $class );
966
+
967
+ // Displays option description.
968
+ if ( isset( $args['description'] ) ) {
969
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
970
+ }
971
+
972
+ echo $html;
973
+ }
974
+
975
+
976
+ /**
977
+ * Checkbox field callback.
978
+ *
979
+ * @param array $args Field arguments.
980
+ *
981
+ * @return string Checkbox field.
982
+ */
983
+ public function checkbox_element_callback( $args ) {
984
+ $menu = $args['menu'];
985
+ $id = $args['id'];
986
+ $value = isset( $args['value'] ) ? $args['value'] : 1;
987
+
988
+ $options = get_option( $menu );
989
+
990
+ if ( isset( $options[$id] ) ) {
991
+ $current = $options[$id];
992
+ } else {
993
+ $current = isset( $args['default'] ) ? $args['default'] : '';
994
+ }
995
+
996
+ $html = sprintf( '<input type="checkbox" id="%1$s" name="%2$s[%1$s]" value="%3$s"%4$s />', $id, $menu, $value, checked( $value, $current, false ) );
997
+
998
+ // Displays option description.
999
+ if ( isset( $args['description'] ) ) {
1000
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1001
+ }
1002
+
1003
+ echo $html;
1004
+ }
1005
+
1006
+ /**
1007
+ * Multiple Checkbox field callback.
1008
+ *
1009
+ * @param array $args Field arguments.
1010
+ *
1011
+ * @return string Checkbox field.
1012
+ */
1013
+ public function multiple_checkbox_element_callback( $args ) {
1014
+ $menu = $args['menu'];
1015
+ $id = $args['id'];
1016
+
1017
+ $options = get_option( $menu );
1018
+
1019
+
1020
+ foreach ( $args['options'] as $key => $label ) {
1021
+ $current = ( isset( $options[$id][$key] ) ) ? $options[$id][$key] : '';
1022
+ printf( '<input type="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="1"%4$s /> %5$s<br/>', $menu, $id, $key, checked( 1, $current, false ), $label );
1023
+ }
1024
+
1025
+ // Displays option description.
1026
+ if ( isset( $args['description'] ) ) {
1027
+ printf( '<p class="description">%s</p>', $args['description'] );
1028
+ }
1029
+ }
1030
+
1031
+ /**
1032
+ * Checkbox fields table callback.
1033
+ *
1034
+ * @param array $args Field arguments.
1035
+ *
1036
+ * @return string Checkbox field.
1037
+ */
1038
+ public function checkbox_table_callback( $args ) {
1039
+ $menu = $args['menu'];
1040
+ $id = $args['id'];
1041
+
1042
+ $options = get_option( $menu );
1043
+
1044
+ $rows = $args['rows'];
1045
+ $columns = $args['columns'];
1046
+
1047
+ ?>
1048
+ <table style="">
1049
+ <tr>
1050
+ <td style="padding:0 10px 5px 0;">&nbsp;</td>
1051
+ <?php foreach ( $columns as $column => $title ) { ?>
1052
+ <td style="padding:0 10px 5px 0;"><?php echo $title; ?></td>
1053
+ <?php } ?>
1054
+ </tr>
1055
+ <tr>
1056
+ <td style="padding: 0;">
1057
+ <?php foreach ($rows as $row) {
1058
+ echo $row.'<br/>';
1059
+ } ?>
1060
+ </td>
1061
+ <?php foreach ( $columns as $column => $title ) { ?>
1062
+ <td style="text-align:center; padding: 0;">
1063
+ <?php foreach ( $rows as $row => $title ) {
1064
+ $current = ( isset( $options[$id.'_'.$column][$row] ) ) ? $options[$id.'_'.$column][$row] : '';
1065
+ $name = sprintf('%1$s[%2$s_%3$s][%4$s]', $menu, $id, $column, $row);
1066
+ printf( '<input type="checkbox" id="%1$s" name="%1$s" value="1"%2$s /><br/>', $name, checked( 1, $current, false ) );
1067
+ } ?>
1068
+ </td>
1069
+ <?php } ?>
1070
+ </tr>
1071
+ </table>
1072
+
1073
+ <?php
1074
+ // Displays option description.
1075
+ if ( isset( $args['description'] ) ) {
1076
+ printf( '<p class="description">%s</p>', $args['description'] );
1077
+ }
1078
+ }
1079
+
1080
+ /**
1081
+ * Select element callback.
1082
+ *
1083
+ * @param array $args Field arguments.
1084
+ *
1085
+ * @return string Select field.
1086
+ */
1087
+ public function select_element_callback( $args ) {
1088
+ $menu = $args['menu'];
1089
+ $id = $args['id'];
1090
+
1091
+ $options = get_option( $menu );
1092
+
1093
+ if ( isset( $options[$id] ) ) {
1094
+ $current = $options[$id];
1095
+ } else {
1096
+ $current = isset( $args['default'] ) ? $args['default'] : '';
1097
+ }
1098
+
1099
+ printf( '<select id="%1$s" name="%2$s[%1$s]">', $id, $menu );
1100
+
1101
+ foreach ( $args['options'] as $key => $label ) {
1102
+ printf( '<option value="%s"%s>%s</option>', $key, selected( $current, $key, false ), $label );
1103
+ }
1104
+
1105
+ echo '</select>';
1106
+
1107
+
1108
+ if (isset($args['custom'])) {
1109
+ $custom = $args['custom'];
1110
+
1111
+ $custom_id = $id.'_custom';
1112
+
1113
+ printf( '<br/><br/><div id="%s" style="display:none;">', $custom_id );
1114
+
1115
+ switch ($custom['type']) {
1116
+ case 'text_element_callback':
1117
+ $this->text_element_callback( $custom['args'] );
1118
+ break;
1119
+ case 'multiple_text_element_callback':
1120
+ $this->multiple_text_element_callback( $custom['args'] );
1121
+ break;
1122
+ case 'multiple_checkbox_element_callback':
1123
+ $this->multiple_checkbox_element_callback( $custom['args'] );
1124
+ break;
1125
+ default:
1126
+ break;
1127
+ }
1128
+
1129
+ echo '</div>';
1130
+
1131
+ ?>
1132
+ <script type="text/javascript">
1133
+ jQuery(document).ready(function($) {
1134
+ function check_<?php echo $id; ?>_custom() {
1135
+ var custom = $('#<?php echo $id; ?>').val();
1136
+ if (custom == 'custom') {
1137
+ $( '#<?php echo $custom_id; ?>').show();
1138
+ } else {
1139
+ $( '#<?php echo $custom_id; ?>').hide();
1140
+ }
1141
+ }
1142
+
1143
+ check_<?php echo $id; ?>_custom();
1144
+
1145
+ $( '#<?php echo $id; ?>' ).change(function() {
1146
+ check_<?php echo $id; ?>_custom();
1147
+ });
1148
+
1149
+ });
1150
+ </script>
1151
+ <?php
1152
+ }
1153
+
1154
+ // Displays option description.
1155
+ if ( isset( $args['description'] ) ) {
1156
+ printf( '<p class="description">%s</p>', $args['description'] );
1157
+ }
1158
+
1159
+ }
1160
+
1161
+ /**
1162
+ * Displays a radio settings field
1163
+ *
1164
+ * @param array $args settings field args
1165
+ */
1166
+ public function radio_element_callback( $args ) {
1167
+ $menu = $args['menu'];
1168
+ $id = $args['id'];
1169
+
1170
+ $options = get_option( $menu );
1171
+
1172
+ if ( isset( $options[$id] ) ) {
1173
+ $current = $options[$id];
1174
+ } else {
1175
+ $current = isset( $args['default'] ) ? $args['default'] : '';
1176
+ }
1177
+
1178
+ $html = '';
1179
+ foreach ( $args['options'] as $key => $label ) {
1180
+ $html .= sprintf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s"%4$s />', $menu, $id, $key, checked( $current, $key, false ) );
1181
+ $html .= sprintf( '<label for="%1$s[%2$s][%3$s]"> %4$s</label><br>', $menu, $id, $key, $label);
1182
+ }
1183
+
1184
+ // Displays option description.
1185
+ if ( isset( $args['description'] ) ) {
1186
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1187
+ }
1188
+
1189
+ echo $html;
1190
+ }
1191
+
1192
+ /**
1193
+ * Media upload callback.
1194
+ *
1195
+ * @param array $args Field arguments.
1196
+ *
1197
+ * @return string Media upload button & preview.
1198
+ */
1199
+ public function media_upload_callback( $args ) {
1200
+ $menu = $args['menu'];
1201
+ $id = $args['id'];
1202
+ $options = get_option( $menu );
1203
+
1204
+ if ( isset( $options[$id] ) ) {
1205
+ $current = $options[$id];
1206
+ } else {
1207
+ $current = isset( $args['default'] ) ? $args['default'] : '';
1208
+ }
1209
+
1210
+ $uploader_title = $args['uploader_title'];
1211
+ $uploader_button_text = $args['uploader_button_text'];
1212
+ $remove_button_text = $args['remove_button_text'];
1213
+
1214
+ $html = '';
1215
+ if( !empty($current) ) {
1216
+ $attachment = wp_get_attachment_image_src( $current, 'full', false );
1217
+
1218
+ $attachment_src = $attachment[0];
1219
+ $attachment_width = $attachment[1];
1220
+ $attachment_height = $attachment[2];
1221
+
1222
+ $attachment_resolution = round($attachment_height/(3/2.54));
1223
+
1224
+ $html .= sprintf('<img src="%1$s" style="display:block" id="img-%4$s"/>', $attachment_src, $attachment_width, $attachment_height, $id );
1225
+ $html .= '<div class="attachment-resolution"><p class="description">'.__('Image resolution').': '.$attachment_resolution.'dpi (default height = 3cm)</p></div>';
1226
+ $html .= sprintf('<span class="button wpo_remove_image_button" data-input_id="%1$s">%2$s</span>', $id, $remove_button_text );
1227
+ }
1228
+
1229
+ $html .= sprintf( '<input id="%1$s" name="%2$s[%1$s]" type="hidden" value="%3$s" />', $id, $menu, $current );
1230
+
1231
+ $html .= sprintf( '<span class="button wpo_upload_image_button %4$s" data-uploader_title="%1$s" data-uploader_button_text="%2$s" data-remove_button_text="%3$s" data-input_id="%4$s">%2$s</span>', $uploader_title, $uploader_button_text, $remove_button_text, $id );
1232
+
1233
+ // Displays option description.
1234
+ if ( isset( $args['description'] ) ) {
1235
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1236
+ }
1237
+
1238
+ echo $html;
1239
+ }
1240
+
1241
+ /**
1242
+ * Invoice number formatting callback.
1243
+ *
1244
+ * @param array $args Field arguments.
1245
+ *
1246
+ * @return string Media upload button & preview.
1247
+ */
1248
+ public function invoice_number_formatting_callback( $args ) {
1249
+ $menu = $args['menu'];
1250
+ $fields = $args['fields'];
1251
+ $options = get_option( $menu );
1252
+
1253
+ echo '<table>';
1254
+ foreach ($fields as $key => $field) {
1255
+ $id = $args['id'] . '_' . $key;
1256
+
1257
+ if ( isset( $options[$id] ) ) {
1258
+ $current = $options[$id];
1259
+ } else {
1260
+ $current = '';
1261
+ }
1262
+
1263
+ $title = $field['title'];
1264
+ $size = $field['size'];
1265
+ $description = isset( $field['description'] ) ? '<span style="font-style:italic;">'.$field['description'].'</span>' : '';
1266
+
1267
+ echo '<tr>';
1268
+ printf( '<td style="padding:0 1em 0 0; ">%1$s:</td><td style="padding:0;"><input type="text" id="%2$s" name="%3$s[%2$s]" value="%4$s" size="%5$s"/></td><td style="padding:0 0 0 1em;">%6$s</td>', $title, $id, $menu, $current, $size, $description );
1269
+ echo '</tr>';
1270
+ }
1271
+ echo '</table>';
1272
+
1273
+
1274
+ // Displays option description.
1275
+ if ( isset( $args['description'] ) ) {
1276
+ printf( '<p class="description">%s</p>', $args['description'] );
1277
+ }
1278
+
1279
+ // echo $html;
1280
+ }
1281
+
1282
+
1283
+ /**
1284
+ * Template select element callback.
1285
+ *
1286
+ * @param array $args Field arguments.
1287
+ *
1288
+ * @return string Select field.
1289
+ */
1290
+ public function template_select_element_callback( $args ) {
1291
+ $menu = $args['menu'];
1292
+ $id = $args['id'];
1293
+
1294
+ $options = get_option( $menu );
1295
+
1296
+ if ( isset( $options[$id] ) ) {
1297
+ $current = $options[$id];
1298
+ } else {
1299
+ $current = isset( $args['default'] ) ? $args['default'] : '';
1300
+ }
1301
+
1302
+ $html = sprintf( '<select id="%1$s" name="%2$s[%1$s]">', $id, $menu );
1303
+
1304
+ // backwards compatible template path (1.4.4+ uses relative paths instead of absolute)
1305
+ if (strpos($current, ABSPATH) !== false) {
1306
+ // check if folder exists, then strip site base path.
1307
+ if ( file_exists( $current ) ) {
1308
+ $current = str_replace( ABSPATH, '', $current );
1309
+ }
1310
+ }
1311
+
1312
+ foreach ( $args['options'] as $key => $label ) {
1313
+ $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $current, $key, false ), $label );
1314
+ }
1315
+
1316
+ $html .= '</select>';
1317
+
1318
+ // Displays option description.
1319
+ if ( isset( $args['description'] ) ) {
1320
+ $html .= sprintf( '<p class="description">%s</p>', $args['description'] );
1321
+ }
1322
+
1323
+ echo $html;
1324
+
1325
+ }
1326
+
1327
+ /**
1328
+ * Section null callback.
1329
+ *
1330
+ * @return void.
1331
+ */
1332
+ public function section_options_callback() {
1333
+ }
1334
+
1335
+ /**
1336
+ * Debug section callback.
1337
+ *
1338
+ * @return void.
1339
+ */
1340
+ public function debug_section() {
1341
+ _e( '<b>Warning!</b> The settings below are meant for debugging/development only. Do not use them on a live website!' , 'wpo_wcpdf' );
1342
+ }
1343
+
1344
+ /**
1345
+ * Custom fields section callback.
1346
+ *
1347
+ * @return void.
1348
+ */
1349
+ public function custom_fields_section() {
1350
+ _e( 'These are used for the (optional) footer columns in the <em>Modern (Premium)</em> template, but can also be used for other elements in your custom template' , 'wpo_wcpdf' );
1351
+ }
1352
+
1353
+ /**
1354
+ * Validate options.
1355
+ *
1356
+ * @param array $input options to valid.
1357
+ *
1358
+ * @return array validated options.
1359
+ */
1360
+ public function validate_options( $input ) {
1361
+ // Create our array for storing the validated options.
1362
+ $output = array();
1363
+
1364
+ if (empty($input) || !is_array($input)) {
1365
+ return $input;
1366
+ }
1367
+
1368
+ // Loop through each of the incoming options.
1369
+ foreach ( $input as $key => $value ) {
1370
+
1371
+ // Check to see if the current option has a value. If so, process it.
1372
+ if ( isset( $input[$key] ) ) {
1373
+ if ( is_array( $input[$key] ) ) {
1374
+ foreach ( $input[$key] as $sub_key => $sub_value ) {
1375
+ $output[$key][$sub_key] = $input[$key][$sub_key];
1376
+ }
1377
+ } else {
1378
+ $output[$key] = $input[$key];
1379
+ }
1380
+ }
1381
+ }
1382
+
1383
+ // Return the array processing any additional functions filtered by this action.
1384
+ return apply_filters( 'wpo_wcpdf_validate_input', $output, $input );
1385
+ }
1386
+
1387
+ /**
1388
+ * List templates in plugin folder, theme folder & child theme folder
1389
+ * @return array template path => template name
1390
+ */
1391
+ public function find_templates() {
1392
+ global $wpo_wcpdf;
1393
+ $installed_templates = array();
1394
+
1395
+ // get base paths
1396
+ $template_paths = array (
1397
+ // note the order: child-theme before theme, so that array_unique filters out parent doubles
1398
+ 'default' => $wpo_wcpdf->export->template_default_base_path,
1399
+ 'child-theme' => get_stylesheet_directory() . '/' . $wpo_wcpdf->export->template_base_path,
1400
+ 'theme' => get_template_directory() . '/' . $wpo_wcpdf->export->template_base_path,
1401
+ );
1402
+
1403
+ $template_paths = apply_filters( 'wpo_wcpdf_template_paths', $template_paths );
1404
+
1405
+ foreach ($template_paths as $template_source => $template_path) {
1406
+ $dirs = (array) glob( $template_path . '*' , GLOB_ONLYDIR);
1407
+
1408
+ foreach ($dirs as $dir) {
1409
+ if ( file_exists($dir."/invoice.php") && file_exists($dir."/packing-slip.php"))
1410
+ // we're stripping abspath to make the plugin settings more portable
1411
+ $installed_templates[ str_replace( ABSPATH, '', $dir )] = basename($dir);
1412
+ }
1413
+ }
1414
+
1415
+ // remove parent doubles
1416
+ $installed_templates = array_unique($installed_templates);
1417
+
1418
+ if (empty($installed_templates)) {
1419
+ // fallback to Simple template for servers with glob() disabled
1420
+ $simple_template_path = str_replace( ABSPATH, '', $template_paths['default'] . 'Simple' );
1421
+ $installed_templates[$simple_template_path] = 'Simple';
1422
+ }
1423
+
1424
+ return apply_filters( 'wpo_wcpdf_templates', $installed_templates );
1425
+ }
1426
+
1427
+ } // end class WooCommerce_PDF_Invoices_Settings
1428
+
1429
  } // end class_exists
includes/class-wcpdf-writepanels.php CHANGED
@@ -1,370 +1,370 @@
1
- <?php
2
-
3
- /**
4
- * Writepanel class
5
- */
6
- if ( !class_exists( 'WooCommerce_PDF_Invoices_Writepanels' ) ) {
7
-
8
- class WooCommerce_PDF_Invoices_Writepanels {
9
- public $bulk_actions;
10
-
11
- /**
12
- * Constructor
13
- */
14
- public function __construct() {
15
- $this->general_settings = get_option('wpo_wcpdf_general_settings');
16
- $this->template_settings = get_option('wpo_wcpdf_template_settings');
17
-
18
- add_action( 'woocommerce_admin_order_actions_end', array( $this, 'add_listing_actions' ) );
19
- add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_invoice_number_column' ), 999 );
20
- add_action( 'manage_shop_order_posts_custom_column', array( $this, 'invoice_number_column_data' ), 2 );
21
- add_action( 'add_meta_boxes_shop_order', array( $this, 'add_meta_boxes' ) );
22
- add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'my_account_pdf_link' ), 10, 2 );
23
- add_action( 'admin_print_scripts', array( $this, 'add_scripts' ) );
24
- add_action( 'admin_print_styles', array( $this, 'add_styles' ) );
25
- add_action( 'admin_footer', array( $this, 'bulk_actions' ) );
26
-
27
- add_action( 'save_post', array( $this,'save_invoice_number_date' ) );
28
-
29
- add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'search_fields' ) );
30
-
31
- $this->bulk_actions = array(
32
- 'invoice' => __( 'PDF Invoices', 'wpo_wcpdf' ),
33
- 'packing-slip' => __( 'PDF Packing Slips', 'wpo_wcpdf' ),
34
- );
35
- }
36
-
37
- /**
38
- * Add the styles
39
- */
40
- public function add_styles() {
41
- if( $this->is_order_edit_page() ) {
42
- wp_enqueue_style( 'thickbox' );
43
-
44
- wp_enqueue_style(
45
- 'wpo-wcpdf',
46
- WooCommerce_PDF_Invoices::$plugin_url . 'css/style.css',
47
- array(),
48
- WooCommerce_PDF_Invoices::$version
49
- );
50
-
51
- if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
52
- // WC 2.1 or newer (MP6) is used: bigger buttons
53
- wp_enqueue_style(
54
- 'wpo-wcpdf-buttons',
55
- WooCommerce_PDF_Invoices::$plugin_url . 'css/style-buttons.css',
56
- array(),
57
- WooCommerce_PDF_Invoices::$version
58
- );
59
- } else {
60
- // legacy WC 2.0 styles
61
- wp_enqueue_style(
62
- 'wpo-wcpdf-buttons',
63
- WooCommerce_PDF_Invoices::$plugin_url . 'css/style-buttons-wc20.css',
64
- array(),
65
- WooCommerce_PDF_Invoices::$version
66
- );
67
- }
68
- }
69
- }
70
-
71
- /**
72
- * Add the scripts
73
- */
74
- public function add_scripts() {
75
- if( $this->is_order_edit_page() ) {
76
- wp_enqueue_script(
77
- 'wpo-wcpdf',
78
- WooCommerce_PDF_Invoices::$plugin_url . 'js/script.js',
79
- array( 'jquery' ),
80
- WooCommerce_PDF_Invoices::$version
81
- );
82
- wp_localize_script(
83
- 'wpo-wcpdf',
84
- 'wpo_wcpdf_ajax',
85
- array(
86
- // 'ajaxurl' => add_query_arg( 'action', 'generate_wpo_wcpdf', admin_url( 'admin-ajax.php' ) ), // URL to WordPress ajax handling page
87
- 'ajaxurl' => admin_url( 'admin-ajax.php' ), // URL to WordPress ajax handling page
88
- 'nonce' => wp_create_nonce('generate_wpo_wcpdf'),
89
- 'bulk_actions' => array_keys( apply_filters( 'wpo_wcpdf_bulk_actions', $this->bulk_actions ) ),
90
- )
91
- );
92
- }
93
- }
94
-
95
- /**
96
- * Is order page
97
- */
98
- public function is_order_edit_page() {
99
- global $post_type;
100
- if( $post_type == 'shop_order' ) {
101
- return true;
102
- } else {
103
- return false;
104
- }
105
- }
106
-
107
- /**
108
- * Add PDF actions to the orders listing
109
- */
110
- public function add_listing_actions( $order ) {
111
- // do not show buttons for trashed orders
112
- if ( $order->status == 'trash' ) {
113
- return;
114
- }
115
-
116
- $listing_actions = array(
117
- 'invoice' => array (
118
- 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id ), 'generate_wpo_wcpdf' ),
119
- 'img' => WooCommerce_PDF_Invoices::$plugin_url . 'images/invoice.png',
120
- 'alt' => __( 'PDF Invoice', 'wpo_wcpdf' ),
121
- ),
122
- 'packing-slip' => array (
123
- 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=packing-slip&order_ids=' . $order->id ), 'generate_wpo_wcpdf' ),
124
- 'img' => WooCommerce_PDF_Invoices::$plugin_url . 'images/packing-slip.png',
125
- 'alt' => __( 'PDF Packing Slip', 'wpo_wcpdf' ),
126
- ),
127
- );
128
-
129
- $listing_actions = apply_filters( 'wpo_wcpdf_listing_actions', $listing_actions, $order );
130
-
131
- foreach ($listing_actions as $action => $data) {
132
- ?>
133
- <a href="<?php echo $data['url']; ?>" class="button tips wpo_wcpdf <?php echo $action; ?>" target="_blank" alt="<?php echo $data['alt']; ?>" data-tip="<?php echo $data['alt']; ?>">
134
- <img src="<?php echo $data['img']; ?>" alt="<?php echo $data['alt']; ?>" width="16">
135
- </a>
136
- <?php
137
- }
138
- }
139
-
140
- /**
141
- * Create additional Shop Order column for Invoice Numbers
142
- * @param array $columns shop order columns
143
- */
144
- public function add_invoice_number_column( $columns ) {
145
- // Check user setting
146
- if ( !isset($this->general_settings['invoice_number_column'] ) ) {
147
- return $columns;
148
- }
149
-
150
- // put the column after the Status column
151
- $new_columns = array_slice($columns, 0, 2, true) +
152
- array( 'pdf_invoice_number' => __( 'Invoice Number', 'wpo_wcpdf' ) ) +
153
- array_slice($columns, 2, count($columns) - 1, true) ;
154
- return $new_columns;
155
- }
156
-
157
- /**
158
- * Display Invoice Number in Shop Order column (if available)
159
- * @param string $column column slug
160
- */
161
- public function invoice_number_column_data( $column ) {
162
- global $post, $the_order, $wpo_wcpdf;
163
-
164
- if ( $column == 'pdf_invoice_number' ) {
165
- if ( empty( $the_order ) || $the_order->id != $post->ID ) {
166
- $order = new WC_Order( $post->ID );
167
- echo $wpo_wcpdf->export->get_invoice_number( $order->id );
168
- do_action( 'wcpdf_invoice_number_column_end', $order );
169
- } else {
170
- echo $wpo_wcpdf->export->get_invoice_number( $the_order->id );
171
- do_action( 'wcpdf_invoice_number_column_end', $the_order );
172
- }
173
- }
174
- }
175
-
176
- /**
177
- * Display download link on My Account page
178
- */
179
- public function my_account_pdf_link( $actions, $order ) {
180
- $pdf_url = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id . '&my-account'), 'generate_wpo_wcpdf' );
181
-
182
- // check my account button settings
183
- if (isset($this->general_settings['my_account_buttons'])) {
184
- switch ($this->general_settings['my_account_buttons']) {
185
- case 'available':
186
- $invoice_allowed = get_post_meta($order->id,'_wcpdf_invoice_exists',true);
187
- break;
188
- case 'always':
189
- $invoice_allowed = true;
190
- break;
191
- case 'never':
192
- $invoice_allowed = false;
193
- break;
194
- case 'custom':
195
- if ( isset( $this->general_settings['my_account_restrict'] ) && in_array( $order->status, array_keys( $this->general_settings['my_account_restrict'] ) ) ) {
196
- $invoice_allowed = true;
197
- } else {
198
- $invoice_allowed = false;
199
- }
200
- break;
201
- }
202
- } else {
203
- // backwards compatibility
204
- $invoice_allowed = get_post_meta($order->id,'_wcpdf_invoice_exists',true);
205
- }
206
-
207
- // Check if invoice has been created already or if status allows download (filter your own array of allowed statuses)
208
- if ( $invoice_allowed || in_array($order->status, apply_filters( 'wpo_wcpdf_myaccount_allowed_order_statuses', array() ) ) ) {
209
- $actions['invoice'] = array(
210
- 'url' => $pdf_url,
211
- 'name' => apply_filters( 'wpo_wcpdf_myaccount_button_text', __( 'Download invoice (PDF)', 'wpo_wcpdf' ) )
212
- );
213
- }
214
-
215
- return apply_filters( 'wpo_wcpdf_myaccount_actions', $actions, $order );
216
- }
217
-
218
- /**
219
- * Add the meta box on the single order page
220
- */
221
- public function add_meta_boxes() {
222
- // create PDF buttons
223
- add_meta_box(
224
- 'wpo_wcpdf-box',
225
- __( 'Create PDF', 'wpo_wcpdf' ),
226
- array( $this, 'sidebar_box_content' ),
227
- 'shop_order',
228
- 'side',
229
- 'default'
230
- );
231
-
232
- // Invoice number & date
233
- add_meta_box(
234
- 'wpo_wcpdf-data-input-box',
235
- __( 'PDF Invoice data', 'wpo_wcpdf' ),
236
- array( $this, 'data_input_box_content' ),
237
- 'shop_order',
238
- 'normal',
239
- 'default'
240
- );
241
- }
242
-
243
- /**
244
- * Create the meta box content on the single order page
245
- */
246
- public function sidebar_box_content( $post ) {
247
- global $post_id;
248
-
249
- $meta_actions = array(
250
- 'invoice' => array (
251
- 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $post_id ), 'generate_wpo_wcpdf' ),
252
- 'alt' => esc_attr__( 'PDF Invoice', 'wpo_wcpdf' ),
253
- 'title' => __( 'PDF Invoice', 'wpo_wcpdf' ),
254
- ),
255
- 'packing-slip' => array (
256
- 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=packing-slip&order_ids=' . $post_id ), 'generate_wpo_wcpdf' ),
257
- 'alt' => esc_attr__( 'PDF Packing Slip', 'wpo_wcpdf' ),
258
- 'title' => __( 'PDF Packing Slip', 'wpo_wcpdf' ),
259
- ),
260
- );
261
-
262
- $meta_actions = apply_filters( 'wpo_wcpdf_meta_box_actions', $meta_actions, $post_id );
263
-
264
- ?>
265
- <ul class="wpo_wcpdf-actions">
266
- <?php
267
- foreach ($meta_actions as $action => $data) {
268
- printf('<li><a href="%1$s" class="button" target="_blank" alt="%2$s">%3$s</a></li>', $data['url'], $data['alt'],$data['title']);
269
- }
270
- ?>
271
- </ul>
272
- <?php
273
- }
274
-
275
- /**
276
- * Add metabox for invoice number & date
277
- */
278
- public function data_input_box_content ( $post ) {
279
- $invoice_exists = get_post_meta( $post->ID, '_wcpdf_invoice_exists', true );
280
- $invoice_number = get_post_meta($post->ID,'_wcpdf_invoice_number',true);
281
- $invoice_date = get_post_meta($post->ID,'_wcpdf_invoice_date',true);
282
-
283
- do_action( 'wpo_wcpdf_meta_box_start', $post->ID );
284
-
285
- ?>
286
- <h4><?php _e( 'Invoice', 'wpo_wcpdf' ) ?></h4>
287
- <p class="form-field _wcpdf_invoice_number_field ">
288
- <label for="_wcpdf_invoice_number"><?php _e( 'Invoice Number (unformatted!)', 'wpo_wcpdf' ); ?>:</label>
289
- <?php if (!empty($invoice_exists)) : ?>
290
- <input type="text" class="short" style="" name="_wcpdf_invoice_number" id="_wcpdf_invoice_number" value="<?php echo $invoice_number ?>">
291
- <?php else : ?>
292
- <input type="text" class="short" style="" name="_wcpdf_invoice_number" id="_wcpdf_invoice_number" value="<?php echo $invoice_number ?>" disabled="disabled" >
293
- <?php endif; ?>
294
- </p>
295
- <p class="form-field form-field-wide">
296
- <label for="wcpdf_invoice_date"><?php _e( 'Invoice Date:', 'wpo_wcpdf' ); ?></label>
297
- <?php if (!empty($invoice_exists)) : ?>
298
- <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $invoice_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $invoice_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $invoice_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
299
- <?php else : ?>
300
- <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" disabled="disabled" value="" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" disabled="disabled" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" maxlength="2" size="2" value="" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" maxlength="2" size="2" value="" pattern="[0-5]{1}[0-9]{1}" disabled="disabled" />
301
- <?php endif; ?>
302
- </p>
303
- <?php
304
-
305
- do_action( 'wpo_wcpdf_meta_box_end', $post->ID );
306
- }
307
-
308
- /**
309
- * Add actions to menu
310
- */
311
- public function bulk_actions() {
312
- global $post_type;
313
- $bulk_actions = apply_filters( 'wpo_wcpdf_bulk_actions', $this->bulk_actions );
314
-
315
- if ( 'shop_order' == $post_type ) {
316
- ?>
317
- <script type="text/javascript">
318
- jQuery(document).ready(function() {
319
- <?php foreach ($bulk_actions as $action => $title) { ?>
320
- jQuery('<option>').val('<?php echo $action; ?>').html('<?php echo esc_attr( $title ); ?>').appendTo("select[name='action'], select[name='action2']");
321
- <?php } ?>
322
- });
323
- </script>
324
- <?php
325
- }
326
- }
327
-
328
- /**
329
- * Save invoice number
330
- */
331
- public function save_invoice_number_date($post_id) {
332
- global $post_type;
333
- if( $post_type == 'shop_order' ) {
334
- if ( isset($_POST['_wcpdf_invoice_number']) ) {
335
- update_post_meta( $post_id, '_wcpdf_invoice_number', stripslashes( $_POST['_wcpdf_invoice_number'] ));
336
- update_post_meta( $post_id, '_wcpdf_invoice_exists', 1 );
337
- }
338
-
339
- if ( isset($_POST['wcpdf_invoice_date']) ) {
340
- if ( empty($_POST['wcpdf_invoice_date']) ) {
341
- delete_post_meta( $post_id, '_wcpdf_invoice_date' );
342
- } else {
343
- $invoice_date = strtotime( $_POST['wcpdf_invoice_date'] . ' ' . (int) $_POST['wcpdf_invoice_date_hour'] . ':' . (int) $_POST['wcpdf_invoice_date_minute'] . ':00' );
344
- $invoice_date = date_i18n( 'Y-m-d H:i:s', $invoice_date );
345
- update_post_meta( $post_id, '_wcpdf_invoice_date', $invoice_date );
346
- update_post_meta( $post_id, '_wcpdf_invoice_exists', 1 );
347
- }
348
- }
349
-
350
- if (empty($_POST['wcpdf_invoice_date']) && isset($_POST['_wcpdf_invoice_number'])) {
351
- $invoice_date = date_i18n( 'Y-m-d H:i:s', time() );
352
- update_post_meta( $post_id, '_wcpdf_invoice_date', $invoice_date );
353
- }
354
-
355
- if ( empty($_POST['wcpdf_invoice_date']) && empty($_POST['_wcpdf_invoice_number'])) {
356
- delete_post_meta( $post_id, '_wcpdf_invoice_exists' );
357
- }
358
- }
359
- }
360
-
361
- /**
362
- * Add invoice number to order search scope
363
- */
364
- public function search_fields ( $custom_fields ) {
365
- $custom_fields[] = '_wcpdf_invoice_number';
366
- $custom_fields[] = '_wcpdf_formatted_invoice_number';
367
- return $custom_fields;
368
- }
369
- }
370
  }
1
+ <?php
2
+
3
+ /**
4
+ * Writepanel class
5
+ */
6
+ if ( !class_exists( 'WooCommerce_PDF_Invoices_Writepanels' ) ) {
7
+
8
+ class WooCommerce_PDF_Invoices_Writepanels {
9
+ public $bulk_actions;
10
+
11
+ /**
12
+ * Constructor
13
+ */
14
+ public function __construct() {
15
+ $this->general_settings = get_option('wpo_wcpdf_general_settings');
16
+ $this->template_settings = get_option('wpo_wcpdf_template_settings');
17
+
18
+ add_action( 'woocommerce_admin_order_actions_end', array( $this, 'add_listing_actions' ) );
19
+ add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_invoice_number_column' ), 999 );
20
+ add_action( 'manage_shop_order_posts_custom_column', array( $this, 'invoice_number_column_data' ), 2 );
21
+ add_action( 'add_meta_boxes_shop_order', array( $this, 'add_meta_boxes' ) );
22
+ add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'my_account_pdf_link' ), 10, 2 );
23
+ add_action( 'admin_print_scripts', array( $this, 'add_scripts' ) );
24
+ add_action( 'admin_print_styles', array( $this, 'add_styles' ) );
25
+ add_action( 'admin_footer', array( $this, 'bulk_actions' ) );
26
+
27
+ add_action( 'save_post', array( $this,'save_invoice_number_date' ) );
28
+
29
+ add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'search_fields' ) );
30
+
31
+ $this->bulk_actions = array(
32
+ 'invoice' => __( 'PDF Invoices', 'wpo_wcpdf' ),
33
+ 'packing-slip' => __( 'PDF Packing Slips', 'wpo_wcpdf' ),
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Add the styles
39
+ */
40
+ public function add_styles() {
41
+ if( $this->is_order_edit_page() ) {
42
+ wp_enqueue_style( 'thickbox' );
43
+
44
+ wp_enqueue_style(
45
+ 'wpo-wcpdf',
46
+ WooCommerce_PDF_Invoices::$plugin_url . 'css/style.css',
47
+ array(),
48
+ WooCommerce_PDF_Invoices::$version
49
+ );
50
+
51
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
52
+ // WC 2.1 or newer (MP6) is used: bigger buttons
53
+ wp_enqueue_style(
54
+ 'wpo-wcpdf-buttons',
55
+ WooCommerce_PDF_Invoices::$plugin_url . 'css/style-buttons.css',
56
+ array(),
57
+ WooCommerce_PDF_Invoices::$version
58
+ );
59
+ } else {
60
+ // legacy WC 2.0 styles
61
+ wp_enqueue_style(
62
+ 'wpo-wcpdf-buttons',
63
+ WooCommerce_PDF_Invoices::$plugin_url . 'css/style-buttons-wc20.css',
64
+ array(),
65
+ WooCommerce_PDF_Invoices::$version
66
+ );
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Add the scripts
73
+ */
74
+ public function add_scripts() {
75
+ if( $this->is_order_edit_page() ) {
76
+ wp_enqueue_script(
77
+ 'wpo-wcpdf',
78
+ WooCommerce_PDF_Invoices::$plugin_url . 'js/script.js',
79
+ array( 'jquery' ),
80
+ WooCommerce_PDF_Invoices::$version
81
+ );
82
+ wp_localize_script(
83
+ 'wpo-wcpdf',
84
+ 'wpo_wcpdf_ajax',
85
+ array(
86
+ // 'ajaxurl' => add_query_arg( 'action', 'generate_wpo_wcpdf', admin_url( 'admin-ajax.php' ) ), // URL to WordPress ajax handling page
87
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ), // URL to WordPress ajax handling page
88
+ 'nonce' => wp_create_nonce('generate_wpo_wcpdf'),
89
+ 'bulk_actions' => array_keys( apply_filters( 'wpo_wcpdf_bulk_actions', $this->bulk_actions ) ),
90
+ )
91
+ );
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Is order page
97
+ */
98
+ public function is_order_edit_page() {
99
+ global $post_type;
100
+ if( $post_type == 'shop_order' ) {
101
+ return true;
102
+ } else {
103
+ return false;
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Add PDF actions to the orders listing
109
+ */
110
+ public function add_listing_actions( $order ) {
111
+ // do not show buttons for trashed orders
112
+ if ( $order->status == 'trash' ) {
113
+ return;
114
+ }
115
+
116
+ $listing_actions = array(
117
+ 'invoice' => array (
118
+ 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id ), 'generate_wpo_wcpdf' ),
119
+ 'img' => WooCommerce_PDF_Invoices::$plugin_url . 'images/invoice.png',
120
+ 'alt' => __( 'PDF Invoice', 'wpo_wcpdf' ),
121
+ ),
122
+ 'packing-slip' => array (
123
+ 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=packing-slip&order_ids=' . $order->id ), 'generate_wpo_wcpdf' ),
124
+ 'img' => WooCommerce_PDF_Invoices::$plugin_url . 'images/packing-slip.png',
125
+ 'alt' => __( 'PDF Packing Slip', 'wpo_wcpdf' ),
126
+ ),
127
+ );
128
+
129
+ $listing_actions = apply_filters( 'wpo_wcpdf_listing_actions', $listing_actions, $order );
130
+
131
+ foreach ($listing_actions as $action => $data) {
132
+ ?>
133
+ <a href="<?php echo $data['url']; ?>" class="button tips wpo_wcpdf <?php echo $action; ?>" target="_blank" alt="<?php echo $data['alt']; ?>" data-tip="<?php echo $data['alt']; ?>">
134
+ <img src="<?php echo $data['img']; ?>" alt="<?php echo $data['alt']; ?>" width="16">
135
+ </a>
136
+ <?php
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Create additional Shop Order column for Invoice Numbers
142
+ * @param array $columns shop order columns
143
+ */
144
+ public function add_invoice_number_column( $columns ) {
145
+ // Check user setting
146
+ if ( !isset($this->general_settings['invoice_number_column'] ) ) {
147
+ return $columns;
148
+ }
149
+
150
+ // put the column after the Status column
151
+ $new_columns = array_slice($columns, 0, 2, true) +
152
+ array( 'pdf_invoice_number' => __( 'Invoice Number', 'wpo_wcpdf' ) ) +
153
+ array_slice($columns, 2, count($columns) - 1, true) ;
154
+ return $new_columns;
155
+ }
156
+
157
+ /**
158
+ * Display Invoice Number in Shop Order column (if available)
159
+ * @param string $column column slug
160
+ */
161
+ public function invoice_number_column_data( $column ) {
162
+ global $post, $the_order, $wpo_wcpdf;
163
+
164
+ if ( $column == 'pdf_invoice_number' ) {
165
+ if ( empty( $the_order ) || $the_order->id != $post->ID ) {
166
+ $order = new WC_Order( $post->ID );
167
+ echo $wpo_wcpdf->export->get_invoice_number( $order->id );
168
+ do_action( 'wcpdf_invoice_number_column_end', $order );
169
+ } else {
170
+ echo $wpo_wcpdf->export->get_invoice_number( $the_order->id );
171
+ do_action( 'wcpdf_invoice_number_column_end', $the_order );
172
+ }
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Display download link on My Account page
178
+ */
179
+ public function my_account_pdf_link( $actions, $order ) {
180
+ $pdf_url = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id . '&my-account'), 'generate_wpo_wcpdf' );
181
+
182
+ // check my account button settings
183
+ if (isset($this->general_settings['my_account_buttons'])) {
184
+ switch ($this->general_settings['my_account_buttons']) {
185
+ case 'available':
186
+ $invoice_allowed = get_post_meta($order->id,'_wcpdf_invoice_exists',true);
187
+ break;
188
+ case 'always':
189
+ $invoice_allowed = true;
190
+ break;
191
+ case 'never':
192
+ $invoice_allowed = false;
193
+ break;
194
+ case 'custom':
195
+ if ( isset( $this->general_settings['my_account_restrict'] ) && in_array( $order->status, array_keys( $this->general_settings['my_account_restrict'] ) ) ) {
196
+ $invoice_allowed = true;
197
+ } else {
198
+ $invoice_allowed = false;
199
+ }
200
+ break;
201
+ }
202
+ } else {
203
+ // backwards compatibility
204
+ $invoice_allowed = get_post_meta($order->id,'_wcpdf_invoice_exists',true);
205
+ }
206
+
207
+ // Check if invoice has been created already or if status allows download (filter your own array of allowed statuses)
208
+ if ( $invoice_allowed || in_array($order->status, apply_filters( 'wpo_wcpdf_myaccount_allowed_order_statuses', array() ) ) ) {
209
+ $actions['invoice'] = array(
210
+ 'url' => $pdf_url,
211
+ 'name' => apply_filters( 'wpo_wcpdf_myaccount_button_text', __( 'Download invoice (PDF)', 'wpo_wcpdf' ) )
212
+ );
213
+ }
214
+
215
+ return apply_filters( 'wpo_wcpdf_myaccount_actions', $actions, $order );
216
+ }
217
+
218
+ /**
219
+ * Add the meta box on the single order page
220
+ */
221
+ public function add_meta_boxes() {
222
+ // create PDF buttons
223
+ add_meta_box(
224
+ 'wpo_wcpdf-box',
225
+ __( 'Create PDF', 'wpo_wcpdf' ),
226
+ array( $this, 'sidebar_box_content' ),
227
+ 'shop_order',
228
+ 'side',
229
+ 'default'
230
+ );
231
+
232
+ // Invoice number & date
233
+ add_meta_box(
234
+ 'wpo_wcpdf-data-input-box',
235
+ __( 'PDF Invoice data', 'wpo_wcpdf' ),
236
+ array( $this, 'data_input_box_content' ),
237
+ 'shop_order',
238
+ 'normal',
239
+ 'default'
240
+ );
241
+ }
242
+
243
+ /**
244
+ * Create the meta box content on the single order page
245
+ */
246
+ public function sidebar_box_content( $post ) {
247
+ global $post_id;
248
+
249
+ $meta_actions = array(
250
+ 'invoice' => array (
251
+ 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $post_id ), 'generate_wpo_wcpdf' ),
252
+ 'alt' => esc_attr__( 'PDF Invoice', 'wpo_wcpdf' ),
253
+ 'title' => __( 'PDF Invoice', 'wpo_wcpdf' ),
254
+ ),
255
+ 'packing-slip' => array (
256
+ 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=packing-slip&order_ids=' . $post_id ), 'generate_wpo_wcpdf' ),
257
+ 'alt' => esc_attr__( 'PDF Packing Slip', 'wpo_wcpdf' ),
258
+ 'title' => __( 'PDF Packing Slip', 'wpo_wcpdf' ),
259
+ ),
260
+ );
261
+
262
+ $meta_actions = apply_filters( 'wpo_wcpdf_meta_box_actions', $meta_actions, $post_id );
263
+
264
+ ?>
265
+ <ul class="wpo_wcpdf-actions">
266
+ <?php
267
+ foreach ($meta_actions as $action => $data) {
268
+ printf('<li><a href="%1$s" class="button" target="_blank" alt="%2$s">%3$s</a></li>', $data['url'], $data['alt'],$data['title']);
269
+ }
270
+ ?>
271
+ </ul>
272
+ <?php
273
+ }
274
+
275
+ /**
276
+ * Add metabox for invoice number & date
277
+ */
278
+ public function data_input_box_content ( $post ) {
279
+ $invoice_exists = get_post_meta( $post->ID, '_wcpdf_invoice_exists', true );
280
+ $invoice_number = get_post_meta($post->ID,'_wcpdf_invoice_number',true);
281
+ $invoice_date = get_post_meta($post->ID,'_wcpdf_invoice_date',true);
282
+
283
+ do_action( 'wpo_wcpdf_meta_box_start', $post->ID );
284
+
285
+ ?>
286
+ <h4><?php _e( 'Invoice', 'wpo_wcpdf' ) ?></h4>
287
+ <p class="form-field _wcpdf_invoice_number_field ">
288
+ <label for="_wcpdf_invoice_number"><?php _e( 'Invoice Number (unformatted!)', 'wpo_wcpdf' ); ?>:</label>
289
+ <?php if (!empty($invoice_exists)) : ?>
290
+ <input type="text" class="short" style="" name="_wcpdf_invoice_number" id="_wcpdf_invoice_number" value="<?php echo $invoice_number ?>">
291
+ <?php else : ?>
292
+ <input type="text" class="short" style="" name="_wcpdf_invoice_number" id="_wcpdf_invoice_number" value="<?php echo $invoice_number ?>" disabled="disabled" >
293
+ <?php endif; ?>
294
+ </p>
295
+ <p class="form-field form-field-wide">
296
+ <label for="wcpdf_invoice_date"><?php _e( 'Invoice Date:', 'wpo_wcpdf' ); ?></label>
297
+ <?php if (!empty($invoice_exists)) : ?>
298
+ <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $invoice_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="number" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" min="0" max="23" size="2" value="<?php echo date_i18n( 'H', strtotime( $invoice_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" min="0" max="59" size="2" value="<?php echo date_i18n( 'i', strtotime( $invoice_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
299
+ <?php else : ?>
300
+ <input type="text" class="date-picker-field" name="wcpdf_invoice_date" id="wcpdf_invoice_date" maxlength="10" disabled="disabled" value="" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="number" class="hour" disabled="disabled" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="wcpdf_invoice_date_hour" id="wcpdf_invoice_date_hour" min="0" max="23" size="2" value="" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="wcpdf_invoice_date_minute" id="wcpdf_invoice_date_minute" min="0" max="59" size="2" value="" pattern="[0-5]{1}[0-9]{1}" disabled="disabled" />
301
+ <?php endif; ?>
302
+ </p>
303
+ <?php
304
+
305
+ do_action( 'wpo_wcpdf_meta_box_end', $post->ID );
306
+ }
307
+
308
+ /**
309
+ * Add actions to menu
310
+ */
311
+ public function bulk_actions() {
312
+ global $post_type;
313
+ $bulk_actions = apply_filters( 'wpo_wcpdf_bulk_actions', $this->bulk_actions );
314
+
315
+ if ( 'shop_order' == $post_type ) {
316
+ ?>
317
+ <script type="text/javascript">
318
+ jQuery(document).ready(function() {
319
+ <?php foreach ($bulk_actions as $action => $title) { ?>
320
+ jQuery('<option>').val('<?php echo $action; ?>').html('<?php echo esc_attr( $title ); ?>').appendTo("select[name='action'], select[name='action2']");
321
+ <?php } ?>
322
+ });
323
+ </script>
324
+ <?php
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Save invoice number
330
+ */
331
+ public function save_invoice_number_date($post_id) {
332
+ global $post_type;
333
+ if( $post_type == 'shop_order' ) {
334
+ if ( isset($_POST['_wcpdf_invoice_number']) ) {
335
+ update_post_meta( $post_id, '_wcpdf_invoice_number', stripslashes( $_POST['_wcpdf_invoice_number'] ));
336
+ update_post_meta( $post_id, '_wcpdf_invoice_exists', 1 );
337
+ }
338
+
339
+ if ( isset($_POST['wcpdf_invoice_date']) ) {
340
+ if ( empty($_POST['wcpdf_invoice_date']) ) {
341
+ delete_post_meta( $post_id, '_wcpdf_invoice_date' );
342
+ } else {
343
+ $invoice_date = strtotime( $_POST['wcpdf_invoice_date'] . ' ' . (int) $_POST['wcpdf_invoice_date_hour'] . ':' . (int) $_POST['wcpdf_invoice_date_minute'] . ':00' );
344
+ $invoice_date = date_i18n( 'Y-m-d H:i:s', $invoice_date );
345
+ update_post_meta( $post_id, '_wcpdf_invoice_date', $invoice_date );
346
+ update_post_meta( $post_id, '_wcpdf_invoice_exists', 1 );
347
+ }
348
+ }
349
+
350
+ if (empty($_POST['wcpdf_invoice_date']) && isset($_POST['_wcpdf_invoice_number'])) {
351
+ $invoice_date = date_i18n( 'Y-m-d H:i:s', time() );
352
+ update_post_meta( $post_id, '_wcpdf_invoice_date', $invoice_date );
353
+ }
354
+
355
+ if ( empty($_POST['wcpdf_invoice_date']) && empty($_POST['_wcpdf_invoice_number'])) {
356
+ delete_post_meta( $post_id, '_wcpdf_invoice_exists' );
357
+ }
358
+ }
359
+ }
360
+
361
+ /**
362
+ * Add invoice number to order search scope
363
+ */
364
+ public function search_fields ( $custom_fields ) {
365
+ $custom_fields[] = '_wcpdf_invoice_number';
366
+ $custom_fields[] = '_wcpdf_formatted_invoice_number';
367
+ return $custom_fields;
368
+ }
369
+ }
370
  }
includes/wcpdf-extensions.php CHANGED
@@ -10,14 +10,43 @@ jQuery(document).ready(function() {
10
  </script>
11
 
12
  <div class="wcpdf-extensions-ad">
13
-
14
  <img src="<?php echo WooCommerce_PDF_Invoices::$plugin_url . 'images/wpo-helper.png'; ?>" class="wpo-helper">
15
  <h3><?php _e( 'Check out these premium extensions!', 'wpo_wcpdf' ); ?></h3>
16
  <i>(<?php _e( 'click items to read more', 'wpo_wcpdf' ); ?>)</i>
17
  <ul class="extensions">
18
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <?php
20
- if (!class_exists('WooCommerce_PDF_IPS_Pro')) {
 
21
  ?>
22
  <li>
23
  <?php _e('Go Pro: Proforma invoices, credit notes (=refunds) & more!', 'wpo_wcpdf')?>
@@ -36,7 +65,27 @@ jQuery(document).ready(function() {
36
  <?php } ?>
37
 
38
  <?php
39
- if (!class_exists('WooCommerce_PDF_IPS_Dropbox')) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ?>
41
  <li>
42
  <?php _e('Upload all invoices automatically to your dropbox', 'wpo_wcpdf')?>
@@ -74,7 +123,7 @@ jQuery(document).ready(function() {
74
  <?php } ?>
75
 
76
  <?php
77
- if (!class_exists('WooCommerce_PDF_IPS_Templates')) {
78
  $template_link = '<a href="https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/" target="_blank">wpovernight.com</a>';
79
  $email_link = '<a href="mailto:support@wpovernight.com">support@wpovernight.com</a>'
80
  ?>
@@ -93,7 +142,7 @@ jQuery(document).ready(function() {
93
  </ul>
94
  <?php
95
  // link to hide message when one of the premium extensions is installed
96
- if ( class_exists('WooCommerce_PDF_IPS_Pro') || class_exists('WooCommerce_PDF_IPS_Dropbox') || class_exists('WooCommerce_PDF_IPS_Templates') || class_exists('WooCommerce_Ext_PrintOrders') ) {
97
  printf('<a href="%s" style="display:inline-block; margin-top: 10px;">%s</a>', add_query_arg( 'wpo_wcpdf_hide_extensions_ad', 'true' ), __( 'Hide this message', 'wpo_wcpdf' ) );
98
  }
99
  ?>
10
  </script>
11
 
12
  <div class="wcpdf-extensions-ad">
13
+ <?php $no_pro = !class_exists('WooCommerce_PDF_IPS_Pro') && !class_exists('WooCommerce_PDF_IPS_Dropbox') && !class_exists('WooCommerce_PDF_IPS_Templates'); ?>
14
  <img src="<?php echo WooCommerce_PDF_Invoices::$plugin_url . 'images/wpo-helper.png'; ?>" class="wpo-helper">
15
  <h3><?php _e( 'Check out these premium extensions!', 'wpo_wcpdf' ); ?></h3>
16
  <i>(<?php _e( 'click items to read more', 'wpo_wcpdf' ); ?>)</i>
17
  <ul class="extensions">
18
+ <?php if ( $no_pro ): ?>
19
+ <!-- No Pro extensions: Ad for PDF bundle -->
20
+ <li>
21
+ <?php _e('Premium PDF Invoice bundle: Everything you need for a perfect invoicing system', 'wpo_wcpdf')?>
22
+ <div class="more" style="display:none;">
23
+ <h4><?php _e( 'Supercharge WooCommerce PDF Invoices & Packing Slips with the all our premium extensions:', 'wpo_wcpdf' ); ?></h4>
24
+ <?php _e( 'Professional features:', 'wpo_wcpdf' ); ?>
25
+ <ul>
26
+ <li><?php _e( 'Email/print/download <b>PDF Credit Notes & Proforma invoices</b>', 'wpo_wcpdf' ); ?></li>
27
+ <li><?php _e( 'Send out a separate <b>notification email</b> with (or without) PDF invoices/packing slips, for example to a drop-shipper or a supplier.', 'wpo_wcpdf' ); ?></li>
28
+ <li><?php _e( 'Attach <b>up to 3 static files</b> (for example a terms & conditions document) to the WooCommerce emails of your choice.', 'wpo_wcpdf' ); ?></li>
29
+ <li><?php _e( 'Use <b>separate numbering systems</b> and/or format for proforma invoices and credit notes or utilize the main invoice numbering system', 'wpo_wcpdf' ); ?></li>
30
+ <li><?php _e( '<b>Customize</b> the <b>shipping & billing address</b> format to include additional custom fields, font sizes etc. without the need to create a custom template.', 'wpo_wcpdf' ); ?></li>
31
+ <li><?php _e( 'Use the plugin in multilingual <b>WPML</b> setups', 'wpo_wcpdf' ); ?></li>
32
+ </ul>
33
+ <?php _e('Advanced, customizable templates', 'wpo_wcpdf')?>
34
+ <ul>
35
+ <li><?php _e( 'Completely customize the invoice contents (prices, taxes, thumbnails) to your needs with a drag & drop customizer', 'wpo_wcpdf' ); ?></li>
36
+ <li><?php _e( 'Two extra stylish premade templates (Modern & Business)', 'wpo_wcpdf' ); ?></li>
37
+ </ul>
38
+ <?php _e('Upload automatically to dropbox', 'wpo_wcpdf')?>
39
+ <ul>
40
+ <li><?php _e( 'This extension conveniently uploads all the invoices (and other pdf documents from the professional extension) that are emailed to your customers to Dropbox. The best way to keep your invoice administration up to date!', 'wpo_wcpdf' ); ?></li>
41
+ </ul>
42
+ <br>
43
+ <a href="https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/" target="_blank"><?php _e("Get WooCommerce PDF Invoices & Packing Slips Bundle", 'wpo_wcpdf'); ?></a>
44
+ </div>
45
+ </li>
46
+ <?php endif; ?>
47
  <?php
48
+ // NO BUNDLE: separate ads
49
+ if (!class_exists('WooCommerce_PDF_IPS_Pro') && !$no_pro) {
50
  ?>
51
  <li>
52
  <?php _e('Go Pro: Proforma invoices, credit notes (=refunds) & more!', 'wpo_wcpdf')?>
65
  <?php } ?>
66
 
67
  <?php
68
+ if (!class_exists('WPO_WC_Smart_Reminder_Emails')) {
69
+ ?>
70
+ <li>
71
+ <?php _e('Automatically send payment reminders to your customers', 'wpo_wcpdf')?>
72
+ <div class="more" style="display:none;">
73
+ <?php _e('WooCommerce Smart Reminder emails', 'wpo_wcpdf')?>
74
+ <ul>
75
+ <li><?php _e( '<b>Completely automatic</b> scheduled emails', 'wpo_wcpdf' ); ?></li>
76
+ <li><?php _e( '<b>Rich text editor</b> for the email text, including placeholders for data from the order (name, order total, etc)', 'wpo_wcpdf' ); ?></li>
77
+ <li><?php _e( 'Configure the exact requirements for sending an email (time after order, order status, payment method)', 'wpo_wcpdf' ); ?></li>
78
+ <li><?php _e( 'Fully <b>WPML Compatible</b> – emails will be automatically sent in the order language.', 'wpo_wcpdf' ); ?></li>
79
+ <li><?php _e( '<b>Super versatile!</b> Can be used for any kind of reminder email (review reminders, repeat purchases)', 'wpo_wcpdf' ); ?></li>
80
+ <li><b><?php _e( 'Integrates seamlessly with the PDF Invoices & Packing Slips plugin', 'wpo_wcpdf' ); ?></b></li>
81
+ </ul>
82
+ <a href="https://wpovernight.com/downloads/woocommerce-reminder-emails-payment-reminders/" target="_blank"><?php _e("Get WooCommerce Smart Reminder Emails", 'wpo_wcpdf'); ?></a>
83
+ </div>
84
+ </li>
85
+ <?php } ?>
86
+
87
+ <?php
88
+ if (!class_exists('WooCommerce_PDF_IPS_Dropbox') && !$no_pro) {
89
  ?>
90
  <li>
91
  <?php _e('Upload all invoices automatically to your dropbox', 'wpo_wcpdf')?>
123
  <?php } ?>
124
 
125
  <?php
126
+ if (!class_exists('WooCommerce_PDF_IPS_Templates') && !$no_pro) {
127
  $template_link = '<a href="https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/" target="_blank">wpovernight.com</a>';
128
  $email_link = '<a href="mailto:support@wpovernight.com">support@wpovernight.com</a>'
129
  ?>
142
  </ul>
143
  <?php
144
  // link to hide message when one of the premium extensions is installed
145
+ if ( class_exists('WooCommerce_PDF_IPS_Pro') || class_exists('WooCommerce_PDF_IPS_Dropbox') || class_exists('WooCommerce_PDF_IPS_Templates') || class_exists('WooCommerce_Ext_PrintOrders') || class_exists('WPO_WC_Smart_Reminder_Emails') ) {
146
  printf('<a href="%s" style="display:inline-block; margin-top: 10px;">%s</a>', add_query_arg( 'wpo_wcpdf_hide_extensions_ad', 'true' ), __( 'Hide this message', 'wpo_wcpdf' ) );
147
  }
148
  ?>
js/script.js CHANGED
@@ -1,43 +1,43 @@
1
- jQuery(document).ready(function($) {
2
- $("#doaction, #doaction2").click(function (event) {
3
- var actionselected = $(this).attr("id").substr(2);
4
- var action = $('select[name="' + actionselected + '"]').val();
5
- if ( $.inArray(action, wpo_wcpdf_ajax.bulk_actions) !== -1 ) {
6
- event.preventDefault();
7
- var template = action;
8
- var checked = [];
9
- $('tbody th.check-column input[type="checkbox"]:checked').each(
10
- function() {
11
- checked.push($(this).val());
12
- }
13
- );
14
-
15
- if (!checked.length) {
16
- alert('You have to select order(s) first!');
17
- return;
18
- }
19
-
20
- var order_ids=checked.join('x');
21
-
22
- if (wpo_wcpdf_ajax.ajaxurl.indexOf("?") != -1) {
23
- url = wpo_wcpdf_ajax.ajaxurl+'&action=generate_wpo_wcpdf&template_type='+template+'&order_ids='+order_ids+'&_wpnonce='+wpo_wcpdf_ajax.nonce;
24
- } else {
25
- url = wpo_wcpdf_ajax.ajaxurl+'?action=generate_wpo_wcpdf&template_type='+template+'&order_ids='+order_ids+'&_wpnonce='+wpo_wcpdf_ajax.nonce;
26
- }
27
-
28
- window.open(url,'_blank');
29
- }
30
- });
31
-
32
- $('#wpo_wcpdf-data-input-box').insertAfter('#woocommerce-order-data');
33
-
34
- // enable invoice number edit if user initiated
35
- $('#wpo_wcpdf-data-input-box label').click(function (event) {
36
- input = $(this).attr('for');
37
- $('#'+input).prop('disabled', false);
38
- });
39
- $( "#_wcpdf_invoice_number" ).on( "click", function() {
40
- console.log( this );
41
- });
42
- });
43
-
1
+ jQuery(document).ready(function($) {
2
+ $("#doaction, #doaction2").click(function (event) {
3
+ var actionselected = $(this).attr("id").substr(2);
4
+ var action = $('select[name="' + actionselected + '"]').val();
5
+ if ( $.inArray(action, wpo_wcpdf_ajax.bulk_actions) !== -1 ) {
6
+ event.preventDefault();
7
+ var template = action;
8
+ var checked = [];
9
+ $('tbody th.check-column input[type="checkbox"]:checked').each(
10
+ function() {
11
+ checked.push($(this).val());
12
+ }
13
+ );
14
+
15
+ if (!checked.length) {
16
+ alert('You have to select order(s) first!');
17
+ return;
18
+ }
19
+
20
+ var order_ids=checked.join('x');
21
+
22
+ if (wpo_wcpdf_ajax.ajaxurl.indexOf("?") != -1) {
23
+ url = wpo_wcpdf_ajax.ajaxurl+'&action=generate_wpo_wcpdf&template_type='+template+'&order_ids='+order_ids+'&_wpnonce='+wpo_wcpdf_ajax.nonce;
24
+ } else {
25
+ url = wpo_wcpdf_ajax.ajaxurl+'?action=generate_wpo_wcpdf&template_type='+template+'&order_ids='+order_ids+'&_wpnonce='+wpo_wcpdf_ajax.nonce;
26
+ }
27
+
28
+ window.open(url,'_blank');
29
+ }
30
+ });
31
+
32
+ $('#wpo_wcpdf-data-input-box').insertAfter('#woocommerce-order-data');
33
+
34
+ // enable invoice number edit if user initiated
35
+ $('#wpo_wcpdf-data-input-box label').click(function (event) {
36
+ input = $(this).attr('for');
37
+ $('#'+input).prop('disabled', false);
38
+ });
39
+ $( "#_wcpdf_invoice_number" ).on( "click", function() {
40
+ console.log( this );
41
+ });
42
+ });
43
+
languages/wpo_wcpdf-nb_NO.mo CHANGED
Binary file
languages/wpo_wcpdf-nb_NO.po CHANGED
@@ -1,106 +1,106 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
4
- "POT-Creation-Date: 2015-04-29 09:09+0100\n"
5
- "PO-Revision-Date: 2015-06-11 15:24+0100\n"
6
  "Last-Translator: Eirik Opsanger <eirik.opsanger@gmail.com>\n"
7
  "Language-Team: WP Overnight <support@wpovernight.com>\n"
8
  "Language: nb\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.8.1\n"
13
- "X-Poedit-Basepath: ../\n"
14
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __;_e;_x;_n:1,2\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
- #: includes/class-wcpdf-export.php:338 includes/class-wcpdf-export.php:348
20
- #: includes/class-wcpdf-export.php:359 includes/class-wcpdf-export.php:367
21
  msgid "You do not have sufficient permissions to access this page."
22
  msgstr "Du har ikke nok rettigheter til denne siden"
23
 
24
- #: includes/class-wcpdf-export.php:343
25
  msgid "Some of the export parameters are missing."
26
  msgstr ""
27
 
28
  # This is a filename (prefix). do not use spaces or special characters!
29
- #: includes/class-wcpdf-export.php:424
30
  msgid "invoice"
31
  msgid_plural "invoices"
32
  msgstr[0] "Faktura"
33
  msgstr[1] "Fakturaer"
34
 
35
  # This is a filename (prefix). do not use spaces or special characters!
36
- #: includes/class-wcpdf-export.php:428
37
  msgid "packing-slip"
38
  msgid_plural "packing-slips"
39
  msgstr[0] "Pakkseddel"
40
  msgstr[1] "Pakksedler"
41
 
42
- #: includes/class-wcpdf-settings.php:38 includes/class-wcpdf-settings.php:39
43
  #: includes/class-wcpdf-writepanels.php:32
44
  msgid "PDF Invoices"
45
  msgstr "PDF-faktura"
46
 
47
- #: includes/class-wcpdf-settings.php:80
48
  msgid "Settings"
49
  msgstr "Innstillinger"
50
 
51
- #: includes/class-wcpdf-settings.php:102
52
  msgid "General"
53
  msgstr "Generelt"
54
 
55
- #: includes/class-wcpdf-settings.php:103
56
  msgid "Template"
57
  msgstr "Template"
58
 
59
- #: includes/class-wcpdf-settings.php:108
60
  msgid "Status"
61
  msgstr "Status"
62
 
63
- #: includes/class-wcpdf-settings.php:120
64
  msgid "WooCommerce PDF Invoices"
65
  msgstr "WooCommerce PDF Faktura"
66
 
67
- #: includes/class-wcpdf-settings.php:189
68
  msgid "General settings"
69
  msgstr "Generelle innstillinger"
70
 
71
- #: includes/class-wcpdf-settings.php:196
72
  msgid "How do you want to view the PDF?"
73
  msgstr "Hvordan vil du se PDF`en?"
74
 
75
- #: includes/class-wcpdf-settings.php:204
76
  msgid "Download the PDF"
77
  msgstr "Last ned PDF`en"
78
 
79
- #: includes/class-wcpdf-settings.php:205
80
  msgid "Open the PDF in a new browser tab/window"
81
  msgstr "Åpne PDF`en i ett nytt vindu"
82
 
83
- #: includes/class-wcpdf-settings.php:214
84
  msgid "Admin New Order email"
85
  msgstr "Admins Ny Ordre epost"
86
 
87
- #: includes/class-wcpdf-settings.php:215
88
  msgid "Customer Processing Order email"
89
  msgstr "Kundens Behandler Ordre epost"
90
 
91
- #: includes/class-wcpdf-settings.php:216
92
  msgid "Customer Completed Order email"
93
  msgstr "Kundens Fullført Ordre epost"
94
 
95
- #: includes/class-wcpdf-settings.php:217
96
  msgid "Customer Invoice email"
97
  msgstr "Kundens Faktura epost"
98
 
99
- #: includes/class-wcpdf-settings.php:222
100
  msgid "Attach invoice to:"
101
  msgstr "Legg ved faktura til:"
102
 
103
- #: includes/class-wcpdf-settings.php:230
104
  #, php-format
105
  msgid ""
106
  "It looks like the temp folder (<code>%s</code>) is not writable, check the "
@@ -111,49 +111,53 @@ msgstr ""
111
  "skrivbar, sjekk rettighetene på denne mappen! Uten skrivetilgang til denne "
112
  "mappen vil ikke denne plugin kunne sende pdf-faktura."
113
 
114
- #: includes/class-wcpdf-settings.php:236
115
  msgid "Disable for free products"
116
  msgstr ""
117
 
118
- #: includes/class-wcpdf-settings.php:243
119
  msgid ""
120
  "Disable automatic creation/attachment of invoices when only free products "
121
  "are ordered"
122
  msgstr ""
123
 
124
- #: includes/class-wcpdf-settings.php:250
125
  msgid "Interface"
126
  msgstr ""
127
 
128
- #: includes/class-wcpdf-settings.php:298
129
  msgid "Allow My Account invoice download"
130
  msgstr ""
131
 
132
- #: includes/class-wcpdf-settings.php:306
133
  msgid "Only when an invoice is already created/emailed"
134
  msgstr ""
135
 
136
- #: includes/class-wcpdf-settings.php:307
137
  msgid "Only for specific order statuses (define below)"
138
  msgstr ""
139
 
140
- #: includes/class-wcpdf-settings.php:308
141
  msgid "Always"
142
  msgstr ""
143
 
144
  #: includes/class-wcpdf-settings.php:323
 
 
 
 
145
  msgid "Enable invoice number column in the orders list"
146
  msgstr "Aktiver kolonne for fakturanummer i ordrelisten"
147
 
148
- #: includes/class-wcpdf-settings.php:361
149
  msgid "PDF Template settings"
150
  msgstr "PDF Template-innstillinger"
151
 
152
- #: includes/class-wcpdf-settings.php:373
153
  msgid "Choose a template"
154
  msgstr "Velg din template"
155
 
156
- #: includes/class-wcpdf-settings.php:381
157
  #, php-format
158
  msgid ""
159
  "Want to use your own template? Copy all the files from <code>%s</code> to "
@@ -162,83 +166,97 @@ msgstr ""
162
  "Vil du bruke din egen template? Kopier alle filer fra <code>%s</code> til "
163
  "<code>%s</code>for å endre de."
164
 
165
- #: includes/class-wcpdf-settings.php:387
166
  msgid "Paper size"
167
  msgstr "Papirstørrelse"
168
 
169
- #: includes/class-wcpdf-settings.php:395
170
  msgid "A4"
171
  msgstr "A4"
172
 
173
- #: includes/class-wcpdf-settings.php:396
174
  msgid "Letter"
175
  msgstr "Letter"
176
 
177
- #: includes/class-wcpdf-settings.php:403
178
  msgid "Shop header/logo"
179
  msgstr "Butikkens header/logo"
180
 
181
- #: includes/class-wcpdf-settings.php:410
182
  msgid "Select or upload your invoice header/logo"
183
  msgstr "Velg eller last opp din faktura header/logo"
184
 
185
- #: includes/class-wcpdf-settings.php:411
186
  msgid "Set image"
187
  msgstr "Velg bilde"
188
 
189
- #: includes/class-wcpdf-settings.php:412
190
  msgid "Remove image"
191
  msgstr "Fjern bilde"
192
 
193
- #: includes/class-wcpdf-settings.php:419
194
  msgid "Shop Name"
195
  msgstr "Butikkens navn"
196
 
197
- #: includes/class-wcpdf-settings.php:432
198
  msgid "Shop Address"
199
  msgstr "Butikkens adresse"
200
 
201
- #: includes/class-wcpdf-settings.php:447
202
  msgid "Footer: terms & conditions, policies, etc."
203
  msgstr "Footer: Betingelser og Vilkår"
204
 
205
- #: includes/class-wcpdf-settings.php:463 templates/pdf/Simple/invoice.php:9
 
206
  #: templates/pdf/Simple/invoice.php:21
207
- #: woocommerce-pdf-invoices-packingslips.php:220
208
  msgid "Invoice"
209
  msgstr "Faktura"
210
 
211
- #: includes/class-wcpdf-settings.php:470
212
  msgid "Display shipping address"
213
  msgstr ""
214
 
215
- #: includes/class-wcpdf-settings.php:477
216
  msgid ""
217
  "Display shipping address on invoice (in addition to the default billing "
218
  "address) if different from billing address"
219
  msgstr ""
220
 
221
- #: includes/class-wcpdf-settings.php:483 includes/class-wcpdf-settings.php:598
222
  msgid "Display email address"
223
  msgstr ""
224
 
225
- #: includes/class-wcpdf-settings.php:495 includes/class-wcpdf-settings.php:610
226
  msgid "Display phone number"
227
  msgstr ""
228
 
229
- #: includes/class-wcpdf-settings.php:507
230
  msgid "Display invoice date"
231
  msgstr "Vis fakturadato"
232
 
233
- #: includes/class-wcpdf-settings.php:520
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  msgid "Display built-in sequential invoice number"
235
  msgstr "Vis sekvensielt fakturanummer"
236
 
237
- #: includes/class-wcpdf-settings.php:533
238
  msgid "Next invoice number (without prefix/suffix etc.)"
239
  msgstr "Neste fakturanummer (uten prefix/suffix etc.)"
240
 
241
- #: includes/class-wcpdf-settings.php:541
242
  msgid ""
243
  "This is the number that will be used on the next invoice that is created. By "
244
  "default, numbering starts from the WooCommerce Order Number of the first "
@@ -252,35 +270,33 @@ msgstr ""
252
  "dersom du endrer denne og setter et lavere tall enn høyeste (PDF) "
253
  "fakturanummer, vil du få flere fakturaer med samme nummer!"
254
 
255
- #: includes/class-wcpdf-settings.php:547
256
  msgid "Invoice number format"
257
  msgstr "Format på fakturanummer"
258
 
259
- #: includes/class-wcpdf-settings.php:556
260
  msgid "Prefix"
261
  msgstr "Prefix"
262
 
263
- #: includes/class-wcpdf-settings.php:558
264
  msgid ""
265
- "to use the order year and/or month, use [order_year] or [order_month] "
266
  "respectively"
267
  msgstr ""
268
- "for å bruke år og/eller måned, kan du bruker [order_year] og/eller "
269
- "[order_month]"
270
 
271
- #: includes/class-wcpdf-settings.php:561
272
  msgid "Suffix"
273
  msgstr "Suffix"
274
 
275
- #: includes/class-wcpdf-settings.php:566
276
  msgid "Padding"
277
  msgstr "Siffer"
278
 
279
- #: includes/class-wcpdf-settings.php:568
280
  msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
281
  msgstr "skriv antall siffer her - skriv \"6\" for å vise 42 som 000042"
282
 
283
- #: includes/class-wcpdf-settings.php:571
284
  msgid ""
285
  "note: if you have already created a custom invoice number format with a "
286
  "filter, the above settings will be ignored"
@@ -288,96 +304,108 @@ msgstr ""
288
  "merk: hvis du allerede har laget et eget nummerformat for fakuranummer med "
289
  "et filter, vil innstillingene over bli ignorert"
290
 
291
- #: includes/class-wcpdf-settings.php:578
 
 
 
 
 
 
 
 
 
 
 
 
292
  #: templates/pdf/Simple/packing-slip.php:9
293
  #: templates/pdf/Simple/packing-slip.php:21
294
- #: woocommerce-pdf-invoices-packingslips.php:223
295
  msgid "Packing Slip"
296
  msgstr "Pakkseddel"
297
 
298
- #: includes/class-wcpdf-settings.php:585
299
  msgid "Display billing address"
300
  msgstr ""
301
 
302
- #: includes/class-wcpdf-settings.php:592
303
  msgid ""
304
  "Display billing address on packing slip (in addition to the default shipping "
305
  "address) if different from shipping address"
306
  msgstr ""
307
 
308
- #: includes/class-wcpdf-settings.php:623
309
  msgid "Extra template fields"
310
  msgstr "Ekstrafelt"
311
 
312
- #: includes/class-wcpdf-settings.php:630
313
  msgid "Extra field 1"
314
  msgstr "Ekstrafelt 1"
315
 
316
- #: includes/class-wcpdf-settings.php:639
317
  msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
318
  msgstr "Dette er fotnote-kolonne 1 i <i>Modern (Premium)</i> template"
319
 
320
- #: includes/class-wcpdf-settings.php:645
321
  msgid "Extra field 2"
322
  msgstr "Ekstrafelt 2"
323
 
324
- #: includes/class-wcpdf-settings.php:654
325
  msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
326
  msgstr "Dette er fotnote-kolonne 2 i <i>Modern (Premium)</i> template"
327
 
328
- #: includes/class-wcpdf-settings.php:660
329
  msgid "Extra field 3"
330
  msgstr "Ekstrafelt 3"
331
 
332
- #: includes/class-wcpdf-settings.php:669
333
  msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
334
  msgstr "Dette er fotnote-kolonne 3 i <i>Modern (Premium)</i> template"
335
 
336
- #: includes/class-wcpdf-settings.php:711
337
  msgid "Debug settings"
338
  msgstr ""
339
 
340
- #: includes/class-wcpdf-settings.php:718
341
  msgid "Enable debug output"
342
  msgstr ""
343
 
344
- #: includes/class-wcpdf-settings.php:725
345
  msgid ""
346
  "Enable this option to output plugin errors if you're getting a blank page or "
347
  "other PDF generation issues"
348
  msgstr ""
349
 
350
- #: includes/class-wcpdf-settings.php:731
351
  msgid "Output to HTML"
352
  msgstr ""
353
 
354
- #: includes/class-wcpdf-settings.php:738
355
  msgid ""
356
  "Send the template output as HTML to the browser instead of creating a PDF."
357
  msgstr ""
358
 
359
- #: includes/class-wcpdf-settings.php:744
360
  msgid "Use old tmp folder"
361
  msgstr ""
362
 
363
- #: includes/class-wcpdf-settings.php:751
364
  msgid ""
365
  "Before version 1.5 of PDF Invoices, temporary files were stored in the "
366
  "plugin folder. This setting is only intended for backwards compatibility, "
367
  "not recommended on new installs!"
368
  msgstr ""
369
 
370
- #: includes/class-wcpdf-settings.php:1091
371
  msgid "Image resolution"
372
  msgstr "Bildeoppløsning"
373
 
374
- #: includes/class-wcpdf-settings.php:1207
375
  msgid ""
376
  "<b>Warning!</b> The settings below are meant for debugging/development only. "
377
  "Do not use them on a live website!"
378
  msgstr ""
379
 
380
- #: includes/class-wcpdf-settings.php:1216
381
  msgid ""
382
  "These are used for the (optional) footer columns in the <em>Modern "
383
  "(Premium)</em> template, but can also be used for other elements in your "
@@ -390,42 +418,47 @@ msgstr ""
390
  msgid "PDF Packing Slips"
391
  msgstr "PDF Pakksedler"
392
 
393
- #: includes/class-wcpdf-writepanels.php:107
394
- #: includes/class-wcpdf-writepanels.php:216
395
  msgid "PDF Invoice"
396
  msgstr "PDF-faktura"
397
 
398
- #: includes/class-wcpdf-writepanels.php:112
399
- #: includes/class-wcpdf-writepanels.php:221
400
  msgid "PDF Packing Slip"
401
  msgstr "PDF Pakkseddel"
402
 
403
- #: includes/class-wcpdf-writepanels.php:139
404
  msgid "Invoice Number"
405
  msgstr "Fakturanummer"
406
 
407
- #: includes/class-wcpdf-writepanels.php:192
408
  msgid "Download invoice (PDF)"
409
  msgstr "Last ned faktura (PDF)"
410
 
411
- #: includes/class-wcpdf-writepanels.php:203
412
  msgid "Create PDF"
413
  msgstr "Opprett PDF"
414
 
415
- #: includes/class-wcpdf-writepanels.php:264
416
- msgid "PDF Invoice Number (unformatted!)"
417
- msgstr "PDF fakturanummer (uformatert)"
 
 
 
 
418
 
419
- #: includes/class-wcpdf-writepanels.php:267
420
- #: templates/pdf/Simple/invoice.php:55
421
  msgid "Invoice Date:"
422
  msgstr "Fakturadato:"
423
 
424
- #: includes/class-wcpdf-writepanels.php:268
 
425
  msgid "h"
426
  msgstr "h"
427
 
428
- #: includes/class-wcpdf-writepanels.php:268
 
429
  msgid "m"
430
  msgstr "m"
431
 
@@ -528,16 +561,18 @@ msgid "WooCommerce Automatic Order Printing"
528
  msgstr "Automatisk ordreutskrift"
529
 
530
  #: includes/wcpdf-extensions.php:82
531
- msgid "More advanced templates"
532
- msgstr "Mer avanserte stiler"
533
 
534
  #: includes/wcpdf-extensions.php:85
535
- msgid "Stylish modern invoices & packing slips with product thumbnails!"
536
- msgstr "Stilfylle, moderne faktura og pakkelapper med produktbilder!"
 
 
537
 
538
  #: includes/wcpdf-extensions.php:86
539
- msgid "More tax details on the invoices!"
540
- msgstr "Flere detaljer for skatter og avgifter på faktura!"
541
 
542
  #: includes/wcpdf-extensions.php:87
543
  #, php-format
@@ -551,8 +586,11 @@ msgstr ""
551
  msgid "For custom templates, contact us at %s."
552
  msgstr "For egendefinerte templates, kontakt oss på %s"
553
 
554
- #: templates/pdf/Simple/invoice.php:29
555
- #: templates/pdf/Simple/packing-slip.php:40
 
 
 
556
  msgid "Billing Address:"
557
  msgstr "Fakturaadresse:"
558
 
@@ -564,13 +602,11 @@ msgstr "Send til:"
564
  msgid "Invoice Number:"
565
  msgstr "Fakturanummer:"
566
 
567
- #: templates/pdf/Simple/invoice.php:60
568
- #: templates/pdf/Simple/packing-slip.php:48
569
  msgid "Order Number:"
570
  msgstr "Ordrenummer:"
571
 
572
- #: templates/pdf/Simple/invoice.php:64
573
- #: templates/pdf/Simple/packing-slip.php:52
574
  msgid "Order Date:"
575
  msgstr "Ordredato:"
576
 
@@ -578,13 +614,11 @@ msgstr "Ordredato:"
578
  msgid "Payment Method:"
579
  msgstr "Betalingsmåte:"
580
 
581
- #: templates/pdf/Simple/invoice.php:82
582
- #: templates/pdf/Simple/packing-slip.php:70
583
  msgid "Product"
584
  msgstr "Produkt:"
585
 
586
- #: templates/pdf/Simple/invoice.php:83
587
- #: templates/pdf/Simple/packing-slip.php:71
588
  msgid "Quantity"
589
  msgstr "Antall"
590
 
@@ -592,23 +626,19 @@ msgstr "Antall"
592
  msgid "Price"
593
  msgstr "Pris"
594
 
595
- #: templates/pdf/Simple/invoice.php:91
596
- #: templates/pdf/Simple/packing-slip.php:78
597
  msgid "Description"
598
  msgstr "Beskrivelse"
599
 
600
- #: templates/pdf/Simple/invoice.php:96
601
- #: templates/pdf/Simple/packing-slip.php:83
602
  msgid "SKU"
603
  msgstr "Art.nr"
604
 
605
- #: templates/pdf/Simple/invoice.php:97
606
- #: templates/pdf/Simple/packing-slip.php:84
607
  msgid "SKU:"
608
  msgstr "Art.nr:"
609
 
610
- #: templates/pdf/Simple/invoice.php:98
611
- #: templates/pdf/Simple/packing-slip.php:85
612
  msgid "Weight:"
613
  msgstr "Vekt:"
614
 
@@ -634,47 +664,76 @@ msgstr ""
634
  "WooCommerce PDF Invoices & Packing Slips krever %sWooCommerce%s for å bli "
635
  "installert og aktivert!"
636
 
637
- #: woocommerce-pdf-invoices-packingslips.php:330
638
- #: woocommerce-pdf-invoices-packingslips.php:391
639
  msgid "N/A"
640
  msgstr "N/A"
641
 
642
- #: woocommerce-pdf-invoices-packingslips.php:480
643
  msgid "Payment method"
644
  msgstr "Betalingsmåte"
645
 
646
- #: woocommerce-pdf-invoices-packingslips.php:491
647
  msgid "Shipping method"
648
  msgstr "Leveringsmåte"
649
 
650
- #: woocommerce-pdf-invoices-packingslips.php:644
 
 
 
 
 
 
 
 
 
 
651
  msgid "Subtotal"
652
  msgstr "Total"
653
 
654
- #: woocommerce-pdf-invoices-packingslips.php:666
655
  msgid "Shipping"
656
  msgstr "Frakt"
657
 
658
- #: woocommerce-pdf-invoices-packingslips.php:719
659
  msgid "Discount"
660
  msgstr "Avslag"
661
 
662
- #: woocommerce-pdf-invoices-packingslips.php:759
663
  msgid "VAT"
664
  msgstr "MVA"
665
 
666
- #: woocommerce-pdf-invoices-packingslips.php:760
667
  msgid "Tax rate"
668
  msgstr "MVA"
669
 
670
- #: woocommerce-pdf-invoices-packingslips.php:797
671
  msgid "Total ex. VAT"
672
  msgstr "Totalt eksl. MVA"
673
 
674
- #: woocommerce-pdf-invoices-packingslips.php:800
675
  msgid "Total"
676
  msgstr "Subtotal"
677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  #~ msgid ""
679
  #~ "Attach a <b>static file</b> (for example a terms & conditions document) "
680
  #~ "to the WooCommerce emails of your choice."
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
4
+ "POT-Creation-Date: 2016-09-22 15:50+0200\n"
5
+ "PO-Revision-Date: 2016-09-22 15:50+0200\n"
6
  "Last-Translator: Eirik Opsanger <eirik.opsanger@gmail.com>\n"
7
  "Language-Team: WP Overnight <support@wpovernight.com>\n"
8
  "Language: nb\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.9\n"
13
+ "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __;_e;_x;_n:1,2\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
+ #: includes/class-wcpdf-export.php:418 includes/class-wcpdf-export.php:432
20
+ #: includes/class-wcpdf-export.php:439 includes/class-wcpdf-export.php:447
21
  msgid "You do not have sufficient permissions to access this page."
22
  msgstr "Du har ikke nok rettigheter til denne siden"
23
 
24
+ #: includes/class-wcpdf-export.php:423
25
  msgid "Some of the export parameters are missing."
26
  msgstr ""
27
 
28
  # This is a filename (prefix). do not use spaces or special characters!
29
+ #: includes/class-wcpdf-export.php:504
30
  msgid "invoice"
31
  msgid_plural "invoices"
32
  msgstr[0] "Faktura"
33
  msgstr[1] "Fakturaer"
34
 
35
  # This is a filename (prefix). do not use spaces or special characters!
36
+ #: includes/class-wcpdf-export.php:508
37
  msgid "packing-slip"
38
  msgid_plural "packing-slips"
39
  msgstr[0] "Pakkseddel"
40
  msgstr[1] "Pakksedler"
41
 
42
+ #: includes/class-wcpdf-settings.php:37 includes/class-wcpdf-settings.php:38
43
  #: includes/class-wcpdf-writepanels.php:32
44
  msgid "PDF Invoices"
45
  msgstr "PDF-faktura"
46
 
47
+ #: includes/class-wcpdf-settings.php:79
48
  msgid "Settings"
49
  msgstr "Innstillinger"
50
 
51
+ #: includes/class-wcpdf-settings.php:101
52
  msgid "General"
53
  msgstr "Generelt"
54
 
55
+ #: includes/class-wcpdf-settings.php:102
56
  msgid "Template"
57
  msgstr "Template"
58
 
59
+ #: includes/class-wcpdf-settings.php:107
60
  msgid "Status"
61
  msgstr "Status"
62
 
63
+ #: includes/class-wcpdf-settings.php:119
64
  msgid "WooCommerce PDF Invoices"
65
  msgstr "WooCommerce PDF Faktura"
66
 
67
+ #: includes/class-wcpdf-settings.php:199
68
  msgid "General settings"
69
  msgstr "Generelle innstillinger"
70
 
71
+ #: includes/class-wcpdf-settings.php:206
72
  msgid "How do you want to view the PDF?"
73
  msgstr "Hvordan vil du se PDF`en?"
74
 
75
+ #: includes/class-wcpdf-settings.php:214
76
  msgid "Download the PDF"
77
  msgstr "Last ned PDF`en"
78
 
79
+ #: includes/class-wcpdf-settings.php:215
80
  msgid "Open the PDF in a new browser tab/window"
81
  msgstr "Åpne PDF`en i ett nytt vindu"
82
 
83
+ #: includes/class-wcpdf-settings.php:224
84
  msgid "Admin New Order email"
85
  msgstr "Admins Ny Ordre epost"
86
 
87
+ #: includes/class-wcpdf-settings.php:225
88
  msgid "Customer Processing Order email"
89
  msgstr "Kundens Behandler Ordre epost"
90
 
91
+ #: includes/class-wcpdf-settings.php:226
92
  msgid "Customer Completed Order email"
93
  msgstr "Kundens Fullført Ordre epost"
94
 
95
+ #: includes/class-wcpdf-settings.php:227
96
  msgid "Customer Invoice email"
97
  msgstr "Kundens Faktura epost"
98
 
99
+ #: includes/class-wcpdf-settings.php:236
100
  msgid "Attach invoice to:"
101
  msgstr "Legg ved faktura til:"
102
 
103
+ #: includes/class-wcpdf-settings.php:244
104
  #, php-format
105
  msgid ""
106
  "It looks like the temp folder (<code>%s</code>) is not writable, check the "
111
  "skrivbar, sjekk rettighetene på denne mappen! Uten skrivetilgang til denne "
112
  "mappen vil ikke denne plugin kunne sende pdf-faktura."
113
 
114
+ #: includes/class-wcpdf-settings.php:250
115
  msgid "Disable for free products"
116
  msgstr ""
117
 
118
+ #: includes/class-wcpdf-settings.php:257
119
  msgid ""
120
  "Disable automatic creation/attachment of invoices when only free products "
121
  "are ordered"
122
  msgstr ""
123
 
124
+ #: includes/class-wcpdf-settings.php:264
125
  msgid "Interface"
126
  msgstr ""
127
 
128
+ #: includes/class-wcpdf-settings.php:312
129
  msgid "Allow My Account invoice download"
130
  msgstr ""
131
 
132
+ #: includes/class-wcpdf-settings.php:320
133
  msgid "Only when an invoice is already created/emailed"
134
  msgstr ""
135
 
136
+ #: includes/class-wcpdf-settings.php:321
137
  msgid "Only for specific order statuses (define below)"
138
  msgstr ""
139
 
140
+ #: includes/class-wcpdf-settings.php:322
141
  msgid "Always"
142
  msgstr ""
143
 
144
  #: includes/class-wcpdf-settings.php:323
145
+ msgid "Never"
146
+ msgstr ""
147
+
148
+ #: includes/class-wcpdf-settings.php:338
149
  msgid "Enable invoice number column in the orders list"
150
  msgstr "Aktiver kolonne for fakturanummer i ordrelisten"
151
 
152
+ #: includes/class-wcpdf-settings.php:376
153
  msgid "PDF Template settings"
154
  msgstr "PDF Template-innstillinger"
155
 
156
+ #: includes/class-wcpdf-settings.php:388
157
  msgid "Choose a template"
158
  msgstr "Velg din template"
159
 
160
+ #: includes/class-wcpdf-settings.php:396
161
  #, php-format
162
  msgid ""
163
  "Want to use your own template? Copy all the files from <code>%s</code> to "
166
  "Vil du bruke din egen template? Kopier alle filer fra <code>%s</code> til "
167
  "<code>%s</code>for å endre de."
168
 
169
+ #: includes/class-wcpdf-settings.php:402
170
  msgid "Paper size"
171
  msgstr "Papirstørrelse"
172
 
173
+ #: includes/class-wcpdf-settings.php:410
174
  msgid "A4"
175
  msgstr "A4"
176
 
177
+ #: includes/class-wcpdf-settings.php:411
178
  msgid "Letter"
179
  msgstr "Letter"
180
 
181
+ #: includes/class-wcpdf-settings.php:418
182
  msgid "Shop header/logo"
183
  msgstr "Butikkens header/logo"
184
 
185
+ #: includes/class-wcpdf-settings.php:425
186
  msgid "Select or upload your invoice header/logo"
187
  msgstr "Velg eller last opp din faktura header/logo"
188
 
189
+ #: includes/class-wcpdf-settings.php:426
190
  msgid "Set image"
191
  msgstr "Velg bilde"
192
 
193
+ #: includes/class-wcpdf-settings.php:427
194
  msgid "Remove image"
195
  msgstr "Fjern bilde"
196
 
197
+ #: includes/class-wcpdf-settings.php:434
198
  msgid "Shop Name"
199
  msgstr "Butikkens navn"
200
 
201
+ #: includes/class-wcpdf-settings.php:448
202
  msgid "Shop Address"
203
  msgstr "Butikkens adresse"
204
 
205
+ #: includes/class-wcpdf-settings.php:464
206
  msgid "Footer: terms & conditions, policies, etc."
207
  msgstr "Footer: Betingelser og Vilkår"
208
 
209
+ #: includes/class-wcpdf-settings.php:481
210
+ #: includes/class-wcpdf-writepanels.php:286 templates/pdf/Simple/invoice.php:9
211
  #: templates/pdf/Simple/invoice.php:21
212
+ #: woocommerce-pdf-invoices-packingslips.php:226
213
  msgid "Invoice"
214
  msgstr "Faktura"
215
 
216
+ #: includes/class-wcpdf-settings.php:488
217
  msgid "Display shipping address"
218
  msgstr ""
219
 
220
+ #: includes/class-wcpdf-settings.php:495
221
  msgid ""
222
  "Display shipping address on invoice (in addition to the default billing "
223
  "address) if different from billing address"
224
  msgstr ""
225
 
226
+ #: includes/class-wcpdf-settings.php:501 includes/class-wcpdf-settings.php:675
227
  msgid "Display email address"
228
  msgstr ""
229
 
230
+ #: includes/class-wcpdf-settings.php:513 includes/class-wcpdf-settings.php:687
231
  msgid "Display phone number"
232
  msgstr ""
233
 
234
+ #: includes/class-wcpdf-settings.php:525
235
  msgid "Display invoice date"
236
  msgstr "Vis fakturadato"
237
 
238
+ #: includes/class-wcpdf-settings.php:537
239
+ msgid "Invoice numbers are created by a third-party extension."
240
+ msgstr ""
241
+
242
+ #: includes/class-wcpdf-settings.php:540
243
+ #, php-format
244
+ msgid "Configure it <a href=\"%s\">here</a>."
245
+ msgstr ""
246
+
247
+ #: includes/class-wcpdf-settings.php:549
248
+ msgid "Display invoice number"
249
+ msgstr ""
250
+
251
+ #: includes/class-wcpdf-settings.php:549
252
  msgid "Display built-in sequential invoice number"
253
  msgstr "Vis sekvensielt fakturanummer"
254
 
255
+ #: includes/class-wcpdf-settings.php:566
256
  msgid "Next invoice number (without prefix/suffix etc.)"
257
  msgstr "Neste fakturanummer (uten prefix/suffix etc.)"
258
 
259
+ #: includes/class-wcpdf-settings.php:574
260
  msgid ""
261
  "This is the number that will be used on the next invoice that is created. By "
262
  "default, numbering starts from the WooCommerce Order Number of the first "
270
  "dersom du endrer denne og setter et lavere tall enn høyeste (PDF) "
271
  "fakturanummer, vil du få flere fakturaer med samme nummer!"
272
 
273
+ #: includes/class-wcpdf-settings.php:598
274
  msgid "Invoice number format"
275
  msgstr "Format på fakturanummer"
276
 
277
+ #: includes/class-wcpdf-settings.php:607
278
  msgid "Prefix"
279
  msgstr "Prefix"
280
 
281
+ #: includes/class-wcpdf-settings.php:609
282
  msgid ""
283
+ "to use the invoice year and/or month, use [invoice_year] or [invoice_month] "
284
  "respectively"
285
  msgstr ""
 
 
286
 
287
+ #: includes/class-wcpdf-settings.php:612
288
  msgid "Suffix"
289
  msgstr "Suffix"
290
 
291
+ #: includes/class-wcpdf-settings.php:617
292
  msgid "Padding"
293
  msgstr "Siffer"
294
 
295
+ #: includes/class-wcpdf-settings.php:619
296
  msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
297
  msgstr "skriv antall siffer her - skriv \"6\" for å vise 42 som 000042"
298
 
299
+ #: includes/class-wcpdf-settings.php:622
300
  msgid ""
301
  "note: if you have already created a custom invoice number format with a "
302
  "filter, the above settings will be ignored"
304
  "merk: hvis du allerede har laget et eget nummerformat for fakuranummer med "
305
  "et filter, vil innstillingene over bli ignorert"
306
 
307
+ #: includes/class-wcpdf-settings.php:628
308
+ msgid "Reset invoice number yearly"
309
+ msgstr ""
310
+
311
+ #: includes/class-wcpdf-settings.php:641
312
+ msgid "Extended currency symbol support"
313
+ msgstr ""
314
+
315
+ #: includes/class-wcpdf-settings.php:648
316
+ msgid "Enable this if your currency symbol is not displaying properly"
317
+ msgstr ""
318
+
319
+ #: includes/class-wcpdf-settings.php:655
320
  #: templates/pdf/Simple/packing-slip.php:9
321
  #: templates/pdf/Simple/packing-slip.php:21
322
+ #: woocommerce-pdf-invoices-packingslips.php:229
323
  msgid "Packing Slip"
324
  msgstr "Pakkseddel"
325
 
326
+ #: includes/class-wcpdf-settings.php:662
327
  msgid "Display billing address"
328
  msgstr ""
329
 
330
+ #: includes/class-wcpdf-settings.php:669
331
  msgid ""
332
  "Display billing address on packing slip (in addition to the default shipping "
333
  "address) if different from shipping address"
334
  msgstr ""
335
 
336
+ #: includes/class-wcpdf-settings.php:700
337
  msgid "Extra template fields"
338
  msgstr "Ekstrafelt"
339
 
340
+ #: includes/class-wcpdf-settings.php:707
341
  msgid "Extra field 1"
342
  msgstr "Ekstrafelt 1"
343
 
344
+ #: includes/class-wcpdf-settings.php:716
345
  msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
346
  msgstr "Dette er fotnote-kolonne 1 i <i>Modern (Premium)</i> template"
347
 
348
+ #: includes/class-wcpdf-settings.php:723
349
  msgid "Extra field 2"
350
  msgstr "Ekstrafelt 2"
351
 
352
+ #: includes/class-wcpdf-settings.php:732
353
  msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
354
  msgstr "Dette er fotnote-kolonne 2 i <i>Modern (Premium)</i> template"
355
 
356
+ #: includes/class-wcpdf-settings.php:739
357
  msgid "Extra field 3"
358
  msgstr "Ekstrafelt 3"
359
 
360
+ #: includes/class-wcpdf-settings.php:748
361
  msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
362
  msgstr "Dette er fotnote-kolonne 3 i <i>Modern (Premium)</i> template"
363
 
364
+ #: includes/class-wcpdf-settings.php:770
365
  msgid "Debug settings"
366
  msgstr ""
367
 
368
+ #: includes/class-wcpdf-settings.php:777
369
  msgid "Enable debug output"
370
  msgstr ""
371
 
372
+ #: includes/class-wcpdf-settings.php:784
373
  msgid ""
374
  "Enable this option to output plugin errors if you're getting a blank page or "
375
  "other PDF generation issues"
376
  msgstr ""
377
 
378
+ #: includes/class-wcpdf-settings.php:790
379
  msgid "Output to HTML"
380
  msgstr ""
381
 
382
+ #: includes/class-wcpdf-settings.php:797
383
  msgid ""
384
  "Send the template output as HTML to the browser instead of creating a PDF."
385
  msgstr ""
386
 
387
+ #: includes/class-wcpdf-settings.php:803
388
  msgid "Use old tmp folder"
389
  msgstr ""
390
 
391
+ #: includes/class-wcpdf-settings.php:810
392
  msgid ""
393
  "Before version 1.5 of PDF Invoices, temporary files were stored in the "
394
  "plugin folder. This setting is only intended for backwards compatibility, "
395
  "not recommended on new installs!"
396
  msgstr ""
397
 
398
+ #: includes/class-wcpdf-settings.php:1225
399
  msgid "Image resolution"
400
  msgstr "Bildeoppløsning"
401
 
402
+ #: includes/class-wcpdf-settings.php:1341
403
  msgid ""
404
  "<b>Warning!</b> The settings below are meant for debugging/development only. "
405
  "Do not use them on a live website!"
406
  msgstr ""
407
 
408
+ #: includes/class-wcpdf-settings.php:1350
409
  msgid ""
410
  "These are used for the (optional) footer columns in the <em>Modern "
411
  "(Premium)</em> template, but can also be used for other elements in your "
418
  msgid "PDF Packing Slips"
419
  msgstr "PDF Pakksedler"
420
 
421
+ #: includes/class-wcpdf-writepanels.php:120
422
+ #: includes/class-wcpdf-writepanels.php:253
423
  msgid "PDF Invoice"
424
  msgstr "PDF-faktura"
425
 
426
+ #: includes/class-wcpdf-writepanels.php:125
427
+ #: includes/class-wcpdf-writepanels.php:258
428
  msgid "PDF Packing Slip"
429
  msgstr "PDF Pakkseddel"
430
 
431
+ #: includes/class-wcpdf-writepanels.php:152
432
  msgid "Invoice Number"
433
  msgstr "Fakturanummer"
434
 
435
+ #: includes/class-wcpdf-writepanels.php:211
436
  msgid "Download invoice (PDF)"
437
  msgstr "Last ned faktura (PDF)"
438
 
439
+ #: includes/class-wcpdf-writepanels.php:225
440
  msgid "Create PDF"
441
  msgstr "Opprett PDF"
442
 
443
+ #: includes/class-wcpdf-writepanels.php:235
444
+ msgid "PDF Invoice data"
445
+ msgstr ""
446
+
447
+ #: includes/class-wcpdf-writepanels.php:288
448
+ msgid "Invoice Number (unformatted!)"
449
+ msgstr ""
450
 
451
+ #: includes/class-wcpdf-writepanels.php:296 templates/pdf/Simple/invoice.php:55
 
452
  msgid "Invoice Date:"
453
  msgstr "Fakturadato:"
454
 
455
+ #: includes/class-wcpdf-writepanels.php:298
456
+ #: includes/class-wcpdf-writepanels.php:300
457
  msgid "h"
458
  msgstr "h"
459
 
460
+ #: includes/class-wcpdf-writepanels.php:298
461
+ #: includes/class-wcpdf-writepanels.php:300
462
  msgid "m"
463
  msgstr "m"
464
 
561
  msgstr "Automatisk ordreutskrift"
562
 
563
  #: includes/wcpdf-extensions.php:82
564
+ msgid "Advanced, customizable templates"
565
+ msgstr ""
566
 
567
  #: includes/wcpdf-extensions.php:85
568
+ msgid ""
569
+ "Completely customize the invoice contents (prices, taxes, thumbnails) to "
570
+ "your needs with a drag & drop customizer"
571
+ msgstr ""
572
 
573
  #: includes/wcpdf-extensions.php:86
574
+ msgid "Two extra stylish premade templates (Modern & Business)"
575
+ msgstr ""
576
 
577
  #: includes/wcpdf-extensions.php:87
578
  #, php-format
586
  msgid "For custom templates, contact us at %s."
587
  msgstr "For egendefinerte templates, kontakt oss på %s"
588
 
589
+ #: includes/wcpdf-extensions.php:97
590
+ msgid "Hide this message"
591
+ msgstr ""
592
+
593
+ #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
594
  msgid "Billing Address:"
595
  msgstr "Fakturaadresse:"
596
 
602
  msgid "Invoice Number:"
603
  msgstr "Fakturanummer:"
604
 
605
+ #: templates/pdf/Simple/invoice.php:60 templates/pdf/Simple/packing-slip.php:48
 
606
  msgid "Order Number:"
607
  msgstr "Ordrenummer:"
608
 
609
+ #: templates/pdf/Simple/invoice.php:64 templates/pdf/Simple/packing-slip.php:52
 
610
  msgid "Order Date:"
611
  msgstr "Ordredato:"
612
 
614
  msgid "Payment Method:"
615
  msgstr "Betalingsmåte:"
616
 
617
+ #: templates/pdf/Simple/invoice.php:82 templates/pdf/Simple/packing-slip.php:70
 
618
  msgid "Product"
619
  msgstr "Produkt:"
620
 
621
+ #: templates/pdf/Simple/invoice.php:83 templates/pdf/Simple/packing-slip.php:71
 
622
  msgid "Quantity"
623
  msgstr "Antall"
624
 
626
  msgid "Price"
627
  msgstr "Pris"
628
 
629
+ #: templates/pdf/Simple/invoice.php:91 templates/pdf/Simple/packing-slip.php:78
 
630
  msgid "Description"
631
  msgstr "Beskrivelse"
632
 
633
+ #: templates/pdf/Simple/invoice.php:96 templates/pdf/Simple/packing-slip.php:83
 
634
  msgid "SKU"
635
  msgstr "Art.nr"
636
 
637
+ #: templates/pdf/Simple/invoice.php:97 templates/pdf/Simple/packing-slip.php:84
 
638
  msgid "SKU:"
639
  msgstr "Art.nr:"
640
 
641
+ #: templates/pdf/Simple/invoice.php:98 templates/pdf/Simple/packing-slip.php:85
 
642
  msgid "Weight:"
643
  msgstr "Vekt:"
644
 
664
  "WooCommerce PDF Invoices & Packing Slips krever %sWooCommerce%s for å bli "
665
  "installert og aktivert!"
666
 
667
+ #: woocommerce-pdf-invoices-packingslips.php:377
668
+ #: woocommerce-pdf-invoices-packingslips.php:438
669
  msgid "N/A"
670
  msgstr "N/A"
671
 
672
+ #: woocommerce-pdf-invoices-packingslips.php:533
673
  msgid "Payment method"
674
  msgstr "Betalingsmåte"
675
 
676
+ #: woocommerce-pdf-invoices-packingslips.php:552
677
  msgid "Shipping method"
678
  msgstr "Leveringsmåte"
679
 
680
+ #: woocommerce-pdf-invoices-packingslips.php:712
681
+ #, php-format
682
+ msgid "(includes %s)"
683
+ msgstr ""
684
+
685
+ #: woocommerce-pdf-invoices-packingslips.php:715
686
+ #, php-format
687
+ msgid "(Includes %s)"
688
+ msgstr ""
689
+
690
+ #: woocommerce-pdf-invoices-packingslips.php:744
691
  msgid "Subtotal"
692
  msgstr "Total"
693
 
694
+ #: woocommerce-pdf-invoices-packingslips.php:766
695
  msgid "Shipping"
696
  msgstr "Frakt"
697
 
698
+ #: woocommerce-pdf-invoices-packingslips.php:829
699
  msgid "Discount"
700
  msgstr "Avslag"
701
 
702
+ #: woocommerce-pdf-invoices-packingslips.php:870
703
  msgid "VAT"
704
  msgstr "MVA"
705
 
706
+ #: woocommerce-pdf-invoices-packingslips.php:871
707
  msgid "Tax rate"
708
  msgstr "MVA"
709
 
710
+ #: woocommerce-pdf-invoices-packingslips.php:908
711
  msgid "Total ex. VAT"
712
  msgstr "Totalt eksl. MVA"
713
 
714
+ #: woocommerce-pdf-invoices-packingslips.php:911
715
  msgid "Total"
716
  msgstr "Subtotal"
717
 
718
+ #~ msgid ""
719
+ #~ "to use the order year and/or month, use [order_year] or [order_month] "
720
+ #~ "respectively"
721
+ #~ msgstr ""
722
+ #~ "for å bruke år og/eller måned, kan du bruker [order_year] og/eller "
723
+ #~ "[order_month]"
724
+
725
+ #~ msgid "PDF Invoice Number (unformatted!)"
726
+ #~ msgstr "PDF fakturanummer (uformatert)"
727
+
728
+ #~ msgid "More advanced templates"
729
+ #~ msgstr "Mer avanserte stiler"
730
+
731
+ #~ msgid "Stylish modern invoices & packing slips with product thumbnails!"
732
+ #~ msgstr "Stilfylle, moderne faktura og pakkelapper med produktbilder!"
733
+
734
+ #~ msgid "More tax details on the invoices!"
735
+ #~ msgstr "Flere detaljer for skatter og avgifter på faktura!"
736
+
737
  #~ msgid ""
738
  #~ "Attach a <b>static file</b> (for example a terms & conditions document) "
739
  #~ "to the WooCommerce emails of your choice."
languages/wpo_wcpdf-nl_NL.mo CHANGED
Binary file
languages/wpo_wcpdf-nl_NL.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-12-01 17:03+0100\n"
6
- "PO-Revision-Date: 2015-12-01 17:03+0100\n"
7
  "Last-Translator: Ewout Fernhout <chocolade@extrapuur.nl>\n"
8
  "Language-Team: WP Overnight <support@wpovernight.com>\n"
9
  "Language: nl_NL\n"
@@ -16,92 +16,92 @@ msgstr ""
16
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
  "X-Poedit-Basepath: ..\n"
18
  "X-Textdomain-Support: yes\n"
19
- "X-Generator: Poedit 1.8.6\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
 
22
- #: includes/class-wcpdf-export.php:372 includes/class-wcpdf-export.php:386
23
- #: includes/class-wcpdf-export.php:393 includes/class-wcpdf-export.php:401
24
  msgid "You do not have sufficient permissions to access this page."
25
  msgstr "Je hebt onvoldoende rechten voor deze pagina."
26
 
27
- #: includes/class-wcpdf-export.php:377
28
  msgid "Some of the export parameters are missing."
29
  msgstr "Er ontbreken export parameters"
30
 
31
- #: includes/class-wcpdf-export.php:458
32
  msgid "invoice"
33
  msgid_plural "invoices"
34
  msgstr[0] "factuur"
35
  msgstr[1] "facturen"
36
 
37
- #: includes/class-wcpdf-export.php:462
38
  msgid "packing-slip"
39
  msgid_plural "packing-slips"
40
  msgstr[0] "pakbon"
41
  msgstr[1] "pakbonnen"
42
 
43
- #: includes/class-wcpdf-settings.php:34 includes/class-wcpdf-settings.php:35
44
  #: includes/class-wcpdf-writepanels.php:32
45
  msgid "PDF Invoices"
46
  msgstr "PDF facturen"
47
 
48
- #: includes/class-wcpdf-settings.php:76
49
  msgid "Settings"
50
  msgstr "Instellingen"
51
 
52
- #: includes/class-wcpdf-settings.php:98
53
  msgid "General"
54
  msgstr "Algemeen"
55
 
56
- #: includes/class-wcpdf-settings.php:99
57
  msgid "Template"
58
  msgstr "Template"
59
 
60
- #: includes/class-wcpdf-settings.php:104
61
  msgid "Status"
62
  msgstr "Status"
63
 
64
- #: includes/class-wcpdf-settings.php:116
65
  msgid "WooCommerce PDF Invoices"
66
  msgstr "WooCommerce PDF Facturen"
67
 
68
- #: includes/class-wcpdf-settings.php:185
69
  msgid "General settings"
70
  msgstr "Algemene instellingen"
71
 
72
- #: includes/class-wcpdf-settings.php:192
73
  msgid "How do you want to view the PDF?"
74
  msgstr "Hoe wil je de PDF bekijken?"
75
 
76
- #: includes/class-wcpdf-settings.php:200
77
  msgid "Download the PDF"
78
  msgstr "Download de PDF"
79
 
80
- #: includes/class-wcpdf-settings.php:201
81
  msgid "Open the PDF in a new browser tab/window"
82
  msgstr "Open de PDF in een nieuwe browser tab/venster"
83
 
84
- #: includes/class-wcpdf-settings.php:210
85
  msgid "Admin New Order email"
86
  msgstr "Nieuwe bestelling (admin email)"
87
 
88
- #: includes/class-wcpdf-settings.php:211
89
  msgid "Customer Processing Order email"
90
  msgstr "Bestelling in behandeling (klant email)"
91
 
92
- #: includes/class-wcpdf-settings.php:212
93
  msgid "Customer Completed Order email"
94
  msgstr "Bestelling afgerond (klant email)"
95
 
96
- #: includes/class-wcpdf-settings.php:213
97
  msgid "Customer Invoice email"
98
  msgstr "Factuur (klant email)"
99
 
100
- #: includes/class-wcpdf-settings.php:222
101
  msgid "Attach invoice to:"
102
  msgstr "Factuur als bijlage toevoegen aan:"
103
 
104
- #: includes/class-wcpdf-settings.php:230
105
  #, php-format
106
  msgid ""
107
  "It looks like the temp folder (<code>%s</code>) is not writable, check the "
@@ -112,11 +112,11 @@ msgstr ""
112
  "controleer de rechten op deze folder! Zonder schrijfrechten kan de plugin "
113
  "geen facturen emailen."
114
 
115
- #: includes/class-wcpdf-settings.php:236
116
  msgid "Disable for free products"
117
  msgstr "Uitschakelen voor gratis producten"
118
 
119
- #: includes/class-wcpdf-settings.php:243
120
  msgid ""
121
  "Disable automatic creation/attachment of invoices when only free products "
122
  "are ordered"
@@ -124,43 +124,43 @@ msgstr ""
124
  "Automatisch aanmaken/vesturen van facturen uitschakelen wanneer er alleen "
125
  "gratis producten zijn besteld."
126
 
127
- #: includes/class-wcpdf-settings.php:250
128
  msgid "Interface"
129
  msgstr "Interface"
130
 
131
- #: includes/class-wcpdf-settings.php:298
132
  msgid "Allow My Account invoice download"
133
  msgstr "Sta downloaden factuur vanaf Mijn Account toe"
134
 
135
- #: includes/class-wcpdf-settings.php:306
136
  msgid "Only when an invoice is already created/emailed"
137
  msgstr "Alleen wanneer een factuur al is aangemaakt/gemaild"
138
 
139
- #: includes/class-wcpdf-settings.php:307
140
  msgid "Only for specific order statuses (define below)"
141
  msgstr "Alleen voor specifieke order statussen (hieronder gedefinieerd)"
142
 
143
- #: includes/class-wcpdf-settings.php:308
144
  msgid "Always"
145
  msgstr "Altijd"
146
 
147
- #: includes/class-wcpdf-settings.php:309
148
  msgid "Never"
149
  msgstr "Nooit"
150
 
151
- #: includes/class-wcpdf-settings.php:324
152
  msgid "Enable invoice number column in the orders list"
153
  msgstr "Schakel factuurnummer kolom in het bestellingen overzicht in"
154
 
155
- #: includes/class-wcpdf-settings.php:362
156
  msgid "PDF Template settings"
157
  msgstr "PDF Template instellingen"
158
 
159
- #: includes/class-wcpdf-settings.php:374
160
  msgid "Choose a template"
161
  msgstr "Kies een template"
162
 
163
- #: includes/class-wcpdf-settings.php:382
164
  #, php-format
165
  msgid ""
166
  "Want to use your own template? Copy all the files from <code>%s</code> to "
@@ -169,58 +169,58 @@ msgstr ""
169
  "Wil je je eigen template gebruiken? Kopieer alle bestanden van <code>%s</"
170
  "code> naar je (child-) theme in <code>%s</code> en pas ze aan naar je wensen."
171
 
172
- #: includes/class-wcpdf-settings.php:388
173
  msgid "Paper size"
174
  msgstr "Papierformaat"
175
 
176
- #: includes/class-wcpdf-settings.php:396
177
  msgid "A4"
178
  msgstr "A4"
179
 
180
- #: includes/class-wcpdf-settings.php:397
181
  msgid "Letter"
182
  msgstr "Letter (US)"
183
 
184
- #: includes/class-wcpdf-settings.php:404
185
  msgid "Shop header/logo"
186
  msgstr "Shop header/logo"
187
 
188
- #: includes/class-wcpdf-settings.php:411
189
  msgid "Select or upload your invoice header/logo"
190
  msgstr "Selecteer of upload je factuur header/logo"
191
 
192
- #: includes/class-wcpdf-settings.php:412
193
  msgid "Set image"
194
  msgstr "Stel afbeelding in"
195
 
196
- #: includes/class-wcpdf-settings.php:413
197
  msgid "Remove image"
198
  msgstr "Verwijder afbeelding"
199
 
200
- #: includes/class-wcpdf-settings.php:420
201
  msgid "Shop Name"
202
  msgstr "Shop Naam"
203
 
204
- #: includes/class-wcpdf-settings.php:434
205
  msgid "Shop Address"
206
  msgstr "Shop Adres"
207
 
208
- #: includes/class-wcpdf-settings.php:450
209
  msgid "Footer: terms & conditions, policies, etc."
210
  msgstr "Voettekst: algemene voorwaarden, retourenbeleid, etc."
211
 
212
- #: includes/class-wcpdf-settings.php:467
213
- #: includes/class-wcpdf-writepanels.php:285 templates/pdf/Simple/invoice.php:9
214
  #: templates/pdf/Simple/invoice.php:21
215
- #: woocommerce-pdf-invoices-packingslips.php:220
216
  msgid "Invoice"
217
  msgstr "Factuur"
218
 
219
- #: includes/class-wcpdf-settings.php:474
220
  msgid "Display shipping address"
221
  msgstr "Geef verzendadres weer"
222
 
223
- #: includes/class-wcpdf-settings.php:481
224
  msgid ""
225
  "Display shipping address on invoice (in addition to the default billing "
226
  "address) if different from billing address"
@@ -228,27 +228,40 @@ msgstr ""
228
  "Geef verzendadres weer op de factuur (naast het standaard factuuradres) "
229
  "wanneer deze verschilt van het factuuradres"
230
 
231
- #: includes/class-wcpdf-settings.php:487 includes/class-wcpdf-settings.php:614
232
  msgid "Display email address"
233
  msgstr "Geef email adres weer"
234
 
235
- #: includes/class-wcpdf-settings.php:499 includes/class-wcpdf-settings.php:626
236
  msgid "Display phone number"
237
  msgstr "Geef telefoonnummer weer"
238
 
239
- #: includes/class-wcpdf-settings.php:511
240
  msgid "Display invoice date"
241
  msgstr "Geef factuurdatum weer"
242
 
243
- #: includes/class-wcpdf-settings.php:524
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  msgid "Display built-in sequential invoice number"
245
  msgstr "Geef ingebouwde doorlopende factuurnummers weer"
246
 
247
- #: includes/class-wcpdf-settings.php:537
248
  msgid "Next invoice number (without prefix/suffix etc.)"
249
  msgstr "Volgend factuurnummer (zonder voor- of achtervoegsel etc.)"
250
 
251
- #: includes/class-wcpdf-settings.php:545
252
  msgid ""
253
  "This is the number that will be used on the next invoice that is created. By "
254
  "default, numbering starts from the WooCommerce Order Number of the first "
@@ -263,37 +276,37 @@ msgstr ""
263
  "hoogste huidige (PDF) factuurnummer zet, kan dit dubbele factuurnummers tot "
264
  "gevolg hebben!"
265
 
266
- #: includes/class-wcpdf-settings.php:551
267
  msgid "Invoice number format"
268
  msgstr "Factuurnummer format"
269
 
270
- #: includes/class-wcpdf-settings.php:560
271
  msgid "Prefix"
272
  msgstr "Voorvoegsel"
273
 
274
- #: includes/class-wcpdf-settings.php:562
275
  msgid ""
276
- "to use the order year and/or month, use [order_year] or [order_month] "
277
  "respectively"
278
  msgstr ""
279
- "gebruik [order_year] of [order_month] om het order jaar en/of maand te weer "
280
- "te geven"
281
 
282
- #: includes/class-wcpdf-settings.php:565
283
  msgid "Suffix"
284
  msgstr "Achtervoegsel"
285
 
286
- #: includes/class-wcpdf-settings.php:570
287
  msgid "Padding"
288
  msgstr "Vulling"
289
 
290
- #: includes/class-wcpdf-settings.php:572
291
  msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
292
  msgstr ""
293
  "voer hier het aantal cijfers in - vul hier \"6\" in om 42 als 000042 weer te "
294
  "geven"
295
 
296
- #: includes/class-wcpdf-settings.php:575
297
  msgid ""
298
  "note: if you have already created a custom invoice number format with a "
299
  "filter, the above settings will be ignored"
@@ -301,22 +314,32 @@ msgstr ""
301
  "let op: als je al een format voor een factuurnummer hebt gemaakt met een "
302
  "filter, worden de bovenstaande instellingen genegeerd"
303
 
304
- #: includes/class-wcpdf-settings.php:581
305
  msgid "Reset invoice number yearly"
306
  msgstr "Reset factuurnummer jaarlijks"
307
 
308
- #: includes/class-wcpdf-settings.php:594
 
 
 
 
 
 
 
 
 
 
309
  #: templates/pdf/Simple/packing-slip.php:9
310
  #: templates/pdf/Simple/packing-slip.php:21
311
- #: woocommerce-pdf-invoices-packingslips.php:223
312
  msgid "Packing Slip"
313
  msgstr "Pakbon"
314
 
315
- #: includes/class-wcpdf-settings.php:601
316
  msgid "Display billing address"
317
  msgstr "Geef factuuradres weer"
318
 
319
- #: includes/class-wcpdf-settings.php:608
320
  msgid ""
321
  "Display billing address on packing slip (in addition to the default shipping "
322
  "address) if different from shipping address"
@@ -324,43 +347,43 @@ msgstr ""
324
  "Geef factuuradres weer op de pakbon (naast het standaard verzendadres) "
325
  "wanneer deze verschilt van het verzendadres"
326
 
327
- #: includes/class-wcpdf-settings.php:639
328
  msgid "Extra template fields"
329
  msgstr "Extra templatevelden"
330
 
331
- #: includes/class-wcpdf-settings.php:646
332
  msgid "Extra field 1"
333
  msgstr "Extra veld 1"
334
 
335
- #: includes/class-wcpdf-settings.php:655
336
  msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
337
  msgstr "Dit is voettekst kolom 1 in het <i>Modern (Premium)</i> template"
338
 
339
- #: includes/class-wcpdf-settings.php:662
340
  msgid "Extra field 2"
341
  msgstr "Extra veld 2"
342
 
343
- #: includes/class-wcpdf-settings.php:671
344
  msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
345
  msgstr "Dit is voettekst kolom 2 in het <i>Modern (Premium)</i> template"
346
 
347
- #: includes/class-wcpdf-settings.php:678
348
  msgid "Extra field 3"
349
  msgstr "Extra veld 3"
350
 
351
- #: includes/class-wcpdf-settings.php:687
352
  msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
353
  msgstr "Dit is voettekst kolom 3 in het <i>Modern (Premium)</i> template"
354
 
355
- #: includes/class-wcpdf-settings.php:730
356
  msgid "Debug settings"
357
  msgstr "Debug instellingen"
358
 
359
- #: includes/class-wcpdf-settings.php:737
360
  msgid "Enable debug output"
361
  msgstr "Debug uitvoer inschakelen"
362
 
363
- #: includes/class-wcpdf-settings.php:744
364
  msgid ""
365
  "Enable this option to output plugin errors if you're getting a blank page or "
366
  "other PDF generation issues"
@@ -368,22 +391,22 @@ msgstr ""
368
  "Schakel deze optie in om pluginfouten weer te geven, wanneer je een lege "
369
  "pagina krijgt of andere problemen hebt met het genereren van PDF."
370
 
371
- #: includes/class-wcpdf-settings.php:750
372
  msgid "Output to HTML"
373
  msgstr "Uitvoer naar HTML"
374
 
375
- #: includes/class-wcpdf-settings.php:757
376
  msgid ""
377
  "Send the template output as HTML to the browser instead of creating a PDF."
378
  msgstr ""
379
  "Stuur de uitvoer van de template als HTML naar de browser in plaats van een "
380
  "PDF."
381
 
382
- #: includes/class-wcpdf-settings.php:763
383
  msgid "Use old tmp folder"
384
  msgstr "Gebruik de oude tmp folder"
385
 
386
- #: includes/class-wcpdf-settings.php:770
387
  msgid ""
388
  "Before version 1.5 of PDF Invoices, temporary files were stored in the "
389
  "plugin folder. This setting is only intended for backwards compatibility, "
@@ -393,11 +416,11 @@ msgstr ""
393
  "de plugin map. Deze instelling is enkel bedoelde voor backwards "
394
  "compatibiliteit, en niet aanbevolen op nieuwe installaties!"
395
 
396
- #: includes/class-wcpdf-settings.php:1143
397
  msgid "Image resolution"
398
  msgstr "Afbeeldings resolutie"
399
 
400
- #: includes/class-wcpdf-settings.php:1259
401
  msgid ""
402
  "<b>Warning!</b> The settings below are meant for debugging/development only. "
403
  "Do not use them on a live website!"
@@ -405,7 +428,7 @@ msgstr ""
405
  "<b>Waarschuwing!</b> Onderstaande instellingen zijn enkel bedoeld om fouten "
406
  "op te sporen of om te testen. Gebruik ze niet op een live website!"
407
 
408
- #: includes/class-wcpdf-settings.php:1268
409
  msgid ""
410
  "These are used for the (optional) footer columns in the <em>Modern "
411
  "(Premium)</em> template, but can also be used for other elements in your "
@@ -419,45 +442,47 @@ msgstr ""
419
  msgid "PDF Packing Slips"
420
  msgstr "PDF Pakbonnen"
421
 
422
- #: includes/class-wcpdf-writepanels.php:119
423
- #: includes/class-wcpdf-writepanels.php:252
424
  msgid "PDF Invoice"
425
  msgstr "PDF factuur"
426
 
427
- #: includes/class-wcpdf-writepanels.php:124
428
- #: includes/class-wcpdf-writepanels.php:257
429
  msgid "PDF Packing Slip"
430
  msgstr "PDF Pakbon"
431
 
432
- #: includes/class-wcpdf-writepanels.php:151
433
  msgid "Invoice Number"
434
  msgstr "Factuurnummer"
435
 
436
- #: includes/class-wcpdf-writepanels.php:210
437
  msgid "Download invoice (PDF)"
438
  msgstr "Download factuur (PDF)"
439
 
440
- #: includes/class-wcpdf-writepanels.php:224
441
  msgid "Create PDF"
442
  msgstr "Maak PDF"
443
 
444
- #: includes/class-wcpdf-writepanels.php:234
445
  msgid "PDF Invoice data"
446
  msgstr "PDF Factuur gegevens"
447
 
448
- #: includes/class-wcpdf-writepanels.php:287
449
  msgid "Invoice Number (unformatted!)"
450
  msgstr "Factuurnummer (zonder formatting!)"
451
 
452
- #: includes/class-wcpdf-writepanels.php:295 templates/pdf/Simple/invoice.php:55
453
  msgid "Invoice Date:"
454
  msgstr "Factuurdatum:"
455
 
456
- #: includes/class-wcpdf-writepanels.php:297
 
457
  msgid "h"
458
  msgstr "u"
459
 
460
- #: includes/class-wcpdf-writepanels.php:297
 
461
  msgid "m"
462
  msgstr "m"
463
 
@@ -469,23 +494,31 @@ msgstr "Bekijk deze premium uitbreidingen!"
469
  msgid "click items to read more"
470
  msgstr "Klik op de items om meer te lezen"
471
 
472
- #: includes/wcpdf-extensions.php:23
473
- msgid "Go Pro: Proforma invoices, credit notes (=refunds) & more!"
474
- msgstr "Go Pro: Pro-forma facturen, credit nota's (=refunds) & meer!"
 
 
 
 
475
 
476
- #: includes/wcpdf-extensions.php:25
477
  msgid ""
478
- "Supercharge WooCommerce PDF Invoices & Packing Slips with the following "
479
- "features:"
480
  msgstr ""
481
- "Geef WooCommerce PDF Invoices & Packing Slips een boost met de volgende "
482
- "functies:"
483
 
484
- #: includes/wcpdf-extensions.php:27
 
 
 
 
485
  msgid "Email/print/download <b>PDF Credit Notes & Proforma invoices</b>"
486
  msgstr "Email/print/download <b>PDF Credit Nota's & Pro-forma facturen</b>"
487
 
488
- #: includes/wcpdf-extensions.php:28
489
  msgid ""
490
  "Send out a separate <b>notification email</b> with (or without) PDF invoices/"
491
  "packing slips, for example to a drop-shipper or a supplier."
@@ -493,7 +526,7 @@ msgstr ""
493
  "Verstuur een aparte <b>notificatie email</b> met (of zonder) PDF facturen/"
494
  "pakbonnen, bijvoorbeeld naar een drop-shipper of een leverancier."
495
 
496
- #: includes/wcpdf-extensions.php:29
497
  msgid ""
498
  "Attach <b>up to 3 static files</b> (for example a terms & conditions "
499
  "document) to the WooCommerce emails of your choice."
@@ -501,7 +534,7 @@ msgstr ""
501
  "Voeg tot <b>3 vaste bestandsbijlagen</b> (bijvoorbeeld algemene voorwaarden) "
502
  "toe aan WooCommerce emails naar keuze."
503
 
504
- #: includes/wcpdf-extensions.php:30
505
  msgid ""
506
  "Use <b>separate numbering systems</b> and/or format for proforma invoices "
507
  "and credit notes or utilize the main invoice numbering system"
@@ -509,7 +542,7 @@ msgstr ""
509
  "Gebruik <b>losse nummersystemen</b> en/of formats voor pro-forma facturen en "
510
  "credit notes, of gebruik het hoofd factuurnummersysteem."
511
 
512
- #: includes/wcpdf-extensions.php:31
513
  msgid ""
514
  "<b>Customize</b> the <b>shipping & billing address</b> format to include "
515
  "additional custom fields, font sizes etc. without the need to create a "
@@ -518,19 +551,31 @@ msgstr ""
518
  "<b>Pas het verzend- en factuuradres aan</b> met custom velden, verschillende "
519
  "fontgroottes etc, zonder daarvoor een custom template aan te maken."
520
 
521
- #: includes/wcpdf-extensions.php:32
522
  msgid "Use the plugin in multilingual <b>WPML</b> setups"
523
  msgstr "Gebruik de plugin in meertalige <b>WPML</b> setups"
524
 
525
- #: includes/wcpdf-extensions.php:34
526
- msgid "Get WooCommerce PDF Invoices & Packing Slips Professional!"
527
- msgstr "Neem WooCommerce PDF Invoices & Packing Slips Professional!"
528
 
529
- #: includes/wcpdf-extensions.php:42
530
- msgid "Upload all invoices automatically to your dropbox"
531
- msgstr "Upload alle facturen automatisch naar je Dropbox"
 
 
 
 
 
 
 
 
 
 
 
 
532
 
533
- #: includes/wcpdf-extensions.php:48
534
  msgid ""
535
  "This extension conveniently uploads all the invoices (and other pdf "
536
  "documents from the professional extension) that are emailed to your "
@@ -541,11 +586,88 @@ msgstr ""
541
  "professional extensie) die worden ge-emaild naar je klanten naar Dropbox. De "
542
  "beste manier om je factuur administratie up te date te houden!"
543
 
544
- #: includes/wcpdf-extensions.php:49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  msgid "Get WooCommerce PDF Invoices & Packing Slips to dropbox!"
546
  msgstr "Neem WooCommerce PDF Invoices & Packing Slips to dropbox!"
547
 
548
- #: includes/wcpdf-extensions.php:61
549
  msgid ""
550
  "Automatically send new orders or packing slips to your printer, as soon as "
551
  "the customer orders!"
@@ -553,7 +675,7 @@ msgstr ""
553
  "Verstuur nieuwe orders of pakbonnen automatisch naar je printer, zodra een "
554
  "klant een bestelling plaatst."
555
 
556
- #: includes/wcpdf-extensions.php:67
557
  msgid ""
558
  "Check out the WooCommerce Automatic Order Printing extension from our "
559
  "partners at Simba Hosting"
@@ -561,36 +683,24 @@ msgstr ""
561
  "Bekijk de WooCommerce Automatic Order Printing extensie van onze parters van "
562
  "Simba Hosting"
563
 
564
- #: includes/wcpdf-extensions.php:68
565
  msgid "WooCommerce Automatic Order Printing"
566
  msgstr "WooCommerce Automatic Order Printing"
567
 
568
- #: includes/wcpdf-extensions.php:82
569
- msgid "Advanced, customizable templates"
570
- msgstr "Geavanceerde, aanpasbare templates"
571
-
572
- #: includes/wcpdf-extensions.php:85
573
- msgid ""
574
- "Completely customize the invoice contents (prices, taxes, thumbnails) to "
575
- "your needs with a drag & drop customizer"
576
- msgstr ""
577
- "Past de inhoud van de factuur (prijzen, BTW, thumbnails) volledig naar je "
578
- "wensen aan met een eenvoudige drag & drop interface"
579
-
580
- #: includes/wcpdf-extensions.php:86
581
- msgid "Two extra stylish premade templates (Modern & Business)"
582
- msgstr "Twee extra stijlvolle voorgeconfigureerde templates (Moden & Business)"
583
-
584
- #: includes/wcpdf-extensions.php:87
585
  #, php-format
586
  msgid "Check out the Premium PDF Invoice & Packing Slips templates at %s."
587
  msgstr "Bekijk de Premium PDF Invoice & Packing Slips templates op %s."
588
 
589
- #: includes/wcpdf-extensions.php:88
590
  #, php-format
591
  msgid "For custom templates, contact us at %s."
592
  msgstr "Neem voor custom templates contact met ons op via %s"
593
 
 
 
 
 
594
  #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
595
  msgid "Billing Address:"
596
  msgstr "Factuuradres:"
@@ -665,52 +775,64 @@ msgstr ""
665
  "WooCommerce PDF Invoices & Packing Slips vereist dat %sWooCommerce%s is "
666
  "geïnstalleerd & geactiveerd!"
667
 
668
- #: woocommerce-pdf-invoices-packingslips.php:367
669
- #: woocommerce-pdf-invoices-packingslips.php:428
670
  msgid "N/A"
671
  msgstr "N/A"
672
 
673
- #: woocommerce-pdf-invoices-packingslips.php:523
674
  msgid "Payment method"
675
  msgstr "Betaalmethode"
676
 
677
- #: woocommerce-pdf-invoices-packingslips.php:534
678
  msgid "Shipping method"
679
  msgstr "Verzendmethode"
680
 
681
- #: woocommerce-pdf-invoices-packingslips.php:693
 
 
 
 
 
682
  #, php-format
683
  msgid "(Includes %s)"
684
  msgstr ""
685
 
686
- #: woocommerce-pdf-invoices-packingslips.php:714
687
  msgid "Subtotal"
688
  msgstr "Subtotaal"
689
 
690
- #: woocommerce-pdf-invoices-packingslips.php:736
691
  msgid "Shipping"
692
  msgstr "Verzendkosten"
693
 
694
- #: woocommerce-pdf-invoices-packingslips.php:799
695
  msgid "Discount"
696
  msgstr "Korting"
697
 
698
- #: woocommerce-pdf-invoices-packingslips.php:839
699
  msgid "VAT"
700
  msgstr "BTW"
701
 
702
- #: woocommerce-pdf-invoices-packingslips.php:840
703
  msgid "Tax rate"
704
  msgstr "BTW tarief"
705
 
706
- #: woocommerce-pdf-invoices-packingslips.php:877
707
  msgid "Total ex. VAT"
708
  msgstr "Totaal excl. BTW"
709
 
710
- #: woocommerce-pdf-invoices-packingslips.php:880
711
  msgid "Total"
712
  msgstr "Totaal"
713
 
 
 
 
 
 
 
 
714
  #~ msgid "PDF Invoice Number (unformatted!)"
715
  #~ msgstr "PDF Factuurnummer (zonder formatting!)"
716
 
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-11-07 17:00+0100\n"
6
+ "PO-Revision-Date: 2016-11-07 17:10+0100\n"
7
  "Last-Translator: Ewout Fernhout <chocolade@extrapuur.nl>\n"
8
  "Language-Team: WP Overnight <support@wpovernight.com>\n"
9
  "Language: nl_NL\n"
16
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
  "X-Poedit-Basepath: ..\n"
18
  "X-Textdomain-Support: yes\n"
19
+ "X-Generator: Poedit 1.8.9\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
 
22
+ #: includes/class-wcpdf-export.php:418 includes/class-wcpdf-export.php:432
23
+ #: includes/class-wcpdf-export.php:439 includes/class-wcpdf-export.php:447
24
  msgid "You do not have sufficient permissions to access this page."
25
  msgstr "Je hebt onvoldoende rechten voor deze pagina."
26
 
27
+ #: includes/class-wcpdf-export.php:423
28
  msgid "Some of the export parameters are missing."
29
  msgstr "Er ontbreken export parameters"
30
 
31
+ #: includes/class-wcpdf-export.php:504
32
  msgid "invoice"
33
  msgid_plural "invoices"
34
  msgstr[0] "factuur"
35
  msgstr[1] "facturen"
36
 
37
+ #: includes/class-wcpdf-export.php:508
38
  msgid "packing-slip"
39
  msgid_plural "packing-slips"
40
  msgstr[0] "pakbon"
41
  msgstr[1] "pakbonnen"
42
 
43
+ #: includes/class-wcpdf-settings.php:37 includes/class-wcpdf-settings.php:38
44
  #: includes/class-wcpdf-writepanels.php:32
45
  msgid "PDF Invoices"
46
  msgstr "PDF facturen"
47
 
48
+ #: includes/class-wcpdf-settings.php:79
49
  msgid "Settings"
50
  msgstr "Instellingen"
51
 
52
+ #: includes/class-wcpdf-settings.php:101
53
  msgid "General"
54
  msgstr "Algemeen"
55
 
56
+ #: includes/class-wcpdf-settings.php:102
57
  msgid "Template"
58
  msgstr "Template"
59
 
60
+ #: includes/class-wcpdf-settings.php:107
61
  msgid "Status"
62
  msgstr "Status"
63
 
64
+ #: includes/class-wcpdf-settings.php:119
65
  msgid "WooCommerce PDF Invoices"
66
  msgstr "WooCommerce PDF Facturen"
67
 
68
+ #: includes/class-wcpdf-settings.php:199
69
  msgid "General settings"
70
  msgstr "Algemene instellingen"
71
 
72
+ #: includes/class-wcpdf-settings.php:206
73
  msgid "How do you want to view the PDF?"
74
  msgstr "Hoe wil je de PDF bekijken?"
75
 
76
+ #: includes/class-wcpdf-settings.php:214
77
  msgid "Download the PDF"
78
  msgstr "Download de PDF"
79
 
80
+ #: includes/class-wcpdf-settings.php:215
81
  msgid "Open the PDF in a new browser tab/window"
82
  msgstr "Open de PDF in een nieuwe browser tab/venster"
83
 
84
+ #: includes/class-wcpdf-settings.php:224
85
  msgid "Admin New Order email"
86
  msgstr "Nieuwe bestelling (admin email)"
87
 
88
+ #: includes/class-wcpdf-settings.php:225
89
  msgid "Customer Processing Order email"
90
  msgstr "Bestelling in behandeling (klant email)"
91
 
92
+ #: includes/class-wcpdf-settings.php:226
93
  msgid "Customer Completed Order email"
94
  msgstr "Bestelling afgerond (klant email)"
95
 
96
+ #: includes/class-wcpdf-settings.php:227
97
  msgid "Customer Invoice email"
98
  msgstr "Factuur (klant email)"
99
 
100
+ #: includes/class-wcpdf-settings.php:236
101
  msgid "Attach invoice to:"
102
  msgstr "Factuur als bijlage toevoegen aan:"
103
 
104
+ #: includes/class-wcpdf-settings.php:244
105
  #, php-format
106
  msgid ""
107
  "It looks like the temp folder (<code>%s</code>) is not writable, check the "
112
  "controleer de rechten op deze folder! Zonder schrijfrechten kan de plugin "
113
  "geen facturen emailen."
114
 
115
+ #: includes/class-wcpdf-settings.php:250
116
  msgid "Disable for free products"
117
  msgstr "Uitschakelen voor gratis producten"
118
 
119
+ #: includes/class-wcpdf-settings.php:257
120
  msgid ""
121
  "Disable automatic creation/attachment of invoices when only free products "
122
  "are ordered"
124
  "Automatisch aanmaken/vesturen van facturen uitschakelen wanneer er alleen "
125
  "gratis producten zijn besteld."
126
 
127
+ #: includes/class-wcpdf-settings.php:264
128
  msgid "Interface"
129
  msgstr "Interface"
130
 
131
+ #: includes/class-wcpdf-settings.php:312
132
  msgid "Allow My Account invoice download"
133
  msgstr "Sta downloaden factuur vanaf Mijn Account toe"
134
 
135
+ #: includes/class-wcpdf-settings.php:320
136
  msgid "Only when an invoice is already created/emailed"
137
  msgstr "Alleen wanneer een factuur al is aangemaakt/gemaild"
138
 
139
+ #: includes/class-wcpdf-settings.php:321
140
  msgid "Only for specific order statuses (define below)"
141
  msgstr "Alleen voor specifieke order statussen (hieronder gedefinieerd)"
142
 
143
+ #: includes/class-wcpdf-settings.php:322
144
  msgid "Always"
145
  msgstr "Altijd"
146
 
147
+ #: includes/class-wcpdf-settings.php:323
148
  msgid "Never"
149
  msgstr "Nooit"
150
 
151
+ #: includes/class-wcpdf-settings.php:338
152
  msgid "Enable invoice number column in the orders list"
153
  msgstr "Schakel factuurnummer kolom in het bestellingen overzicht in"
154
 
155
+ #: includes/class-wcpdf-settings.php:376
156
  msgid "PDF Template settings"
157
  msgstr "PDF Template instellingen"
158
 
159
+ #: includes/class-wcpdf-settings.php:388
160
  msgid "Choose a template"
161
  msgstr "Kies een template"
162
 
163
+ #: includes/class-wcpdf-settings.php:396
164
  #, php-format
165
  msgid ""
166
  "Want to use your own template? Copy all the files from <code>%s</code> to "
169
  "Wil je je eigen template gebruiken? Kopieer alle bestanden van <code>%s</"
170
  "code> naar je (child-) theme in <code>%s</code> en pas ze aan naar je wensen."
171
 
172
+ #: includes/class-wcpdf-settings.php:402
173
  msgid "Paper size"
174
  msgstr "Papierformaat"
175
 
176
+ #: includes/class-wcpdf-settings.php:410
177
  msgid "A4"
178
  msgstr "A4"
179
 
180
+ #: includes/class-wcpdf-settings.php:411
181
  msgid "Letter"
182
  msgstr "Letter (US)"
183
 
184
+ #: includes/class-wcpdf-settings.php:418
185
  msgid "Shop header/logo"
186
  msgstr "Shop header/logo"
187
 
188
+ #: includes/class-wcpdf-settings.php:425
189
  msgid "Select or upload your invoice header/logo"
190
  msgstr "Selecteer of upload je factuur header/logo"
191
 
192
+ #: includes/class-wcpdf-settings.php:426
193
  msgid "Set image"
194
  msgstr "Stel afbeelding in"
195
 
196
+ #: includes/class-wcpdf-settings.php:427
197
  msgid "Remove image"
198
  msgstr "Verwijder afbeelding"
199
 
200
+ #: includes/class-wcpdf-settings.php:434
201
  msgid "Shop Name"
202
  msgstr "Shop Naam"
203
 
204
+ #: includes/class-wcpdf-settings.php:448
205
  msgid "Shop Address"
206
  msgstr "Shop Adres"
207
 
208
+ #: includes/class-wcpdf-settings.php:464
209
  msgid "Footer: terms & conditions, policies, etc."
210
  msgstr "Voettekst: algemene voorwaarden, retourenbeleid, etc."
211
 
212
+ #: includes/class-wcpdf-settings.php:481
213
+ #: includes/class-wcpdf-writepanels.php:286 templates/pdf/Simple/invoice.php:9
214
  #: templates/pdf/Simple/invoice.php:21
215
+ #: woocommerce-pdf-invoices-packingslips.php:226
216
  msgid "Invoice"
217
  msgstr "Factuur"
218
 
219
+ #: includes/class-wcpdf-settings.php:488
220
  msgid "Display shipping address"
221
  msgstr "Geef verzendadres weer"
222
 
223
+ #: includes/class-wcpdf-settings.php:495
224
  msgid ""
225
  "Display shipping address on invoice (in addition to the default billing "
226
  "address) if different from billing address"
228
  "Geef verzendadres weer op de factuur (naast het standaard factuuradres) "
229
  "wanneer deze verschilt van het factuuradres"
230
 
231
+ #: includes/class-wcpdf-settings.php:501 includes/class-wcpdf-settings.php:675
232
  msgid "Display email address"
233
  msgstr "Geef email adres weer"
234
 
235
+ #: includes/class-wcpdf-settings.php:513 includes/class-wcpdf-settings.php:687
236
  msgid "Display phone number"
237
  msgstr "Geef telefoonnummer weer"
238
 
239
+ #: includes/class-wcpdf-settings.php:525
240
  msgid "Display invoice date"
241
  msgstr "Geef factuurdatum weer"
242
 
243
+ #: includes/class-wcpdf-settings.php:537
244
+ msgid "Invoice numbers are created by a third-party extension."
245
+ msgstr "Factuurnummers zijn gemaakt door een derde-partij uitbreiding."
246
+
247
+ #: includes/class-wcpdf-settings.php:540
248
+ #, php-format
249
+ msgid "Configure it <a href=\"%s\">here</a>."
250
+ msgstr "Configureer het <a href=\"%s\">hier</a>."
251
+
252
+ #: includes/class-wcpdf-settings.php:549
253
+ msgid "Display invoice number"
254
+ msgstr "Geef factuurnummer weer"
255
+
256
+ #: includes/class-wcpdf-settings.php:549
257
  msgid "Display built-in sequential invoice number"
258
  msgstr "Geef ingebouwde doorlopende factuurnummers weer"
259
 
260
+ #: includes/class-wcpdf-settings.php:566
261
  msgid "Next invoice number (without prefix/suffix etc.)"
262
  msgstr "Volgend factuurnummer (zonder voor- of achtervoegsel etc.)"
263
 
264
+ #: includes/class-wcpdf-settings.php:574
265
  msgid ""
266
  "This is the number that will be used on the next invoice that is created. By "
267
  "default, numbering starts from the WooCommerce Order Number of the first "
276
  "hoogste huidige (PDF) factuurnummer zet, kan dit dubbele factuurnummers tot "
277
  "gevolg hebben!"
278
 
279
+ #: includes/class-wcpdf-settings.php:598
280
  msgid "Invoice number format"
281
  msgstr "Factuurnummer format"
282
 
283
+ #: includes/class-wcpdf-settings.php:607
284
  msgid "Prefix"
285
  msgstr "Voorvoegsel"
286
 
287
+ #: includes/class-wcpdf-settings.php:609
288
  msgid ""
289
+ "to use the invoice year and/or month, use [invoice_year] or [invoice_month] "
290
  "respectively"
291
  msgstr ""
292
+ "om de factuur jaar en/of maand te gebruiken, gebruik respectievelijk "
293
+ "[invoice_year] en [invoice_month]"
294
 
295
+ #: includes/class-wcpdf-settings.php:612
296
  msgid "Suffix"
297
  msgstr "Achtervoegsel"
298
 
299
+ #: includes/class-wcpdf-settings.php:617
300
  msgid "Padding"
301
  msgstr "Vulling"
302
 
303
+ #: includes/class-wcpdf-settings.php:619
304
  msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
305
  msgstr ""
306
  "voer hier het aantal cijfers in - vul hier \"6\" in om 42 als 000042 weer te "
307
  "geven"
308
 
309
+ #: includes/class-wcpdf-settings.php:622
310
  msgid ""
311
  "note: if you have already created a custom invoice number format with a "
312
  "filter, the above settings will be ignored"
314
  "let op: als je al een format voor een factuurnummer hebt gemaakt met een "
315
  "filter, worden de bovenstaande instellingen genegeerd"
316
 
317
+ #: includes/class-wcpdf-settings.php:628
318
  msgid "Reset invoice number yearly"
319
  msgstr "Reset factuurnummer jaarlijks"
320
 
321
+ #: includes/class-wcpdf-settings.php:641
322
+ msgid "Extended currency symbol support"
323
+ msgstr "Uitgebreide support voor munteenheid symbolen"
324
+
325
+ #: includes/class-wcpdf-settings.php:648
326
+ msgid "Enable this if your currency symbol is not displaying properly"
327
+ msgstr ""
328
+ "Schakel deze optie in wanneer het symbool van jouw munteenheid niet goed "
329
+ "wordt weergegeven"
330
+
331
+ #: includes/class-wcpdf-settings.php:655
332
  #: templates/pdf/Simple/packing-slip.php:9
333
  #: templates/pdf/Simple/packing-slip.php:21
334
+ #: woocommerce-pdf-invoices-packingslips.php:229
335
  msgid "Packing Slip"
336
  msgstr "Pakbon"
337
 
338
+ #: includes/class-wcpdf-settings.php:662
339
  msgid "Display billing address"
340
  msgstr "Geef factuuradres weer"
341
 
342
+ #: includes/class-wcpdf-settings.php:669
343
  msgid ""
344
  "Display billing address on packing slip (in addition to the default shipping "
345
  "address) if different from shipping address"
347
  "Geef factuuradres weer op de pakbon (naast het standaard verzendadres) "
348
  "wanneer deze verschilt van het verzendadres"
349
 
350
+ #: includes/class-wcpdf-settings.php:700
351
  msgid "Extra template fields"
352
  msgstr "Extra templatevelden"
353
 
354
+ #: includes/class-wcpdf-settings.php:707
355
  msgid "Extra field 1"
356
  msgstr "Extra veld 1"
357
 
358
+ #: includes/class-wcpdf-settings.php:716
359
  msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
360
  msgstr "Dit is voettekst kolom 1 in het <i>Modern (Premium)</i> template"
361
 
362
+ #: includes/class-wcpdf-settings.php:723
363
  msgid "Extra field 2"
364
  msgstr "Extra veld 2"
365
 
366
+ #: includes/class-wcpdf-settings.php:732
367
  msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
368
  msgstr "Dit is voettekst kolom 2 in het <i>Modern (Premium)</i> template"
369
 
370
+ #: includes/class-wcpdf-settings.php:739
371
  msgid "Extra field 3"
372
  msgstr "Extra veld 3"
373
 
374
+ #: includes/class-wcpdf-settings.php:748
375
  msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
376
  msgstr "Dit is voettekst kolom 3 in het <i>Modern (Premium)</i> template"
377
 
378
+ #: includes/class-wcpdf-settings.php:770
379
  msgid "Debug settings"
380
  msgstr "Debug instellingen"
381
 
382
+ #: includes/class-wcpdf-settings.php:777
383
  msgid "Enable debug output"
384
  msgstr "Debug uitvoer inschakelen"
385
 
386
+ #: includes/class-wcpdf-settings.php:784
387
  msgid ""
388
  "Enable this option to output plugin errors if you're getting a blank page or "
389
  "other PDF generation issues"
391
  "Schakel deze optie in om pluginfouten weer te geven, wanneer je een lege "
392
  "pagina krijgt of andere problemen hebt met het genereren van PDF."
393
 
394
+ #: includes/class-wcpdf-settings.php:790
395
  msgid "Output to HTML"
396
  msgstr "Uitvoer naar HTML"
397
 
398
+ #: includes/class-wcpdf-settings.php:797
399
  msgid ""
400
  "Send the template output as HTML to the browser instead of creating a PDF."
401
  msgstr ""
402
  "Stuur de uitvoer van de template als HTML naar de browser in plaats van een "
403
  "PDF."
404
 
405
+ #: includes/class-wcpdf-settings.php:803
406
  msgid "Use old tmp folder"
407
  msgstr "Gebruik de oude tmp folder"
408
 
409
+ #: includes/class-wcpdf-settings.php:810
410
  msgid ""
411
  "Before version 1.5 of PDF Invoices, temporary files were stored in the "
412
  "plugin folder. This setting is only intended for backwards compatibility, "
416
  "de plugin map. Deze instelling is enkel bedoelde voor backwards "
417
  "compatibiliteit, en niet aanbevolen op nieuwe installaties!"
418
 
419
+ #: includes/class-wcpdf-settings.php:1225
420
  msgid "Image resolution"
421
  msgstr "Afbeeldings resolutie"
422
 
423
+ #: includes/class-wcpdf-settings.php:1341
424
  msgid ""
425
  "<b>Warning!</b> The settings below are meant for debugging/development only. "
426
  "Do not use them on a live website!"
428
  "<b>Waarschuwing!</b> Onderstaande instellingen zijn enkel bedoeld om fouten "
429
  "op te sporen of om te testen. Gebruik ze niet op een live website!"
430
 
431
+ #: includes/class-wcpdf-settings.php:1350
432
  msgid ""
433
  "These are used for the (optional) footer columns in the <em>Modern "
434
  "(Premium)</em> template, but can also be used for other elements in your "
442
  msgid "PDF Packing Slips"
443
  msgstr "PDF Pakbonnen"
444
 
445
+ #: includes/class-wcpdf-writepanels.php:120
446
+ #: includes/class-wcpdf-writepanels.php:253
447
  msgid "PDF Invoice"
448
  msgstr "PDF factuur"
449
 
450
+ #: includes/class-wcpdf-writepanels.php:125
451
+ #: includes/class-wcpdf-writepanels.php:258
452
  msgid "PDF Packing Slip"
453
  msgstr "PDF Pakbon"
454
 
455
+ #: includes/class-wcpdf-writepanels.php:152
456
  msgid "Invoice Number"
457
  msgstr "Factuurnummer"
458
 
459
+ #: includes/class-wcpdf-writepanels.php:211
460
  msgid "Download invoice (PDF)"
461
  msgstr "Download factuur (PDF)"
462
 
463
+ #: includes/class-wcpdf-writepanels.php:225
464
  msgid "Create PDF"
465
  msgstr "Maak PDF"
466
 
467
+ #: includes/class-wcpdf-writepanels.php:235
468
  msgid "PDF Invoice data"
469
  msgstr "PDF Factuur gegevens"
470
 
471
+ #: includes/class-wcpdf-writepanels.php:288
472
  msgid "Invoice Number (unformatted!)"
473
  msgstr "Factuurnummer (zonder formatting!)"
474
 
475
+ #: includes/class-wcpdf-writepanels.php:296 templates/pdf/Simple/invoice.php:55
476
  msgid "Invoice Date:"
477
  msgstr "Factuurdatum:"
478
 
479
+ #: includes/class-wcpdf-writepanels.php:298
480
+ #: includes/class-wcpdf-writepanels.php:300
481
  msgid "h"
482
  msgstr "u"
483
 
484
+ #: includes/class-wcpdf-writepanels.php:298
485
+ #: includes/class-wcpdf-writepanels.php:300
486
  msgid "m"
487
  msgstr "m"
488
 
494
  msgid "click items to read more"
495
  msgstr "Klik op de items om meer te lezen"
496
 
497
+ #: includes/wcpdf-extensions.php:21
498
+ msgid ""
499
+ "Premium PDF Invoice bundle: Everything you need for a perfect invoicing "
500
+ "system"
501
+ msgstr ""
502
+ "Premie PDF factuur bundel: alles wat je nodig hebt voor een perfect "
503
+ "facturatie systeem"
504
 
505
+ #: includes/wcpdf-extensions.php:23
506
  msgid ""
507
+ "Supercharge WooCommerce PDF Invoices & Packing Slips with the all our "
508
+ "premium extensions:"
509
  msgstr ""
510
+ "Geef WooCommerce PDF Invoices & Packing Slips een boost met al onze premium "
511
+ "uitbreidingen:"
512
 
513
+ #: includes/wcpdf-extensions.php:24
514
+ msgid "Professional features:"
515
+ msgstr "Professionele functies:"
516
+
517
+ #: includes/wcpdf-extensions.php:26 includes/wcpdf-extensions.php:56
518
  msgid "Email/print/download <b>PDF Credit Notes & Proforma invoices</b>"
519
  msgstr "Email/print/download <b>PDF Credit Nota's & Pro-forma facturen</b>"
520
 
521
+ #: includes/wcpdf-extensions.php:27 includes/wcpdf-extensions.php:57
522
  msgid ""
523
  "Send out a separate <b>notification email</b> with (or without) PDF invoices/"
524
  "packing slips, for example to a drop-shipper or a supplier."
526
  "Verstuur een aparte <b>notificatie email</b> met (of zonder) PDF facturen/"
527
  "pakbonnen, bijvoorbeeld naar een drop-shipper of een leverancier."
528
 
529
+ #: includes/wcpdf-extensions.php:28 includes/wcpdf-extensions.php:58
530
  msgid ""
531
  "Attach <b>up to 3 static files</b> (for example a terms & conditions "
532
  "document) to the WooCommerce emails of your choice."
534
  "Voeg tot <b>3 vaste bestandsbijlagen</b> (bijvoorbeeld algemene voorwaarden) "
535
  "toe aan WooCommerce emails naar keuze."
536
 
537
+ #: includes/wcpdf-extensions.php:29 includes/wcpdf-extensions.php:59
538
  msgid ""
539
  "Use <b>separate numbering systems</b> and/or format for proforma invoices "
540
  "and credit notes or utilize the main invoice numbering system"
542
  "Gebruik <b>losse nummersystemen</b> en/of formats voor pro-forma facturen en "
543
  "credit notes, of gebruik het hoofd factuurnummersysteem."
544
 
545
+ #: includes/wcpdf-extensions.php:30 includes/wcpdf-extensions.php:60
546
  msgid ""
547
  "<b>Customize</b> the <b>shipping & billing address</b> format to include "
548
  "additional custom fields, font sizes etc. without the need to create a "
551
  "<b>Pas het verzend- en factuuradres aan</b> met custom velden, verschillende "
552
  "fontgroottes etc, zonder daarvoor een custom template aan te maken."
553
 
554
+ #: includes/wcpdf-extensions.php:31 includes/wcpdf-extensions.php:61
555
  msgid "Use the plugin in multilingual <b>WPML</b> setups"
556
  msgstr "Gebruik de plugin in meertalige <b>WPML</b> setups"
557
 
558
+ #: includes/wcpdf-extensions.php:33 includes/wcpdf-extensions.php:131
559
+ msgid "Advanced, customizable templates"
560
+ msgstr "Geavanceerde, aanpasbare templates"
561
 
562
+ #: includes/wcpdf-extensions.php:35 includes/wcpdf-extensions.php:134
563
+ msgid ""
564
+ "Completely customize the invoice contents (prices, taxes, thumbnails) to "
565
+ "your needs with a drag & drop customizer"
566
+ msgstr ""
567
+ "Past de inhoud van de factuur (prijzen, BTW, thumbnails) volledig naar je "
568
+ "wensen aan met een eenvoudige drag & drop interface"
569
+
570
+ #: includes/wcpdf-extensions.php:36 includes/wcpdf-extensions.php:135
571
+ msgid "Two extra stylish premade templates (Modern & Business)"
572
+ msgstr "Twee extra stijlvolle voorgeconfigureerde templates (Moden & Business)"
573
+
574
+ #: includes/wcpdf-extensions.php:38
575
+ msgid "Upload automatically to dropbox"
576
+ msgstr "Automatisch uploaden naar dropbox"
577
 
578
+ #: includes/wcpdf-extensions.php:40 includes/wcpdf-extensions.php:97
579
  msgid ""
580
  "This extension conveniently uploads all the invoices (and other pdf "
581
  "documents from the professional extension) that are emailed to your "
586
  "professional extensie) die worden ge-emaild naar je klanten naar Dropbox. De "
587
  "beste manier om je factuur administratie up te date te houden!"
588
 
589
+ #: includes/wcpdf-extensions.php:43
590
+ msgid "Get WooCommerce PDF Invoices & Packing Slips Bundle"
591
+ msgstr "Neem decWooCommerce PDF Invoices & Packing Slips Bundel!"
592
+
593
+ #: includes/wcpdf-extensions.php:52
594
+ msgid "Go Pro: Proforma invoices, credit notes (=refunds) & more!"
595
+ msgstr "Go Pro: Pro-forma facturen, credit nota's (=refunds) & meer!"
596
+
597
+ #: includes/wcpdf-extensions.php:54
598
+ msgid ""
599
+ "Supercharge WooCommerce PDF Invoices & Packing Slips with the following "
600
+ "features:"
601
+ msgstr ""
602
+ "Geef WooCommerce PDF Invoices & Packing Slips een boost met de volgende "
603
+ "functies:"
604
+
605
+ #: includes/wcpdf-extensions.php:63
606
+ msgid "Get WooCommerce PDF Invoices & Packing Slips Professional!"
607
+ msgstr "Neem WooCommerce PDF Invoices & Packing Slips Professional!"
608
+
609
+ #: includes/wcpdf-extensions.php:71
610
+ msgid "Automatically send payment reminders to your customers"
611
+ msgstr "Verstuur automatisch betalingsherrinneringen naar je klanten"
612
+
613
+ #: includes/wcpdf-extensions.php:73
614
+ msgid "WooCommerce Smart Reminder emails"
615
+ msgstr "WooCommerce Smart Reminder Emails"
616
+
617
+ #: includes/wcpdf-extensions.php:75
618
+ msgid "<b>Completely automatic</b> scheduled emails"
619
+ msgstr "<b>Volledig automatisch</b> ingeplande/verstuurde e-mails"
620
+
621
+ #: includes/wcpdf-extensions.php:76
622
+ msgid ""
623
+ "<b>Rich text editor</b> for the email text, including placeholders for data "
624
+ "from the order (name, order total, etc)"
625
+ msgstr ""
626
+ "<b>Tekstbewerker met uitgebreide opmaak</b> voor de tekst van de e-mail, "
627
+ "inclusief placeholders voor gegevens uit de bestelling (ordertotaal, naam, "
628
+ "enz)"
629
+
630
+ #: includes/wcpdf-extensions.php:77
631
+ msgid ""
632
+ "Configure the exact requirements for sending an email (time after order, "
633
+ "order status, payment method)"
634
+ msgstr ""
635
+ "Stel exacte vereisten voor het versturen van een email in (tijd na de order, "
636
+ "orderstatus, betaalmethode, enz.)"
637
+
638
+ #: includes/wcpdf-extensions.php:78
639
+ msgid ""
640
+ "Fully <b>WPML Compatible</b> – emails will be automatically sent in the "
641
+ "order language."
642
+ msgstr ""
643
+ "Volledig <b>Compatible met WPML</b> – e-mails worden automatisch verzonden "
644
+ "in de taal van de bestelling."
645
+
646
+ #: includes/wcpdf-extensions.php:79
647
+ msgid ""
648
+ "<b>Super versatile!</b> Can be used for any kind of reminder email (review "
649
+ "reminders, repeat purchases)"
650
+ msgstr ""
651
+ "<b>Super veelzijdig!</b> Kan worden gebruikt voor elke soort "
652
+ "herinneringsemail (review herinneringen, herhalende aankopen)"
653
+
654
+ #: includes/wcpdf-extensions.php:80
655
+ msgid "Integrates seamlessly with the PDF Invoices & Packing Slips plugin"
656
+ msgstr "Integreert naadloos met de PDF Invoices & Packing Slips plugin"
657
+
658
+ #: includes/wcpdf-extensions.php:82
659
+ msgid "Get WooCommerce Smart Reminder Emails"
660
+ msgstr "Neem WooCommerce Smart Reminder Emails"
661
+
662
+ #: includes/wcpdf-extensions.php:91
663
+ msgid "Upload all invoices automatically to your dropbox"
664
+ msgstr "Upload alle facturen automatisch naar je Dropbox"
665
+
666
+ #: includes/wcpdf-extensions.php:98
667
  msgid "Get WooCommerce PDF Invoices & Packing Slips to dropbox!"
668
  msgstr "Neem WooCommerce PDF Invoices & Packing Slips to dropbox!"
669
 
670
+ #: includes/wcpdf-extensions.php:110
671
  msgid ""
672
  "Automatically send new orders or packing slips to your printer, as soon as "
673
  "the customer orders!"
675
  "Verstuur nieuwe orders of pakbonnen automatisch naar je printer, zodra een "
676
  "klant een bestelling plaatst."
677
 
678
+ #: includes/wcpdf-extensions.php:116
679
  msgid ""
680
  "Check out the WooCommerce Automatic Order Printing extension from our "
681
  "partners at Simba Hosting"
683
  "Bekijk de WooCommerce Automatic Order Printing extensie van onze parters van "
684
  "Simba Hosting"
685
 
686
+ #: includes/wcpdf-extensions.php:117
687
  msgid "WooCommerce Automatic Order Printing"
688
  msgstr "WooCommerce Automatic Order Printing"
689
 
690
+ #: includes/wcpdf-extensions.php:136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
  #, php-format
692
  msgid "Check out the Premium PDF Invoice & Packing Slips templates at %s."
693
  msgstr "Bekijk de Premium PDF Invoice & Packing Slips templates op %s."
694
 
695
+ #: includes/wcpdf-extensions.php:137
696
  #, php-format
697
  msgid "For custom templates, contact us at %s."
698
  msgstr "Neem voor custom templates contact met ons op via %s"
699
 
700
+ #: includes/wcpdf-extensions.php:146
701
+ msgid "Hide this message"
702
+ msgstr "Verberg dit bericht"
703
+
704
  #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
705
  msgid "Billing Address:"
706
  msgstr "Factuuradres:"
775
  "WooCommerce PDF Invoices & Packing Slips vereist dat %sWooCommerce%s is "
776
  "geïnstalleerd & geactiveerd!"
777
 
778
+ #: woocommerce-pdf-invoices-packingslips.php:377
779
+ #: woocommerce-pdf-invoices-packingslips.php:438
780
  msgid "N/A"
781
  msgstr "N/A"
782
 
783
+ #: woocommerce-pdf-invoices-packingslips.php:533
784
  msgid "Payment method"
785
  msgstr "Betaalmethode"
786
 
787
+ #: woocommerce-pdf-invoices-packingslips.php:552
788
  msgid "Shipping method"
789
  msgstr "Verzendmethode"
790
 
791
+ #: woocommerce-pdf-invoices-packingslips.php:712
792
+ #, php-format
793
+ msgid "(includes %s)"
794
+ msgstr ""
795
+
796
+ #: woocommerce-pdf-invoices-packingslips.php:715
797
  #, php-format
798
  msgid "(Includes %s)"
799
  msgstr ""
800
 
801
+ #: woocommerce-pdf-invoices-packingslips.php:744
802
  msgid "Subtotal"
803
  msgstr "Subtotaal"
804
 
805
+ #: woocommerce-pdf-invoices-packingslips.php:766
806
  msgid "Shipping"
807
  msgstr "Verzendkosten"
808
 
809
+ #: woocommerce-pdf-invoices-packingslips.php:829
810
  msgid "Discount"
811
  msgstr "Korting"
812
 
813
+ #: woocommerce-pdf-invoices-packingslips.php:870
814
  msgid "VAT"
815
  msgstr "BTW"
816
 
817
+ #: woocommerce-pdf-invoices-packingslips.php:871
818
  msgid "Tax rate"
819
  msgstr "BTW tarief"
820
 
821
+ #: woocommerce-pdf-invoices-packingslips.php:908
822
  msgid "Total ex. VAT"
823
  msgstr "Totaal excl. BTW"
824
 
825
+ #: woocommerce-pdf-invoices-packingslips.php:911
826
  msgid "Total"
827
  msgstr "Totaal"
828
 
829
+ #~ msgid ""
830
+ #~ "to use the order year and/or month, use [order_year] or [order_month] "
831
+ #~ "respectively"
832
+ #~ msgstr ""
833
+ #~ "gebruik [order_year] of [order_month] om het order jaar en/of maand te "
834
+ #~ "weer te geven"
835
+
836
  #~ msgid "PDF Invoice Number (unformatted!)"
837
  #~ msgstr "PDF Factuurnummer (zonder formatting!)"
838
 
languages/wpo_wcpdf-sv_SE.mo CHANGED
Binary file
languages/wpo_wcpdf-sv_SE.po CHANGED
@@ -1,684 +1,818 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-05-28 16:09+0100\n"
6
- "PO-Revision-Date: 2015-06-24 12:43+0100\n"
7
- "Last-Translator: conney@johansen.se <conney@johansen.se>\n"
8
- "Language-Team: WP Overnight <support@wpovernight.com>\n"
9
- "Language: sv\n"
10
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
11
- "MIME-Version: 1.0\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
- "Content-Transfer-Encoding: 8bit\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;__:1;"
16
- "_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;_x:1,2c;"
17
- "_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;esc_attr__:1;"
18
- "esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;esc_html_x:1,2c;"
19
- "comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
20
- "X-Poedit-Basepath: ../\n"
21
- "X-Textdomain-Support: yes\n"
22
- "X-Generator: Poedit 1.8.1\n"
23
- "X-Loco-Target-Locale: sv_SE\n"
24
- "X-Poedit-SearchPath-0: .\n"
25
-
26
- #: includes/class-wcpdf-export.php:338 includes/class-wcpdf-export.php:348
27
- #: includes/class-wcpdf-export.php:359 includes/class-wcpdf-export.php:367
28
- msgid "You do not have sufficient permissions to access this page."
29
- msgstr "Du har inte behörighet att komma åt den här sidan."
30
-
31
- #: includes/class-wcpdf-export.php:343
32
- msgid "Some of the export parameters are missing."
33
- msgstr "Vissa paramertrar i exporten saknas"
34
-
35
- #: includes/class-wcpdf-export.php:424
36
- msgid "invoice"
37
- msgid_plural "invoices"
38
- msgstr[0] "faktura"
39
- msgstr[1] "fakturor"
40
-
41
- #: includes/class-wcpdf-export.php:428
42
- msgid "packing-slip"
43
- msgid_plural "packing-slips"
44
- msgstr[0] "följesedel"
45
- msgstr[1] "följesedlarna"
46
-
47
- #: includes/class-wcpdf-settings.php:38 includes/class-wcpdf-settings.php:39
48
- #: includes/class-wcpdf-writepanels.php:31
49
- msgid "PDF Invoices"
50
- msgstr "PDF fakturor"
51
-
52
- #: includes/class-wcpdf-settings.php:80
53
- msgid "Settings"
54
- msgstr "Inställningar"
55
-
56
- #: includes/class-wcpdf-settings.php:102
57
- msgid "General"
58
- msgstr "Allmänt"
59
-
60
- #: includes/class-wcpdf-settings.php:103
61
- msgid "Template"
62
- msgstr "Mall"
63
-
64
- #: includes/class-wcpdf-settings.php:108
65
- msgid "Status"
66
- msgstr "Status"
67
-
68
- #: includes/class-wcpdf-settings.php:120
69
- msgid "WooCommerce PDF Invoices"
70
- msgstr "WooCommerce PDF fakturor"
71
-
72
- #: includes/class-wcpdf-settings.php:189
73
- msgid "General settings"
74
- msgstr "Allmäna inställningar"
75
-
76
- #: includes/class-wcpdf-settings.php:196
77
- msgid "How do you want to view the PDF?"
78
- msgstr "Hur vill du visa din PDF?"
79
-
80
- #: includes/class-wcpdf-settings.php:204
81
- msgid "Download the PDF"
82
- msgstr "Ladda ner PDF"
83
-
84
- #: includes/class-wcpdf-settings.php:205
85
- msgid "Open the PDF in a new browser tab/window"
86
- msgstr "Öppna PDF i en ny tabb/fönster"
87
-
88
- #: includes/class-wcpdf-settings.php:214
89
- msgid "Admin New Order email"
90
- msgstr "vid ny order"
91
-
92
- #: includes/class-wcpdf-settings.php:215
93
- msgid "Customer Processing Order email"
94
- msgstr "vid bearbetad order"
95
-
96
- #: includes/class-wcpdf-settings.php:216
97
- msgid "Customer Completed Order email"
98
- msgstr "vid genomförd order"
99
-
100
- #: includes/class-wcpdf-settings.php:217
101
- msgid "Customer Invoice email"
102
- msgstr "vid kundfaktura"
103
-
104
- #: includes/class-wcpdf-settings.php:222
105
- msgid "Attach invoice to:"
106
- msgstr "Bifoga faktura:"
107
-
108
- #: includes/class-wcpdf-settings.php:230
109
- #, php-format
110
- msgid ""
111
- "It looks like the temp folder (<code>%s</code>) is not writable, check the "
112
- "permissions for this folder! Without having write access to this folder, the "
113
- "plugin will not be able to email invoices."
114
- msgstr ""
115
- "Det ser ut som den temporära mappen (<code>%s</code>) inte är skrivbar, "
116
- "kontrollera rättigheterna för den mappen! Utan skrivrättigheter så kan inte detta "
117
- "plugin skapa email fakturor."
118
-
119
- #: includes/class-wcpdf-settings.php:236
120
- msgid "Disable for free products"
121
- msgstr "Inaktivera för gratisprodukter"
122
-
123
- #: includes/class-wcpdf-settings.php:243
124
- msgid ""
125
- "Disable automatic creation/attachment of invoices when only free products are "
126
- "ordered"
127
- msgstr ""
128
- "Inaktivera automatisk genererad faktura vid gratisprodukter (endast när "
129
- "gratisprodukter är beställda )"
130
-
131
- #: includes/class-wcpdf-settings.php:250
132
- msgid "Interface"
133
- msgstr "Gränssnitt"
134
-
135
- #: includes/class-wcpdf-settings.php:298
136
- msgid "Allow My Account invoice download"
137
- msgstr "Tillåt nerladdning av faktura på \"Mitt konto\" "
138
-
139
- #: includes/class-wcpdf-settings.php:306
140
- msgid "Only when an invoice is already created/emailed"
141
- msgstr "Endast när en faktura redan är skapad/skickad"
142
-
143
- #: includes/class-wcpdf-settings.php:307
144
- msgid "Only for specific order statuses (define below)"
145
- msgstr "Endast för specifik orderstatus (definierade nedan)"
146
-
147
- #: includes/class-wcpdf-settings.php:308
148
- msgid "Always"
149
- msgstr "Alltid"
150
-
151
- #: includes/class-wcpdf-settings.php:323
152
- msgid "Enable invoice number column in the orders list"
153
- msgstr "Aktivera fakturanummer i orderlistan."
154
-
155
- #: includes/class-wcpdf-settings.php:361
156
- msgid "PDF Template settings"
157
- msgstr "PDF-mall inställningar"
158
-
159
- #: includes/class-wcpdf-settings.php:373
160
- msgid "Choose a template"
161
- msgstr "Välj en mall"
162
-
163
- #: includes/class-wcpdf-settings.php:381
164
- #, php-format
165
- msgid ""
166
- "Want to use your own template? Copy all the files from <code>%s</code> to your "
167
- "(child) theme in <code>%s</code> to customize them"
168
- msgstr ""
169
- "Vill du använda egen mall? Kopiera alla filer från <code>%s</code> till ditt eget "
170
- "\" (child) theme\" <code>%s</code> för att skräddasy temat"
171
-
172
- #: includes/class-wcpdf-settings.php:387
173
- msgid "Paper size"
174
- msgstr "Pappersstorlek"
175
-
176
- #: includes/class-wcpdf-settings.php:395
177
- msgid "A4"
178
- msgstr "A4"
179
-
180
- #: includes/class-wcpdf-settings.php:396
181
- msgid "Letter"
182
- msgstr "Letter (US)"
183
-
184
- #: includes/class-wcpdf-settings.php:403
185
- msgid "Shop header/logo"
186
- msgstr "Butikslogotyp"
187
-
188
- #: includes/class-wcpdf-settings.php:410
189
- msgid "Select or upload your invoice header/logo"
190
- msgstr "Välj eller ladda upp din faktura logotyp"
191
-
192
- #: includes/class-wcpdf-settings.php:411
193
- msgid "Set image"
194
- msgstr "Välj bild"
195
-
196
- #: includes/class-wcpdf-settings.php:412
197
- msgid "Remove image"
198
- msgstr "Ta bort bild"
199
-
200
- #: includes/class-wcpdf-settings.php:419
201
- msgid "Shop Name"
202
- msgstr "Butiksnamn"
203
-
204
- #: includes/class-wcpdf-settings.php:432
205
- msgid "Shop Address"
206
- msgstr "Butiksadress"
207
-
208
- #: includes/class-wcpdf-settings.php:447
209
- msgid "Footer: terms & conditions, policies, etc."
210
- msgstr "Sidfot: villkor, policy, osv."
211
-
212
- #: includes/class-wcpdf-settings.php:463 includes/class-wcpdf-writepanels.php:273
213
- #: templates/pdf/Simple/invoice.php:9 templates/pdf/Simple/invoice.php:21
214
- #: woocommerce-pdf-invoices-packingslips.php:220
215
- msgid "Invoice"
216
- msgstr "Faktura"
217
-
218
- #: includes/class-wcpdf-settings.php:470
219
- msgid "Display shipping address"
220
- msgstr "Visa leveransadress"
221
-
222
- #: includes/class-wcpdf-settings.php:477
223
- msgid ""
224
- "Display shipping address on invoice (in addition to the default billing address) "
225
- "if different from billing address"
226
- msgstr "Visa leveransadress på fakturan om den skiljer sig åt från faktura adressen"
227
-
228
- #: includes/class-wcpdf-settings.php:483 includes/class-wcpdf-settings.php:598
229
- msgid "Display email address"
230
- msgstr "Visa e-postadress"
231
-
232
- #: includes/class-wcpdf-settings.php:495 includes/class-wcpdf-settings.php:610
233
- msgid "Display phone number"
234
- msgstr "Visa telefonnumer"
235
-
236
- #: includes/class-wcpdf-settings.php:507
237
- msgid "Display invoice date"
238
- msgstr "Visa fakturadatum"
239
-
240
- #: includes/class-wcpdf-settings.php:520
241
- msgid "Display built-in sequential invoice number"
242
- msgstr "Visa inbyggt sekventiell fakturanummer"
243
-
244
- #: includes/class-wcpdf-settings.php:533
245
- msgid "Next invoice number (without prefix/suffix etc.)"
246
- msgstr "Nästa ordernummer (utan prefix/suffix etc.)"
247
-
248
- #: includes/class-wcpdf-settings.php:541
249
- msgid ""
250
- "This is the number that will be used on the next invoice that is created. By "
251
- "default, numbering starts from the WooCommerce Order Number of the first invoice "
252
- "that is created and increases for every new invoice. Note that if you override "
253
- "this and set it lower than the highest (PDF) invoice number, this could create "
254
- "double invoice numbers!"
255
- msgstr ""
256
- "Det här är numret som kommer användas när nästa order görs. Det förvalda värdet "
257
- "startar från WooCommerce ordernummer och den första fakturan som skapas kommer "
258
- "att följa efter varje ny faktura som skapas. Notera att om du skriver över detta "
259
- "och sätter ett lägre värde än det högsta (PDF) faktura numret så kan det "
260
- "resultera i dubbla fakturanummer."
261
-
262
- #: includes/class-wcpdf-settings.php:547
263
- msgid "Invoice number format"
264
- msgstr "Fakturanummers format"
265
-
266
- #: includes/class-wcpdf-settings.php:556
267
- msgid "Prefix"
268
- msgstr "Prefix"
269
-
270
- #: includes/class-wcpdf-settings.php:558
271
- msgid ""
272
- "to use the order year and/or month, use [order_year] or [order_month] respectively"
273
- msgstr ""
274
- "för att använda order datum eller månad , använd [order_year] eller "
275
- "[order_month] "
276
-
277
- #: includes/class-wcpdf-settings.php:561
278
- msgid "Suffix"
279
- msgstr "Suflix"
280
-
281
- #: includes/class-wcpdf-settings.php:566
282
- msgid "Padding"
283
- msgstr "Utfyllnad"
284
-
285
- #: includes/class-wcpdf-settings.php:568
286
- msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
287
- msgstr "fyll i antalet värdesiffror här. Skriv \"6\" så visas 42 som 000042"
288
-
289
- #: includes/class-wcpdf-settings.php:571
290
- msgid ""
291
- "note: if you have already created a custom invoice number format with a filter, "
292
- "the above settings will be ignored"
293
- msgstr ""
294
- "obs: om du redan skapat ett eget fakturanummerformat med ett filter, då ignoreras "
295
- "inställningarna ovan"
296
-
297
- #: includes/class-wcpdf-settings.php:578 templates/pdf/Simple/packing-slip.php:9
298
- #: templates/pdf/Simple/packing-slip.php:21
299
- #: woocommerce-pdf-invoices-packingslips.php:223
300
- msgid "Packing Slip"
301
- msgstr "Följesedel"
302
-
303
- #: includes/class-wcpdf-settings.php:585
304
- msgid "Display billing address"
305
- msgstr "Visa fakturaadress"
306
-
307
- #: includes/class-wcpdf-settings.php:592
308
- msgid ""
309
- "Display billing address on packing slip (in addition to the default shipping "
310
- "address) if different from shipping address"
311
- msgstr "Visa fakturaadress på följesedeln om den skiljer sig från leveransadressen"
312
-
313
- #: includes/class-wcpdf-settings.php:623
314
- msgid "Extra template fields"
315
- msgstr "Extra mallfält"
316
-
317
- #: includes/class-wcpdf-settings.php:630
318
- msgid "Extra field 1"
319
- msgstr "Fält 1"
320
-
321
- #: includes/class-wcpdf-settings.php:639
322
- msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
323
- msgstr "Kolumnnummer 1 i sidfot <i>(Premium)</i> mallen"
324
-
325
- #: includes/class-wcpdf-settings.php:645
326
- msgid "Extra field 2"
327
- msgstr "Fält 2"
328
-
329
- #: includes/class-wcpdf-settings.php:654
330
- msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
331
- msgstr "Kolumnnummer 2 i sidfot <i>(Premium)</i> mallen"
332
-
333
- #: includes/class-wcpdf-settings.php:660
334
- msgid "Extra field 3"
335
- msgstr "Fält 3"
336
-
337
- #: includes/class-wcpdf-settings.php:669
338
- msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
339
- msgstr "Kolumnnummer 3 i sidfot <i>(Premium)</i> mallen"
340
-
341
- #: includes/class-wcpdf-settings.php:711
342
- msgid "Debug settings"
343
- msgstr "Felsökningsinställningar"
344
-
345
- #: includes/class-wcpdf-settings.php:718
346
- msgid "Enable debug output"
347
- msgstr "Aktivera felsökningsinställningar"
348
-
349
- #: includes/class-wcpdf-settings.php:725
350
- msgid ""
351
- "Enable this option to output plugin errors if you're getting a blank page or "
352
- "other PDF generation issues"
353
- msgstr ""
354
- "Aktivera det här alternativet för att mata ut plugin fel om du får en tom sida "
355
- "eller andra PDF generation frågor"
356
-
357
- #: includes/class-wcpdf-settings.php:731
358
- msgid "Output to HTML"
359
- msgstr "Utgång till HTML"
360
-
361
- #: includes/class-wcpdf-settings.php:738
362
- msgid "Send the template output as HTML to the browser instead of creating a PDF."
363
- msgstr "Skicka mallen som HTML till webbläsaren istället för att skapa en PDF-fil."
364
-
365
- #: includes/class-wcpdf-settings.php:744
366
- msgid "Use old tmp folder"
367
- msgstr "Använd \"old tmp\" mapp"
368
-
369
- #: includes/class-wcpdf-settings.php:751
370
- msgid ""
371
- "Before version 1.5 of PDF Invoices, temporary files were stored in the plugin "
372
- "folder. This setting is only intended for backwards compatibility, not "
373
- "recommended on new installs!"
374
- msgstr ""
375
- "Innan version 1.5 av PDF fakturor, var temporära filer lagrade i plugin-mappen. "
376
- "Den här inställningen är endast avsedd för bakåtkompatibilitet, rekommenderas "
377
- "inte på nya installationer!"
378
-
379
- #: includes/class-wcpdf-settings.php:1091
380
- msgid "Image resolution"
381
- msgstr "Bildupplösning"
382
-
383
- #: includes/class-wcpdf-settings.php:1207
384
- msgid ""
385
- "<b>Warning!</b> The settings below are meant for debugging/development only. Do "
386
- "not use them on a live website!"
387
- msgstr ""
388
- "<b>Varning!</b> Inställningarna nedan är avsedda för felsökning / endast "
389
- "utveckling. Använd dem inte på en aktiv hemsida!"
390
-
391
- #: includes/class-wcpdf-settings.php:1216
392
- msgid ""
393
- "These are used for the (optional) footer columns in the <em>Modern (Premium)</em> "
394
- "template, but can also be used for other elements in your custom template"
395
- msgstr ""
396
- "Dessa kan användas (valfritt) som kolumner i sidfoten i <em>Modern (Premium)</em> "
397
- "mallen, men kan även användas för dina egna element i dina skräddarsydda mallar."
398
-
399
- #: includes/class-wcpdf-writepanels.php:32
400
- msgid "PDF Packing Slips"
401
- msgstr "Följesedlar (PDF)"
402
-
403
- #: includes/class-wcpdf-writepanels.php:113
404
- #: includes/class-wcpdf-writepanels.php:240
405
- msgid "PDF Invoice"
406
- msgstr "Faktura (PDF)"
407
-
408
- #: includes/class-wcpdf-writepanels.php:118
409
- #: includes/class-wcpdf-writepanels.php:245
410
- msgid "PDF Packing Slip"
411
- msgstr "Följesedel (PDF)"
412
-
413
- #: includes/class-wcpdf-writepanels.php:145
414
- msgid "Invoice Number"
415
- msgstr "Fakturanummer"
416
-
417
- #: includes/class-wcpdf-writepanels.php:198
418
- msgid "Download invoice (PDF)"
419
- msgstr "Ladda ner Faktura (PDF)"
420
-
421
- #: includes/class-wcpdf-writepanels.php:212
422
- msgid "Create PDF"
423
- msgstr "Skapa PDF"
424
-
425
- #: includes/class-wcpdf-writepanels.php:222
426
- msgid "PDF Invoice data"
427
- msgstr "PDF Fakturadatum"
428
-
429
- #: includes/class-wcpdf-writepanels.php:275
430
- msgid "Invoice Number (unformatted!)"
431
- msgstr "Faktur nummer (oformaterat)"
432
-
433
- #: includes/class-wcpdf-writepanels.php:283 templates/pdf/Simple/invoice.php:55
434
- msgid "Invoice Date:"
435
- msgstr "Fakturadatum:"
436
-
437
- #: includes/class-wcpdf-writepanels.php:285
438
- msgid "h"
439
- msgstr "h"
440
-
441
- #: includes/class-wcpdf-writepanels.php:285
442
- msgid "m"
443
- msgstr "m"
444
-
445
- #: includes/wcpdf-extensions.php:15
446
- msgid "Check out these premium extensions!"
447
- msgstr "Kolla in dessa Premium tillägg"
448
-
449
- #: includes/wcpdf-extensions.php:16
450
- msgid "click items to read more"
451
- msgstr "klicka för att se mer"
452
-
453
- #: includes/wcpdf-extensions.php:23
454
- msgid "Go Pro: Proforma invoices, credit notes (=refunds) & more!"
455
- msgstr ""
456
- "Köp Premium: Proformafaktura, kreditfaktura (=återbetalning) och mycket annat!"
457
-
458
- #: includes/wcpdf-extensions.php:25
459
- msgid ""
460
- "Supercharge WooCommerce PDF Invoices & Packing Slips with the following features:"
461
- msgstr "WooCommerce PDF Invoices & Packing Slips med följande funktioner:"
462
-
463
- #: includes/wcpdf-extensions.php:27
464
- msgid "Email/print/download <b>PDF Credit Notes & Proforma invoices</b>"
465
- msgstr "E-post/utskrift/nerladdning<b>PDF Kreditfakturor & Proformafakturor</b>"
466
-
467
- #: includes/wcpdf-extensions.php:28
468
- msgid ""
469
- "Send out a separate <b>notification email</b> with (or without) PDF invoices/"
470
- "packing slips, for example to a drop-shipper or a supplier."
471
- msgstr ""
472
- "Skicka ett separat <b> e-postmeddelande</b> med eller utan PDF faktura/"
473
- "följesedel, till exempel \"drop-shipper\" eller en leverantör."
474
-
475
- #: includes/wcpdf-extensions.php:29
476
- msgid ""
477
- "Attach <b>up to 3 static files</b> (for example a terms & conditions document) to "
478
- "the WooCommerce emails of your choice."
479
- msgstr ""
480
- "Bifoga<b>upp till 3 statiska filer</b> (till exempel användarvillkor) med valfri "
481
- "WooCommerce e-post."
482
-
483
- #: includes/wcpdf-extensions.php:30
484
- msgid ""
485
- "Use <b>separate numbering systems</b> and/or format for proforma invoices and "
486
- "credit notes or utilize the main invoice numbering system"
487
- msgstr ""
488
- "Använd <b>Separata nummer system</b> för preformafakturor, kreditfakturor eller "
489
- "använd huvud fakturanummer systemet. "
490
-
491
- #: includes/wcpdf-extensions.php:31
492
- msgid ""
493
- "<b>Customize</b> the <b>shipping & billing address</b> format to include "
494
- "additional custom fields, font sizes etc. without the need to create a custom "
495
- "template."
496
- msgstr ""
497
- "<b>Förändra, faktura och leveransadress</b> efter dina behov, typsnitt storlek "
498
- "mm. utan att behöva skapa en egen mall. "
499
-
500
- #: includes/wcpdf-extensions.php:32
501
- msgid "Use the plugin in multilingual <b>WPML</b> setups"
502
- msgstr "Användar tillägg är flerspråkigt <b>WPML</b> inställningar"
503
-
504
- #: includes/wcpdf-extensions.php:34
505
- msgid "Get WooCommerce PDF Invoices & Packing Slips Professional!"
506
- msgstr "Få WooCommerce PDF Fakturor & följesedlar Professional!"
507
-
508
- #: includes/wcpdf-extensions.php:42
509
- msgid "Upload all invoices automatically to your dropbox"
510
- msgstr "Ladda upp alla fakturor automatiskt till din Dropbox"
511
-
512
- #: includes/wcpdf-extensions.php:48
513
- msgid ""
514
- "This extension conveniently uploads all the invoices (and other pdf documents "
515
- "from the professional extension) that are emailed to your customers to Dropbox. "
516
- "The best way to keep your invoice administration up to date!"
517
- msgstr ""
518
- "Det här tillägget laddar enkelt alla fakturor (och andra PDF-dokument från den "
519
- "professionella förlängning) som mailas till dina kunders Dropbox. Det bästa "
520
- "sättet att hålla din fakturaadministration aktuell!"
521
-
522
- #: includes/wcpdf-extensions.php:49
523
- msgid "Get WooCommerce PDF Invoices & Packing Slips to dropbox!"
524
- msgstr "Få WooCommerce PDF Fakturor & följesedlar till Dropbox!"
525
-
526
- #: includes/wcpdf-extensions.php:61
527
- msgid ""
528
- "Automatically send new orders or packing slips to your printer, as soon as the "
529
- "customer orders!"
530
- msgstr ""
531
- "Skicka automatiskt nya order eller följesedlar till din skrivare, så snart kunden "
532
- "beställer!"
533
-
534
- #: includes/wcpdf-extensions.php:67
535
- msgid ""
536
- "Check out the WooCommerce Automatic Order Printing extension from our partners at "
537
- "Simba Hosting"
538
- msgstr ""
539
- "Kolla in WooCommerce automatisk order Printing förlängning från våra partners på "
540
- "Simba Hosting"
541
-
542
- #: includes/wcpdf-extensions.php:68
543
- msgid "WooCommerce Automatic Order Printing"
544
- msgstr "WooCommerce automatisk order utskrift"
545
-
546
- #: includes/wcpdf-extensions.php:82
547
- msgid "Advanced, customizable templates"
548
- msgstr "Avancerade, anpassningsbara mallar"
549
-
550
- #: includes/wcpdf-extensions.php:85
551
- msgid ""
552
- "Completely customize the invoice contents (prices, taxes, thumbnails) to your "
553
- "needs with a drag & drop customizer"
554
- msgstr ""
555
- "Helt anpassa faktura innehåll (priser, skatter, miniatyrer) till dina behov med "
556
- "en dra och släpp Customizer"
557
-
558
- #: includes/wcpdf-extensions.php:86
559
- msgid "Two extra stylish premade templates (Modern & Business)"
560
- msgstr "Två extra snygg mallarna (Modern & Business)"
561
-
562
- #: includes/wcpdf-extensions.php:87
563
- #, php-format
564
- msgid "Check out the Premium PDF Invoice & Packing Slips templates at %s."
565
- msgstr "Kolla in Premium PDF-faktura och följesedlar mallar på %s."
566
-
567
- #: includes/wcpdf-extensions.php:88
568
- #, php-format
569
- msgid "For custom templates, contact us at %s."
570
- msgstr "För skräddarsydda mallar, kontakta oss på %s"
571
-
572
- #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
573
- msgid "Billing Address:"
574
- msgstr "Fakturaadress:"
575
-
576
- #: templates/pdf/Simple/invoice.php:40
577
- msgid "Ship To:"
578
- msgstr "Leveransadress:"
579
-
580
- #: templates/pdf/Simple/invoice.php:49
581
- msgid "Invoice Number:"
582
- msgstr "Fakturanummer:"
583
-
584
- #: templates/pdf/Simple/invoice.php:60 templates/pdf/Simple/packing-slip.php:48
585
- msgid "Order Number:"
586
- msgstr "Ordernummer:"
587
-
588
- #: templates/pdf/Simple/invoice.php:64 templates/pdf/Simple/packing-slip.php:52
589
- msgid "Order Date:"
590
- msgstr "Orderdatum:"
591
-
592
- #: templates/pdf/Simple/invoice.php:68
593
- msgid "Payment Method:"
594
- msgstr "Betalningsätt:"
595
-
596
- #: templates/pdf/Simple/invoice.php:82 templates/pdf/Simple/packing-slip.php:70
597
- msgid "Product"
598
- msgstr "Produkt:"
599
-
600
- #: templates/pdf/Simple/invoice.php:83 templates/pdf/Simple/packing-slip.php:71
601
- msgid "Quantity"
602
- msgstr "Antal:"
603
-
604
- #: templates/pdf/Simple/invoice.php:84
605
- msgid "Price"
606
- msgstr "Pris:"
607
-
608
- #: templates/pdf/Simple/invoice.php:91 templates/pdf/Simple/packing-slip.php:78
609
- msgid "Description"
610
- msgstr "Beskrivning:"
611
-
612
- #: templates/pdf/Simple/invoice.php:96 templates/pdf/Simple/packing-slip.php:83
613
- msgid "SKU"
614
- msgstr "Artikelnummer:"
615
-
616
- #: templates/pdf/Simple/invoice.php:97 templates/pdf/Simple/packing-slip.php:84
617
- msgid "SKU:"
618
- msgstr "SKU:"
619
-
620
- #: templates/pdf/Simple/invoice.php:98 templates/pdf/Simple/packing-slip.php:85
621
- msgid "Weight:"
622
- msgstr "Vikt:"
623
-
624
- #: templates/pdf/Simple/invoice.php:112 templates/pdf/Simple/packing-slip.php:99
625
- msgid "Customer Notes"
626
- msgstr "Kundnoteringar:"
627
-
628
- #: templates/pdf/Simple/packing-slip.php:29
629
- msgid "Shipping Address:"
630
- msgstr "Leveransadress:"
631
-
632
- #: templates/pdf/Simple/packing-slip.php:56
633
- msgid "Shipping Method:"
634
- msgstr "Fraktmetod:"
635
-
636
- #: woocommerce-pdf-invoices-packingslips.php:123
637
- #, php-format
638
- msgid ""
639
- "WooCommerce PDF Invoices & Packing Slips requires %sWooCommerce%s to be installed "
640
- "& activated!"
641
- msgstr ""
642
- "WooCommerce PDF Invoices & Packing Slips behövert %sWooCommerce%s för att "
643
- "installeras och aktiveras!"
644
-
645
- #: woocommerce-pdf-invoices-packingslips.php:367
646
- #: woocommerce-pdf-invoices-packingslips.php:428
647
- msgid "N/A"
648
- msgstr "N/A"
649
-
650
- #: woocommerce-pdf-invoices-packingslips.php:517
651
- msgid "Payment method"
652
- msgstr "Betalningsätt:"
653
-
654
- #: woocommerce-pdf-invoices-packingslips.php:528
655
- msgid "Shipping method"
656
- msgstr "Fraktmetod:"
657
-
658
- #: woocommerce-pdf-invoices-packingslips.php:681
659
- msgid "Subtotal"
660
- msgstr "Belopp:"
661
-
662
- #: woocommerce-pdf-invoices-packingslips.php:703
663
- msgid "Shipping"
664
- msgstr "Frakt:"
665
-
666
- #: woocommerce-pdf-invoices-packingslips.php:766
667
- msgid "Discount"
668
- msgstr "Rabatt:"
669
-
670
- #: woocommerce-pdf-invoices-packingslips.php:806
671
- msgid "VAT"
672
- msgstr "Moms:"
673
-
674
- #: woocommerce-pdf-invoices-packingslips.php:807
675
- msgid "Tax rate"
676
- msgstr "Momssats:"
677
-
678
- #: woocommerce-pdf-invoices-packingslips.php:844
679
- msgid "Total ex. VAT"
680
- msgstr "Totalt exkl. moms:"
681
-
682
- #: woocommerce-pdf-invoices-packingslips.php:847
683
- msgid "Total"
684
- msgstr "Totalt:"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-11-21 12:09+0100\n"
6
+ "PO-Revision-Date: 2016-11-21 12:09+0100\n"
7
+ "Last-Translator: conney@johansen.se <conney@johansen.se>\n"
8
+ "Language-Team: WP Overnight <support@wpovernight.com>\n"
9
+ "Language: sv\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
16
+ "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
17
+ "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
18
+ "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
19
+ "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
20
+ "X-Poedit-Basepath: ..\n"
21
+ "X-Textdomain-Support: yes\n"
22
+ "X-Generator: Poedit 1.8.9\n"
23
+ "X-Loco-Target-Locale: sv_SE\n"
24
+ "X-Poedit-SearchPath-0: .\n"
25
+
26
+ #: includes/class-wcpdf-export.php:418 includes/class-wcpdf-export.php:432
27
+ #: includes/class-wcpdf-export.php:439 includes/class-wcpdf-export.php:447
28
+ msgid "You do not have sufficient permissions to access this page."
29
+ msgstr "Du har inte behörighet att komma åt den här sidan."
30
+
31
+ #: includes/class-wcpdf-export.php:423
32
+ msgid "Some of the export parameters are missing."
33
+ msgstr "Vissa paramertrar i exporten saknas"
34
+
35
+ #: includes/class-wcpdf-export.php:504
36
+ msgid "invoice"
37
+ msgid_plural "invoices"
38
+ msgstr[0] "faktura"
39
+ msgstr[1] "fakturor"
40
+
41
+ #: includes/class-wcpdf-export.php:508
42
+ msgid "packing-slip"
43
+ msgid_plural "packing-slips"
44
+ msgstr[0] "följesedel"
45
+ msgstr[1] "följesedlarna"
46
+
47
+ #: includes/class-wcpdf-settings.php:37 includes/class-wcpdf-settings.php:38
48
+ #: includes/class-wcpdf-writepanels.php:32
49
+ msgid "PDF Invoices"
50
+ msgstr "PDF fakturor"
51
+
52
+ #: includes/class-wcpdf-settings.php:79
53
+ msgid "Settings"
54
+ msgstr "Inställningar"
55
+
56
+ #: includes/class-wcpdf-settings.php:101
57
+ msgid "General"
58
+ msgstr "Allmänt"
59
+
60
+ #: includes/class-wcpdf-settings.php:102
61
+ msgid "Template"
62
+ msgstr "Mall"
63
+
64
+ #: includes/class-wcpdf-settings.php:107
65
+ msgid "Status"
66
+ msgstr "Status"
67
+
68
+ #: includes/class-wcpdf-settings.php:119
69
+ msgid "WooCommerce PDF Invoices"
70
+ msgstr "WooCommerce PDF fakturor"
71
+
72
+ #: includes/class-wcpdf-settings.php:199
73
+ msgid "General settings"
74
+ msgstr "Allmäna inställningar"
75
+
76
+ #: includes/class-wcpdf-settings.php:206
77
+ msgid "How do you want to view the PDF?"
78
+ msgstr "Hur vill du visa din PDF?"
79
+
80
+ #: includes/class-wcpdf-settings.php:214
81
+ msgid "Download the PDF"
82
+ msgstr "Ladda ner PDF"
83
+
84
+ #: includes/class-wcpdf-settings.php:215
85
+ msgid "Open the PDF in a new browser tab/window"
86
+ msgstr "Öppna PDF i en ny tabb/fönster"
87
+
88
+ #: includes/class-wcpdf-settings.php:224
89
+ msgid "Admin New Order email"
90
+ msgstr "vid ny order"
91
+
92
+ #: includes/class-wcpdf-settings.php:225
93
+ msgid "Customer Processing Order email"
94
+ msgstr "vid bearbetad order"
95
+
96
+ #: includes/class-wcpdf-settings.php:226
97
+ msgid "Customer Completed Order email"
98
+ msgstr "vid genomförd order"
99
+
100
+ #: includes/class-wcpdf-settings.php:227
101
+ msgid "Customer Invoice email"
102
+ msgstr "vid kundfaktura"
103
+
104
+ #: includes/class-wcpdf-settings.php:236
105
+ msgid "Attach invoice to:"
106
+ msgstr "Bifoga faktura:"
107
+
108
+ #: includes/class-wcpdf-settings.php:244
109
+ #, php-format
110
+ msgid ""
111
+ "It looks like the temp folder (<code>%s</code>) is not writable, check the "
112
+ "permissions for this folder! Without having write access to this folder, the "
113
+ "plugin will not be able to email invoices."
114
+ msgstr ""
115
+ "Det ser ut som den temporära mappen (<code>%s</code>) inte är skrivbar, "
116
+ "kontrollera rättigheterna för den mappen! Utan skrivrättigheter så kan inte "
117
+ "detta plugin skapa email fakturor."
118
+
119
+ #: includes/class-wcpdf-settings.php:250
120
+ msgid "Disable for free products"
121
+ msgstr "Inaktivera för gratisprodukter"
122
+
123
+ #: includes/class-wcpdf-settings.php:257
124
+ msgid ""
125
+ "Disable automatic creation/attachment of invoices when only free products "
126
+ "are ordered"
127
+ msgstr ""
128
+ "Inaktivera automatisk genererad faktura vid gratisprodukter (endast när "
129
+ "gratisprodukter är beställda )"
130
+
131
+ #: includes/class-wcpdf-settings.php:264
132
+ msgid "Interface"
133
+ msgstr "Gränssnitt"
134
+
135
+ #: includes/class-wcpdf-settings.php:312
136
+ msgid "Allow My Account invoice download"
137
+ msgstr "Tillåt nerladdning av faktura på \"Mitt konto\" "
138
+
139
+ #: includes/class-wcpdf-settings.php:320
140
+ msgid "Only when an invoice is already created/emailed"
141
+ msgstr "Endast när en faktura redan är skapad/skickad"
142
+
143
+ #: includes/class-wcpdf-settings.php:321
144
+ msgid "Only for specific order statuses (define below)"
145
+ msgstr "Endast för specifik orderstatus (definierade nedan)"
146
+
147
+ #: includes/class-wcpdf-settings.php:322
148
+ msgid "Always"
149
+ msgstr "Alltid"
150
+
151
+ #: includes/class-wcpdf-settings.php:323
152
+ msgid "Never"
153
+ msgstr ""
154
+
155
+ #: includes/class-wcpdf-settings.php:338
156
+ msgid "Enable invoice number column in the orders list"
157
+ msgstr "Aktivera fakturanummer i orderlistan."
158
+
159
+ #: includes/class-wcpdf-settings.php:376
160
+ msgid "PDF Template settings"
161
+ msgstr "PDF-mall inställningar"
162
+
163
+ #: includes/class-wcpdf-settings.php:388
164
+ msgid "Choose a template"
165
+ msgstr "Välj en mall"
166
+
167
+ #: includes/class-wcpdf-settings.php:396
168
+ #, php-format
169
+ msgid ""
170
+ "Want to use your own template? Copy all the files from <code>%s</code> to "
171
+ "your (child) theme in <code>%s</code> to customize them"
172
+ msgstr ""
173
+ "Vill du använda egen mall? Kopiera alla filer från <code>%s</code> till ditt "
174
+ "eget \" (child) theme\" <code>%s</code> för att skräddasy temat"
175
+
176
+ #: includes/class-wcpdf-settings.php:402
177
+ msgid "Paper size"
178
+ msgstr "Pappersstorlek"
179
+
180
+ #: includes/class-wcpdf-settings.php:410
181
+ msgid "A4"
182
+ msgstr "A4"
183
+
184
+ #: includes/class-wcpdf-settings.php:411
185
+ msgid "Letter"
186
+ msgstr "Letter (US)"
187
+
188
+ #: includes/class-wcpdf-settings.php:418
189
+ msgid "Shop header/logo"
190
+ msgstr "Butikslogotyp"
191
+
192
+ #: includes/class-wcpdf-settings.php:425
193
+ msgid "Select or upload your invoice header/logo"
194
+ msgstr "Välj eller ladda upp din faktura logotyp"
195
+
196
+ #: includes/class-wcpdf-settings.php:426
197
+ msgid "Set image"
198
+ msgstr "Välj bild"
199
+
200
+ #: includes/class-wcpdf-settings.php:427
201
+ msgid "Remove image"
202
+ msgstr "Ta bort bild"
203
+
204
+ #: includes/class-wcpdf-settings.php:434
205
+ msgid "Shop Name"
206
+ msgstr "Butiksnamn"
207
+
208
+ #: includes/class-wcpdf-settings.php:448
209
+ msgid "Shop Address"
210
+ msgstr "Butiksadress"
211
+
212
+ #: includes/class-wcpdf-settings.php:464
213
+ msgid "Footer: terms & conditions, policies, etc."
214
+ msgstr "Sidfot: villkor, policy, osv."
215
+
216
+ #: includes/class-wcpdf-settings.php:481
217
+ #: includes/class-wcpdf-writepanels.php:286 templates/pdf/Simple/invoice.php:9
218
+ #: templates/pdf/Simple/invoice.php:21
219
+ #: woocommerce-pdf-invoices-packingslips.php:226
220
+ msgid "Invoice"
221
+ msgstr "Faktura"
222
+
223
+ #: includes/class-wcpdf-settings.php:488
224
+ msgid "Display shipping address"
225
+ msgstr "Visa leveransadress"
226
+
227
+ #: includes/class-wcpdf-settings.php:495
228
+ msgid ""
229
+ "Display shipping address on invoice (in addition to the default billing "
230
+ "address) if different from billing address"
231
+ msgstr ""
232
+ "Visa leveransadress på fakturan om den skiljer sig åt från faktura adressen"
233
+
234
+ #: includes/class-wcpdf-settings.php:501 includes/class-wcpdf-settings.php:675
235
+ msgid "Display email address"
236
+ msgstr "Visa e-postadress"
237
+
238
+ #: includes/class-wcpdf-settings.php:513 includes/class-wcpdf-settings.php:687
239
+ msgid "Display phone number"
240
+ msgstr "Visa telefonnumer"
241
+
242
+ #: includes/class-wcpdf-settings.php:525
243
+ msgid "Display invoice date"
244
+ msgstr "Visa fakturadatum"
245
+
246
+ #: includes/class-wcpdf-settings.php:537
247
+ msgid "Invoice numbers are created by a third-party extension."
248
+ msgstr ""
249
+
250
+ #: includes/class-wcpdf-settings.php:540
251
+ #, php-format
252
+ msgid "Configure it <a href=\"%s\">here</a>."
253
+ msgstr ""
254
+
255
+ #: includes/class-wcpdf-settings.php:549
256
+ msgid "Display invoice number"
257
+ msgstr ""
258
+
259
+ #: includes/class-wcpdf-settings.php:549
260
+ msgid "Display built-in sequential invoice number"
261
+ msgstr "Visa inbyggt sekventiell fakturanummer"
262
+
263
+ #: includes/class-wcpdf-settings.php:566
264
+ msgid "Next invoice number (without prefix/suffix etc.)"
265
+ msgstr "Nästa ordernummer (utan prefix/suffix etc.)"
266
+
267
+ #: includes/class-wcpdf-settings.php:574
268
+ msgid ""
269
+ "This is the number that will be used on the next invoice that is created. By "
270
+ "default, numbering starts from the WooCommerce Order Number of the first "
271
+ "invoice that is created and increases for every new invoice. Note that if "
272
+ "you override this and set it lower than the highest (PDF) invoice number, "
273
+ "this could create double invoice numbers!"
274
+ msgstr ""
275
+ "Det här är numret som kommer användas när nästa order görs. Det förvalda "
276
+ "värdet startar från WooCommerce ordernummer och den första fakturan som "
277
+ "skapas kommer att följa efter varje ny faktura som skapas. Notera att om du "
278
+ "skriver över detta och sätter ett lägre värde än det högsta (PDF) faktura "
279
+ "numret så kan det resultera i dubbla fakturanummer."
280
+
281
+ #: includes/class-wcpdf-settings.php:598
282
+ msgid "Invoice number format"
283
+ msgstr "Fakturanummers format"
284
+
285
+ #: includes/class-wcpdf-settings.php:607
286
+ msgid "Prefix"
287
+ msgstr "Prefix"
288
+
289
+ #: includes/class-wcpdf-settings.php:609
290
+ msgid ""
291
+ "to use the invoice year and/or month, use [invoice_year] or [invoice_month] "
292
+ "respectively"
293
+ msgstr ""
294
+
295
+ #: includes/class-wcpdf-settings.php:612
296
+ msgid "Suffix"
297
+ msgstr "Suflix"
298
+
299
+ #: includes/class-wcpdf-settings.php:617
300
+ msgid "Padding"
301
+ msgstr "Utfyllnad"
302
+
303
+ #: includes/class-wcpdf-settings.php:619
304
+ msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
305
+ msgstr "fyll i antalet värdesiffror här. Skriv \"6\" så visas 42 som 000042"
306
+
307
+ #: includes/class-wcpdf-settings.php:622
308
+ msgid ""
309
+ "note: if you have already created a custom invoice number format with a "
310
+ "filter, the above settings will be ignored"
311
+ msgstr ""
312
+ "obs: om du redan skapat ett eget fakturanummerformat med ett filter, då "
313
+ "ignoreras inställningarna ovan"
314
+
315
+ #: includes/class-wcpdf-settings.php:628
316
+ msgid "Reset invoice number yearly"
317
+ msgstr ""
318
+
319
+ #: includes/class-wcpdf-settings.php:641
320
+ msgid "Extended currency symbol support"
321
+ msgstr ""
322
+
323
+ #: includes/class-wcpdf-settings.php:648
324
+ msgid "Enable this if your currency symbol is not displaying properly"
325
+ msgstr ""
326
+
327
+ #: includes/class-wcpdf-settings.php:655
328
+ #: templates/pdf/Simple/packing-slip.php:9
329
+ #: templates/pdf/Simple/packing-slip.php:21
330
+ #: woocommerce-pdf-invoices-packingslips.php:229
331
+ msgid "Packing Slip"
332
+ msgstr "Följesedel"
333
+
334
+ #: includes/class-wcpdf-settings.php:662
335
+ msgid "Display billing address"
336
+ msgstr "Visa fakturaadress"
337
+
338
+ #: includes/class-wcpdf-settings.php:669
339
+ msgid ""
340
+ "Display billing address on packing slip (in addition to the default shipping "
341
+ "address) if different from shipping address"
342
+ msgstr ""
343
+ "Visa fakturaadress på följesedeln om den skiljer sig från leveransadressen"
344
+
345
+ #: includes/class-wcpdf-settings.php:700
346
+ msgid "Extra template fields"
347
+ msgstr "Extra mallfält"
348
+
349
+ #: includes/class-wcpdf-settings.php:707
350
+ msgid "Extra field 1"
351
+ msgstr "Fält 1"
352
+
353
+ #: includes/class-wcpdf-settings.php:716
354
+ msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
355
+ msgstr "Kolumnnummer 1 i sidfot <i>(Premium)</i> mallen"
356
+
357
+ #: includes/class-wcpdf-settings.php:723
358
+ msgid "Extra field 2"
359
+ msgstr "Fält 2"
360
+
361
+ #: includes/class-wcpdf-settings.php:732
362
+ msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
363
+ msgstr "Kolumnnummer 2 i sidfot <i>(Premium)</i> mallen"
364
+
365
+ #: includes/class-wcpdf-settings.php:739
366
+ msgid "Extra field 3"
367
+ msgstr "Fält 3"
368
+
369
+ #: includes/class-wcpdf-settings.php:748
370
+ msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
371
+ msgstr "Kolumnnummer 3 i sidfot <i>(Premium)</i> mallen"
372
+
373
+ #: includes/class-wcpdf-settings.php:770
374
+ msgid "Debug settings"
375
+ msgstr "Felsökningsinställningar"
376
+
377
+ #: includes/class-wcpdf-settings.php:777
378
+ msgid "Enable debug output"
379
+ msgstr "Aktivera felsökningsinställningar"
380
+
381
+ #: includes/class-wcpdf-settings.php:784
382
+ msgid ""
383
+ "Enable this option to output plugin errors if you're getting a blank page or "
384
+ "other PDF generation issues"
385
+ msgstr ""
386
+ "Aktivera det här alternativet för att mata ut plugin fel om du får en tom "
387
+ "sida eller andra PDF generation frågor"
388
+
389
+ #: includes/class-wcpdf-settings.php:790
390
+ msgid "Output to HTML"
391
+ msgstr "Utgång till HTML"
392
+
393
+ #: includes/class-wcpdf-settings.php:797
394
+ msgid ""
395
+ "Send the template output as HTML to the browser instead of creating a PDF."
396
+ msgstr ""
397
+ "Skicka mallen som HTML till webbläsaren istället för att skapa en PDF-fil."
398
+
399
+ #: includes/class-wcpdf-settings.php:803
400
+ msgid "Use old tmp folder"
401
+ msgstr "Använd \"old tmp\" mapp"
402
+
403
+ #: includes/class-wcpdf-settings.php:810
404
+ msgid ""
405
+ "Before version 1.5 of PDF Invoices, temporary files were stored in the "
406
+ "plugin folder. This setting is only intended for backwards compatibility, "
407
+ "not recommended on new installs!"
408
+ msgstr ""
409
+ "Innan version 1.5 av PDF fakturor, var temporära filer lagrade i plugin-"
410
+ "mappen. Den här inställningen är endast avsedd för bakåtkompatibilitet, "
411
+ "rekommenderas inte på nya installationer!"
412
+
413
+ #: includes/class-wcpdf-settings.php:1225
414
+ msgid "Image resolution"
415
+ msgstr "Bildupplösning"
416
+
417
+ #: includes/class-wcpdf-settings.php:1341
418
+ msgid ""
419
+ "<b>Warning!</b> The settings below are meant for debugging/development only. "
420
+ "Do not use them on a live website!"
421
+ msgstr ""
422
+ "<b>Varning!</b> Inställningarna nedan är avsedda för felsökning / endast "
423
+ "utveckling. Använd dem inte på en aktiv hemsida!"
424
+
425
+ #: includes/class-wcpdf-settings.php:1350
426
+ msgid ""
427
+ "These are used for the (optional) footer columns in the <em>Modern "
428
+ "(Premium)</em> template, but can also be used for other elements in your "
429
+ "custom template"
430
+ msgstr ""
431
+ "Dessa kan användas (valfritt) som kolumner i sidfoten i <em>Modern "
432
+ "(Premium)</em> mallen, men kan även användas för dina egna element i dina "
433
+ "skräddarsydda mallar."
434
+
435
+ #: includes/class-wcpdf-writepanels.php:33
436
+ msgid "PDF Packing Slips"
437
+ msgstr "Följesedlar (PDF)"
438
+
439
+ #: includes/class-wcpdf-writepanels.php:120
440
+ #: includes/class-wcpdf-writepanels.php:252
441
+ #: includes/class-wcpdf-writepanels.php:253
442
+ msgid "PDF Invoice"
443
+ msgstr "Faktura (PDF)"
444
+
445
+ #: includes/class-wcpdf-writepanels.php:125
446
+ #: includes/class-wcpdf-writepanels.php:257
447
+ #: includes/class-wcpdf-writepanels.php:258
448
+ msgid "PDF Packing Slip"
449
+ msgstr "Följesedel (PDF)"
450
+
451
+ #: includes/class-wcpdf-writepanels.php:152
452
+ msgid "Invoice Number"
453
+ msgstr "Fakturanummer"
454
+
455
+ #: includes/class-wcpdf-writepanels.php:211
456
+ msgid "Download invoice (PDF)"
457
+ msgstr "Ladda ner Faktura (PDF)"
458
+
459
+ #: includes/class-wcpdf-writepanels.php:225
460
+ msgid "Create PDF"
461
+ msgstr "Skapa PDF"
462
+
463
+ #: includes/class-wcpdf-writepanels.php:235
464
+ msgid "PDF Invoice data"
465
+ msgstr "PDF Fakturadatum"
466
+
467
+ #: includes/class-wcpdf-writepanels.php:288
468
+ msgid "Invoice Number (unformatted!)"
469
+ msgstr "Faktur nummer (oformaterat)"
470
+
471
+ #: includes/class-wcpdf-writepanels.php:296 templates/pdf/Simple/invoice.php:55
472
+ msgid "Invoice Date:"
473
+ msgstr "Fakturadatum:"
474
+
475
+ #: includes/class-wcpdf-writepanels.php:298
476
+ #: includes/class-wcpdf-writepanels.php:300
477
+ msgid "h"
478
+ msgstr "h"
479
+
480
+ #: includes/class-wcpdf-writepanels.php:298
481
+ #: includes/class-wcpdf-writepanels.php:300
482
+ msgid "m"
483
+ msgstr "m"
484
+
485
+ #: includes/wcpdf-extensions.php:15
486
+ msgid "Check out these premium extensions!"
487
+ msgstr "Kolla in dessa Premium tillägg"
488
+
489
+ #: includes/wcpdf-extensions.php:16
490
+ msgid "click items to read more"
491
+ msgstr "klicka för att se mer"
492
+
493
+ #: includes/wcpdf-extensions.php:21
494
+ msgid ""
495
+ "Premium PDF Invoice bundle: Everything you need for a perfect invoicing "
496
+ "system"
497
+ msgstr ""
498
+
499
+ #: includes/wcpdf-extensions.php:23
500
+ msgid ""
501
+ "Supercharge WooCommerce PDF Invoices & Packing Slips with the all our "
502
+ "premium extensions:"
503
+ msgstr ""
504
+
505
+ #: includes/wcpdf-extensions.php:24
506
+ msgid "Professional features:"
507
+ msgstr ""
508
+
509
+ #: includes/wcpdf-extensions.php:26 includes/wcpdf-extensions.php:56
510
+ msgid "Email/print/download <b>PDF Credit Notes & Proforma invoices</b>"
511
+ msgstr ""
512
+ "E-post/utskrift/nerladdning<b>PDF Kreditfakturor & Proformafakturor</b>"
513
+
514
+ #: includes/wcpdf-extensions.php:27 includes/wcpdf-extensions.php:57
515
+ msgid ""
516
+ "Send out a separate <b>notification email</b> with (or without) PDF invoices/"
517
+ "packing slips, for example to a drop-shipper or a supplier."
518
+ msgstr ""
519
+ "Skicka ett separat <b> e-postmeddelande</b> med eller utan PDF faktura/"
520
+ "följesedel, till exempel \"drop-shipper\" eller en leverantör."
521
+
522
+ #: includes/wcpdf-extensions.php:28 includes/wcpdf-extensions.php:58
523
+ msgid ""
524
+ "Attach <b>up to 3 static files</b> (for example a terms & conditions "
525
+ "document) to the WooCommerce emails of your choice."
526
+ msgstr ""
527
+ "Bifoga<b>upp till 3 statiska filer</b> (till exempel användarvillkor) med "
528
+ "valfri WooCommerce e-post."
529
+
530
+ #: includes/wcpdf-extensions.php:29 includes/wcpdf-extensions.php:59
531
+ msgid ""
532
+ "Use <b>separate numbering systems</b> and/or format for proforma invoices "
533
+ "and credit notes or utilize the main invoice numbering system"
534
+ msgstr ""
535
+ "Använd <b>Separata nummer system</b> för preformafakturor, kreditfakturor "
536
+ "eller använd huvud fakturanummer systemet. "
537
+
538
+ #: includes/wcpdf-extensions.php:30 includes/wcpdf-extensions.php:60
539
+ msgid ""
540
+ "<b>Customize</b> the <b>shipping & billing address</b> format to include "
541
+ "additional custom fields, font sizes etc. without the need to create a "
542
+ "custom template."
543
+ msgstr ""
544
+ "<b>Förändra, faktura och leveransadress</b> efter dina behov, typsnitt "
545
+ "storlek mm. utan att behöva skapa en egen mall. "
546
+
547
+ #: includes/wcpdf-extensions.php:31 includes/wcpdf-extensions.php:61
548
+ msgid "Use the plugin in multilingual <b>WPML</b> setups"
549
+ msgstr "Användar tillägg är flerspråkigt <b>WPML</b> inställningar"
550
+
551
+ #: includes/wcpdf-extensions.php:33 includes/wcpdf-extensions.php:131
552
+ msgid "Advanced, customizable templates"
553
+ msgstr "Avancerade, anpassningsbara mallar"
554
+
555
+ #: includes/wcpdf-extensions.php:35 includes/wcpdf-extensions.php:134
556
+ msgid ""
557
+ "Completely customize the invoice contents (prices, taxes, thumbnails) to "
558
+ "your needs with a drag & drop customizer"
559
+ msgstr ""
560
+ "Helt anpassa faktura innehåll (priser, skatter, miniatyrer) till dina behov "
561
+ "med en dra och släpp Customizer"
562
+
563
+ #: includes/wcpdf-extensions.php:36 includes/wcpdf-extensions.php:135
564
+ msgid "Two extra stylish premade templates (Modern & Business)"
565
+ msgstr "Två extra snygg mallarna (Modern & Business)"
566
+
567
+ #: includes/wcpdf-extensions.php:38
568
+ msgid "Upload automatically to dropbox"
569
+ msgstr ""
570
+
571
+ #: includes/wcpdf-extensions.php:40 includes/wcpdf-extensions.php:97
572
+ msgid ""
573
+ "This extension conveniently uploads all the invoices (and other pdf "
574
+ "documents from the professional extension) that are emailed to your "
575
+ "customers to Dropbox. The best way to keep your invoice administration up to "
576
+ "date!"
577
+ msgstr ""
578
+ "Det här tillägget laddar enkelt alla fakturor (och andra PDF-dokument från "
579
+ "den professionella förlängning) som mailas till dina kunders Dropbox. Det "
580
+ "bästa sättet att hålla din fakturaadministration aktuell!"
581
+
582
+ #: includes/wcpdf-extensions.php:43
583
+ msgid "Get WooCommerce PDF Invoices & Packing Slips Bundle"
584
+ msgstr ""
585
+
586
+ #: includes/wcpdf-extensions.php:52
587
+ msgid "Go Pro: Proforma invoices, credit notes (=refunds) & more!"
588
+ msgstr ""
589
+ "Köp Premium: Proformafaktura, kreditfaktura (=återbetalning) och mycket "
590
+ "annat!"
591
+
592
+ #: includes/wcpdf-extensions.php:54
593
+ msgid ""
594
+ "Supercharge WooCommerce PDF Invoices & Packing Slips with the following "
595
+ "features:"
596
+ msgstr "WooCommerce PDF Invoices & Packing Slips med följande funktioner:"
597
+
598
+ #: includes/wcpdf-extensions.php:63
599
+ msgid "Get WooCommerce PDF Invoices & Packing Slips Professional!"
600
+ msgstr "Få WooCommerce PDF Fakturor & följesedlar Professional!"
601
+
602
+ #: includes/wcpdf-extensions.php:71
603
+ msgid "Automatically send payment reminders to your customers"
604
+ msgstr ""
605
+
606
+ #: includes/wcpdf-extensions.php:73
607
+ msgid "WooCommerce Smart Reminder emails"
608
+ msgstr ""
609
+
610
+ #: includes/wcpdf-extensions.php:75
611
+ msgid "<b>Completely automatic</b> scheduled emails"
612
+ msgstr ""
613
+
614
+ #: includes/wcpdf-extensions.php:76
615
+ msgid ""
616
+ "<b>Rich text editor</b> for the email text, including placeholders for data "
617
+ "from the order (name, order total, etc)"
618
+ msgstr ""
619
+
620
+ #: includes/wcpdf-extensions.php:77
621
+ msgid ""
622
+ "Configure the exact requirements for sending an email (time after order, "
623
+ "order status, payment method)"
624
+ msgstr ""
625
+
626
+ #: includes/wcpdf-extensions.php:78
627
+ msgid ""
628
+ "Fully <b>WPML Compatible</b> – emails will be automatically sent in the "
629
+ "order language."
630
+ msgstr ""
631
+
632
+ #: includes/wcpdf-extensions.php:79
633
+ msgid ""
634
+ "<b>Super versatile!</b> Can be used for any kind of reminder email (review "
635
+ "reminders, repeat purchases)"
636
+ msgstr ""
637
+
638
+ #: includes/wcpdf-extensions.php:80
639
+ msgid "Integrates seamlessly with the PDF Invoices & Packing Slips plugin"
640
+ msgstr ""
641
+
642
+ #: includes/wcpdf-extensions.php:82
643
+ msgid "Get WooCommerce Smart Reminder Emails"
644
+ msgstr ""
645
+
646
+ #: includes/wcpdf-extensions.php:91
647
+ msgid "Upload all invoices automatically to your dropbox"
648
+ msgstr "Ladda upp alla fakturor automatiskt till din Dropbox"
649
+
650
+ #: includes/wcpdf-extensions.php:98
651
+ msgid "Get WooCommerce PDF Invoices & Packing Slips to dropbox!"
652
+ msgstr "Få WooCommerce PDF Fakturor & följesedlar till Dropbox!"
653
+
654
+ #: includes/wcpdf-extensions.php:110
655
+ msgid ""
656
+ "Automatically send new orders or packing slips to your printer, as soon as "
657
+ "the customer orders!"
658
+ msgstr ""
659
+ "Skicka automatiskt nya order eller följesedlar till din skrivare, så snart "
660
+ "kunden beställer!"
661
+
662
+ #: includes/wcpdf-extensions.php:116
663
+ msgid ""
664
+ "Check out the WooCommerce Automatic Order Printing extension from our "
665
+ "partners at Simba Hosting"
666
+ msgstr ""
667
+ "Kolla in WooCommerce automatisk order Printing förlängning från våra "
668
+ "partners på Simba Hosting"
669
+
670
+ #: includes/wcpdf-extensions.php:117
671
+ msgid "WooCommerce Automatic Order Printing"
672
+ msgstr "WooCommerce automatisk order utskrift"
673
+
674
+ #: includes/wcpdf-extensions.php:136
675
+ #, php-format
676
+ msgid "Check out the Premium PDF Invoice & Packing Slips templates at %s."
677
+ msgstr "Kolla in Premium PDF-faktura och följesedlar mallar på %s."
678
+
679
+ #: includes/wcpdf-extensions.php:137
680
+ #, php-format
681
+ msgid "For custom templates, contact us at %s."
682
+ msgstr "För skräddarsydda mallar, kontakta oss på %s"
683
+
684
+ #: includes/wcpdf-extensions.php:146
685
+ msgid "Hide this message"
686
+ msgstr ""
687
+
688
+ #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
689
+ msgid "Billing Address:"
690
+ msgstr "Fakturaadress:"
691
+
692
+ #: templates/pdf/Simple/invoice.php:40
693
+ msgid "Ship To:"
694
+ msgstr "Leveransadress:"
695
+
696
+ #: templates/pdf/Simple/invoice.php:49
697
+ msgid "Invoice Number:"
698
+ msgstr "Fakturanummer:"
699
+
700
+ #: templates/pdf/Simple/invoice.php:60 templates/pdf/Simple/packing-slip.php:48
701
+ msgid "Order Number:"
702
+ msgstr "Ordernummer:"
703
+
704
+ #: templates/pdf/Simple/invoice.php:64 templates/pdf/Simple/packing-slip.php:52
705
+ msgid "Order Date:"
706
+ msgstr "Orderdatum:"
707
+
708
+ #: templates/pdf/Simple/invoice.php:68
709
+ msgid "Payment Method:"
710
+ msgstr "Betalningssätt:"
711
+
712
+ #: templates/pdf/Simple/invoice.php:82 templates/pdf/Simple/packing-slip.php:70
713
+ msgid "Product"
714
+ msgstr "Produkt:"
715
+
716
+ #: templates/pdf/Simple/invoice.php:83 templates/pdf/Simple/packing-slip.php:71
717
+ msgid "Quantity"
718
+ msgstr "Antal:"
719
+
720
+ #: templates/pdf/Simple/invoice.php:84
721
+ msgid "Price"
722
+ msgstr "Pris:"
723
+
724
+ #: templates/pdf/Simple/invoice.php:91 templates/pdf/Simple/packing-slip.php:78
725
+ msgid "Description"
726
+ msgstr "Beskrivning:"
727
+
728
+ #: templates/pdf/Simple/invoice.php:96 templates/pdf/Simple/packing-slip.php:83
729
+ msgid "SKU"
730
+ msgstr "Artikelnummer:"
731
+
732
+ #: templates/pdf/Simple/invoice.php:97 templates/pdf/Simple/packing-slip.php:84
733
+ msgid "SKU:"
734
+ msgstr "SKU:"
735
+
736
+ #: templates/pdf/Simple/invoice.php:98 templates/pdf/Simple/packing-slip.php:85
737
+ msgid "Weight:"
738
+ msgstr "Vikt:"
739
+
740
+ #: templates/pdf/Simple/invoice.php:112
741
+ #: templates/pdf/Simple/packing-slip.php:99
742
+ msgid "Customer Notes"
743
+ msgstr "Kundnoteringar:"
744
+
745
+ #: templates/pdf/Simple/packing-slip.php:29
746
+ msgid "Shipping Address:"
747
+ msgstr "Leveransadress:"
748
+
749
+ #: templates/pdf/Simple/packing-slip.php:56
750
+ msgid "Shipping Method:"
751
+ msgstr "Fraktmetod:"
752
+
753
+ #: woocommerce-pdf-invoices-packingslips.php:123
754
+ #, php-format
755
+ msgid ""
756
+ "WooCommerce PDF Invoices & Packing Slips requires %sWooCommerce%s to be "
757
+ "installed & activated!"
758
+ msgstr ""
759
+ "WooCommerce PDF Invoices & Packing Slips behövert %sWooCommerce%s för att "
760
+ "installeras och aktiveras!"
761
+
762
+ #: woocommerce-pdf-invoices-packingslips.php:377
763
+ #: woocommerce-pdf-invoices-packingslips.php:438
764
+ msgid "N/A"
765
+ msgstr "N/A"
766
+
767
+ #: woocommerce-pdf-invoices-packingslips.php:533
768
+ msgid "Payment method"
769
+ msgstr "Betalningssätt:"
770
+
771
+ #: woocommerce-pdf-invoices-packingslips.php:552
772
+ msgid "Shipping method"
773
+ msgstr "Fraktmetod:"
774
+
775
+ #: woocommerce-pdf-invoices-packingslips.php:712
776
+ #, php-format
777
+ msgid "(includes %s)"
778
+ msgstr ""
779
+
780
+ #: woocommerce-pdf-invoices-packingslips.php:715
781
+ #, php-format
782
+ msgid "(Includes %s)"
783
+ msgstr ""
784
+
785
+ #: woocommerce-pdf-invoices-packingslips.php:744
786
+ msgid "Subtotal"
787
+ msgstr "Belopp:"
788
+
789
+ #: woocommerce-pdf-invoices-packingslips.php:766
790
+ msgid "Shipping"
791
+ msgstr "Frakt:"
792
+
793
+ #: woocommerce-pdf-invoices-packingslips.php:829
794
+ msgid "Discount"
795
+ msgstr "Rabatt:"
796
+
797
+ #: woocommerce-pdf-invoices-packingslips.php:870
798
+ msgid "VAT"
799
+ msgstr "Moms:"
800
+
801
+ #: woocommerce-pdf-invoices-packingslips.php:871
802
+ msgid "Tax rate"
803
+ msgstr "Momssats:"
804
+
805
+ #: woocommerce-pdf-invoices-packingslips.php:908
806
+ msgid "Total ex. VAT"
807
+ msgstr "Totalt exkl. moms:"
808
+
809
+ #: woocommerce-pdf-invoices-packingslips.php:911
810
+ msgid "Total"
811
+ msgstr "Totalt:"
812
+
813
+ #~ msgid ""
814
+ #~ "to use the order year and/or month, use [order_year] or [order_month] "
815
+ #~ "respectively"
816
+ #~ msgstr ""
817
+ #~ "för att använda order datum eller månad , använd [order_year] eller "
818
+ #~ "[order_month] "
languages/wpo_wcpdf.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
5
- "POT-Creation-Date: 2016-02-02 15:18+0100\n"
6
  "PO-Revision-Date: 2015-04-29 08:58+0100\n"
7
  "Last-Translator: \n"
8
  "Language-Team: WP Overnight <support@wpovernight.com>\n"
@@ -10,29 +10,29 @@ msgstr ""
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 1.8.6\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-KeywordsList: __;_e;_x;_n:1,2\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
 
20
- #: includes/class-wcpdf-export.php:373 includes/class-wcpdf-export.php:387
21
- #: includes/class-wcpdf-export.php:394 includes/class-wcpdf-export.php:402
22
  msgid "You do not have sufficient permissions to access this page."
23
  msgstr ""
24
 
25
- #: includes/class-wcpdf-export.php:378
26
  msgid "Some of the export parameters are missing."
27
  msgstr ""
28
 
29
- #: includes/class-wcpdf-export.php:459
30
  msgid "invoice"
31
  msgid_plural "invoices"
32
  msgstr[0] ""
33
  msgstr[1] ""
34
 
35
- #: includes/class-wcpdf-export.php:463
36
  msgid "packing-slip"
37
  msgid_plural "packing-slips"
38
  msgstr[0] ""
@@ -63,43 +63,43 @@ msgstr ""
63
  msgid "WooCommerce PDF Invoices"
64
  msgstr ""
65
 
66
- #: includes/class-wcpdf-settings.php:188
67
  msgid "General settings"
68
  msgstr ""
69
 
70
- #: includes/class-wcpdf-settings.php:195
71
  msgid "How do you want to view the PDF?"
72
  msgstr ""
73
 
74
- #: includes/class-wcpdf-settings.php:203
75
  msgid "Download the PDF"
76
  msgstr ""
77
 
78
- #: includes/class-wcpdf-settings.php:204
79
  msgid "Open the PDF in a new browser tab/window"
80
  msgstr ""
81
 
82
- #: includes/class-wcpdf-settings.php:213
83
  msgid "Admin New Order email"
84
  msgstr ""
85
 
86
- #: includes/class-wcpdf-settings.php:214
87
  msgid "Customer Processing Order email"
88
  msgstr ""
89
 
90
- #: includes/class-wcpdf-settings.php:215
91
  msgid "Customer Completed Order email"
92
  msgstr ""
93
 
94
- #: includes/class-wcpdf-settings.php:216
95
  msgid "Customer Invoice email"
96
  msgstr ""
97
 
98
- #: includes/class-wcpdf-settings.php:225
99
  msgid "Attach invoice to:"
100
  msgstr ""
101
 
102
- #: includes/class-wcpdf-settings.php:233
103
  #, php-format
104
  msgid ""
105
  "It looks like the temp folder (<code>%s</code>) is not writable, check the "
@@ -107,137 +107,150 @@ msgid ""
107
  "plugin will not be able to email invoices."
108
  msgstr ""
109
 
110
- #: includes/class-wcpdf-settings.php:239
111
  msgid "Disable for free products"
112
  msgstr ""
113
 
114
- #: includes/class-wcpdf-settings.php:246
115
  msgid ""
116
  "Disable automatic creation/attachment of invoices when only free products "
117
  "are ordered"
118
  msgstr ""
119
 
120
- #: includes/class-wcpdf-settings.php:253
121
  msgid "Interface"
122
  msgstr ""
123
 
124
- #: includes/class-wcpdf-settings.php:301
125
  msgid "Allow My Account invoice download"
126
  msgstr ""
127
 
128
- #: includes/class-wcpdf-settings.php:309
129
  msgid "Only when an invoice is already created/emailed"
130
  msgstr ""
131
 
132
- #: includes/class-wcpdf-settings.php:310
133
  msgid "Only for specific order statuses (define below)"
134
  msgstr ""
135
 
136
- #: includes/class-wcpdf-settings.php:311
137
  msgid "Always"
138
  msgstr ""
139
 
140
- #: includes/class-wcpdf-settings.php:312
141
  msgid "Never"
142
  msgstr ""
143
 
144
- #: includes/class-wcpdf-settings.php:327
145
  msgid "Enable invoice number column in the orders list"
146
  msgstr ""
147
 
148
- #: includes/class-wcpdf-settings.php:365
149
  msgid "PDF Template settings"
150
  msgstr ""
151
 
152
- #: includes/class-wcpdf-settings.php:377
153
  msgid "Choose a template"
154
  msgstr ""
155
 
156
- #: includes/class-wcpdf-settings.php:385
157
  #, php-format
158
  msgid ""
159
  "Want to use your own template? Copy all the files from <code>%s</code> to "
160
  "your (child) theme in <code>%s</code> to customize them"
161
  msgstr ""
162
 
163
- #: includes/class-wcpdf-settings.php:391
164
  msgid "Paper size"
165
  msgstr ""
166
 
167
- #: includes/class-wcpdf-settings.php:399
168
  msgid "A4"
169
  msgstr ""
170
 
171
- #: includes/class-wcpdf-settings.php:400
172
  msgid "Letter"
173
  msgstr ""
174
 
175
- #: includes/class-wcpdf-settings.php:407
176
  msgid "Shop header/logo"
177
  msgstr ""
178
 
179
- #: includes/class-wcpdf-settings.php:414
180
  msgid "Select or upload your invoice header/logo"
181
  msgstr ""
182
 
183
- #: includes/class-wcpdf-settings.php:415
184
  msgid "Set image"
185
  msgstr ""
186
 
187
- #: includes/class-wcpdf-settings.php:416
188
  msgid "Remove image"
189
  msgstr ""
190
 
191
- #: includes/class-wcpdf-settings.php:423
192
  msgid "Shop Name"
193
  msgstr ""
194
 
195
- #: includes/class-wcpdf-settings.php:437
196
  msgid "Shop Address"
197
  msgstr ""
198
 
199
- #: includes/class-wcpdf-settings.php:453
200
  msgid "Footer: terms & conditions, policies, etc."
201
  msgstr ""
202
 
203
- #: includes/class-wcpdf-settings.php:470
204
- #: includes/class-wcpdf-writepanels.php:285 templates/pdf/Simple/invoice.php:9
205
  #: templates/pdf/Simple/invoice.php:21
206
- #: woocommerce-pdf-invoices-packingslips.php:220
207
  msgid "Invoice"
208
  msgstr ""
209
 
210
- #: includes/class-wcpdf-settings.php:477
211
  msgid "Display shipping address"
212
  msgstr ""
213
 
214
- #: includes/class-wcpdf-settings.php:484
215
  msgid ""
216
  "Display shipping address on invoice (in addition to the default billing "
217
  "address) if different from billing address"
218
  msgstr ""
219
 
220
- #: includes/class-wcpdf-settings.php:490 includes/class-wcpdf-settings.php:617
221
  msgid "Display email address"
222
  msgstr ""
223
 
224
- #: includes/class-wcpdf-settings.php:502 includes/class-wcpdf-settings.php:629
225
  msgid "Display phone number"
226
  msgstr ""
227
 
228
- #: includes/class-wcpdf-settings.php:514
229
  msgid "Display invoice date"
230
  msgstr ""
231
 
232
- #: includes/class-wcpdf-settings.php:527
233
- msgid "Display built-in sequential invoice number"
234
  msgstr ""
235
 
236
  #: includes/class-wcpdf-settings.php:540
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  msgid "Next invoice number (without prefix/suffix etc.)"
238
  msgstr ""
239
 
240
- #: includes/class-wcpdf-settings.php:548
241
  msgid ""
242
  "This is the number that will be used on the next invoice that is created. By "
243
  "default, numbering starts from the WooCommerce Order Number of the first "
@@ -246,132 +259,140 @@ msgid ""
246
  "this could create double invoice numbers!"
247
  msgstr ""
248
 
249
- #: includes/class-wcpdf-settings.php:554
250
  msgid "Invoice number format"
251
  msgstr ""
252
 
253
- #: includes/class-wcpdf-settings.php:563
254
  msgid "Prefix"
255
  msgstr ""
256
 
257
- #: includes/class-wcpdf-settings.php:565
258
  msgid ""
259
  "to use the invoice year and/or month, use [invoice_year] or [invoice_month] "
260
  "respectively"
261
  msgstr ""
262
 
263
- #: includes/class-wcpdf-settings.php:568
264
  msgid "Suffix"
265
  msgstr ""
266
 
267
- #: includes/class-wcpdf-settings.php:573
268
  msgid "Padding"
269
  msgstr ""
270
 
271
- #: includes/class-wcpdf-settings.php:575
272
  msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
273
  msgstr ""
274
 
275
- #: includes/class-wcpdf-settings.php:578
276
  msgid ""
277
  "note: if you have already created a custom invoice number format with a "
278
  "filter, the above settings will be ignored"
279
  msgstr ""
280
 
281
- #: includes/class-wcpdf-settings.php:584
282
  msgid "Reset invoice number yearly"
283
  msgstr ""
284
 
285
- #: includes/class-wcpdf-settings.php:597
 
 
 
 
 
 
 
 
286
  #: templates/pdf/Simple/packing-slip.php:9
287
  #: templates/pdf/Simple/packing-slip.php:21
288
- #: woocommerce-pdf-invoices-packingslips.php:223
289
  msgid "Packing Slip"
290
  msgstr ""
291
 
292
- #: includes/class-wcpdf-settings.php:604
293
  msgid "Display billing address"
294
  msgstr ""
295
 
296
- #: includes/class-wcpdf-settings.php:611
297
  msgid ""
298
  "Display billing address on packing slip (in addition to the default shipping "
299
  "address) if different from shipping address"
300
  msgstr ""
301
 
302
- #: includes/class-wcpdf-settings.php:642
303
  msgid "Extra template fields"
304
  msgstr ""
305
 
306
- #: includes/class-wcpdf-settings.php:649
307
  msgid "Extra field 1"
308
  msgstr ""
309
 
310
- #: includes/class-wcpdf-settings.php:658
311
  msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
312
  msgstr ""
313
 
314
- #: includes/class-wcpdf-settings.php:665
315
  msgid "Extra field 2"
316
  msgstr ""
317
 
318
- #: includes/class-wcpdf-settings.php:674
319
  msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
320
  msgstr ""
321
 
322
- #: includes/class-wcpdf-settings.php:681
323
  msgid "Extra field 3"
324
  msgstr ""
325
 
326
- #: includes/class-wcpdf-settings.php:690
327
  msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
328
  msgstr ""
329
 
330
- #: includes/class-wcpdf-settings.php:733
331
  msgid "Debug settings"
332
  msgstr ""
333
 
334
- #: includes/class-wcpdf-settings.php:740
335
  msgid "Enable debug output"
336
  msgstr ""
337
 
338
- #: includes/class-wcpdf-settings.php:747
339
  msgid ""
340
  "Enable this option to output plugin errors if you're getting a blank page or "
341
  "other PDF generation issues"
342
  msgstr ""
343
 
344
- #: includes/class-wcpdf-settings.php:753
345
  msgid "Output to HTML"
346
  msgstr ""
347
 
348
- #: includes/class-wcpdf-settings.php:760
349
  msgid ""
350
  "Send the template output as HTML to the browser instead of creating a PDF."
351
  msgstr ""
352
 
353
- #: includes/class-wcpdf-settings.php:766
354
  msgid "Use old tmp folder"
355
  msgstr ""
356
 
357
- #: includes/class-wcpdf-settings.php:773
358
  msgid ""
359
  "Before version 1.5 of PDF Invoices, temporary files were stored in the "
360
  "plugin folder. This setting is only intended for backwards compatibility, "
361
  "not recommended on new installs!"
362
  msgstr ""
363
 
364
- #: includes/class-wcpdf-settings.php:1163
365
  msgid "Image resolution"
366
  msgstr ""
367
 
368
- #: includes/class-wcpdf-settings.php:1279
369
  msgid ""
370
  "<b>Warning!</b> The settings below are meant for debugging/development only. "
371
  "Do not use them on a live website!"
372
  msgstr ""
373
 
374
- #: includes/class-wcpdf-settings.php:1288
375
  msgid ""
376
  "These are used for the (optional) footer columns in the <em>Modern "
377
  "(Premium)</em> template, but can also be used for other elements in your "
@@ -382,45 +403,47 @@ msgstr ""
382
  msgid "PDF Packing Slips"
383
  msgstr ""
384
 
385
- #: includes/class-wcpdf-writepanels.php:119
386
- #: includes/class-wcpdf-writepanels.php:252
387
  msgid "PDF Invoice"
388
  msgstr ""
389
 
390
- #: includes/class-wcpdf-writepanels.php:124
391
- #: includes/class-wcpdf-writepanels.php:257
392
  msgid "PDF Packing Slip"
393
  msgstr ""
394
 
395
- #: includes/class-wcpdf-writepanels.php:151
396
  msgid "Invoice Number"
397
  msgstr ""
398
 
399
- #: includes/class-wcpdf-writepanels.php:210
400
  msgid "Download invoice (PDF)"
401
  msgstr ""
402
 
403
- #: includes/class-wcpdf-writepanels.php:224
404
  msgid "Create PDF"
405
  msgstr ""
406
 
407
- #: includes/class-wcpdf-writepanels.php:234
408
  msgid "PDF Invoice data"
409
  msgstr ""
410
 
411
- #: includes/class-wcpdf-writepanels.php:287
412
  msgid "Invoice Number (unformatted!)"
413
  msgstr ""
414
 
415
- #: includes/class-wcpdf-writepanels.php:295 templates/pdf/Simple/invoice.php:55
416
  msgid "Invoice Date:"
417
  msgstr ""
418
 
419
- #: includes/class-wcpdf-writepanels.php:297
 
420
  msgid "h"
421
  msgstr ""
422
 
423
- #: includes/class-wcpdf-writepanels.php:297
 
424
  msgid "m"
425
  msgstr ""
426
 
@@ -432,58 +455,74 @@ msgstr ""
432
  msgid "click items to read more"
433
  msgstr ""
434
 
435
- #: includes/wcpdf-extensions.php:23
436
- msgid "Go Pro: Proforma invoices, credit notes (=refunds) & more!"
 
 
437
  msgstr ""
438
 
439
- #: includes/wcpdf-extensions.php:25
440
  msgid ""
441
- "Supercharge WooCommerce PDF Invoices & Packing Slips with the following "
442
- "features:"
443
  msgstr ""
444
 
445
- #: includes/wcpdf-extensions.php:27
 
 
 
 
446
  msgid "Email/print/download <b>PDF Credit Notes & Proforma invoices</b>"
447
  msgstr ""
448
 
449
- #: includes/wcpdf-extensions.php:28
450
  msgid ""
451
  "Send out a separate <b>notification email</b> with (or without) PDF invoices/"
452
  "packing slips, for example to a drop-shipper or a supplier."
453
  msgstr ""
454
 
455
- #: includes/wcpdf-extensions.php:29
456
  msgid ""
457
  "Attach <b>up to 3 static files</b> (for example a terms & conditions "
458
  "document) to the WooCommerce emails of your choice."
459
  msgstr ""
460
 
461
- #: includes/wcpdf-extensions.php:30
462
  msgid ""
463
  "Use <b>separate numbering systems</b> and/or format for proforma invoices "
464
  "and credit notes or utilize the main invoice numbering system"
465
  msgstr ""
466
 
467
- #: includes/wcpdf-extensions.php:31
468
  msgid ""
469
  "<b>Customize</b> the <b>shipping & billing address</b> format to include "
470
  "additional custom fields, font sizes etc. without the need to create a "
471
  "custom template."
472
  msgstr ""
473
 
474
- #: includes/wcpdf-extensions.php:32
475
  msgid "Use the plugin in multilingual <b>WPML</b> setups"
476
  msgstr ""
477
 
478
- #: includes/wcpdf-extensions.php:34
479
- msgid "Get WooCommerce PDF Invoices & Packing Slips Professional!"
480
  msgstr ""
481
 
482
- #: includes/wcpdf-extensions.php:42
483
- msgid "Upload all invoices automatically to your dropbox"
 
 
484
  msgstr ""
485
 
486
- #: includes/wcpdf-extensions.php:48
 
 
 
 
 
 
 
 
487
  msgid ""
488
  "This extension conveniently uploads all the invoices (and other pdf "
489
  "documents from the professional extension) that are emailed to your "
@@ -491,50 +530,106 @@ msgid ""
491
  "date!"
492
  msgstr ""
493
 
494
- #: includes/wcpdf-extensions.php:49
495
- msgid "Get WooCommerce PDF Invoices & Packing Slips to dropbox!"
496
  msgstr ""
497
 
498
- #: includes/wcpdf-extensions.php:61
 
 
 
 
499
  msgid ""
500
- "Automatically send new orders or packing slips to your printer, as soon as "
501
- "the customer orders!"
 
 
 
 
 
 
 
 
502
  msgstr ""
503
 
504
- #: includes/wcpdf-extensions.php:67
 
 
 
 
 
 
 
 
505
  msgid ""
506
- "Check out the WooCommerce Automatic Order Printing extension from our "
507
- "partners at Simba Hosting"
508
  msgstr ""
509
 
510
- #: includes/wcpdf-extensions.php:68
511
- msgid "WooCommerce Automatic Order Printing"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  msgstr ""
513
 
514
  #: includes/wcpdf-extensions.php:82
515
- msgid "Advanced, customizable templates"
516
  msgstr ""
517
 
518
- #: includes/wcpdf-extensions.php:85
 
 
 
 
 
 
 
 
519
  msgid ""
520
- "Completely customize the invoice contents (prices, taxes, thumbnails) to "
521
- "your needs with a drag & drop customizer"
522
  msgstr ""
523
 
524
- #: includes/wcpdf-extensions.php:86
525
- msgid "Two extra stylish premade templates (Modern & Business)"
 
 
 
 
 
 
526
  msgstr ""
527
 
528
- #: includes/wcpdf-extensions.php:87
529
  #, php-format
530
  msgid "Check out the Premium PDF Invoice & Packing Slips templates at %s."
531
  msgstr ""
532
 
533
- #: includes/wcpdf-extensions.php:88
534
  #, php-format
535
  msgid "For custom templates, contact us at %s."
536
  msgstr ""
537
 
 
 
 
 
538
  #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
539
  msgid "Billing Address:"
540
  msgstr ""
@@ -607,48 +702,53 @@ msgid ""
607
  "installed & activated!"
608
  msgstr ""
609
 
610
- #: woocommerce-pdf-invoices-packingslips.php:367
611
- #: woocommerce-pdf-invoices-packingslips.php:428
612
  msgid "N/A"
613
  msgstr ""
614
 
615
- #: woocommerce-pdf-invoices-packingslips.php:523
616
  msgid "Payment method"
617
  msgstr ""
618
 
619
- #: woocommerce-pdf-invoices-packingslips.php:542
620
  msgid "Shipping method"
621
  msgstr ""
622
 
623
- #: woocommerce-pdf-invoices-packingslips.php:701
 
 
 
 
 
624
  #, php-format
625
  msgid "(Includes %s)"
626
  msgstr ""
627
 
628
- #: woocommerce-pdf-invoices-packingslips.php:722
629
  msgid "Subtotal"
630
  msgstr ""
631
 
632
- #: woocommerce-pdf-invoices-packingslips.php:744
633
  msgid "Shipping"
634
  msgstr ""
635
 
636
- #: woocommerce-pdf-invoices-packingslips.php:807
637
  msgid "Discount"
638
  msgstr ""
639
 
640
- #: woocommerce-pdf-invoices-packingslips.php:848
641
  msgid "VAT"
642
  msgstr ""
643
 
644
- #: woocommerce-pdf-invoices-packingslips.php:849
645
  msgid "Tax rate"
646
  msgstr ""
647
 
648
- #: woocommerce-pdf-invoices-packingslips.php:886
649
  msgid "Total ex. VAT"
650
  msgstr ""
651
 
652
- #: woocommerce-pdf-invoices-packingslips.php:889
653
  msgid "Total"
654
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WooCommerce PDF Invoices & Packing Slips\n"
5
+ "POT-Creation-Date: 2016-11-07 17:00+0100\n"
6
  "PO-Revision-Date: 2015-04-29 08:58+0100\n"
7
  "Last-Translator: \n"
8
  "Language-Team: WP Overnight <support@wpovernight.com>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 1.8.9\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-KeywordsList: __;_e;_x;_n:1,2\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
 
20
+ #: includes/class-wcpdf-export.php:418 includes/class-wcpdf-export.php:432
21
+ #: includes/class-wcpdf-export.php:439 includes/class-wcpdf-export.php:447
22
  msgid "You do not have sufficient permissions to access this page."
23
  msgstr ""
24
 
25
+ #: includes/class-wcpdf-export.php:423
26
  msgid "Some of the export parameters are missing."
27
  msgstr ""
28
 
29
+ #: includes/class-wcpdf-export.php:504
30
  msgid "invoice"
31
  msgid_plural "invoices"
32
  msgstr[0] ""
33
  msgstr[1] ""
34
 
35
+ #: includes/class-wcpdf-export.php:508
36
  msgid "packing-slip"
37
  msgid_plural "packing-slips"
38
  msgstr[0] ""
63
  msgid "WooCommerce PDF Invoices"
64
  msgstr ""
65
 
66
+ #: includes/class-wcpdf-settings.php:199
67
  msgid "General settings"
68
  msgstr ""
69
 
70
+ #: includes/class-wcpdf-settings.php:206
71
  msgid "How do you want to view the PDF?"
72
  msgstr ""
73
 
74
+ #: includes/class-wcpdf-settings.php:214
75
  msgid "Download the PDF"
76
  msgstr ""
77
 
78
+ #: includes/class-wcpdf-settings.php:215
79
  msgid "Open the PDF in a new browser tab/window"
80
  msgstr ""
81
 
82
+ #: includes/class-wcpdf-settings.php:224
83
  msgid "Admin New Order email"
84
  msgstr ""
85
 
86
+ #: includes/class-wcpdf-settings.php:225
87
  msgid "Customer Processing Order email"
88
  msgstr ""
89
 
90
+ #: includes/class-wcpdf-settings.php:226
91
  msgid "Customer Completed Order email"
92
  msgstr ""
93
 
94
+ #: includes/class-wcpdf-settings.php:227
95
  msgid "Customer Invoice email"
96
  msgstr ""
97
 
98
+ #: includes/class-wcpdf-settings.php:236
99
  msgid "Attach invoice to:"
100
  msgstr ""
101
 
102
+ #: includes/class-wcpdf-settings.php:244
103
  #, php-format
104
  msgid ""
105
  "It looks like the temp folder (<code>%s</code>) is not writable, check the "
107
  "plugin will not be able to email invoices."
108
  msgstr ""
109
 
110
+ #: includes/class-wcpdf-settings.php:250
111
  msgid "Disable for free products"
112
  msgstr ""
113
 
114
+ #: includes/class-wcpdf-settings.php:257
115
  msgid ""
116
  "Disable automatic creation/attachment of invoices when only free products "
117
  "are ordered"
118
  msgstr ""
119
 
120
+ #: includes/class-wcpdf-settings.php:264
121
  msgid "Interface"
122
  msgstr ""
123
 
124
+ #: includes/class-wcpdf-settings.php:312
125
  msgid "Allow My Account invoice download"
126
  msgstr ""
127
 
128
+ #: includes/class-wcpdf-settings.php:320
129
  msgid "Only when an invoice is already created/emailed"
130
  msgstr ""
131
 
132
+ #: includes/class-wcpdf-settings.php:321
133
  msgid "Only for specific order statuses (define below)"
134
  msgstr ""
135
 
136
+ #: includes/class-wcpdf-settings.php:322
137
  msgid "Always"
138
  msgstr ""
139
 
140
+ #: includes/class-wcpdf-settings.php:323
141
  msgid "Never"
142
  msgstr ""
143
 
144
+ #: includes/class-wcpdf-settings.php:338
145
  msgid "Enable invoice number column in the orders list"
146
  msgstr ""
147
 
148
+ #: includes/class-wcpdf-settings.php:376
149
  msgid "PDF Template settings"
150
  msgstr ""
151
 
152
+ #: includes/class-wcpdf-settings.php:388
153
  msgid "Choose a template"
154
  msgstr ""
155
 
156
+ #: includes/class-wcpdf-settings.php:396
157
  #, php-format
158
  msgid ""
159
  "Want to use your own template? Copy all the files from <code>%s</code> to "
160
  "your (child) theme in <code>%s</code> to customize them"
161
  msgstr ""
162
 
163
+ #: includes/class-wcpdf-settings.php:402
164
  msgid "Paper size"
165
  msgstr ""
166
 
167
+ #: includes/class-wcpdf-settings.php:410
168
  msgid "A4"
169
  msgstr ""
170
 
171
+ #: includes/class-wcpdf-settings.php:411
172
  msgid "Letter"
173
  msgstr ""
174
 
175
+ #: includes/class-wcpdf-settings.php:418
176
  msgid "Shop header/logo"
177
  msgstr ""
178
 
179
+ #: includes/class-wcpdf-settings.php:425
180
  msgid "Select or upload your invoice header/logo"
181
  msgstr ""
182
 
183
+ #: includes/class-wcpdf-settings.php:426
184
  msgid "Set image"
185
  msgstr ""
186
 
187
+ #: includes/class-wcpdf-settings.php:427
188
  msgid "Remove image"
189
  msgstr ""
190
 
191
+ #: includes/class-wcpdf-settings.php:434
192
  msgid "Shop Name"
193
  msgstr ""
194
 
195
+ #: includes/class-wcpdf-settings.php:448
196
  msgid "Shop Address"
197
  msgstr ""
198
 
199
+ #: includes/class-wcpdf-settings.php:464
200
  msgid "Footer: terms & conditions, policies, etc."
201
  msgstr ""
202
 
203
+ #: includes/class-wcpdf-settings.php:481
204
+ #: includes/class-wcpdf-writepanels.php:286 templates/pdf/Simple/invoice.php:9
205
  #: templates/pdf/Simple/invoice.php:21
206
+ #: woocommerce-pdf-invoices-packingslips.php:226
207
  msgid "Invoice"
208
  msgstr ""
209
 
210
+ #: includes/class-wcpdf-settings.php:488
211
  msgid "Display shipping address"
212
  msgstr ""
213
 
214
+ #: includes/class-wcpdf-settings.php:495
215
  msgid ""
216
  "Display shipping address on invoice (in addition to the default billing "
217
  "address) if different from billing address"
218
  msgstr ""
219
 
220
+ #: includes/class-wcpdf-settings.php:501 includes/class-wcpdf-settings.php:675
221
  msgid "Display email address"
222
  msgstr ""
223
 
224
+ #: includes/class-wcpdf-settings.php:513 includes/class-wcpdf-settings.php:687
225
  msgid "Display phone number"
226
  msgstr ""
227
 
228
+ #: includes/class-wcpdf-settings.php:525
229
  msgid "Display invoice date"
230
  msgstr ""
231
 
232
+ #: includes/class-wcpdf-settings.php:537
233
+ msgid "Invoice numbers are created by a third-party extension."
234
  msgstr ""
235
 
236
  #: includes/class-wcpdf-settings.php:540
237
+ #, php-format
238
+ msgid "Configure it <a href=\"%s\">here</a>."
239
+ msgstr ""
240
+
241
+ #: includes/class-wcpdf-settings.php:549
242
+ msgid "Display invoice number"
243
+ msgstr ""
244
+
245
+ #: includes/class-wcpdf-settings.php:549
246
+ msgid "Display built-in sequential invoice number"
247
+ msgstr ""
248
+
249
+ #: includes/class-wcpdf-settings.php:566
250
  msgid "Next invoice number (without prefix/suffix etc.)"
251
  msgstr ""
252
 
253
+ #: includes/class-wcpdf-settings.php:574
254
  msgid ""
255
  "This is the number that will be used on the next invoice that is created. By "
256
  "default, numbering starts from the WooCommerce Order Number of the first "
259
  "this could create double invoice numbers!"
260
  msgstr ""
261
 
262
+ #: includes/class-wcpdf-settings.php:598
263
  msgid "Invoice number format"
264
  msgstr ""
265
 
266
+ #: includes/class-wcpdf-settings.php:607
267
  msgid "Prefix"
268
  msgstr ""
269
 
270
+ #: includes/class-wcpdf-settings.php:609
271
  msgid ""
272
  "to use the invoice year and/or month, use [invoice_year] or [invoice_month] "
273
  "respectively"
274
  msgstr ""
275
 
276
+ #: includes/class-wcpdf-settings.php:612
277
  msgid "Suffix"
278
  msgstr ""
279
 
280
+ #: includes/class-wcpdf-settings.php:617
281
  msgid "Padding"
282
  msgstr ""
283
 
284
+ #: includes/class-wcpdf-settings.php:619
285
  msgid "enter the number of digits here - enter \"6\" to display 42 as 000042"
286
  msgstr ""
287
 
288
+ #: includes/class-wcpdf-settings.php:622
289
  msgid ""
290
  "note: if you have already created a custom invoice number format with a "
291
  "filter, the above settings will be ignored"
292
  msgstr ""
293
 
294
+ #: includes/class-wcpdf-settings.php:628
295
  msgid "Reset invoice number yearly"
296
  msgstr ""
297
 
298
+ #: includes/class-wcpdf-settings.php:641
299
+ msgid "Extended currency symbol support"
300
+ msgstr ""
301
+
302
+ #: includes/class-wcpdf-settings.php:648
303
+ msgid "Enable this if your currency symbol is not displaying properly"
304
+ msgstr ""
305
+
306
+ #: includes/class-wcpdf-settings.php:655
307
  #: templates/pdf/Simple/packing-slip.php:9
308
  #: templates/pdf/Simple/packing-slip.php:21
309
+ #: woocommerce-pdf-invoices-packingslips.php:229
310
  msgid "Packing Slip"
311
  msgstr ""
312
 
313
+ #: includes/class-wcpdf-settings.php:662
314
  msgid "Display billing address"
315
  msgstr ""
316
 
317
+ #: includes/class-wcpdf-settings.php:669
318
  msgid ""
319
  "Display billing address on packing slip (in addition to the default shipping "
320
  "address) if different from shipping address"
321
  msgstr ""
322
 
323
+ #: includes/class-wcpdf-settings.php:700
324
  msgid "Extra template fields"
325
  msgstr ""
326
 
327
+ #: includes/class-wcpdf-settings.php:707
328
  msgid "Extra field 1"
329
  msgstr ""
330
 
331
+ #: includes/class-wcpdf-settings.php:716
332
  msgid "This is footer column 1 in the <i>Modern (Premium)</i> template"
333
  msgstr ""
334
 
335
+ #: includes/class-wcpdf-settings.php:723
336
  msgid "Extra field 2"
337
  msgstr ""
338
 
339
+ #: includes/class-wcpdf-settings.php:732
340
  msgid "This is footer column 2 in the <i>Modern (Premium)</i> template"
341
  msgstr ""
342
 
343
+ #: includes/class-wcpdf-settings.php:739
344
  msgid "Extra field 3"
345
  msgstr ""
346
 
347
+ #: includes/class-wcpdf-settings.php:748
348
  msgid "This is footer column 3 in the <i>Modern (Premium)</i> template"
349
  msgstr ""
350
 
351
+ #: includes/class-wcpdf-settings.php:770
352
  msgid "Debug settings"
353
  msgstr ""
354
 
355
+ #: includes/class-wcpdf-settings.php:777
356
  msgid "Enable debug output"
357
  msgstr ""
358
 
359
+ #: includes/class-wcpdf-settings.php:784
360
  msgid ""
361
  "Enable this option to output plugin errors if you're getting a blank page or "
362
  "other PDF generation issues"
363
  msgstr ""
364
 
365
+ #: includes/class-wcpdf-settings.php:790
366
  msgid "Output to HTML"
367
  msgstr ""
368
 
369
+ #: includes/class-wcpdf-settings.php:797
370
  msgid ""
371
  "Send the template output as HTML to the browser instead of creating a PDF."
372
  msgstr ""
373
 
374
+ #: includes/class-wcpdf-settings.php:803
375
  msgid "Use old tmp folder"
376
  msgstr ""
377
 
378
+ #: includes/class-wcpdf-settings.php:810
379
  msgid ""
380
  "Before version 1.5 of PDF Invoices, temporary files were stored in the "
381
  "plugin folder. This setting is only intended for backwards compatibility, "
382
  "not recommended on new installs!"
383
  msgstr ""
384
 
385
+ #: includes/class-wcpdf-settings.php:1225
386
  msgid "Image resolution"
387
  msgstr ""
388
 
389
+ #: includes/class-wcpdf-settings.php:1341
390
  msgid ""
391
  "<b>Warning!</b> The settings below are meant for debugging/development only. "
392
  "Do not use them on a live website!"
393
  msgstr ""
394
 
395
+ #: includes/class-wcpdf-settings.php:1350
396
  msgid ""
397
  "These are used for the (optional) footer columns in the <em>Modern "
398
  "(Premium)</em> template, but can also be used for other elements in your "
403
  msgid "PDF Packing Slips"
404
  msgstr ""
405
 
406
+ #: includes/class-wcpdf-writepanels.php:120
407
+ #: includes/class-wcpdf-writepanels.php:253
408
  msgid "PDF Invoice"
409
  msgstr ""
410
 
411
+ #: includes/class-wcpdf-writepanels.php:125
412
+ #: includes/class-wcpdf-writepanels.php:258
413
  msgid "PDF Packing Slip"
414
  msgstr ""
415
 
416
+ #: includes/class-wcpdf-writepanels.php:152
417
  msgid "Invoice Number"
418
  msgstr ""
419
 
420
+ #: includes/class-wcpdf-writepanels.php:211
421
  msgid "Download invoice (PDF)"
422
  msgstr ""
423
 
424
+ #: includes/class-wcpdf-writepanels.php:225
425
  msgid "Create PDF"
426
  msgstr ""
427
 
428
+ #: includes/class-wcpdf-writepanels.php:235
429
  msgid "PDF Invoice data"
430
  msgstr ""
431
 
432
+ #: includes/class-wcpdf-writepanels.php:288
433
  msgid "Invoice Number (unformatted!)"
434
  msgstr ""
435
 
436
+ #: includes/class-wcpdf-writepanels.php:296 templates/pdf/Simple/invoice.php:55
437
  msgid "Invoice Date:"
438
  msgstr ""
439
 
440
+ #: includes/class-wcpdf-writepanels.php:298
441
+ #: includes/class-wcpdf-writepanels.php:300
442
  msgid "h"
443
  msgstr ""
444
 
445
+ #: includes/class-wcpdf-writepanels.php:298
446
+ #: includes/class-wcpdf-writepanels.php:300
447
  msgid "m"
448
  msgstr ""
449
 
455
  msgid "click items to read more"
456
  msgstr ""
457
 
458
+ #: includes/wcpdf-extensions.php:21
459
+ msgid ""
460
+ "Premium PDF Invoice bundle: Everything you need for a perfect invoicing "
461
+ "system"
462
  msgstr ""
463
 
464
+ #: includes/wcpdf-extensions.php:23
465
  msgid ""
466
+ "Supercharge WooCommerce PDF Invoices & Packing Slips with the all our "
467
+ "premium extensions:"
468
  msgstr ""
469
 
470
+ #: includes/wcpdf-extensions.php:24
471
+ msgid "Professional features:"
472
+ msgstr ""
473
+
474
+ #: includes/wcpdf-extensions.php:26 includes/wcpdf-extensions.php:56
475
  msgid "Email/print/download <b>PDF Credit Notes & Proforma invoices</b>"
476
  msgstr ""
477
 
478
+ #: includes/wcpdf-extensions.php:27 includes/wcpdf-extensions.php:57
479
  msgid ""
480
  "Send out a separate <b>notification email</b> with (or without) PDF invoices/"
481
  "packing slips, for example to a drop-shipper or a supplier."
482
  msgstr ""
483
 
484
+ #: includes/wcpdf-extensions.php:28 includes/wcpdf-extensions.php:58
485
  msgid ""
486
  "Attach <b>up to 3 static files</b> (for example a terms & conditions "
487
  "document) to the WooCommerce emails of your choice."
488
  msgstr ""
489
 
490
+ #: includes/wcpdf-extensions.php:29 includes/wcpdf-extensions.php:59
491
  msgid ""
492
  "Use <b>separate numbering systems</b> and/or format for proforma invoices "
493
  "and credit notes or utilize the main invoice numbering system"
494
  msgstr ""
495
 
496
+ #: includes/wcpdf-extensions.php:30 includes/wcpdf-extensions.php:60
497
  msgid ""
498
  "<b>Customize</b> the <b>shipping & billing address</b> format to include "
499
  "additional custom fields, font sizes etc. without the need to create a "
500
  "custom template."
501
  msgstr ""
502
 
503
+ #: includes/wcpdf-extensions.php:31 includes/wcpdf-extensions.php:61
504
  msgid "Use the plugin in multilingual <b>WPML</b> setups"
505
  msgstr ""
506
 
507
+ #: includes/wcpdf-extensions.php:33 includes/wcpdf-extensions.php:131
508
+ msgid "Advanced, customizable templates"
509
  msgstr ""
510
 
511
+ #: includes/wcpdf-extensions.php:35 includes/wcpdf-extensions.php:134
512
+ msgid ""
513
+ "Completely customize the invoice contents (prices, taxes, thumbnails) to "
514
+ "your needs with a drag & drop customizer"
515
  msgstr ""
516
 
517
+ #: includes/wcpdf-extensions.php:36 includes/wcpdf-extensions.php:135
518
+ msgid "Two extra stylish premade templates (Modern & Business)"
519
+ msgstr ""
520
+
521
+ #: includes/wcpdf-extensions.php:38
522
+ msgid "Upload automatically to dropbox"
523
+ msgstr ""
524
+
525
+ #: includes/wcpdf-extensions.php:40 includes/wcpdf-extensions.php:97
526
  msgid ""
527
  "This extension conveniently uploads all the invoices (and other pdf "
528
  "documents from the professional extension) that are emailed to your "
530
  "date!"
531
  msgstr ""
532
 
533
+ #: includes/wcpdf-extensions.php:43
534
+ msgid "Get WooCommerce PDF Invoices & Packing Slips Bundle"
535
  msgstr ""
536
 
537
+ #: includes/wcpdf-extensions.php:52
538
+ msgid "Go Pro: Proforma invoices, credit notes (=refunds) & more!"
539
+ msgstr ""
540
+
541
+ #: includes/wcpdf-extensions.php:54
542
  msgid ""
543
+ "Supercharge WooCommerce PDF Invoices & Packing Slips with the following "
544
+ "features:"
545
+ msgstr ""
546
+
547
+ #: includes/wcpdf-extensions.php:63
548
+ msgid "Get WooCommerce PDF Invoices & Packing Slips Professional!"
549
+ msgstr ""
550
+
551
+ #: includes/wcpdf-extensions.php:71
552
+ msgid "Automatically send payment reminders to your customers"
553
  msgstr ""
554
 
555
+ #: includes/wcpdf-extensions.php:73
556
+ msgid "WooCommerce Smart Reminder emails"
557
+ msgstr ""
558
+
559
+ #: includes/wcpdf-extensions.php:75
560
+ msgid "<b>Completely automatic</b> scheduled emails"
561
+ msgstr ""
562
+
563
+ #: includes/wcpdf-extensions.php:76
564
  msgid ""
565
+ "<b>Rich text editor</b> for the email text, including placeholders for data "
566
+ "from the order (name, order total, etc)"
567
  msgstr ""
568
 
569
+ #: includes/wcpdf-extensions.php:77
570
+ msgid ""
571
+ "Configure the exact requirements for sending an email (time after order, "
572
+ "order status, payment method)"
573
+ msgstr ""
574
+
575
+ #: includes/wcpdf-extensions.php:78
576
+ msgid ""
577
+ "Fully <b>WPML Compatible</b> – emails will be automatically sent in the "
578
+ "order language."
579
+ msgstr ""
580
+
581
+ #: includes/wcpdf-extensions.php:79
582
+ msgid ""
583
+ "<b>Super versatile!</b> Can be used for any kind of reminder email (review "
584
+ "reminders, repeat purchases)"
585
+ msgstr ""
586
+
587
+ #: includes/wcpdf-extensions.php:80
588
+ msgid "Integrates seamlessly with the PDF Invoices & Packing Slips plugin"
589
  msgstr ""
590
 
591
  #: includes/wcpdf-extensions.php:82
592
+ msgid "Get WooCommerce Smart Reminder Emails"
593
  msgstr ""
594
 
595
+ #: includes/wcpdf-extensions.php:91
596
+ msgid "Upload all invoices automatically to your dropbox"
597
+ msgstr ""
598
+
599
+ #: includes/wcpdf-extensions.php:98
600
+ msgid "Get WooCommerce PDF Invoices & Packing Slips to dropbox!"
601
+ msgstr ""
602
+
603
+ #: includes/wcpdf-extensions.php:110
604
  msgid ""
605
+ "Automatically send new orders or packing slips to your printer, as soon as "
606
+ "the customer orders!"
607
  msgstr ""
608
 
609
+ #: includes/wcpdf-extensions.php:116
610
+ msgid ""
611
+ "Check out the WooCommerce Automatic Order Printing extension from our "
612
+ "partners at Simba Hosting"
613
+ msgstr ""
614
+
615
+ #: includes/wcpdf-extensions.php:117
616
+ msgid "WooCommerce Automatic Order Printing"
617
  msgstr ""
618
 
619
+ #: includes/wcpdf-extensions.php:136
620
  #, php-format
621
  msgid "Check out the Premium PDF Invoice & Packing Slips templates at %s."
622
  msgstr ""
623
 
624
+ #: includes/wcpdf-extensions.php:137
625
  #, php-format
626
  msgid "For custom templates, contact us at %s."
627
  msgstr ""
628
 
629
+ #: includes/wcpdf-extensions.php:146
630
+ msgid "Hide this message"
631
+ msgstr ""
632
+
633
  #: templates/pdf/Simple/invoice.php:29 templates/pdf/Simple/packing-slip.php:40
634
  msgid "Billing Address:"
635
  msgstr ""
702
  "installed & activated!"
703
  msgstr ""
704
 
705
+ #: woocommerce-pdf-invoices-packingslips.php:377
706
+ #: woocommerce-pdf-invoices-packingslips.php:438
707
  msgid "N/A"
708
  msgstr ""
709
 
710
+ #: woocommerce-pdf-invoices-packingslips.php:533
711
  msgid "Payment method"
712
  msgstr ""
713
 
714
+ #: woocommerce-pdf-invoices-packingslips.php:552
715
  msgid "Shipping method"
716
  msgstr ""
717
 
718
+ #: woocommerce-pdf-invoices-packingslips.php:712
719
+ #, php-format
720
+ msgid "(includes %s)"
721
+ msgstr ""
722
+
723
+ #: woocommerce-pdf-invoices-packingslips.php:715
724
  #, php-format
725
  msgid "(Includes %s)"
726
  msgstr ""
727
 
728
+ #: woocommerce-pdf-invoices-packingslips.php:744
729
  msgid "Subtotal"
730
  msgstr ""
731
 
732
+ #: woocommerce-pdf-invoices-packingslips.php:766
733
  msgid "Shipping"
734
  msgstr ""
735
 
736
+ #: woocommerce-pdf-invoices-packingslips.php:829
737
  msgid "Discount"
738
  msgstr ""
739
 
740
+ #: woocommerce-pdf-invoices-packingslips.php:870
741
  msgid "VAT"
742
  msgstr ""
743
 
744
+ #: woocommerce-pdf-invoices-packingslips.php:871
745
  msgid "Tax rate"
746
  msgstr ""
747
 
748
+ #: woocommerce-pdf-invoices-packingslips.php:908
749
  msgid "Total ex. VAT"
750
  msgstr ""
751
 
752
+ #: woocommerce-pdf-invoices-packingslips.php:911
753
  msgid "Total"
754
  msgstr ""
lib/dompdf/dompdf.php CHANGED
@@ -1,289 +1,289 @@
1
- <?php
2
- /**
3
- * Command line utility to use dompdf.
4
- * Can also be used with HTTP GET parameters
5
- *
6
- * @package dompdf
7
- * @link http://dompdf.github.com/
8
- * @author Benj Carson <benjcarson@digitaljunkies.ca>
9
- * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
10
- */
11
-
12
- /**
13
- * Display command line usage
14
- */
15
- function dompdf_usage() {
16
- $default_paper_size = DOMPDF_DEFAULT_PAPER_SIZE;
17
-
18
- echo <<<EOD
19
-
20
- Usage: {$_SERVER["argv"][0]} [options] html_file
21
-
22
- html_file can be a filename, a url if fopen_wrappers are enabled, or the '-' character to read from standard input.
23
-
24
- Options:
25
- -h Show this message
26
- -l List available paper sizes
27
- -p size Paper size; something like 'letter', 'A4', 'legal', etc.
28
- The default is '$default_paper_size'
29
- -o orientation Either 'portrait' or 'landscape'. Default is 'portrait'
30
- -b path Set the 'document root' of the html_file.
31
- Relative urls (for stylesheets) are resolved using this directory.
32
- Default is the directory of html_file.
33
- -f file The output filename. Default is the input [html_file].pdf
34
- -v Verbose: display html parsing warnings and file not found errors.
35
- -d Very verbose: display oodles of debugging output: every frame
36
- in the tree printed to stdout.
37
- -t Comma separated list of debugging types (page-break,reflow,split)
38
-
39
- EOD;
40
- exit;
41
- }
42
-
43
- /**
44
- * Parses command line options
45
- *
46
- * @return array The command line options
47
- */
48
- function getoptions() {
49
-
50
- $opts = array();
51
-
52
- if ( $_SERVER["argc"] == 1 )
53
- return $opts;
54
-
55
- $i = 1;
56
- while ($i < $_SERVER["argc"]) {
57
-
58
- switch ($_SERVER["argv"][$i]) {
59
-
60
- case "--help":
61
- case "-h":
62
- $opts["h"] = true;
63
- $i++;
64
- break;
65
-
66
- case "-l":
67
- $opts["l"] = true;
68
- $i++;
69
- break;
70
-
71
- case "-p":
72
- if ( !isset($_SERVER["argv"][$i+1]) )
73
- die("-p switch requires a size parameter\n");
74
- $opts["p"] = $_SERVER["argv"][$i+1];
75
- $i += 2;
76
- break;
77
-
78
- case "-o":
79
- if ( !isset($_SERVER["argv"][$i+1]) )
80
- die("-o switch requires an orientation parameter\n");
81
- $opts["o"] = $_SERVER["argv"][$i+1];
82
- $i += 2;
83
- break;
84
-
85
- case "-b":
86
- if ( !isset($_SERVER["argv"][$i+1]) )
87
- die("-b switch requires a path parameter\n");
88
- $opts["b"] = $_SERVER["argv"][$i+1];
89
- $i += 2;
90
- break;
91
-
92
- case "-f":
93
- if ( !isset($_SERVER["argv"][$i+1]) )
94
- die("-f switch requires a filename parameter\n");
95
- $opts["f"] = $_SERVER["argv"][$i+1];
96
- $i += 2;
97
- break;
98
-
99
- case "-v":
100
- $opts["v"] = true;
101
- $i++;
102
- break;
103
-
104
- case "-d":
105
- $opts["d"] = true;
106
- $i++;
107
- break;
108
-
109
- case "-t":
110
- if ( !isset($_SERVER['argv'][$i + 1]) )
111
- die("-t switch requires a comma separated list of types\n");
112
- $opts["t"] = $_SERVER['argv'][$i+1];
113
- $i += 2;
114
- break;
115
-
116
- default:
117
- $opts["filename"] = $_SERVER["argv"][$i];
118
- $i++;
119
- break;
120
- }
121
-
122
- }
123
- return $opts;
124
- }
125
-
126
- require_once("dompdf_config.inc.php");
127
- global $_dompdf_show_warnings, $_dompdf_debug, $_DOMPDF_DEBUG_TYPES;
128
-
129
- $sapi = php_sapi_name();
130
- $options = array();
131
-
132
- switch ( $sapi ) {
133
-
134
- case "cli":
135
-
136
- $opts = getoptions();
137
-
138
- if ( isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"])) ) {
139
- dompdf_usage();
140
- exit;
141
- }
142
-
143
- if ( isset($opts["l"]) ) {
144
- echo "\nUnderstood paper sizes:\n";
145
-
146
- foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size)
147
- echo " " . mb_strtoupper($size) . "\n";
148
- exit;
149
- }
150
- $file = $opts["filename"];
151
-
152
- if ( isset($opts["p"]) )
153
- $paper = $opts["p"];
154
- else
155
- $paper = DOMPDF_DEFAULT_PAPER_SIZE;
156
-
157
- if ( isset($opts["o"]) )
158
- $orientation = $opts["o"];
159
- else
160
- $orientation = "portrait";
161
-
162
- if ( isset($opts["b"]) )
163
- $base_path = $opts["b"];
164
-
165
- if ( isset($opts["f"]) )
166
- $outfile = $opts["f"];
167
- else {
168
- if ( $file === "-" )
169
- $outfile = "dompdf_out.pdf";
170
- else
171
- $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf";
172
- }
173
-
174
- if ( isset($opts["v"]) )
175
- $_dompdf_show_warnings = true;
176
-
177
- if ( isset($opts["d"]) ) {
178
- $_dompdf_show_warnings = true;
179
- $_dompdf_debug = true;
180
- }
181
-
182
- if ( isset($opts['t']) ) {
183
- $arr = explode(',',$opts['t']);
184
- $types = array();
185
- foreach ($arr as $type)
186
- $types[ trim($type) ] = 1;
187
- $_DOMPDF_DEBUG_TYPES = $types;
188
- }
189
-
190
- $save_file = true;
191
-
192
- break;
193
-
194
- default:
195
-
196
- if ( isset($_GET["input_file"]) )
197
- $file = rawurldecode($_GET["input_file"]);
198
- else
199
- throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable).");
200
-
201
- if ( isset($_GET["paper"]) )
202
- $paper = rawurldecode($_GET["paper"]);
203
- else
204
- $paper = DOMPDF_DEFAULT_PAPER_SIZE;
205
-
206
- if ( isset($_GET["orientation"]) )
207
- $orientation = rawurldecode($_GET["orientation"]);
208
- else
209
- $orientation = "portrait";
210
-
211
- if ( isset($_GET["base_path"]) ) {
212
- $base_path = rawurldecode($_GET["base_path"]);
213
- $file = $base_path . $file; # Set the input file
214
- }
215
-
216
- if ( isset($_GET["options"]) ) {
217
- $options = $_GET["options"];
218
- }
219
-
220
- $file_parts = explode_url($file);
221
-
222
- /* Check to see if the input file is local and, if so, that the base path falls within that specified by DOMDPF_CHROOT */
223
- if(($file_parts['protocol'] == '' || $file_parts['protocol'] === 'file://')) {
224
- $file = realpath($file);
225
- if ( strpos($file, DOMPDF_CHROOT) !== 0 ) {
226
- throw new DOMPDF_Exception("Permission denied on $file. The file could not be found under the directory specified by DOMPDF_CHROOT.");
227
- }
228
- }
229
-
230
- if($file_parts['protocol'] === 'php://') {
231
- throw new DOMPDF_Exception("Permission denied on $file. This script does not allow PHP streams.");
232
- }
233
-
234
- $outfile = "dompdf_out.pdf"; # Don't allow them to set the output file
235
- $save_file = false; # Don't save the file
236
-
237
- break;
238
- }
239
-
240
- $dompdf = new DOMPDF();
241
-
242
- if ( $file === "-" ) {
243
- $str = "";
244
- while ( !feof(STDIN) )
245
- $str .= fread(STDIN, 4096);
246
-
247
- $dompdf->load_html($str);
248
-
249
- } else
250
- $dompdf->load_html_file($file);
251
-
252
- if ( isset($base_path) ) {
253
- $dompdf->set_base_path($base_path);
254
- }
255
-
256
- $dompdf->set_paper($paper, $orientation);
257
-
258
- $dompdf->render();
259
-
260
- if ( $_dompdf_show_warnings ) {
261
- global $_dompdf_warnings;
262
- foreach ($_dompdf_warnings as $msg)
263
- echo $msg . "\n";
264
- echo $dompdf->get_canvas()->get_cpdf()->messages;
265
- flush();
266
- }
267
-
268
- if ( $save_file ) {
269
- // if ( !is_writable($outfile) )
270
- // throw new DOMPDF_Exception("'$outfile' is not writable.");
271
- if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" )
272
- $outfile = str_replace(".pdf", ".png", $outfile);
273
-
274
- list($proto, $host, $path, $file) = explode_url($outfile);
275
- if ( $proto != "" ) // i.e. not file://
276
- $outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file
277
-
278
- $outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile);
279
-
280
- if ( strpos($outfile, DOMPDF_CHROOT) !== 0 )
281
- throw new DOMPDF_Exception("Permission denied.");
282
-
283
- file_put_contents($outfile, $dompdf->output( array("compress" => 0) ));
284
- exit(0);
285
- }
286
-
287
- if ( !headers_sent() ) {
288
- $dompdf->stream($outfile, $options);
289
- }
1
+ <?php
2
+ /**
3
+ * Command line utility to use dompdf.
4
+ * Can also be used with HTTP GET parameters
5
+ *
6
+ * @package dompdf
7
+ * @link http://dompdf.github.com/
8
+ * @author Benj Carson <benjcarson@digitaljunkies.ca>
9
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
10
+ */
11
+
12
+ /**
13
+ * Display command line usage
14
+ */
15
+ function dompdf_usage() {
16
+ $default_paper_size = DOMPDF_DEFAULT_PAPER_SIZE;
17
+
18
+ echo <<<EOD
19
+
20
+ Usage: {$_SERVER["argv"][0]} [options] html_file
21
+
22
+ html_file can be a filename, a url if fopen_wrappers are enabled, or the '-' character to read from standard input.
23
+
24
+ Options:
25
+ -h Show this message
26
+ -l List available paper sizes
27
+ -p size Paper size; something like 'letter', 'A4', 'legal', etc.
28
+ The default is '$default_paper_size'
29
+ -o orientation Either 'portrait' or 'landscape'. Default is 'portrait'
30
+ -b path Set the 'document root' of the html_file.
31
+ Relative urls (for stylesheets) are resolved using this directory.
32
+ Default is the directory of html_file.
33
+ -f file The output filename. Default is the input [html_file].pdf
34
+ -v Verbose: display html parsing warnings and file not found errors.
35
+ -d Very verbose: display oodles of debugging output: every frame
36
+ in the tree printed to stdout.
37
+ -t Comma separated list of debugging types (page-break,reflow,split)
38
+
39
+ EOD;
40
+ exit;
41
+ }
42
+
43
+ /**
44
+ * Parses command line options
45
+ *
46
+ * @return array The command line options
47
+ */
48
+ function getoptions() {
49
+
50
+ $opts = array();
51
+
52
+ if ( $_SERVER["argc"] == 1 )
53
+ return $opts;
54
+
55
+ $i = 1;
56
+ while ($i < $_SERVER["argc"]) {
57
+
58
+ switch ($_SERVER["argv"][$i]) {
59
+
60
+ case "--help":
61
+ case "-h":
62
+ $opts["h"] = true;
63
+ $i++;
64
+ break;
65
+
66
+ case "-l":
67
+ $opts["l"] = true;
68
+ $i++;
69
+ break;
70
+
71
+ case "-p":
72
+ if ( !isset($_SERVER["argv"][$i+1]) )
73
+ die("-p switch requires a size parameter\n");
74
+ $opts["p"] = $_SERVER["argv"][$i+1];
75
+ $i += 2;
76
+ break;
77
+
78
+ case "-o":
79
+ if ( !isset($_SERVER["argv"][$i+1]) )
80
+ die("-o switch requires an orientation parameter\n");
81
+ $opts["o"] = $_SERVER["argv"][$i+1];
82
+ $i += 2;
83
+ break;
84
+
85
+ case "-b":
86
+ if ( !isset($_SERVER["argv"][$i+1]) )
87
+ die("-b switch requires a path parameter\n");
88
+ $opts["b"] = $_SERVER["argv"][$i+1];
89
+ $i += 2;
90
+ break;
91
+
92
+ case "-f":
93
+ if ( !isset($_SERVER["argv"][$i+1]) )
94
+ die("-f switch requires a filename parameter\n");
95
+ $opts["f"] = $_SERVER["argv"][$i+1];
96
+ $i += 2;
97
+ break;
98
+
99
+ case "-v":
100
+ $opts["v"] = true;
101
+ $i++;
102
+ break;
103
+
104
+ case "-d":
105
+ $opts["d"] = true;
106
+ $i++;
107
+ break;
108
+
109
+ case "-t":
110
+ if ( !isset($_SERVER['argv'][$i + 1]) )
111
+ die("-t switch requires a comma separated list of types\n");
112
+ $opts["t"] = $_SERVER['argv'][$i+1];
113
+ $i += 2;
114
+ break;
115
+
116
+ default:
117
+ $opts["filename"] = $_SERVER["argv"][$i];
118
+ $i++;
119
+ break;
120
+ }
121
+
122
+ }
123
+ return $opts;
124
+ }
125
+
126
+ require_once("dompdf_config.inc.php");
127
+ global $_dompdf_show_warnings, $_dompdf_debug, $_DOMPDF_DEBUG_TYPES;
128
+
129
+ $sapi = php_sapi_name();
130
+ $options = array();
131
+
132
+ switch ( $sapi ) {
133
+
134
+ case "cli":
135
+
136
+ $opts = getoptions();
137
+
138
+ if ( isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"])) ) {
139
+ dompdf_usage();
140
+ exit;
141
+ }
142
+
143
+ if ( isset($opts["l"]) ) {
144
+ echo "\nUnderstood paper sizes:\n";
145
+
146
+ foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size)
147
+ echo " " . mb_strtoupper($size) . "\n";
148
+ exit;
149
+ }
150
+ $file = $opts["filename"];
151
+
152
+ if ( isset($opts["p"]) )
153
+ $paper = $opts["p"];
154
+ else
155
+ $paper = DOMPDF_DEFAULT_PAPER_SIZE;
156
+
157
+ if ( isset($opts["o"]) )
158
+ $orientation = $opts["o"];
159
+ else
160
+ $orientation = "portrait";
161
+
162
+ if ( isset($opts["b"]) )
163
+ $base_path = $opts["b"];
164
+
165
+ if ( isset($opts["f"]) )
166
+ $outfile = $opts["f"];
167
+ else {
168
+ if ( $file === "-" )
169
+ $outfile = "dompdf_out.pdf";
170
+ else
171
+ $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf";
172
+ }
173
+
174
+ if ( isset($opts["v"]) )
175
+ $_dompdf_show_warnings = true;
176
+
177
+ if ( isset($opts["d"]) ) {
178
+ $_dompdf_show_warnings = true;
179
+ $_dompdf_debug = true;
180
+ }
181
+
182
+ if ( isset($opts['t']) ) {
183
+ $arr = explode(',',$opts['t']);
184
+ $types = array();
185
+ foreach ($arr as $type)
186
+ $types[ trim($type) ] = 1;
187
+ $_DOMPDF_DEBUG_TYPES = $types;
188
+ }
189
+
190
+ $save_file = true;
191
+
192
+ break;
193
+
194
+ default:
195
+
196
+ if ( isset($_GET["input_file"]) )
197
+ $file = rawurldecode($_GET["input_file"]);
198
+ else
199
+ throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable).");
200
+
201
+ if ( isset($_GET["paper"]) )
202
+ $paper = rawurldecode($_GET["paper"]);
203
+ else
204
+ $paper = DOMPDF_DEFAULT_PAPER_SIZE;
205
+
206
+ if ( isset($_GET["orientation"]) )
207
+ $orientation = rawurldecode($_GET["orientation"]);
208
+ else
209
+ $orientation = "portrait";
210
+
211
+ if ( isset($_GET["base_path"]) ) {
212
+ $base_path = rawurldecode($_GET["base_path"]);
213
+ $file = $base_path . $file; # Set the input file
214
+ }
215
+
216
+ if ( isset($_GET["options"]) ) {
217
+ $options = $_GET["options"];
218
+ }
219
+
220
+ $file_parts = explode_url($file);
221
+
222
+ /* Check to see if the input file is local and, if so, that the base path falls within that specified by DOMDPF_CHROOT */
223
+ if(($file_parts['protocol'] == '' || $file_parts['protocol'] === 'file://')) {
224
+ $file = realpath($file);
225
+ if ( strpos($file, DOMPDF_CHROOT) !== 0 ) {
226
+ throw new DOMPDF_Exception("Permission denied on $file. The file could not be found under the directory specified by DOMPDF_CHROOT.");
227
+ }
228
+ }
229
+
230
+ if($file_parts['protocol'] === 'php://') {
231
+ throw new DOMPDF_Exception("Permission denied on $file. This script does not allow PHP streams.");
232
+ }
233
+
234
+ $outfile = "dompdf_out.pdf"; # Don't allow them to set the output file
235
+ $save_file = false; # Don't save the file
236
+
237
+ break;
238
+ }
239
+
240
+ $dompdf = new DOMPDF();
241
+
242
+ if ( $file === "-" ) {
243
+ $str = "";
244
+ while ( !feof(STDIN) )
245
+ $str .= fread(STDIN, 4096);
246
+
247
+ $dompdf->load_html($str);
248
+
249
+ } else
250
+ $dompdf->load_html_file($file);
251
+
252
+ if ( isset($base_path) ) {
253
+ $dompdf->set_base_path($base_path);
254
+ }
255
+
256
+ $dompdf->set_paper($paper, $orientation);
257
+
258
+ $dompdf->render();
259
+
260
+ if ( $_dompdf_show_warnings ) {
261
+ global $_dompdf_warnings;
262
+ foreach ($_dompdf_warnings as $msg)
263
+ echo $msg . "\n";
264
+ echo $dompdf->get_canvas()->get_cpdf()->messages;
265
+ flush();
266
+ }
267
+
268
+ if ( $save_file ) {
269
+ // if ( !is_writable($outfile) )
270
+ // throw new DOMPDF_Exception("'$outfile' is not writable.");
271
+ if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" )
272
+ $outfile = str_replace(".pdf", ".png", $outfile);
273
+
274
+ list($proto, $host, $path, $file) = explode_url($outfile);
275
+ if ( $proto != "" ) // i.e. not file://
276
+ $outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file
277
+
278
+ $outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile);
279
+
280
+ if ( strpos($outfile, DOMPDF_CHROOT) !== 0 )
281
+ throw new DOMPDF_Exception("Permission denied.");
282
+
283
+ file_put_contents($outfile, $dompdf->output( array("compress" => 0) ));
284
+ exit(0);
285
+ }
286
+
287
+ if ( !headers_sent() ) {
288
+ $dompdf->stream($outfile, $options);
289
+ }
readme.txt CHANGED
@@ -1,635 +1,643 @@
1
- === Plugin Name ===
2
- Contributors: pomegranate
3
- Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice, packing slip, export, email, bulk, automatic
4
- Requires at least: 3.5
5
- Tested up to: 4.6
6
- Stable tag: 1.5.37
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.
11
-
12
- == Description ==
13
-
14
- This WooCommerce extension automatically adds a PDF invoice to the order confirmation emails sent out to your customers. Includes a basic template (additional templates are available from [WP Overnight](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/)) as well as the possibility to modify/create your own templates. In addition, you can choose to download or print invoices and packing slips from the WooCommerce order admin.
15
-
16
- = Main features =
17
- * Automatically attach invoice PDF to WooCommerce emails of your choice
18
- * Download the PDF invoice / packing slip from the order admin page
19
- * Generate PDF invoices / packings slips in bulk
20
- * **Fully customizable** HTML/CSS invoice templates
21
- * Download invoices from the My Account page
22
- * Sequential invoice numbers - with custom formatting
23
- * **Available in: Czech, Dutch, English, Finnish, French, German, Hungarian, Italian, Japanese (see FAQ for adding custom fonts!), Norwegian, Polish, Romanian, Russian, Slovak, Slovenian, Spanish, Swedish & Ukrainian**
24
-
25
- In addition to this, we offer several premium extensions:
26
-
27
- * Create/email PDF Proforma Invoices, Credit Notes (for Refunds), email Packing Slips & more with [WooCommerce PDF Invoices & Packing Slips Professional](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-professional/)
28
- * Upload all invoices automatically to Dropbox with [WooCommerce PDF Invoices & Packing Slips to Dropbox](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-dropbox/)
29
- * Automatically send new orders or packing slips to your printer, as soon as the customer orders! [WooCommerce Automatic Order Printing](https://www.simbahosting.co.uk/s3/product/woocommerce-automatic-order-printing/?affiliates=2) (from our partners at Simba Hosting)
30
- * More advanced & stylish templates with [WooCommerce PDF Invoices & Packing Slips Premium Templates](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/)
31
-
32
- = Fully customizable =
33
- In addition to a number of default settings (including a custom header/logo) and several layout fields that you can use out of the box, the plugin contains HTML/CSS based templates that allow for customization & full control over the PDF output. Copy the templates to your theme folder and you don't have to worry that your customizations will be overwritten when you update the plugin.
34
-
35
- * Insert customer header image/logo
36
- * Modify shop data / footer / disclaimer etc. on the invoices & packing slips
37
- * Select paper size (Letter or A4)
38
- * Translation ready
39
-
40
- == Installation ==
41
-
42
- = Minimum Requirements =
43
-
44
- * WooCommerce 2.0 or later
45
- * WordPress 3.5 or later
46
-
47
- = Automatic installation =
48
- Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't even need to leave your web browser. To do an automatic install of WooCommerce PDF Invoices & Packing Slips, log in to your WordPress admin panel, navigate to the Plugins menu and click Add New.
49
-
50
- In the search field type "WooCommerce PDF Invoices & Packing Slips" and click Search Plugins. You can install it by simply clicking Install Now. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. After installation has finished, click the 'activate plugin' link.
51
-
52
- = Manual installation via the WordPress interface =
53
- 1. Download the plugin zip file to your computer
54
- 2. Go to the WordPress admin panel menu Plugins > Add New
55
- 3. Choose upload
56
- 4. Upload the plugin zip file, the plugin will now be installed
57
- 5. After installation has finished, click the 'activate plugin' link
58
-
59
- = Manual installation via FTP =
60
- 1. Download the plugin file to your computer and unzip it
61
- 2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation's wp-content/plugins/ directory.
62
- 3. Activate the plugin from the Plugins menu within the WordPress admin.
63
-
64
- == Frequently Asked Questions ==
65
-
66
- Make sure to check out [WooCommerce PDF Invoices & Packing Slips documentation](http://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/) on our site - it covers most of the questions below (and more!) in more detail!
67
-
68
- = How do I create my own custom template? =
69
-
70
- Copy the files from `wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple/` to your (child) theme in `wp-content/themes/yourtheme/woocommerce/pdf/yourtemplate` and customize them there. The new template will show up as 'yourtemplate' (the folder name) in the settings panel.
71
-
72
- = Where can I find more templates? =
73
-
74
- Go to [wpovernight.com](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/) to checkout more templates! These include templates with more tax details and product thumbnails. Need a custom templates? Contact us at support@wpovernight.com for more information.
75
-
76
- = Can I create/send a proforma invoice or a credit note? =
77
- This is a feature of our Professional extension, which can be found at [wpovernight.com](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-professional/)
78
-
79
- = Can I contribute to the code? =
80
- You're more than welcome! This plugin is hosted on github, where you can post issues or make pull requests.
81
- https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips
82
-
83
- = My language is not included, how can I contribute? =
84
-
85
- This plugin is translation ready, which means that you can translate it using standard WordPress methods.
86
-
87
- 1. Download POEdit at (http://www.poedit.net/download.php)
88
- 2. Open POEdit
89
- 3. File > New from POT
90
- 4. Open wpo_wcpdf.pot (from `woocommerce-pdf-invoices-packing-slips/languages/`)
91
- 5. A popup will ask you for your language
92
- 6. This step is a bit tricky, configuring the plurals. Somehow the settings can't be copied from the pot. Go to Catalogue > Preferences. Then enter nplurals=2; plural=n != 1; in the custom expression field
93
- 7. Enter the translations. invoice and packing-slip now have two translation fields, single & plural. Note that this is a filename, so replace spaces with a - just to be sure!
94
- 8. Save as `wpo_wcpdf-xx_XX.po`, where you replace xx_XX with your language code & country code suffix (da_DK, pl_PL, de_DE etc.)
95
-
96
- = How can I use my own font? =
97
- Although the plugin supports webfonts, this is somewhat limited and has a lot of caveats, read [this thread](https://wordpress.org/support/topic/webfonts-within-a-custom-template-not-rendering-in-pdf?replies=4#post-5395442) on the forum.
98
- Some languages (Japanese, Chinese, etc.) are not supported by the default font included with the plugin, in this case a custom font is required.
99
- The best method is to create a custom template first (see above), then add a `fonts/` folder to that template and use the following code (replace the font names/filenames) to load the font in the style.css from the pdf template:
100
- `
101
- <?php global $wpo_wcpdf;?>
102
- /* Load font */
103
- @font-face {
104
- font-family: 'MyFont';
105
- font-style: normal;
106
- font-weight: normal;
107
- src: local('MyFont'), local('MyFont'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont.ttf) format('truetype');
108
- }
109
- @font-face {
110
- font-family: 'MyFont';
111
- font-style: normal;
112
- font-weight: bold;
113
- src: local('MyFont Bold'), local('MyFont-Bold'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-bold.ttf) format('truetype');
114
- }
115
- @font-face {
116
- font-family: 'MyFont';
117
- font-style: italic;
118
- font-weight: normal;
119
- src: local('MyFont Italic'), local('MyFont-Italic'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-italic.ttf) format('truetype');
120
- }
121
- @font-face {
122
- font-family: 'MyFont';
123
- font-style: italic;
124
- font-weight: bold;
125
- src: local('MyFont Bold Italic'), local('MyFont-BoldItalic'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-bolditalic.ttf) format('truetype');
126
- }
127
- `
128
- then make sure you assign that font family to the body or other elements of the template:
129
- `
130
- font-family: 'MyFont';
131
- `
132
-
133
- Some notes:
134
-
135
- * Only TTF fonts are supported.
136
- * You can't use numeric font weights (like 700 instead of bold)!
137
- * Avoid spaces or special characters in the font filenames.
138
- * I have found that not all servers cope well with the font paths. If this is the case with your font, try to put the font in the root of your site and put that in the font url (i.e. `url(http://yoursite.com/fonts/myfont-italic.ttf)` )
139
-
140
- Some font links:
141
-
142
- * Japanese - http://ipafont.ipa.go.jp/index.html
143
- * Chinese - http://www.study-area.org/apt/firefly-font/
144
-
145
- = How can I display the HTML/CSS source for debugging/developing templates? =
146
- There's a setting on the Status tab of the settings page that allows you to toggle HTML output. Don't forget to turn if off after you're done testing!
147
-
148
- = How can I display custom fields in the invoice or packing slip? =
149
- First, you need to create a custom template following instructions from the first item in this FAQ.
150
- Then place the following snippet where you would like the custom field to appear:
151
-
152
- `
153
- <?php $wpo_wcpdf->custom_field('custom_fieldname', 'Custom field:'); ?>
154
- `
155
-
156
- Where you replace 'custom_fieldname' with the name of the field you want to display, and 'Custom field' with the label. The plugin only displays the field when it contains data. If you also want to display the label when the field is empty, you can pass a third parameter (true), like this:
157
-
158
- `
159
- <?php $wpo_wcpdf->custom_field('custom_fieldname', 'Custom field:', true); ?>
160
- `
161
-
162
- = How can I display order notes in the invoice or packing slip? =
163
- First, you need to create a custom template following instructions from the first item in this FAQ.
164
- Then place the following snippet where you would like the order notes to appear:
165
-
166
- `
167
- <?php $wpo_wcpdf->order_notes(); ?>
168
- `
169
-
170
- if you want to display all order notes, including the (private) admin notes, use:
171
- `
172
- <?php $wpo_wcpdf->order_notes('all'); ?>
173
- `
174
-
175
- = How do can I modify the pdf filename? =
176
- You can do this via a filter in your theme's `functions.php` (Some themes have a "custom functions" area in the settings).
177
-
178
- Here's a simple example for putting your shop name in front of the filname.
179
- `
180
- add_filter( 'wpo_wcpdf_filename', 'wpo_wcpdf_custom_filename', 10, 4 );
181
- function wpo_wcpdf_custom_filename( $filename, $template_type, $order_ids, $context ) {
182
- // prepend your shopname to the file
183
- $new_filename = 'myshopname_' . $filename;
184
-
185
- return $new_filename;
186
- }
187
- `
188
- You can also use the $template_type ('invoice' or 'packing-slip'), $order_ids (single array) or $context ('download' or 'attachment') variables to make more complex rules for the filename.
189
-
190
- = How can I add a download link to the invoice on the Thank you page? =
191
- You can do this with an action in your theme's `functions.php` (Some themes have a "custom functions" area in the settings). Note that due to security restrictions, this will only work for registered/logged in users!
192
-
193
- `
194
- add_filter('woocommerce_thankyou_order_received_text', 'wpo_wcpdf_thank_you_link', 10, 2);
195
- function wpo_wcpdf_thank_you_link( $text, $order ) {
196
- if ( is_user_logged_in() ) {
197
- $pdf_url = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id . '&my-account'), 'generate_wpo_wcpdf' );
198
- $text .= '<p><a href="'.esc_attr($pdf_url).'">Download a printable invoice / payment confirmation (PDF format)</a></p>';
199
- }
200
- return $text;
201
- }
202
- `
203
-
204
- alternatively, you can hook this text to the `woocommerce_thankyou` action, see [this thread](https://wordpress.org/support/topic/suggestion-for-the-faq?replies=5#post-6298810) on the support forum.
205
-
206
- = How can I get a copy of the invoice emailed to the shop manager? =
207
- The easiest way to do this is to just tick the 'new order' box. However, this also means that an invoice will be created for all new orders, also the ones that are never completed.
208
-
209
- Alternatively you can get a (BCC) copy of the completed order email by placing the following filter in your theme's `functions.php` (Some themes have a "custom functions" area in the settings)
210
- Modify the name & email address to your own preferences,
211
-
212
- `
213
- add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
214
-
215
- function mycustom_headers_filter_function( $headers, $object ) {
216
- if ($object == 'customer_completed_order') {
217
- $headers .= 'BCC: Your name <your@email.com>' . "\r\n"; //just repeat this line again to insert another email address in BCC
218
- }
219
-
220
- return $headers;
221
- }
222
- `
223
-
224
-
225
- = Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ### bytes) =
226
-
227
- This usually only happens on batch actions. PDF creation is a memory intensive job, especially if it includes several pages with images. Go to WooCommerce > System Status to check your WP Memory Limit. We recommend setting it to 128mb or more.
228
-
229
- == Screenshots ==
230
-
231
- 1. General settings page
232
- 2. Template settings page
233
- 3. Simple invoice PDF
234
- 4. Simple packing slip PDF
235
-
236
- == Changelog ==
237
-
238
- = 1.5.37 =
239
- * Feature: Added support for third party invoice numbers
240
- * Feature: Enable pre-invoice number click-to-edit
241
- * Fix: Review link for custom admins
242
- * Fix: PHP7 compatibility
243
- * Fix: Invoice date hour/minute pattern
244
- * Tweak: Multisite WooCommerce check optimization
245
-
246
- = 1.5.36 =
247
- * Translations: Fixed Romanian (incorrect "Factură Proforma" translation for "Invoice")
248
-
249
- = 1.5.35 =
250
- * Translations: Fixed "Includes %s" string for WC2.6+
251
-
252
- = 1.5.34 =
253
- * Fix: Document check that was introduced in 1.5.33 for disable free setting
254
-
255
- = 1.5.33 =
256
- * Tweak: Don't apply 'disable free' setting to packing slip attachment
257
- * Translations: Updated Romanian
258
-
259
- = 1.5.32 =
260
- * Fix: Updated currency font with Indian Rupee symbol
261
- * Translations: added Formal German (currently a copy of informal German)
262
-
263
- = 1.5.31 =
264
- * Feature: [invoice_day] or [order_day] in invoice number format
265
- * Fix: Link to hide all ads when premium extensions active
266
-
267
- = 1.5.30 =
268
- * Feature: Enable currency font for extended currency support
269
- * Fix: Font sync on plugin update
270
-
271
- = 1.5.29 =
272
- * Translations: Added Croation (Thanks Neven/Spine ICT!), updated French (Thanks Sabra!)
273
- * Tweak: filter shop address before checking if it's empty
274
- * Dev: added $order to `wpo_wcpdf_template_file` filter
275
-
276
- = 1.5.28 =
277
- * Tweak: the 'Next invoice number' is now stored separately in the database for faster and more reliable retrieval. Circumventing any caching, this should prevent duplicate invoice numbers.
278
- * Fix: Bulk actions plugin conflicts
279
- * Experimental: page numbers (use {{PAGE_NUM}} / {{PAGE_COUNT}} in your template)
280
-
281
- = 1.5.27 =
282
- * Feature: Use [invoice_year] and [invoice_month] placeholders in invoice number prefix/suffix
283
- * Feature: WooCommerce Order Status & Actions Manager emails compatibility
284
- * Feature: Add invoice number to WC REST API
285
- * Fix: Allow positive 'discounts' (price corrections)
286
- * Fix: Discounts rounding
287
- * Translations: Updated Finnish & Portugese & POT
288
-
289
- = 1.5.26 =
290
- * Feature: Automatically list all emails registered in WooCommerce
291
- * Feature: Reset invoice number yearly
292
- * Feature: WooCommerce Chained Products compatibility
293
- * Feature: WooCommerce Product Bundles visibility settings taken into account in invoice
294
- * Fix: Disable PDF creation from trashed order_ids
295
- * Tweak: Alert when no orders selected for bulk export (Props to Dartui!)
296
- * Tweak: PDF invoice settings always under WooCommerce menu (also for premium users)
297
- * Tweak: extra $item_id passed in row class filter
298
- * Translations: Updated Slovenian, Spanish, Dutch & POT file
299
-
300
- = 1.5.24 =
301
- * Hotfix: Subscriptions renewal filter arguments
302
-
303
- = 1.5.23 =
304
- * Fix: WooCommerce Subscriptons 2.0 deprecation notice.
305
- * Tweak: better qTranslate-X support
306
- * Tweak: filter for user privileges check (wpo_wcpdf_check_privs)
307
- * Translations: French translations fix
308
-
309
- = 1.5.22 =
310
- * Fix: Workaround for bug in WPML (which cleared all settings)
311
- * Translation: fixed Polish translation for invoice
312
-
313
- = 1.5.21 =
314
- * Translations: Added Estionan (thanks Tanel!)
315
- * Tweak: WC2.4 compatibility
316
-
317
- = 1.5.20 =
318
- * Feature: Option to 'never' display My Account invoice link
319
- * Fix: Order total for refunds in WC2.4
320
- * Fix: notice when no custom statuses selected for My Account display
321
- * Tweak: Product bundles styles
322
-
323
- = 1.5.19 =
324
- * Fix: Invoice number search (broke other custom searches)
325
-
326
- = 1.5.18 =
327
- * Fix: wpo_wcpdf_item_row_class packing slip filter arguments
328
-
329
- = 1.5.17 =
330
- * Feature: WooCommerce Product Bundles compatibility styles
331
- * Tweak: wpo_wcpdf_item_row_class as filter instead of action
332
-
333
- = 1.5.16 =
334
- * Feature: Search orders by invoice number (note: search on formatted invoice number only works for new orders)
335
- * Feature: Formatted invoice number stored in order
336
- * Tweak: Function parameters added to some of the filters
337
- * Tweak: WooCommerce 2.4 compatibility
338
- * Dev feature: action to add class to items table row (wpo_wcpdf_item_row_class)
339
- * Translations: Swedish updated (thanks Conney!)
340
- * Translations: Norwegian updated
341
-
342
- = 1.5.15 =
343
- * Fix: invoice number padding didn't work for values lower than 3
344
- * Tweak: WPML compatibility filter
345
- * Translations: Updated French (Thanks Nicolas!)
346
-
347
- = 1.5.14 =
348
- * Tweak: Invoice number & date edit fields moved to separate box on order edit page
349
- * Translations: Updated POT & Dutch
350
-
351
- = 1.5.13 =
352
- * Fix: Better address comparison to determine when to display alternate address
353
- * Tweak: Filter N/A addresses
354
- * Tweak: Use WooCommerce function for 2.3 discounts
355
- * Translations: Czech Updated (Thanks Ivo!)
356
- * Translations: French (minor fixes)
357
-
358
- = 1.5.12 =
359
- * Translations: added Danish, Updated POT & Italian
360
-
361
- = 1.5.11 =
362
- * Fix: Product text attributes (now checks key too)
363
- * Fix: Status page upload explanation typos
364
-
365
- = 1.5.10 =
366
- * Fix: Double check to make sure plugin doesn't attach to user emails
367
-
368
- = 1.5.9 =
369
- * Feature: Shorthand function to display product attributes: `$wpo_wcpdf->get_product_attribute( $attribute_name, $product )`
370
-
371
- = 1.5.8 =
372
- * Feature: disable invoice for free orders
373
- * Feature: action to insert data before & after item meta
374
- * Tweak: Added classes to sku & weight
375
- * Tweak: Hide payment method from totals (already shown in template)
376
- * Translations: Updated POT & Dutch
377
-
378
- = 1.5.7 =
379
- * Feature: Setting to show email address & phone number on invoice or packing slip (does not work on custom templates based on previous versions!)
380
-
381
- = 1.5.6 =
382
- * Feature: Setting to show shipping address on invoice (does not work on custom templates based on previous versions!)
383
- * Feature: My Account invoice download setting
384
- * Feature: several new template actions
385
- * Tweak: WooCommerce Bookings compatibility
386
- * Tweak: Gerenal stylesheet cleanup
387
- * Fix: temp path check/error on settings page
388
- * Fix: Document titles for credit notes and proforma (Pro)
389
- * Fix: Discount including tax
390
- * Fix: Special characters on item meta (requires WooCommerce 2.3.6)
391
- * Translations: Missing text domain on several strings
392
- * Translations: Updated POT & Dutch
393
-
394
- = 1.5.5 =
395
- * Fix: Check for incomplete line tax data (Subscriptions compatibility)
396
- * Fix: More precise template path instructions
397
- * Fix: duplicate stylesheet filter
398
- * Fix: Always prefer original order's billing address for refunds (WooCommerce EU VAT Number compatibility)
399
- * Translations: Updated German (MwSt. instead of formal Ust.)
400
- * Translations: Updated Dutch
401
-
402
- = 1.5.4 =
403
- * Tweak: include plugin version in style/script includes
404
- * Tweak: upload code cleanup
405
- * Fix: Parent invoice number (for Credit Notes in professional extension)
406
-
407
- = 1.5.3 =
408
- * Feature: add original order date value to order date filter
409
- * Feature: Work with line_tax_data when available
410
- * Feature: pass item_id to items
411
- * Tweak: later check for woocommerce active
412
- * Fix: do not try to validate empty settings (Status page settings)
413
- * Translations: Fixed Dutch typo
414
-
415
- = 1.5.2 =
416
- * Fix: fatal error when trying to activate with WooCommerce not installed yet.
417
- * Tweak: indentation fix on the Simple template
418
-
419
- = 1.5.1 =
420
- * Fix: prevent errors when upgrading
421
-
422
- = 1.5.0 =
423
- * Feature: All temporary files are now stored centrally in the WP uploads folder.
424
- * Feature: Debug settings in status panel (output errors & output to HTML)
425
- * Feature: Compatibility filter for WooCommerce Subscriptions (prevents duplicate invoice numbers)
426
- * Tweak: Pass order to totals filters
427
- * Translations: Updated POT
428
- * Translations: Updated Italian (Thanks Astrid!)
429
- * Translations: Updated Dutch
430
- * FAQ: instructions for placing a link on the thank you page
431
-
432
- = 1.4.14 =
433
- * Fix: fatal error when user registers at checkout (applies to credit notes only)
434
- * Translations: Updated German (Thanks Dietmar!)
435
- * Translations: Place your custom translations in wp-content/languages/woocommerce-pdf-invoices-packing-slips/wpo_wcpdf-LOCALE.mo to protect them from being overwritten by plugin updates.
436
-
437
- = 1.4.13 =
438
- * Feature: use separate file for all your template specific functions (template-functions.php)
439
- * Translations: Added Slovenian (thanks gregy1403!)
440
- * Translations: Updated Norwegian & Dutch.
441
- * Translations: Added Japanese - needs custom font!
442
- * FAQ: instructions on how to use custom fonts
443
-
444
- = 1.4.12 =
445
- * Fix: issues with post parent objects (WC2.1 and older)
446
-
447
- = 1.4.11 =
448
- * Small fix: bulk actions for specific i18n configurations
449
- * Tweak: total row key used as class in Simple template
450
-
451
- = 1.4.10 =
452
- * Fix: Invoice not attaching
453
- * Translations: Updated POT file
454
- * Translations: Updated Dutch, Norwegian, Polish, Brazilian Portugese, Romanian, Russian, Slovak, Spanish & Ukrainian (Many thanks to all the translators!)
455
- * Templates: added action hooks for easier customizations (`wpo_wcpdf_before_order_details`, `wpo_wcpdf_after_order_details`, `wpo_wcpdf_invoice_title` & `wpo_wcpdf_packing_slip_title`)
456
-
457
- = 1.4.9 =
458
- * Feature: Order number and date are now displayed by default in the Simple template (invoice number and date still optional)
459
- * Feature: Display Customer/Order notes with a simple shorthand (see FAQ)
460
- * Translations: Added Brazilian Portugese (thanks Victor Debone!)
461
- * Tweak: Fail more gracefully when there are errors during PDF generation
462
- * Tweak: added template type class to template output body
463
- * Tweak: cleaned up Simple template style.css
464
-
465
- = 1.4.8 =
466
- * Translations: Added Finnish (Thanks Sami Mäkelä/Contrast.fi!)
467
-
468
- = 1.4.7 =
469
- * Fix: check if image file exists locally, fallback to url if not (CDN compatibility)
470
- * Fix: make deleting invoice date possible
471
- * Fix: correct tmp folder check on status page
472
- * Translations: updated po/mo files
473
- * Tweak: changed settings capability requirement to `manage_woocommerce` (was: `manage_options`)
474
- * Tweak: better email attachment function
475
- * Tweak: prevent footer overlap (Simple template)
476
- * Tweak: fallback if `glob()` is not allowed on the server
477
- * Tweak: better custom template instructions (reflects path to actual (child-)theme)
478
-
479
- = 1.4.6 =
480
- * HOTFIX: WooCommerce 2.2 compatibility fix
481
- * Filter for PDF temp folder (wpo_wcpdf_tmp_path)
482
-
483
- = 1.4.5 =
484
- * Fix: Double date conversion for order date on invoice number filter (to avoid i18n date issues)
485
- * Fix: Template selector reset after update
486
- * Translations: added Norwegian (Thanks Aleksander!)
487
-
488
- = 1.4.4 =
489
- * Feature: Editable invoice date per order/invoice.
490
- * Feature: HTML is now allowed in footer and other settings fields.
491
- * Translations: Updated German (Thanks Nadine!)
492
- * Fix: template paths are now saved relative to the site base path (ABSPATH) to prevent errors when moving to another server
493
- * Tweak: Changed bulk action hook for better theme compatibility
494
- * Tweak: Newlines in custom checkout fields
495
-
496
- = 1.4.3 =
497
- * Feature: Added function to call custom fields more easily (see FAQ)
498
- * Feature: Change the my account button text via a filter (wpo_wcpdf_myaccount_button_text)
499
- * Translations: Added Danish (Thanks Mads!)
500
- * Tweak: only load PDF engine if it's not already loaded by another plugin
501
-
502
- = 1.4.2 =
503
- * Fix: Don't create invoice number when exporting packing slips
504
- * Fix: Division by zero for 0 quantity items
505
-
506
- = 1.4.1 =
507
- * Translations: Added Polish (Thanks Mike!)
508
- * Fix: Invoice number formatting notices in debug mode
509
-
510
- = 1.4.0 =
511
- * Feature: Invoice numbers can now be given a prefix, suffix or padding on the settings page!
512
- * Filter: `wpo_wcpdf_email_allowed_statuses` to attach pdf to custom order status emails
513
- * Tweak: Sequential Order Numbers Pro compatibility
514
- * Tweak: Filenames are now automatically sanitized to prevent issues with illegal characters
515
-
516
- = 1.3.2 =
517
- * Fix: error on wpo_wcpdf_email_attachment filter when $pdf_path not set
518
-
519
- = 1.3.1 =
520
- * Fix: invoice number was cleared when Order Actions were being used when an invoice number was not set
521
- * Translations: Updated Slovak (Thanks Jozef!)
522
- * Translations: Added Czech (Thanks CubiQ!)
523
-
524
- = 1.3.0 =
525
- * Feature: Added 'status' panel for better problem diagnosis
526
- * Tweak: split create & get invoice number calls to prevent slow database calls from causing number skipping
527
- * Translations: Added Romanian (Thanks Leonardo!)
528
- * Translations: Added Slovak (Thanks Oleg!)
529
-
530
- = 1.2.13 =
531
- * Feature: added filter for custom email attachment condition (wpo_wcpdf_custom_email_condition)
532
- * Fix: warning for tax implode
533
-
534
- = 1.2.12 =
535
- * Fix: hyperlink underline (was more like a strikethrough)
536
-
537
- = 1.2.11 =
538
- * Translations: Fixed German spelling error
539
- * Translations: Updated Swedish (Thanks Fredrik!)
540
-
541
- = 1.2.10 =
542
- * Translations: Added Swedish (Thanks Jonathan!)
543
- * Fix: Line-height issue (on some systems, the space between lines was very high)
544
-
545
- = 1.2.9 =
546
- * Fix: bug where 'standard' tax class would not display in some cases
547
- * Fix: bug that caused the totals to jump for some font sizes
548
- * Fix: WC2.1 deprecated totals function
549
- * Fix: If multiple taxes were set up with the same name, only one would display (Simple template was not affected)
550
-
551
- = 1.2.8 =
552
- * Template: Body line-height defined to prevent character jumping with italic texts
553
- * Fix: Open Sans now included in plugin package (fixes font issues for servers with allow_url_fopen disabled)
554
-
555
- = 1.2.7 =
556
- * Translations: POT, DE & NL updated
557
- * Fix: Removed stray span tag in totals table
558
-
559
- = 1.2.6 =
560
- * Translations: Spanish update (thanks prepu!)
561
- * Fix: More advanced checks to determine if a customer can download the invoice (including a status filter)
562
-
563
- = 1.2.5 =
564
- * Feature: Optional Invoice Number column for the orders listing
565
- * Feature: Better support for international characters
566
- * Translations: Added Russian & Ukrainian translation (thanks Oleg!)
567
- * Translations: Updated Spanish (Thanks Manuel!) and Dutch translations & POT file
568
- * Tweak: Memory limit notice
569
- * Tweak: Filename name now includes invoice number (when configured in the settings)
570
-
571
- = 1.2.4 =
572
- * Feature: Set which type of emails you want to attach the invoice to
573
-
574
- = 1.2.3 =
575
- * Feature: Manually edit invoice number on the edit order screen
576
- * Feature: Set the first (/next) invoice number on the settings screen
577
- * Fix: Bug where invoice number would be generated twice due to slow database calls
578
- * Fix: php strict warnings
579
-
580
- = 1.2.2 =
581
- * Feature: Simple template now uses Open Sans to include more international special characters
582
- * Feature: Implemented filters for paper size & orientation ([read here](http://wordpress.org/support/topic/select-a5-paper-size-for-packing-slips?replies=5#post-5211129))
583
- * Tweak: PDF engine updated (dompdf 0.6.0)
584
- * Tweak: Download PDF link on the my account page is now only shown when an invoice is already created by the admin or automatically, to prevent unwanted invoice created (creating problems with european laws).
585
-
586
- = 1.2.1 =
587
- * Fix: shipping & fees functions didn't output correctly with the tax set to 'incl'
588
-
589
- = 1.2.0 =
590
- * Feature: Sequential invoice numbers (set upon invoice creation).
591
- * Feature: Invoice date (set upon invoice creation).
592
-
593
- = 1.1.6 =
594
- * Feature: Hungarian translations added - thanks Joseph!
595
- * Tweak: Better debug code.
596
- * Tweak: Error reporting when templates not found.
597
- * Fix: tax rate calculation for free items.
598
-
599
- = 1.1.5 =
600
- * Feature: German translations added - thanks Christian!
601
- * Fix: dompdf 0.6.0 proved to be less stable, so switching back to beta3 for now.
602
-
603
- = 1.1.4 =
604
- * Fix: Template paths on windows servers were not properly saved (stripslashes), resulting in an empty output.
605
-
606
- = 1.1.3 =
607
- * Feature: PDF engine (dompdf) updated to 0.6.0 for better stability and utf-8 support.
608
- * Tweak: Local server path is used for header image for better compatibility with server settings.
609
- * Fix: several small bugs.
610
-
611
- = 1.1.2 =
612
- * Feature: Totals can now be called with simpler template functions
613
- * Feature: Italian translations - thanks max66max!
614
- * Tweak: improved memory performance
615
-
616
- = 1.1.1 =
617
- * Feature: French translations - thanks Guillaume!
618
-
619
- = 1.1.0 =
620
- * Feature: Fees can now also be called ex. VAT
621
- * Feature: Invoices can now be downloaded from the My Account page
622
- * Feature: Spanish translation & POT file included
623
- * Fix: ternary statements that caused an error
624
-
625
- = 1.0.1 =
626
- * Tweak: Packing slip now displays shipping address instead of billing address
627
- * Tweak: Variation data is now displayed by default
628
-
629
- = 1.0.0 =
630
- * First release
631
-
632
- == Upgrade Notice ==
633
-
634
- = 1.5 =
635
- Version 1.5 changes where temporary files are stored - everything is now stored centrally in the WP uploads folder. For backwards compatibility, this feature is turned off by default, but we recommend to use the new folders. Check the plugin Status panel for more information!
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: pomegranate
3
+ Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice, packing slip, export, email, bulk, automatic
4
+ Requires at least: 3.5
5
+ Tested up to: 4.6
6
+ Stable tag: 1.5.38
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.
11
+
12
+ == Description ==
13
+
14
+ This WooCommerce extension automatically adds a PDF invoice to the order confirmation emails sent out to your customers. Includes a basic template (additional templates are available from [WP Overnight](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/)) as well as the possibility to modify/create your own templates. In addition, you can choose to download or print invoices and packing slips from the WooCommerce order admin.
15
+
16
+ = Main features =
17
+ * Automatically attach invoice PDF to WooCommerce emails of your choice
18
+ * Download the PDF invoice / packing slip from the order admin page
19
+ * Generate PDF invoices / packings slips in bulk
20
+ * **Fully customizable** HTML/CSS invoice templates
21
+ * Download invoices from the My Account page
22
+ * Sequential invoice numbers - with custom formatting
23
+ * **Available in: Czech, Dutch, English, Finnish, French, German, Hungarian, Italian, Japanese (see FAQ for adding custom fonts!), Norwegian, Polish, Romanian, Russian, Slovak, Slovenian, Spanish, Swedish & Ukrainian**
24
+
25
+ In addition to this, we offer several premium extensions:
26
+
27
+ * Create/email PDF Proforma Invoices, Credit Notes (for Refunds), email Packing Slips & more with [WooCommerce PDF Invoices & Packing Slips Professional](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-professional/)
28
+ * Upload all invoices automatically to Dropbox with [WooCommerce PDF Invoices & Packing Slips to Dropbox](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-dropbox/)
29
+ * Automatically send new orders or packing slips to your printer, as soon as the customer orders! [WooCommerce Automatic Order Printing](https://www.simbahosting.co.uk/s3/product/woocommerce-automatic-order-printing/?affiliates=2) (from our partners at Simba Hosting)
30
+ * More advanced & stylish templates with [WooCommerce PDF Invoices & Packing Slips Premium Templates](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/)
31
+
32
+ = Fully customizable =
33
+ In addition to a number of default settings (including a custom header/logo) and several layout fields that you can use out of the box, the plugin contains HTML/CSS based templates that allow for customization & full control over the PDF output. Copy the templates to your theme folder and you don't have to worry that your customizations will be overwritten when you update the plugin.
34
+
35
+ * Insert customer header image/logo
36
+ * Modify shop data / footer / disclaimer etc. on the invoices & packing slips
37
+ * Select paper size (Letter or A4)
38
+ * Translation ready
39
+
40
+ == Installation ==
41
+
42
+ = Minimum Requirements =
43
+
44
+ * WooCommerce 2.0 or later
45
+ * WordPress 3.5 or later
46
+
47
+ = Automatic installation =
48
+ Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't even need to leave your web browser. To do an automatic install of WooCommerce PDF Invoices & Packing Slips, log in to your WordPress admin panel, navigate to the Plugins menu and click Add New.
49
+
50
+ In the search field type "WooCommerce PDF Invoices & Packing Slips" and click Search Plugins. You can install it by simply clicking Install Now. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. After installation has finished, click the 'activate plugin' link.
51
+
52
+ = Manual installation via the WordPress interface =
53
+ 1. Download the plugin zip file to your computer
54
+ 2. Go to the WordPress admin panel menu Plugins > Add New
55
+ 3. Choose upload
56
+ 4. Upload the plugin zip file, the plugin will now be installed
57
+ 5. After installation has finished, click the 'activate plugin' link
58
+
59
+ = Manual installation via FTP =
60
+ 1. Download the plugin file to your computer and unzip it
61
+ 2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation's wp-content/plugins/ directory.
62
+ 3. Activate the plugin from the Plugins menu within the WordPress admin.
63
+
64
+ == Frequently Asked Questions ==
65
+
66
+ Make sure to check out [WooCommerce PDF Invoices & Packing Slips documentation](http://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/) on our site - it covers most of the questions below (and more!) in more detail!
67
+
68
+ = How do I create my own custom template? =
69
+
70
+ Copy the files from `wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple/` to your (child) theme in `wp-content/themes/yourtheme/woocommerce/pdf/yourtemplate` and customize them there. The new template will show up as 'yourtemplate' (the folder name) in the settings panel.
71
+
72
+ = Where can I find more templates? =
73
+
74
+ Go to [wpovernight.com](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/) to checkout more templates! These include templates with more tax details and product thumbnails. Need a custom templates? Contact us at support@wpovernight.com for more information.
75
+
76
+ = Can I create/send a proforma invoice or a credit note? =
77
+ This is a feature of our Professional extension, which can be found at [wpovernight.com](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-professional/)
78
+
79
+ = Can I contribute to the code? =
80
+ You're more than welcome! This plugin is hosted on github, where you can post issues or make pull requests.
81
+ https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips
82
+
83
+ = My language is not included, how can I contribute? =
84
+
85
+ This plugin is translation ready, which means that you can translate it using standard WordPress methods.
86
+
87
+ 1. Download POEdit at (http://www.poedit.net/download.php)
88
+ 2. Open POEdit
89
+ 3. File > New from POT
90
+ 4. Open wpo_wcpdf.pot (from `woocommerce-pdf-invoices-packing-slips/languages/`)
91
+ 5. A popup will ask you for your language
92
+ 6. This step is a bit tricky, configuring the plurals. Somehow the settings can't be copied from the pot. Go to Catalogue > Preferences. Then enter nplurals=2; plural=n != 1; in the custom expression field
93
+ 7. Enter the translations. invoice and packing-slip now have two translation fields, single & plural. Note that this is a filename, so replace spaces with a - just to be sure!
94
+ 8. Save as `wpo_wcpdf-xx_XX.po`, where you replace xx_XX with your language code & country code suffix (da_DK, pl_PL, de_DE etc.)
95
+
96
+ = How can I use my own font? =
97
+ Although the plugin supports webfonts, this is somewhat limited and has a lot of caveats, read [this thread](https://wordpress.org/support/topic/webfonts-within-a-custom-template-not-rendering-in-pdf?replies=4#post-5395442) on the forum.
98
+ Some languages (Japanese, Chinese, etc.) are not supported by the default font included with the plugin, in this case a custom font is required.
99
+ The best method is to create a custom template first (see above), then add a `fonts/` folder to that template and use the following code (replace the font names/filenames) to load the font in the style.css from the pdf template:
100
+ `
101
+ <?php global $wpo_wcpdf;?>
102
+ /* Load font */
103
+ @font-face {
104
+ font-family: 'MyFont';
105
+ font-style: normal;
106
+ font-weight: normal;
107
+ src: local('MyFont'), local('MyFont'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont.ttf) format('truetype');
108
+ }
109
+ @font-face {
110
+ font-family: 'MyFont';
111
+ font-style: normal;
112
+ font-weight: bold;
113
+ src: local('MyFont Bold'), local('MyFont-Bold'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-bold.ttf) format('truetype');
114
+ }
115
+ @font-face {
116
+ font-family: 'MyFont';
117
+ font-style: italic;
118
+ font-weight: normal;
119
+ src: local('MyFont Italic'), local('MyFont-Italic'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-italic.ttf) format('truetype');
120
+ }
121
+ @font-face {
122
+ font-family: 'MyFont';
123
+ font-style: italic;
124
+ font-weight: bold;
125
+ src: local('MyFont Bold Italic'), local('MyFont-BoldItalic'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-bolditalic.ttf) format('truetype');
126
+ }
127
+ `
128
+ then make sure you assign that font family to the body or other elements of the template:
129
+ `
130
+ font-family: 'MyFont';
131
+ `
132
+
133
+ Some notes:
134
+
135
+ * Only TTF fonts are supported.
136
+ * You can't use numeric font weights (like 700 instead of bold)!
137
+ * Avoid spaces or special characters in the font filenames.
138
+ * I have found that not all servers cope well with the font paths. If this is the case with your font, try to put the font in the root of your site and put that in the font url (i.e. `url(http://yoursite.com/fonts/myfont-italic.ttf)` )
139
+
140
+ Some font links:
141
+
142
+ * Japanese - http://ipafont.ipa.go.jp/index.html
143
+ * Chinese - http://www.study-area.org/apt/firefly-font/
144
+
145
+ = How can I display the HTML/CSS source for debugging/developing templates? =
146
+ There's a setting on the Status tab of the settings page that allows you to toggle HTML output. Don't forget to turn if off after you're done testing!
147
+
148
+ = How can I display custom fields in the invoice or packing slip? =
149
+ First, you need to create a custom template following instructions from the first item in this FAQ.
150
+ Then place the following snippet where you would like the custom field to appear:
151
+
152
+ `
153
+ <?php $wpo_wcpdf->custom_field('custom_fieldname', 'Custom field:'); ?>
154
+ `
155
+
156
+ Where you replace 'custom_fieldname' with the name of the field you want to display, and 'Custom field' with the label. The plugin only displays the field when it contains data. If you also want to display the label when the field is empty, you can pass a third parameter (true), like this:
157
+
158
+ `
159
+ <?php $wpo_wcpdf->custom_field('custom_fieldname', 'Custom field:', true); ?>
160
+ `
161
+
162
+ = How can I display order notes in the invoice or packing slip? =
163
+ First, you need to create a custom template following instructions from the first item in this FAQ.
164
+ Then place the following snippet where you would like the order notes to appear:
165
+
166
+ `
167
+ <?php $wpo_wcpdf->order_notes(); ?>
168
+ `
169
+
170
+ if you want to display all order notes, including the (private) admin notes, use:
171
+ `
172
+ <?php $wpo_wcpdf->order_notes('all'); ?>
173
+ `
174
+
175
+ = How do can I modify the pdf filename? =
176
+ You can do this via a filter in your theme's `functions.php` (Some themes have a "custom functions" area in the settings).
177
+
178
+ Here's a simple example for putting your shop name in front of the filname.
179
+ `
180
+ add_filter( 'wpo_wcpdf_filename', 'wpo_wcpdf_custom_filename', 10, 4 );
181
+ function wpo_wcpdf_custom_filename( $filename, $template_type, $order_ids, $context ) {
182
+ // prepend your shopname to the file
183
+ $new_filename = 'myshopname_' . $filename;
184
+
185
+ return $new_filename;
186
+ }
187
+ `
188
+ You can also use the $template_type ('invoice' or 'packing-slip'), $order_ids (single array) or $context ('download' or 'attachment') variables to make more complex rules for the filename.
189
+
190
+ = How can I add a download link to the invoice on the Thank you page? =
191
+ You can do this with an action in your theme's `functions.php` (Some themes have a "custom functions" area in the settings). Note that due to security restrictions, this will only work for registered/logged in users!
192
+
193
+ `
194
+ add_filter('woocommerce_thankyou_order_received_text', 'wpo_wcpdf_thank_you_link', 10, 2);
195
+ function wpo_wcpdf_thank_you_link( $text, $order ) {
196
+ if ( is_user_logged_in() ) {
197
+ $pdf_url = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id . '&my-account'), 'generate_wpo_wcpdf' );
198
+ $text .= '<p><a href="'.esc_attr($pdf_url).'">Download a printable invoice / payment confirmation (PDF format)</a></p>';
199
+ }
200
+ return $text;
201
+ }
202
+ `
203
+
204
+ alternatively, you can hook this text to the `woocommerce_thankyou` action, see [this thread](https://wordpress.org/support/topic/suggestion-for-the-faq?replies=5#post-6298810) on the support forum.
205
+
206
+ = How can I get a copy of the invoice emailed to the shop manager? =
207
+ The easiest way to do this is to just tick the 'new order' box. However, this also means that an invoice will be created for all new orders, also the ones that are never completed.
208
+
209
+ Alternatively you can get a (BCC) copy of the completed order email by placing the following filter in your theme's `functions.php` (Some themes have a "custom functions" area in the settings)
210
+ Modify the name & email address to your own preferences,
211
+
212
+ `
213
+ add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
214
+
215
+ function mycustom_headers_filter_function( $headers, $object ) {
216
+ if ($object == 'customer_completed_order') {
217
+ $headers .= 'BCC: Your name <your@email.com>' . "\r\n"; //just repeat this line again to insert another email address in BCC
218
+ }
219
+
220
+ return $headers;
221
+ }
222
+ `
223
+
224
+
225
+ = Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ### bytes) =
226
+
227
+ This usually only happens on batch actions. PDF creation is a memory intensive job, especially if it includes several pages with images. Go to WooCommerce > System Status to check your WP Memory Limit. We recommend setting it to 128mb or more.
228
+
229
+ == Screenshots ==
230
+
231
+ 1. General settings page
232
+ 2. Template settings page
233
+ 3. Simple invoice PDF
234
+ 4. Simple packing slip PDF
235
+
236
+ == Changelog ==
237
+
238
+ = 1.5.38 =
239
+ * Fix: Thumbnail path fallback
240
+ * Fix: Edge/IE hour & minute pattern
241
+ * Fix: Skip over non-order objects
242
+ * Tweak: Let shop manager view My Account links
243
+ * Dev: added `wpo_wcpdf_before_attachment_creation` action
244
+ * Translations: Updated POT, Swedish, Dutch & Norwegian
245
+
246
+ = 1.5.37 =
247
+ * Feature: Added support for third party invoice numbers
248
+ * Feature: Enable pre-invoice number click-to-edit
249
+ * Fix: Review link for custom admins
250
+ * Fix: PHP7 compatibility
251
+ * Fix: Invoice date hour/minute pattern
252
+ * Tweak: Multisite WooCommerce check optimization
253
+
254
+ = 1.5.36 =
255
+ * Translations: Fixed Romanian (incorrect "Factură Proforma" translation for "Invoice")
256
+
257
+ = 1.5.35 =
258
+ * Translations: Fixed "Includes %s" string for WC2.6+
259
+
260
+ = 1.5.34 =
261
+ * Fix: Document check that was introduced in 1.5.33 for disable free setting
262
+
263
+ = 1.5.33 =
264
+ * Tweak: Don't apply 'disable free' setting to packing slip attachment
265
+ * Translations: Updated Romanian
266
+
267
+ = 1.5.32 =
268
+ * Fix: Updated currency font with Indian Rupee symbol
269
+ * Translations: added Formal German (currently a copy of informal German)
270
+
271
+ = 1.5.31 =
272
+ * Feature: [invoice_day] or [order_day] in invoice number format
273
+ * Fix: Link to hide all ads when premium extensions active
274
+
275
+ = 1.5.30 =
276
+ * Feature: Enable currency font for extended currency support
277
+ * Fix: Font sync on plugin update
278
+
279
+ = 1.5.29 =
280
+ * Translations: Added Croation (Thanks Neven/Spine ICT!), updated French (Thanks Sabra!)
281
+ * Tweak: filter shop address before checking if it's empty
282
+ * Dev: added $order to `wpo_wcpdf_template_file` filter
283
+
284
+ = 1.5.28 =
285
+ * Tweak: the 'Next invoice number' is now stored separately in the database for faster and more reliable retrieval. Circumventing any caching, this should prevent duplicate invoice numbers.
286
+ * Fix: Bulk actions plugin conflicts
287
+ * Experimental: page numbers (use {{PAGE_NUM}} / {{PAGE_COUNT}} in your template)
288
+
289
+ = 1.5.27 =
290
+ * Feature: Use [invoice_year] and [invoice_month] placeholders in invoice number prefix/suffix
291
+ * Feature: WooCommerce Order Status & Actions Manager emails compatibility
292
+ * Feature: Add invoice number to WC REST API
293
+ * Fix: Allow positive 'discounts' (price corrections)
294
+ * Fix: Discounts rounding
295
+ * Translations: Updated Finnish & Portugese & POT
296
+
297
+ = 1.5.26 =
298
+ * Feature: Automatically list all emails registered in WooCommerce
299
+ * Feature: Reset invoice number yearly
300
+ * Feature: WooCommerce Chained Products compatibility
301
+ * Feature: WooCommerce Product Bundles visibility settings taken into account in invoice
302
+ * Fix: Disable PDF creation from trashed order_ids
303
+ * Tweak: Alert when no orders selected for bulk export (Props to Dartui!)
304
+ * Tweak: PDF invoice settings always under WooCommerce menu (also for premium users)
305
+ * Tweak: extra $item_id passed in row class filter
306
+ * Translations: Updated Slovenian, Spanish, Dutch & POT file
307
+
308
+ = 1.5.24 =
309
+ * Hotfix: Subscriptions renewal filter arguments
310
+
311
+ = 1.5.23 =
312
+ * Fix: WooCommerce Subscriptons 2.0 deprecation notice.
313
+ * Tweak: better qTranslate-X support
314
+ * Tweak: filter for user privileges check (wpo_wcpdf_check_privs)
315
+ * Translations: French translations fix
316
+
317
+ = 1.5.22 =
318
+ * Fix: Workaround for bug in WPML (which cleared all settings)
319
+ * Translation: fixed Polish translation for invoice
320
+
321
+ = 1.5.21 =
322
+ * Translations: Added Estionan (thanks Tanel!)
323
+ * Tweak: WC2.4 compatibility
324
+
325
+ = 1.5.20 =
326
+ * Feature: Option to 'never' display My Account invoice link
327
+ * Fix: Order total for refunds in WC2.4
328
+ * Fix: notice when no custom statuses selected for My Account display
329
+ * Tweak: Product bundles styles
330
+
331
+ = 1.5.19 =
332
+ * Fix: Invoice number search (broke other custom searches)
333
+
334
+ = 1.5.18 =
335
+ * Fix: wpo_wcpdf_item_row_class packing slip filter arguments
336
+
337
+ = 1.5.17 =
338
+ * Feature: WooCommerce Product Bundles compatibility styles
339
+ * Tweak: wpo_wcpdf_item_row_class as filter instead of action
340
+
341
+ = 1.5.16 =
342
+ * Feature: Search orders by invoice number (note: search on formatted invoice number only works for new orders)
343
+ * Feature: Formatted invoice number stored in order
344
+ * Tweak: Function parameters added to some of the filters
345
+ * Tweak: WooCommerce 2.4 compatibility
346
+ * Dev feature: action to add class to items table row (wpo_wcpdf_item_row_class)
347
+ * Translations: Swedish updated (thanks Conney!)
348
+ * Translations: Norwegian updated
349
+
350
+ = 1.5.15 =
351
+ * Fix: invoice number padding didn't work for values lower than 3
352
+ * Tweak: WPML compatibility filter
353
+ * Translations: Updated French (Thanks Nicolas!)
354
+
355
+ = 1.5.14 =
356
+ * Tweak: Invoice number & date edit fields moved to separate box on order edit page
357
+ * Translations: Updated POT & Dutch
358
+
359
+ = 1.5.13 =
360
+ * Fix: Better address comparison to determine when to display alternate address
361
+ * Tweak: Filter N/A addresses
362
+ * Tweak: Use WooCommerce function for 2.3 discounts
363
+ * Translations: Czech Updated (Thanks Ivo!)
364
+ * Translations: French (minor fixes)
365
+
366
+ = 1.5.12 =
367
+ * Translations: added Danish, Updated POT & Italian
368
+
369
+ = 1.5.11 =
370
+ * Fix: Product text attributes (now checks key too)
371
+ * Fix: Status page upload explanation typos
372
+
373
+ = 1.5.10 =
374
+ * Fix: Double check to make sure plugin doesn't attach to user emails
375
+
376
+ = 1.5.9 =
377
+ * Feature: Shorthand function to display product attributes: `$wpo_wcpdf->get_product_attribute( $attribute_name, $product )`
378
+
379
+ = 1.5.8 =
380
+ * Feature: disable invoice for free orders
381
+ * Feature: action to insert data before & after item meta
382
+ * Tweak: Added classes to sku & weight
383
+ * Tweak: Hide payment method from totals (already shown in template)
384
+ * Translations: Updated POT & Dutch
385
+
386
+ = 1.5.7 =
387
+ * Feature: Setting to show email address & phone number on invoice or packing slip (does not work on custom templates based on previous versions!)
388
+
389
+ = 1.5.6 =
390
+ * Feature: Setting to show shipping address on invoice (does not work on custom templates based on previous versions!)
391
+ * Feature: My Account invoice download setting
392
+ * Feature: several new template actions
393
+ * Tweak: WooCommerce Bookings compatibility
394
+ * Tweak: Gerenal stylesheet cleanup
395
+ * Fix: temp path check/error on settings page
396
+ * Fix: Document titles for credit notes and proforma (Pro)
397
+ * Fix: Discount including tax
398
+ * Fix: Special characters on item meta (requires WooCommerce 2.3.6)
399
+ * Translations: Missing text domain on several strings
400
+ * Translations: Updated POT & Dutch
401
+
402
+ = 1.5.5 =
403
+ * Fix: Check for incomplete line tax data (Subscriptions compatibility)
404
+ * Fix: More precise template path instructions
405
+ * Fix: duplicate stylesheet filter
406
+ * Fix: Always prefer original order's billing address for refunds (WooCommerce EU VAT Number compatibility)
407
+ * Translations: Updated German (MwSt. instead of formal Ust.)
408
+ * Translations: Updated Dutch
409
+
410
+ = 1.5.4 =
411
+ * Tweak: include plugin version in style/script includes
412
+ * Tweak: upload code cleanup
413
+ * Fix: Parent invoice number (for Credit Notes in professional extension)
414
+
415
+ = 1.5.3 =
416
+ * Feature: add original order date value to order date filter
417
+ * Feature: Work with line_tax_data when available
418
+ * Feature: pass item_id to items
419
+ * Tweak: later check for woocommerce active
420
+ * Fix: do not try to validate empty settings (Status page settings)
421
+ * Translations: Fixed Dutch typo
422
+
423
+ = 1.5.2 =
424
+ * Fix: fatal error when trying to activate with WooCommerce not installed yet.
425
+ * Tweak: indentation fix on the Simple template
426
+
427
+ = 1.5.1 =
428
+ * Fix: prevent errors when upgrading
429
+
430
+ = 1.5.0 =
431
+ * Feature: All temporary files are now stored centrally in the WP uploads folder.
432
+ * Feature: Debug settings in status panel (output errors & output to HTML)
433
+ * Feature: Compatibility filter for WooCommerce Subscriptions (prevents duplicate invoice numbers)
434
+ * Tweak: Pass order to totals filters
435
+ * Translations: Updated POT
436
+ * Translations: Updated Italian (Thanks Astrid!)
437
+ * Translations: Updated Dutch
438
+ * FAQ: instructions for placing a link on the thank you page
439
+
440
+ = 1.4.14 =
441
+ * Fix: fatal error when user registers at checkout (applies to credit notes only)
442
+ * Translations: Updated German (Thanks Dietmar!)
443
+ * Translations: Place your custom translations in wp-content/languages/woocommerce-pdf-invoices-packing-slips/wpo_wcpdf-LOCALE.mo to protect them from being overwritten by plugin updates.
444
+
445
+ = 1.4.13 =
446
+ * Feature: use separate file for all your template specific functions (template-functions.php)
447
+ * Translations: Added Slovenian (thanks gregy1403!)
448
+ * Translations: Updated Norwegian & Dutch.
449
+ * Translations: Added Japanese - needs custom font!
450
+ * FAQ: instructions on how to use custom fonts
451
+
452
+ = 1.4.12 =
453
+ * Fix: issues with post parent objects (WC2.1 and older)
454
+
455
+ = 1.4.11 =
456
+ * Small fix: bulk actions for specific i18n configurations
457
+ * Tweak: total row key used as class in Simple template
458
+
459
+ = 1.4.10 =
460
+ * Fix: Invoice not attaching
461
+ * Translations: Updated POT file
462
+ * Translations: Updated Dutch, Norwegian, Polish, Brazilian Portugese, Romanian, Russian, Slovak, Spanish & Ukrainian (Many thanks to all the translators!)
463
+ * Templates: added action hooks for easier customizations (`wpo_wcpdf_before_order_details`, `wpo_wcpdf_after_order_details`, `wpo_wcpdf_invoice_title` & `wpo_wcpdf_packing_slip_title`)
464
+
465
+ = 1.4.9 =
466
+ * Feature: Order number and date are now displayed by default in the Simple template (invoice number and date still optional)
467
+ * Feature: Display Customer/Order notes with a simple shorthand (see FAQ)
468
+ * Translations: Added Brazilian Portugese (thanks Victor Debone!)
469
+ * Tweak: Fail more gracefully when there are errors during PDF generation
470
+ * Tweak: added template type class to template output body
471
+ * Tweak: cleaned up Simple template style.css
472
+
473
+ = 1.4.8 =
474
+ * Translations: Added Finnish (Thanks Sami Mäkelä/Contrast.fi!)
475
+
476
+ = 1.4.7 =
477
+ * Fix: check if image file exists locally, fallback to url if not (CDN compatibility)
478
+ * Fix: make deleting invoice date possible
479
+ * Fix: correct tmp folder check on status page
480
+ * Translations: updated po/mo files
481
+ * Tweak: changed settings capability requirement to `manage_woocommerce` (was: `manage_options`)
482
+ * Tweak: better email attachment function
483
+ * Tweak: prevent footer overlap (Simple template)
484
+ * Tweak: fallback if `glob()` is not allowed on the server
485
+ * Tweak: better custom template instructions (reflects path to actual (child-)theme)
486
+
487
+ = 1.4.6 =
488
+ * HOTFIX: WooCommerce 2.2 compatibility fix
489
+ * Filter for PDF temp folder (wpo_wcpdf_tmp_path)
490
+
491
+ = 1.4.5 =
492
+ * Fix: Double date conversion for order date on invoice number filter (to avoid i18n date issues)
493
+ * Fix: Template selector reset after update
494
+ * Translations: added Norwegian (Thanks Aleksander!)
495
+
496
+ = 1.4.4 =
497
+ * Feature: Editable invoice date per order/invoice.
498
+ * Feature: HTML is now allowed in footer and other settings fields.
499
+ * Translations: Updated German (Thanks Nadine!)
500
+ * Fix: template paths are now saved relative to the site base path (ABSPATH) to prevent errors when moving to another server
501
+ * Tweak: Changed bulk action hook for better theme compatibility
502
+ * Tweak: Newlines in custom checkout fields
503
+
504
+ = 1.4.3 =
505
+ * Feature: Added function to call custom fields more easily (see FAQ)
506
+ * Feature: Change the my account button text via a filter (wpo_wcpdf_myaccount_button_text)
507
+ * Translations: Added Danish (Thanks Mads!)
508
+ * Tweak: only load PDF engine if it's not already loaded by another plugin
509
+
510
+ = 1.4.2 =
511
+ * Fix: Don't create invoice number when exporting packing slips
512
+ * Fix: Division by zero for 0 quantity items
513
+
514
+ = 1.4.1 =
515
+ * Translations: Added Polish (Thanks Mike!)
516
+ * Fix: Invoice number formatting notices in debug mode
517
+
518
+ = 1.4.0 =
519
+ * Feature: Invoice numbers can now be given a prefix, suffix or padding on the settings page!
520
+ * Filter: `wpo_wcpdf_email_allowed_statuses` to attach pdf to custom order status emails
521
+ * Tweak: Sequential Order Numbers Pro compatibility
522
+ * Tweak: Filenames are now automatically sanitized to prevent issues with illegal characters
523
+
524
+ = 1.3.2 =
525
+ * Fix: error on wpo_wcpdf_email_attachment filter when $pdf_path not set
526
+
527
+ = 1.3.1 =
528
+ * Fix: invoice number was cleared when Order Actions were being used when an invoice number was not set
529
+ * Translations: Updated Slovak (Thanks Jozef!)
530
+ * Translations: Added Czech (Thanks CubiQ!)
531
+
532
+ = 1.3.0 =
533
+ * Feature: Added 'status' panel for better problem diagnosis
534
+ * Tweak: split create & get invoice number calls to prevent slow database calls from causing number skipping
535
+ * Translations: Added Romanian (Thanks Leonardo!)
536
+ * Translations: Added Slovak (Thanks Oleg!)
537
+
538
+ = 1.2.13 =
539
+ * Feature: added filter for custom email attachment condition (wpo_wcpdf_custom_email_condition)
540
+ * Fix: warning for tax implode
541
+
542
+ = 1.2.12 =
543
+ * Fix: hyperlink underline (was more like a strikethrough)
544
+
545
+ = 1.2.11 =
546
+ * Translations: Fixed German spelling error
547
+ * Translations: Updated Swedish (Thanks Fredrik!)
548
+
549
+ = 1.2.10 =
550
+ * Translations: Added Swedish (Thanks Jonathan!)
551
+ * Fix: Line-height issue (on some systems, the space between lines was very high)
552
+
553
+ = 1.2.9 =
554
+ * Fix: bug where 'standard' tax class would not display in some cases
555
+ * Fix: bug that caused the totals to jump for some font sizes
556
+ * Fix: WC2.1 deprecated totals function
557
+ * Fix: If multiple taxes were set up with the same name, only one would display (Simple template was not affected)
558
+
559
+ = 1.2.8 =
560
+ * Template: Body line-height defined to prevent character jumping with italic texts
561
+ * Fix: Open Sans now included in plugin package (fixes font issues for servers with allow_url_fopen disabled)
562
+
563
+ = 1.2.7 =
564
+ * Translations: POT, DE & NL updated
565
+ * Fix: Removed stray span tag in totals table
566
+
567
+ = 1.2.6 =
568
+ * Translations: Spanish update (thanks prepu!)
569
+ * Fix: More advanced checks to determine if a customer can download the invoice (including a status filter)
570
+
571
+ = 1.2.5 =
572
+ * Feature: Optional Invoice Number column for the orders listing
573
+ * Feature: Better support for international characters
574
+ * Translations: Added Russian & Ukrainian translation (thanks Oleg!)
575
+ * Translations: Updated Spanish (Thanks Manuel!) and Dutch translations & POT file
576
+ * Tweak: Memory limit notice
577
+ * Tweak: Filename name now includes invoice number (when configured in the settings)
578
+
579
+ = 1.2.4 =
580
+ * Feature: Set which type of emails you want to attach the invoice to
581
+
582
+ = 1.2.3 =
583
+ * Feature: Manually edit invoice number on the edit order screen
584
+ * Feature: Set the first (/next) invoice number on the settings screen
585
+ * Fix: Bug where invoice number would be generated twice due to slow database calls
586
+ * Fix: php strict warnings
587
+
588
+ = 1.2.2 =
589
+ * Feature: Simple template now uses Open Sans to include more international special characters
590
+ * Feature: Implemented filters for paper size & orientation ([read here](http://wordpress.org/support/topic/select-a5-paper-size-for-packing-slips?replies=5#post-5211129))
591
+ * Tweak: PDF engine updated (dompdf 0.6.0)
592
+ * Tweak: Download PDF link on the my account page is now only shown when an invoice is already created by the admin or automatically, to prevent unwanted invoice created (creating problems with european laws).
593
+
594
+ = 1.2.1 =
595
+ * Fix: shipping & fees functions didn't output correctly with the tax set to 'incl'
596
+
597
+ = 1.2.0 =
598
+ * Feature: Sequential invoice numbers (set upon invoice creation).
599
+ * Feature: Invoice date (set upon invoice creation).
600
+
601
+ = 1.1.6 =
602
+ * Feature: Hungarian translations added - thanks Joseph!
603
+ * Tweak: Better debug code.
604
+ * Tweak: Error reporting when templates not found.
605
+ * Fix: tax rate calculation for free items.
606
+
607
+ = 1.1.5 =
608
+ * Feature: German translations added - thanks Christian!
609
+ * Fix: dompdf 0.6.0 proved to be less stable, so switching back to beta3 for now.
610
+
611
+ = 1.1.4 =
612
+ * Fix: Template paths on windows servers were not properly saved (stripslashes), resulting in an empty output.
613
+
614
+ = 1.1.3 =
615
+ * Feature: PDF engine (dompdf) updated to 0.6.0 for better stability and utf-8 support.
616
+ * Tweak: Local server path is used for header image for better compatibility with server settings.
617
+ * Fix: several small bugs.
618
+
619
+ = 1.1.2 =
620
+ * Feature: Totals can now be called with simpler template functions
621
+ * Feature: Italian translations - thanks max66max!
622
+ * Tweak: improved memory performance
623
+
624
+ = 1.1.1 =
625
+ * Feature: French translations - thanks Guillaume!
626
+
627
+ = 1.1.0 =
628
+ * Feature: Fees can now also be called ex. VAT
629
+ * Feature: Invoices can now be downloaded from the My Account page
630
+ * Feature: Spanish translation & POT file included
631
+ * Fix: ternary statements that caused an error
632
+
633
+ = 1.0.1 =
634
+ * Tweak: Packing slip now displays shipping address instead of billing address
635
+ * Tweak: Variation data is now displayed by default
636
+
637
+ = 1.0.0 =
638
+ * First release
639
+
640
+ == Upgrade Notice ==
641
+
642
+ = 1.5 =
643
+ Version 1.5 changes where temporary files are stored - everything is now stored centrally in the WP uploads folder. For backwards compatibility, this feature is turned off by default, but we recommend to use the new folders. Check the plugin Status panel for more information!
woocommerce-pdf-invoices-packingslips.php CHANGED
@@ -1,994 +1,994 @@
1
- <?php
2
- /**
3
- * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
- * Plugin URI: http://www.wpovernight.com
5
- * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
- * Version: 1.5.37
7
- * Author: Ewout Fernhout
8
- * Author URI: http://www.wpovernight.com
9
- * License: GPLv2 or later
10
- * License URI: http://www.opensource.org/licenses/gpl-license.php
11
- * Text Domain: wpo_wcpdf
12
- */
13
-
14
- if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
15
-
16
- class WooCommerce_PDF_Invoices {
17
-
18
- public static $plugin_prefix;
19
- public static $plugin_url;
20
- public static $plugin_path;
21
- public static $plugin_basename;
22
- public static $version;
23
-
24
- public $writepanels;
25
- public $settings;
26
- public $export;
27
-
28
- /**
29
- * Constructor
30
- */
31
- public function __construct() {
32
- self::$plugin_prefix = 'wpo_wcpdf_';
33
- self::$plugin_basename = plugin_basename(__FILE__);
34
- self::$plugin_url = plugin_dir_url(self::$plugin_basename);
35
- self::$plugin_path = trailingslashit(dirname(__FILE__));
36
- self::$version = '1.5.37';
37
-
38
- // load the localisation & classes
39
- add_action( 'plugins_loaded', array( $this, 'translations' ) ); // or use init?
40
- add_action( 'init', array( $this, 'load_classes' ) );
41
-
42
- // run lifecycle methods
43
- if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
44
- // check if upgrading from versionless (1.4.14 and older)
45
- if ( get_option('wpo_wcpdf_general_settings') && get_option('wpo_wcpdf_version') === false ) {
46
- // tag 'versionless', so that we can apply necessary upgrade settings
47
- add_option( 'wpo_wcpdf_version', 'versionless' );
48
- }
49
-
50
- add_action( 'wp_loaded', array( $this, 'do_install' ) );
51
- }
52
- }
53
-
54
- /**
55
- * Load the translation / textdomain files
56
- *
57
- * Note: the first-loaded translation file overrides any following ones if the same translation is present
58
- */
59
- public function translations() {
60
- $locale = apply_filters( 'plugin_locale', get_locale(), 'wpo_wcpdf' );
61
- $dir = trailingslashit( WP_LANG_DIR );
62
-
63
- /**
64
- * Frontend/global Locale. Looks in:
65
- *
66
- * - WP_LANG_DIR/woocommerce-pdf-invoices-packing-slips/wpo_wcpdf-LOCALE.mo
67
- * - WP_LANG_DIR/plugins/wpo_wcpdf-LOCALE.mo
68
- * - woocommerce-pdf-invoices-packing-slips/languages/wpo_wcpdf-LOCALE.mo (which if not found falls back to:)
69
- * - WP_LANG_DIR/plugins/wpo_wcpdf-LOCALE.mo
70
- */
71
- load_textdomain( 'wpo_wcpdf', $dir . 'woocommerce-pdf-invoices-packing-slips/wpo_wcpdf-' . $locale . '.mo' );
72
- load_textdomain( 'wpo_wcpdf', $dir . 'plugins/wpo_wcpdf-' . $locale . '.mo' );
73
- load_plugin_textdomain( 'wpo_wcpdf', false, dirname( self::$plugin_basename ) . '/languages' );
74
- }
75
-
76
- /**
77
- * Load the main plugin classes and functions
78
- */
79
- public function includes() {
80
- include_once( 'includes/class-wcpdf-settings.php' );
81
- include_once( 'includes/class-wcpdf-writepanels.php' );
82
- include_once( 'includes/class-wcpdf-export.php' );
83
- }
84
-
85
-
86
- /**
87
- * Instantiate classes when woocommerce is activated
88
- */
89
- public function load_classes() {
90
- if ( $this->is_woocommerce_activated() ) {
91
- $this->includes();
92
- $this->settings = new WooCommerce_PDF_Invoices_Settings();
93
- $this->writepanels = new WooCommerce_PDF_Invoices_Writepanels();
94
- $this->export = new WooCommerce_PDF_Invoices_Export();
95
- } else {
96
- // display notice instead
97
- add_action( 'admin_notices', array ( $this, 'need_woocommerce' ) );
98
- }
99
-
100
- }
101
-
102
- /**
103
- * Check if woocommerce is activated
104
- */
105
- public function is_woocommerce_activated() {
106
- $blog_plugins = get_option( 'active_plugins', array() );
107
- $site_plugins = is_multisite() ? (array) maybe_unserialize( get_site_option('active_sitewide_plugins' ) ) : array();
108
-
109
- if ( in_array( 'woocommerce/woocommerce.php', $blog_plugins ) || isset( $site_plugins['woocommerce/woocommerce.php'] ) ) {
110
- return true;
111
- } else {
112
- return false;
113
- }
114
- }
115
-
116
- /**
117
- * WooCommerce not active notice.
118
- *
119
- * @return string Fallack notice.
120
- */
121
-
122
- public function need_woocommerce() {
123
- $error = sprintf( __( 'WooCommerce PDF Invoices & Packing Slips requires %sWooCommerce%s to be installed & activated!' , 'wpo_wcpdf' ), '<a href="http://wordpress.org/extend/plugins/woocommerce/">', '</a>' );
124
-
125
- $message = '<div class="error"><p>' . $error . '</p></div>';
126
-
127
- echo $message;
128
- }
129
-
130
- /** Lifecycle methods *******************************************************
131
- * Because register_activation_hook only runs when the plugin is manually
132
- * activated by the user, we're checking the current version against the
133
- * version stored in the database
134
- ****************************************************************************/
135
-
136
- /**
137
- * Handles version checking
138
- */
139
- public function do_install() {
140
- // only install when woocommerce is active
141
- if ( !$this->is_woocommerce_activated() ) {
142
- return;
143
- }
144
-
145
- $version_setting = 'wpo_wcpdf_version';
146
- $installed_version = get_option( $version_setting );
147
-
148
- // installed version lower than plugin version?
149
- if ( version_compare( $installed_version, self::$version, '<' ) ) {
150
-
151
- if ( ! $installed_version ) {
152
- $this->install();
153
- } else {
154
- $this->upgrade( $installed_version );
155
- }
156
-
157
- // new version number
158
- update_option( $version_setting, self::$version );
159
- }
160
- }
161
-
162
-
163
- /**
164
- * Plugin install method. Perform any installation tasks here
165
- */
166
- protected function install() {
167
- // Create temp folders
168
- $tmp_base = $this->export->get_tmp_base();
169
-
170
- // check if tmp folder exists => if not, initialize
171
- if ( !@is_dir( $tmp_base ) ) {
172
- $this->export->init_tmp( $tmp_base );
173
- }
174
-
175
- }
176
-
177
-
178
- /**
179
- * Plugin upgrade method. Perform any required upgrades here
180
- *
181
- * @param string $installed_version the currently installed version
182
- */
183
- protected function upgrade( $installed_version ) {
184
- if ( $installed_version == 'versionless') { // versionless = 1.4.14 and older
185
- // We're upgrading from an old version, so we're enabling the option to use the plugin tmp folder.
186
- // This is not per se the 'best' solution, but the good thing is that nothing is changed
187
- // and nothing will be broken (that wasn't broken before)
188
- $default = array( 'old_tmp' => 1 );
189
- update_option( 'wpo_wcpdf_debug_settings', $default );
190
- }
191
-
192
- // sync fonts on every upgrade!
193
- $debug_settings = get_option( 'wpo_wcpdf_debug_settings' ); // get temp setting
194
-
195
- // do not copy if old_tmp function active! (double check for slow databases)
196
- if ( !( isset($debug_settings['old_tmp']) || $installed_version == 'versionless' ) ) {
197
- $tmp_base = $this->export->get_tmp_base();
198
-
199
- // check if tmp folder exists => if not, initialize
200
- if ( !@is_dir( $tmp_base ) ) {
201
- $this->export->init_tmp( $tmp_base );
202
- }
203
-
204
- $font_path = $tmp_base . 'fonts/';
205
- $this->export->copy_fonts( $font_path );
206
- }
207
-
208
- // 1.5.28 update: copy next invoice number to separate setting
209
- if ( $installed_version == 'versionless' || version_compare( $installed_version, '1.5.28', '<' ) ) {
210
- $template_settings = get_option( 'wpo_wcpdf_template_settings' );
211
- $next_invoice_number = isset($template_settings['next_invoice_number'])?$template_settings['next_invoice_number']:'';
212
- update_option( 'wpo_wcpdf_next_invoice_number', $next_invoice_number );
213
- }
214
- }
215
-
216
- /***********************************************************************/
217
- /********************** GENERAL TEMPLATE FUNCTIONS *********************/
218
- /***********************************************************************/
219
-
220
- /**
221
- * Get template name from slug
222
- */
223
- public function get_template_name ( $template_type ) {
224
- switch ( $template_type ) {
225
- case 'invoice':
226
- $template_name = apply_filters( 'wpo_wcpdf_invoice_title', __( 'Invoice', 'wpo_wcpdf' ) );
227
- break;
228
- case 'packing-slip':
229
- $template_name = apply_filters( 'wpo_wcpdf_packing_slip_title', __( 'Packing Slip', 'wpo_wcpdf' ) );
230
- break;
231
- default:
232
- // try to 'unslug' the name
233
- $template_name = ucwords( str_replace( array( '_', '-' ), ' ', $template_type ) );
234
- break;
235
- }
236
-
237
- return apply_filters( 'wpo_wcpdf_template_name', $template_name, $template_type );
238
- }
239
-
240
- /**
241
- * Output template styles
242
- */
243
- public function template_styles() {
244
- $css = apply_filters( 'wpo_wcpdf_template_styles_file', $this->export->template_path. '/' .'style.css' );
245
-
246
- ob_start();
247
- if (file_exists($css)) {
248
- include($css);
249
- }
250
- $html = ob_get_clean();
251
- $html = apply_filters( 'wpo_wcpdf_template_styles', $html );
252
-
253
- echo $html;
254
- }
255
-
256
- /**
257
- * Return logo id
258
- */
259
- public function get_header_logo_id() {
260
- if (isset($this->settings->template_settings['header_logo'])) {
261
- return apply_filters( 'wpo_wcpdf_header_logo_id', $this->settings->template_settings['header_logo'] );
262
- }
263
- }
264
-
265
- /**
266
- * Show logo html
267
- */
268
- public function header_logo() {
269
- if ($this->get_header_logo_id()) {
270
- $attachment_id = $this->get_header_logo_id();
271
- $company = isset($this->settings->template_settings['shop_name'])? $this->settings->template_settings['shop_name'] : '';
272
- if( $attachment_id ) {
273
- $attachment = wp_get_attachment_image_src( $attachment_id, 'full', false );
274
-
275
- $attachment_src = $attachment[0];
276
- $attachment_width = $attachment[1];
277
- $attachment_height = $attachment[2];
278
-
279
- $attachment_path = get_attached_file( $attachment_id );
280
-
281
- if ( apply_filters('wpo_wcpdf_use_path', true) && file_exists($attachment_path) ) {
282
- $src = $attachment_path;
283
- } else {
284
- $src = $attachment_src;
285
- }
286
-
287
- printf('<img src="%1$s" width="%2$d" height="%3$d" alt="%4$s" />', $src, $attachment_width, $attachment_height, esc_attr( $company ) );
288
- }
289
- }
290
- }
291
-
292
- /**
293
- * Return/Show custom company name or default to blog name
294
- */
295
- public function get_shop_name() {
296
- if (!empty($this->settings->template_settings['shop_name'])) {
297
- $name = trim( $this->settings->template_settings['shop_name'] );
298
- return apply_filters( 'wpo_wcpdf_shop_name', wptexturize( $name ) );
299
- } else {
300
- return apply_filters( 'wpo_wcpdf_shop_name', get_bloginfo( 'name' ) );
301
- }
302
- }
303
- public function shop_name() {
304
- echo $this->get_shop_name();
305
- }
306
-
307
- /**
308
- * Return/Show shop/company address if provided
309
- */
310
- public function get_shop_address() {
311
- $shop_address = apply_filters( 'wpo_wcpdf_shop_address', wpautop( wptexturize( $this->settings->template_settings['shop_address'] ) ) );
312
- if (!empty($shop_address)) {
313
- return $shop_address;
314
- } else {
315
- return false;
316
- }
317
- }
318
- public function shop_address() {
319
- echo $this->get_shop_address();
320
- }
321
-
322
- /**
323
- * Check if billing address and shipping address are equal
324
- */
325
- public function ships_to_different_address() {
326
- // always prefer parent address for refunds
327
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
328
- // temporarily switch order to make all filters / order calls work correctly
329
- $order_meta = get_post_meta( $parent_order_id );
330
- } else {
331
- $order_meta = get_post_meta( $this->export->order->id );
332
- }
333
-
334
- $address_comparison_fields = apply_filters( 'wpo_wcpdf_address_comparison_fields', array(
335
- 'first_name',
336
- 'last_name',
337
- 'company',
338
- 'address_1',
339
- 'address_2',
340
- 'city',
341
- 'state',
342
- 'postcode',
343
- 'country'
344
- ) );
345
-
346
- foreach ($address_comparison_fields as $address_field) {
347
- $billing_field = isset( $order_meta['_billing_'.$address_field] ) ? $order_meta['_billing_'.$address_field] : '';
348
- $shipping_field = isset( $order_meta['_shipping_'.$address_field] ) ? $order_meta['_shipping_'.$address_field] : '';
349
- if ( $shipping_field != $billing_field ) {
350
- // this address field is different -> ships to different address!
351
- return true;
352
- }
353
- }
354
-
355
- //if we got here, it means the addresses are equal -> doesn't ship to different address!
356
- return apply_filters( 'wpo_wcpdf_ships_to_different_address', false, $order_meta );
357
- }
358
-
359
- /**
360
- * Return/Show billing address
361
- */
362
- public function get_billing_address() {
363
- // always prefer parent billing address for refunds
364
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
365
- // temporarily switch order to make all filters / order calls work correctly
366
- $current_order = $this->export->order;
367
- $this->export->order = new WC_Order( $parent_order_id );
368
- $address = apply_filters( 'wpo_wcpdf_billing_address', $this->export->order->get_formatted_billing_address() );
369
- // switch back & unset
370
- $this->export->order = $current_order;
371
- unset($current_order);
372
- } elseif ( $address = $this->export->order->get_formatted_billing_address() ) {
373
- // regular shop_order
374
- $address = apply_filters( 'wpo_wcpdf_billing_address', $address );
375
- } else {
376
- // no address
377
- $address = apply_filters( 'wpo_wcpdf_billing_address', __('N/A', 'wpo_wcpdf') );
378
- }
379
-
380
- return $address;
381
- }
382
- public function billing_address() {
383
- echo $this->get_billing_address();
384
- }
385
-
386
- /**
387
- * Return/Show billing email
388
- */
389
- public function get_billing_email() {
390
- $billing_email = $this->export->order->billing_email;
391
-
392
- if ( !$billing_email && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
393
- // try parent
394
- $billing_email = get_post_meta( $parent_order_id, '_billing_email', true );
395
- }
396
-
397
- return apply_filters( 'wpo_wcpdf_billing_email', $billing_email );
398
- }
399
- public function billing_email() {
400
- echo $this->get_billing_email();
401
- }
402
-
403
- /**
404
- * Return/Show billing phone
405
- */
406
- public function get_billing_phone() {
407
- $billing_phone = $this->export->order->billing_phone;
408
-
409
- if ( !$billing_phone && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
410
- // try parent
411
- $billing_phone = get_post_meta( $parent_order_id, '_billing_phone', true );
412
- }
413
-
414
- return apply_filters( 'wpo_wcpdf_billing_phone', $billing_phone );
415
- }
416
- public function billing_phone() {
417
- echo $this->get_billing_phone();
418
- }
419
-
420
- /**
421
- * Return/Show shipping address
422
- */
423
- public function get_shipping_address() {
424
- // always prefer parent shipping address for refunds
425
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
426
- // temporarily switch order to make all filters / order calls work correctly
427
- $current_order = $this->export->order;
428
- $this->export->order = new WC_Order( $parent_order_id );
429
- $address = apply_filters( 'wpo_wcpdf_shipping_address', $this->export->order->get_formatted_shipping_address() );
430
- // switch back & unset
431
- $this->export->order = $current_order;
432
- unset($current_order);
433
- } elseif ( $address = $this->export->order->get_formatted_shipping_address() ) {
434
- // regular shop_order
435
- $address = apply_filters( 'wpo_wcpdf_shipping_address', $address );
436
- } else {
437
- // no address
438
- $address = apply_filters( 'wpo_wcpdf_shipping_address', __('N/A', 'wpo_wcpdf') );
439
- }
440
-
441
- return $address;
442
- }
443
- public function shipping_address() {
444
- echo $this->get_shipping_address();
445
- }
446
-
447
- /**
448
- * Return/Show a custom field
449
- */
450
- public function get_custom_field( $field_name ) {
451
- $custom_field = get_post_meta($this->export->order->id,$field_name,true);
452
-
453
- if ( !$custom_field && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
454
- // try parent
455
- $custom_field = get_post_meta( $parent_order_id, $field_name, true );
456
- }
457
-
458
- return apply_filters( 'wpo_wcpdf_billing_custom_field', $custom_field );
459
- }
460
- public function custom_field( $field_name, $field_label = '', $display_empty = false ) {
461
- $custom_field = $this->get_custom_field( $field_name );
462
- if (!empty($field_label)){
463
- // add a a trailing space to the label
464
- $field_label .= ' ';
465
- }
466
-
467
- if (!empty($custom_field) || $display_empty) {
468
- echo $field_label . nl2br ($custom_field);
469
- }
470
- }
471
-
472
- /**
473
- * Return/Show order notes
474
- */
475
- public function get_order_notes( $filter = 'customer' ) {
476
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
477
- $post_id = $parent_order_id;
478
- } else {
479
- $post_id = $this->export->order->id;
480
- }
481
-
482
- $args = array(
483
- 'post_id' => $post_id,
484
- 'approve' => 'approve',
485
- 'type' => 'order_note'
486
- );
487
-
488
- remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
489
-
490
- $notes = get_comments( $args );
491
-
492
- add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
493
-
494
- if ( $notes ) {
495
- foreach( $notes as $key => $note ) {
496
- if ( $filter == 'customer' && !get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ) {
497
- unset($notes[$key]);
498
- }
499
- if ( $filter == 'private' && get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ) {
500
- unset($notes[$key]);
501
- }
502
- }
503
- return $notes;
504
- }
505
- }
506
- public function order_notes( $filter = 'customer' ) {
507
- $notes = $this->get_order_notes( $filter );
508
- if ( $notes ) {
509
- foreach( $notes as $note ) {
510
- ?>
511
- <div class="note_content">
512
- <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
513
- </div>
514
- <?php
515
- }
516
- }
517
- }
518
-
519
- /**
520
- * Return/Show the current date
521
- */
522
- public function get_current_date() {
523
- return apply_filters( 'wpo_wcpdf_date', date_i18n( get_option( 'date_format' ) ) );
524
- }
525
- public function current_date() {
526
- echo $this->get_current_date();
527
- }
528
-
529
- /**
530
- * Return/Show payment method
531
- */
532
- public function get_payment_method() {
533
- $payment_method_label = __( 'Payment method', 'wpo_wcpdf' );
534
-
535
- $payment_method = __( $this->export->order->payment_method_title, 'woocommerce' );
536
- if ( !$payment_method && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
537
- // try parent
538
- $payment_method = get_post_meta( $parent_order_id, '_payment_method_title', true );
539
- $payment_method = __( $payment_method, 'woocommerce' );
540
- }
541
-
542
- return apply_filters( 'wpo_wcpdf_payment_method', $payment_method );
543
- }
544
- public function payment_method() {
545
- echo $this->get_payment_method();
546
- }
547
-
548
- /**
549
- * Return/Show shipping method
550
- */
551
- public function get_shipping_method() {
552
- $shipping_method_label = __( 'Shipping method', 'wpo_wcpdf' );
553
- return apply_filters( 'wpo_wcpdf_shipping_method', __( $this->export->order->get_shipping_method(), 'woocommerce' ) );
554
- }
555
- public function shipping_method() {
556
- echo $this->get_shipping_method();
557
- }
558
-
559
- /**
560
- * Return/Show order number
561
- */
562
- public function get_order_number() {
563
- // try parent first
564
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
565
- $parent_order = new WC_Order( $parent_order_id );
566
- $order_number = $parent_order->get_order_number();
567
- } else {
568
- $order_number = $this->export->order->get_order_number();
569
- }
570
-
571
- // Trim the hash to have a clean number but still
572
- // support any filters that were applied before.
573
- $order_number = ltrim($order_number, '#');
574
- return apply_filters( 'wpo_wcpdf_order_number', $order_number);
575
- }
576
- public function order_number() {
577
- echo $this->get_order_number();
578
- }
579
-
580
- /**
581
- * Return/Show invoice number
582
- */
583
- public function get_invoice_number() {
584
- // try parent first
585
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
586
- $invoice_number = $this->export->get_invoice_number( $parent_order_id );
587
- } else {
588
- $invoice_number = $this->export->get_invoice_number( $this->export->order->id );
589
- }
590
-
591
- return $invoice_number;
592
- }
593
- public function invoice_number() {
594
- echo $this->get_invoice_number();
595
- }
596
-
597
- /**
598
- * Return/Show the order date
599
- */
600
- public function get_order_date() {
601
- if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
602
- $parent_order = new WC_Order( $parent_order_id );
603
- $order_date = $parent_order->order_date;
604
- } else {
605
- $order_date = $this->export->order->order_date;
606
- }
607
-
608
- $date = date_i18n( get_option( 'date_format' ), strtotime( $order_date ) );
609
- return apply_filters( 'wpo_wcpdf_order_date', $date, $order_date );
610
- }
611
- public function order_date() {
612
- echo $this->get_order_date();
613
- }
614
-
615
- /**
616
- * Return/Show the invoice date
617
- */
618
- public function get_invoice_date() {
619
- $invoice_date = get_post_meta($this->export->order->id,'_wcpdf_invoice_date',true);
620
-
621
- // add invoice date if it doesn't exist
622
- if ( empty($invoice_date) || !isset($invoice_date) ) {
623
- $invoice_date = current_time('mysql');
624
- update_post_meta( $this->export->order->id, '_wcpdf_invoice_date', $invoice_date );
625
- }
626
-
627
- $formatted_invoice_date = date_i18n( get_option( 'date_format' ), strtotime( $invoice_date ) );
628
-
629
- return apply_filters( 'wpo_wcpdf_invoice_date', $formatted_invoice_date, $invoice_date );
630
- }
631
- public function invoice_date() {
632
- echo $this->get_invoice_date();
633
- }
634
-
635
- /**
636
- * Return the order items
637
- */
638
- public function get_order_items() {
639
- return apply_filters( 'wpo_wcpdf_order_items', $this->export->get_order_items() );
640
- }
641
-
642
- /**
643
- * Return/show product attribute
644
- */
645
- public function get_product_attribute( $attribute_name, $product ) {
646
- // first, check the text attributes
647
- $attributes = $product->get_attributes();
648
- $attribute_key = @wc_attribute_taxonomy_name( $attribute_name );
649
- if (array_key_exists( sanitize_title( $attribute_name ), $attributes) ) {
650
- $attribute = $product->get_attribute ( $attribute_name );
651
- return $attribute;
652
- } elseif (array_key_exists( sanitize_title( $attribute_key ), $attributes) ) {
653
- $attribute = $product->get_attribute ( $attribute_key );
654
- return $attribute;
655
- }
656
-
657
- // not a text attribute, try attribute taxonomy
658
- $attribute_key = @wc_attribute_taxonomy_name( $attribute_name );
659
- $product_terms = @wc_get_product_terms( $product->id, $attribute_key, array( 'fields' => 'names' ) );
660
- // check if not empty, then display
661
- if ( !empty($product_terms) ) {
662
- $attribute = array_shift( $product_terms );
663
- return $attribute;
664
- } else {
665
- // no attribute under this name
666
- return false;
667
- }
668
- }
669
- public function product_attribute( $attribute_name, $product ) {
670
- echo $this->get_product_attribute( $attribute_name, $product );
671
- }
672
-
673
-
674
- /**
675
- * Return the order totals listing
676
- */
677
- public function get_woocommerce_totals() {
678
- // get totals and remove the semicolon
679
- $totals = apply_filters( 'wpo_wcpdf_raw_order_totals', $this->export->order->get_order_item_totals(), $this->export->order );
680
-
681
- // remove the colon for every label
682
- foreach ( $totals as $key => $total ) {
683
- $label = $total['label'];
684
- $colon = strrpos( $label, ':' );
685
- if( $colon !== false ) {
686
- $label = substr_replace( $label, '', $colon, 1 );
687
- }
688
- $totals[$key]['label'] = $label;
689
- }
690
-
691
- // WC2.4 fix order_total for refunded orders
692
- if ( version_compare( WOOCOMMERCE_VERSION, '2.4', '>=' ) && isset($totals['order_total']) ) {
693
- $tax_display = $this->export->order->tax_display_cart;
694
- $totals['order_total']['value'] = wc_price( $this->export->order->get_total(), array( 'currency' => $this->export->order->get_order_currency() ) );
695
- $order_total = $this->export->order->get_total();
696
- $tax_string = '';
697
-
698
- // Tax for inclusive prices
699
- if ( wc_tax_enabled() && 'incl' == $tax_display ) {
700
- $tax_string_array = array();
701
-
702
- if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
703
- foreach ( $this->export->order->get_tax_totals() as $code => $tax ) {
704
- $tax_amount = $tax->formatted_amount;
705
- $tax_string_array[] = sprintf( '%s %s', $tax_amount, $tax->label );
706
- }
707
- } else {
708
- $tax_string_array[] = sprintf( '%s %s', wc_price( $this->export->order->get_total_tax() - $this->export->order->get_total_tax_refunded(), array( 'currency' => $this->export->order->get_order_currency() ) ), WC()->countries->tax_or_vat() );
709
- }
710
- if ( ! empty( $tax_string_array ) ) {
711
- if ( version_compare( WOOCOMMERCE_VERSION, '2.6', '>=' ) ) {
712
- $tax_string = ' ' . sprintf( __( '(includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) );
713
- } else {
714
- // use old capitalized string
715
- $tax_string = ' ' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) );
716
- }
717
- }
718
- }
719
-
720
- $totals['order_total']['value'] .= $tax_string;
721
- }
722
-
723
- // remove refund lines (shouldn't be in invoice)
724
- foreach ( $totals as $key => $total ) {
725
- if ( strpos($key, 'refund_') !== false ) {
726
- unset( $totals[$key] );
727
- }
728
- }
729
-
730
- return apply_filters( 'wpo_wcpdf_woocommerce_totals', $totals, $this->export->order );
731
- }
732
-
733
- /**
734
- * Return/show the order subtotal
735
- */
736
- public function get_order_subtotal( $tax = 'excl', $discount = 'incl' ) { // set $tax to 'incl' to include tax, same for $discount
737
- //$compound = ($discount == 'incl')?true:false;
738
-
739
- $subtotal = $this->export->order->get_subtotal_to_display( false, $tax );
740
-
741
- $subtotal = ($pos = strpos($subtotal, ' <small')) ? substr($subtotal, 0, $pos) : $subtotal; //removing the 'excluding tax' text
742
-
743
- $subtotal = array (
744
- 'label' => __('Subtotal', 'wpo_wcpdf'),
745
- 'value' => $subtotal,
746
- );
747
-
748
- return apply_filters( 'wpo_wcpdf_order_subtotal', $subtotal, $tax, $discount );
749
- }
750
- public function order_subtotal( $tax = 'excl', $discount = 'incl' ) {
751
- $subtotal = $this->get_order_subtotal( $tax, $discount );
752
- echo $subtotal['value'];
753
- }
754
-
755
- /**
756
- * Return/show the order shipping costs
757
- */
758
- public function get_order_shipping( $tax = 'excl' ) { // set $tax to 'incl' to include tax
759
- if ($tax == 'excl' ) {
760
- $shipping_costs = $this->export->wc_price( $this->export->order->order_shipping );
761
- } else {
762
- $shipping_costs = $this->export->wc_price( $this->export->order->order_shipping + $this->export->order->order_shipping_tax );
763
- }
764
-
765
- $shipping = array (
766
- 'label' => __('Shipping', 'wpo_wcpdf'),
767
- 'value' => $shipping_costs,
768
- 'tax' => $this->export->wc_price( $this->export->order->order_shipping_tax ),
769
- );
770
- return apply_filters( 'wpo_wcpdf_order_shipping', $shipping, $tax );
771
- }
772
- public function order_shipping( $tax = 'excl' ) {
773
- $shipping = $this->get_order_shipping( $tax );
774
- echo $shipping['value'];
775
- }
776
-
777
- /**
778
- * Return/show the total discount
779
- */
780
- public function get_order_discount( $type = 'total', $tax = 'incl' ) {
781
- if ( $tax == 'incl' ) {
782
- switch ($type) {
783
- case 'cart':
784
- // Cart Discount - pre-tax discounts. (deprecated in WC2.3)
785
- $discount_value = $this->export->order->get_cart_discount();
786
- break;
787
- case 'order':
788
- // Order Discount - post-tax discounts. (deprecated in WC2.3)
789
- $discount_value = $this->export->order->get_order_discount();
790
- break;
791
- case 'total':
792
- // Total Discount
793
- if ( version_compare( WOOCOMMERCE_VERSION, '2.3' ) >= 0 ) {
794
- $discount_value = $this->export->order->get_total_discount( false ); // $ex_tax = false
795
- } else {
796
- // WC2.2 and older: recalculate to include tax
797
- $discount_value = 0;
798
- $items = $this->export->order->get_items();;
799
- if( sizeof( $items ) > 0 ) {
800
- foreach( $items as $item ) {
801
- $discount_value += ($item['line_subtotal'] + $item['line_subtotal_tax']) - ($item['line_total'] + $item['line_tax']);
802
- }
803
- }
804
- }
805
-
806
- break;
807
- default:
808
- // Total Discount - Cart & Order Discounts combined
809
- $discount_value = $this->export->order->get_total_discount();
810
- break;
811
- }
812
- } else { // calculate discount excluding tax
813
- if ( version_compare( WOOCOMMERCE_VERSION, '2.3' ) >= 0 ) {
814
- $discount_value = $this->export->order->get_total_discount( true ); // $ex_tax = true
815
- } else {
816
- // WC2.2 and older: recalculate to exclude tax
817
- $discount_value = 0;
818
-
819
- $items = $this->export->order->get_items();;
820
- if( sizeof( $items ) > 0 ) {
821
- foreach( $items as $item ) {
822
- $discount_value += ($item['line_subtotal'] - $item['line_total']);
823
- }
824
- }
825
- }
826
- }
827
-
828
- $discount = array (
829
- 'label' => __('Discount', 'wpo_wcpdf'),
830
- 'value' => $this->export->wc_price($discount_value),
831
- 'raw_value' => $discount_value,
832
- );
833
-
834
- if ( round( $discount_value, 3 ) != 0 ) {
835
- return apply_filters( 'wpo_wcpdf_order_discount', $discount, $type, $tax );
836
- }
837
- }
838
- public function order_discount( $type = 'total', $tax = 'incl' ) {
839
- $discount = $this->get_order_discount( $type, $tax );
840
- echo $discount['value'];
841
- }
842
-
843
- /**
844
- * Return the order fees
845
- */
846
- public function get_order_fees( $tax = 'excl' ) {
847
- if ( $wcfees = $this->export->order->get_fees() ) {
848
- foreach( $wcfees as $id => $fee ) {
849
- if ($tax == 'excl' ) {
850
- $fee_price = $this->export->wc_price( $fee['line_total'] );
851
- } else {
852
- $fee_price = $this->export->wc_price( $fee['line_total'] + $fee['line_tax'] );
853
- }
854
-
855
- $fees[ $id ] = array(
856
- 'label' => $fee['name'],
857
- 'value' => $fee_price,
858
- 'line_total' => $this->export->wc_price($fee['line_total']),
859
- 'line_tax' => $this->export->wc_price($fee['line_tax'])
860
- );
861
- }
862
- return $fees;
863
- }
864
- }
865
-
866
- /**
867
- * Return the order taxes
868
- */
869
- public function get_order_taxes() {
870
- $tax_label = __( 'VAT', 'wpo_wcpdf' ); // register alternate label translation
871
- $tax_label = __( 'Tax rate', 'wpo_wcpdf' );
872
- $tax_rate_ids = $this->export->get_tax_rate_ids();
873
- if ($this->export->order->get_taxes()) {
874
- foreach ( $this->export->order->get_taxes() as $key => $tax ) {
875
- $taxes[ $key ] = array(
876
- 'label' => isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ],
877
- 'value' => $this->export->wc_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) ),
878
- 'rate_id' => $tax['rate_id'],
879
- 'tax_amount' => $tax['tax_amount'],
880
- 'shipping_tax_amount' => $tax['shipping_tax_amount'],
881
- 'rate' => isset( $tax_rate_ids[ $tax['rate_id'] ] ) ? ( (float) $tax_rate_ids[$tax['rate_id']]['tax_rate'] ) . ' %': '',
882
- );
883
- }
884
-
885
- return apply_filters( 'wpo_wcpdf_order_taxes', $taxes );
886
- }
887
- }
888
-
889
- /**
890
- * Return/show the order grand total
891
- */
892
- public function get_order_grand_total( $tax = 'incl' ) {
893
- if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
894
- // WC 2.1 or newer is used
895
- $total_unformatted = $this->export->order->get_total();
896
- } else {
897
- // Backwards compatibility
898
- $total_unformatted = $this->export->order->get_order_total();
899
- }
900
-
901
- if ($tax == 'excl' ) {
902
- $total_tax = 0;
903
- foreach ( $this->export->order->get_taxes() as $tax ) {
904
- $total_tax += ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] );
905
- }
906
-
907
- $total = $this->export->wc_price( ( $total_unformatted - $total_tax ) );
908
- $label = __( 'Total ex. VAT', 'wpo_wcpdf' );
909
- } else {
910
- $total = $this->export->wc_price( ( $total_unformatted ) );
911
- $label = __( 'Total', 'wpo_wcpdf' );
912
- }
913
-
914
- $grand_total = array(
915
- 'label' => $label,
916
- 'value' => $total,
917
- );
918
-
919
- return apply_filters( 'wpo_wcpdf_order_grand_total', $grand_total, $tax );
920
- }
921
- public function order_grand_total( $tax = 'incl' ) {
922
- $grand_total = $this->get_order_grand_total( $tax );
923
- echo $grand_total['value'];
924
- }
925
-
926
-
927
- /**
928
- * Return/Show shipping notes
929
- */
930
- public function get_shipping_notes() {
931
- $shipping_notes = wpautop( wptexturize( $this->export->order->customer_note ) );
932
- return apply_filters( 'wpo_wcpdf_shipping_notes', $shipping_notes );
933
- }
934
- public function shipping_notes() {
935
- echo $this->get_shipping_notes();
936
- }
937
-
938
-
939
- /**
940
- * Return/Show shop/company footer imprint, copyright etc.
941
- */
942
- public function get_footer() {
943
- if (isset($this->settings->template_settings['footer'])) {
944
- $footer = wpautop( wptexturize( $this->settings->template_settings[ 'footer' ] ) );
945
- return apply_filters( 'wpo_wcpdf_footer', $footer );
946
- }
947
- }
948
- public function footer() {
949
- echo $this->get_footer();
950
- }
951
-
952
- /**
953
- * Return/Show Extra field 1
954
- */
955
- public function get_extra_1() {
956
- if (isset($this->settings->template_settings['extra_1'])) {
957
- $extra_1 = nl2br( wptexturize( $this->settings->template_settings[ 'extra_1' ] ) );
958
- return apply_filters( 'wpo_wcpdf_extra_1', $extra_1 );
959
- }
960
- }
961
- public function extra_1() {
962
- echo $this->get_extra_1();
963
- }
964
-
965
- /**
966
- * Return/Show Extra field 2
967
- */
968
- public function get_extra_2() {
969
- if (isset($this->settings->template_settings['extra_2'])) {
970
- $extra_2 = nl2br( wptexturize( $this->settings->template_settings[ 'extra_2' ] ) );
971
- return apply_filters( 'wpo_wcpdf_extra_2', $extra_2 );
972
- }
973
- }
974
- public function extra_2() {
975
- echo $this->get_extra_2();
976
- }
977
-
978
- /**
979
- * Return/Show Extra field 3
980
- */
981
- public function get_extra_3() {
982
- if (isset($this->settings->template_settings['extra_3'])) {
983
- $extra_3 = nl2br( wptexturize( $this->settings->template_settings[ 'extra_3' ] ) );
984
- return apply_filters( 'wpo_wcpdf_extra_3', $extra_3 );
985
- }
986
- }
987
- public function extra_3() {
988
- echo $this->get_extra_3();
989
- }
990
- }
991
- }
992
-
993
- // Load main plugin class
994
- $wpo_wcpdf = new WooCommerce_PDF_Invoices();
1
+ <?php
2
+ /**
3
+ * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
+ * Plugin URI: http://www.wpovernight.com
5
+ * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
+ * Version: 1.5.38
7
+ * Author: Ewout Fernhout
8
+ * Author URI: http://www.wpovernight.com
9
+ * License: GPLv2 or later
10
+ * License URI: http://www.opensource.org/licenses/gpl-license.php
11
+ * Text Domain: wpo_wcpdf
12
+ */
13
+
14
+ if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
15
+
16
+ class WooCommerce_PDF_Invoices {
17
+
18
+ public static $plugin_prefix;
19
+ public static $plugin_url;
20
+ public static $plugin_path;
21
+ public static $plugin_basename;
22
+ public static $version;
23
+
24
+ public $writepanels;
25
+ public $settings;
26
+ public $export;
27
+
28
+ /**
29
+ * Constructor
30
+ */
31
+ public function __construct() {
32
+ self::$plugin_prefix = 'wpo_wcpdf_';
33
+ self::$plugin_basename = plugin_basename(__FILE__);
34
+ self::$plugin_url = plugin_dir_url(self::$plugin_basename);
35
+ self::$plugin_path = trailingslashit(dirname(__FILE__));
36
+ self::$version = '1.5.38';
37
+
38
+ // load the localisation & classes
39
+ add_action( 'plugins_loaded', array( $this, 'translations' ) ); // or use init?
40
+ add_action( 'init', array( $this, 'load_classes' ) );
41
+
42
+ // run lifecycle methods
43
+ if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
44
+ // check if upgrading from versionless (1.4.14 and older)
45
+ if ( get_option('wpo_wcpdf_general_settings') && get_option('wpo_wcpdf_version') === false ) {
46
+ // tag 'versionless', so that we can apply necessary upgrade settings
47
+ add_option( 'wpo_wcpdf_version', 'versionless' );
48
+ }
49
+
50
+ add_action( 'wp_loaded', array( $this, 'do_install' ) );
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Load the translation / textdomain files
56
+ *
57
+ * Note: the first-loaded translation file overrides any following ones if the same translation is present
58
+ */
59
+ public function translations() {
60
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'wpo_wcpdf' );
61
+ $dir = trailingslashit( WP_LANG_DIR );
62
+
63
+ /**
64
+ * Frontend/global Locale. Looks in:
65
+ *
66
+ * - WP_LANG_DIR/woocommerce-pdf-invoices-packing-slips/wpo_wcpdf-LOCALE.mo
67
+ * - WP_LANG_DIR/plugins/wpo_wcpdf-LOCALE.mo
68
+ * - woocommerce-pdf-invoices-packing-slips/languages/wpo_wcpdf-LOCALE.mo (which if not found falls back to:)
69
+ * - WP_LANG_DIR/plugins/wpo_wcpdf-LOCALE.mo
70
+ */
71
+ load_textdomain( 'wpo_wcpdf', $dir . 'woocommerce-pdf-invoices-packing-slips/wpo_wcpdf-' . $locale . '.mo' );
72
+ load_textdomain( 'wpo_wcpdf', $dir . 'plugins/wpo_wcpdf-' . $locale . '.mo' );
73
+ load_plugin_textdomain( 'wpo_wcpdf', false, dirname( self::$plugin_basename ) . '/languages' );
74
+ }
75
+
76
+ /**
77
+ * Load the main plugin classes and functions
78
+ */
79
+ public function includes() {
80
+ include_once( 'includes/class-wcpdf-settings.php' );
81
+ include_once( 'includes/class-wcpdf-writepanels.php' );
82
+ include_once( 'includes/class-wcpdf-export.php' );
83
+ }
84
+
85
+
86
+ /**
87
+ * Instantiate classes when woocommerce is activated
88
+ */
89
+ public function load_classes() {
90
+ if ( $this->is_woocommerce_activated() ) {
91
+ $this->includes();
92
+ $this->settings = new WooCommerce_PDF_Invoices_Settings();
93
+ $this->writepanels = new WooCommerce_PDF_Invoices_Writepanels();
94
+ $this->export = new WooCommerce_PDF_Invoices_Export();
95
+ } else {
96
+ // display notice instead
97
+ add_action( 'admin_notices', array ( $this, 'need_woocommerce' ) );
98
+ }
99
+
100
+ }
101
+
102
+ /**
103
+ * Check if woocommerce is activated
104
+ */
105
+ public function is_woocommerce_activated() {
106
+ $blog_plugins = get_option( 'active_plugins', array() );
107
+ $site_plugins = is_multisite() ? (array) maybe_unserialize( get_site_option('active_sitewide_plugins' ) ) : array();
108
+
109
+ if ( in_array( 'woocommerce/woocommerce.php', $blog_plugins ) || isset( $site_plugins['woocommerce/woocommerce.php'] ) ) {
110
+ return true;
111
+ } else {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ /**
117
+ * WooCommerce not active notice.
118
+ *
119
+ * @return string Fallack notice.
120
+ */
121
+
122
+ public function need_woocommerce() {
123
+ $error = sprintf( __( 'WooCommerce PDF Invoices & Packing Slips requires %sWooCommerce%s to be installed & activated!' , 'wpo_wcpdf' ), '<a href="http://wordpress.org/extend/plugins/woocommerce/">', '</a>' );
124
+
125
+ $message = '<div class="error"><p>' . $error . '</p></div>';
126
+
127
+ echo $message;
128
+ }
129
+
130
+ /** Lifecycle methods *******************************************************
131
+ * Because register_activation_hook only runs when the plugin is manually
132
+ * activated by the user, we're checking the current version against the
133
+ * version stored in the database
134
+ ****************************************************************************/
135
+
136
+ /**
137
+ * Handles version checking
138
+ */
139
+ public function do_install() {
140
+ // only install when woocommerce is active
141
+ if ( !$this->is_woocommerce_activated() ) {
142
+ return;
143
+ }
144
+
145
+ $version_setting = 'wpo_wcpdf_version';
146
+ $installed_version = get_option( $version_setting );
147
+
148
+ // installed version lower than plugin version?
149
+ if ( version_compare( $installed_version, self::$version, '<' ) ) {
150
+
151
+ if ( ! $installed_version ) {
152
+ $this->install();
153
+ } else {
154
+ $this->upgrade( $installed_version );
155
+ }
156
+
157
+ // new version number
158
+ update_option( $version_setting, self::$version );
159
+ }
160
+ }
161
+
162
+
163
+ /**
164
+ * Plugin install method. Perform any installation tasks here
165
+ */
166
+ protected function install() {
167
+ // Create temp folders
168
+ $tmp_base = $this->export->get_tmp_base();
169
+
170
+ // check if tmp folder exists => if not, initialize
171
+ if ( !@is_dir( $tmp_base ) ) {
172
+ $this->export->init_tmp( $tmp_base );
173
+ }
174
+
175
+ }
176
+
177
+
178
+ /**
179
+ * Plugin upgrade method. Perform any required upgrades here
180
+ *
181
+ * @param string $installed_version the currently installed version
182
+ */
183
+ protected function upgrade( $installed_version ) {
184
+ if ( $installed_version == 'versionless') { // versionless = 1.4.14 and older
185
+ // We're upgrading from an old version, so we're enabling the option to use the plugin tmp folder.
186
+ // This is not per se the 'best' solution, but the good thing is that nothing is changed
187
+ // and nothing will be broken (that wasn't broken before)
188
+ $default = array( 'old_tmp' => 1 );
189
+ update_option( 'wpo_wcpdf_debug_settings', $default );
190
+ }
191
+
192
+ // sync fonts on every upgrade!
193
+ $debug_settings = get_option( 'wpo_wcpdf_debug_settings' ); // get temp setting
194
+
195
+ // do not copy if old_tmp function active! (double check for slow databases)
196
+ if ( !( isset($debug_settings['old_tmp']) || $installed_version == 'versionless' ) ) {
197
+ $tmp_base = $this->export->get_tmp_base();
198
+
199
+ // check if tmp folder exists => if not, initialize
200
+ if ( !@is_dir( $tmp_base ) ) {
201
+ $this->export->init_tmp( $tmp_base );
202
+ }
203
+
204
+ $font_path = $tmp_base . 'fonts/';
205
+ $this->export->copy_fonts( $font_path );
206
+ }
207
+
208
+ // 1.5.28 update: copy next invoice number to separate setting
209
+ if ( $installed_version == 'versionless' || version_compare( $installed_version, '1.5.28', '<' ) ) {
210
+ $template_settings = get_option( 'wpo_wcpdf_template_settings' );
211
+ $next_invoice_number = isset($template_settings['next_invoice_number'])?$template_settings['next_invoice_number']:'';
212
+ update_option( 'wpo_wcpdf_next_invoice_number', $next_invoice_number );
213
+ }
214
+ }
215
+
216
+ /***********************************************************************/
217
+ /********************** GENERAL TEMPLATE FUNCTIONS *********************/
218
+ /***********************************************************************/
219
+
220
+ /**
221
+ * Get template name from slug
222
+ */
223
+ public function get_template_name ( $template_type ) {
224
+ switch ( $template_type ) {
225
+ case 'invoice':
226
+ $template_name = apply_filters( 'wpo_wcpdf_invoice_title', __( 'Invoice', 'wpo_wcpdf' ) );
227
+ break;
228
+ case 'packing-slip':
229
+ $template_name = apply_filters( 'wpo_wcpdf_packing_slip_title', __( 'Packing Slip', 'wpo_wcpdf' ) );
230
+ break;
231
+ default:
232
+ // try to 'unslug' the name
233
+ $template_name = ucwords( str_replace( array( '_', '-' ), ' ', $template_type ) );
234
+ break;
235
+ }
236
+
237
+ return apply_filters( 'wpo_wcpdf_template_name', $template_name, $template_type );
238
+ }
239
+
240
+ /**
241
+ * Output template styles
242
+ */
243
+ public function template_styles() {
244
+ $css = apply_filters( 'wpo_wcpdf_template_styles_file', $this->export->template_path. '/' .'style.css' );
245
+
246
+ ob_start();
247
+ if (file_exists($css)) {
248
+ include($css);
249
+ }
250
+ $html = ob_get_clean();
251
+ $html = apply_filters( 'wpo_wcpdf_template_styles', $html );
252
+
253
+ echo $html;
254
+ }
255
+
256
+ /**
257
+ * Return logo id
258
+ */
259
+ public function get_header_logo_id() {
260
+ if (isset($this->settings->template_settings['header_logo'])) {
261
+ return apply_filters( 'wpo_wcpdf_header_logo_id', $this->settings->template_settings['header_logo'] );
262
+ }
263
+ }
264
+
265
+ /**
266
+ * Show logo html
267
+ */
268
+ public function header_logo() {
269
+ if ($this->get_header_logo_id()) {
270
+ $attachment_id = $this->get_header_logo_id();
271
+ $company = isset($this->settings->template_settings['shop_name'])? $this->settings->template_settings['shop_name'] : '';
272
+ if( $attachment_id ) {
273
+ $attachment = wp_get_attachment_image_src( $attachment_id, 'full', false );
274
+
275
+ $attachment_src = $attachment[0];
276
+ $attachment_width = $attachment[1];
277
+ $attachment_height = $attachment[2];
278
+
279
+ $attachment_path = get_attached_file( $attachment_id );
280
+
281
+ if ( apply_filters('wpo_wcpdf_use_path', true) && file_exists($attachment_path) ) {
282
+ $src = $attachment_path;
283
+ } else {
284
+ $src = $attachment_src;
285
+ }
286
+
287
+ printf('<img src="%1$s" width="%2$d" height="%3$d" alt="%4$s" />', $src, $attachment_width, $attachment_height, esc_attr( $company ) );
288
+ }
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Return/Show custom company name or default to blog name
294
+ */
295
+ public function get_shop_name() {
296
+ if (!empty($this->settings->template_settings['shop_name'])) {
297
+ $name = trim( $this->settings->template_settings['shop_name'] );
298
+ return apply_filters( 'wpo_wcpdf_shop_name', wptexturize( $name ) );
299
+ } else {
300
+ return apply_filters( 'wpo_wcpdf_shop_name', get_bloginfo( 'name' ) );
301
+ }
302
+ }
303
+ public function shop_name() {
304
+ echo $this->get_shop_name();
305
+ }
306
+
307
+ /**
308
+ * Return/Show shop/company address if provided
309
+ */
310
+ public function get_shop_address() {
311
+ $shop_address = apply_filters( 'wpo_wcpdf_shop_address', wpautop( wptexturize( $this->settings->template_settings['shop_address'] ) ) );
312
+ if (!empty($shop_address)) {
313
+ return $shop_address;
314
+ } else {
315
+ return false;
316
+ }
317
+ }
318
+ public function shop_address() {
319
+ echo $this->get_shop_address();
320
+ }
321
+
322
+ /**
323
+ * Check if billing address and shipping address are equal
324
+ */
325
+ public function ships_to_different_address() {
326
+ // always prefer parent address for refunds
327
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
328
+ // temporarily switch order to make all filters / order calls work correctly
329
+ $order_meta = get_post_meta( $parent_order_id );
330
+ } else {
331
+ $order_meta = get_post_meta( $this->export->order->id );
332
+ }
333
+
334
+ $address_comparison_fields = apply_filters( 'wpo_wcpdf_address_comparison_fields', array(
335
+ 'first_name',
336
+ 'last_name',
337
+ 'company',
338
+ 'address_1',
339
+ 'address_2',
340
+ 'city',
341
+ 'state',
342
+ 'postcode',
343
+ 'country'
344
+ ) );
345
+
346
+ foreach ($address_comparison_fields as $address_field) {
347
+ $billing_field = isset( $order_meta['_billing_'.$address_field] ) ? $order_meta['_billing_'.$address_field] : '';
348
+ $shipping_field = isset( $order_meta['_shipping_'.$address_field] ) ? $order_meta['_shipping_'.$address_field] : '';
349
+ if ( $shipping_field != $billing_field ) {
350
+ // this address field is different -> ships to different address!
351
+ return true;
352
+ }
353
+ }
354
+
355
+ //if we got here, it means the addresses are equal -> doesn't ship to different address!
356
+ return apply_filters( 'wpo_wcpdf_ships_to_different_address', false, $order_meta );
357
+ }
358
+
359
+ /**
360
+ * Return/Show billing address
361
+ */
362
+ public function get_billing_address() {
363
+ // always prefer parent billing address for refunds
364
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
365
+ // temporarily switch order to make all filters / order calls work correctly
366
+ $current_order = $this->export->order;
367
+ $this->export->order = new WC_Order( $parent_order_id );
368
+ $address = apply_filters( 'wpo_wcpdf_billing_address', $this->export->order->get_formatted_billing_address() );
369
+ // switch back & unset
370
+ $this->export->order = $current_order;
371
+ unset($current_order);
372
+ } elseif ( $address = $this->export->order->get_formatted_billing_address() ) {
373
+ // regular shop_order
374
+ $address = apply_filters( 'wpo_wcpdf_billing_address', $address );
375
+ } else {
376
+ // no address
377
+ $address = apply_filters( 'wpo_wcpdf_billing_address', __('N/A', 'wpo_wcpdf') );
378
+ }
379
+
380
+ return $address;
381
+ }
382
+ public function billing_address() {
383
+ echo $this->get_billing_address();
384
+ }
385
+
386
+ /**
387
+ * Return/Show billing email
388
+ */
389
+ public function get_billing_email() {
390
+ $billing_email = $this->export->order->billing_email;
391
+
392
+ if ( !$billing_email && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
393
+ // try parent
394
+ $billing_email = get_post_meta( $parent_order_id, '_billing_email', true );
395
+ }
396
+
397
+ return apply_filters( 'wpo_wcpdf_billing_email', $billing_email );
398
+ }
399
+ public function billing_email() {
400
+ echo $this->get_billing_email();
401
+ }
402
+
403
+ /**
404
+ * Return/Show billing phone
405
+ */
406
+ public function get_billing_phone() {
407
+ $billing_phone = $this->export->order->billing_phone;
408
+
409
+ if ( !$billing_phone && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
410
+ // try parent
411
+ $billing_phone = get_post_meta( $parent_order_id, '_billing_phone', true );
412
+ }
413
+
414
+ return apply_filters( 'wpo_wcpdf_billing_phone', $billing_phone );
415
+ }
416
+ public function billing_phone() {
417
+ echo $this->get_billing_phone();
418
+ }
419
+
420
+ /**
421
+ * Return/Show shipping address
422
+ */
423
+ public function get_shipping_address() {
424
+ // always prefer parent shipping address for refunds
425
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
426
+ // temporarily switch order to make all filters / order calls work correctly
427
+ $current_order = $this->export->order;
428
+ $this->export->order = new WC_Order( $parent_order_id );
429
+ $address = apply_filters( 'wpo_wcpdf_shipping_address', $this->export->order->get_formatted_shipping_address() );
430
+ // switch back & unset
431
+ $this->export->order = $current_order;
432
+ unset($current_order);
433
+ } elseif ( $address = $this->export->order->get_formatted_shipping_address() ) {
434
+ // regular shop_order
435
+ $address = apply_filters( 'wpo_wcpdf_shipping_address', $address );
436
+ } else {
437
+ // no address
438
+ $address = apply_filters( 'wpo_wcpdf_shipping_address', __('N/A', 'wpo_wcpdf') );
439
+ }
440
+
441
+ return $address;
442
+ }
443
+ public function shipping_address() {
444
+ echo $this->get_shipping_address();
445
+ }
446
+
447
+ /**
448
+ * Return/Show a custom field
449
+ */
450
+ public function get_custom_field( $field_name ) {
451
+ $custom_field = get_post_meta($this->export->order->id,$field_name,true);
452
+
453
+ if ( !$custom_field && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
454
+ // try parent
455
+ $custom_field = get_post_meta( $parent_order_id, $field_name, true );
456
+ }
457
+
458
+ return apply_filters( 'wpo_wcpdf_billing_custom_field', $custom_field );
459
+ }
460
+ public function custom_field( $field_name, $field_label = '', $display_empty = false ) {
461
+ $custom_field = $this->get_custom_field( $field_name );
462
+ if (!empty($field_label)){
463
+ // add a a trailing space to the label
464
+ $field_label .= ' ';
465
+ }
466
+
467
+ if (!empty($custom_field) || $display_empty) {
468
+ echo $field_label . nl2br ($custom_field);
469
+ }
470
+ }
471
+
472
+ /**
473
+ * Return/Show order notes
474
+ */
475
+ public function get_order_notes( $filter = 'customer' ) {
476
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
477
+ $post_id = $parent_order_id;
478
+ } else {
479
+ $post_id = $this->export->order->id;
480
+ }
481
+
482
+ $args = array(
483
+ 'post_id' => $post_id,
484
+ 'approve' => 'approve',
485
+ 'type' => 'order_note'
486
+ );
487
+
488
+ remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
489
+
490
+ $notes = get_comments( $args );
491
+
492
+ add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
493
+
494
+ if ( $notes ) {
495
+ foreach( $notes as $key => $note ) {
496
+ if ( $filter == 'customer' && !get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ) {
497
+ unset($notes[$key]);
498
+ }
499
+ if ( $filter == 'private' && get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ) {
500
+ unset($notes[$key]);
501
+ }
502
+ }
503
+ return $notes;
504
+ }
505
+ }
506
+ public function order_notes( $filter = 'customer' ) {
507
+ $notes = $this->get_order_notes( $filter );
508
+ if ( $notes ) {
509
+ foreach( $notes as $note ) {
510
+ ?>
511
+ <div class="note_content">
512
+ <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
513
+ </div>
514
+ <?php
515
+ }
516
+ }
517
+ }
518
+
519
+ /**
520
+ * Return/Show the current date
521
+ */
522
+ public function get_current_date() {
523
+ return apply_filters( 'wpo_wcpdf_date', date_i18n( get_option( 'date_format' ) ) );
524
+ }
525
+ public function current_date() {
526
+ echo $this->get_current_date();
527
+ }
528
+
529
+ /**
530
+ * Return/Show payment method
531
+ */
532
+ public function get_payment_method() {
533
+ $payment_method_label = __( 'Payment method', 'wpo_wcpdf' );
534
+
535
+ $payment_method = __( $this->export->order->payment_method_title, 'woocommerce' );
536
+ if ( !$payment_method && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
537
+ // try parent
538
+ $payment_method = get_post_meta( $parent_order_id, '_payment_method_title', true );
539
+ $payment_method = __( $payment_method, 'woocommerce' );
540
+ }
541
+
542
+ return apply_filters( 'wpo_wcpdf_payment_method', $payment_method );
543
+ }
544
+ public function payment_method() {
545
+ echo $this->get_payment_method();
546
+ }
547
+
548
+ /**
549
+ * Return/Show shipping method
550
+ */
551
+ public function get_shipping_method() {
552
+ $shipping_method_label = __( 'Shipping method', 'wpo_wcpdf' );
553
+ return apply_filters( 'wpo_wcpdf_shipping_method', __( $this->export->order->get_shipping_method(), 'woocommerce' ) );
554
+ }
555
+ public function shipping_method() {
556
+ echo $this->get_shipping_method();
557
+ }
558
+
559
+ /**
560
+ * Return/Show order number
561
+ */
562
+ public function get_order_number() {
563
+ // try parent first
564
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
565
+ $parent_order = new WC_Order( $parent_order_id );
566
+ $order_number = $parent_order->get_order_number();
567
+ } else {
568
+ $order_number = $this->export->order->get_order_number();
569
+ }
570
+
571
+ // Trim the hash to have a clean number but still
572
+ // support any filters that were applied before.
573
+ $order_number = ltrim($order_number, '#');
574
+ return apply_filters( 'wpo_wcpdf_order_number', $order_number);
575
+ }
576
+ public function order_number() {
577
+ echo $this->get_order_number();
578
+ }
579
+
580
+ /**
581
+ * Return/Show invoice number
582
+ */
583
+ public function get_invoice_number() {
584
+ // try parent first
585
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
586
+ $invoice_number = $this->export->get_invoice_number( $parent_order_id );
587
+ } else {
588
+ $invoice_number = $this->export->get_invoice_number( $this->export->order->id );
589
+ }
590
+
591
+ return $invoice_number;
592
+ }
593
+ public function invoice_number() {
594
+ echo $this->get_invoice_number();
595
+ }
596
+
597
+ /**
598
+ * Return/Show the order date
599
+ */
600
+ public function get_order_date() {
601
+ if ( get_post_type( $this->export->order->id ) == 'shop_order_refund' && $parent_order_id = wp_get_post_parent_id( $this->export->order->id ) ) {
602
+ $parent_order = new WC_Order( $parent_order_id );
603
+ $order_date = $parent_order->order_date;
604
+ } else {
605
+ $order_date = $this->export->order->order_date;
606
+ }
607
+
608
+ $date = date_i18n( get_option( 'date_format' ), strtotime( $order_date ) );
609
+ return apply_filters( 'wpo_wcpdf_order_date', $date, $order_date );
610
+ }
611
+ public function order_date() {
612
+ echo $this->get_order_date();
613
+ }
614
+
615
+ /**
616
+ * Return/Show the invoice date
617
+ */
618
+ public function get_invoice_date() {
619
+ $invoice_date = get_post_meta($this->export->order->id,'_wcpdf_invoice_date',true);
620
+
621
+ // add invoice date if it doesn't exist
622
+ if ( empty($invoice_date) || !isset($invoice_date) ) {
623
+ $invoice_date = current_time('mysql');
624
+ update_post_meta( $this->export->order->id, '_wcpdf_invoice_date', $invoice_date );
625
+ }
626
+
627
+ $formatted_invoice_date = date_i18n( get_option( 'date_format' ), strtotime( $invoice_date ) );
628
+
629
+ return apply_filters( 'wpo_wcpdf_invoice_date', $formatted_invoice_date, $invoice_date );
630
+ }
631
+ public function invoice_date() {
632
+ echo $this->get_invoice_date();
633
+ }
634
+
635
+ /**
636
+ * Return the order items
637
+ */
638
+ public function get_order_items() {
639
+ return apply_filters( 'wpo_wcpdf_order_items', $this->export->get_order_items() );
640
+ }
641
+
642
+ /**
643
+ * Return/show product attribute
644
+ */
645
+ public function get_product_attribute( $attribute_name, $product ) {
646
+ // first, check the text attributes
647
+ $attributes = $product->get_attributes();
648
+ $attribute_key = @wc_attribute_taxonomy_name( $attribute_name );
649
+ if (array_key_exists( sanitize_title( $attribute_name ), $attributes) ) {
650
+ $attribute = $product->get_attribute ( $attribute_name );
651
+ return $attribute;
652
+ } elseif (array_key_exists( sanitize_title( $attribute_key ), $attributes) ) {
653
+ $attribute = $product->get_attribute ( $attribute_key );
654
+ return $attribute;
655
+ }
656
+
657
+ // not a text attribute, try attribute taxonomy
658
+ $attribute_key = @wc_attribute_taxonomy_name( $attribute_name );
659
+ $product_terms = @wc_get_product_terms( $product->id, $attribute_key, array( 'fields' => 'names' ) );
660
+ // check if not empty, then display
661
+ if ( !empty($product_terms) ) {
662
+ $attribute = array_shift( $product_terms );
663
+ return $attribute;
664
+ } else {
665
+ // no attribute under this name
666
+ return false;
667
+ }
668
+ }
669
+ public function product_attribute( $attribute_name, $product ) {
670
+ echo $this->get_product_attribute( $attribute_name, $product );
671
+ }
672
+
673
+
674
+ /**
675
+ * Return the order totals listing
676
+ */
677
+ public function get_woocommerce_totals() {
678
+ // get totals and remove the semicolon
679
+ $totals = apply_filters( 'wpo_wcpdf_raw_order_totals', $this->export->order->get_order_item_totals(), $this->export->order );
680
+
681
+ // remove the colon for every label
682
+ foreach ( $totals as $key => $total ) {
683
+ $label = $total['label'];
684
+ $colon = strrpos( $label, ':' );
685
+ if( $colon !== false ) {
686
+ $label = substr_replace( $label, '', $colon, 1 );
687
+ }
688
+ $totals[$key]['label'] = $label;
689
+ }
690
+
691
+ // WC2.4 fix order_total for refunded orders
692
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.4', '>=' ) && isset($totals['order_total']) ) {
693
+ $tax_display = $this->export->order->tax_display_cart;
694
+ $totals['order_total']['value'] = wc_price( $this->export->order->get_total(), array( 'currency' => $this->export->order->get_order_currency() ) );
695
+ $order_total = $this->export->order->get_total();
696
+ $tax_string = '';
697
+
698
+ // Tax for inclusive prices
699
+ if ( wc_tax_enabled() && 'incl' == $tax_display ) {
700
+ $tax_string_array = array();
701
+
702
+ if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
703
+ foreach ( $this->export->order->get_tax_totals() as $code => $tax ) {
704
+ $tax_amount = $tax->formatted_amount;
705
+ $tax_string_array[] = sprintf( '%s %s', $tax_amount, $tax->label );
706
+ }
707
+ } else {
708
+ $tax_string_array[] = sprintf( '%s %s', wc_price( $this->export->order->get_total_tax() - $this->export->order->get_total_tax_refunded(), array( 'currency' => $this->export->order->get_order_currency() ) ), WC()->countries->tax_or_vat() );
709
+ }
710
+ if ( ! empty( $tax_string_array ) ) {
711
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.6', '>=' ) ) {
712
+ $tax_string = ' ' . sprintf( __( '(includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) );
713
+ } else {
714
+ // use old capitalized string
715
+ $tax_string = ' ' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) );
716
+ }
717
+ }
718
+ }
719
+
720
+ $totals['order_total']['value'] .= $tax_string;
721
+ }
722
+
723
+ // remove refund lines (shouldn't be in invoice)
724
+ foreach ( $totals as $key => $total ) {
725
+ if ( strpos($key, 'refund_') !== false ) {
726
+ unset( $totals[$key] );
727
+ }
728
+ }
729
+
730
+ return apply_filters( 'wpo_wcpdf_woocommerce_totals', $totals, $this->export->order );
731
+ }
732
+
733
+ /**
734
+ * Return/show the order subtotal
735
+ */
736
+ public function get_order_subtotal( $tax = 'excl', $discount = 'incl' ) { // set $tax to 'incl' to include tax, same for $discount
737
+ //$compound = ($discount == 'incl')?true:false;
738
+
739
+ $subtotal = $this->export->order->get_subtotal_to_display( false, $tax );
740
+
741
+ $subtotal = ($pos = strpos($subtotal, ' <small')) ? substr($subtotal, 0, $pos) : $subtotal; //removing the 'excluding tax' text
742
+
743
+ $subtotal = array (
744
+ 'label' => __('Subtotal', 'wpo_wcpdf'),
745
+ 'value' => $subtotal,
746
+ );
747
+
748
+ return apply_filters( 'wpo_wcpdf_order_subtotal', $subtotal, $tax, $discount );
749
+ }
750
+ public function order_subtotal( $tax = 'excl', $discount = 'incl' ) {
751
+ $subtotal = $this->get_order_subtotal( $tax, $discount );
752
+ echo $subtotal['value'];
753
+ }
754
+
755
+ /**
756
+ * Return/show the order shipping costs
757
+ */
758
+ public function get_order_shipping( $tax = 'excl' ) { // set $tax to 'incl' to include tax
759
+ if ($tax == 'excl' ) {
760
+ $shipping_costs = $this->export->wc_price( $this->export->order->order_shipping );
761
+ } else {
762
+ $shipping_costs = $this->export->wc_price( $this->export->order->order_shipping + $this->export->order->order_shipping_tax );
763
+ }
764
+
765
+ $shipping = array (
766
+ 'label' => __('Shipping', 'wpo_wcpdf'),
767
+ 'value' => $shipping_costs,
768
+ 'tax' => $this->export->wc_price( $this->export->order->order_shipping_tax ),
769
+ );
770
+ return apply_filters( 'wpo_wcpdf_order_shipping', $shipping, $tax );
771
+ }
772
+ public function order_shipping( $tax = 'excl' ) {
773
+ $shipping = $this->get_order_shipping( $tax );
774
+ echo $shipping['value'];
775
+ }
776
+
777
+ /**
778
+ * Return/show the total discount
779
+ */
780
+ public function get_order_discount( $type = 'total', $tax = 'incl' ) {
781
+ if ( $tax == 'incl' ) {
782
+ switch ($type) {
783
+ case 'cart':
784
+ // Cart Discount - pre-tax discounts. (deprecated in WC2.3)
785
+ $discount_value = $this->export->order->get_cart_discount();
786
+ break;
787
+ case 'order':
788
+ // Order Discount - post-tax discounts. (deprecated in WC2.3)
789
+ $discount_value = $this->export->order->get_order_discount();
790
+ break;
791
+ case 'total':
792
+ // Total Discount
793
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.3' ) >= 0 ) {
794
+ $discount_value = $this->export->order->get_total_discount( false ); // $ex_tax = false
795
+ } else {
796
+ // WC2.2 and older: recalculate to include tax
797
+ $discount_value = 0;
798
+ $items = $this->export->order->get_items();;
799
+ if( sizeof( $items ) > 0 ) {
800
+ foreach( $items as $item ) {
801
+ $discount_value += ($item['line_subtotal'] + $item['line_subtotal_tax']) - ($item['line_total'] + $item['line_tax']);
802
+ }
803
+ }
804
+ }
805
+
806
+ break;
807
+ default:
808
+ // Total Discount - Cart & Order Discounts combined
809
+ $discount_value = $this->export->order->get_total_discount();
810
+ break;
811
+ }
812
+ } else { // calculate discount excluding tax
813
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.3' ) >= 0 ) {
814
+ $discount_value = $this->export->order->get_total_discount( true ); // $ex_tax = true
815
+ } else {
816
+ // WC2.2 and older: recalculate to exclude tax
817
+ $discount_value = 0;
818
+
819
+ $items = $this->export->order->get_items();;
820
+ if( sizeof( $items ) > 0 ) {
821
+ foreach( $items as $item ) {
822
+ $discount_value += ($item['line_subtotal'] - $item['line_total']);
823
+ }
824
+ }
825
+ }
826
+ }
827
+
828
+ $discount = array (
829
+ 'label' => __('Discount', 'wpo_wcpdf'),
830
+ 'value' => $this->export->wc_price($discount_value),
831
+ 'raw_value' => $discount_value,
832
+ );
833
+
834
+ if ( round( $discount_value, 3 ) != 0 ) {
835
+ return apply_filters( 'wpo_wcpdf_order_discount', $discount, $type, $tax );
836
+ }
837
+ }
838
+ public function order_discount( $type = 'total', $tax = 'incl' ) {
839
+ $discount = $this->get_order_discount( $type, $tax );
840
+ echo $discount['value'];
841
+ }
842
+
843
+ /**
844
+ * Return the order fees
845
+ */
846
+ public function get_order_fees( $tax = 'excl' ) {
847
+ if ( $wcfees = $this->export->order->get_fees() ) {
848
+ foreach( $wcfees as $id => $fee ) {
849
+ if ($tax == 'excl' ) {
850
+ $fee_price = $this->export->wc_price( $fee['line_total'] );
851
+ } else {
852
+ $fee_price = $this->export->wc_price( $fee['line_total'] + $fee['line_tax'] );
853
+ }
854
+
855
+ $fees[ $id ] = array(
856
+ 'label' => $fee['name'],
857
+ 'value' => $fee_price,
858
+ 'line_total' => $this->export->wc_price($fee['line_total']),
859
+ 'line_tax' => $this->export->wc_price($fee['line_tax'])
860
+ );
861
+ }
862
+ return $fees;
863
+ }
864
+ }
865
+
866
+ /**
867
+ * Return the order taxes
868
+ */
869
+ public function get_order_taxes() {
870
+ $tax_label = __( 'VAT', 'wpo_wcpdf' ); // register alternate label translation
871
+ $tax_label = __( 'Tax rate', 'wpo_wcpdf' );
872
+ $tax_rate_ids = $this->export->get_tax_rate_ids();
873
+ if ($this->export->order->get_taxes()) {
874
+ foreach ( $this->export->order->get_taxes() as $key => $tax ) {
875
+ $taxes[ $key ] = array(
876
+ 'label' => isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ],
877
+ 'value' => $this->export->wc_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) ),
878
+ 'rate_id' => $tax['rate_id'],
879
+ 'tax_amount' => $tax['tax_amount'],
880
+ 'shipping_tax_amount' => $tax['shipping_tax_amount'],
881
+ 'rate' => isset( $tax_rate_ids[ $tax['rate_id'] ] ) ? ( (float) $tax_rate_ids[$tax['rate_id']]['tax_rate'] ) . ' %': '',
882
+ );
883
+ }
884
+
885
+ return apply_filters( 'wpo_wcpdf_order_taxes', $taxes );
886
+ }
887
+ }
888
+
889
+ /**
890
+ * Return/show the order grand total
891
+ */
892
+ public function get_order_grand_total( $tax = 'incl' ) {
893
+ if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
894
+ // WC 2.1 or newer is used
895
+ $total_unformatted = $this->export->order->get_total();
896
+ } else {
897
+ // Backwards compatibility
898
+ $total_unformatted = $this->export->order->get_order_total();
899
+ }
900
+
901
+ if ($tax == 'excl' ) {
902
+ $total_tax = 0;
903
+ foreach ( $this->export->order->get_taxes() as $tax ) {
904
+ $total_tax += ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] );
905
+ }
906
+
907
+ $total = $this->export->wc_price( ( $total_unformatted - $total_tax ) );
908
+ $label = __( 'Total ex. VAT', 'wpo_wcpdf' );
909
+ } else {
910
+ $total = $this->export->wc_price( ( $total_unformatted ) );
911
+ $label = __( 'Total', 'wpo_wcpdf' );
912
+ }
913
+
914
+ $grand_total = array(
915
+ 'label' => $label,
916
+ 'value' => $total,
917
+ );
918
+
919
+ return apply_filters( 'wpo_wcpdf_order_grand_total', $grand_total, $tax );
920
+ }
921
+ public function order_grand_total( $tax = 'incl' ) {
922
+ $grand_total = $this->get_order_grand_total( $tax );
923
+ echo $grand_total['value'];
924
+ }
925
+
926
+
927
+ /**
928
+ * Return/Show shipping notes
929
+ */
930
+ public function get_shipping_notes() {
931
+ $shipping_notes = wpautop( wptexturize( $this->export->order->customer_note ) );
932
+ return apply_filters( 'wpo_wcpdf_shipping_notes', $shipping_notes );
933
+ }
934
+ public function shipping_notes() {
935
+ echo $this->get_shipping_notes();
936
+ }
937
+
938
+
939
+ /**
940
+ * Return/Show shop/company footer imprint, copyright etc.
941
+ */
942
+ public function get_footer() {
943
+ if (isset($this->settings->template_settings['footer'])) {
944
+ $footer = wpautop( wptexturize( $this->settings->template_settings[ 'footer' ] ) );
945
+ return apply_filters( 'wpo_wcpdf_footer', $footer );
946
+ }
947
+ }
948
+ public function footer() {
949
+ echo $this->get_footer();
950
+ }
951
+
952
+ /**
953
+ * Return/Show Extra field 1
954
+ */
955
+ public function get_extra_1() {
956
+ if (isset($this->settings->template_settings['extra_1'])) {
957
+ $extra_1 = nl2br( wptexturize( $this->settings->template_settings[ 'extra_1' ] ) );
958
+ return apply_filters( 'wpo_wcpdf_extra_1', $extra_1 );
959
+ }
960
+ }
961
+ public function extra_1() {
962
+ echo $this->get_extra_1();
963
+ }
964
+
965
+ /**
966
+ * Return/Show Extra field 2
967
+ */
968
+ public function get_extra_2() {
969
+ if (isset($this->settings->template_settings['extra_2'])) {
970
+ $extra_2 = nl2br( wptexturize( $this->settings->template_settings[ 'extra_2' ] ) );
971
+ return apply_filters( 'wpo_wcpdf_extra_2', $extra_2 );
972
+ }
973
+ }
974
+ public function extra_2() {
975
+ echo $this->get_extra_2();
976
+ }
977
+
978
+ /**
979
+ * Return/Show Extra field 3
980
+ */
981
+ public function get_extra_3() {
982
+ if (isset($this->settings->template_settings['extra_3'])) {
983
+ $extra_3 = nl2br( wptexturize( $this->settings->template_settings[ 'extra_3' ] ) );
984
+ return apply_filters( 'wpo_wcpdf_extra_3', $extra_3 );
985
+ }
986
+ }
987
+ public function extra_3() {
988
+ echo $this->get_extra_3();
989
+ }
990
+ }
991
+ }
992
+
993
+ // Load main plugin class
994
+ $wpo_wcpdf = new WooCommerce_PDF_Invoices();