Checkbox "Create new revision on update" always on by default. But I don't want to waste database with many revisions of one order. How I can disable "Create new revision on update" checked as default?

Comments

murz’s picture

Title: Disable creating new revisions each time on save » Disable creating new order revisions each time on save
rszrama’s picture

Status: Active » Fixed

You'll need to use hook_form_alter() to change the #default_value of that checkbox. It also happens each time a product is added to / removed from the cart.

murz’s picture

Will be good to add this as option in settings, because there are too much revisions created, but, I think, only very small percents of users review and use revisions.

murz’s picture

Using hook_form_alter() to change the #default_value helps to disable creating new revisions when a product is added to / removed from the cart, or I must do additional hooks for change this?

rszrama’s picture

Category: support » feature

It would require additional integration b/c those revisions are specified elsewhere. Let's make this a feature request; it wouldn't hurt to have an option for this.

rszrama’s picture

Status: Fixed » Active

Confirmed this idea with Damien; I'll add an option to the order settings page to switch the default behavior of revisions for Orders. It will still default to create a new revision on every change / edit, but you'll be able to toggle this with a checkbox.

mr.baileys’s picture

Status: Active » Needs review
StatusFileSize
new19.05 KB
new5.41 KB

Patch attached adds a checkbox to the "Order settings"-form that allows users to toggle the automatic creation of revisions on/off:

Screenshot.png

murz’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, I test it and all works normally! Will be good to see this option in core.

rszrama’s picture

Status: Reviewed & tested by the community » Fixed

Noticed during manual testing that this wasn't trapping the revision created when a customer cancels checkout. Turns out we were manually setting the revision / log properties on the order in a few form submit handlers to avoid a separate call to commerce_order_status_update(). I wrapped the code in the submit handlers with an if check on the new variable, and everything tests out great now!

Thanks again, Ivo. : )

Commit: http://drupalcode.org/project/commerce.git/commitdiff/c242133

Potential follow-up commit would be to add an option to the order status update action so you can force a new revision even when the default is not to. For the sake of time, I didn't go ahead and do this myself.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.