-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backport 2.2] Translate order getCreatedAtFormatted() to store locale #11422
Conversation
@@ -213,6 +215,11 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface | |||
protected $_currencyFactory; | |||
|
|||
/** | |||
* @var \Magento\Eav\Model\Config | |||
*/ | |||
private $_eavConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a new variable you do not need the _
at the beginning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't a new variable, just a missing phpdoc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In version 2.2-develop
of this file there is no such variable. https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Sales/Model/Order.php It seems be have been added to develop
in you original PR. I wonder if it is a left over from when the file was created. I will see what I can find out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmanners I remember, variable was already there but never declared as a property.
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Sales/Model/Order.php#L338
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup seems to be. My guess is we can remove the property and the mapping but leave the injection for BiC reasons. But I will dig a bit deeper to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, ping me if you need any changes done in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup so this looks like a left over from the M1 approach of doing things. I cannot find a usage in this class and in the history it was last changed 4 years ago. I would suggest you can remove the new property, remove the assignment in the constructor $this->_eav
and add the tag @SuppressWarnings(PHPMD.UnusedFormalParameter)
to the constructor phpdocs.
@@ -213,6 +215,11 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface | |||
protected $_currencyFactory; | |||
|
|||
/** | |||
* @var \Magento\Eav\Model\Config | |||
*/ | |||
private $_eavConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup so this looks like a left over from the M1 approach of doing things. I cannot find a usage in this class and in the history it was last changed 4 years ago. I would suggest you can remove the new property, remove the assignment in the constructor $this->_eav
and add the tag @SuppressWarnings(PHPMD.UnusedFormalParameter)
to the constructor phpdocs.
@dmanners I removed the variable and added the |
@dmanners Can you proceed merging? Would love to see this released in 2.2.2 |
@@ -310,7 +318,6 @@ public function __construct( | |||
\Magento\Catalog\Model\Product\Visibility $productVisibility, | |||
\Magento\Sales\Api\InvoiceManagementInterface $invoiceManagement, | |||
\Magento\Directory\Model\CurrencyFactory $currencyFactory, | |||
\Magento\Eav\Model\Config $eavConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you cannot remove the injection via the __constuct
without this breaking BC but you can remove the setting of $this->_eavConfig = $eavConfig;
which you have done. If you add back this to the construct and docblock the rest seems fine to me
2559e0c
to
02bc892
Compare
@JeroenVanLeusden while testing this our team found the following.
It seems that in the testing process both the branch for this PR and the |
@dmanners Will find some time this week to check this. Will ping you with the results! |
Thanks @JeroenVanLeusden if you get stuck and need some help feel free to drop me a message here on in the engcom slack. |
@dmanners I've reproduced using the following steps:
Using the DE language pack will give me the same results. http://cloud.h-o.nl/nmZE and with patch http://cloud.h-o.nl/nnBu This is tested from commit d2cbddd |
Thank you for the update @JeroenVanLeusden will keep you updated on the progress. |
@dmanners I've been able to reproduce it using the following steps:
|
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-83552: save invoice ID on credit memo when using API method salesRefundInvoiceV1 #11670 - MAGETWO-82577: [Backport 2.2] Translate order getCreatedAtFormatted() to store locale #11422 - MAGETWO-84474: 10128: New Orders not being saved to order grid #12241 - MAGETWO-83783: Shipping method fixtures not compatible with getShippingMethod(true) in OrderCreateTest #12227 - MAGETWO-83290: Add swatch option: Prevent loosing data and default value if data is not populated via adminhtml #12036 - MAGETWO-83741: 11740: Sending emails from Admin in Multi-Store Environment defaults to Primary Store #11992 - MAGETWO-83399: Fix for remove 'product_list_toolbar' block from layout in XML #9413 #11473
Description
Backport of version of #10491.
Add
getDefaultStoreLocale()
to allow fetching scoped values. Use this ingetCreatedAtFormatted()
socreated_at
date of order will be translated in emails to locale being used in that store view.Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist