updating controller fixes #3191

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5702 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-09-30 19:30:48 +00:00
parent 66bfa5631a
commit bf651a279e
2 changed files with 12 additions and 1 deletions

View file

@ -966,6 +966,8 @@ class Controller extends Object {
if (isset($this->data[$modelClass][$field . $var])) {
if (!empty($this->data[$modelClass][$field . $var])) {
$time[$var] = $this->data[$modelClass][$field . $var];
} elseif ($this->data[$modelClass][$field . $var] === '0') {
$time[$var] = '00';
}
$useNewDate = true;
unset($this->data[$modelClass][$field . $var]);
@ -1107,7 +1109,7 @@ class Controller extends Object {
} else {
$count = $object->findCount($conditions, $recursive);
}
$pageCount = ceil($count / $limit);
$pageCount = intval(ceil($count / $limit));
if ($page == 'last') {
$options['page'] = $page = $pageCount;

View file

@ -119,6 +119,15 @@ class ControllerTest extends CakeTestCase {
$expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40'));
$this->assertEqual($Controller->data, $expected);
$Controller->data['ControllerPost']['created_hour'] = '13';
$Controller->data['ControllerPost']['created_min'] = '0';
$Controller->data['ControllerPost']['updated_hour'] = '14';
$Controller->data['ControllerPost']['updated_min'] = '40';
$Controller->cleanUpFields();
$expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40'));
$this->assertEqual($Controller->data, $expected);
unset($Controller);
}