I had this as a request from one of my clients, and the most sensible way of doing was to actually modify the code. But considering it, it feels that this should be the right approach within Ubercart as well.

It makes sense that CSV reports are to be used with spreadsheets software, and figures are likely to be added/used in formulas, for which it would be extremely useful to have them as plain numbers, and not formatted by any means.

I know this can eventually be achieve by using formulas to strip the formatting out of the column, but maybe is something that might be considered.

Attached is a patched that removes all uc_price() calls from within the csv figures.

a.=

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hanoii’s picture

Version: 6.x-2.0 » 6.x-2.2

Applies to 2.2 as well

hanoii’s picture

Attach better patch using proper $context_csv and the use of uc_price() where it was used before.

And also tax report patch following this same behavior.

hanoii’s picture

Bumping this one up, any comments/ideas?

jkopel’s picture

I just wrote this same patch for the tax report.
My only comment would be to use 'formatted-original' in the $context_csv array to add the uc_price formatting (but not the theming).

jak

hanoii’s picture

Formatted would add the currency, and I think it's not really useful for a CSV report.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense. Patches in #2 work for me except one chunk no longer applies but is easily fixed.

Applying this would also mean #603524: CSV report downloads are missing the UTF-8 byte order mark can be closed.

Island Usurper’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Needs work

If the context format is going to be "original" anyway, there really isn't any reason to use uc_price(). "original" just makes it do a bunch of calculations and then throw away the results.

I would commit the first patch, but it's a good idea to get the tax reports changed the same way.

iamjon’s picture

is there any reason that the first patch hasn't been committed?

Island Usurper’s picture

No, I suppose not. So I've done that, and now I'm working on changing the tax reports patch to not use uc_price() for no reason.

Island Usurper’s picture

Status: Needs work » Fixed
FileSize
1.55 KB

Well, that was quick. Committed to 6.x-2.x.

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Fixed » Patch (to be ported)

Looks like this needs forward porting to 7.x.

iamjon’s picture

That's awesome!!! You guys rock. :)

Island Usurper’s picture

Status: Patch (to be ported) » Fixed

Ported to 7.x-3.x.

Status: Fixed » Closed (fixed)

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