Skip to content

Commit

Permalink
Merge pull request #225 from kaolengmian7/fix/30350
Browse files Browse the repository at this point in the history
[CNT30350]兼容旧版本行内多个tracking
  • Loading branch information
kaolengmian7 authored Aug 13, 2024
2 parents 81dc7f3 + 7ce233d commit a96ab3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/frontendv2/dist/metabox/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ export default function EditTrackingModal(props: Props) {
if (tracking.tracking_number.length > 256) {
return { isValid: false, errors: 'Tracking number invalid' };
}
if (tracking.tracking_number.includes(',')) {
return { isValid: false, errors: 'Tracking number invalid' };
}

// check if tracking number has already been added by other fulfillments
let exist = otherFulfillmentsTrackings().get(tracking.slug + tracking.tracking_number);
Expand Down
16 changes: 9 additions & 7 deletions includes/class-aftership-fulfillment.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,17 @@ public function trackings_to_fulfillments($trackings)
$f['from_tracking'] = true;

// trackings to fulfillment trackings
$tracking_numbers = explode(',', $tracking['tracking_number']);
$t_arr = [];
$t_arr[] = [
'tracking_id' => safeArrayGet($tracking, 'tracking_id', ''),
'tracking_number'=> safeArrayGet($tracking, 'tracking_number', ''),
'slug' => safeArrayGet($tracking, 'slug', ''),
'additional_fields' => safeArrayGet($tracking, 'additional_fields', []),
];
foreach ($tracking_numbers as $tracking_number) {
$t_arr[] = [
'tracking_id' => safeArrayGet($tracking, 'tracking_id', ''),
'tracking_number'=> $tracking_number,
'slug' => safeArrayGet($tracking, 'slug', ''),
'additional_fields' => safeArrayGet($tracking, 'additional_fields', []),
];
}
$f['trackings'] = $t_arr;

$fulfillments[] = $f;
}
return $fulfillments;
Expand Down

0 comments on commit a96ab3a

Please sign in to comment.