eAuction
  Not just another Perl script
Google
Welcome, Guest. Please Login or Register


If you use eAuction a lot and like it or if you make money from eAuction or from eAuction-related activities ...
then the project asks you for a donation in favor of the further development.



The forums are protected by
AccessControl
(written by Dieter Werner)
Click here if you want to check your IP against the most important RBLs of the net.
Click here in order to visite the AccessControl forums.


<< Visit the international e Auction Marketplace >>
Buy and sell PC and Consumer Electronic components






  HomeHelpSearchLoginRegister
 



Pages: 1
Currency and decimal/comma position (Read 293 times)
agamoto
Ex Member




Currency and decimal/comma position
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:

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Take care,

Trent





Back to top
 
 


Advertising
  IP Logged
Dieter Werner
Administrator
*****
Offline

Dipl. Paranoiac ®

Posts: 1162
Germany
Gender: male
Re: Currency and decimal/comma position
Reply #1 - 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;
} 



Back to top
 
« Last Edit: 10/04/05 at 10:06:40 by Dieter Werner »  

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Greetings from Germany
Dieter Werner




Advertising
View Profile | WWW   IP Logged
Pages: 1


If you like eAuction, please Rate it.
If you don't like eAuction, please Rate it too.


1 is being poor and 10 is being excellent


EveryScript

ip-location


AccessControl - Members Only