Commit 9d26cb88 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

V1.3.6: Fix order numbers for old orders; Fix JS for update credentials to...

V1.3.6: Fix order numbers for old orders; Fix JS for update credentials to include the slug and thus work when two OpenTools plugins are installed
parent c733080a
BASE=ordernumbers BASE=ordernumbers
PLATTFORM=woocommerce PLATTFORM=woocommerce
VENDOR=opentools VENDOR=opentools
VERSION=1.3.5 VERSION=1.3.6
DIR = $(shell pwd) DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn SVNDIR=wordpress-plugin-svn
......
...@@ -9,7 +9,7 @@ var showUpdateCredentialsRow = function (btn) { ...@@ -9,7 +9,7 @@ var showUpdateCredentialsRow = function (btn) {
type: "POST", type: "POST",
url: ajaxurl, url: ajaxurl,
data: { data: {
action: 'getUpdateCredentialsRow', action: 'getUpdateCredentialsRow_'+slug,
slug: slug, slug: slug,
_ajax_nonce: nonce _ajax_nonce: nonce
}, },
...@@ -32,7 +32,7 @@ var submitUpdateCredentials = function(btn) { ...@@ -32,7 +32,7 @@ var submitUpdateCredentials = function(btn) {
var tr = jQuery(btn).closest('tr'); var tr = jQuery(btn).closest('tr');
var data = { var data = {
action: 'submitUpdateCredentials', action: 'submitUpdateCredentials_'+slug,
slug: slug, slug: slug,
_ajax_nonce: nonce, _ajax_nonce: nonce,
}; };
......
...@@ -42,8 +42,8 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 { ...@@ -42,8 +42,8 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
// add_filter('plugin_row_meta', array($this, 'displayUpdateCredentialsLink'), 9, 2); // add_filter('plugin_row_meta', array($this, 'displayUpdateCredentialsLink'), 9, 2);
add_filter('plugin_action_links_'.$this->pluginFile, array($this, 'displayUpdateCredentialsLink'), 9, 2); add_filter('plugin_action_links_'.$this->pluginFile, array($this, 'displayUpdateCredentialsLink'), 9, 2);
add_action( 'wp_ajax_getUpdateCredentialsRow', array( &$this, 'getUpdateCredentialsRow') ); add_action( 'wp_ajax_getUpdateCredentialsRow_'.$this->slug, array( &$this, 'getUpdateCredentialsRow') );
add_action( 'wp_ajax_submitUpdateCredentials', array( &$this, 'submitUpdateCredentials') ); add_action( 'wp_ajax_submitUpdateCredentials_'.$this->slug, array( &$this, 'submitUpdateCredentials') );
} }
protected function getCredentials($slug) protected function getCredentials($slug)
...@@ -123,12 +123,25 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 { ...@@ -123,12 +123,25 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
*/ */
public function getUpdateCredentialsRow() { public function getUpdateCredentialsRow() {
$json = array('row' => '', 'message'=>'Unsuccessful'); $json = array('row' => '', 'message'=>'Unsuccessful');
if (isset($_REQUEST['slug']) && $_REQUEST['slug'] != $this->slug) {
// This update checker is not responsible. Action is for another plugin
return;
}
$json['showCredentials'] = $showCredentials;
$json['issetSLUG'] = isset($_REQUEST['slug']);
$json['SLUGmatches'] = $_REQUEST['slug'] == $this->slug;
$json['userCanUpdatePlugins'] = current_user_can('update_plugins');
$json['checkAjax'] = check_ajax_referer('otup_enter_update_credentials');
$json['NotEmptyCredVars'] = !empty($this->credvars);
$json['IsNetworkAdmin'] = is_network_admin();
$json['isMultisite'] = is_multisite();
$showCredentials = isset($_REQUEST['slug']) $showCredentials = isset($_REQUEST['slug'])
&& $_REQUEST['slug'] == $this->slug && $_REQUEST['slug'] == $this->slug
&& current_user_can('update_plugins') && current_user_can('update_plugins')
&& check_ajax_referer('otup_enter_update_credentials'); && check_ajax_referer('otup_enter_update_credentials')
$showCredentials = $showCredentials && !empty($this->credvars); && !empty($this->credvars);
if ( $showCredentials && (is_network_admin() || !is_multisite() )) { if ( $showCredentials && (is_network_admin() || !is_multisite() )) {
$slug = $this->slug; $slug = $this->slug;
...@@ -175,10 +188,15 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 { ...@@ -175,10 +188,15 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
* @return void * @return void
*/ */
public function submitUpdateCredentials() { public function submitUpdateCredentials() {
if (isset($_REQUEST['slug']) && $_REQUEST['slug'] != $this->slug) {
// This update checker is not responsible. Action is for another plugin
return;
}
$json = array('message' => '', 'success' => FALSE); $json = array('message' => '', 'success' => FALSE);
$slug = isset($_REQUEST['slug'])?($_REQUEST['slug']):"INVALIDSLUG"; $slug = isset($_REQUEST['slug'])?($_REQUEST['slug']):"INVALIDSLUG";
$submitCredentials = $slug == $this->slug $submitCredentials = ($slug == $this->slug)
&& current_user_can('update_plugins') && current_user_can('update_plugins')
&& check_ajax_referer('otup_enter_update_credentials_'.$slug); && check_ajax_referer('otup_enter_update_credentials_'.$slug);
$submitCredentials = $submitCredentials && !empty($this->credvars); $submitCredentials = $submitCredentials && !empty($this->credvars);
......
...@@ -510,7 +510,7 @@ class OpenToolsOrdernumbersBasic { ...@@ -510,7 +510,7 @@ class OpenToolsOrdernumbersBasic {
return $stored_number; return $stored_number;
} else { } else {
// No order number was created for this order, so simply use the orderid as default. // No order number was created for this order, so simply use the orderid as default.
return $default; return $orderid;
} }
} }
......
...@@ -4,7 +4,7 @@ Contributors: opentools ...@@ -4,7 +4,7 @@ Contributors: opentools
Tags: WooCommerce, Order numbers, orders Tags: WooCommerce, Order numbers, orders
Requires at least: 4.0 Requires at least: 4.0
Tested up to: 4.5 Tested up to: 4.5
Stable tag: 1.3.5 Stable tag: 1.3.6
License: GPLv3 or later License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl.html License URI: http://www.gnu.org/licenses/gpl.html
...@@ -78,6 +78,9 @@ The Advanced Ordernumbers for WooCommerce plugin supports some invoicing plugins ...@@ -78,6 +78,9 @@ The Advanced Ordernumbers for WooCommerce plugin supports some invoicing plugins
== Changelog == == Changelog ==
= 1.3.6 =
* Fix order number display for old orders
= 1.3.5 = = 1.3.5 =
* Added variables [MonthName], [MonthName3], [Week], [WeekNumberYear], [DayOfYear], [Weekday], [WeekdayName], [WeekdayName3] (advanced version only) * Added variables [MonthName], [MonthName3], [Week], [WeekNumberYear], [DayOfYear], [Weekday], [WeekdayName], [WeekdayName3] (advanced version only)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: Woocommerce Advanced Ordernumbers * Plugin Name: Woocommerce Advanced Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html * Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Lets the user freely configure the order numbers in WooCommerce. * Description: Lets the user freely configure the order numbers in WooCommerce.
* Version: 1.3.5 * Version: 1.3.6
* Author: Open Tools * Author: Open Tools
* Author URI: http://open-tools.net * Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers * Text Domain: woocommerce-advanced-ordernumbers
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Basic Ordernumbers * Plugin Name: WooCommerce Basic Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html * Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Configure WooCommerce ordernumbers to have a running counter and arbitrary, fixed text (prefix / postfix). * Description: Configure WooCommerce ordernumbers to have a running counter and arbitrary, fixed text (prefix / postfix).
* Version: 1.3.5 * Version: 1.3.6
* Author: Open Tools * Author: Open Tools
* Author URI: http://open-tools.net * Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers * Text Domain: woocommerce-advanced-ordernumbers
......
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