mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +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)
|
protected function convertToData(&$data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$model = new e_model($data);
|
$model = new e_model($data);
|
||||||
|
$data = $model->getData();
|
||||||
foreach ($this->getFields() as $key => $attributes)
|
foreach ($this->getFields() as $key => $attributes)
|
||||||
{
|
{
|
||||||
$value = vartrue($attributes['dataPath']) ? $model->getData($attributes['dataPath']) : $model->get($data[$key]);
|
$value = vartrue($attributes['dataPath']) ? $model->getData($attributes['dataPath']) : $model->get($data[$key]);
|
||||||
|
|
||||||
if(null === $value)
|
if(null === $value)
|
||||||
{
|
{
|
||||||
continue;
|
//FIXME - value appears to always be NULL.
|
||||||
|
// continue;
|
||||||
}
|
}
|
||||||
switch($attributes['type'])
|
switch($attributes['type'])
|
||||||
{
|
{
|
||||||
case 'datestamp':
|
case 'datestamp':
|
||||||
|
$value = $data[$key]; //FIXME temporary fix so that dates are converted
|
||||||
|
|
||||||
if(!is_numeric($value))
|
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;
|
break;
|
||||||
|
|
||||||
case 'ip': // TODO - ask Steve if this check is required
|
case 'ip': // TODO - ask Steve if this check is required
|
||||||
@@ -2535,10 +2543,10 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$data = $model->getData();
|
|
||||||
unset($model);
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($model);
|
||||||
$this->toData($data);
|
$this->toData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* Form Handler
|
* Form Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||||
* $Revision: 1.103 $
|
* $Revision: 1.104 $
|
||||||
* $Date: 2009-12-23 15:12:13 $
|
* $Date: 2009-12-24 22:36:34 $
|
||||||
* $Author: secretr $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1356,7 +1356,7 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'datestamp':
|
case 'datestamp':
|
||||||
if(vartrue($parms['auto']))
|
if(vartrue($parms['auto']) && ($value == null))
|
||||||
{
|
{
|
||||||
$value = time();
|
$value = time();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user