Skip to content
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

[4.x]: Sale / Discount set dateUpdated + dateCreated after save #3298

Closed
Anubarak opened this issue Oct 13, 2023 · 2 comments · Fixed by #3301
Closed

[4.x]: Sale / Discount set dateUpdated + dateCreated after save #3298

Anubarak opened this issue Oct 13, 2023 · 2 comments · Fixed by #3301
Assignees
Labels
bug commerce4 Issues related to Commerce v4

Comments

@Anubarak
Copy link

Anubarak commented Oct 13, 2023

What happened?

Description

https://github.com/craftcms/commerce/blob/develop/src/services/Sales.php#L546-L547

https://github.com/craftcms/commerce/blob/4.3.0/src/services/Discounts.php#L753-L754

I need to access the dateUpdated / dateCreated property on Sales / Discounts after I manually save them via custom form on my site. Currently I set those two values in their afterSave events by myself. It would be awesome to be able to remove these events.

Steps to reproduce

  1. Save a sale manually, try to access the dateUpdated / dateCreated attribute and see it's null

Craft CMS version

4.x / 3.x

Craft Commerce version

4.3

@Anubarak Anubarak added commerce4 Issues related to Commerce v4 bug labels Oct 13, 2023
@Anubarak Anubarak changed the title [4.x]: Sale / Discount set date updated after save [4.x]: Sale / Discount set dateUpdated + dateCreated after save Oct 13, 2023
@nfourtythree nfourtythree self-assigned this Oct 13, 2023
lukeholder added a commit that referenced this issue Oct 17, 2023
…et-dateupdated-+-datecreated-after-save

Fixed #3298 population of audit columns on Sales and Discounts after saving
@lukeholder
Copy link
Member

Thanks for reporting @Anubarak - this is fixed and will be in the next release of Commerce. We will let you know here once it is out!

@nfourtythree
Copy link
Contributor

Commerce 4.3.1 has now been released with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants