feat(admin): shipping list create, after-sale filters, order note/actions
Native pay ops UX: create shipping/after-sale from list pages with redirect branching, after-sale order/type filters and merchant actions, JSON-safe order admin notes, and complete/refund/close shortcuts.
This commit is contained in:
1 parent
8eb5c273ef
commit
7a1069f003
3 files changed
+412
-64
No files matched your search
@@ -232,6 +232,46 @@ class AKSRT_Order_Repository {
|
||||
/**
|
||||
* 更新订单状态(带状态机验证)
|
||||
*/
|
||||
/**
|
||||
* Merge operator admin note into order note meta without destroying JSON payload.
|
||||
*/
|
||||
public function update_admin_note(string $order_number, string $admin_note): bool {
|
||||
global $wpdb;
|
||||
|
||||
$order = $this->get($order_number);
|
||||
if (!$order) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$raw = isset($order['note']) && is_string($order['note']) ? $order['note'] : '';
|
||||
$decoded = $raw !== '' ? json_decode($raw, true) : null;
|
||||
$admin_note = sanitize_textarea_field($admin_note);
|
||||
|
||||
if (is_array($decoded)) {
|
||||
$decoded['admin_note'] = $admin_note;
|
||||
$new_note = wp_json_encode($decoded, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
} elseif ($raw !== '') {
|
||||
$new_note = wp_json_encode([
|
||||
'customer_note' => $raw,
|
||||
'admin_note' => $admin_note,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
} else {
|
||||
$new_note = wp_json_encode([
|
||||
'admin_note' => $admin_note,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
|
||||
$result = $wpdb->update(
|
||||
$this->table(),
|
||||
['note' => $new_note],
|
||||
['order_number' => $order_number],
|
||||
['%s'],
|
||||
['%s']
|
||||
);
|
||||
|
||||
return $result !== false;
|
||||
}
|
||||
|
||||
public function update_status(string $order_number, string $new_status, array $extra = []): bool {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
Reference in new issue
Block a user