[interchange-cvs] interchange - heins modified 7 files

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Thu Jan 23 14:19:03 2003


User:      heins
Date:      2003-01-23 19:18:47 GMT
Modified:  code/SystemTag currency.coretag salestax.coretag
Modified:           subtotal.coretag total_cost.coretag
Modified:  lib/Vend Config.pm Dispatch.pm Interpolate.pm
Log:
* Fix various bugs and problems in Locale settings.

  -- Prevent permanent change of setlocale when just making a setting.
  -- Use proper key in setting of ExecutionLocale.

* Add locale=xx_XX capability for [currency ...], [salestax ...], [subtotal ...],
  [shipping ...], [handling ...], and [total-cost ...]. This will with any
  luck prevent the need for a [setlocale ....] in most situations.

Revision  Changes    Path
1.2       +3 -2      interchange/code/SystemTag/currency.coretag


rev 1.2, prev_rev 1.1
Index: currency.coretag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/currency.coretag,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- currency.coretag	29 Jan 2002 05:52:38 -0000	1.1
+++ currency.coretag	23 Jan 2003 19:18:47 -0000	1.2
@@ -1,10 +1,11 @@
 UserTag currency            Order        convert noformat
 UserTag currency            hasEndTag
 UserTag currency            Interpolate
+UserTag currency            addAttr
 UserTag currency            PosNumber    2
 UserTag currency            Routine      <<EOR
 sub {
-	my($convert,$noformat,$amount) = @_;
-	return Vend::Util::currency($amount, $noformat, $convert);
+	my($convert,$noformat,$opt,$amount) = @_;
+	return Vend::Util::currency($amount, $noformat, $convert, $opt);
 }
 EOR



1.3       +1 -1      interchange/code/SystemTag/salestax.coretag


rev 1.3, prev_rev 1.2
Index: salestax.coretag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/salestax.coretag,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- salestax.coretag	28 Jul 2002 05:28:13 -0000	1.2
+++ salestax.coretag	23 Jan 2003 19:18:47 -0000	1.3
@@ -6,6 +6,6 @@
 UserTag salestax            Routine <<EOR
 sub {
 	my($cart, $noformat, $opt) = @_;
-	return currency( salestax($cart, $opt), $noformat);
+	return currency( salestax($cart, $opt), $noformat, undef, $opt);
 }
 EOR



1.2       +3 -2      interchange/code/SystemTag/subtotal.coretag


rev 1.2, prev_rev 1.1
Index: subtotal.coretag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/subtotal.coretag,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- subtotal.coretag	29 Jan 2002 05:52:38 -0000	1.1
+++ subtotal.coretag	23 Jan 2003 19:18:47 -0000	1.2
@@ -1,10 +1,11 @@
 UserTag subtotal            Order        name noformat
 UserTag subtotal            attrAlias    cart name
+UserTag subtotal            addAttr
 UserTag subtotal            InvalidateCache
 UserTag subtotal            PosNumber    2
 UserTag subtotal            Routine <<EOR
 sub {
-	my($cart, $noformat) = @_;
-	return currency( subtotal($cart), $noformat);
+	my($cart, $noformat, $opt) = @_;
+	return currency( subtotal($cart), $noformat, undef, $opt);
 }
 EOR



1.2       +3 -2      interchange/code/SystemTag/total_cost.coretag


rev 1.2, prev_rev 1.1
Index: total_cost.coretag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/total_cost.coretag,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- total_cost.coretag	29 Jan 2002 05:52:38 -0000	1.1
+++ total_cost.coretag	23 Jan 2003 19:18:47 -0000	1.2
@@ -2,9 +2,10 @@
 UserTag total-cost          attrAlias    cart name
 UserTag total-cost          InvalidateCache
 UserTag total-cost          PosNumber    2
+UserTag total-cost          addAttr
 UserTag total-cost          Routine <<EOR
 sub {
-	my($cart, $noformat) = @_;
-	return currency( total_cost($cart), $noformat);
+	my($cart, $noformat, $opt) = @_;
+	return currency( total_cost($cart), $noformat, undef, $opt);
 }
 EOR



2.95      +5 -10     interchange/lib/Vend/Config.pm


rev 2.95, prev_rev 2.94
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.94
retrieving revision 2.95
diff -u -r2.94 -r2.95
--- Config.pm	13 Jan 2003 22:57:51 -0000	2.94
+++ Config.pm	23 Jan 2003 19:18:47 -0000	2.95
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.94 2003/01/13 22:57:51 mheins Exp $
+# $Id: Config.pm,v 2.95 2003/01/23 19:18:47 mheins Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 # Copyright (C) 2003 ICDEVGROUP <interchange@icdevgroup.org>
@@ -46,7 +46,7 @@
 use Vend::Util;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.94 $, 10);
+$VERSION = substr(q$Revision: 2.95 $, 10);
 
 my %CDname;
 
@@ -2046,15 +2046,8 @@
 		$store = ${"Global::$item" . "_repository"};
 	}
 
-	# Try POSIX first if Locale.
-	$name = POSIX::setlocale(POSIX::LC_ALL, $settings)
-		if $item eq 'Locale' and $settings !~ /\s/;
-
 	my ($eval, $safe);
-	if ($name and $item eq 'Locale') {
-		$store->{$name} = POSIX::localeconv();
-	}
-	elsif ($settings =~ s/^\s*([-\w.@]+)\s+//) {
+	if ($settings =~ s/^\s*([-\w.@]+)(?:\s+)?//) {
 		$name = $1;
 
 		undef $eval;
@@ -2063,9 +2056,11 @@
 				and $eval = 1;
 		$eval and ! $safe and $safe = new Safe;
 		if(! defined $store->{$name} and $item eq 'Locale') {
+		    my $past = POSIX::setlocale(POSIX::LC_ALL);
 			if(POSIX::setlocale(POSIX::LC_ALL, $name) ) {
 				$store->{$name} = POSIX::localeconv();
 			}
+			POSIX::setlocale($past);
 		}
 
 		my($sethash);



1.9       +3 -3      interchange/lib/Vend/Dispatch.pm


rev 1.9, prev_rev 1.8
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Dispatch.pm	14 Jan 2003 02:25:53 -0000	1.8
+++ Dispatch.pm	23 Jan 2003 19:18:47 -0000	1.9
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.8 2003/01/14 02:25:53 mheins Exp $
+# $Id: Dispatch.pm,v 1.9 2003/01/23 19:18:47 mheins Exp $
 #
 # Copyright (C) 2002 ICDEVGROUP <interchange@icdevgroup.org>
 # Copyright (C) 2002 Mike Heins <mike@perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.8 $, 10);
+$VERSION = substr(q$Revision: 1.9 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -983,7 +983,7 @@
 
 	chdir $Vend::Cfg->{VendRoot} 
 		or die "Couldn't change to $Vend::Cfg->{VendRoot}: $!\n";
-	POSIX::setlocale('LC_ALL', $Vend::Cfg->{ExecutionLocale});
+	POSIX::setlocale(POSIX::LC_ALL, $Vend::Cfg->{ExecutionLocale});
 	set_file_permissions();
 # STATICPAGE
 	tie_static_dbm() if $Vend::Cfg->{StaticDBM};



2.144     +3 -3      interchange/lib/Vend/Interpolate.pm


rev 2.144, prev_rev 2.143
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.143
retrieving revision 2.144
diff -u -r2.143 -r2.144
--- Interpolate.pm	20 Jan 2003 18:59:17 -0000	2.143
+++ Interpolate.pm	23 Jan 2003 19:18:47 -0000	2.144
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.143 2003/01/20 18:59:17 jon Exp $
+# $Id: Interpolate.pm,v 2.144 2003/01/23 19:18:47 mheins Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.143 $, 10);
+$VERSION = substr(q$Revision: 2.144 $, 10);
 
 @EXPORT = qw (
 
@@ -6448,7 +6448,7 @@
 		$out = Vend::Util::round_to_frac_digits($out);
 		## Conversion would have been done above, force to 0, as
 		## found by Frederic Steinfels
-		$out = currency($out, $opt->{noformat}, 0);
+		$out = currency($out, $opt->{noformat}, 0, $opt);
 	}
 	return $out unless $opt->{hide};
 	return;