mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +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:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.103 $
|
||||
* $Date: 2009-12-23 15:12:13 $
|
||||
* $Author: secretr $
|
||||
* $Revision: 1.104 $
|
||||
* $Date: 2009-12-24 22:36:34 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1356,7 +1356,7 @@ class e_form
|
||||
break;
|
||||
|
||||
case 'datestamp':
|
||||
if(vartrue($parms['auto']))
|
||||
if(vartrue($parms['auto']) && ($value == null))
|
||||
{
|
||||
$value = time();
|
||||
}
|
||||
|
Reference in New Issue
Block a user