Skip to content
Snippets Groups Projects
Commit 68f5e2aa authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Support for Bas Elbers' WooCommerce PDF Invoices (woocommerce-pdf-invoices) plugin

parent e768a4e3
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,8 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic { ...@@ -46,6 +46,8 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
$this->thirdparty_invoicenumber_init(); $this->thirdparty_invoicenumber_init();
// Support for specific plugins: // Support for specific plugins:
$this->thirdparty_wpo_wcpdf_init(); $this->thirdparty_wpo_wcpdf_init();
$this->thirdparty_bewpi_invoices_init();
// END THIRD-PARTY PLUGIN SUPPORT
} }
...@@ -406,4 +408,48 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic { ...@@ -406,4 +408,48 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
} }
} }
/** ************************************************************
* 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 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....
*/
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 (get_option('customize_invoice', 'no')!='no') {
// 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>.' );
}
}
// END THIRD-PARTY PLUGIN SUPPORT
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment