Paul,

Thank you very much for the information.
This is my quick jab at a function in include/citrus_base.php

function currency_format ($value, $flags = '%!i') {
     $result = false;
     global $currency_format;
     $input = preg_replace('/[,]/', '', $value);
     if ( is_numeric( $input ) ) {
         $value = $input;
     }

     $oldLocale = setlocale(LC_MONETARY, '0');
     setlocale(LC_MONETARY, $currency_format);
     $result = money_format($flags, $value);
     setlocale(LC_MONETARY, $oldLocale);

     return $result;
}

In include/config.inc.php used a locale variable:
$currency_format = 'ja_JP';

It took more time to replace the sprintf... For that I have a diff file 
for citrusdb-2.4.2, if anyone is interested.  There were other changes 
to the SQL file for Japan but, those are off topic?

Bryan


On 2012-08-25 23:42, Paul Yasi wrote:
> The variable should go into the config.inc.php and you are right that
> kind of function can go into citrus_base.php
>
> Paul
>
> On Thu, Aug 23, 2012 at 5:04 AM, bryan <br...@inter.net> wrote:
>> Paul,
>>
>> You have probably been asked this before...
>> To introduce a function where would I put it?
>>    include/citrus_base.php ?
>>
>> I need to change the currency format for Japanese Yen.  Which 
>> doesn't
>> use decimals.
>> So I thought that a function that formats depending on a variable in
>> include/config.inc.php
>> would be more flexible than changing all the sprintf each type.
>>
>> $billedamount = sprintf("%.2f",$myresult['d_billed_amount']);
>> ==>
>> $billedamount = sprintf("%d",$myresult['d_billed_amount']);
>>
>> Of course instead I would need to change all those to the function 
>> name
>> but only once.
>> One installation uses US dollars and the other Japanese Yen.
>>
>> $billedamount = currency_format($myresult['d_billed_amount']);
>>
>>
>>
>> 
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. 
>> Discussions
>> will include endpoint security, mobile security and the latest in 
>> malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Citrusdb-users mailing list
>> Citrusdb-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/citrusdb-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Citrusdb-users mailing list
Citrusdb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/citrusdb-users

Reply via email to