* EventMgr: fixed fatal error eventmgr_merge::number_format() is not defined

This commit is contained in:
Ralf Becker 2011-03-18 15:17:25 +00:00
parent a69151c7f8
commit fd9d3315cd

View File

@ -676,7 +676,7 @@ abstract class bo_merge
if (isset($archive))
{
$zip = new ZipArchive;
if ($zip->open($archive,ZIPARCHIVE::CHECKCONS) !== true)
if ($zip->open($archive,ZIPARCHIVE::CHECKCONS) !== true)
{
error_log(__METHOD__.__LINE__." !ZipArchive::open('$archive',ZIPARCHIVE::CHECKCONS) failed. Trying open without validating");
if ($zip->open($archive) !== true) throw new Exception("!ZipArchive::open('$archive',|ZIPARCHIVE::CHECKCONS)");
@ -711,4 +711,27 @@ abstract class bo_merge
}
common::egw_exit();
}
/**
* Format a number according to user prefs with decimal and thousands separator
*
* Reimplemented from etemplate to NOT use user prefs for Excel 2003, which gives an xml error
*
* @param int|float|string $number
* @param int $num_decimal_places=2
* @param string $_mimetype=''
* @return string
*/
static public function number_format($number,$num_decimal_places=2,$_mimetype='')
{
if ((string)$number === '') return '';
//error_log(__METHOD__.$_mimetype);
switch($_mimetype)
{
case 'application/xml': // Excel 2003
case 'application/vnd.oasis.opendocument.spreadsheet': // OO.o spreadsheet
return number_format(str_replace(' ','',$number),$num_decimal_places,'.','');
}
return etemplate::number_format($number,$num_decimal_places);
}
}