// Fixed #PSTEST-450 : number of digits displayed for prices is now 2

This commit is contained in:
bMancone
2012-01-16 14:27:51 +00:00
parent c89b354c53
commit 13ed870bde
3 changed files with 53 additions and 2 deletions
+21
View File
@@ -466,6 +466,27 @@ class SupplyOrderCore extends ObjectModel
return (new SupplyOrder((int)$id));
}
/**
* @see ObjectModel::hydrate()
*/
public function hydrate(array $data, $id_lang = null)
{
$this->id_lang = $id_lang;
if (isset($data[$this->def['primary']]))
$this->id = $data[$this->def['primary']];
foreach ($data as $key => $value)
{
if (array_key_exists($key, $this))
{
// formats prices and floats
if ($this->def['fields'][$key]['validate'] == 'isFloat' ||
$this->def['fields'][$key]['validate'] == 'isPrice')
$value = number_format($value, 2);
$this->$key = $value;
}
}
}
/*********************************\
*
* Webservices Specific Methods
+23 -1
View File
@@ -313,4 +313,26 @@ class SupplyOrderDetailCore extends ObjectModel
return $errors;
}
}
/**
* @see ObjectModel::hydrate()
*/
public function hydrate(array $data, $id_lang = null)
{
$this->id_lang = $id_lang;
if (isset($data[$this->def['primary']]))
$this->id = $data[$this->def['primary']];
foreach ($data as $key => $value)
{
if (array_key_exists($key, $this))
{
// formats prices and floats
if ($this->def['fields'][$key]['validate'] == 'isFloat' ||
$this->def['fields'][$key]['validate'] == 'isPrice')
$value = number_format($value, 2);
$this->$key = $value;
}
}
}
}