[interchange-cvs] interchange - kwalsh modified lib/Vend/Util.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Feb 16 16:44:11 EST 2006


User:      kwalsh
Date:      2006-02-16 21:44:10 GMT
Modified:  lib/Vend Util.pm
Log:
    * When display="text", make sure that the currency text is always
      displayed before the price value.  The p_cs_precedes value doesn't
      apply to the int_currency_symbol.

    * Make sure that the currency text is separated from the price value,
      just in case the administrator uses something like "GBP", instead
      of "GBP ", in the int_currency_symbol.

Revision  Changes    Path
2.91      +13 -4     interchange/lib/Vend/Util.pm


rev 2.91, prev_rev 2.90
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.90
retrieving revision 2.91
diff -u -r2.90 -r2.91
--- Util.pm	15 Feb 2006 09:27:53 -0000	2.90
+++ Util.pm	16 Feb 2006 21:44:10 -0000	2.91
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.90 2006/02/15 09:27:53 ton Exp $
+# $Id: Util.pm,v 2.91 2006/02/16 21:44:10 kwalsh Exp $
 # 
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -88,7 +88,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.90 $, 10);
+$VERSION = substr(q$Revision: 2.91 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -506,9 +506,18 @@
 		my $cs;
 		my $display = lc($opt->{display}) || 'symbol';
 		my $sep_by_space = $loc->{p_sep_by_space};
+		my $cs_precedes = $loc->{p_cs_precedes};
+
 		if( $loc->{int_currency_symbol} && $display eq 'text' ) {
 			$cs = $loc->{int_currency_symbol};
-			$sep_by_space = 0;
+			$cs_precedes = 1;
+
+			if (length($cs) > 3 || $cs =~ /\W$/) {
+				$sep_by_space = 0;
+			}
+			else {
+				$sep_by_space = 1;
+			}
 		}
 		elsif ( $display eq 'none' ) {
 			$cs = '';
@@ -517,7 +526,7 @@
 			$cs = $loc->{currency_symbol} || '';
 		}
 		if($cs) {
-			if($loc->{p_cs_precedes}) {
+			if ($cs_precedes) {
 				$precede = $cs;
 				$precede = "$precede " if $sep_by_space;
 			}








More information about the interchange-cvs mailing list