The eAuction Support Forums
https://www.everyscript.de/cgi-bin/yabb/YaBB.pl
eAuction 1.6.1.x >> Start Up and more >> Currency and decimal/comma position
https://www.everyscript.de/cgi-bin/yabb/YaBB.pl?num=1108939806

Message started by agamoto on 02/20/05 at 23:50:05

Title: Currency and decimal/comma position
Post by agamoto on 02/20/05 at 23:50:05

Hi Dieter!

How's Germany?

What a great script!

I've modified the language from German to Indonesian, and I'll be happy to upload that language pack to you later if you want.

I'm having a bit of a problem though. In Indonesia they use the Rupiah which is 9000 to the US dollar... That makes for some large prices and the script seems to be having difficulty with them, or perhaps I screwed something up.

For example:

10000000 or 10,000,000.00 appears as 100,00,000.00
1000000 or 10,000,000.00 appears as 100,0,000.00

Everything below 6 digit numbers appears fine, just with those troublesome two decimal places.

As 1 rupiah is worth far less than a cent I want to eliminate "cents", and thus the decimal and two places altogether...

When they are displayed... when anyone inputs into bidding or posting forms... everywhere gone. Is this easy to do?

I've tried turning allow cents on and off, but that doesn't do anything for me and changing the country just switches the comma and decimal. I'm stumped!

You can see here:

http://wolodko.net/auction/eAuction.pl

Take care,

Trent






Title: Re: Currency and decimal/comma position
Post by Dieter Werner on 03/04/05 at 14:02:49

Sorry for the delay ...
but I couldn't find the time to check this out.

This should be the soluten:
in eConfig161.pl set $config{'allow_cent'} = 0

in sub check_item_data replace the $config{'currency'} block with this

Code:

   $config{'currency'} == 0
       ?   do { # USA
               $config{'allow_cent'} == 1
                   ?   ($pattern = qr/(\d*\W*\d{1,3})$/)
                   :   ($pattern = qr/(\d*\W*\d{1,3})$/);
           }
       :   do {
               $config{'allow_cent'} == 1
                   ?   ($pattern = qr/(\d*\W*\d{1,3})$/)
                   :   ($pattern = qr/(\d*\W*\d{1,3})$/);
           };


in sub proc_bid replace the block $config{'currency'} ...

Code:

       $config{'currency'} == 1  
     ?   do {                
           $config{'allow_cent'} == 1
               ?       do {                      
                     $form{'BID'} !~ /(\d*\D*\d{1,3}\,{1}\d{2})$/ && do {
                               close LOCK;
                               unlink "$config{'basepath'}$form{'ITEM'}_lock.dat" or die $!;
                               oops($txt{'You must enter a valid bid amount'})
                     };
                 }
               :      do {
                     $form{'BID'} !~ /(\d*\D*\d{1,3})$/ && do {
                               close LOCK;
                               unlink "$config{'basepath'}$form{'ITEM'}_lock.dat" or die $!;
                               oops($txt{'You must enter a valid bid amount'})
                     };
                 };
         }  
     :   do {
           $config{'allow_cent'} == 1
               ?       do {
                     $form{'BID'} !~ /(\d*\D*\d{1,3}\.{1}\d{2})$/ && do {
                               close LOCK;
                               unlink "$config{'basepath'}$form{'ITEM'}_lock.dat" or die $!;
                               oops($txt{'You must enter a valid bid amount'})
                     };
                 }
               :      do {
                     $form{'BID'} !~ /(\d*\D*\d{1,3})$/ && do {
                               close LOCK;
                               unlink "$config{'basepath'}$form{'ITEM'}_lock.dat" or die $!;
                               oops($txt{'You must enter a valid bid amount'})
                     };
                 };
         };


replace sub form_amt_dec with this


Code:
sub form_amt_dec {
   my $amt = shift;    
   $amt =~ s/\D//g;    
   $config{'currency'} == 0
       ?   ($amt =~ s/(\d{1,3})(?=(?:\d{3}))/$1\,/g)
       :   do {
               $amt =~ s/(\d{1,3})(?=(?:\d{3}))/$1\./g;
               $amt =~ s/(\.(\d{2}))$/\,$2/;
           };

   return $amt;
}



The eAuction Support Forums » Powered by YaBB 2.2!
YaBB © 2000-2007. All Rights Reserved.