[ic] tag_shipping and currency and convert

Peter peter at pajamian.dhs.org
Wed Aug 18 15:29:26 UTC 2010

I noticed this today, not confirmed by any actual testing ...
back in January 2003 we have this commit to tag_shipping:
-               $out = currency($out, $opt->{noformat}, $opt->{convert});
+               ## Conversion would have been done above, force to 0, as
+               ## found by Frederic Steinfels
+               $out = currency($out, $opt->{noformat}, 0);

Ok, so basicalyl it says we've already done currency conversion so
explicitly avoid doing it again by passing 0 to currency instead of
$opt->{convert} ... this is fair enough.

Now, one day later we have this commit:
-       return currency( salestax($cart, $opt), $noformat);
+       return currency( salestax($cart, $opt), $noformat, undef, $opt);

ok, so now we're passing the $opt hash on the end ... which incidentally
includes $opt->{convert}.

Ok, now in November of 2006 we have this:

        * Make sure the "convert" parameter is set correctly, even if
the tag
          is called from the recently modified [price] tag.

... and in the currency tag:
+       $convert ||= $opt->{convert};

so now we're picking up $opt->{convert} again, even if it was explicitly
set to 0 already (which is done on purpose in tag_shipping).

Like I said, I'm not sure if that is actually causing any problems, but
if it is I think the correct fix is to change that last line to:

	$convert = $opt->{convert} unless defined $convert;


More information about the interchange-users mailing list