WooCommerce PDF Invoices - Version 3.0.10

Version Description

  • October 28, 2019 =

  • Fixed: Fatal errors when using micro template.

Download this release

Release Info

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

Code changes from version 3.0.9 to 3.0.10

bootstrap.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PDF Invoices
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
5
  * Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
6
- * Version: 3.0.9
7
  * Author: Bas Elbers
8
  * Author URI: http://wcpdfinvoices.com
9
  * License: GPL-2.0+
@@ -16,7 +16,7 @@
16
 
17
  defined( 'ABSPATH' ) || exit;
18
 
19
- define( 'WPI_VERSION', '3.0.9' );
20
 
21
  /**
22
  * Load WooCommerce PDF Invoices plugin.
3
  * Plugin Name: WooCommerce PDF Invoices
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
5
  * Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
6
+ * Version: 3.0.10
7
  * Author: Bas Elbers
8
  * Author URI: http://wcpdfinvoices.com
9
  * License: GPL-2.0+
16
 
17
  defined( 'ABSPATH' ) || exit;
18
 
19
+ define( 'WPI_VERSION', '3.0.10' );
20
 
21
  /**
22
  * Load WooCommerce PDF Invoices plugin.
includes/abstracts/abstract-invoice.php CHANGED
@@ -664,4 +664,249 @@ abstract class BEWPI_Abstract_Invoice extends BEWPI_Abstract_Document {
664
  public function set_colspan( $colspan ) {
665
  $this->colspan = $colspan;
666
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  }
664
  public function set_colspan( $colspan ) {
665
  $this->colspan = $colspan;
666
  }
667
+
668
+ /**
669
+ * Checks if invoice needs to have a zero rated VAT.
670
+ *
671
+ * @deprecated See minimal template.
672
+ * @return bool
673
+ */
674
+ public function display_zero_rated_vat() {
675
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8' );
676
+ // WC backwards compatibility.
677
+ $order_id = BEWPI_WC_Order_Compatibility::get_id( $this->order );
678
+
679
+ $is_vat_valid = get_post_meta( $order_id, '_vat_number_is_valid', true );
680
+ if ( ! $is_vat_valid ) {
681
+ return false;
682
+ }
683
+
684
+ $is_tax_removed = count( $this->order->get_tax_totals() ) === 0;
685
+ if ( ! $is_tax_removed ) {
686
+ return false;
687
+ }
688
+
689
+ return true;
690
+ }
691
+
692
+ /**
693
+ * @param $str
694
+ *
695
+ * @deprecated moved to BEWPI_Template Class.
696
+ *
697
+ * @return mixed
698
+ */
699
+ private function replace_placeholders( $str ) {
700
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8' );
701
+ // WC backwards compatibility.
702
+ $order_id = BEWPI_WC_Order_Compatibility::get_id( $this->order );
703
+
704
+ $placeholders = apply_filters( 'bewpi_placeholders', array(
705
+ '[payment_method]' => BEWPI_WC_Order_Compatibility::get_prop( $this->order, 'payment_method_title' ),
706
+ '[shipping_method]' => $this->order->get_shipping_method(),
707
+ ), $order_id );
708
+
709
+ foreach ( $placeholders as $placeholder => $value ) {
710
+ $str = str_replace( $placeholder, $value, $str );
711
+ }
712
+
713
+ return $str;
714
+ }
715
+
716
+ /**
717
+ * @deprecated instead use 'WPI()->templater()->get_option()'.
718
+ */
719
+ public function left_footer_column_html() {
720
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8', 'WPI()->templater()->get_option( \'bewpi_left_footer_column\' )' );
721
+ $left_footer_column_text = $this->template_options['bewpi_left_footer_column'];
722
+ if ( ! empty( $left_footer_column_text ) ) {
723
+ echo '<p>' . nl2br( $this->replace_placeholders( $left_footer_column_text ) ) . '</p>';
724
+ }
725
+ }
726
+
727
+ /**
728
+ * @deprecated instead use 'WPI()->templater()->get_option()'.
729
+ */
730
+ public function right_footer_column_html() {
731
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8' );
732
+ $right_footer_column_text = $this->template_options['bewpi_right_footer_column'];
733
+ if ( ! empty( $right_footer_column_text ) ) {
734
+ echo '<p>' . nl2br( $this->replace_placeholders( $right_footer_column_text ) ) . '</p>';
735
+ } else {
736
+ echo '<p>' . sprintf( __( '%s of %s', 'woocommerce-pdf-invoices' ), '{PAGENO}', '{nbpg}' ) . '</p>';
737
+ }
738
+ }
739
+
740
+ /**
741
+ * Backwards compatibility.
742
+ *
743
+ * @deprecated Use `generate()` instead.
744
+ *
745
+ * @param string $destination pdf generation mode.
746
+ */
747
+ public function save( $destination = 'F', $html_templates = array() ) {
748
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8', 'generate' );
749
+ $this->generate( $destination );
750
+ }
751
+
752
+ /**
753
+ * Display company logo or name
754
+ *
755
+ * @deprecated See minimal template.
756
+ */
757
+ public function get_company_logo_html() {
758
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8', 'WPI()->templater()->get_meta( \'_vat_number\' )' );
759
+ $logo_url = $this->template_options['bewpi_company_logo'];
760
+ if ( ! empty( $logo_url ) ) {
761
+ // mPDF' stablest method to display an image is to use their "Image data as a Variable" (https://mpdf.github.io/what-else-can-i-do/images.html) option.
762
+ $src = apply_filters( 'bewpi_company_logo_url', 'var:company_logo' );
763
+ printf( '<img class="company-logo" src="%s"/>', esc_attr( $src ) );
764
+ } else {
765
+ // show company name if company logo isn't uploaded.
766
+ $company_name = $this->template_options['bewpi_company_name'];
767
+ printf( '<h1 class="company-logo">%s</h1>', esc_html( $company_name ) );
768
+ }
769
+ }
770
+
771
+ /**
772
+ * Get VAT number from WooCommerce EU VAT Number plugin.
773
+ *
774
+ * @deprecated See minimal template.
775
+ */
776
+ public function display_vat_number() {
777
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8', 'WPI()->templater()->get_meta( \'_vat_number\' )' );
778
+ // WC backwards compatibility.
779
+ $order_id = BEWPI_WC_Order_Compatibility::get_id( $this->order );
780
+
781
+ $vat_number = get_post_meta( $order_id, '_vat_number', true );
782
+ if ( ! empty( $vat_number ) ) {
783
+ echo '<span>' . sprintf( __( 'VAT Number: %s', 'woocommerce-pdf-invoices' ), $vat_number ) . '</span>';
784
+ }
785
+ }
786
+
787
+ /**
788
+ * Get PO Number from WooCommerce Purchase Order Gateway plugin.
789
+ *
790
+ * @deprecated See minimal template.
791
+ */
792
+ public function display_purchase_order_number() {
793
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8', 'WPI()->templater()->get_meta( \'_po_number\' )' );
794
+ // WC backwards compatibility.
795
+ $payment_method = BEWPI_WC_Order_Compatibility::get_prop( $this->order, 'payment_method' );
796
+ if ( isset( $payment_method ) && 'woocommerce_gateway_purchase_order' === $payment_method ) {
797
+ // WC backwards compatibility.
798
+ $order_id = BEWPI_WC_Order_Compatibility::get_id( $this->order );
799
+ $po_number = get_post_meta( $order_id, '_po_number', true );
800
+ if ( ! empty( $po_number ) ) {
801
+ echo '<span>' . sprintf( __( 'Purchase Order Number: %s', 'woocommerce-gateway-purchase-order' ), $po_number ) . '</span>';
802
+ }
803
+ }
804
+ }
805
+
806
+ /**
807
+ * Outline columns for within pdf template files.
808
+ *
809
+ * @param int $taxes_count number of tax classes.
810
+ *
811
+ * @deprecated See minimal template.
812
+ */
813
+ public function outlining_columns_html( $taxes_count = 0 ) {
814
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8' );
815
+ $columns_count = $this->get_columns_count( $taxes_count );
816
+ $colspan = $this->get_colspan( $columns_count );
817
+ ?>
818
+ <style>
819
+ <?php
820
+ // Create css for outlining the product cells.
821
+ $righter_product_row_tds_css = "";
822
+ for ( $td = $colspan['left'] + 1; $td <= $columns_count; $td++ ) {
823
+ if ( $td !== $columns_count ) {
824
+ $righter_product_row_tds_css .= "tr.product-row td:nth-child(" . $td . "),";
825
+ } else {
826
+ $righter_product_row_tds_css .= "tr.product-row td:nth-child(" . $td . ")";
827
+ $righter_product_row_tds_css .= "{ width: " . ( 50 / $colspan['right'] ) . "%; }";
828
+ }
829
+ }
830
+ echo $righter_product_row_tds_css;
831
+ ?>
832
+ tr.product-row td:nth-child(1) {
833
+ width: <?php echo $this->desc_cell_width; ?>;
834
+ }
835
+ </style>
836
+ <?php
837
+ }
838
+
839
+ /**
840
+ * Number of columns.
841
+ *
842
+ * @param int $tax_count number of taxes.
843
+ *
844
+ * @deprecated See minimal template.
845
+ * @return int
846
+ */
847
+ public function get_columns_count( $tax_count = 0 ) {
848
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8' );
849
+ $columns_count = 4;
850
+
851
+ if ( $this->template_options['bewpi_show_sku'] ) {
852
+ $columns_count ++;
853
+ }
854
+
855
+ if ( $this->template_options['bewpi_show_tax'] && wc_tax_enabled() && empty( $legacy_order ) ) {
856
+ $columns_count += $tax_count;
857
+ }
858
+
859
+ return $columns_count;
860
+ }
861
+
862
+ /**
863
+ * Calculates colspan for table footer cells
864
+ *
865
+ * @deprecated See minimal template solution.
866
+ *
867
+ * @param int $columns_count number of columns.
868
+ *
869
+ * @return array
870
+ */
871
+ public function get_colspan( $columns_count = 0 ) {
872
+ _deprecated_function( __FUNCTION__, 'WooCommerce PDF Invoices v2.8' );
873
+ $colspan = array();
874
+ $number_of_left_half_columns = 3;
875
+ $this->desc_cell_width = '30%';
876
+
877
+ // The product table will be split into 2 where on the right 5 columns are the max.
878
+ if ( $columns_count <= 4 ) :
879
+ $number_of_left_half_columns = 1;
880
+ $this->desc_cell_width = '48%';
881
+ elseif ( $columns_count <= 6 ) :
882
+ $number_of_left_half_columns = 2;
883
+ $this->desc_cell_width = '35.50%';
884
+ endif;
885
+
886
+ $colspan['left'] = $number_of_left_half_columns;
887
+ $colspan['right'] = $columns_count - $number_of_left_half_columns;
888
+ $colspan['right_left'] = round( ( $colspan['right'] / 2 ), 0, PHP_ROUND_HALF_DOWN );
889
+ $colspan['right_right'] = round( ( $colspan['right'] / 2 ), 0, PHP_ROUND_HALF_UP );
890
+
891
+ return $colspan;
892
+ }
893
+
894
+ /**
895
+ * Check if order has only virtual products.
896
+ *
897
+ * @return bool
898
+ *
899
+ * @deprecated moved to WPI()->templater().
900
+ * @since 2.5.3
901
+ */
902
+ public function has_only_virtual_products() {
903
+ foreach ( $this->order->get_items( 'line_item' ) as $item ) {
904
+ $product = $this->order->get_product_from_item( $item );
905
+ if ( ! $product || ! $product->is_virtual() ) {
906
+ return false;
907
+ }
908
+ }
909
+
910
+ return true;
911
+ }
912
  }
includes/class-template.php CHANGED
@@ -430,4 +430,15 @@ class BEWPI_Template {
430
  public function set_packing_slip( $packing_slip ) {
431
  $this->packing_slip = $packing_slip;
432
  }
 
 
 
 
 
 
 
 
 
 
 
433
  }
430
  public function set_packing_slip( $packing_slip ) {
431
  $this->packing_slip = $packing_slip;
432
  }
433
+
434
+ /**
435
+ * Get the company logo URL.
436
+ *
437
+ * @deprecated
438
+ *
439
+ * @return string The actual url from the Media Library.
440
+ */
441
+ public function get_logo_url() {
442
+ return esc_url_raw( $this->get_option( 'bewpi_company_logo' ) );
443
+ }
444
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: woocommerce pdf invoices, invoice, packing slips, delivery note, packing list, shipping list, generate, pdf, woocommerce, attachment, email, customer invoice, processing, vat, tax, sequential, number, dropbox, google drive, onedrive, egnyte, cloud, storage
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
- Stable tag: 3.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -344,6 +344,10 @@ Since version 2.9.4 the plugin removed the ability to update the PDF invoice whe
344
 
345
  == Changelog ==
346
 
 
 
 
 
347
  = 3.0.9 - October 26, 2019 =
348
 
349
  - Improved: Custom logo upload setting by using the native media library.
4
  Tags: woocommerce pdf invoices, invoice, packing slips, delivery note, packing list, shipping list, generate, pdf, woocommerce, attachment, email, customer invoice, processing, vat, tax, sequential, number, dropbox, google drive, onedrive, egnyte, cloud, storage
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
+ Stable tag: 3.0.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
344
 
345
  == Changelog ==
346
 
347
+ = 3.0.10 - October 28, 2019 =
348
+
349
+ - Fixed: Fatal errors when using micro template.
350
+
351
  = 3.0.9 - October 26, 2019 =
352
 
353
  - Improved: Custom logo upload setting by using the native media library.
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInitce7bc2d44e1502c83506d47b51f806b3::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitff4207c6eb1813414c9e2d05ecccbac9::getLoader();
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInitce7bc2d44e1502c83506d47b51f806b3 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitce7bc2d44e1502c83506d47b51f806b3 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitce7bc2d44e1502c83506d47b51f806b3', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitce7bc2d44e1502c83506d47b51f806b3', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInitff4207c6eb1813414c9e2d05ecccbac9 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitff4207c6eb1813414c9e2d05ecccbac9', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitff4207c6eb1813414c9e2d05ecccbac9', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);