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

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
No related branches found
No related tags found
No related merge requests found
BASE=ordernumbers
PLATTFORM=woocommerce
VENDOR=opentools
VERSION=1.3.5
VERSION=1.3.6
DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn
......
......@@ -9,7 +9,7 @@ var showUpdateCredentialsRow = function (btn) {
type: "POST",
url: ajaxurl,
data: {
action: 'getUpdateCredentialsRow',
action: 'getUpdateCredentialsRow_'+slug,
slug: slug,
_ajax_nonce: nonce
},
......@@ -32,7 +32,7 @@ var submitUpdateCredentials = function(btn) {
var tr = jQuery(btn).closest('tr');
var data = {
action: 'submitUpdateCredentials',
action: 'submitUpdateCredentials_'+slug,
slug: slug,
_ajax_nonce: nonce,
};
......
......@@ -42,8 +42,8 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
// add_filter('plugin_row_meta', 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_submitUpdateCredentials', array( &$this, 'submitUpdateCredentials') );
add_action( 'wp_ajax_getUpdateCredentialsRow_'.$this->slug, array( &$this, 'getUpdateCredentialsRow') );
add_action( 'wp_ajax_submitUpdateCredentials_'.$this->slug, array( &$this, 'submitUpdateCredentials') );
}
protected function getCredentials($slug)
......@@ -123,13 +123,26 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
*/
public function getUpdateCredentialsRow() {
$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'])
&& $_REQUEST['slug'] == $this->slug
&& current_user_can('update_plugins')
&& check_ajax_referer('otup_enter_update_credentials');
$showCredentials = $showCredentials && !empty($this->credvars);
&& check_ajax_referer('otup_enter_update_credentials')
&& !empty($this->credvars);
if ( $showCredentials && (is_network_admin() || !is_multisite() )) {
$slug = $this->slug;
if ( is_network_admin() ) {
......@@ -175,10 +188,15 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
* @return void
*/
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);
$slug = isset($_REQUEST['slug'])?($_REQUEST['slug']):"INVALIDSLUG";
$submitCredentials = $slug == $this->slug
$submitCredentials = ($slug == $this->slug)
&& current_user_can('update_plugins')
&& check_ajax_referer('otup_enter_update_credentials_'.$slug);
$submitCredentials = $submitCredentials && !empty($this->credvars);
......
......@@ -510,7 +510,7 @@ class OpenToolsOrdernumbersBasic {
return $stored_number;
} else {
// 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
Tags: WooCommerce, Order numbers, orders
Requires at least: 4.0
Tested up to: 4.5
Stable tag: 1.3.5
Stable tag: 1.3.6
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl.html
......@@ -78,6 +78,9 @@ The Advanced Ordernumbers for WooCommerce plugin supports some invoicing plugins
== Changelog ==
= 1.3.6 =
* Fix order number display for old orders
= 1.3.5 =
* Added variables [MonthName], [MonthName3], [Week], [WeekNumberYear], [DayOfYear], [Weekday], [WeekdayName], [WeekdayName3] (advanced version only)
......
File added
File added
......@@ -3,7 +3,7 @@
* Plugin Name: Woocommerce Advanced Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Lets the user freely configure the order numbers in WooCommerce.
* Version: 1.3.5
* Version: 1.3.6
* Author: Open Tools
* Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers
......
......@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Basic Ordernumbers
* 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).
* Version: 1.3.5
* Version: 1.3.6
* Author: Open Tools
* Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment