Skip to content

Commit

Permalink
Merge branch '4.x' into 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Sep 11, 2024
2 parents 76f1a3f + a08ccec commit 6dfad2b
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 20 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Release Notes for Craft Commerce

## Unreleased

- Fixed a bug where some text wasn’t getting translated on the Edit Order page.
- Fixed a JavaScript error that could occur when editing an order.

## 4.6.11 - 2024-09-10

- Fixed XSS vulnerabilities.

## 4.6.10 - 2024-08-28

- Fixed a PHP error that could occur when default addresses were set on a cart. ([#3641](https://github.com/craftcms/commerce/issues/3641))
Expand Down
17 changes: 9 additions & 8 deletions src/elements/traits/OrderElementTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use craft\elements\db\ElementQueryInterface;
use craft\elements\exporters\Expanded as CraftExpanded;
use craft\helpers\ArrayHelper;
use craft\helpers\Html;
use craft\models\FieldLayout;
use Exception;

Expand Down Expand Up @@ -77,35 +78,35 @@ protected function tableAttributeHtml(string $attribute): string
}
case 'shippingFullName':
{
return $this->getShippingAddress() ? $this->getShippingAddress()->fullName ?? '' : '';
return $this->getShippingAddress() ? Html::encode($this->getShippingAddress()->fullName ?? '') : '';
}
case 'shippingFirstName':
{
return $this->getShippingAddress() ? $this->getShippingAddress()->firstName ?? '' : '';
return $this->getShippingAddress() ? Html::encode($this->getShippingAddress()->firstName ?? '') : '';
}
case 'shippingLastName':
{
return $this->getShippingAddress() ? $this->getShippingAddress()->lastName ?? '' : '';
return $this->getShippingAddress() ? Html::encode($this->getShippingAddress()->lastName ?? '') : '';
}
case 'billingFullName':
{
return $this->getBillingAddress() ? $this->getBillingAddress()->fullName ?? '' : '';
return $this->getBillingAddress() ? Html::encode($this->getBillingAddress()->fullName ?? '') : '';
}
case 'billingFirstName':
{
return $this->getBillingAddress() ? $this->getBillingAddress()->firstName ?? '' : '';
return $this->getBillingAddress() ? Html::encode($this->getBillingAddress()->firstName ?? '') : '';
}
case 'billingLastName':
{
return $this->getBillingAddress() ? $this->getBillingAddress()->lastName ?? '' : '';
return $this->getBillingAddress() ? Html::encode($this->getBillingAddress()->lastName ?? '') : '';
}
case 'shippingOrganizationName':
{
return $this->getShippingAddress()->organization ?? '';
return $this->getShippingAddress() ? Html::encode($this->getShippingAddress()->organization ?? '') : '';
}
case 'billingOrganizationName':
{
return $this->getBillingAddress()->organization ?? '';
return $this->getBillingAddress() ? Html::encode($this->getBillingAddress()->organization ?? '') : '';
}
case 'shippingMethodName':
{
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/commerceui/dist/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/commerceui/dist/js/app.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/web/assets/commerceui/src/js/order/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ window.OrderDetailsApp = new Vue({
this.$store
.dispatch('recalculateOrder', draft)
.then(() => {
this.$store.dispatch('displayNotice', 'Order recalculated.');
this.$store.dispatch(
'displayNotice',
this.$options.filters.t('Order recalculated.', 'commerce')
);
})
.catch((error) => {
this.$store.dispatch('displayError', error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand Down
10 changes: 8 additions & 2 deletions src/web/assets/commerceui/src/js/order/apps/OrderDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand All @@ -242,7 +245,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand Down
25 changes: 20 additions & 5 deletions src/web/assets/commerceui/src/js/order/apps/OrderMeta.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand All @@ -373,7 +376,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand All @@ -394,7 +400,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand Down Expand Up @@ -450,7 +459,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand All @@ -476,7 +488,10 @@
.then(() => {
this.$store.dispatch(
'displayNotice',
'Order recalculated.'
this.$options.filters.t(
'Order recalculated.',
'commerce'
)
);
})
.catch((error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
},
isLoadMoreVisible() {
if (!this.$store.state.draft.order.customer) {
return false;
}
if (
this.$store.state.draft.order.customer.totalAddresses ==
this.addresses.length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
</template>
<template v-else>
<div class="w-1/5">
<span class="adjustment-type">{{ type }}</span>
<span class="adjustment-type">{{ getTypeName(type) }}</span>
</div>
<div class="w-4/5 order-flex">
<div class="w-2/3">
Expand Down Expand Up @@ -231,6 +231,18 @@
};
},
methods: {
getTypeName(type) {
for (let i = 0; i < this.adjustmentOptions.length; i++) {
if (this.adjustmentOptions[i].value === type) {
return this.adjustmentOptions[i].label;
}
}
return type;
},
},
computed: {
...mapGetters(['getErrors']),
Expand Down

0 comments on commit 6dfad2b

Please sign in to comment.