Fixes in moneyfield and dateform
This commit is contained in:
parent
be28b150ac
commit
2ca8e2ac3f
2 changed files with 13 additions and 3 deletions
|
|
@ -18,11 +18,15 @@ class MoneyField extends DoubleField{
|
||||||
}
|
}
|
||||||
|
|
||||||
function check($value)
|
function check($value)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(strpos($value, ','))
|
||||||
{
|
{
|
||||||
|
|
||||||
$value=str_replace('.', '', $value);
|
$value=str_replace('.', '', $value);
|
||||||
|
|
||||||
$value=str_replace(',', '.', $value);
|
$value=str_replace(',', '.', $value);
|
||||||
|
}
|
||||||
|
|
||||||
$value=parent::check($value);
|
$value=parent::check($value);
|
||||||
return round($value, 2);
|
return round($value, 2);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class DateForm extends \PhangoApp\PhaModels\Forms\BaseForm {
|
||||||
|
|
||||||
public $set_time=1;
|
public $set_time=1;
|
||||||
public $see_title=0;
|
public $see_title=0;
|
||||||
|
public $utc=true;
|
||||||
|
|
||||||
function form()
|
function form()
|
||||||
{
|
{
|
||||||
|
|
@ -40,10 +41,15 @@ class DateForm extends \PhangoApp\PhaModels\Forms\BaseForm {
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->utc)
|
||||||
{
|
{
|
||||||
|
|
||||||
$value=PhaTime\DateTime::gmt_to_local($value);
|
$value=PhaTime\DateTime::gmt_to_local($value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
list($year, $month, $day, $hour, $minute, $second)=PhaTime\DateTime::format_timedata($value);
|
list($year, $month, $day, $hour, $minute, $second)=PhaTime\DateTime::format_timedata($value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue