Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare release version 2.0.6 #443

Merged
merged 11 commits into from
Oct 7, 2024
13 changes: 9 additions & 4 deletions includes/Admin/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,15 @@ public static function display_order_item_meta( $item_id, $item, $product ) {
return;
}
$keys = wcsn_get_keys(
array(
'order_id' => $order_id,
'product_id' => $product->get_id(),
'limit' => - 1,
apply_filters(
'wcsn_order_item_keys_query_args',
array(
'order_id' => $order_id,
'product_id' => $product->get_id(),
'limit' => - 1,
),
$item_id,
$order_id
)
);

Expand Down
50 changes: 25 additions & 25 deletions languages/wc-serial-numbers.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the GPL v2 or later.
msgid ""
msgstr ""
"Project-Id-Version: WC Serial Numbers 2.0.5\n"
"Project-Id-Version: WC Serial Numbers 2.0.6\n"
"Report-Msgid-Bugs-To: https://pluginever.com/support\n"
"POT-Creation-Date: 2024-09-26 06:08:46+00:00\n"
"POT-Creation-Date: 2024-10-07 09:04:45+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -53,42 +53,42 @@ msgstr ""
msgid "%d orders updated successfully."
msgstr ""

#: includes/Admin/Orders.php:228
#: includes/Admin/Orders.php:233
msgid "Serial keys sold with this product:"
msgstr ""

#: includes/Admin/Orders.php:233 src/Admin/ListTables/ActivationsTable.php:178
#: includes/Admin/Orders.php:238 src/Admin/ListTables/ActivationsTable.php:178
#: src/Admin/ListTables/KeysTable.php:349
#: src/Admin/views/html-api-actions.php:131
#: src/Admin/views/html-api-validation.php:134 src/Functions/Template.php:42
#: src/functions.php:1009
#: src/functions.php:1015
msgid "Key"
msgstr ""

#: includes/Admin/Orders.php:237
#: includes/Admin/Orders.php:242
msgid "Expire date"
msgstr ""

#: includes/Admin/Orders.php:238 src/Admin/ListTables/KeysTable.php:532
#: src/Functions/Template.php:63 src/functions.php:1030
#: includes/Admin/Orders.php:243 src/Admin/ListTables/KeysTable.php:532
#: src/Functions/Template.php:63 src/functions.php:1036
msgid "Lifetime"
msgstr ""

#: includes/Admin/Orders.php:241 src/Admin/views/html-edit-key.php:67
#: includes/Admin/Orders.php:246 src/Admin/views/html-edit-key.php:67
msgid "Activation limit"
msgstr ""

#: includes/Admin/Orders.php:242
#: includes/Admin/Orders.php:247
msgid "Unlimited"
msgstr ""

#: includes/Admin/Orders.php:245 src/Admin/ListTables/KeysTable.php:360
#: includes/Admin/Orders.php:250 src/Admin/ListTables/KeysTable.php:360
#: src/Admin/Menus.php:320 src/Admin/views/html-edit-key.php:92
#: src/Functions/Template.php:78 src/functions.php:1034
#: src/Functions/Template.php:78 src/functions.php:1040
msgid "Status"
msgstr ""

#: includes/Admin/Orders.php:272
#: includes/Admin/Orders.php:277
#. translators: %s is the item number.
msgid "View Details"
msgstr ""
Expand Down Expand Up @@ -1166,7 +1166,7 @@ msgid "Serial Number"
msgstr ""

#: src/Deprecated/Functions.php:361 src/Functions/Template.php:52
#: src/functions.php:1019
#: src/functions.php:1025
msgid "Activation Limit"
msgstr ""

Expand Down Expand Up @@ -1223,28 +1223,28 @@ msgstr ""
msgid "Invalid request."
msgstr ""

#: src/Functions/Template.php:47 src/functions.php:1014
#: src/Functions/Template.php:47 src/functions.php:1020
msgid "Activation Email"
msgstr ""

#: src/Functions/Template.php:53 src/Functions/Template.php:58
#: src/functions.php:1020 src/functions.php:1025
#: src/functions.php:1026 src/functions.php:1031
msgid "None"
msgstr ""

#: src/Functions/Template.php:57 src/functions.php:1024
#: src/Functions/Template.php:57 src/functions.php:1030
msgid "Activation Count"
msgstr ""

#: src/Functions/Template.php:62 src/functions.php:1029
#: src/Functions/Template.php:62 src/functions.php:1035
msgid "Expire Date"
msgstr ""

#: src/Functions/Template.php:70
msgid "Active"
msgstr ""

#: src/Functions/Template.php:305
#: src/Functions/Template.php:307
msgid "Order is waiting for serial numbers to be assigned."
msgstr ""

Expand All @@ -1265,23 +1265,23 @@ msgstr ""
msgid "Instance is required."
msgstr ""

#: src/Models/Key.php:484
#: src/Models/Key.php:509
msgid "Product id is required."
msgstr ""

#: src/Models/Key.php:489
#: src/Models/Key.php:514
msgid "Product id is invalid."
msgstr ""

#: src/Models/Key.php:494 src/RestAPI.php:148
#: src/Models/Key.php:519 src/RestAPI.php:148
msgid "Serial key is required."
msgstr ""

#: src/Models/Key.php:506
#: src/Models/Key.php:531
msgid "Serial key already exists. Duplicate serial keys are not allowed."
msgstr ""

#: src/Models/Key.php:512
#: src/Models/Key.php:537
msgid "Order id is invalid."
msgstr ""

Expand Down Expand Up @@ -1373,7 +1373,7 @@ msgstr ""
msgid "Manually added"
msgstr ""

#: src/functions.php:533
#: src/functions.php:539
#. translators: 1: product title 2: source and 3: Quantity
msgid ""
"There is not enough serial numbers for the product %1$s from selected "
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wc-serial-numbers",
"title": "WC Serial Numbers",
"version": "2.0.5",
"version": "2.0.6",
"description": "Sell and manage license keys/ serial numbers/ secret keys easily within your WooCommerce store.",
"homepage": "https://pluginever.com/plugins/woocommerce-serial-numbers-pro/",
"license": "GPL v2 or later",
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: license, license manager, serial number, serial key, woocommerce
Requires at least: 5.0
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 2.0.5
Stable tag: 2.0.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -251,6 +251,9 @@ Yes, you are always welcome to [provide suggestions](https://github.com/pluginev
9. Thank You Page with Keys

== Changelog ==
= 2.0.6 (07 Oct 2024) =
* Enhance: Update the Key Model to enable more precise key queries, enhancing performance and accuracy.

= 2.0.3 (12 Sep 2024) =
* Fix: Security issue.

Expand Down
4 changes: 3 additions & 1 deletion src/Functions/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ function wcsn_display_order_keys_table( $order, $line_items ) {
'product_id' => $line_item['product_id'],
'status__in' => array( 'sold', 'expired' ),
'limit' => - 1,
)
),
$line_item,
$order
);

$keys = wcsn_get_keys( $args );
Expand Down
25 changes: 25 additions & 0 deletions src/Models/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Key extends Model {
'activation_limit' => 0,
'activation_count' => 0,
'order_id' => 0,
'order_item_id' => 0,
'vendor_id' => 0,
'status' => 'available',
'validity' => 0,
Expand Down Expand Up @@ -287,6 +288,30 @@ public function set_order_id( $order_id ) {
$this->set_prop( 'order_id', absint( $order_id ) );
}

/**
* Get the order item id.
*
* @param string $context What the value is for. Valid values are 'view' and 'edit'.
*
* @since 2.0.6
* @return int
*/
public function get_order_item_id( $context = 'edit' ) {
return $this->get_prop( 'order_item_id', $context );
}

/**
* Set the order item id.
*
* @param int $order_item_id Order id.
*
* @since 2.0.6
* @return void
*/
public function set_order_item_id( $order_item_id ) {
$this->set_prop( 'order_item_id', absint( $order_item_id ) );
}

/**
* Get the vendor id.
*
Expand Down
14 changes: 10 additions & 4 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,18 @@ function wcsn_order_update_keys( $order_id ) {
}

$delivered_qty = Key::count(
array(
'order_id' => $order_id,
'product_id' => $item['product_id'],
'status__not_in' => array( 'cancelled' ),
apply_filters(
'wcsn_order_item_keys_count_args',
array(
'order_id' => $order_id,
'product_id' => $item['product_id'],
'status__not_in' => array( 'cancelled' ),
),
$item,
$order_id
)
);

if ( $item['refunded_qty'] >= $item['quantity'] ) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion wc-serial-numbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WC Serial Numbers
* Plugin URI: https://pluginever.com/plugins/wocommerce-serial-numbers-pro/
* Description: Sell and manage license keys/ serial numbers/ secret keys easily within your WooCommerce store.
* Version: 2.0.5
* Version: 2.0.6
* Requires at least: 5.0
* Requires PHP: 7.4
* Author: PluginEver
Expand Down
Loading