-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Generate Release Notes | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- run: npm install [email protected] -g | ||
- name: Write PreRelease Notes | ||
env: | ||
GREN_GITHUB_TOKEN: ${{ secrets.ACTIONS }} | ||
GITHUB_EVENT_REF: ${{ github.event.ref }} | ||
run: | | ||
tagname="${GITHUB_EVENT_REF/refs\/tags\//}" | ||
gren release --override -d --tags=$tagname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Deploy to WordPress.org | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
build: | ||
if: "!github.event.release.prerelease" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: git config --system --add safe.directory /github/workspace | ||
- name: WordPress Plugin Deploy | ||
uses: 10up/action-wordpress-plugin-deploy@master | ||
env: | ||
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | ||
SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | ||
SLUG: wc-rearrange-order-items | ||
ASSETS_DIR: assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
function getAuthor(placeholders) { | ||
if (placeholders.author === 'ole1986') { | ||
// skip owner | ||
return ''; | ||
} | ||
|
||
if (placeholders.author === null) { | ||
// skip when no author could be found | ||
return ''; | ||
} | ||
|
||
return `- @${placeholders.author}`; | ||
} | ||
|
||
function parseCommitLine(placeholders) { | ||
return `- ${placeholders.message} ${getAuthor(placeholders)}` | ||
} | ||
|
||
module.exports = { | ||
dataSource: "commits", | ||
"template": { | ||
commit: parseCommitLine | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<?php | ||
/* | ||
* Plugin Name: WC Rearrange Order Items | ||
* Plugin Name: Rearrange Order Items for WooCommerce | ||
* Description: Rearrange Woocommerce Order Item from admin backend | ||
* Version: 1.0.0 | ||
* Version: 1.0.4 | ||
* Author: ole1986 <[email protected]> | ||
* Author URI: https://github.com/ole1986/wc-orderitem-rearrange | ||
* Plugin URI: https://github.com/ole1986/wc-orderitem-rearrange/releases | ||
* Text Domain: wc-orderitem-rearrange | ||
* | ||
* WC requires at least: 3.0.0 | ||
* WC tested up to: 7.0 | ||
* WC tested up to: 7.5 | ||
*/ | ||
|
||
namespace Ole1986\WcOrderItemRearrange; | ||
|
@@ -44,9 +44,8 @@ public function DoAjax() | |
$item_id = intval($_POST['item_id']); | ||
$direction = intval($_POST['direction']); | ||
|
||
if (empty($item_id)) { | ||
wp_die(); | ||
} | ||
if (empty($item_id)) wp_die(); | ||
if (is_null($direction)) wp_die(); | ||
|
||
$orderItem = new \WC_Order_Item_Product($item_id); | ||
$order = wc_get_order($orderItem->get_order_id()); | ||
|
@@ -59,12 +58,12 @@ public function DoAjax() | |
|
||
if (!$swap_id) return; | ||
|
||
$results = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE order_item_id IN({$item_id}, {$swap_id})", OBJECT); | ||
$results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE order_item_id = %d OR order_item_id = %d", $item_id, $swap_id), OBJECT); | ||
$meta_ids = array_column($results, 'meta_id'); | ||
|
||
$wpdb->query("UPDATE {$wpdb->prefix}woocommerce_order_itemmeta SET order_item_id = IF(order_item_id = {$item_id}, {$swap_id}, {$item_id}) WHERE meta_id IN (" . implode(',', $meta_ids) . ")"); | ||
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}woocommerce_order_itemmeta SET order_item_id = IF(order_item_id = %d, %d, %d) WHERE meta_id IN (" . implode(',', $meta_ids) . ")", $item_id, $swap_id, $item_id)); | ||
|
||
$results = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id IN({$item_id}, {$swap_id})", OBJECT); | ||
$results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id = %d OR order_item_id = %d", $item_id, $swap_id), OBJECT); | ||
$resultIds = array_column($results, 'order_item_id'); | ||
|
||
foreach ($results as $item) { | ||
|
@@ -79,8 +78,8 @@ public function add_item_mover($item_id, $item, $product) | |
$css = 'font-size:1.2em; margin-right: 0.5em; padding: 0.2em; text-decoration:none'; | ||
?> | ||
<div style="margin-top: 1em;"> | ||
<a href="javascript:void(0)" style="<?php echo $css ?>" onclick="WcOrderItemRearrange.MoveOrderItem(this, <?php echo $item_id ?>, 0)">⇧</span></a> | ||
<a href="javascript:void(0)" style="<?php echo $css ?>" onclick="WcOrderItemRearrange.MoveOrderItem(this, <?php echo $item_id ?>, 1)">⇩</span></a> | ||
<a href="javascript:void(0)" style="<?php echo esc_attr($css) ?>" onclick="WcOrderItemRearrange.MoveOrderItem(this, <?php echo esc_attr($item_id) ?>, 0)">⇧</span></a> | ||
<a href="javascript:void(0)" style="<?php echo esc_attr($css) ?>" onclick="WcOrderItemRearrange.MoveOrderItem(this, <?php echo esc_attr($item_id) ?>, 1)">⇩</span></a> | ||
</div> | ||
<?php | ||
} | ||
|