Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The commerce order normally saves the REQUEST_TIME of the server in both create time as well as changed time. But this time is the time where the request has been sent. In a single request, there can be a multiple order updates to an order via commerce_order_save(). In those cases, it the $order->changed should not save the created time rather it should pick the time when the order is updated.
Comments
Comment #2
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedCreated a patch which will fix the issue..
Comment #3
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #4
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #5
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #7
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #8
BramDriesenAny motivation of why this is needed? Personally I don't see an issue with using the first timestamp that started the the request to change the order.
Also tests failed to run so re-scheduled them.
Comment #9
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commented@BramDriesen Actually the logic used in commerce_order_save applies only if there is only one order save per request. But if in a single request if we create and update the order, then it should update the changed time as well (indeed I have a requirement like that :) ). But that is not happening here..That is why I created this.
Comment #10
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #11
mglamanLong-running command line requests. The REQUEST_TIME is set from the parent process. Any fork carries the same constant. So an hour-long process uses that initial timestamp, forever.
Comment #12
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #13
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #15
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedThe test passed with PHP 5.4
Comment #16
poornachandran CreditAttribution: poornachandran as a volunteer and at Capgemini commentedComment #17
czigor CreditAttribution: czigor at Centarro commentedI like that the patch in #12 still uses REQUEST_TIME for new orders and time() for order updates. This is ready to be committed.
Comment #18
rszrama CreditAttribution: rszrama at Centarro commentedThanks for the review, committed!