1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-30 09:39:55 +02:00

datestamp wasn't being converted correctly by admin_ui. Temporary fix. Auto-datestamp now only active when no value is present.

This commit is contained in:
CaMer0n
2009-12-24 22:36:34 +00:00
parent b019c110d0
commit 8b55fb138b
2 changed files with 16 additions and 8 deletions

View File

@@ -2511,21 +2511,29 @@ class e_admin_controller_ui extends e_admin_controller
*/
protected function convertToData(&$data)
{
$model = new e_model($data);
$data = $model->getData();
foreach ($this->getFields() as $key => $attributes)
{
$value = vartrue($attributes['dataPath']) ? $model->getData($attributes['dataPath']) : $model->get($data[$key]);
if(null === $value)
{
continue;
//FIXME - value appears to always be NULL.
// continue;
}
switch($attributes['type'])
{
case 'datestamp':
$value = $data[$key]; //FIXME temporary fix so that dates are converted
if(!is_numeric($value))
{
$value = trim($value) ? e107::getDateConvert()->toTime($value, 'input') : 0;
$value = trim($value) ? e107::getDateConvert()->toTime($value, 'input') : 0;
}
$data[$key] = $value; //FIXME temporary fix so that date is actually saved.
break;
case 'ip': // TODO - ask Steve if this check is required
@@ -2535,10 +2543,10 @@ class e_admin_controller_ui extends e_admin_controller
}
break;
}
}
$data = $model->getData();
unset($model);
unset($model);
$this->toData($data);
}