Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(212)

Unified Diff: classes/class-pdf-send-pdf-class.php

Issue 287270043: Add support for third-party numbering plugins (WooCommerce PDF Invoices by WooThemes) Base URL: ssh://open-tools.net/var/www/open-tools.net/private/git/Others/woothemes-pdf-invoice@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « classes/class-pdf-functions-class.php ('k') | classes/class-pdf-settings-class.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: classes/class-pdf-send-pdf-class.php
diff --git a/classes/class-pdf-send-pdf-class.php b/classes/class-pdf-send-pdf-class.php
index a3cfa368eb35918bb1a61715a4dd5189a142d205..9af7f3e5324241ec9571175dbf4ccc9aecc0054c 100644
--- a/classes/class-pdf-send-pdf-class.php
+++ b/classes/class-pdf-send-pdf-class.php
@@ -281,7 +281,12 @@
global $woocommerce;
if ( $order_id ) :
- $invnum = esc_html( get_post_meta( $order_id, '_invoice_number_display', true ) );
+ $invnum = get_post_meta( $order_id, '_invoice_number_display', true );
+ // Let third-party numbering plugins override the invoice number
+ if ($woocommerce_pdf_invoice_options['sequential'] != "true") {
+ $invnum = apply_filters( 'woocommerce_invoice_number', $invnum, $order_id );
+ }
+ $invnum = esc_html( $invnum );
else :
$invnum = '';
endif;
@@ -619,24 +624,16 @@
endif;
/**
- * Look for the Sequential Order Numbers Pro / Sequential Order Numbers order number and use it if it's there
+ * Look for Order numbers assigned by third-party plugins (e.g. Sequential Order Numbers Pro /
+ * Sequential Order Numbers or Open Tools Advanced Order Numbers) and use it if it's there.
*/
- $output_order_num = $order_id;
+ // WooCommerce's Order class provides a generic function to obtain the order number (which might be set by third-party plugins...)
+ $output_order_num = $order->get_order_number();
if( !is_admin() ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
- // Sequential Order Numbers
- if ( get_post_meta( $order_id,'_order_number',TRUE ) && class_exists( 'WC_Seq_Order_Number_Pro' ) ) :
- $output_order_num = get_post_meta( $order_id,'_order_number',TRUE );
- endif;
-
- // Sequential Order Numbers Pro
- if ( get_post_meta( $order_id,'_order_number_formatted',TRUE ) && class_exists( 'WC_Seq_Order_Number' ) ) :
- $output_order_num = get_post_meta( $order_id,'_order_number_formatted',TRUE );
- endif;
-
$headers = '<table class="shop_table orderdetails" width="100%">' .
'<thead>' .
'<tr><th colspan="7" align="left"><h2>' . esc_html__('Order Details', 'woocommerce-pdf-invoice') . '</h2></th></tr>' .
« no previous file with comments | « classes/class-pdf-functions-class.php ('k') | classes/class-pdf-settings-class.php » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b