Commit f2869cd7 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

Support for almost all third-party invoice plugins (patches ready to be...

Support for almost all third-party invoice plugins (patches ready to be submitted to the respective authors, this plugin needs hardly any change)
parent 0a5da15b
......@@ -46,7 +46,10 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
$this->thirdparty_invoicenumber_init();
// Support for specific plugins:
$this->thirdparty_wpo_wcpdf_init();
$this->thirdparty_wt_wc_pdf_invoice_init();
$this->thirdparty_bewpi_invoices_init();
$this->thirdparty_yith_pdf_invoice_init();
$this->thirdparty_wc_delivery_notes_init();
// END THIRD-PARTY PLUGIN SUPPORT
}
......@@ -410,47 +413,59 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
}
/** ************************************************************
* Support for WooCommerce PDF Invoice (woocommerce-pdf-invoice) by WooThemes
** ************************************************************
*/
protected function thirdparty_wt_wc_pdf_invoice_init() {
// Patch by OpenTools implements the generic interface, so nothing special needs to be done
}
/** ************************************************************
* Support for WooCommerce PDF Invoices (woocommerce-pdf-invoices) by Bas Elbers
** ************************************************************
*
* - Patch by OpenTools implements the generic interface, so nothing special needs to be done
*/
protected function thirdparty_bewpi_invoices_init() {
// Add an explanation to the invoice number section on how to enable invoice numbers through our plugin...
add_action ('woocommerce_page_bewpi-invoices', array($this, 'thirdparty_bewpi_remove_options'));
// The plugin has code itself to hide the counter settings when a third-party plugin is enabled
// Patch by OpenTools implements the generic interface, so nothing special needs to be done
}
/**
* The action that is called for Bas Elbers' WooCommerce PDF Invoices plugin only, when the options page is loaded.
* If this plugin is enabled and invoice numbers are configured, we simply remove all invoice number-specific
* settings, because this plugin will be responsible....
/** ************************************************************
* Support for YITH WooCommerce PDF Invoice (yith-woocommerce-pdf-invoice)
** ************************************************************
*/
function thirdparty_bewpi_remove_options() {
// TODO: Modify the invoice number section text to hint at the installed order number plugin and how to enable it!
global $wp_settings_fields;
return;
if ($this->invoicenumbers_activated()) {
// bewpi_template_settings -> invoice_number ->
// -) bewpi_invoice_number_type
// -) bewpi_reset_counter
// -) bewpi_next_invoice_number
// -) bewpi_invoice_number_digits
// -) bewpi_invoice_number_prefix
// -) bewpi_invoice_number_suffix
// -) bewpi_invoice_number_format
// -) bewpi_reset_counter_yearly
// $wp_settings_fields['bewpi_template_settings']['invoice_number']['display_number']['title'] = $this->helper->__('Display invoice number');
// $wp_settings_fields['bewpi_template_settings']['invoice_number']['display_number']['args']['description'] = $this->helper->__('The <a href="admin.php?page=wc-settings&tab=checkout&section=ordernumber">Open Tools Ordernumber plugin</a> has invoice numbers enabled and will generate invoice numbers for this plugin.' );
// unset($wp_settings_fields['bewpi_template_settings']['invoice_number']['next_invoice_number']);
// unset($wp_settings_fields['bewpi_template_settings']['invoice_number']['invoice_number_formatting']);
} else {
// $wp_settings_fields['bewpi_template_settings']['invoice_number']['display_number']['args']['description'] = $this->helper->__('To let the Open Tools ordernumber plugin create invoice numbers with your desired format, please enable invoices in <a href="admin.php?page=wc-settings&tab=checkout&section=ordernumber">that plugin\'s configuration page</a>.' );
protected function thirdparty_yith_pdf_invoice_init() {
// Patch by OpenTools implements the generic interface, so nothing special needs to be done
}
/** ************************************************************
* Support for WooCommerce Print Invoice and Delivery Notes (woocommerce-delivery-notes) by Triggvy Gunderson
** ************************************************************
*
* - Patch has been sent to the author to implement generic invoice number filters
* - Removing the invoice numbering options and adding a link to this
* plugin's configuration has to be coded in the other plugin, because
* it does not use the WP options API...
*/
/**
* Initialize support for WooCommerce Print Invoice and Delivery Notes
*/
protected function thirdparty_wc_delivery_notes_init() {
// Patch by OpenTools implements the generic interface, so nothing special needs to be done
}
// END THIRD-PARTY PLUGIN SUPPORT
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment