I thought this came up before, but I couldn't find the relevant issue beyond the one that saw the addition of the tax report module. Basically, if a customer places an order when the sales tax was 8% but that tax rate is then changed, any future updates of that order by an administrator will change the stored tax rate. The taxes module recalculates tax line items based on the current tax rate settings when the submit changes button is clicked. This will inappropriately alter the historical tax collection data preserved in the cart and made available through the tax reports.

There needs to be some way to indicate that an order should not have its taxes recalculated, possibly through the extra tax data that was added to tax line items in that previous patch. I imagine it should be time calculated based on the last time a tax rate was established, but that could use some more thinking.

CommentFileSizeAuthor
#2 preserve_taxes.patch1.35 KBIsland Usurper
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR’s picture

Island Usurper’s picture

Status: Active » Needs review
FileSize
1.35 KB

Got a patch rolled up. It checks that the order's state is either 'payment_received' or 'completed', and uses the same tax rates that its current tax line items have stored for recalculating the tax amount. I think it's good to recalculate the taxes even when the rates are the same because this is only triggered when changes to the order have been submitted. Something else may have changed, like the delivery address which could affect the tax amounts. In cases when that happens, the customer must be refunded or billed for the new balance.

codexmas’s picture

Awesome! Good work guys.

mplewis’s picture

Great! Thanks! Is anyone planning to port this back to Ubercart 5.x-1.7? I'd offer to do it myself, but I don't know Ubercart well enough yet.

mplewis’s picture

Here's another related thread - http://drupal.org/node/359544

sammys’s picture

Patch is tested and works as expected. We've already discussed one problem with the patch: A break statement could probably be placed into the upper loop to jump out once a match is made.

Other than that RTBC!

Island Usurper’s picture

Status: Needs review » Fixed

Thanks, sammy. Committed.

Status: Fixed » Closed (fixed)

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