Skip to content

Commit

Permalink
Preparing release v1.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
sultann committed Apr 8, 2023
1 parent 0a966ba commit d0d00eb
Show file tree
Hide file tree
Showing 11 changed files with 424 additions and 129 deletions.
61 changes: 39 additions & 22 deletions languages/wc-serial-numbers.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Serial Numbers for WooCommerce 1.4.8\n"
"Report-Msgid-Bugs-To: https://pluginever.com/plugins/wc-serial-numbers/\n"
"POT-Creation-Date: 2023-04-06 13:39:13+00:00\n"
"POT-Creation-Date: 2023-04-07 18:46:44+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 @@ -303,8 +303,8 @@ msgstr ""

#: src/Admin/Admin.php:101 src/Admin/Menus.php:57 src/Admin/Menus.php:98
#: src/Admin/Menus.php:99 src/Admin/Menus.php:434 src/Admin/Metaboxes.php:36
#: src/Admin/Metaboxes.php:45 src/Admin/Metaboxes.php:226
#: src/Deprecated/Functions.php:424
#: src/Admin/Metaboxes.php:45 src/Admin/Metaboxes.php:227
#: src/Functions/Template.php:219 templates/order-keys.php:16
msgid "Serial Numbers"
msgstr ""

Expand Down Expand Up @@ -353,7 +353,7 @@ msgstr ""
#: src/Admin/ListTables/ActivationsTable.php:191
#: src/Admin/ListTables/KeysTable.php:309
#: src/Admin/Views/html-api-actions.php:117
#: src/Admin/Views/html-api-validation.php:121
#: src/Admin/Views/html-api-validation.php:121 src/Functions/Template.php:42
msgid "Key"
msgstr ""

Expand Down Expand Up @@ -414,7 +414,8 @@ msgid "This means the key has been sold, and the order has been completed."
msgstr ""

#: src/Admin/ListTables/KeysTable.php:192
#: src/Admin/ListTables/KeysTable.php:225 src/functions.php:49
#: src/Admin/ListTables/KeysTable.php:225 src/Functions/Template.php:72
#: src/functions.php:49
msgid "Expired"
msgstr ""

Expand Down Expand Up @@ -474,7 +475,7 @@ msgid "Order Date"
msgstr ""

#: src/Admin/ListTables/KeysTable.php:320 src/Admin/Menus.php:322
#: src/Admin/Views/html-edit-key.php:113
#: src/Admin/Views/html-edit-key.php:113 src/Functions/Template.php:78
msgid "Status"
msgstr ""

Expand All @@ -483,7 +484,7 @@ msgid "ID: %d"
msgstr ""

#: src/Admin/ListTables/KeysTable.php:380
#: src/Admin/ListTables/StockTable.php:185 src/Admin/Metaboxes.php:339
#: src/Admin/ListTables/StockTable.php:185 src/Admin/Metaboxes.php:334
msgid "Edit"
msgstr ""

Expand All @@ -493,8 +494,8 @@ msgid_plural "<b>%s</b> Days <br><small>After purchase</small>"
msgstr[0] ""
msgstr[1] ""

#: src/Admin/ListTables/KeysTable.php:471 src/Admin/Metaboxes.php:326
#: src/Deprecated/Functions.php:472
#: src/Admin/ListTables/KeysTable.php:471 src/Admin/Metaboxes.php:321
#: src/Functions/Template.php:63
msgid "Lifetime"
msgstr ""

Expand Down Expand Up @@ -674,35 +675,31 @@ msgid ""
"order and many more?"
msgstr ""

#: src/Admin/Metaboxes.php:130 src/Admin/Metaboxes.php:149
#: src/Admin/Metaboxes.php:130 src/Admin/Metaboxes.php:150
msgid "Upgrade to Pro"
msgstr ""

#: src/Admin/Metaboxes.php:149
#: src/Admin/Metaboxes.php:150
msgid "WooCommerce Serial Number Free version does not support product variation."
msgstr ""

#: src/Admin/Metaboxes.php:217
#: src/Admin/Metaboxes.php:218
msgid "Order missing serial numbers for this item."
msgstr ""

#: src/Admin/Metaboxes.php:264
msgid "Order status is not completed."
msgstr ""

#: src/Admin/Metaboxes.php:271
#: src/Admin/Metaboxes.php:266
msgid "No serial keys associated with the order."
msgstr ""

#: src/Admin/Metaboxes.php:281
#: src/Admin/Metaboxes.php:276
msgid "Order waiting for assigning serial keys."
msgstr ""

#: src/Admin/Metaboxes.php:298
#: src/Admin/Metaboxes.php:293
msgid "Actions"
msgstr ""

#: src/Admin/Metaboxes.php:319 src/Deprecated/Functions.php:465
#: src/Admin/Metaboxes.php:314
msgid "Unlimited"
msgstr ""

Expand Down Expand Up @@ -1288,15 +1285,35 @@ msgstr ""
msgid "Serial Number"
msgstr ""

#: src/Deprecated/Functions.php:362
#: src/Deprecated/Functions.php:362 src/Functions/Template.php:52
msgid "Activation Limit"
msgstr ""

#: src/Deprecated/Functions.php:363
msgid "Expires"
msgstr ""

#: src/Deprecated/Functions.php:426
#: src/Functions/Template.php:47
msgid "Activation Email"
msgstr ""

#: src/Functions/Template.php:53 src/Functions/Template.php:58
msgid "None"
msgstr ""

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

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

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

#: src/Functions/Template.php:297 templates/order-key.php:31
msgid "Order is waiting for serial numbers to be assigned."
msgstr ""

Expand Down
1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<exclude-pattern>assets/</exclude-pattern>
<exclude-pattern>dist/</exclude-pattern>
<exclude-pattern>bin/</exclude-pattern>
<exclude-pattern>includes/</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*\.(css|js|xml)</exclude-pattern>
Expand Down
3 changes: 2 additions & 1 deletion src/Admin/ListTables/KeysTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ public function prepare_items() {
'include' => $id,
'search' => $search,
);

//var_dump( Key::count( array_merge( $args, [ 'status' => 'sold' ] ) ));
$this->items = Key::query( $args );
$this->available_count = Key::count( array_merge( $args, [ 'status' => 'available' ] ) );
$this->pending_count = Key::count( array_merge( $args, [ 'status' => 'pending' ] ) );
$this->sold_count = Key::count( array_merge( $args, [ 'status' => 'sold' ] ) );
$this->expired_count = Key::count( array_merge( $args, [ 'status' => 'expired' ] ) );
$this->cancelled_count = Key::count( array_merge( $args, [ 'status' => 'cancelled' ] ) );
$this->total_count = array_sum( [ $this->available_count, $this->sold_count, $this->pending_count, $this->expired_count, $this->cancelled_count ] );

switch ( $status ) {
case 'available':
$total_items = $this->available_count;
Expand Down
1 change: 1 addition & 0 deletions src/Admin/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ public static function print_style() {
ob_get_clean();
echo $style;
}

}
4 changes: 0 additions & 4 deletions src/Admin/Views/html-list-stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@
<input type="hidden" name="tab" value="stock">
<input type="hidden" name="page" value="wc-serial-numbers-reports">
</form>
<p class="description">
<strong><?php esc_html_e( 'Note:', 'wc-serial-numbers' ); ?></strong>
<?php esc_html_e( 'The following report displays a comprehensive list of products whose source for serial keys has been set to "Manually Added.".', 'wc-serial-numbers' ); ?>
</p>
94 changes: 1 addition & 93 deletions src/Deprecated/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ function wc_serial_numbers_get_stock_quantity( $product_id ) {
return 9999;
}


/**
* Get order table.
*
Expand All @@ -402,98 +401,7 @@ function wc_serial_numbers_get_stock_quantity( $product_id ) {
* @return false|string|void
*/
function wc_serial_numbers_get_order_table( $order, $return = false ) {
$order_id = $order->get_id();
if ( 'completed' !== $order->get_status( 'edit' ) ) {
return;
}

// no serial numbers ordered so bail @since 1.2.1
$total_ordered_serial_numbers = wcsn_order_has_products( $order );

if ( empty( $total_ordered_serial_numbers ) ) {
return;
}

$serial_numbers = wcsn_get_keys(
array(
'order_id' => $order_id,
'limit' => - 1,
)
);

echo sprintf( '<h2 class="woocommerce-order-downloads__title">%s</h2>', apply_filters( 'wc_serial_numbers_order_table_heading', esc_html__( 'Serial Numbers', 'wc-serial-numbers' ) ) );
if ( empty( $serial_numbers ) ) {
echo sprintf( '<p>%s</p>', apply_filters( 'wc_serial_numbers_pending_notice', __( 'Order is waiting for serial numbers to be assigned.', 'wc-serial-numbers' ) ) );

return;
}

ob_start();
$columns = wc_serial_numbers_get_order_table_columns();
?>
<table
class="woocommerce-table woocommerce-table--order-details shop_table order_details wc-serial-numbers-order-items"
style="width: 100%; margin-bottom: 40px;"
cellspacing="0" cellpadding="6" border="1">
<thead>
<tr>
<?php
foreach ( $columns as $key => $label ) {
echo sprintf( '<th class="td %s" scope="col" style="text-align:left;">%s</th>', sanitize_html_class( $key ), $label );
}
?>
</tr>
</thead>
<tbody>
<?php
foreach ( $serial_numbers as $serial_number ) {
echo '<tr>';
foreach ( $columns as $key => $label ) {
echo '<td class="td" style="text-align:left;">';
switch ( $key ) {
case 'product':
echo sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $serial_number->product_id ) ), get_the_title( $serial_number->product_id ) );
break;
case 'serial_key':
echo esc_html( $serial_number->serial_key );
break;
case 'activation_email':
echo $order->get_billing_email();
break;
case 'activation_limit':
if ( empty( $serial_number->activation_limit ) ) {
echo __( 'Unlimited', 'wc-serial-numbers' );
} else {
echo esc_html( $serial_number->activation_limit );
}
break;
case 'expire_date':
if ( empty( $serial_number->validity ) ) {
echo __( 'Lifetime', 'wc-serial-numbers' );
} else {
echo date( 'Y-m-d', strtotime( $serial_number->order_date . ' + ' . $serial_number->validity . ' Day ' ) );
}
break;

default:
do_action( 'wc_serial_numbers_order_table_cell_content', $key, $serial_number, $order_id );
}
echo '</td>';
}
echo '</tr>';
}
?>

</tbody>
</table>
<?php
$output = ob_get_contents();
ob_get_clean();
if ( $return ) {
return $output;
}

echo $output;
wcsn_display_order_keys( $order, $return );
}

/**
Expand Down
24 changes: 24 additions & 0 deletions src/Frontend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace WooCommerceSerialNumbers;

defined( 'ABSPATH' ) || exit;

/**
* Class Frontend.
*
* @since 1.0.0
* @package WooCommerceSerialNumbers
*/
class Frontend extends Lib\Singleton {

/**
* Frontend constructor.
*
* @since 1.0.0
*/
protected function __construct() {
add_action( 'wc_serial_numbers_before_display_order_keys', 'wcsn_display_order_keys_title', 10, 2 );
add_action( 'wc_serial_numbers_display_order_keys', 'wcsn_display_order_keys_table', 10, 2 );
}
}
Loading

0 comments on commit d0d00eb

Please sign in to comment.