Commit 812a2bbd authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

Clean up function arguments (default vs. order ID in general)

parent f2869cd7
...@@ -444,28 +444,15 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic { ...@@ -444,28 +444,15 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
// Patch by OpenTools implements the generic interface, so nothing special needs to be done // 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 * 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() { protected function thirdparty_wc_delivery_notes_init() {
// Patch by OpenTools implements the generic interface, so nothing special needs to be done // Patch by OpenTools implements the generic interface, so nothing special needs to be done
} }
// END THIRD-PARTY PLUGIN SUPPORT // END THIRD-PARTY PLUGIN SUPPORT
} }
...@@ -426,7 +426,7 @@ class OpenToolsOrdernumbersBasic { ...@@ -426,7 +426,7 @@ class OpenToolsOrdernumbersBasic {
// $reps["[year2]"] = date ("y", $utime); // $reps["[year2]"] = date ("y", $utime);
} }
function generateNumber($orderid, $order, $type='ordernumber') { function generateNumber($default, $order, $type='ordernumber') {
if ($this->numbers_activated($type)) { if ($this->numbers_activated($type)) {
$fmt = get_option ($type.'_format', "#"); $fmt = get_option ($type.'_format', "#");
$ctrsettings = array( $ctrsettings = array(
...@@ -440,10 +440,10 @@ class OpenToolsOrdernumbersBasic { ...@@ -440,10 +440,10 @@ class OpenToolsOrdernumbersBasic {
$customvars = get_option ('ordernumber_variables', array()); $customvars = get_option ('ordernumber_variables', array());
$number = $this->helper->createNumber ($fmt, $type, $order, $customvars, $ctrsettings); $number = $this->helper->createNumber ($fmt, $type, $order, $customvars, $ctrsettings);
update_post_meta( $orderid, $this->ordernumber_meta.$type, $number ); update_post_meta( $order->id, $this->ordernumber_meta.$type, $number );
return $number; return $number;
} else { } else {
return $orderid; return $default;
} }
} }
...@@ -468,12 +468,12 @@ class OpenToolsOrdernumbersBasic { ...@@ -468,12 +468,12 @@ class OpenToolsOrdernumbersBasic {
return $number; return $number;
} }
function get_or_create_number($orderid, $order, $type = 'ordernumber') { function get_or_create_number($default, $order, $type = 'ordernumber') {
$stored_number = get_post_meta( $orderid, $this->ordernumber_meta.$type, true); $stored_number = get_post_meta( $order->id, $this->ordernumber_meta.$type, true);
if (!empty($stored_number)) { if (!empty($stored_number)) {
return $stored_number; return $stored_number;
} else { } else {
return $this->generateNumber($orderid, $order, $type); return $this->generateNumber($order->id, $order, $type);
} }
} }
......
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