diff --git a/inc/class-async-request.php b/inc/class-async-request.php index dcc3f64..611ed62 100755 --- a/inc/class-async-request.php +++ b/inc/class-async-request.php @@ -52,7 +52,7 @@ public function generate_zip( $order_statuses ) { return new WP_Error( 'error', sprintf( esc_html__( 'Order from %1$s to %2$s not found.', 'woocommerce-pdf-invoices-bulk-download' ), $this->date_after, $this->date_before ) ); } - return $this->run( $orders); + return $this->run( $orders ); } public function create_zip( $files = array(), $destination = '', $args = array(), $callback = null ) { @@ -126,6 +126,10 @@ public function run( $orders ) { } else if ( function_exists( 'wcpdf_get_document' ) ) { $r = $this->woocommerce_pdf_invoices_packing_slips( $orders ); + + } else if ( defined( 'PDFPLUGINPATH' ) ) { + require_once( PDFPLUGINPATH . 'classes/class-pdf-send-pdf-class.php' ); + $r = $this->woocommerce_pdf_invoice_plugin( $orders ); } return apply_filters( 'woocommerce-pdf-invoices-bulk-download/run/after', $r, $orders, $this ); @@ -182,6 +186,22 @@ function( $files_to_zip ) { } ); } + public function woocommerce_pdf_invoice_plugin( $orders ) { + $files_to_zip = array(); + + foreach ( $orders as $order ) { + $files_to_zip[] = WC_send_pdf::get_woocommerce_invoice( $order ); + } + + $archive_name = $this->get_archive_name(); + + return $this->create_zip( + $files_to_zip, + $archive_name, + array( 'overwrite' => true ) + ); + } + public function get_archive_name() { return sprintf( 'Invoices_%s-%s.zip', $this->date_after, $this->date_before ); } diff --git a/woocommerce-pdf-invoices-bulk-download.php b/woocommerce-pdf-invoices-bulk-download.php index 4ad436c..19918b5 100644 --- a/woocommerce-pdf-invoices-bulk-download.php +++ b/woocommerce-pdf-invoices-bulk-download.php @@ -29,6 +29,7 @@ $depends_plugins = array( 'woocommerce-pdf-invoices/bootstrap.php', 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php', + 'woocommerce-pdf-invoice/woocommerce-pdf-invoice.php', ); $plugin_is_activated = false; @@ -72,7 +73,9 @@ function woo_pdf_invoices_buld_download_depends_fail() { $messages = array(); $messages[] = sprintf( '%2$s', esc_url( 'https://wordpress.org/plugins/woocommerce-pdf-invoices/' ), esc_html__( 'WooCommerce PDF Invoices', 'woocommerce-pdf-invoices-bulk-download' ) ); $messages[] = sprintf( '%2$s', esc_url( 'https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/' ), esc_html__( 'WooCommerce PDF Invoices & Packing Slips', 'woocommerce-pdf-invoices-bulk-download' ) ); + $messages[] = sprintf( '%2$s', esc_url( 'https://woocommerce.com/products/pdf-invoices/' ), esc_html__( 'PDF Invoices', 'woocommerce-pdf-invoices-bulk-download' ) ); + $html_message = sprintf( '
%1$s %2$s %3$s